Skip to content

Commit

Permalink
zebra: Remove static ARP entries on interface down events
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ton31337 committed Oct 31, 2023
1 parent 95f841c commit 6348c81
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions zebra/redistribute.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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. */
Expand Down
13 changes: 13 additions & 0 deletions zebra/zebra_neigh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

if (IS_ZEBRA_DEBUG_NEIGH)
zlog_debug("zebra neigh delete all for interface %s/%d",
ifp->name, ifp->ifindex);

RB_FOREACH (n, zebra_neigh_rb_head, &zneigh_info->neigh_rb_tree)
zebra_neigh_del(ifp, &n->ip);
}

/* kernel neigh add */
void zebra_neigh_add(struct interface *ifp, struct ipaddr *ip,
struct ethaddr *mac)
Expand Down
1 change: 1 addition & 0 deletions zebra/zebra_neigh.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6348c81

Please sign in to comment.