diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2019-12-16 13:34:43 +0100 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2021-04-12 19:23:53 +0200 |
commit | f468a45af26433c70f61ff4df1c6dd30c551cbc5 (patch) | |
tree | 0d1c053570af7c4a29d69eb9da98f26ce7049cfa /nhrpd | |
parent | topotests: add standard nhrp test between spoke and hub (diff) | |
download | frr-f468a45af26433c70f61ff4df1c6dd30c551cbc5.tar.xz frr-f468a45af26433c70f61ff4df1c6dd30c551cbc5.zip |
nhrpd: add a zebra api to configure neighbor table per interface
neighbor table per interface is being configured per interface, via
zebra api.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'nhrpd')
-rw-r--r-- | nhrpd/linux.c | 1 | ||||
-rw-r--r-- | nhrpd/netlink_arp.c | 32 | ||||
-rw-r--r-- | nhrpd/nhrp_interface.c | 1 | ||||
-rw-r--r-- | nhrpd/nhrp_route.c | 20 | ||||
-rw-r--r-- | nhrpd/nhrpd.h | 4 |
5 files changed, 24 insertions, 34 deletions
diff --git a/nhrpd/linux.c b/nhrpd/linux.c index 59c82b1c5..9cabdbf06 100644 --- a/nhrpd/linux.c +++ b/nhrpd/linux.c @@ -154,7 +154,6 @@ int os_configure_dmvpn(unsigned int ifindex, const char *ifname, int af) break; } ret |= linux_configure_arp(ifname, 1); - ret |= netlink_configure_arp(ifindex, af); return ret; } diff --git a/nhrpd/netlink_arp.c b/nhrpd/netlink_arp.c index bf5d74c25..4cca177c9 100644 --- a/nhrpd/netlink_arp.c +++ b/nhrpd/netlink_arp.c @@ -219,35 +219,3 @@ void netlink_init(void) if (netlink_req_fd < 0) return; } - -int netlink_configure_arp(unsigned int ifindex, int pf) -{ - struct nlmsghdr *n; - struct ndtmsg *ndtm; - struct rtattr *rta; - struct zbuf *zb = zbuf_alloc(512); - int r; - - n = znl_nlmsg_push(zb, RTM_SETNEIGHTBL, NLM_F_REQUEST | NLM_F_REPLACE); - ndtm = znl_push(zb, sizeof(*ndtm)); - *ndtm = (struct ndtmsg){ - .ndtm_family = pf, - }; - - znl_rta_push(zb, NDTA_NAME, pf == AF_INET ? "arp_cache" : "ndisc_cache", - 10); - - rta = znl_rta_nested_push(zb, NDTA_PARMS); - znl_rta_push_u32(zb, NDTPA_IFINDEX, ifindex); - znl_rta_push_u32(zb, NDTPA_APP_PROBES, 1); - znl_rta_push_u32(zb, NDTPA_MCAST_PROBES, 0); - znl_rta_push_u32(zb, NDTPA_UCAST_PROBES, 0); - znl_rta_nested_complete(zb, rta); - - znl_nlmsg_complete(zb, n); - r = zbuf_send(zb, netlink_req_fd); - zbuf_recv(zb, netlink_req_fd); - zbuf_free(zb); - - return r; -} diff --git a/nhrpd/nhrp_interface.c b/nhrpd/nhrp_interface.c index a6880054f..f6d89b141 100644 --- a/nhrpd/nhrp_interface.c +++ b/nhrpd/nhrp_interface.c @@ -298,6 +298,7 @@ void nhrp_interface_update(struct interface *ifp) if (!if_ad->configured) { os_configure_dmvpn(ifp->ifindex, ifp->name, afi2family(afi)); + nhrp_send_zebra_configure_arp(ifp, afi2family(afi)); if_ad->configured = 1; nhrp_interface_update_address(ifp, afi, 1); } diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c index 06a9564e8..99f35b79d 100644 --- a/nhrpd/nhrp_route.c +++ b/nhrpd/nhrp_route.c @@ -392,6 +392,26 @@ static void nhrp_table_node_cleanup(struct route_table *table, XFREE(MTYPE_NHRP_ROUTE, node->info); } +void nhrp_send_zebra_configure_arp(struct interface *ifp, int family) +{ + struct stream *s; + + if (!zclient || zclient->sock < 0) { + debugf(NHRP_DEBUG_COMMON, "%s() : zclient not ready", + __func__); + return; + } + s = zclient->obuf; + stream_reset(s); + zclient_create_header(s, + ZEBRA_CONFIGURE_ARP, + ifp->vrf_id); + stream_putc(s, family); + stream_putl(s, ifp->ifindex); + stream_putw_at(s, 0, stream_get_endp(s)); + zclient_send_message(zclient); +} + void nhrp_send_zebra_nbr(union sockunion *in, union sockunion *out, struct interface *ifp) diff --git a/nhrpd/nhrpd.h b/nhrpd/nhrpd.h index 0f4635d3d..136f855df 100644 --- a/nhrpd/nhrpd.h +++ b/nhrpd/nhrpd.h @@ -88,10 +88,12 @@ static inline int notifier_active(struct notifier_list *l) void nhrp_zebra_init(void); void nhrp_zebra_terminate(void); +void nhrp_send_zebra_configure_arp(struct interface *ifp, int family); void nhrp_send_zebra_nbr(union sockunion *in, union sockunion *out, struct interface *ifp); - +void nhrp_send_zebra_configure_arp(struct interface *ifp, + int family); struct zbuf; struct nhrp_vc; struct nhrp_cache; |