From 9a76375f39f556188d25920fb53802c091bc4064 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Mon, 11 Dec 2017 15:19:15 +0100 Subject: [PATCH] zebra: route configuration fix for vrf when applied to namespaces For each route to be added or deleted, instead of applying directly to default namespaces, when a vrf is mapped to a namespace, then the correct zns must be found out. Signed-off-by: Philippe Guibert --- zebra/rt_netlink.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 20abd76973..84c7b8e9cf 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1334,9 +1334,13 @@ static int netlink_route_multipath(int cmd, struct prefix *p, char buf[NL_PKT_BUF_SIZE]; } req; - struct zebra_ns *zns = zebra_ns_lookup(NS_DEFAULT); + struct zebra_ns *zns; struct zebra_vrf *zvrf = vrf_info_lookup(re->vrf_id); + if (!vrf_is_backend_netns()) + zns = zebra_ns_lookup(NS_DEFAULT); + else + zns = (struct zebra_ns *)ns_info_lookup(re->vrf_id); memset(&req, 0, sizeof req - NL_PKT_BUF_SIZE); bytelen = (family == AF_INET ? 4 : 16); -- 2.39.5