summaryrefslogtreecommitdiff
path: root/zebra/rt_netlink.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2021-08-25 11:46:42 +0200
committerPhilippe Guibert <philippe.guibert@6wind.com>2021-08-26 09:19:42 +0200
commit80f6b5faeb62b9d201ddb55af847638dfb88dc8f (patch)
tree81ca0b4949a5b5c95f17107a1099a7245ff5f013 /zebra/rt_netlink.c
parentc4e1fd52a149a4686b9c1ff1dd4b3a24740eb03b (diff)
lib, zebra: complete the ndm flags on zclient api
Insist on the fact that zclient neighbor state flags are mapped over netlink state flags. List all the defines currently known on kernel, and create a netlink API to convert netlink values to zclient values. The function is simplified as it is a 1-1 match. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/rt_netlink.c')
-rw-r--r--zebra/rt_netlink.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 48ccf91ec7..a8b4b54d29 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -3658,6 +3658,15 @@ static void netlink_handle_5549(struct ndmsg *ndm, struct zebra_if *zif,
#define NUD_LOCAL_ACTIVE \
(NUD_PERMANENT | NUD_NOARP | NUD_REACHABLE)
+static int netlink_nbr_entry_state_to_zclient(int nbr_state)
+{
+ /* an exact match is done between
+ * - netlink neighbor state values: NDM_XXX (see in linux/neighbour.h)
+ * - zclient neighbor state values: ZEBRA_NEIGH_STATE_XXX
+ * (see in lib/zclient.h)
+ */
+ return nbr_state;
+}
static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
{
struct ndmsg *ndm;
@@ -3747,8 +3756,10 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
&mac, l2_len);
} else
sockunion_family(&link_layer_ipv4) = AF_UNSPEC;
- zsend_nhrp_neighbor_notify(cmd, ifp, &ip, ndm->ndm_state,
- &link_layer_ipv4);
+ zsend_nhrp_neighbor_notify(
+ cmd, ifp, &ip,
+ netlink_nbr_entry_state_to_zclient(ndm->ndm_state),
+ &link_layer_ipv4);
}
if (h->nlmsg_type == RTM_GETNEIGH)