diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2019-12-12 16:08:26 +0100 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2021-04-09 18:29:58 +0200 |
commit | b3b7510464952d0f2f024a31c5d4aede0fcabd75 (patch) | |
tree | 4b81fc781f1d197df4fd5183b559a183b02ea32d /nhrpd/nhrp_route.c | |
parent | zebra: link layer config and notification, implementation in zebra (diff) | |
download | frr-b3b7510464952d0f2f024a31c5d4aede0fcabd75.tar.xz frr-b3b7510464952d0f2f024a31c5d4aede0fcabd75.zip |
nhrpd: link layer registration to notifications
neighbor notifications are done in zebra. so, instead of relying on
nhrp, rely on zebra by using zebra api interface.
Consequently, the code originally used in nhrp for netlink neighor
notification is no more used.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'nhrpd/nhrp_route.c')
-rw-r--r-- | nhrpd/nhrp_route.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c index 7a4c57b5d..746b585ed 100644 --- a/nhrpd/nhrp_route.c +++ b/nhrpd/nhrp_route.c @@ -79,6 +79,24 @@ static void nhrp_route_update_zebra(const struct prefix *p, } } +static void nhrp_zebra_register_neigh(vrf_id_t vrf_id, afi_t afi, bool reg) +{ + struct stream *s; + + if (!zclient || zclient->sock < 0) + return; + + s = zclient->obuf; + stream_reset(s); + + zclient_create_header(s, reg ? ZEBRA_NHRP_NEIGH_REGISTER : + ZEBRA_NHRP_NEIGH_UNREGISTER, + vrf_id); + stream_putw(s, afi); + stream_putw_at(s, 0, stream_get_endp(s)); + zclient_send_message(zclient); +} + void nhrp_route_update_nhrp(const struct prefix *p, struct interface *ifp) { struct route_node *rn; @@ -344,6 +362,8 @@ static void nhrp_zebra_connected(struct zclient *zclient) ZEBRA_ROUTE_ALL, 0, VRF_DEFAULT); zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, ZEBRA_ROUTE_ALL, 0, VRF_DEFAULT); + nhrp_zebra_register_neigh(VRF_DEFAULT, AFI_IP, true); + nhrp_zebra_register_neigh(VRF_DEFAULT, AFI_IP6, true); } void nhrp_zebra_init(void) @@ -357,7 +377,9 @@ void nhrp_zebra_init(void) zclient->interface_address_delete = nhrp_interface_address_delete; zclient->redistribute_route_add = nhrp_route_read; zclient->redistribute_route_del = nhrp_route_read; - + zclient->neighbor_added = nhrp_neighbor_operation; + zclient->neighbor_removed = nhrp_neighbor_operation; + zclient->neighbor_get = nhrp_neighbor_operation; zclient_init(zclient, ZEBRA_ROUTE_NHRP, 0, &nhrpd_privs); } @@ -372,6 +394,8 @@ static void nhrp_table_node_cleanup(struct route_table *table, void nhrp_zebra_terminate(void) { + nhrp_zebra_register_neigh(VRF_DEFAULT, AFI_IP, false); + nhrp_zebra_register_neigh(VRF_DEFAULT, AFI_IP6, false); zclient_stop(zclient); zclient_free(zclient); |