[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4ebe673f-a758-45a5-914a-d6ed60400dee@kernel.org>
Date: Fri, 15 Mar 2024 08:55:01 -0600
From: David Ahern <dsahern@...nel.org>
To: Tobias Brunner <tobias@...ongswan.org>, nicolas.dichtel@...nd.com,
"David S. Miller" <davem@...emloft.net>
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
On 3/15/24 8:31 AM, Tobias Brunner wrote:
>>> 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.
I agree with that; setting it in raw_send_hdrinc makes it consistent
across protocols.
Reviewed-by: David Ahern <dsahern@...nel.org>
Powered by blists - more mailing lists