@@ -428,6 +428,8 @@ parse_tc_flower_to_match(struct tc_flower *flower,
match_set_nw_ttl_masked(match, key->ip_ttl, mask->ip_ttl);
+ match_set_nw_frag_masked(match, key->ip_frag, mask->ip_frag);
+
match_set_nw_src_masked(match, key->ipv4.ipv4_src, mask->ipv4.ipv4_src);
match_set_nw_dst_masked(match, key->ipv4.ipv4_dst, mask->ipv4.ipv4_dst);
@@ -932,6 +934,16 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match,
flower.key.ip_ttl = key->nw_ttl;
flower.mask.ip_ttl = mask->nw_ttl;
+ if (mask->nw_frag) {
+ if (key->nw_frag) {
+ return EOPNOTSUPP;
+ }
+
+ flower.key.ip_frag = key->nw_frag;
+ flower.mask.ip_frag = mask->nw_frag;
+ mask->nw_frag = 0;
+ }
+
if (key->nw_proto == IPPROTO_TCP) {
flower.key.tcp_dst = key->tp_dst;
flower.mask.tcp_dst = mask->tp_dst;
@@ -958,7 +970,6 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match,
mask->tp_dst = 0;
}
- mask->nw_frag = 0;
mask->nw_tos = 0;
mask->nw_proto = 0;
mask->nw_ttl = 0;
@@ -281,6 +281,8 @@ static const struct nl_policy tca_flower_policy[] = {
.optional = true, },
[TCA_FLOWER_KEY_ENC_UDP_DST_PORT] = { .type = NL_A_U16,
.optional = true, },
+ [TCA_FLOWER_KEY_FLAGS] = { .type = NL_A_BE32, .optional = true, },
+ [TCA_FLOWER_KEY_FLAGS_MASK] = { .type = NL_A_BE32, .optional = true, },
[TCA_FLOWER_KEY_IP_TTL] = { .type = NL_A_U8,
.optional = true, },
[TCA_FLOWER_KEY_IP_TTL_MASK] = { .type = NL_A_U8,
@@ -374,6 +376,15 @@ nl_parse_flower_ip(struct nlattr **attrs, struct tc_flower *flower) {
mask->ip_proto = UINT8_MAX;
}
+ if (attrs[TCA_FLOWER_KEY_FLAGS_MASK]) {
+ uint32_t flags = ntohl(nl_attr_get_u32(attrs[TCA_FLOWER_KEY_FLAGS]));
+ uint32_t flags_mask =
+ ntohl(nl_attr_get_u32(attrs[TCA_FLOWER_KEY_FLAGS_MASK]));
+
+ key->ip_frag = flags & TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT;
+ mask->ip_frag = flags_mask & TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT;
+ }
+
if (attrs[TCA_FLOWER_KEY_IPV4_SRC_MASK]) {
key->ipv4.ipv4_src =
nl_attr_get_be32(attrs[TCA_FLOWER_KEY_IPV4_SRC]);
@@ -1490,11 +1501,28 @@ nl_msg_put_flower_options(struct ofpbuf *request, struct tc_flower *flower)
FLOWER_PUT_MASKED_VALUE(src_mac, TCA_FLOWER_KEY_ETH_SRC);
if (host_eth_type == ETH_P_IP || host_eth_type == ETH_P_IPV6) {
+ uint32_t flags = 0;
+ uint32_t flags_mask = 0;
+
if (flower->mask.ip_proto && flower->key.ip_proto) {
nl_msg_put_u8(request, TCA_FLOWER_KEY_IP_PROTO,
flower->key.ip_proto);
}
+ if (flower->mask.ip_frag) {
+ flags_mask |= TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT;
+
+ if (flower->key.ip_frag) {
+ flags |= TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT;
+ }
+ }
+
+ if (flags_mask) {
+ nl_msg_put_u32(request, TCA_FLOWER_KEY_FLAGS, htonl(flags));
+ nl_msg_put_u32(request, TCA_FLOWER_KEY_FLAGS_MASK,
+ htonl(flags_mask));
+ }
+
if (flower->key.ip_proto == IPPROTO_UDP) {
FLOWER_PUT_MASKED_VALUE(udp_src, TCA_FLOWER_KEY_UDP_SRC);
FLOWER_PUT_MASKED_VALUE(udp_dst, TCA_FLOWER_KEY_UDP_DST);
@@ -93,6 +93,7 @@ struct tc_flower_key {
ovs_be16 encap_eth_type;
uint8_t ip_ttl;
+ uint8_t ip_frag;
struct {
ovs_be32 ipv4_src;