Skip to content

Commit ce57adc

Browse files
liuhangbindavem330
authored andcommitted
ipvlan: fix bound dev checking for IPv6 l3s mode
The commit 59a0b02 ("ipvlan: Make skb->skb_iif track skb->dev for l3s mode") fixed ipvlan bonded dev checking by updating skb skb_iif. This fix works for IPv4, as in raw_v4_input() the dif is from inet_iif(skb), which is skb->skb_iif when there is no route. But for IPv6, the fix is not enough, because in ipv6_raw_deliver() -> raw_v6_match(), the dif is inet6_iif(skb), which is returns IP6CB(skb)->iif instead of skb->skb_iif if it's not a l3_slave. To fix the IPv6 part issue. Let's set IP6CB(skb)->iif to correct ifindex. BTW, ipvlan handles NS/NA specifically. Since it works fine, I will not reset IP6CB(skb)->iif when addr->atype is IPVL_ICMPV6. Fixes: c675e06 ("ipvlan: decouple l3s mode dependencies from other modes") Link: https://bugzilla.redhat.com/show_bug.cgi?id=2196710 Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 52f7960 commit ce57adc

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/net/ipvlan/ipvlan_l3s.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ static unsigned int ipvlan_nf_input(void *priv, struct sk_buff *skb,
102102

103103
skb->dev = addr->master->dev;
104104
skb->skb_iif = skb->dev->ifindex;
105+
#if IS_ENABLED(CONFIG_IPV6)
106+
if (addr->atype == IPVL_IPV6)
107+
IP6CB(skb)->iif = skb->dev->ifindex;
108+
#endif
105109
len = skb->len + ETH_HLEN;
106110
ipvlan_count_rx(addr->master, len, true, false);
107111
out:

0 commit comments

Comments
 (0)