summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2018-03-30 04:13:57 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2018-03-30 19:14:34 +0200
commit16d6ea59d3d738cceeaabe6a2df5afad4b515b00 (patch)
tree32c34cfff3df175a65686f8b69340d4a401c35ea /lib
parentMerge pull request #1824 from pguibert6WIND/table_manager (diff)
downloadfrr-16d6ea59d3d738cceeaabe6a2df5afad4b515b00.tar.xz
frr-16d6ea59d3d738cceeaabe6a2df5afad4b515b00.zip
lib, vtysh: vrf walkup bugfix
Static route commands are now installed inside the VRF nodes. This has quietly broken top-level static routes in certain scenarios due to walkup logic resolving a static route configuration command inside VRF_NODE first if the command is issued while in a CLI node lower than VRF_NODE. To fix this VRF_NODE needs a special exit command, as has been done for many other nodes with the same issue, to explicitly change the vrf context to the default VRF so that when walkup resolves against the VRF node it will configure against the default VRF as desired. Of course this is a hack on top of a hack and the CLI walkup implementation needs to be rewritten. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/vrf.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/vrf.c b/lib/vrf.c
index 02ac160ab..1ed96cd0a 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -642,6 +642,17 @@ int vrf_is_mapped_on_netns(vrf_id_t vrf_id)
}
/* vrf CLI commands */
+DEFUN_NOSH(vrf_exit,
+ vrf_exit_cmd,
+ "exit-vrf",
+ "Exit current mode and down to previous mode\n")
+{
+ /* We have to set vrf context to default vrf */
+ VTY_PUSH_CONTEXT(VRF_NODE, vrf_get(VRF_DEFAULT, VRF_DEFAULT_NAME));
+ vty->node = CONFIG_NODE;
+ return CMD_SUCCESS;
+}
+
DEFUN_NOSH (vrf,
vrf_cmd,
"vrf NAME",
@@ -799,6 +810,7 @@ void vrf_cmd_init(int (*writefunc)(struct vty *vty),
install_element(CONFIG_NODE, &no_vrf_cmd);
install_node(&vrf_node, writefunc);
install_default(VRF_NODE);
+ install_element(VRF_NODE, &vrf_exit_cmd);
if (vrf_is_backend_netns() && ns_have_netns()) {
/* Install NS commands. */
vrf_daemon_privs = daemon_privs;