net: fou: remove redundant code in gue_udp_recv
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Tue, 9 Apr 2019 10:03:07 +0000 (12:03 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Apr 2019 07:08:51 +0000 (00:08 -0700)
Remove not useful protocol version check in gue_udp_recv since just
gue version 0 can hit that code. Moreover remove duplicated hdrlen
computation

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/fou.c

index d2a2f3258e4bdb41fdee478e15c071e473febb13..b038f563baa411e01e466b484b2a541ab520c2d4 100644 (file)
@@ -170,9 +170,7 @@ static int gue_udp_recv(struct sock *sk, struct sk_buff *skb)
        /* guehdr may change after pull */
        guehdr = (struct guehdr *)&udp_hdr(skb)[1];
 
-       hdrlen = sizeof(struct guehdr) + optlen;
-
-       if (guehdr->version != 0 || validate_gue_flags(guehdr, optlen))
+       if (validate_gue_flags(guehdr, optlen))
                goto drop;
 
        hdrlen = sizeof(struct guehdr) + optlen;