]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
neighbour: send netlink notification if NTF_ROUTER changes
authorRoopa Prabhu <roopa@cumulusnetworks.com>
Sun, 23 Sep 2018 04:26:20 +0000 (21:26 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Sep 2018 19:21:32 +0000 (12:21 -0700)
send netlink notification if neigh_update results in NTF_ROUTER
change and if NEIGH_UPDATE_F_ISROUTER is on. Also move the
NTF_ROUTER change function into a helper.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/neighbour.h
net/core/neighbour.c

index 6c1eecd56a4d072f14074b7e1f5fe59ebb92ede2..0874f7fcd8598bb2eefa04a692672c4b416a553c 100644 (file)
@@ -544,4 +544,19 @@ static inline void neigh_update_ext_learned(struct neighbour *neigh, u32 flags,
                *notify = 1;
        }
 }
+
+static inline void neigh_update_is_router(struct neighbour *neigh, u32 flags,
+                                         int *notify)
+{
+       u8 ndm_flags = 0;
+
+       ndm_flags |= (flags & NEIGH_UPDATE_F_ISROUTER) ? NTF_ROUTER : 0;
+       if ((neigh->flags ^ ndm_flags) & NTF_ROUTER) {
+               if (ndm_flags & NTF_ROUTER)
+                       neigh->flags |= NTF_ROUTER;
+               else
+                       neigh->flags &= ~NTF_ROUTER;
+               *notify = 1;
+       }
+}
 #endif
index 0e1cad89184f67436522cd1a5b9443c9aa53090f..20e0d3308148a98a16c5a446cc95506a66680f02 100644 (file)
@@ -1280,11 +1280,8 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
                neigh->arp_queue_len_bytes = 0;
        }
 out:
-       if (update_isrouter) {
-               neigh->flags = (flags & NEIGH_UPDATE_F_ISROUTER) ?
-                       (neigh->flags | NTF_ROUTER) :
-                       (neigh->flags & ~NTF_ROUTER);
-       }
+       if (update_isrouter)
+               neigh_update_is_router(neigh, flags, &notify);
        write_unlock_bh(&neigh->lock);
 
        if (notify)