util: Introduce ASSIGN_CONTAINER to make iteration macros easier to read.
[openvswitch] / lib / ofp-util.c
index cc38105b57baa9f1c22a77316187b295bf47770e..99ef722332830726405f2b197ae509a7ba8d4f9a 100644 (file)
@@ -103,7 +103,8 @@ enum {
  * wildcarded. */
 void
 ofputil_cls_rule_from_match(const struct ofp_match *match,
-                            unsigned int priority, int flow_format,
+                            unsigned int priority,
+                            enum nx_flow_format flow_format,
                             uint64_t cookie, struct cls_rule *rule)
 {
     struct flow_wildcards *wc = &rule->wc;
@@ -124,7 +125,7 @@ ofputil_cls_rule_from_match(const struct ofp_match *match,
     wc->nw_src_mask = ofputil_wcbits_to_netmask(ofpfw >> OFPFW_NW_SRC_SHIFT);
     wc->nw_dst_mask = ofputil_wcbits_to_netmask(ofpfw >> OFPFW_NW_DST_SHIFT);
 
-    if (!(ofpfw & NXFW_TUN_ID)) {
+    if (flow_format == NXFF_TUN_ID_FROM_COOKIE && !(ofpfw & NXFW_TUN_ID)) {
         rule->flow.tun_id = htonl(ntohll(cookie) >> 32);
     } else {
         wc->wildcards |= FWW_TUN_ID;
@@ -205,7 +206,8 @@ ofputil_cls_rule_from_match(const struct ofp_match *match,
  * the latter case only, 'match''s NXFW_TUN_ID bit will be filled in; otherwise
  * it is always set to 0. */
 void
-ofputil_cls_rule_to_match(const struct cls_rule *rule, int flow_format,
+ofputil_cls_rule_to_match(const struct cls_rule *rule,
+                          enum nx_flow_format flow_format,
                           struct ofp_match *match)
 {
     const struct flow_wildcards *wc = &rule->wc;