Netdev List
 help / color / mirror / Atom feed
* [PATCH] net: l3mdev: Set OIF flag only when an L3 master exists
@ 2026-10-24 17:57 Haon KIM
  2026-10-26  8:30 ` Daniel Machon
  0 siblings, 1 reply; 2+ messages in thread
From: Haon KIM @ 2026-10-24 17:57 UTC (permalink / raw)
  To: dsahern; +Cc: netdev, Haon KIM

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.

Signed-off-by: Haon KIM <akrn112@naver.com>
---
 net/l3mdev/l3mdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/l3mdev/l3mdev.c b/net/l3mdev/l3mdev.c
index 5432a5f2dfc8..92b48d6a4301 100644
--- a/net/l3mdev/l3mdev.c
+++ b/net/l3mdev/l3mdev.c
@@ -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;
-- 
2.37.0


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

end of thread, other threads:[~2026-10-26  8:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-24 17:57 [PATCH] net: l3mdev: Set OIF flag only when an L3 master exists Haon KIM
2026-10-26  8:30 ` Daniel Machon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox