diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2023-11-23 15:40:38 +0100 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2023-11-23 15:42:59 +0100 |
| commit | 5a40f2b0e75bbb43c0d6e2f9cfe190dfaa61f386 (patch) | |
| tree | 0474bf802a46f54f4170e40b8829b271906a4879 /lib/zclient.c | |
| parent | cc90c54b36818a13774edfed8d7ac9a6e36c9373 (diff) | |
lib, bgp/vnc: add `.auxiliary` zclient option
Avoids calling VRF/interface/... handlers in library code more than
once. It's kinda surprising that this hasn't been blowing up already
for the VNC code, luckily these handlers are (mostly?) idempotent.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/zclient.c')
| -rw-r--r-- | lib/zclient.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/zclient.c b/lib/zclient.c index 61533aecc6..1b2ff02f61 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -43,10 +43,17 @@ static void zebra_interface_if_set_value(struct stream *s, const struct zclient_options zclient_options_default = { .synchronous = false, + .auxiliary = false, }; const struct zclient_options zclient_options_sync = { .synchronous = true, + .auxiliary = true, +}; + +const struct zclient_options zclient_options_auxiliary = { + .synchronous = false, + .auxiliary = true, }; struct sockaddr_storage zclient_addr; @@ -75,6 +82,7 @@ struct zclient *zclient_new(struct event_loop *master, zclient->n_handlers = n_handlers; zclient->synchronous = opt->synchronous; + zclient->auxiliary = opt->auxiliary; return zclient; } @@ -4444,7 +4452,8 @@ static void zclient_read(struct event *thread) zlog_debug("zclient %p command %s VRF %u", zclient, zserv_command_string(command), vrf_id); - if (command < array_size(lib_handlers) && lib_handlers[command]) + if (!zclient->auxiliary && command < array_size(lib_handlers) && + lib_handlers[command]) lib_handlers[command](command, zclient, length, vrf_id); if (command < zclient->n_handlers && zclient->handlers[command]) zclient->handlers[command](command, zclient, length, vrf_id); |
