diff options
author | David S. Miller <davem@davemloft.net> | 2020-09-15 02:49:39 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-09-15 02:49:39 +0300 |
commit | ad7b27c9e64afce4ad69020329a3e89f6df4f382 (patch) | |
tree | 4eb7a4a9a92ba5e9dbcf96ce35b879738bcf6e7c /net | |
parent | ff48b6222e65ebdba5a403ef1deba6214e749193 (diff) | |
parent | 681d2cfb790339a3e95b98bc140baf1f816a896a (diff) | |
download | linux-ad7b27c9e64afce4ad69020329a3e89f6df4f382.tar.xz |
Merge branch 'net-improve-vxlan-option-process-in-net_sched-and-lwtunnel'
Xin Long says:
====================
net: improve vxlan option process in net_sched and lwtunnel
This patch is to do some mask when setting vxlan option in net_sched
and lwtunnel, so that only available bits can be set on vxlan md gbp.
This would help when users don't know exactly vxlan's gbp bits, and
avoid some mismatch because of some unavailable bits set by users.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/ip_tunnel_core.c | 1 | ||||
-rw-r--r-- | net/sched/act_tunnel_key.c | 1 | ||||
-rw-r--r-- | net/sched/cls_flower.c | 4 |
3 files changed, 5 insertions, 1 deletions
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c index 75c6013ff9a4..b2ea1a8c5fd6 100644 --- a/net/ipv4/ip_tunnel_core.c +++ b/net/ipv4/ip_tunnel_core.c @@ -554,6 +554,7 @@ static int ip_tun_parse_opts_vxlan(struct nlattr *attr, attr = tb[LWTUNNEL_IP_OPT_VXLAN_GBP]; md->gbp = nla_get_u32(attr); + md->gbp &= VXLAN_GBP_MASK; info->key.tun_flags |= TUNNEL_VXLAN_OPT; } diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c index 536c4bc31be6..37f1e10f35e0 100644 --- a/net/sched/act_tunnel_key.c +++ b/net/sched/act_tunnel_key.c @@ -156,6 +156,7 @@ tunnel_key_copy_vxlan_opt(const struct nlattr *nla, void *dst, int dst_len, struct vxlan_metadata *md = dst; md->gbp = nla_get_u32(tb[TCA_TUNNEL_KEY_ENC_OPT_VXLAN_GBP]); + md->gbp &= VXLAN_GBP_MASK; } return sizeof(struct vxlan_metadata); diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index a4f7ef1de7e7..e8fda1bd4d9d 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -1175,8 +1175,10 @@ static int fl_set_vxlan_opt(const struct nlattr *nla, struct fl_flow_key *key, return -EINVAL; } - if (tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP]) + if (tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP]) { md->gbp = nla_get_u32(tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP]); + md->gbp &= VXLAN_GBP_MASK; + } return sizeof(*md); } |