diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-04-22 23:03:52 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-04-23 04:50:24 +0200 |
commit | 453844abd7bce28479d10490de513ca59cd0d490 (patch) | |
tree | 7396f2ff275f5e8186975d819b3cc75a4b3b34bc /zebra/zebra_rnh.c | |
parent | zebra: clean up zapi organization (diff) | |
download | frr-453844abd7bce28479d10490de513ca59cd0d490.tar.xz frr-453844abd7bce28479d10490de513ca59cd0d490.zip |
zebra: use hooks for client lifecycle callbacks
zserv.c was using hardcoded callbacks to clean up various components
when a client disconnected. Ergo zserv.c had to know about all these
unrelated components that it should not care about. We have hooks now,
let's use the proper thing instead.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_rnh.c')
-rw-r--r-- | zebra/zebra_rnh.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 8b8997981..6b74a3c92 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -66,10 +66,16 @@ static int compare_state(struct route_entry *r1, struct route_entry *r2); static int send_client(struct rnh *rnh, struct zserv *client, rnh_type_t type, vrf_id_t vrf_id); static void print_rnh(struct route_node *rn, struct vty *vty); +static int zebra_client_cleanup_rnh(struct zserv *client); int zebra_rnh_ip_default_route = 0; int zebra_rnh_ipv6_default_route = 0; +void zebra_rnh_init(void) +{ + hook_register(client_close, zebra_client_cleanup_rnh); +} + static inline struct route_table *get_rnh_table(vrf_id_t vrfid, int family, rnh_type_t type) { @@ -1204,7 +1210,7 @@ static int zebra_cleanup_rnh_client(vrf_id_t vrf_id, int family, } /* Cleanup registered nexthops (across VRFs) upon client disconnect. */ -void zebra_client_cleanup_rnh(struct zserv *client) +static int zebra_client_cleanup_rnh(struct zserv *client) { struct vrf *vrf; struct zebra_vrf *zvrf; @@ -1228,4 +1234,6 @@ void zebra_client_cleanup_rnh(struct zserv *client) } } } + + return 0; } |