All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] vrf: Reset IPCB/IP6CB when processing outbound pkts in vrf dev xmit
@ 2021-11-30 16:26 Stephen Suryaputra
  2021-12-01  2:15 ` David Ahern
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stephen Suryaputra @ 2021-11-30 16:26 UTC (permalink / raw)
  To: netdev, dsahern; +Cc: Stephen Suryaputra

IPCB/IP6CB need to be initialized when processing outbound v4 or v6 pkts
in the codepath of vrf device xmit function so that leftover garbage
doesn't cause futher code that uses the CB to incorrectly process the
pkt.

One occasion of the issue might occur when MPLS route uses the vrf
device as the outgoing device such as when the route is added using "ip
-f mpls route add <label> dev <vrf>" command.

The problems seems to exist since day one. Hence I put the day one
commits on the Fixes tags.

Fixes: 193125dbd8eb ("net: Introduce VRF device driver")
Fixes: 35402e313663 ("net: Add IPv6 support to VRF device")
Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>
---
 drivers/net/vrf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index ccf677015d5b..131c745dc701 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -497,6 +497,7 @@ static netdev_tx_t vrf_process_v6_outbound(struct sk_buff *skb,
 	/* strip the ethernet header added for pass through VRF device */
 	__skb_pull(skb, skb_network_offset(skb));
 
+	memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
 	ret = vrf_ip6_local_out(net, skb->sk, skb);
 	if (unlikely(net_xmit_eval(ret)))
 		dev->stats.tx_errors++;
@@ -579,6 +580,7 @@ static netdev_tx_t vrf_process_v4_outbound(struct sk_buff *skb,
 					       RT_SCOPE_LINK);
 	}
 
+	memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
 	ret = vrf_ip_local_out(dev_net(skb_dst(skb)->dev), skb->sk, skb);
 	if (unlikely(net_xmit_eval(ret)))
 		vrf_dev->stats.tx_errors++;
-- 
2.25.1


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

* Re: [PATCH net] vrf: Reset IPCB/IP6CB when processing outbound pkts in vrf dev xmit
  2021-11-30 16:26 [PATCH net] vrf: Reset IPCB/IP6CB when processing outbound pkts in vrf dev xmit Stephen Suryaputra
@ 2021-12-01  2:15 ` David Ahern
  2021-12-01  8:18 ` Nicolas Dichtel
  2021-12-02  3:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2021-12-01  2:15 UTC (permalink / raw)
  To: Stephen Suryaputra, netdev

On 11/30/21 9:26 AM, Stephen Suryaputra wrote:
> IPCB/IP6CB need to be initialized when processing outbound v4 or v6 pkts
> in the codepath of vrf device xmit function so that leftover garbage
> doesn't cause futher code that uses the CB to incorrectly process the
> pkt.
> 
> One occasion of the issue might occur when MPLS route uses the vrf
> device as the outgoing device such as when the route is added using "ip
> -f mpls route add <label> dev <vrf>" command.
> 
> The problems seems to exist since day one. Hence I put the day one
> commits on the Fixes tags.
> 
> Fixes: 193125dbd8eb ("net: Introduce VRF device driver")
> Fixes: 35402e313663 ("net: Add IPv6 support to VRF device")
> Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>
> ---
>  drivers/net/vrf.c | 2 ++
>  1 file changed, 2 insertions(+)
> 

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


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

* Re: [PATCH net] vrf: Reset IPCB/IP6CB when processing outbound pkts in vrf dev xmit
  2021-11-30 16:26 [PATCH net] vrf: Reset IPCB/IP6CB when processing outbound pkts in vrf dev xmit Stephen Suryaputra
  2021-12-01  2:15 ` David Ahern
@ 2021-12-01  8:18 ` Nicolas Dichtel
  2021-12-02  3:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Nicolas Dichtel @ 2021-12-01  8:18 UTC (permalink / raw)
  To: Stephen Suryaputra, netdev, dsahern, stable

Le 30/11/2021 à 17:26, Stephen Suryaputra a écrit :
> IPCB/IP6CB need to be initialized when processing outbound v4 or v6 pkts
> in the codepath of vrf device xmit function so that leftover garbage
> doesn't cause futher code that uses the CB to incorrectly process the
> pkt.
> 
> One occasion of the issue might occur when MPLS route uses the vrf
> device as the outgoing device such as when the route is added using "ip
> -f mpls route add <label> dev <vrf>" command.
> 
> The problems seems to exist since day one. Hence I put the day one
> commits on the Fixes tags.
> 
> Fixes: 193125dbd8eb ("net: Introduce VRF device driver")
> Fixes: 35402e313663 ("net: Add IPv6 support to VRF device")
> Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>
Cc: stable@vger.kernel.org

Thanks,
Nicolas

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

* Re: [PATCH net] vrf: Reset IPCB/IP6CB when processing outbound pkts in vrf dev xmit
  2021-11-30 16:26 [PATCH net] vrf: Reset IPCB/IP6CB when processing outbound pkts in vrf dev xmit Stephen Suryaputra
  2021-12-01  2:15 ` David Ahern
  2021-12-01  8:18 ` Nicolas Dichtel
@ 2021-12-02  3:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-12-02  3:10 UTC (permalink / raw)
  To: Stephen Suryaputra; +Cc: netdev, dsahern

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 30 Nov 2021 11:26:37 -0500 you wrote:
> IPCB/IP6CB need to be initialized when processing outbound v4 or v6 pkts
> in the codepath of vrf device xmit function so that leftover garbage
> doesn't cause futher code that uses the CB to incorrectly process the
> pkt.
> 
> One occasion of the issue might occur when MPLS route uses the vrf
> device as the outgoing device such as when the route is added using "ip
> -f mpls route add <label> dev <vrf>" command.
> 
> [...]

Here is the summary with links:
  - [net] vrf: Reset IPCB/IP6CB when processing outbound pkts in vrf dev xmit
    https://git.kernel.org/netdev/net/c/ee201011c1e1

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-12-02  3:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 16:26 [PATCH net] vrf: Reset IPCB/IP6CB when processing outbound pkts in vrf dev xmit Stephen Suryaputra
2021-12-01  2:15 ` David Ahern
2021-12-01  8:18 ` Nicolas Dichtel
2021-12-02  3:10 ` 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.