diff options
author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-01-23 07:51:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-23 07:51:26 +0100 |
commit | 92a56d2fa2eb85dadb37ed58fafa16b5d3b1b81e (patch) | |
tree | 05eb701e4ab196f5d2a60bf1e4836d83960796de /lib | |
parent | Merge pull request #15193 from idryzhov/fix-bgp-rmap-probability (diff) | |
parent | sharpd: Allow sharpd to listen to neighbor events (diff) | |
download | frr-92a56d2fa2eb85dadb37ed58fafa16b5d3b1b81e.tar.xz frr-92a56d2fa2eb85dadb37ed58fafa16b5d3b1b81e.zip |
Merge pull request #15179 from donaldsharp/zebra_neigh_update
Zebra neigh update
Diffstat (limited to 'lib')
-rw-r--r-- | lib/log.c | 10 | ||||
-rw-r--r-- | lib/zclient.c | 24 | ||||
-rw-r--r-- | lib/zclient.h | 16 |
3 files changed, 38 insertions, 12 deletions
@@ -444,11 +444,11 @@ static const struct zebra_desc_table command_types[] = { DESC_ENTRY(ZEBRA_NEIGH_DISCOVER), DESC_ENTRY(ZEBRA_ROUTE_NOTIFY_REQUEST), DESC_ENTRY(ZEBRA_CLIENT_CLOSE_NOTIFY), - DESC_ENTRY(ZEBRA_NHRP_NEIGH_ADDED), - DESC_ENTRY(ZEBRA_NHRP_NEIGH_REMOVED), - DESC_ENTRY(ZEBRA_NHRP_NEIGH_GET), - DESC_ENTRY(ZEBRA_NHRP_NEIGH_REGISTER), - DESC_ENTRY(ZEBRA_NHRP_NEIGH_UNREGISTER), + DESC_ENTRY(ZEBRA_NEIGH_ADDED), + DESC_ENTRY(ZEBRA_NEIGH_REMOVED), + DESC_ENTRY(ZEBRA_NEIGH_GET), + DESC_ENTRY(ZEBRA_NEIGH_REGISTER), + DESC_ENTRY(ZEBRA_NEIGH_UNREGISTER), DESC_ENTRY(ZEBRA_NEIGH_IP_ADD), DESC_ENTRY(ZEBRA_NEIGH_IP_DEL), DESC_ENTRY(ZEBRA_CONFIGURE_ARP), diff --git a/lib/zclient.c b/lib/zclient.c index 2a7d2a8c5..25c6e2b8e 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -4709,7 +4709,7 @@ static int zclient_neigh_ip_read_entry(struct stream *s, struct ipaddr *add) int zclient_neigh_ip_encode(struct stream *s, uint16_t cmd, union sockunion *in, union sockunion *out, struct interface *ifp, - int ndm_state) + int ndm_state, int ip_len) { int ret = 0; @@ -4722,6 +4722,7 @@ int zclient_neigh_ip_encode(struct stream *s, uint16_t cmd, union sockunion *in, sockunion_get_addrlen(out)); } else stream_putc(s, AF_UNSPEC); + stream_putl(s, ip_len); stream_putl(s, ifp->ifindex); if (out) stream_putl(s, ndm_state); @@ -4739,6 +4740,7 @@ int zclient_neigh_ip_decode(struct stream *s, struct zapi_neigh_ip *api) return -1; zclient_neigh_ip_read_entry(s, &api->ip_out); + STREAM_GETL(s, api->ip_len); STREAM_GETL(s, api->index); STREAM_GETL(s, api->ndm_state); return 0; @@ -4885,3 +4887,23 @@ enum zclient_send_status zclient_opaque_drop_notify(struct zclient *zclient, return zclient_send_message(zclient); } + +void zclient_register_neigh(struct zclient *zclient, 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_NEIGH_REGISTER + : ZEBRA_NEIGH_UNREGISTER, + vrf_id); + stream_putw(s, afi); + stream_putw_at(s, 0, stream_get_endp(s)); + zclient_send_message(zclient); +} diff --git a/lib/zclient.h b/lib/zclient.h index 8d7faeb22..3027c2c37 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -216,11 +216,11 @@ typedef enum { ZEBRA_NEIGH_DISCOVER, ZEBRA_ROUTE_NOTIFY_REQUEST, ZEBRA_CLIENT_CLOSE_NOTIFY, - ZEBRA_NHRP_NEIGH_ADDED, - ZEBRA_NHRP_NEIGH_REMOVED, - ZEBRA_NHRP_NEIGH_GET, - ZEBRA_NHRP_NEIGH_REGISTER, - ZEBRA_NHRP_NEIGH_UNREGISTER, + ZEBRA_NEIGH_ADDED, + ZEBRA_NEIGH_REMOVED, + ZEBRA_NEIGH_GET, + ZEBRA_NEIGH_REGISTER, + ZEBRA_NEIGH_UNREGISTER, ZEBRA_NEIGH_IP_ADD, ZEBRA_NEIGH_IP_DEL, ZEBRA_CONFIGURE_ARP, @@ -867,6 +867,7 @@ extern const struct zclient_options zclient_options_auxiliary; struct zapi_neigh_ip { int cmd; + int ip_len; struct ipaddr ip_in; struct ipaddr ip_out; ifindex_t index; @@ -875,7 +876,7 @@ struct zapi_neigh_ip { int zclient_neigh_ip_decode(struct stream *s, struct zapi_neigh_ip *api); int zclient_neigh_ip_encode(struct stream *s, uint16_t cmd, union sockunion *in, union sockunion *out, struct interface *ifp, - int ndm_state); + int ndm_state, int ip_len); /* * We reserve the top 4 bits for l2-NHG, everything else @@ -1322,6 +1323,9 @@ enum zapi_opaque_registry { */ extern enum zclient_send_status zclient_send_hello(struct zclient *client); +extern void zclient_register_neigh(struct zclient *zclient, vrf_id_t vrf_id, + afi_t afi, bool reg); + extern enum zclient_send_status zclient_send_neigh_discovery_req(struct zclient *zclient, const struct interface *ifp, |