summaryrefslogtreecommitdiff
path: root/lib/zclient.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2019-01-19 17:19:13 -0200
committerRenato Westphal <renato@opensourcerouting.org>2019-01-19 22:46:37 -0200
commitbb6b7f79bede8d849de4517de0f4b1b510871565 (patch)
treef273625fcbf32a3a8beb6da0f9029fc3f6bcbd4c /lib/zclient.c
parent70fc94ca1d6063b64449b0971678521c021ac916 (diff)
zebra, lib: send VRF backend to the client daemons
Add a new field in the ZEBRA_CAPABILITIES zapi message specifying the VRF backend in use. For simplicity, make the zclient code call vrf_configure_backend() to apply the received value automatically instead of requiring the daemons to do that themselves in their zebra_capabilities() callbacks. Additionally, call zebra_vrf_update_all() only after sending the capabilities message to the client, so that it will know which VRF backend is in use when processing the VRF messages. This commit fixes a couple of bugs in the "interface" CLI command and associated northbound callbacks, which behave differently depending on the VRF backend in use. Before this commit, the vrf_backend variable would always be set to VRF_BACKEND_NETNS in the client daemons, even when zebra was started without the --vrfwnetns option. This could lead to inconsistent behavior and subtle bugs under specific circumstances. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/zclient.c')
-rw-r--r--lib/zclient.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index cc936d47d7..0a2bea0c9f 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -2372,8 +2372,12 @@ static void zclient_capability_decode(int command, struct zclient *zclient,
{
struct zclient_capabilities cap;
struct stream *s = zclient->ibuf;
+ int vrf_backend;
uint8_t mpls_enabled;
+ STREAM_GETL(s, vrf_backend);
+ vrf_configure_backend(vrf_backend);
+
memset(&cap, 0, sizeof(cap));
STREAM_GETC(s, mpls_enabled);
cap.mpls_enabled = !!mpls_enabled;