* [PATCH net] ipvlan: fix bound dev checking for IPv6 l3s mode
@ 2023-06-07 8:45 Hangbin Liu
2023-06-08 8:46 ` Paolo Abeni
0 siblings, 1 reply; 2+ messages in thread
From: Hangbin Liu @ 2023-06-07 8:45 UTC (permalink / raw)
To: netdev
Cc: David Ahern, Jianguo Wu, Daniel Borkmann, Mahesh Bandewar,
Hangbin Liu
The commit 59a0b022aa24 ("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 IP6SKB_L3SLAVE flag for ipvlan l3s input packets.
Fixes: c675e06a98a4 ("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>
---
I'm not 100% sure if we can use IP6SKB_L3SLAVE flag for ipvlan. But since
the l3s mode is a part of l3mdev enhancements. I assume it should be OK.
BTW, the fixes tag also looks not fit enough. The ipvlan_nf_input() is already
there in commit c675e06a98a4 ("ipvlan: decouple l3s mode dependencies from
other modes"). I think we should use 4fbae7d83c98 ("ipvlan: Introduce l3s
mode"). But I would keep using c675e06a98a4 as a consistence of the IPv4
version fix if no object.
---
drivers/net/ipvlan/ipvlan_l3s.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ipvlan/ipvlan_l3s.c b/drivers/net/ipvlan/ipvlan_l3s.c
index 71712ea25403..df675d9d2f21 100644
--- a/drivers/net/ipvlan/ipvlan_l3s.c
+++ b/drivers/net/ipvlan/ipvlan_l3s.c
@@ -100,6 +100,11 @@ static unsigned int ipvlan_nf_input(void *priv, struct sk_buff *skb,
if (!addr)
goto out;
+#if IS_ENABLED(CONFIG_IPV6)
+ if (addr->atype == IPVL_IPV6)
+ IP6CB(skb)->flags |= IP6SKB_L3SLAVE;
+#endif
+
skb->dev = addr->master->dev;
skb->skb_iif = skb->dev->ifindex;
len = skb->len + ETH_HLEN;
--
2.38.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] ipvlan: fix bound dev checking for IPv6 l3s mode
2023-06-07 8:45 [PATCH net] ipvlan: fix bound dev checking for IPv6 l3s mode Hangbin Liu
@ 2023-06-08 8:46 ` Paolo Abeni
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Abeni @ 2023-06-08 8:46 UTC (permalink / raw)
To: Hangbin Liu, netdev
Cc: David Ahern, Jianguo Wu, Daniel Borkmann, Mahesh Bandewar
On Wed, 2023-06-07 at 16:45 +0800, Hangbin Liu wrote:
> The commit 59a0b022aa24 ("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 IP6SKB_L3SLAVE flag for ipvlan l3s input packets.
>
> Fixes: c675e06a98a4 ("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>
> ---
> I'm not 100% sure if we can use IP6SKB_L3SLAVE flag for ipvlan.
I'm unsure either ;) Especially for a -net patch, as the implication on
later stack processing are fairly not trivial to me.
What about instead just setting IP6CB(skb)->iif for ipv6 packets?
Side notes we could possibly use nf hooks for ipv4 and ipv6
Thanks!
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-08 8:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-07 8:45 [PATCH net] ipvlan: fix bound dev checking for IPv6 l3s mode Hangbin Liu
2023-06-08 8:46 ` Paolo Abeni
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).