Skip to content

Commit 1166a53

Browse files
zenczykowskiklassert
authored andcommitted
xfrm: fix inbound ipv4/udp/esp packets to UDPv6 dualstack sockets
Before Linux v5.8 an AF_INET6 SOCK_DGRAM (udp/udplite) socket with SOL_UDP, UDP_ENCAP, UDP_ENCAP_ESPINUDP{,_NON_IKE} enabled would just unconditionally use xfrm4_udp_encap_rcv(), afterwards such a socket would use the newly added xfrm6_udp_encap_rcv() which only handles IPv6 packets. Cc: Sabrina Dubroca <[email protected]> Cc: Steffen Klassert <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Benedict Wong <[email protected]> Cc: Yan Yan <[email protected]> Fixes: 0146dca ("xfrm: add support for UDPv6 encapsulation of ESP") Signed-off-by: Maciej Żenczykowski <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Sabrina Dubroca <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent bf06fcf commit 1166a53

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

net/ipv4/xfrm4_input.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
164164
kfree_skb(skb);
165165
return 0;
166166
}
167+
EXPORT_SYMBOL(xfrm4_udp_encap_rcv);
167168

168169
int xfrm4_rcv(struct sk_buff *skb)
169170
{

net/ipv6/xfrm6_input.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
8686
__be32 *udpdata32;
8787
__u16 encap_type = up->encap_type;
8888

89+
if (skb->protocol == htons(ETH_P_IP))
90+
return xfrm4_udp_encap_rcv(sk, skb);
91+
8992
/* if this is not encapsulated socket, then just return now */
9093
if (!encap_type)
9194
return 1;

0 commit comments

Comments
 (0)