};
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
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);
}
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
/* 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 ||
} 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;
}
}
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();
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;
"%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));