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>
diff --git a/lib/if.c b/lib/if.c
index 30da8a9..4d4b656 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -645,6 +645,9 @@
return CMD_WARNING;
}
+ if (argc > 1)
+ VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
+
#ifdef SUNOS_5
ifp = if_sunwzebra_get (argv[0], sl, vrf_id);
#else
@@ -657,6 +660,13 @@
return CMD_SUCCESS;
}
+ALIAS (interface,
+ interface_vrf_cmd,
+ "interface IFNAME " VRF_CMD_STR,
+ "Select an interface to configure\n"
+ "Interface's name\n"
+ VRF_CMD_HELP_STR)
+
DEFUN_NOSH (no_interface,
no_interface_cmd,
"no interface IFNAME",
@@ -668,6 +678,9 @@
struct interface *ifp;
vrf_id_t vrf_id = VRF_DEFAULT;
+ if (argc > 1)
+ VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
+
ifp = if_lookup_by_name_vrf (argv[0], vrf_id);
if (ifp == NULL)
@@ -688,6 +701,14 @@
return CMD_SUCCESS;
}
+ALIAS (no_interface,
+ no_interface_vrf_cmd,
+ "no interface IFNAME " VRF_CMD_STR,
+ NO_STR
+ "Delete a pseudo interface's configuration\n"
+ "Interface's name\n"
+ VRF_CMD_HELP_STR)
+
/* For debug purpose. */
DEFUN (show_address,
show_address_cmd,