/*
- * Copyright (c) 2011, 2012 Nicira Networks.
+ * Copyright (c) 2011, 2012 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
MFF_ND_TARGET, "nd_target", NULL,
MF_FIELD_SIZES(ipv6),
- MFM_NONE, FWW_ND_TARGET,
+ MFM_CIDR, 0,
MFS_IPV6,
MFP_ND,
false,
case MFF_ARP_OP:
case MFF_ARP_SHA:
case MFF_ARP_THA:
- case MFF_ND_TARGET:
case MFF_ND_SLL:
case MFF_ND_TLL:
assert(mf->fww_bit != 0);
case MFF_IPV6_DST:
return ipv6_mask_is_any(&wc->ipv6_dst_mask);
+ case MFF_ND_TARGET:
+ return ipv6_mask_is_any(&wc->nd_target_mask);
+
case MFF_IP_FRAG:
return !(wc->nw_frag_mask & FLOW_NW_FRAG_MASK);
case MFF_ARP_OP:
case MFF_ARP_SHA:
case MFF_ARP_THA:
- case MFF_ND_TARGET:
case MFF_ND_SLL:
case MFF_ND_TLL:
assert(mf->fww_bit != 0);
mask->ipv6 = wc->ipv6_dst_mask;
break;
+ case MFF_ND_TARGET:
+ mask->ipv6 = wc->nd_target_mask;
+ break;
+
case MFF_IP_FRAG:
mask->u8 = wc->nw_frag_mask & FLOW_NW_FRAG_MASK;
break;
break;
case MFF_ETH_DST:
- memcpy(flow->dl_src, value->mac, ETH_ADDR_LEN);
+ memcpy(flow->dl_dst, value->mac, ETH_ADDR_LEN);
break;
case MFF_ETH_TYPE:
}
}
+/* Returns true if 'mf' has a zero value in 'flow', false if it is nonzero.
+ *
+ * The caller is responsible for ensuring that 'flow' meets 'mf''s
+ * prerequisites. */
+bool
+mf_is_zero(const struct mf_field *mf, const struct flow *flow)
+{
+ union mf_value value;
+
+ mf_get_value(mf, flow, &value);
+ return is_all_zeros((const uint8_t *) &value, mf->n_bytes);
+}
+
/* Makes 'rule' wildcard field 'mf'.
*
* The caller is responsible for ensuring that 'rule' meets 'mf''s
break;
case MFF_ND_TARGET:
- rule->wc.wildcards |= FWW_ND_TARGET;
+ memset(&rule->wc.nd_target_mask, 0, sizeof rule->wc.nd_target_mask);
memset(&rule->flow.nd_target, 0, sizeof rule->flow.nd_target);
break;
case MFF_ICMPV4_CODE:
case MFF_ICMPV6_TYPE:
case MFF_ICMPV6_CODE:
- case MFF_ND_TARGET:
case MFF_ND_SLL:
case MFF_ND_TLL:
NOT_REACHED();
cls_rule_set_ipv6_dst_masked(rule, &value->ipv6, &mask->ipv6);
break;
+ case MFF_ND_TARGET:
+ cls_rule_set_nd_target_masked(rule, &value->ipv6, &mask->ipv6);
+ break;
+
case MFF_IP_FRAG:
cls_rule_set_nw_frag_masked(rule, value->u8, mask->u8);
break;