On Wed, Oct 17, 2012 at 1:29 PM, Ben Pfaff <span dir="ltr"><<a href="mailto:blp@nicira.com" target="_blank">blp@nicira.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Commit c6100d92142b (ovs-ofctl: Accept port keywords, OF1.1 port numbers,<br>
reject port number 0.) intentionally prohibited using port 0, which is not<br>
a valid OpenFlow port number, in OpenFlow commands and actions. However,<br>
since then we have discovered that the NVP controller uses port 0 in<br>
"resubmit" actions and hence in flow matches as well. This seems like a<br>
valid enough use case; after all, the port number in a resubmit action is<br>
really just an arbitrary number that need not (and preferably does not)<br>
refer to an actual OpenFlow port. Therefore, this commit restores the<br>
ability to use port 0.<br>
<br>
(Only functions that parse OpenFlow commands and actions from strings, not<br>
those that interpret binary OpenFlow coming in on OpenFlow connections,<br>
were affected by this prohibition, so this only comes up in corner cases<br>
anyhow.)<br>
<br>
Reported-by: Gurucharan Shetty <<a href="mailto:gshetty@nicira.com">gshetty@nicira.com</a>><br>
Signed-off-by: Ben Pfaff <<a href="mailto:blp@nicira.com">blp@nicira.com</a>><br>
---<br>
NEWS | 2 --<br>
lib/ofp-util.c | 5 +----<br>
tests/<a href="http://ovs-ofctl.at" target="_blank">ovs-ofctl.at</a> | 2 ++<br>
3 files changed, 3 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/NEWS b/NEWS<br>
index d841cb3..30077c0 100644<br>
--- a/NEWS<br>
+++ b/NEWS<br>
@@ -15,8 +15,6 @@ post-v1.8.0<br>
also the recommended way to specify these ports, for compatibility<br>
with OpenFlow 1.1 and later (which use the OpenFlow 1.0 numbers<br>
for these ports for different purposes).<br>
- - Commands and actions that accept port numbers no longer accept port 0,<br>
- which is not a valid port number in OpenFlow 1.0 and later.<br>
- ovs-dpctl:<br>
- Support requesting the port number with the "port_no" option in<br>
the "add-if" command.<br>
diff --git a/lib/ofp-util.c b/lib/ofp-util.c<br>
index 419a1cd..34255da 100644<br>
--- a/lib/ofp-util.c<br>
+++ b/lib/ofp-util.c<br>
@@ -3562,10 +3562,7 @@ ofputil_port_from_string(const char *s, uint16_t *portp)<br>
<br>
*portp = 0;<br>
if (str_to_uint(s, 10, &port32)) {<br>
- if (port32 == 0) {<br>
- VLOG_WARN("port 0 is not a valid OpenFlow port number");<br>
- return false;<br>
- } else if (port32 < OFPP_MAX) {<br>
+ if (port32 < OFPP_MAX) {<br>
*portp = port32;<br>
return true;<br>
} else if (port32 < OFPP_FIRST_RESV) {<br>
diff --git a/tests/<a href="http://ovs-ofctl.at" target="_blank">ovs-ofctl.at</a> b/tests/<a href="http://ovs-ofctl.at" target="_blank">ovs-ofctl.at</a><br>
index 8185827..f800da1 100644<br>
--- a/tests/<a href="http://ovs-ofctl.at" target="_blank">ovs-ofctl.at</a><br>
+++ b/tests/<a href="http://ovs-ofctl.at" target="_blank">ovs-ofctl.at</a><br>
@@ -11,6 +11,7 @@ udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1<br>
cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller<br>
actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note<br>
actions=set_field:fe80:0123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src<br>
+in_port=0 actions=resubmit:0<br>
]])<br>
<br>
AT_CHECK([ovs-ofctl parse-flows flows.txt<br>
@@ -26,6 +27,7 @@ OFPT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1<br>
OFPT_FLOW_MOD: ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535<br>
OFPT_FLOW_MOD: ADD actions=note:41.42.43.00.00.00,note:00.01.02.03.04.05.06.07.00.00.00.00.00.00,note:00.00.00.00.00.00<br>
OFPT_FLOW_MOD: ADD actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[0..63],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[64..127]<br>
+OFPT_FLOW_MOD: ADD in_port=0 actions=resubmit:0<br>
]])<br>
AT_CLEANUP<br>
<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div>Looks good to me.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888">
--<br>
1.7.2.5<br>
<br>
</font></span></blockquote></div><br>