diff options
author | Ben Pfaff <blp@nicira.com> | 2012-05-07 14:01:57 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2012-05-14 12:47:44 -0700 |
commit | 58a1590cb3da958cc0d1407dcc83d48c1e893c14 (patch) | |
tree | 945f874ecdf8a40fa4ff4ba0245a72cdf5a03e05 | |
parent | 211f89447bd7602c26a7d86d01d40ef433e8c0da (diff) |
ofproto: Treat a packet-out in_port of OFPP_CONTROLLER as OFPP_NONE.
Some OpenFlow 1.0 controllers incorrectly use OPFP_CONTROLLER as the
in_port in packet-out messages, when OFPP_NONE is their intent. Until now,
Open vSwitch has rejected such requests with an error message. This commit
makes Open vSwitch instead treat OFPP_CONTROLLER the same as OFPP_NONE for
compatibility with those controllers.
(Also, as of this writing, OpenFlow 1.0.1 appears to be changing the port
to use from OFPP_NONE to OFPP_CONTROLLER.)
Suggested-by: Rob Sherwood <rob.sherwood@bigswitch.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
-rw-r--r-- | lib/odp-util.c | 2 | ||||
-rw-r--r-- | lib/ofp-util.h | 2 | ||||
-rw-r--r-- | ofproto/ofproto-provider.h | 23 | ||||
-rw-r--r-- | ofproto/ofproto.c | 3 |
4 files changed, 25 insertions, 5 deletions
diff --git a/lib/odp-util.c b/lib/odp-util.c index 110b60be..f2cf12c4 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -1157,7 +1157,7 @@ odp_flow_key_from_flow(struct ofpbuf *buf, const struct flow *flow) nl_msg_put_be64(buf, OVS_KEY_ATTR_TUN_ID, flow->tun_id); } - if (flow->in_port != OFPP_NONE) { + if (flow->in_port != OFPP_NONE && flow->in_port != OFPP_CONTROLLER) { nl_msg_put_u32(buf, OVS_KEY_ATTR_IN_PORT, ofp_port_to_odp_port(flow->in_port)); } diff --git a/lib/ofp-util.h b/lib/ofp-util.h index 13195c76..971331a5 100644 --- a/lib/ofp-util.h +++ b/lib/ofp-util.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks. + * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index 6dd206b9..263b5758 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -871,8 +871,27 @@ struct ofproto_class { * * 'flow' reflects the flow information for 'packet'. All of the * information in 'flow' is extracted from 'packet', except for - * flow->in_port, which is taken from the OFPT_PACKET_OUT message. - * flow->tun_id and its register values are zeroed. + * flow->in_port (see below). flow->tun_id and its register values are + * zeroed. + * + * flow->in_port comes from the OpenFlow OFPT_PACKET_OUT message. The + * implementation should reject invalid flow->in_port values by returning + * OFPERR_NXBRC_BAD_IN_PORT. For consistency, the implementation should + * consider valid for flow->in_port any value that could possibly be seen + * in a packet that it passes to connmgr_send_packet_in(). Ideally, even + * an implementation that never generates packet-ins (e.g. due to hardware + * limitations) should still allow flow->in_port values for every possible + * physical port and OFPP_LOCAL. The only virtual ports (those above + * OFPP_MAX) that the caller will ever pass in as flow->in_port, other than + * OFPP_LOCAL, are OFPP_NONE and OFPP_CONTROLLER. The implementation + * should allow both of these, treating each of them as packets generated + * by the controller as opposed to packets originating from some switch + * port. + * + * (Ordinarily the only effect of flow->in_port is on output actions that + * involve the input port, such as actions that output to OFPP_IN_PORT, + * OFPP_FLOOD, or OFPP_ALL. flow->in_port can also affect Nicira extension + * "resubmit" actions.) * * 'packet' is not matched against the OpenFlow flow table, so its * statistics should not be included in OpenFlow flow statistics. diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 766646db..bdf82a18 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1873,7 +1873,8 @@ handle_packet_out(struct ofconn *ofconn, const struct ofp_header *oh) * we do know that only certain reserved ports (numbered OFPP_MAX and * above) are valid. */ in_port = ntohs(opo->in_port); - if (in_port >= OFPP_MAX && in_port != OFPP_LOCAL && in_port != OFPP_NONE) { + if (in_port >= OFPP_MAX && in_port != OFPP_LOCAL && in_port != OFPP_NONE + && in_port != OFPP_CONTROLLER) { return ofp_mkerr_nicira(OFPET_BAD_REQUEST, NXBRC_BAD_IN_PORT); } |