On Mon, Jun 8, 2026 at 4:55 AM Adrian Moreno via dev < [email protected]> wrote:
> Now that netdev-linux flags are also cached, we need to ensure they are > updated correctly. > > Currently, there are subsystems that rely on link state changes via > rtnetlink notifiers (e.g: iface-notifier, route-table). In parallel, > netdev-linux creates its own netlink socket to listen for link > notifications based on which netdev's states are updated. This creates a > potential race: some subsystems might be notified that a link changed > but the internal netdev representation is still old. > > If we want to both cache netdev internal state (e.g: flags, ether_addr) > effectively we need to use the same callback chain, i.e: we need to use > rtnetlink to update netdev-linux netdevs as well when links change. > > The order of callbacks cannot be guaranteed so it could still be possible > to > have another subsystem be notified before netdev-linux has been given a > chance > to update its state. However, subsystems would likely want to aggregate > reconfigurations and will likely have their own "_run()" function to > operate. > > Therefore, it could be reasonalbe to assume the other subsystems would use > the > callback to set a flag that is then used to trigger reconfigurations in > their > own periodic "_run()" functions (this is exactly the case of the two > existing > users: iface-notifier, route-table). > > This patch makes netdev-linux use rtnetlink notifier for interface updates > and > independent nln notifiers for address changes. > > Signed-off-by: Adrian Moreno <[email protected]> > --- > lib/netdev-linux.c | 213 ++++++++++++++++++++--------------------- > lib/netdev-linux.h | 1 + > lib/netlink-notifier.h | 3 +- > lib/rtnetlink.c | 12 ++- > lib/rtnetlink.h | 1 + > 5 files changed, 117 insertions(+), 113 deletions(-) > > diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c > index a7c0f5451..351dfb735 100644 > --- a/lib/netdev-linux.c > +++ b/lib/netdev-linux.c > @@ -298,6 +298,10 @@ static struct ovs_mutex lag_mutex = > OVS_MUTEX_INITIALIZER; > static struct shash lag_shash OVS_GUARDED_BY(lag_mutex) > = SHASH_INITIALIZER(&lag_shash); > > +static struct rtnetlink_change netlink_change; > +static struct nln *nln = NULL; > +static struct nln_notifier *notifiers[4] = {NULL, NULL, NULL, NULL}; > Nit: Initialization is redundant. Other than that, looks good to me. -M _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
