diff options
Diffstat (limited to 'lib/zclient.c')
| -rw-r--r-- | lib/zclient.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/zclient.c b/lib/zclient.c index e769906012..655e4e1a80 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -52,8 +52,11 @@ socklen_t zclient_addr_len; /* This file local debug flag. */ int zclient_debug = 0; +struct zclient_options zclient_options_default = { .receive_notify = false }; + /* Allocate zclient structure. */ -struct zclient *zclient_new(struct thread_master *master) +struct zclient *zclient_new_notify(struct thread_master *master, + struct zclient_options *opt) { struct zclient *zclient; zclient = XCALLOC(MTYPE_ZCLIENT, sizeof(struct zclient)); @@ -63,6 +66,8 @@ struct zclient *zclient_new(struct thread_master *master) zclient->wb = buffer_new(0); zclient->master = master; + zclient->receive_notify = opt->receive_notify; + return zclient; } @@ -190,7 +195,7 @@ void zclient_reset(struct zclient *zclient) * @param zclient a pointer to zclient structure * @return socket fd just to make sure that connection established * @see zclient_init - * @see zclient_new + * @see zclient_new_notify */ int zclient_socket_connect(struct zclient *zclient) { @@ -346,6 +351,11 @@ static int zebra_hello_send(struct zclient *zclient) zclient_create_header(s, ZEBRA_HELLO, VRF_DEFAULT); stream_putc(s, zclient->redist_default); stream_putw(s, zclient->instance); + if (zclient->receive_notify) + stream_putc(s, 1); + else + stream_putc(s, 0); + stream_putw_at(s, 0, stream_get_endp(s)); return zclient_send_message(zclient); } |
