Skip to content

Commit a4cbcc4

Browse files
tobiasbrunnerSasha Levin
authored and
Sasha Levin
committed
ipv4: raw: Fix sending packets from raw sockets via IPsec tunnels
[ Upstream commit c9b3b81 ] 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 9c9c9ad ("ipv6: set skb->protocol on tcp, raw and ip6_append_data genereated skbs"). Fixes: f479639 ("xfrm: Remove inner/outer modes from output path") Signed-off-by: Tobias Brunner <[email protected]> Reviewed-by: David Ahern <[email protected]> Reviewed-by: Nicolas Dichtel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 0f25725 commit a4cbcc4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/ipv4/raw.c

+1
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
350350
goto error;
351351
skb_reserve(skb, hlen);
352352

353+
skb->protocol = htons(ETH_P_IP);
353354
skb->priority = READ_ONCE(sk->sk_priority);
354355
skb->mark = sockc->mark;
355356
skb->tstamp = sockc->transmit_time;

0 commit comments

Comments
 (0)