summaryrefslogtreecommitdiffstats
path: root/zebra/interface.c
diff options
context:
space:
mode:
authorFeng Lu <lu.feng@6wind.com>2015-05-22 11:40:00 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2015-06-02 06:59:36 +0200
commit471ea39ce54537194ff2f22420589ddec5ef5ada (patch)
tree65b04ef42d4ece7e4a44d230fcc0a15f388755c4 /zebra/interface.c
parent5a5702fac5458d63d7a099c4db7ac387afefd2de (diff)
downloadquagga-471ea39ce54537194ff2f22420589ddec5ef5ada.tar.bz2
quagga-471ea39ce54537194ff2f22420589ddec5ef5ada.tar.xz
lib, zebra, vtysh: configure an interface in non-default VRF
Introduce a new command "interface IFNAME vrf N" to configure an interface in the non-default VRF. Till now, only zebra uses this command. Other daemons will install the command when they support multiple VRFs. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'zebra/interface.c')
-rw-r--r--zebra/interface.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index 3063dad8..527893be 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -32,6 +32,7 @@
#include "connected.h"
#include "log.h"
#include "zclient.h"
+#include "vrf.h"
#include "zebra/interface.h"
#include "zebra/rtadv.h"
@@ -914,6 +915,13 @@ DEFUN_NOSH (zebra_interface,
return ret;
}
+ALIAS (zebra_interface,
+ zebra_interface_vrf_cmd,
+ "interface IFNAME " VRF_CMD_STR,
+ "Select an interface to configure\n"
+ "Interface's name\n"
+ VRF_CMD_HELP_STR)
+
struct cmd_node interface_node =
{
INTERFACE_NODE,
@@ -1558,8 +1566,10 @@ if_config_write (struct vty *vty)
{
struct listnode *node;
struct interface *ifp;
+ vrf_iter_t iter;
- for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+ for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
+ for (ALL_LIST_ELEMENTS_RO (vrf_iter2iflist (iter), node, ifp))
{
struct zebra_if *if_data;
struct listnode *addrnode;
@@ -1567,9 +1577,12 @@ if_config_write (struct vty *vty)
struct prefix *p;
if_data = ifp->info;
-
- vty_out (vty, "interface %s%s", ifp->name,
- VTY_NEWLINE);
+
+ if (ifp->vrf_id == VRF_DEFAULT)
+ vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE);
+ else
+ vty_out (vty, "interface %s vrf %u%s", ifp->name, ifp->vrf_id,
+ VTY_NEWLINE);
if (if_data)
{
@@ -1644,7 +1657,9 @@ zebra_if_init (void)
install_element (ENABLE_NODE, &show_interface_cmd);
install_element (ENABLE_NODE, &show_interface_desc_cmd);
install_element (CONFIG_NODE, &zebra_interface_cmd);
+ install_element (CONFIG_NODE, &zebra_interface_vrf_cmd);
install_element (CONFIG_NODE, &no_interface_cmd);
+ install_element (CONFIG_NODE, &no_interface_vrf_cmd);
install_default (INTERFACE_NODE);
install_element (INTERFACE_NODE, &interface_desc_cmd);
install_element (INTERFACE_NODE, &no_interface_desc_cmd);