All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] ipv6: fix typos in __ip6_finish_output()
@ 2021-11-19  1:37 Eric Dumazet
  2021-11-19  3:48 ` David Ahern
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Dumazet @ 2021-11-19  1:37 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Eric Dumazet, Tobias Brunner,
	Steffen Klassert, David Ahern

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
-- 
2.34.0.rc2.393.gf8c9666880-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] ipv6: fix typos in __ip6_finish_output()
  2021-11-19  1:37 [PATCH net] ipv6: fix typos in __ip6_finish_output() Eric Dumazet
@ 2021-11-19  3:48 ` David Ahern
  2021-11-19 13:59 ` Tobias Brunner
  2021-11-22 12:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2021-11-19  3:48 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Tobias Brunner, Steffen Klassert, David Ahern

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>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] ipv6: fix typos in __ip6_finish_output()
  2021-11-19  1:37 [PATCH net] ipv6: fix typos in __ip6_finish_output() Eric Dumazet
  2021-11-19  3:48 ` David Ahern
@ 2021-11-19 13:59 ` Tobias Brunner
  2021-11-22 12:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Tobias Brunner @ 2021-11-19 13:59 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Steffen Klassert, David Ahern

On 19.11.21 02:37, 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
> 

Thanks for catching this.

Tested-by: Tobias Brunner <tobias@strongswan.org>
Acked-by: Tobias Brunner <tobias@strongswan.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] ipv6: fix typos in __ip6_finish_output()
  2021-11-19  1:37 [PATCH net] ipv6: fix typos in __ip6_finish_output() Eric Dumazet
  2021-11-19  3:48 ` David Ahern
  2021-11-19 13:59 ` Tobias Brunner
@ 2021-11-22 12:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-11-22 12:50 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: davem, kuba, netdev, edumazet, tobias, steffen.klassert, dsahern

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 18 Nov 2021 17:37:58 -0800 you 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.
> 
> [...]

Here is the summary with links:
  - [net] ipv6: fix typos in __ip6_finish_output()
    https://git.kernel.org/netdev/net/c/19d36c5f2948

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-22 12:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19  1:37 [PATCH net] ipv6: fix typos in __ip6_finish_output() Eric Dumazet
2021-11-19  3:48 ` David Ahern
2021-11-19 13:59 ` Tobias Brunner
2021-11-22 12:50 ` patchwork-bot+netdevbpf

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.