summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2024-03-15 17:35:40 +0300
committerSasha Levin <sashal@kernel.org>2024-03-27 01:17:36 +0300
commitac935a605cab6b03fdce3c0e1e25f0de125aea1e (patch)
tree1feb19bb146d2790c49ec3dbd14725d0504b90f2 /net
parent770e3ab94e6e5faefa2652457ef6162c4ba76f65 (diff)
downloadlinux-ac935a605cab6b03fdce3c0e1e25f0de125aea1e.tar.xz
ipv4: raw: Fix sending packets from raw sockets via IPsec tunnels
[ Upstream commit c9b3b81716c5b92132a6c1d4ac3c48a7b44082ab ] Since the referenced commit, the xfrm_inner_extract_output() function uses the protocol field to determine the address family. So not setting it for IPv4 raw sockets meant that such packets couldn't be tunneled via IPsec anymore. IPv6 raw sockets are not affected as they already set the protocol since 9c9c9ad5fae7 ("ipv6: set skb->protocol on tcp, raw and ip6_append_data genereated skbs"). Fixes: f4796398f21b ("xfrm: Remove inner/outer modes from output path") Signed-off-by: Tobias Brunner <tobias@strongswan.org> Reviewed-by: David Ahern <dsahern@kernel.org> Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://lore.kernel.org/r/c5d9a947-eb19-4164-ac99-468ea814ce20@strongswan.org Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/raw.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index aea89326c697..288f1846b351 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -350,6 +350,7 @@ static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
goto error;
skb_reserve(skb, hlen);
+ skb->protocol = htons(ETH_P_IP);
skb->priority = READ_ONCE(sk->sk_priority);
skb->mark = sockc->mark;
skb->tstamp = sockc->transmit_time;