Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee20101

Browse files
ssuryaextrkuba-moo
authored andcommitted
vrf: Reset IPCB/IP6CB when processing outbound pkts in vrf dev xmit
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: 193125d ("net: Introduce VRF device driver") Fixes: 35402e3 ("net: Add IPv6 support to VRF device") Cc: [email protected] Signed-off-by: Stephen Suryaputra <[email protected]> Reviewed-by: David Ahern <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e2dabc4 commit ee20101

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/vrf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ static netdev_tx_t vrf_process_v6_outbound(struct sk_buff *skb,
497497
/* strip the ethernet header added for pass through VRF device */
498498
__skb_pull(skb, skb_network_offset(skb));
499499

500+
memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
500501
ret = vrf_ip6_local_out(net, skb->sk, skb);
501502
if (unlikely(net_xmit_eval(ret)))
502503
dev->stats.tx_errors++;
@@ -579,6 +580,7 @@ static netdev_tx_t vrf_process_v4_outbound(struct sk_buff *skb,
579580
RT_SCOPE_LINK);
580581
}
581582

583+
memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
582584
ret = vrf_ip_local_out(dev_net(skb_dst(skb)->dev), skb->sk, skb);
583585
if (unlikely(net_xmit_eval(ret)))
584586
vrf_dev->stats.tx_errors++;

0 commit comments

Comments
 (0)