From: Donald Sharp Date: Sun, 25 Mar 2018 23:35:27 +0000 (-0400) Subject: zebra: Set table id *before* we enable the vrf X-Git-Tag: frr-5.0-dev~99^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=593406a1335eda5098ffc191845cc8592c21c444;p=matthieu%2Ffrr.git zebra: Set table id *before* we enable the vrf The table id of the vrf is being given to us as part of the vrf creation netlink callback. Unfortunately it was being set in the zvrf *after* the vrf_enable callback. This didn't used to matter until we started having config data stored on the side that we needed to act on when the vrf came up enough to start working. So when we were storing static routes and installing them they were being pushed into the default table for non-default vrf's. Ticket: CM-19141 Signed-off-by: Donald Sharp --- diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index a37d74416b..f1a12f5310 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -314,21 +314,28 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb, return; } - /* Enable the created VRF. */ - if (!vrf_enable(vrf)) { - zlog_err("Failed to enable VRF %s id %u", name, - ifi->ifi_index); - return; - } - /* * This is the only place that we get the actual kernel table_id * being used. We need it to set the table_id of the routes * we are passing to the kernel.... And to throw some totally * awesome parties. that too. + * + * At this point we *must* have a zvrf because the vrf_create + * callback creates one. We *must* set the table id + * before the vrf_enable because of( at the very least ) + * static routes being delayed for installation until + * during the vrf_enable callbacks. */ zvrf = (struct zebra_vrf *)vrf->info; zvrf->table_id = nl_table_id; + + /* Enable the created VRF. */ + if (!vrf_enable(vrf)) { + zlog_err("Failed to enable VRF %s id %u", name, + ifi->ifi_index); + return; + } + } else // h->nlmsg_type == RTM_DELLINK { if (IS_ZEBRA_DEBUG_KERNEL)