Remove NXAST_DROP_SPOOFED_ARP action.
[sliver-openvswitch.git] / lib / ofp-util.c
index 5da5989..750918d 100644 (file)
@@ -101,19 +101,12 @@ static const flow_wildcards_t WC_INVARIANTS = 0
 #undef WC_INVARIANT_BIT
 ;
 
-/* Converts the ofp_match in 'match' into a cls_rule in 'rule', with the given
- * 'priority'. */
+/* Converts the wildcard in 'ofpfw' into a flow_wildcards in 'wc' for use in
+ * struct cls_rule.  It is the caller's responsibility to handle the special
+ * case where the flow match's dl_vlan is set to OFP_VLAN_NONE. */
 void
-ofputil_cls_rule_from_match(const struct ofp_match *match,
-                            unsigned int priority, struct cls_rule *rule)
+ofputil_wildcard_from_openflow(uint32_t ofpfw, struct flow_wildcards *wc)
 {
-    struct flow_wildcards *wc = &rule->wc;
-    uint32_t ofpfw;
-
-    /* Initialize rule->priority. */
-    ofpfw = ntohl(match->wildcards) & OFPFW_ALL;
-    rule->priority = !ofpfw ? UINT16_MAX : priority;
-
     /* Initialize most of rule->wc. */
     flow_wildcards_init_catchall(wc);
     wc->wildcards = (OVS_FORCE flow_wildcards_t) ofpfw & WC_INVARIANTS;
@@ -134,6 +127,27 @@ ofputil_cls_rule_from_match(const struct ofp_match *match,
         wc->wildcards |= FWW_ETH_MCAST;
     }
 
+    /* VLAN TCI mask. */
+    if (!(ofpfw & OFPFW_DL_VLAN_PCP)) {
+        wc->vlan_tci_mask |= htons(VLAN_PCP_MASK | VLAN_CFI);
+    }
+    if (!(ofpfw & OFPFW_DL_VLAN)) {
+        wc->vlan_tci_mask |= htons(VLAN_VID_MASK | VLAN_CFI);
+    }
+}
+
+/* Converts the ofp_match in 'match' into a cls_rule in 'rule', with the given
+ * 'priority'. */
+void
+ofputil_cls_rule_from_match(const struct ofp_match *match,
+                            unsigned int priority, struct cls_rule *rule)
+{
+    uint32_t ofpfw = ntohl(match->wildcards) & OFPFW_ALL;
+
+    /* Initialize rule->priority, rule->wc. */
+    rule->priority = !ofpfw ? UINT16_MAX : priority;
+    ofputil_wildcard_from_openflow(ofpfw, &rule->wc);
+
     /* Initialize most of rule->flow. */
     rule->flow.nw_src = match->nw_src;
     rule->flow.nw_dst = match->nw_dst;
@@ -157,24 +171,14 @@ ofputil_cls_rule_from_match(const struct ofp_match *match,
          * However, older versions of OVS treated this as matching packets
          * withut an 802.1Q header, so we do here too. */
         rule->flow.vlan_tci = htons(0);
-        wc->vlan_tci_mask = htons(0xffff);
+        rule->wc.vlan_tci_mask = htons(0xffff);
     } else {
         ovs_be16 vid, pcp, tci;
 
-        /* Compute mask. */
-        wc->vlan_tci_mask = htons(0);
-        if (!(ofpfw & OFPFW_DL_VLAN_PCP)) {
-            wc->vlan_tci_mask |= htons(VLAN_PCP_MASK | VLAN_CFI);
-        }
-        if (!(ofpfw & OFPFW_DL_VLAN)) {
-            wc->vlan_tci_mask |= htons(VLAN_VID_MASK | VLAN_CFI);
-        }
-
-        /* Compute match value based on mask. */
         vid = match->dl_vlan & htons(VLAN_VID_MASK);
         pcp = htons((match->dl_vlan_pcp << VLAN_PCP_SHIFT) & VLAN_PCP_MASK);
         tci = vid | pcp | htons(VLAN_CFI);
-        rule->flow.vlan_tci = tci & wc->vlan_tci_mask;
+        rule->flow.vlan_tci = tci & rule->wc.vlan_tci_mask;
     }
 
     /* Clean up. */
@@ -1860,7 +1864,6 @@ check_nicira_action(const union ofp_action *a, unsigned int len,
     switch ((enum nx_action_subtype) subtype) {
     case NXAST_RESUBMIT:
     case NXAST_SET_TUNNEL:
-    case NXAST_DROP_SPOOFED_ARP:
     case NXAST_SET_QUEUE:
     case NXAST_POP_QUEUE:
         return check_nx_action_exact_len(nah, len, 16);
@@ -1905,6 +1908,7 @@ check_nicira_action(const union ofp_action *a, unsigned int len,
         return autopath_check((const struct nx_action_autopath *) a);
 
     case NXAST_SNAT__OBSOLETE:
+    case NXAST_DROP_SPOOFED_ARP__OBSOLETE:
     default:
         VLOG_WARN_RL(&bad_ofmsg_rl,
                      "unknown Nicira vendor action subtype %d", subtype);