Skip to contentSkip to conversation

Generate netlink notification when default IPv6 route preference changes

PATCH Applied Kalash Nainwal 3 participants 3 messages Feb 10, 2022 – Feb 14, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Generate netlink notification when default IPv6 route preference changes

Generate RTM_NEWROUTE netlink notification when the route preference changes on an existing kernel generated default route in response to RA messages. Currently netlink notifications are generated only when this route is added or deleted but not when the route preference changes, which can cause userspace routing application state to go out of sync with kernel.

---
 net/ipv6/ndisc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
net/ipv6/ndisc.c +5 -1
index f03b597e4121..1c06d0cd02f7 100644
@@ -1337,8 +1337,12 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 			return;
 		}
 		neigh->flags |= NTF_ROUTER;
-	} else if (rt) {
+	} else if (rt && IPV6_EXTRACT_PREF(rt->fib6_flags) != pref) {
+		struct nl_info nlinfo = {
+			.nl_net = net,
+		};
 		rt->fib6_flags = (rt->fib6_flags & ~RTF_PREF_MASK) | RTF_PREF(pref);
+		inet6_rt_notify(RTM_NEWROUTE, rt, &nlinfo, NLM_F_REPLACE);
 	}
 
 	if (rt)
Signature · 1 line
2.30.1 (Apple Git-130)
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Kalash Nainwal

Generate RTM_NEWROUTE netlink notification when the route preference changes on an existing kernel generated default route in response to RA messages. Currently netlink notifications are generated only when this route is added or deleted but not when the route preference changes, which can cause userspace routing application state to go out of sync with kernel.

Quoted 5 lines
---
 net/ipv6/ndisc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
#2 lore raw
In reply to Kalash Nainwal
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 8 lines · On Thu, 10 Feb 2022 14:09:35 -0800 you wrote:

Generate RTM_NEWROUTE netlink notification when the route preference
changes on an existing kernel generated default route in response to RA messages. Currently netlink notifications are generated only when this route is added or deleted but not when the route preference changes, which can cause userspace routing application state to go out of sync with kernel.

[...]

Here is the summary with links:
- [v2] Generate netlink notification when default IPv6 route preference changes

    https://git.kernel.org/netdev/net-next/c/806c37ddcf28

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html