From: vivek Date: Thu, 21 Jul 2016 15:50:17 +0000 (-0700) Subject: zebra: API to locate client structure based on protocol X-Git-Tag: frr-3.0-branchpoint~83^2~15 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=8ed6821e60c0a28990987e2cc67daead158795d4;p=matthieu%2Ffrr.git zebra: API to locate client structure based on protocol Signed-off-by: Vivek Venkatraman Reviewed-by: Donald Sharp Ticket: Reviewed By: CCR-4968 Testing Done: Tested with subsequent patch(es) --- diff --git a/zebra/zserv.c b/zebra/zserv.c index d3c204d119..a736577a3c 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -2371,6 +2371,21 @@ zebra_show_client_brief (struct vty *vty, struct zserv *client) } +struct zserv * +zebra_find_client (u_char proto) +{ + struct listnode *node, *nnode; + struct zserv *client; + + for (ALL_LIST_ELEMENTS (zebrad.client_list, node, nnode, client)) + { + if (client->proto == proto) + return client; + } + + return NULL; +} + /* Display default rtm_table for all clients. */ DEFUN (show_table, diff --git a/zebra/zserv.h b/zebra/zserv.h index a0434d299b..d17a28eb6a 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -176,4 +176,6 @@ extern void zserv_create_header(struct stream *s, uint16_t cmd, vrf_id_t vrf_id) extern void zserv_nexthop_num_warn(const char *, const struct prefix *, const unsigned int); extern int zebra_server_send_message(struct zserv *client); +extern struct zserv *zebra_find_client (u_char proto); + #endif /* _ZEBRA_ZEBRA_H */