openflow: Delete icmp_type and icmp_code macros.
authorBen Pfaff <blp@nicira.com>
Wed, 5 Oct 2011 18:06:12 +0000 (11:06 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 11 Oct 2011 17:37:25 +0000 (10:37 -0700)
These macros caused trouble if datapath-protocol.h was included before
openflow.h.  Later references to the icmp_type and icmp_code members of
struct ovs_key_icmp caused compiler errors, because the macros caused them
to try to refer to nonexistent tp_src and tp_dst members in those
structures.

include/openflow/openflow.h
lib/classifier.c
lib/flow.c
lib/meta-flow.c
lib/odp-util.c
lib/ofp-print.c

index 0dad50d10d4340718d33479ce3af3d5a60e1c84b..fd8fbeb16f5888c7c1efc5d40f425688f2fa1426 100644 (file)
@@ -536,11 +536,6 @@ struct ofp_match {
 };
 OFP_ASSERT(sizeof(struct ofp_match) == 40);
 
-/* The match fields for ICMP type and code use the transport source and
- * destination port fields, respectively. */
-#define icmp_type tp_src
-#define icmp_code tp_dst
-
 /* Value used in "idle_timeout" and "hard_timeout" to indicate that the entry
  * is permanent. */
 #define OFP_FLOW_PERMANENT 0
index 1f58860bbdba6cd9608fec0ceea04c6d1ef3c946..9f4c42b046f11fbb08bf0807e8dfa020ac54da50 100644 (file)
@@ -327,7 +327,7 @@ void
 cls_rule_set_icmp_type(struct cls_rule *rule, uint8_t icmp_type)
 {
     rule->wc.wildcards &= ~FWW_TP_SRC;
-    rule->flow.icmp_type = htons(icmp_type);
+    rule->flow.tp_src = htons(icmp_type);
 
 }
 
@@ -335,7 +335,7 @@ void
 cls_rule_set_icmp_code(struct cls_rule *rule, uint8_t icmp_code)
 {
     rule->wc.wildcards &= ~FWW_TP_DST;
-    rule->flow.icmp_code = htons(icmp_code);
+    rule->flow.tp_dst = htons(icmp_code);
 }
 
 void
index 1e5f2e5ff3dcfd294961da2cc7eb340290bb93a0..ded98b26cd1af6495ff6a020e020ab165c960013 100644 (file)
@@ -245,8 +245,8 @@ parse_icmpv6(struct ofpbuf *b, struct flow *flow)
 
     /* The ICMPv6 type and code fields use the 16-bit transport port
      * fields, so we need to store them in 16-bit network byte order. */
-    flow->icmp_type = htons(icmp->icmp6_type);
-    flow->icmp_code = htons(icmp->icmp6_code);
+    flow->tp_src = htons(icmp->icmp6_type);
+    flow->tp_dst = htons(icmp->icmp6_code);
 
     if (icmp->icmp6_code == 0 &&
         (icmp->icmp6_type == ND_NEIGHBOR_SOLICIT ||
@@ -373,8 +373,8 @@ flow_extract(struct ofpbuf *packet, ovs_be64 tun_id, uint16_t ofp_in_port,
                 } else if (flow->nw_proto == IPPROTO_ICMP) {
                     const struct icmp_header *icmp = pull_icmp(&b);
                     if (icmp) {
-                        flow->icmp_type = htons(icmp->icmp_type);
-                        flow->icmp_code = htons(icmp->icmp_code);
+                        flow->tp_src = htons(icmp->icmp_type);
+                        flow->tp_dst = htons(icmp->icmp_code);
                         packet->l7 = b.data;
                     }
                 }
index 715442651caa49584c0f18f296eac230287a40c2..f2f1348474428f7c731aa74832ae5a3acdb9c528 100644 (file)
@@ -591,17 +591,17 @@ mf_are_prereqs_ok(const struct mf_field *mf, const struct flow *flow)
 
     case MFP_ND:
         return (is_icmpv6(flow)
-                && flow->icmp_code == htons(0)
-                && (flow->icmp_type == htons(ND_NEIGHBOR_SOLICIT) ||
-                    flow->icmp_type == htons(ND_NEIGHBOR_ADVERT)));
+                && flow->tp_dst == htons(0)
+                && (flow->tp_src == htons(ND_NEIGHBOR_SOLICIT) ||
+                    flow->tp_src == htons(ND_NEIGHBOR_ADVERT)));
     case MFP_ND_SOLICIT:
         return (is_icmpv6(flow)
-                && flow->icmp_code == htons(0)
-                && (flow->icmp_type == htons(ND_NEIGHBOR_SOLICIT)));
+                && flow->tp_dst == htons(0)
+                && (flow->tp_src == htons(ND_NEIGHBOR_SOLICIT)));
     case MFP_ND_ADVERT:
         return (is_icmpv6(flow)
-                && flow->icmp_code == htons(0)
-                && (flow->icmp_type == htons(ND_NEIGHBOR_ADVERT)));
+                && flow->tp_dst == htons(0)
+                && (flow->tp_src == htons(ND_NEIGHBOR_ADVERT)));
     }
 
     NOT_REACHED();
index 7f5158fe90f32764823d2411d7891d29de016376..c67e14a9a1050b552690bba220c98dd771a046d5 100644 (file)
@@ -1087,8 +1087,8 @@ odp_flow_key_to_flow(const struct nlattr *key, size_t key_len,
         return 0;
 
     case OVS_KEY_ATTR_ICMPV6:
-        if (flow->icmp_type == htons(ND_NEIGHBOR_SOLICIT)
-            || flow->icmp_type == htons(ND_NEIGHBOR_ADVERT)) {
+        if (flow->tp_src == htons(ND_NEIGHBOR_SOLICIT)
+            || flow->tp_src == htons(ND_NEIGHBOR_ADVERT)) {
             return EINVAL;
         }
         return 0;
index a9f90df0a01a3692cfec9e810694a17286f66375..64712b5217bc7d125339658ef2eec2c8849618b7 100644 (file)
@@ -739,9 +739,9 @@ ofp_match_to_string(const struct ofp_match *om, int verbosity)
                "%u", om->nw_tos);
     if (om->nw_proto == IPPROTO_ICMP) {
         print_wild(&f, "icmp_type=", w & OFPFW_ICMP_TYPE, verbosity,
-                   "%d", ntohs(om->icmp_type));
+                   "%d", ntohs(om->tp_src));
         print_wild(&f, "icmp_code=", w & OFPFW_ICMP_CODE, verbosity,
-                   "%d", ntohs(om->icmp_code));
+                   "%d", ntohs(om->tp_dst));
     } else {
         print_wild(&f, "tp_src=", w & OFPFW_TP_SRC, verbosity,
                    "%d", ntohs(om->tp_src));