lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 15 Mar 2024 15:31:14 +0100
From: Tobias Brunner <tobias@...ongswan.org>
To: nicolas.dichtel@...nd.com, "David S. Miller" <davem@...emloft.net>,
 David Ahern <dsahern@...nel.org>
Cc: netdev@...r.kernel.org, Steffen Klassert <steffen.klassert@...unet.com>,
 Herbert Xu <herbert@...dor.apana.org.au>
Subject: Re: [PATCH net] ipv4: raw: Fix sending packets from raw sockets via
 IPsec tunnels

>> Since the referenced commit, the xfrm_inner_extract_output() function
>> uses the skb's 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: 5f24f41e8ea6 ("xfrm: Remove inner/outer modes from input path")This is the input part, I presume you were thinking to the output part:
> Fixes: f4796398f21b ("xfrm: Remove inner/outer modes from output path")

Right, will fix.

>> Signed-off-by: Tobias Brunner <tobias@...ongswan.org>
>> ---
>>  net/ipv4/raw.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
>> index 42ac434cfcfa..322e389021c3 100644
>> --- a/net/ipv4/raw.c
>> +++ b/net/ipv4/raw.c
>> @@ -357,6 +357,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;
> For !ipsec packet, dst_output()/ ip_output() is called. This last function set
> skb->protocol to htons(ETH_P_IP).
> What about doing the same in xfrm4_output() to avoid missing another path?

I took this approach because it worked and it aligns the code with the
IPv6 version.  Whether the code path would actually pass through the
function you mention before hitting the problematic one I don't know.

Regards,
Tobias


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ