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 | 5 -----
lib/classifier.c | 4 ++--
lib/flow.c | 8 ++++----
lib/meta-flow.c | 14 +++++++-------
lib/odp-util.c | 4 ++--
lib/ofp-print.c | 4 ++--
6 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/include/openflow/openflow.h b/include/openflow/openflow.h
index 0dad50d..fd8fbeb 100644
--- a/include/openflow/openflow.h
+++ b/include/openflow/openflow.h
@@ -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
diff --git a/lib/classifier.c b/lib/classifier.c
index 1f58860..9f4c42b 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -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
diff --git a/lib/flow.c b/lib/flow.c
index 1e5f2e5..ded98b2 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -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;
}
}
diff --git a/lib/meta-flow.c b/lib/meta-flow.c
index 7154426..f2f1348 100644
--- a/lib/meta-flow.c
+++ b/lib/meta-flow.c
@@ -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();
diff --git a/lib/odp-util.c b/lib/odp-util.c
index 7f5158f..c67e14a 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -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;
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index a9f90df..64712b5 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -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));
--
1.7.2.5
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev