Skip to content

Commit c9b3b81

Browse files
tobiasbrunnerPaolo Abeni
authored andcommitted
ipv4: raw: Fix sending packets from raw sockets via IPsec tunnels
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]>
1 parent 3cf28cd commit c9b3b81

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/ipv4/raw.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
357357
goto error;
358358
skb_reserve(skb, hlen);
359359

360+
skb->protocol = htons(ETH_P_IP);
360361
skb->priority = READ_ONCE(sk->sk_priority);
361362
skb->mark = sockc->mark;
362363
skb->tstamp = sockc->transmit_time;

0 commit comments

Comments
 (0)