All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Tobias Brunner <tobias@strongswan.org>,
	nicolas.dichtel@6wind.com,
	"David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH net] ipv4: raw: Fix sending packets from raw sockets via IPsec tunnels
Date: Fri, 15 Mar 2024 08:55:01 -0600	[thread overview]
Message-ID: <4ebe673f-a758-45a5-914a-d6ed60400dee@kernel.org> (raw)
In-Reply-To: <ec5aacb4-e38c-4c26-a469-69f3315a81d8@strongswan.org>

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@kernel.org>


      reply	other threads:[~2024-03-15 14:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-15 12:25 [PATCH net] ipv4: raw: Fix sending packets from raw sockets via IPsec tunnels Tobias Brunner
2024-03-15 13:48 ` Nicolas Dichtel
2024-03-15 14:31   ` Tobias Brunner
2024-03-15 14:55     ` David Ahern [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ebe673f-a758-45a5-914a-d6ed60400dee@kernel.org \
    --to=dsahern@kernel.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=steffen.klassert@secunet.com \
    --cc=tobias@strongswan.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.