diff options
author | Russ White <russ@riw.us> | 2018-04-20 14:01:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-20 14:01:32 +0200 |
commit | 751423e4415cd8d94e17dc446a6237487a08f4ec (patch) | |
tree | 2df2a2cdef2232d4ea3d9ee5b07f366991404732 | |
parent | Merge pull request #2077 from donaldsharp/static_warn (diff) | |
parent | vtysh: remove exit-vrf for vtysh -m (diff) | |
download | frr-751423e4415cd8d94e17dc446a6237487a08f4ec.tar.xz frr-751423e4415cd8d94e17dc446a6237487a08f4ec.zip |
Merge pull request #2079 from qlyoung/exit-vrf-memes
Always explicitly exit vrf contexts
-rw-r--r-- | vtysh/vtysh.c | 2 | ||||
-rw-r--r-- | vtysh/vtysh_config.c | 6 | ||||
-rw-r--r-- | zebra/zebra_vrf.c | 11 |
3 files changed, 11 insertions, 8 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 240090818..ec212233f 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -671,8 +671,6 @@ int vtysh_mark_file(const char *filename) } else if ((prev_node == BGP_EVPN_VNI_NODE) && (tried == 1)) { fprintf(outputfile, "exit-vni\n"); - } else if (prev_node == VRF_NODE) { - fprintf(outputfile, "exit-vrf\n"); } else if ((prev_node == KEYCHAIN_KEY_NODE) && (tried == 1)) { fprintf(outputfile, "exit\n"); diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c index 3748fef54..6f3b6a826 100644 --- a/vtysh/vtysh_config.c +++ b/vtysh/vtysh_config.c @@ -185,6 +185,12 @@ void vtysh_config_parse_line(void *arg, const char *line) == 0) { config_add_line(config->line, line); config->index = INTERFACE_NODE; + } else if (config->index == VRF_NODE + && strncmp(line, " exit-vrf", + strlen(" exit-vrf")) + == 0) { + config_add_line(config->line, line); + config->index = CONFIG_NODE; } else if (config->index == RMAP_NODE || config->index == INTERFACE_NODE || config->index == LOGICALROUTER_NODE diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index 76dc5657d..18d53292b 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -524,10 +524,8 @@ static int vrf_config_write(struct vty *vty) if (zvrf->l3vni) vty_out(vty, "vni %u\n", zvrf->l3vni); vty_out(vty, "!\n"); - } - - if (vrf_is_user_cfged(vrf)) { - vty_out(vty, "vrf %s\n", zvrf_name(zvrf)); + } else { + vty_frame(vty, "vrf %s\n", zvrf_name(zvrf)); if (zvrf->l3vni) vty_out(vty, " vni %u%s\n", zvrf->l3vni, is_l3vni_for_prefix_routes_only( @@ -535,14 +533,15 @@ static int vrf_config_write(struct vty *vty) ? " prefix-routes-only" : ""); zebra_ns_config_write(vty, (struct ns *)vrf->ns_ctxt); + } static_config(vty, zvrf, AFI_IP, SAFI_UNICAST, "ip route"); static_config(vty, zvrf, AFI_IP, SAFI_MULTICAST, "ip mroute"); static_config(vty, zvrf, AFI_IP6, SAFI_UNICAST, "ipv6 route"); - if (vrf->vrf_id != VRF_DEFAULT) - vty_out(vty, "!\n"); + if (zvrf_id(zvrf) != VRF_DEFAULT) + vty_endframe(vty, " exit-vrf\n!\n"); } return 0; } |