]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: link layer neighbor registration and notification, define API msgs
authorPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 12 Dec 2019 15:05:14 +0000 (16:05 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 9 Apr 2021 16:29:58 +0000 (18:29 +0200)
This patch implements new zapi api to get neighbor information that zebra knows
and that other daemons may need to know. Actually, nhrp daemons is
interested in getting the neighbor information on gre interfaces, and
the API will be used for that.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
lib/log.c
lib/zclient.c
lib/zclient.h

index e078d8e2a7a35c67ee987b9ebd4a6ed371dc4afb..9a8a91b004c6abcc75a40211d9fc785ef4cf85ca 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
@@ -464,7 +464,11 @@ static const struct zebra_desc_table command_types[] = {
        DESC_ENTRY(ZEBRA_ROUTE_NOTIFY_REQUEST),
        DESC_ENTRY(ZEBRA_CLIENT_CLOSE_NOTIFY),
        DESC_ENTRY(ZEBRA_EVPN_REMOTE_NH_ADD),
-       DESC_ENTRY(ZEBRA_EVPN_REMOTE_NH_DEL)};
+       DESC_ENTRY(ZEBRA_EVPN_REMOTE_NH_DEL),
+       DESC_ENTRY(ZEBRA_NHRP_NEIGH_ADDED),
+       DESC_ENTRY(ZEBRA_NHRP_NEIGH_REMOVED),
+       DESC_ENTRY(ZEBRA_NHRP_NEIGH_GET)};
+
 #undef DESC_ENTRY
 
 static const struct zebra_desc_table unknown = {0, "unknown", '?'};
index c78937c1ec3b3cd141d0f065fe205df27e0cd13b..8d94fe1acade2853c0c2ea77c6908b25469f6bc6 100644 (file)
@@ -3916,6 +3916,21 @@ static int zclient_read(struct thread *thread)
                        (*zclient->zebra_client_close_notify)(command, zclient,
                                                              length, vrf_id);
                break;
+       case ZEBRA_NHRP_NEIGH_ADDED:
+               if (zclient->neighbor_added)
+                       (*zclient->neighbor_added)(command, zclient, length,
+                                                  vrf_id);
+               break;
+       case ZEBRA_NHRP_NEIGH_REMOVED:
+               if (zclient->neighbor_removed)
+                       (*zclient->neighbor_removed)(command, zclient, length,
+                                                    vrf_id);
+               break;
+       case ZEBRA_NHRP_NEIGH_GET:
+               if (zclient->neighbor_get)
+                       (*zclient->neighbor_get)(command, zclient, length,
+                                                vrf_id);
+               break;
        default:
                break;
        }
index bd952ea1e66d9c6b22a0532a1bf9208e45b29613..a99f2eba168c737beccf325429df9caa4b05f4f2 100644 (file)
@@ -223,6 +223,9 @@ 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_message_types_t;
 
 enum zebra_error_types {
@@ -381,6 +384,9 @@ struct zclient {
        int (*opaque_unregister_handler)(ZAPI_CALLBACK_ARGS);
        int (*sr_policy_notify_status)(ZAPI_CALLBACK_ARGS);
        int (*zebra_client_close_notify)(ZAPI_CALLBACK_ARGS);
+       void (*neighbor_added)(ZAPI_CALLBACK_ARGS);
+       void (*neighbor_removed)(ZAPI_CALLBACK_ARGS);
+       void (*neighbor_get)(ZAPI_CALLBACK_ARGS);
 };
 
 /* Zebra API message flag. */