post-v1.3.0
------------------------
+ - OpenFlow:
+ - Added ability to match on IPv6 flow label through NXM.
- ovs-appctl:
- New "fdb/flush" command to flush bridge's MAC learning table.
-
v1.3.0 - xx xxx xxxx
------------------------
- OpenFlow:
uint8_t nexthdr;
int err;
- *key_lenp = SW_FLOW_KEY_OFFSET(ipv6.addr);
+ *key_lenp = SW_FLOW_KEY_OFFSET(ipv6.label);
err = check_header(skb, nh_ofs + sizeof(*nh));
if (unlikely(err))
key->ip.proto = NEXTHDR_NONE;
key->ip.tos_frag = ipv6_get_dsfield(nh) & ~INET_ECN_MASK;
+ key->ipv6.label = *(__be32 *)nh & htonl(IPV6_FLOWINFO_FLOWLABEL);
ipv6_addr_copy(&key->ipv6.addr.src, &nh->saddr);
ipv6_addr_copy(&key->ipv6.addr.dst, &nh->daddr);
break;
case TRANSITION(OVS_KEY_ATTR_ETHERTYPE, OVS_KEY_ATTR_IPV6):
- key_len = SW_FLOW_KEY_OFFSET(ipv6.addr);
+ key_len = SW_FLOW_KEY_OFFSET(ipv6.label);
if (swkey->eth.type != htons(ETH_P_IPV6))
goto invalid;
ipv6_key = nla_data(nla);
+ swkey->ipv6.label = ipv6_key->ipv6_label;
swkey->ip.proto = ipv6_key->ipv6_proto;
if (parse_tos_frag(swkey, ipv6_key->ipv6_tos,
ipv6_key->ipv6_frag))
sizeof(ipv6_key->ipv6_src));
memcpy(ipv6_key->ipv6_dst, &swkey->ipv6.addr.dst,
sizeof(ipv6_key->ipv6_dst));
+ ipv6_key->ipv6_label = swkey->ipv6.label;
ipv6_key->ipv6_proto = swkey->ip.proto;
ipv6_key->ipv6_tos = swkey->ip.tos_frag & ~INET_ECN_MASK;
ipv6_key->ipv6_frag = swkey->ip.tos_frag & OVS_FRAG_TYPE_MASK;
struct in6_addr src; /* IPv6 source address. */
struct in6_addr dst; /* IPv6 destination address. */
} addr;
+ __be32 label; /* IPv6 flow label. */
struct {
__be16 src; /* TCP/UDP source port. */
__be16 dst; /* TCP/UDP destination port. */
* OVS_KEY_ATTR_ETHERNET 12 -- 4 16
* OVS_KEY_ATTR_8021Q 4 -- 4 8
* OVS_KEY_ATTR_ETHERTYPE 2 2 4 8
- * OVS_KEY_ATTR_IPV6 34 2 4 40
+ * OVS_KEY_ATTR_IPV6 38 2 4 44
* OVS_KEY_ATTR_ICMPV6 2 2 4 8
* OVS_KEY_ATTR_ND 28 -- 4 32
* -------------------------------------------------
- * total 140
+ * total 144
*/
-#define FLOW_BUFSIZE 140
+#define FLOW_BUFSIZE 144
int flow_to_nlattrs(const struct sw_flow_key *, struct sk_buff *);
int flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp,
struct ovs_key_ipv6 {
__be32 ipv6_src[4];
__be32 ipv6_dst[4];
+ __be32 ipv6_label; /* 20-bits in least-significant bits. */
__u8 ipv6_proto;
__u8 ipv6_tos;
__u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */
#define NX_IP_FRAG_ANY (1 << 0) /* Is this a fragment? */
#define NX_IP_FRAG_LATER (1 << 1) /* Is this a fragment with nonzero offset? */
+/* The flow label in the IPv6 header.
+ *
+ * Prereqs: NXM_OF_ETH_TYPE must match 0x86dd exactly.
+ *
+ * Format: 20-bit IPv6 flow label in least-significant bits.
+ *
+ * Masking: Not maskable. */
+#define NXM_NX_IPV6_LABEL NXM_HEADER (0x0001, 27, 4)
+
/* ## --------------------- ## */
/* ## Requests and replies. ## */
/* ## --------------------- ## */
{
rule->wc.wildcards &= ~FWW_TP_SRC;
rule->flow.tp_src = htons(icmp_type);
-
}
void
}
}
+void
+cls_rule_set_ipv6_label(struct cls_rule *rule, ovs_be32 ipv6_label)
+{
+ rule->wc.wildcards &= ~FWW_IPV6_LABEL;
+ rule->flow.ipv6_label = ipv6_label;
+}
+
void
cls_rule_set_nd_target(struct cls_rule *rule, const struct in6_addr *target)
{
int i;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 3);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 4);
if (rule->priority != OFP_DEFAULT_PRIORITY) {
ds_put_format(s, "priority=%d,", rule->priority);
if (f->dl_type == htons(ETH_TYPE_IPV6)) {
format_ipv6_netmask(s, "ipv6_src", &f->ipv6_src, &wc->ipv6_src_mask);
format_ipv6_netmask(s, "ipv6_dst", &f->ipv6_dst, &wc->ipv6_dst_mask);
+ if (!(w & FWW_IPV6_LABEL)) {
+ ds_put_format(s, "ipv6_label=0x%05"PRIx32",", ntohl(f->ipv6_label));
+ }
} else {
format_ip_netmask(s, "nw_src", f->nw_src, wc->nw_src_mask);
format_ip_netmask(s, "nw_dst", f->nw_dst, wc->nw_dst_mask);
const flow_wildcards_t wc = wildcards->wildcards;
int i;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 3);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 4);
for (i = 0; i < FLOW_N_REGS; i++) {
if ((a->regs[i] ^ b->regs[i]) & wildcards->reg_masks[i]) {
&& !((a->tos_frag ^ b->tos_frag) & wildcards->tos_frag_mask)
&& (wc & FWW_ARP_SHA || eth_addr_equals(a->arp_sha, b->arp_sha))
&& (wc & FWW_ARP_THA || eth_addr_equals(a->arp_tha, b->arp_tha))
+ && (wc & FWW_IPV6_LABEL || a->ipv6_label == b->ipv6_label)
&& ipv6_equal_except(&a->ipv6_src, &b->ipv6_src,
&wildcards->ipv6_src_mask)
&& ipv6_equal_except(&a->ipv6_dst, &b->ipv6_dst,
void cls_rule_set_ipv6_dst(struct cls_rule *, const struct in6_addr *);
bool cls_rule_set_ipv6_dst_masked(struct cls_rule *, const struct in6_addr *,
const struct in6_addr *);
+void cls_rule_set_ipv6_label(struct cls_rule *, ovs_be32);
void cls_rule_set_nd_target(struct cls_rule *, const struct in6_addr *);
bool cls_rule_equal(const struct cls_rule *, const struct cls_rule *);
tc_flow = get_unaligned_be32(&nh->ip6_flow);
flow->tos_frag = (ntohl(tc_flow) >> 4) & IP_DSCP_MASK;
+ flow->ipv6_label = tc_flow & htonl(IPV6_LABEL_MASK);
flow->nw_proto = IPPROTO_NONE;
while (1) {
const flow_wildcards_t wc = wildcards->wildcards;
int i;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 3);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 4);
for (i = 0; i < FLOW_N_REGS; i++) {
flow->regs[i] &= wildcards->reg_masks[i];
if (wc & FWW_NW_PROTO) {
flow->nw_proto = 0;
}
+ if (wc & FWW_IPV6_LABEL) {
+ flow->ipv6_label = htonl(0);
+ }
flow->tos_frag &= wildcards->tos_frag_mask;
if (wc & FWW_ARP_SHA) {
memset(flow->arp_sha, 0, sizeof flow->arp_sha);
ntohs(flow->dl_type));
if (flow->dl_type == htons(ETH_TYPE_IPV6)) {
- ds_put_format(ds, " proto%"PRIu8" tos%"PRIu8" ipv6",
- flow->nw_proto, flow->tos_frag & IP_DSCP_MASK);
+ ds_put_format(ds, " label%#"PRIx32" proto%"PRIu8" tos%"PRIu8" ipv6",
+ ntohl(flow->ipv6_label), flow->nw_proto,
+ flow->tos_frag & IP_DSCP_MASK);
print_ipv6_addr(ds, &flow->ipv6_src);
ds_put_cstr(ds, "->");
print_ipv6_addr(ds, &flow->ipv6_dst);
void
flow_wildcards_init_catchall(struct flow_wildcards *wc)
{
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 3);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 4);
wc->wildcards = FWW_ALL;
wc->tun_id_mask = htonll(0);
void
flow_wildcards_init_exact(struct flow_wildcards *wc)
{
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 3);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 4);
wc->wildcards = 0;
wc->tun_id_mask = htonll(UINT64_MAX);
{
int i;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 3);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 4);
if (wc->wildcards
|| wc->tun_id_mask != htonll(UINT64_MAX)
{
int i;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 3);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 4);
if (wc->wildcards != FWW_ALL
|| wc->tun_id_mask != htonll(0)
/* This sequence number should be incremented whenever anything involving flows
* or the wildcarding of flows changes. This will cause build assertion
* failures in places which likely need to be updated. */
-#define FLOW_WC_SEQ 3
+#define FLOW_WC_SEQ 4
#define FLOW_N_REGS 5
BUILD_ASSERT_DECL(FLOW_N_REGS <= NXM_NX_MAX_REGS);
uint32_t regs[FLOW_N_REGS]; /* Registers. */
ovs_be32 nw_src; /* IPv4 source address. */
ovs_be32 nw_dst; /* IPv4 destination address. */
+ ovs_be32 ipv6_label; /* IPv6 flow label. */
uint16_t in_port; /* OpenFlow port number of input port. */
ovs_be16 vlan_tci; /* If 802.1Q, TCI | VLAN_CFI; otherwise 0. */
ovs_be16 dl_type; /* Ethernet frame type. */
uint8_t tos_frag; /* IP ToS in top bits, FLOW_FRAG_* in low. */
uint8_t arp_sha[6]; /* ARP/ND source hardware address. */
uint8_t arp_tha[6]; /* ARP/ND target hardware address. */
- uint32_t reserved; /* Reserved for 64-bit packing. */
};
/* Assert that there are FLOW_SIG_SIZE bytes of significant data in "struct
* flow", followed by FLOW_PAD_SIZE bytes of padding. */
-#define FLOW_SIG_SIZE (104 + FLOW_N_REGS * 4)
-#define FLOW_PAD_SIZE 4
+#define FLOW_SIG_SIZE (108 + FLOW_N_REGS * 4)
+#define FLOW_PAD_SIZE 0
BUILD_ASSERT_DECL(offsetof(struct flow, arp_tha) == FLOW_SIG_SIZE - 6);
BUILD_ASSERT_DECL(sizeof(((struct flow *)0)->arp_tha) == 6);
BUILD_ASSERT_DECL(sizeof(struct flow) == FLOW_SIG_SIZE + FLOW_PAD_SIZE);
/* Remember to update FLOW_WC_SEQ when changing 'struct flow'. */
-BUILD_ASSERT_DECL(FLOW_SIG_SIZE == 124 && FLOW_WC_SEQ == 3);
+BUILD_ASSERT_DECL(FLOW_SIG_SIZE == 128 && FLOW_WC_SEQ == 4);
void flow_extract(struct ofpbuf *, uint32_t priority, ovs_be64 tun_id,
uint16_t in_port, struct flow *);
#define FWW_ARP_SHA ((OVS_FORCE flow_wildcards_t) (1 << 8))
#define FWW_ARP_THA ((OVS_FORCE flow_wildcards_t) (1 << 9))
#define FWW_ND_TARGET ((OVS_FORCE flow_wildcards_t) (1 << 10))
-#define FWW_ALL ((OVS_FORCE flow_wildcards_t) (((1 << 11)) - 1))
+#define FWW_IPV6_LABEL ((OVS_FORCE flow_wildcards_t) (1 << 11))
+#define FWW_ALL ((OVS_FORCE flow_wildcards_t) (((1 << 12)) - 1))
/* Remember to update FLOW_WC_SEQ when adding or removing FWW_*. */
-BUILD_ASSERT_DECL(FWW_ALL == ((1 << 11) - 1) && FLOW_WC_SEQ == 3);
+BUILD_ASSERT_DECL(FWW_ALL == ((1 << 12) - 1) && FLOW_WC_SEQ == 4);
/* Information on wildcards for a flow, as a supplement to "struct flow".
*
};
/* Remember to update FLOW_WC_SEQ when updating struct flow_wildcards. */
-BUILD_ASSERT_DECL(sizeof(struct flow_wildcards) == 80 && FLOW_WC_SEQ == 3);
+BUILD_ASSERT_DECL(sizeof(struct flow_wildcards) == 80 && FLOW_WC_SEQ == 4);
void flow_wildcards_init_catchall(struct flow_wildcards *);
void flow_wildcards_init_exact(struct flow_wildcards *);
MFP_IPV6,
NXM_NX_IPV6_DST,
},
+ {
+ MFF_IPV6_LABEL, "ipv6_label", NULL,
+ 4, 20,
+ MFM_NONE, FWW_IPV6_LABEL,
+ MFS_HEXADECIMAL,
+ MFP_IPV6,
+ NXM_NX_IPV6_LABEL,
+ },
{
MFF_IP_PROTO, "nw_proto", NULL,
case MFF_ETH_SRC:
case MFF_ETH_TYPE:
case MFF_IP_PROTO:
+ case MFF_IPV6_LABEL:
case MFF_ARP_OP:
case MFF_ARP_SHA:
case MFF_ARP_THA:
case MFF_ETH_SRC:
case MFF_ETH_TYPE:
case MFF_IP_PROTO:
+ case MFF_IPV6_LABEL:
case MFF_ARP_OP:
case MFF_ARP_SHA:
case MFF_ARP_THA:
case MFF_VLAN_PCP:
return !(value->u8 & ~7);
+ case MFF_IPV6_LABEL:
+ return !(value->be32 & ~htonl(IPV6_LABEL_MASK));
+
case MFF_N_IDS:
default:
NOT_REACHED();
value->ipv6 = flow->ipv6_dst;
break;
+ case MFF_IPV6_LABEL:
+ value->be32 = flow->ipv6_label;
+ break;
+
case MFF_IP_PROTO:
value->u8 = flow->nw_proto;
break;
cls_rule_set_ipv6_dst(rule, &value->ipv6);
break;
+ case MFF_IPV6_LABEL:
+ cls_rule_set_ipv6_label(rule, value->be32);
+ break;
+
case MFF_IP_PROTO:
cls_rule_set_nw_proto(rule, value->u8);
break;
memset(&rule->flow.ipv6_dst, 0, sizeof rule->flow.ipv6_dst);
break;
+ case MFF_IPV6_LABEL:
+ rule->wc.wildcards |= FWW_IPV6_LABEL;
+ rule->flow.ipv6_label = 0;
+ break;
+
case MFF_IP_PROTO:
rule->wc.wildcards |= FWW_NW_PROTO;
rule->flow.nw_proto = 0;
case MFF_ETH_TYPE:
case MFF_VLAN_VID:
case MFF_VLAN_PCP:
+ case MFF_IPV6_LABEL:
case MFF_IP_PROTO:
case MFF_IP_TOS:
case MFF_ARP_OP:
case MFF_ND_TLL:
break;
+ case MFF_IPV6_LABEL:
+ value->be32 &= ~htonl(IPV6_LABEL_MASK);
+ break;
+
case MFF_IP_TOS:
value->u8 &= ~0x03;
break;
MFF_IPV6_SRC, /* ipv6 */
MFF_IPV6_DST, /* ipv6 */
+ MFF_IPV6_LABEL, /* be32 */
MFF_IP_PROTO, /* u8 (used for IPv4 or IPv6) */
MFF_IP_TOS, /* u8 (used for IPv4 or IPv6) */
* - "dl_vlan" is 2 bytes but only 12 bits.
* - "dl_vlan_pcp" is 1 byte but only 3 bits.
* - "is_frag" is 1 byte but only 2 bits.
+ * - "ipv6_label" is 4 bytes but only 20 bits.
*/
unsigned int n_bytes; /* Width of the field in bytes. */
unsigned int n_bits; /* Number of significant bits in field. */
int match_len;
int i;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 3);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 4);
/* Metadata. */
if (!(wc & FWW_IN_PORT)) {
&cr->wc.ipv6_src_mask);
nxm_put_ipv6(b, NXM_NX_IPV6_DST, &flow->ipv6_dst,
&cr->wc.ipv6_dst_mask);
+ if (!(wc & FWW_IPV6_LABEL)) {
+ nxm_put_32(b, NXM_NX_IPV6_LABEL, flow->ipv6_label);
+ }
if (!(wc & FWW_NW_PROTO)) {
nxm_put_8(b, NXM_OF_IP_PROTO, flow->nw_proto);
case NFI_NXM_NX_TUN_ID:
return ntohll(flow->tun_id);
+ case NFI_NXM_NX_IPV6_LABEL:
+ return ntohl(flow->ipv6_label);
+
#define NXM_READ_REGISTER(IDX) \
case NFI_NXM_NX_REG##IDX: \
return flow->regs[IDX]; \
flow->nw_dst = htonl(new_value);
break;
+ case NFI_NXM_NX_IPV6_LABEL:
+ flow->ipv6_label = htonl(new_value);
+ break;
+
case NFI_NXM_OF_TCP_SRC:
case NFI_NXM_OF_UDP_SRC:
flow->tp_src = htons(new_value);
DEFINE_FIELD (NX_ARP_THA, MFF_ARP_THA, false)
DEFINE_FIELD_M(NX_IPV6_SRC, MFF_IPV6_SRC, false)
DEFINE_FIELD_M(NX_IPV6_DST, MFF_IPV6_DST, false)
+DEFINE_FIELD (NX_IPV6_LABEL, MFF_IPV6_LABEL,false)
/* XXX should we have MFF_ICMPV4_TYPE and MFF_ICMPV6_TYPE? */
DEFINE_FIELD (NX_ICMPV6_TYPE,MFF_ICMP_TYPE, false)
DEFINE_FIELD (NX_ICMPV6_CODE,MFF_ICMP_CODE, false)
* NXM_OF_IP_PROTO 4 2 -- 6
* NXM_OF_IPV6_SRC_W 4 16 16 36
* NXM_OF_IPV6_DST_W 4 16 16 36
+ * NXM_OF_IPV6_LABEL 4 4 -- 8
* NXM_OF_ICMP_TYPE 4 1 -- 5
* NXM_OF_ICMP_CODE 4 1 -- 5
* NXM_NX_ND_TARGET 4 16 -- 20
* NXM_NX_REG_W(4) 4 4 4 12
* NXM_NX_TUN_ID_W 4 8 8 20
* -------------------------------------------
- * total 257
+ * total 265
*
* So this value is conservative.
*/
inet_ntop(AF_INET6, ipv6_key->ipv6_src, src_str, sizeof src_str);
inet_ntop(AF_INET6, ipv6_key->ipv6_dst, dst_str, sizeof dst_str);
- ds_put_format(ds, "ipv6(src=%s,dst=%s,proto=%"PRId8",tos=%"PRIu8","
- "frag=%s)",
- src_str, dst_str, ipv6_key->ipv6_proto,
- ipv6_key->ipv6_tos,
+ ds_put_format(ds, "ipv6(src=%s,dst=%s,label=%#"PRIx32",proto=%"PRId8
+ ",tos=%"PRIu8",frag=%s)",
+ src_str, dst_str, ntohl(ipv6_key->ipv6_label),
+ ipv6_key->ipv6_proto, ipv6_key->ipv6_tos,
ovs_frag_type_to_string(ipv6_key->ipv6_frag));
break;
}
{
char ipv6_src_s[IPV6_SCAN_LEN + 1];
char ipv6_dst_s[IPV6_SCAN_LEN + 1];
+ int ipv6_label;
int ipv6_proto;
int ipv6_tos;
char frag[8];
int n = -1;
if (sscanf(s, "ipv6(src="IPV6_SCAN_FMT",dst="IPV6_SCAN_FMT","
- "proto=%i,tos=%i,frag=%7[a-z])%n",
- ipv6_src_s, ipv6_dst_s,
+ "label=%i,proto=%i,tos=%i,frag=%7[a-z])%n",
+ ipv6_src_s, ipv6_dst_s, &ipv6_label,
&ipv6_proto, &ipv6_tos, frag, &n) > 0
&& n > 0
&& ovs_frag_type_from_string(frag, &ipv6_frag)) {
inet_pton(AF_INET6, ipv6_dst_s, &ipv6_key.ipv6_dst) != 1) {
return -EINVAL;
}
+ ipv6_key.ipv6_label = htonl(ipv6_label);
ipv6_key.ipv6_proto = ipv6_proto;
ipv6_key.ipv6_tos = ipv6_tos;
ipv6_key.ipv6_frag = ipv6_frag;
memset(ipv6_key, 0, sizeof *ipv6_key);
memcpy(ipv6_key->ipv6_src, &flow->ipv6_src, sizeof ipv6_key->ipv6_src);
memcpy(ipv6_key->ipv6_dst, &flow->ipv6_dst, sizeof ipv6_key->ipv6_dst);
+ ipv6_key->ipv6_label = flow->ipv6_label;
ipv6_key->ipv6_proto = flow->nw_proto;
ipv6_key->ipv6_tos = flow->tos_frag & IP_DSCP_MASK;
ipv6_key->ipv6_frag = tos_frag_to_odp_frag(flow->tos_frag);
ipv6_key = nl_attr_get(nla);
memcpy(&flow->ipv6_src, ipv6_key->ipv6_src, sizeof flow->ipv6_src);
memcpy(&flow->ipv6_dst, ipv6_key->ipv6_dst, sizeof flow->ipv6_dst);
+ flow->ipv6_label = ipv6_key->ipv6_label;
flow->nw_proto = ipv6_key->ipv6_proto;
if (!odp_to_tos_frag(ipv6_key->ipv6_tos, ipv6_key->ipv6_frag,
flow)) {
* OVS_KEY_ATTR_ETHERNET 12 -- 4 16
* OVS_KEY_ATTR_8021Q 4 -- 4 8
* OVS_KEY_ATTR_ETHERTYPE 2 2 4 8
- * OVS_KEY_ATTR_IPV6 34 2 4 40
+ * OVS_KEY_ATTR_IPV6 38 2 4 44
* OVS_KEY_ATTR_ICMPV6 2 2 4 8
* OVS_KEY_ATTR_ND 28 -- 4 32
* -------------------------------------------------
- * total 140
+ * total 144
*/
-#define ODPUTIL_FLOW_KEY_BYTES 140
+#define ODPUTIL_FLOW_KEY_BYTES 144
/* A buffer with sufficient size and alignment to hold an nlattr-formatted flow
* key. An array of "struct nlattr" might not, in theory, be sufficiently
void
ofputil_wildcard_from_openflow(uint32_t ofpfw, struct flow_wildcards *wc)
{
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 3);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 4);
/* Initialize most of rule->wc. */
flow_wildcards_init_catchall(wc);
wc->wildcards = (OVS_FORCE flow_wildcards_t) ofpfw & WC_INVARIANTS;
/* Wildcard fields that aren't defined by ofp_match or tun_id. */
- wc->wildcards |= (FWW_ARP_SHA | FWW_ARP_THA | FWW_ND_TARGET);
+ wc->wildcards |= (FWW_ARP_SHA | FWW_ARP_THA | FWW_ND_TARGET
+ | FWW_IPV6_LABEL);
if (!(ofpfw & OFPFW_NW_TOS)) {
wc->tos_frag_mask |= IP_DSCP_MASK;
{
const struct flow_wildcards *wc = &rule->wc;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 3);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 4);
/* Only NXM supports separately wildcards the Ethernet multicast bit. */
if (!(wc->wildcards & FWW_DL_DST) != !(wc->wildcards & FWW_ETH_MCAST)) {
return NXFF_NXM;
}
+ /* Only NXM supports matching IPv6 flow label. */
+ if (!(wc->wildcards & FWW_IPV6_LABEL)) {
+ return NXFF_NXM;
+ }
+
/* Other formats can express this rule. */
return NXFF_OPENFLOW10;
}
}
if (!(may_match & MAY_IPV6_ADDR)) {
wc.ipv6_src_mask = wc.ipv6_dst_mask = in6addr_any;
+ wc.wildcards |= FWW_IPV6_LABEL;
}
if (!(may_match & MAY_ND_TARGET)) {
wc.wildcards |= FWW_ND_TARGET;
} __attribute__((packed));
BUILD_ASSERT_DECL(ARP_ETH_HEADER_LEN == sizeof(struct arp_eth_header));
+/* The IPv6 flow label is in the lower 20 bits of the first 32-bit word. */
+#define IPV6_LABEL_MASK 0x000fffff
+
/* Example:
*
* char *string = "1 ::1 2";
in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x0800),ipv4(src=35.8.2.41,dst=172.16.0.20,proto=6,tos=0,frag=no),tcp(src=80,dst=8080)
in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x0800),ipv4(src=35.8.2.41,dst=172.16.0.20,proto=17,tos=0,frag=no),udp(src=81,dst=6632)
in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x0800),ipv4(src=35.8.2.41,dst=172.16.0.20,proto=1,tos=0,frag=no),icmp(type=1,code=2)
-in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,proto=10,tos=112,frag=no)
-in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,proto=10,tos=112,frag=first)
-in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,proto=10,tos=112,frag=later)
-in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,proto=6,tos=0,frag=no),tcp(src=80,dst=8080)
-in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,proto=17,tos=0,frag=no),udp(src=6630,dst=22)
-in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,proto=58,tos=0,frag=no),icmpv6(type=1,code=2)
-in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,proto=58,tos=0,frag=no),icmpv6(type=135,code=0),nd(target=::3)
-in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,proto=58,tos=0,frag=no),icmpv6(type=135,code=0),nd(target=::3,sll=00:05:06:07:08:09)
-in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,proto=58,tos=0,frag=no),icmpv6(type=136,code=0),nd(target=::3,tll=00:0a:0b:0c:0d:0e)
-in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,proto=58,tos=0,frag=no),icmpv6(type=136,code=0),nd(target=::3,sll=00:05:06:07:08:09,tll=00:0a:0b:0c:0d:0e)
+in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=10,tos=112,frag=no)
+in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=10,tos=112,frag=first)
+in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=10,tos=112,frag=later)
+in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=6,tos=0,frag=no),tcp(src=80,dst=8080)
+in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=17,tos=0,frag=no),udp(src=6630,dst=22)
+in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=58,tos=0,frag=no),icmpv6(type=1,code=2)
+in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=58,tos=0,frag=no),icmpv6(type=135,code=0),nd(target=::3)
+in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=58,tos=0,frag=no),icmpv6(type=135,code=0),nd(target=::3,sll=00:05:06:07:08:09)
+in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=58,tos=0,frag=no),icmpv6(type=136,code=0),nd(target=::3,tll=00:0a:0b:0c:0d:0e)
+in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=58,tos=0,frag=no),icmpv6(type=136,code=0),nd(target=::3,sll=00:05:06:07:08:09,tll=00:0a:0b:0c:0d:0e)
in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x0806),arp(sip=1.2.3.4,tip=5.6.7.8,op=1,sha=00:0f:10:11:12:13,tha=00:14:15:16:17:18)
])
tcp,tp_src=123,actions=flood
in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
arp,dl_src=00:0A:E4:25:6B:B0,arp_sha=00:0A:E4:25:6B:B0 actions=drop
+ipv6,ipv6_label=0x12345 actions=2
ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=3
ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5/64 actions=4
ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:5/127 actions=5
NXT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
NXT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
NXT_FLOW_MOD: ADD arp,dl_src=00:0a:e4:25:6b:b0,arp_sha=00:0a:e4:25:6b:b0 actions=drop
+NXT_FLOW_MOD: ADD ipv6,ipv6_label=0x12345 actions=output:2
NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output:3
NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1::/64 actions=output:4
NXT_FLOW_MOD: ADD ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:4/127 actions=output:5
tcp,tp_src=123,actions=flood
in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
arp,dl_src=00:0A:E4:25:6B:B0,arp_sha=00:0A:E4:25:6B:B0 actions=drop
+ipv6,ipv6_label=0x12345 actions=2
ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=3
ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5/64 actions=4
ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:5/127 actions=5
[[NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(007b) actions=FLOOD
NXT_FLOW_MOD: ADD NXM_OF_IN_PORT(fffe), NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_VLAN_TCI_W(1009/1fff) actions=drop
NXT_FLOW_MOD: ADD NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(000ae4256bb0) actions=drop
+NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_LABEL(00012345) actions=output:2
NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005) actions=output:3
NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000) actions=output:4
NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST_W(20010db83c4d00010002000300040004/fffffffffffffffffffffffffffffffe) actions=output:5
restricting a match to an IPv6 address prefix. A netmask is specified
as a CIDR block (e.g. \fB2001:db8:3c4d:1::/64\fR).
.
+.IP \fBipv6_label=\fIlabel\fR
+When \fBdl_type\fR is 0x86dd (possibly via shorthand, e.g., \fBipv6\fR
+or \fBtcp6\fR), matches IPv6 flow label \fIlabel\fR.
+.
.IP \fBnd_target=\fIipv6\fR
When \fBdl_type\fR, \fBnw_proto\fR, and \fBicmp_type\fR specify
IPv6 Neighbor Discovery (ICMPv6 type 135 or 136), matches the target address