netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev <netdev@vger.kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Tobias Brunner <tobias@strongswan.org>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	David Ahern <dsahern@kernel.org>
Subject: Re: [PATCH net] ipv6: fix typos in __ip6_finish_output()
Date: Thu, 18 Nov 2021 20:48:17 -0700	[thread overview]
Message-ID: <e48ceee7-b101-44f3-1bbc-6fbcdf9194db@gmail.com> (raw)
In-Reply-To: <20211119013758.2740195-1-eric.dumazet@gmail.com>

On 11/18/21 6:37 PM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> We deal with IPv6 packets, so we need to use IP6CB(skb)->flags and
> IP6SKB_REROUTED, instead of IPCB(skb)->flags and IPSKB_REROUTED
> 
> Found by code inspection, please double check that fixing this bug
> does not surface other bugs.
> 
> Fixes: 09ee9dba9611 ("ipv6: Reinject IPv6 packets if IPsec policy matches after SNAT")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Tobias Brunner <tobias@strongswan.org>
> Cc: Steffen Klassert <steffen.klassert@secunet.com>
> Cc: David Ahern <dsahern@kernel.org>
> ---
>  net/ipv6/ip6_output.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index 2f044a49afa8cf3586c36607c34073edecafc69c..ff4e83e2a5068322bb93391c7c5e2a8cb932730b 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -174,7 +174,7 @@ static int __ip6_finish_output(struct net *net, struct sock *sk, struct sk_buff
>  #if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM)
>  	/* Policy lookup after SNAT yielded a new policy */
>  	if (skb_dst(skb)->xfrm) {
> -		IPCB(skb)->flags |= IPSKB_REROUTED;
> +		IP6CB(skb)->flags |= IP6SKB_REROUTED;
>  		return dst_output(net, sk, skb);
>  	}
>  #endif
> 

How did that even work - the flags are at different offsets.

VRF driver has the same mistake in vrf_output6_direct (I followed ipv6
code back when and did not pick up on the mistake). prepare_ipv6_hdr in
rxe_net.c has a similar style mistake.

Reviewed-by: David Ahern <dsahern@kernel.org>


  reply	other threads:[~2021-11-19  3:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19  1:37 [PATCH net] ipv6: fix typos in __ip6_finish_output() Eric Dumazet
2021-11-19  3:48 ` David Ahern [this message]
2021-11-19 13:59 ` Tobias Brunner
2021-11-22 12:50 ` patchwork-bot+netdevbpf

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=e48ceee7-b101-44f3-1bbc-6fbcdf9194db@gmail.com \
    --to=dsahern@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).