summaryrefslogtreecommitdiffstats
path: root/drivers/net/vxlan.c
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2020-09-25 15:16:02 +0200
committerDavid S. Miller <davem@davemloft.net>2020-09-25 16:58:07 -0700
commit2ae2904b5bac4a554e0734cf494bb6d6fdfd4cd2 (patch)
tree3032c7971c4f4166ee1c402051f1db5ea6f0277a /drivers/net/vxlan.c
parent7470558240330f04dbf940430813233935314f78 (diff)
downloadlinux-2ae2904b5bac4a554e0734cf494bb6d6fdfd4cd2.tar.gz
linux-2ae2904b5bac4a554e0734cf494bb6d6fdfd4cd2.tar.bz2
linux-2ae2904b5bac4a554e0734cf494bb6d6fdfd4cd2.zip
vxlan: don't collect metadata if remote checksum is wrong
call vxlan_remcsum() before md filling in vxlan_rcv() Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r--drivers/net/vxlan.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index b9fefe27e3e8..47c762f7f5b1 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1875,6 +1875,10 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
!net_eq(vxlan->net, dev_net(vxlan->dev))))
goto drop;
+ if (vs->flags & VXLAN_F_REMCSUM_RX)
+ if (!vxlan_remcsum(&unparsed, skb, vs->flags))
+ goto drop;
+
if (vxlan_collect_metadata(vs)) {
struct metadata_dst *tun_dst;
@@ -1891,9 +1895,6 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
memset(md, 0, sizeof(*md));
}
- if (vs->flags & VXLAN_F_REMCSUM_RX)
- if (!vxlan_remcsum(&unparsed, skb, vs->flags))
- goto drop;
if (vs->flags & VXLAN_F_GBP)
vxlan_parse_gbp_hdr(&unparsed, skb, vs->flags, md);
/* Note that GBP and GPE can never be active together. This is