diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 5c3c7169c0a2..78f9d588f712 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -365,13 +365,6 @@ static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb) if (unlikely(geneveh->ver != GENEVE_VER)) goto drop; - inner_proto = geneveh->proto_type; - - if (unlikely((inner_proto != htons(ETH_P_TEB) && - inner_proto != htons(ETH_P_IP) && - inner_proto != htons(ETH_P_IPV6)))) - goto drop; - gs = rcu_dereference_sk_user_data(sk); if (!gs) goto drop; @@ -380,6 +373,8 @@ static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb) if (!geneve) goto drop; + inner_proto = geneveh->proto_type; + if (unlikely((!geneve->cfg.inner_proto_inherit && inner_proto != htons(ETH_P_TEB)))) { geneve->dev->stats.rx_dropped++;