summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2018-03-30 10:51:38 -0400
committerGitHub <noreply@github.com>2018-03-30 10:51:38 -0400
commitd77d48b9ac8f1398e302c206978afd4f67418c48 (patch)
tree5c3482e292588fb5691898d9350da1e03a5b52ae
parentd989640c0a31953f8f7402998a007d62a1eb5672 (diff)
parent593406a1335eda5098ffc191845cc8592c21c444 (diff)
Merge pull request #1966 from donaldsharp/vrf_late_to_the_party
zebra: Set table id *before* we enable the vrf
-rw-r--r--zebra/if_netlink.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index c8a6bedec1..cd602b3d82 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)