ofpaction: support OF11 pop_vlan
authorIsaku Yamahata <yamahata@valinux.co.jp>
Wed, 17 Oct 2012 18:51:58 +0000 (03:51 +0900)
committerBen Pfaff <blp@nicira.com>
Thu, 18 Oct 2012 17:36:07 +0000 (10:36 -0700)
This patch adds support of OF11+ pop_vlan.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
[blp@nicira.com added a test]
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/ofp-actions.c
lib/ofp-actions.h
lib/ofp-parse.c
lib/ofp-util.def
tests/ofp-actions.at

index 0d1a2acdda193ce7b32d647a1c8575487ef123fd..b774a61e00e15860ecaafc2bbad351ba10194281 100644 (file)
@@ -685,6 +685,10 @@ ofpact_from_openflow11(const union ofp_action *a, struct ofpbuf *out)
         ofpact_put_SET_VLAN_PCP(out)->vlan_pcp = a->vlan_pcp.vlan_pcp;
         break;
 
+    case OFPUTIL_OFPAT11_POP_VLAN:
+        ofpact_put_STRIP_VLAN(out);
+        break;
+
     case OFPUTIL_OFPAT11_SET_DL_SRC:
         memcpy(ofpact_put_SET_ETH_SRC(out)->mac,
                ((const struct ofp_action_dl_addr *) a)->dl_addr, ETH_ADDR_LEN);
@@ -1443,7 +1447,7 @@ ofpact_to_openflow11(const struct ofpact *a, struct ofpbuf *out)
         break;
 
     case OFPACT_STRIP_VLAN:
-        /* XXX */
+        ofputil_put_OFPAT11_POP_VLAN(out);
         break;
 
     case OFPACT_SET_ETH_SRC:
index 3049aaafd7210b0ebb3ad3db9238e5e4fe51ba71..37a60825fc9e417c60639c3e57238cb0293a79f8 100644 (file)
@@ -177,7 +177,7 @@ ofpact_end(const struct ofpact *ofpacts, size_t ofpacts_len)
 /* OFPACT_STRIP_VLAN, OFPACT_POP_QUEUE, OFPACT_EXIT, OFPACT_CLEAR_ACTIONS.
  *
  * Used for OFPAT10_STRIP_VLAN, NXAST_POP_QUEUE, NXAST_EXIT,
- * OFPIT11_CLEAR_ACTIONS.
+ * OFPAT11_POP_VLAN, OFPIT11_CLEAR_ACTIONS.
  *
  * Action structure for actions that do not have any extra data beyond the
  * action type. */
index 04f5ab174b68f9e151bc57d7bd011c2e42cec4a5..122f4b36d33fd8e826ee3997fc8566b70a9b834c 100644 (file)
@@ -403,6 +403,7 @@ parse_named_action(enum ofputil_action_code code, const struct flow *flow,
         break;
 
     case OFPUTIL_OFPAT10_STRIP_VLAN:
+    case OFPUTIL_OFPAT11_POP_VLAN:
         ofpact_put_STRIP_VLAN(ofpacts);
         break;
 
index e61049bbd44d11ecce79d8eb9a97c178175b68d6..3954dc0cbb4958b76ccc60fbb0b70a44c2045b09 100644 (file)
@@ -31,7 +31,7 @@ OFPAT11_ACTION(OFPAT11_SET_NW_TOS,   ofp_action_nw_tos,   0, "mod_nw_tos")
 OFPAT11_ACTION(OFPAT11_SET_TP_SRC,   ofp_action_tp_port,  0, "mod_tp_src")
 OFPAT11_ACTION(OFPAT11_SET_TP_DST,   ofp_action_tp_port,  0, "mod_tp_dst")
 //OFPAT11_ACTION(OFPAT11_PUSH_VLAN,    ofp11_action_push,   0, "push_vlan")
-//OFPAT11_ACTION(OFPAT11_POP_VLAN,     ofp_action_header,   0, "pop_vlan")
+OFPAT11_ACTION(OFPAT11_POP_VLAN,     ofp_action_header,   0, "pop_vlan")
 //OFPAT11_ACTION(OFPAT11_SET_QUEUE,    ofp11_action_set_queue, 0, "set_queue")
 //OFPAT11_ACTION(OFPAT11_SET_NW_TTL,   ofp11_action_nw_ttl, 0, "set_nw_ttl")
 OFPAT11_ACTION(OFPAT11_DEC_NW_TTL,   ofp_action_header,   0, NULL)
index c5d666cec665dd60bbbc3941727ab80207961b3b..8d95ae904de97ea3104237fbbcfd6c9f5e596e2c 100644 (file)
@@ -160,6 +160,9 @@ AT_DATA([test-data], [dnl
 # actions=mod_tp_dst:443
 000a 0008 01bb 0000
 
+# actions=strip_vlan
+0012 0008 00000000
+
 # actions=resubmit:5
 ffff 0010 00002320 0001 0005 00000000