[ovs-dev] [PATCH] openflow: Print in_port as string for reserved/special ports.
Gurucharan Shetty
shettyg at nicira.com
Wed Jan 9 00:08:54 UTC 2013
Currently, when we add a flow with in_port=65534, we get the
following warning.
"ofp_util|WARN|referring to port LOCAL as 65534 is deprecated
for compatibility with future versions of OpenFlow."
But ovs-ofctl, while dumping flows uses 65534 instead of LOCAL.
The same is true for other reserved ports.
This patch corrects that.
Bug #14118.
Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
lib/match.c | 10 +++++++++-
tests/ovs-ofctl.at | 12 ++++++------
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/lib/match.c b/lib/match.c
index 7d6e8cc..4a25eac 100644
--- a/lib/match.c
+++ b/lib/match.c
@@ -865,7 +865,15 @@ match_format(const struct match *match, struct ds *s, unsigned int priority)
break;
}
if (wc->masks.in_port) {
- ds_put_format(s, "in_port=%"PRIu16",", f->in_port);
+ if (f->in_port >= OFPP_FIRST_RESV) {
+ struct ds reserved_port;
+ ds_init(&reserved_port);
+ ofputil_format_port(f->in_port, &reserved_port);
+ ds_put_format(s, "in_port=%s,", ds_cstr(&reserved_port));
+ ds_destroy(&reserved_port);
+ } else {
+ ds_put_format(s, "in_port=%"PRIu16",", f->in_port);
+ }
}
if (wc->masks.vlan_tci) {
ovs_be16 vid_mask = wc->masks.vlan_tci & htons(VLAN_VID_MASK);
diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at
index 8616226..ca68226 100644
--- a/tests/ovs-ofctl.at
+++ b/tests/ovs-ofctl.at
@@ -20,7 +20,7 @@ AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
[[usable protocols: any
chosen protocol: OpenFlow10-table_id
OFPT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
-OFPT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
+OFPT_FLOW_MOD: ADD in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
OFPT_FLOW_MOD: ADD udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
OFPT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
OFPT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
@@ -51,7 +51,7 @@ AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
[[usable protocols: any
chosen protocol: OXM-OpenFlow12
OFPT_FLOW_MOD (OF1.2): ADD table:255 tcp,tp_src=123 actions=FLOOD
-OFPT_FLOW_MOD (OF1.2): ADD table:255 in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
+OFPT_FLOW_MOD (OF1.2): ADD table:255 in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
OFPT_FLOW_MOD (OF1.2): ADD table:255 udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
OFPT_FLOW_MOD (OF1.2): ADD table:255 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
OFPT_FLOW_MOD (OF1.2): ADD table:255 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
@@ -124,7 +124,7 @@ AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
[[usable protocols: OXM,NXM+table_id
chosen protocol: NXM+table_id
NXT_FLOW_MOD: ADD table:255 tcp,tp_src=123 actions=FLOOD
-NXT_FLOW_MOD: ADD table:255 in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
+NXT_FLOW_MOD: ADD table:255 in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
NXT_FLOW_MOD: ADD table:255 udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
NXT_FLOW_MOD: ADD table:255 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
NXT_FLOW_MOD: ADD table:255 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
@@ -189,7 +189,7 @@ AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], [dnl
usable protocols: NXM,OXM
chosen protocol: NXM-table_id
NXT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
-NXT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
+NXT_FLOW_MOD: ADD in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
NXT_FLOW_MOD: ADD arp,dl_src=00:0a:e4:25:6b:b0,arp_sha=00:0a:e4:25:6b:b0 actions=drop
NXT_FLOW_MOD: ADD ipv6,ipv6_label=0x12345 actions=output:2
NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output:3
@@ -870,7 +870,7 @@ AT_CLEANUP
AT_SETUP([ovs-ofctl parse-ofp10-match])
AT_KEYWORDS([OF1.0])
AT_DATA([test-data], [dnl
-# in_port=65534
+# in_port=LOCAL
003820fe fffe xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx xxxx xx xx xxxx dnl
xxxxxxxx xxxxxxxx xxxx xxxx
@@ -1077,7 +1077,7 @@ AT_CLEANUP
AT_SETUP([ovs-ofctl parse-ofp11-match])
AT_KEYWORDS([OF1.1])
AT_DATA([test-data], [dnl
-# in_port=65534
+# in_port=LOCAL
0000 0058 fffffffe 000003fe dnl
000000000000ffffffffffff 000000000000ffffffffffff dnl
0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
--
1.7.9.5
More information about the dev
mailing list