|
45 | 45 | (TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT | \
|
46 | 46 | TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST)
|
47 | 47 |
|
48 |
| -#define TUNNEL_FLAGS_PRESENT (\ |
49 |
| - _BITUL(IP_TUNNEL_CSUM_BIT) | \ |
50 |
| - _BITUL(IP_TUNNEL_DONT_FRAGMENT_BIT) | \ |
51 |
| - _BITUL(IP_TUNNEL_OAM_BIT) | \ |
52 |
| - _BITUL(IP_TUNNEL_CRIT_OPT_BIT)) |
| 48 | +#define TCA_FLOWER_KEY_ENC_FLAGS_POLICY_MASK \ |
| 49 | + (TCA_FLOWER_KEY_FLAGS_TUNNEL_CSUM | \ |
| 50 | + TCA_FLOWER_KEY_FLAGS_TUNNEL_DONT_FRAGMENT | \ |
| 51 | + TCA_FLOWER_KEY_FLAGS_TUNNEL_OAM | \ |
| 52 | + TCA_FLOWER_KEY_FLAGS_TUNNEL_CRIT_OPT) |
53 | 53 |
|
54 | 54 | struct fl_flow_key {
|
55 | 55 | struct flow_dissector_key_meta meta;
|
@@ -745,10 +745,10 @@ static const struct nla_policy fl_policy[TCA_FLOWER_MAX + 1] = {
|
745 | 745 | [TCA_FLOWER_KEY_SPI_MASK] = { .type = NLA_U32 },
|
746 | 746 | [TCA_FLOWER_L2_MISS] = NLA_POLICY_MAX(NLA_U8, 1),
|
747 | 747 | [TCA_FLOWER_KEY_CFM] = { .type = NLA_NESTED },
|
748 |
| - [TCA_FLOWER_KEY_ENC_FLAGS] = NLA_POLICY_MASK(NLA_U32, |
749 |
| - TUNNEL_FLAGS_PRESENT), |
750 |
| - [TCA_FLOWER_KEY_ENC_FLAGS_MASK] = NLA_POLICY_MASK(NLA_U32, |
751 |
| - TUNNEL_FLAGS_PRESENT), |
| 748 | + [TCA_FLOWER_KEY_ENC_FLAGS] = NLA_POLICY_MASK(NLA_BE32, |
| 749 | + TCA_FLOWER_KEY_ENC_FLAGS_POLICY_MASK), |
| 750 | + [TCA_FLOWER_KEY_ENC_FLAGS_MASK] = NLA_POLICY_MASK(NLA_BE32, |
| 751 | + TCA_FLOWER_KEY_ENC_FLAGS_POLICY_MASK), |
752 | 752 | };
|
753 | 753 |
|
754 | 754 | static const struct nla_policy
|
@@ -1866,21 +1866,6 @@ static int fl_set_key_cfm(struct nlattr **tb,
|
1866 | 1866 | return 0;
|
1867 | 1867 | }
|
1868 | 1868 |
|
1869 |
| -static int fl_set_key_enc_flags(struct nlattr **tb, u32 *flags_key, |
1870 |
| - u32 *flags_mask, struct netlink_ext_ack *extack) |
1871 |
| -{ |
1872 |
| - /* mask is mandatory for flags */ |
1873 |
| - if (NL_REQ_ATTR_CHECK(extack, NULL, tb, TCA_FLOWER_KEY_ENC_FLAGS_MASK)) { |
1874 |
| - NL_SET_ERR_MSG(extack, "missing enc_flags mask"); |
1875 |
| - return -EINVAL; |
1876 |
| - } |
1877 |
| - |
1878 |
| - *flags_key = nla_get_u32(tb[TCA_FLOWER_KEY_ENC_FLAGS]); |
1879 |
| - *flags_mask = nla_get_u32(tb[TCA_FLOWER_KEY_ENC_FLAGS_MASK]); |
1880 |
| - |
1881 |
| - return 0; |
1882 |
| -} |
1883 |
| - |
1884 | 1869 | static int fl_set_key(struct net *net, struct nlattr **tb,
|
1885 | 1870 | struct fl_flow_key *key, struct fl_flow_key *mask,
|
1886 | 1871 | struct netlink_ext_ack *extack)
|
@@ -2123,8 +2108,8 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
|
2123 | 2108 | }
|
2124 | 2109 |
|
2125 | 2110 | if (tb[TCA_FLOWER_KEY_ENC_FLAGS])
|
2126 |
| - ret = fl_set_key_enc_flags(tb, &key->enc_flags.flags, |
2127 |
| - &mask->enc_flags.flags, extack); |
| 2111 | + ret = fl_set_key_flags(tb, true, &key->enc_control.flags, |
| 2112 | + &mask->enc_control.flags, extack); |
2128 | 2113 |
|
2129 | 2114 | return ret;
|
2130 | 2115 | }
|
@@ -3381,22 +3366,6 @@ static int fl_dump_key_cfm(struct sk_buff *skb,
|
3381 | 3366 | return err;
|
3382 | 3367 | }
|
3383 | 3368 |
|
3384 |
| -static int fl_dump_key_enc_flags(struct sk_buff *skb, |
3385 |
| - struct flow_dissector_key_enc_flags *key, |
3386 |
| - struct flow_dissector_key_enc_flags *mask) |
3387 |
| -{ |
3388 |
| - if (!memchr_inv(mask, 0, sizeof(*mask))) |
3389 |
| - return 0; |
3390 |
| - |
3391 |
| - if (nla_put_u32(skb, TCA_FLOWER_KEY_ENC_FLAGS, key->flags)) |
3392 |
| - return -EMSGSIZE; |
3393 |
| - |
3394 |
| - if (nla_put_u32(skb, TCA_FLOWER_KEY_ENC_FLAGS_MASK, mask->flags)) |
3395 |
| - return -EMSGSIZE; |
3396 |
| - |
3397 |
| - return 0; |
3398 |
| -} |
3399 |
| - |
3400 | 3369 | static int fl_dump_key_options(struct sk_buff *skb, int enc_opt_type,
|
3401 | 3370 | struct flow_dissector_key_enc_opts *enc_opts)
|
3402 | 3371 | {
|
@@ -3699,7 +3668,8 @@ static int fl_dump_key(struct sk_buff *skb, struct net *net,
|
3699 | 3668 | if (fl_dump_key_cfm(skb, &key->cfm, &mask->cfm))
|
3700 | 3669 | goto nla_put_failure;
|
3701 | 3670 |
|
3702 |
| - if (fl_dump_key_enc_flags(skb, &key->enc_flags, &mask->enc_flags)) |
| 3671 | + if (fl_dump_key_flags(skb, true, key->enc_control.flags, |
| 3672 | + mask->enc_control.flags)) |
3703 | 3673 | goto nla_put_failure;
|
3704 | 3674 |
|
3705 | 3675 | return 0;
|
|
0 commit comments