Skip to content

Commit c471236

Browse files
Guillaume Naultkuba-moo
authored andcommitted
bareudp: Pull inner IP header on xmit.
Both bareudp_xmit_skb() and bareudp6_xmit_skb() read their skb's inner IP header to get its ECN value (with ip_tunnel_ecn_encap()). Therefore we need to ensure that the inner IP header is part of the skb's linear data. Fixes: 571912c ("net: UDP tunnel encapsulation module for tunnelling different protocols like MPLS, IP, NSH etc.") Signed-off-by: Guillaume Nault <[email protected]> Reviewed-by: Willem de Bruijn <[email protected]> Link: https://patch.msgid.link/267328222f0a11519c6de04c640a4f87a38ea9ed.1726046181.git.gnault@redhat.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 45fa29c commit c471236

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/net/bareudp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ static int bareudp_xmit_skb(struct sk_buff *skb, struct net_device *dev,
317317
__be32 saddr;
318318
int err;
319319

320+
if (!skb_vlan_inet_prepare(skb, skb->protocol != htons(ETH_P_TEB)))
321+
return -EINVAL;
322+
320323
if (!sock)
321324
return -ESHUTDOWN;
322325

@@ -384,6 +387,9 @@ static int bareudp6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
384387
__be16 sport;
385388
int err;
386389

390+
if (!skb_vlan_inet_prepare(skb, skb->protocol != htons(ETH_P_TEB)))
391+
return -EINVAL;
392+
387393
if (!sock)
388394
return -ESHUTDOWN;
389395

0 commit comments

Comments
 (0)