]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Remove static ARP entries on interface down events 14744/head
authorDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 31 Oct 2023 15:09:48 +0000 (17:09 +0200)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 7 Nov 2023 14:41:07 +0000 (14:41 +0000)
Without this patch, static ARP entries remain active even if the interface is
down, but the kernel already removed them.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit a35bb7e2a89097dc90105a75cbd68618fb74451c)

zebra/redistribute.c
zebra/zebra_neigh.c
zebra/zebra_neigh.h

index 4069f7dd7039cfdc5162478cebe50f5b228df919..7559e314bc80377c32e6fabe434bef2c672dc5bb 100644 (file)
@@ -28,6 +28,7 @@
 #include "zebra/zapi_msg.h"
 #include "zebra/zebra_vxlan.h"
 #include "zebra/zebra_errors.h"
+#include "zebra/zebra_neigh.h"
 
 #define ZEBRA_PTM_SUPPORT
 
@@ -472,6 +473,8 @@ void zebra_interface_down_update(struct interface *ifp)
 
                zsend_interface_update(ZEBRA_INTERFACE_DOWN, client, ifp);
        }
+
+       zebra_neigh_del_all(ifp);
 }
 
 /* Interface information update. */
index 0c3fb97afdf7df8472b80ff0a12d225a70a48c2e..941088afd60678f05352da8cf97477f1c75d3be3 100644 (file)
@@ -152,6 +152,19 @@ void zebra_neigh_del(struct interface *ifp, struct ipaddr *ip)
        zebra_neigh_free(n);
 }
 
+/* kernel neigh delete all for a given interface */
+void zebra_neigh_del_all(struct interface *ifp)
+{
+       struct zebra_neigh_ent *n, *nn;
+
+       if (IS_ZEBRA_DEBUG_NEIGH)
+               zlog_debug("zebra neigh delete all for interface %s/%d",
+                          ifp->name, ifp->ifindex);
+
+       RB_FOREACH_SAFE (n, zebra_neigh_rb_head, &zneigh_info->neigh_rb_tree, nn)
+               zebra_neigh_del(ifp, &n->ip);
+}
+
 /* kernel neigh add */
 void zebra_neigh_add(struct interface *ifp, struct ipaddr *ip,
                     struct ethaddr *mac)
index b957b5efe580732c25d0ab3dd8206f02c7b1fc37..adc5f94f76e15c4d45724d098114f6c0a5eb2b47 100644 (file)
@@ -43,6 +43,7 @@ struct zebra_neigh_info {
 extern void zebra_neigh_add(struct interface *ifp, struct ipaddr *ip,
                            struct ethaddr *mac);
 extern void zebra_neigh_del(struct interface *ifp, struct ipaddr *ip);
+extern void zebra_neigh_del_all(struct interface *ifp);
 extern void zebra_neigh_show(struct vty *vty);
 extern void zebra_neigh_init(void);
 extern void zebra_neigh_terminate(void);