Skip to content

Commit

Permalink
xfrm: fix inbound ipv4/udp/esp packets to UDPv6 dualstack sockets
Browse files Browse the repository at this point in the history
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 <sd@queasysnail.net>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Fixes: 0146dca ('xfrm: add support for UDPv6 encapsulation of ESP')
Signed-off-by: Maciej Żenczykowski <maze@google.com>
  • Loading branch information
zenczykowski authored and intel-lab-lkp committed Oct 26, 2022
1 parent e91001b commit aac18d0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/ipv6/xfrm6_input.c
Expand Up @@ -86,6 +86,9 @@ int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
__be32 *udpdata32;
__u16 encap_type = up->encap_type;

if (skb->protocol == htons(ETH_P_IP))
xfrm4_udp_encap_rcv(sk, skb);

/* if this is not encapsulated socket, then just return now */
if (!encap_type)
return 1;
Expand Down

0 comments on commit aac18d0

Please sign in to comment.