Skip to content

Commit 905e83c

Browse files
Guillaume Naultgregkh
authored andcommitted
bareudp: Pull inner IP header on xmit.
[ Upstream commit c471236 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 61761f0 commit 905e83c

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
@@ -319,6 +319,9 @@ static int bareudp_xmit_skb(struct sk_buff *skb, struct net_device *dev,
319319
__be32 saddr;
320320
int err;
321321

322+
if (!skb_vlan_inet_prepare(skb, skb->protocol != htons(ETH_P_TEB)))
323+
return -EINVAL;
324+
322325
if (!sock)
323326
return -ESHUTDOWN;
324327

@@ -382,6 +385,9 @@ static int bareudp6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
382385
__be16 sport;
383386
int err;
384387

388+
if (!skb_vlan_inet_prepare(skb, skb->protocol != htons(ETH_P_TEB)))
389+
return -EINVAL;
390+
385391
if (!sock)
386392
return -ESHUTDOWN;
387393

0 commit comments

Comments
 (0)