net: l3mdev: Set OIF flag only when an L3 master exists
Subsystems (3)
PATCH 1/1 net: l3mdev: Set OIF flag only when an L3 master exists
l3mdev_master_ifindex_rcu() may return 0 when the device is not associated with an L3 master. In that case, l3mdev_update_flow() currently sets FLOWI_FLAG_L3MDEV_OIF even though flowi_l3mdev remains 0.
Set FLOWI_FLAG_L3MDEV_OIF only when a non-zero L3 master ifindex is returned, keeping the flag consistent with flowi_l3mdev.
--- net/l3mdev/l3mdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/l3mdev/l3mdev.c +2 -1
@@ -279,7 +279,8 @@ void l3mdev_update_flow(struct net *net, struct flowi *fl)if (dev) {if (!fl->flowi_l3mdev) { fl->flowi_l3mdev =l3mdev_master_ifindex_rcu (dev); - fl->flowi_flags |=FLOWI_FLAG_L3MDEV_OIF ; +if (fl->flowi_l3mdev) + fl->flowi_flags |=FLOWI_FLAG_L3MDEV_OIF ; }/* oif set to L3mdev directs lookup to its table;
Signature · 1 line
2.37.0
Hi Haon,
Quoted 18 lines
l3mdev_master_ifindex_rcu()may return 0 when the device is not associated with an L3 master. In that case,l3mdev_update_flow()currently setsFLOWI_FLAG_L3MDEV_OIFeven thoughflowi_l3mdevremains 0.Set
FLOWI_FLAG_L3MDEV_OIFonly when a non-zero L3 master ifindex is returned, keeping the flag consistent withflowi_l3mdev.Signed-off-by Haon KIM <[email protected]>--- net/l3mdev/l3mdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/l3mdev/l3mdev.c +0
-0
net/l3mdev/l3mdev.c void l3mdev_update_flow(struct net *net, struct flowi *fl) · line 283
Quoted 6 lines
net/l3mdev/l3mdev.c +2
-1@@ -279,7 +279,8 @@ void l3mdev_update_flow(struct net *net, struct flowi *fl)if (dev) {if (!fl->flowi_l3mdev) { fl->flowi_l3mdev =l3mdev_master_ifindex_rcu (dev); - fl->flowi_flags |=FLOWI_FLAG_L3MDEV_OIF ; +if (fl->flowi_l3mdev) + fl->flowi_flags |=FLOWI_FLAG_L3MDEV_OIF ;
Looking at the readers of this flag, it does not look like this does much, so if anything this is a no-functional clean-up for net-next, I guess. The commit description could be more specific about this. Also, the target tree is missing.
Quoted 6 lines
net/l3mdev/l3mdev.c +0
-0}/* oif set to L3mdev directs lookup to its table; Signature · 1 line
2.37.0
/Daniel
David Ahern
maintainerQuoted 15 lines · Daniel Machon
Hi Haon,
Quoted 13 lines
l3mdev_master_ifindex_rcu()may return 0 when the device is not associated with an L3 master. In that case,l3mdev_update_flow()currently setsFLOWI_FLAG_L3MDEV_OIFeven thoughflowi_l3mdevremains 0.Set
FLOWI_FLAG_L3MDEV_OIFonly when a non-zero L3 master ifindex is returned, keeping the flag consistent withflowi_l3mdev.Signed-off-by Haon KIM <[email protected]>--- net/l3mdev/l3mdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 16 lines
net/l3mdev/l3mdev.c void l3mdev_update_flow(struct net *net, struct flowi *fl) · line 283
Quoted 11 lines
net/l3mdev/l3mdev.c +2
-1@@ -279,7 +279,8 @@ void l3mdev_update_flow(struct net *net, struct flowi *fl)if (dev) {if (!fl->flowi_l3mdev) { fl->flowi_l3mdev =l3mdev_master_ifindex_rcu (dev); - fl->flowi_flags |=FLOWI_FLAG_L3MDEV_OIF ; +if (fl->flowi_l3mdev) + fl->flowi_flags |=FLOWI_FLAG_L3MDEV_OIF ;Looking at the readers of this flag, it does not look like this does much, so if anything this is a no-functional clean-up for net-next, I guess. The commit description could be more specific about this. Also, the target tree is missing.
Example of a failing use case?