netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfrm: fix inbound ipv4/udp/esp packets to UDPv6 dualstack sockets
@ 2022-10-26  8:32 Maciej Żenczykowski
  2022-10-26  8:42 ` Maciej Żenczykowski
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Maciej Żenczykowski @ 2022-10-26  8:32 UTC (permalink / raw)
  To: Maciej Żenczykowski
  Cc: Linux Network Development Mailing List, Sabrina Dubroca,
	Steffen Klassert

From: Maciej Żenczykowski <maze@google.com>

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: 0146dca70b87 ('xfrm: add support for UDPv6 encapsulation of ESP')
Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 net/ipv6/xfrm6_input.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c
index 04cbeefd8982..2d1c75b42709 100644
--- a/net/ipv6/xfrm6_input.c
+++ b/net/ipv6/xfrm6_input.c
@@ -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;
-- 
2.38.0.135.g90850a2211-goog


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-06-09  7:17 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-26  8:32 [PATCH] xfrm: fix inbound ipv4/udp/esp packets to UDPv6 dualstack sockets Maciej Żenczykowski
2022-10-26  8:42 ` Maciej Żenczykowski
2022-10-27  1:24   ` Jakub Kicinski
2022-10-27  1:52     ` Maciej Żenczykowski
2022-10-27  1:58       ` Jakub Kicinski
2022-10-27  4:47 ` kernel test robot
2023-06-05 11:06 ` [PATCH v2] " Maciej Żenczykowski
2023-06-05 12:59   ` Simon Horman
2023-06-05 21:38     ` Maciej Żenczykowski
2023-06-06  9:30       ` Simon Horman
2023-06-07  9:41       ` Steffen Klassert
2023-06-07 15:00       ` Sabrina Dubroca
2023-06-05 13:04   ` Simon Horman
2023-06-09  7:17   ` Steffen Klassert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).