From 64fcc0731396b64b27976df016d8f465723a66be Mon Sep 17 00:00:00 2001 From: Jarno Rajahalme Date: Thu, 24 Oct 2013 13:19:26 -0700 Subject: [PATCH] OF 1.1 pop vlan compatibility. Store the original action code with the strip vlan action, so that it can be printed back properly. Signed-off-by: Jarno Rajahalme Signed-off-by: Ben Pfaff --- lib/ofp-actions.c | 7 ++++--- lib/ofp-parse.c | 2 +- tests/ofp-actions.at | 2 +- tests/ovs-ofctl.at | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index ca26038f1..7d3a5b732 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -539,7 +539,7 @@ ofpact_from_openflow10(const union ofp_action *a, struct ofpbuf *out) break; case OFPUTIL_OFPAT10_STRIP_VLAN: - ofpact_put_STRIP_VLAN(out); + ofpact_put_STRIP_VLAN(out)->ofpact.compat = code; break; case OFPUTIL_OFPAT10_SET_DL_SRC: @@ -828,7 +828,7 @@ ofpact_from_openflow11(const union ofp_action *a, struct ofpbuf *out) break; case OFPUTIL_OFPAT11_POP_VLAN: - ofpact_put_STRIP_VLAN(out); + ofpact_put_STRIP_VLAN(out)->ofpact.compat = code; break; case OFPUTIL_OFPAT11_SET_QUEUE: @@ -2772,7 +2772,8 @@ ofpact_format(const struct ofpact *a, struct ds *s) break; case OFPACT_STRIP_VLAN: - ds_put_cstr(s, "strip_vlan"); + ds_put_cstr(s, a->compat == OFPUTIL_OFPAT11_POP_VLAN + ? "pop_vlan" : "strip_vlan"); break; case OFPACT_PUSH_VLAN: diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index 73a56b807..1ada870dd 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -653,7 +653,7 @@ parse_named_action(enum ofputil_action_code code, case OFPUTIL_OFPAT10_STRIP_VLAN: case OFPUTIL_OFPAT11_POP_VLAN: - ofpact_put_STRIP_VLAN(ofpacts); + ofpact_put_STRIP_VLAN(ofpacts)->ofpact.compat = code; break; case OFPUTIL_OFPAT11_PUSH_VLAN: diff --git a/tests/ofp-actions.at b/tests/ofp-actions.at index e3fc2bc10..244c9eee1 100644 --- a/tests/ofp-actions.at +++ b/tests/ofp-actions.at @@ -165,7 +165,7 @@ AT_DATA([test-data], [dnl # actions=mod_tp_dst:443 000a 0008 01bb 0000 -# actions=strip_vlan +# actions=pop_vlan 0012 0008 00000000 # actions=set_queue:2309737729 diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at index ae252b9bb..4272fb1b8 100644 --- a/tests/ovs-ofctl.at +++ b/tests/ovs-ofctl.at @@ -186,7 +186,7 @@ AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], chosen protocol: OpenFlow11 OFPT_FLOW_MOD (OF1.1): ADD table:255 tcp,tp_src=123 out_port:5 actions=FLOOD OFPT_FLOW_MOD (OF1.1): ADD table:255 in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop -OFPT_FLOW_MOD (OF1.1): ADD table:255 udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0 +OFPT_FLOW_MOD (OF1.1): ADD table:255 udp,dl_vlan_pcp=7 idle:5 actions=pop_vlan,output:0 OFPT_FLOW_MOD (OF1.1): ADD table:255 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1 OFPT_FLOW_MOD (OF1.1): ADD table:255 udp,nw_src=192.168.0.3,tp_dst=53 actions=mod_nw_ecn:2,output:1 OFPT_FLOW_MOD (OF1.1): ADD table:255 priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535 @@ -223,7 +223,7 @@ AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], 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=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 udp,dl_vlan_pcp=7 idle:5 actions=pop_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 OFPT_FLOW_MOD (OF1.2): ADD table:255 priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535 -- 2.20.1