summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_vty.c
diff options
context:
space:
mode:
authorFeng Lu <lu.feng@6wind.com>2015-05-22 11:39:56 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2015-06-02 06:58:12 +0200
commit41f44a23e86a65a5cad7e5e8cafd7e935f153232 (patch)
tree1fcffa568b188ae66e5f18df09f6960522dfe564 /zebra/zebra_vty.c
parent395828eea809e8b2b8c5824d3639cefedd7aa9f0 (diff)
downloadquagga-41f44a23e86a65a5cad7e5e8cafd7e935f153232.tar.bz2
quagga-41f44a23e86a65a5cad7e5e8cafd7e935f153232.tar.xz
lib, zebra: move "struct vrf" to be a lib module
Previously "struct vrf" is defined locally in zebra. Now it is moved to be a lib module. This is the first step to support multi-VRF in quagga. The implementation is splitted into small patches for the purpose of easy review. * lib: "struct vrf" with basic members is defined in vrf.c. The member "void *info" is for user data. Some basic functions are defined in vrf.c for adding/deleting/ looking up a VRF, scanning the VRF table and initializing the VRF module. The type "vrf_id_t" is defined specificly for VRF ID. * zebra: The previous "struct vrf" is re-defined as "struct zebra_vrf"; and previous "vrf" variables are renamed to "zvrf". The previous "struct vrf" related functions are removed from zbera_rib.c. New functions are defined to maintain the new "struct zebra_vrf". The names vrf_xxx are reserved for the functions in VRF module. So: - the previous vrf_table() are renamed to zebra_vrf_table(); - the previous vrf_static_table() are renamed to zebra_vrf_static_table(). The main logic is not changed. BTW: Add a statement to zebra_snmp.c telling that the SNMP is running only for the MIBs in the default VRF. 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/zebra_vty.c')
-rw-r--r--zebra/zebra_vty.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index bc453de9..a4e6af78 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -27,6 +27,7 @@
#include "command.h"
#include "table.h"
#include "rib.h"
+#include "vrf.h"
#include "zebra/zserv.h"
@@ -989,7 +990,7 @@ static int do_show_ip_route(struct vty *vty, safi_t safi) {
struct rib *rib;
int first = 1;
- table = vrf_table (AFI_IP, safi, 0);
+ table = zebra_vrf_table (AFI_IP, safi, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -1030,7 +1031,7 @@ DEFUN (show_ip_route_prefix_longer,
return CMD_WARNING;
}
- table = vrf_table (AFI_IP, SAFI_UNICAST, 0);
+ table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -1063,7 +1064,7 @@ DEFUN (show_ip_route_supernets,
u_int32_t addr;
int first = 1;
- table = vrf_table (AFI_IP, SAFI_UNICAST, 0);
+ table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -1109,7 +1110,7 @@ DEFUN (show_ip_route_protocol,
return CMD_WARNING;
}
- table = vrf_table (AFI_IP, SAFI_UNICAST, 0);
+ table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -1148,7 +1149,7 @@ DEFUN (show_ip_route_addr,
return CMD_WARNING;
}
- table = vrf_table (AFI_IP, SAFI_UNICAST, 0);
+ table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -1186,7 +1187,7 @@ DEFUN (show_ip_route_prefix,
return CMD_WARNING;
}
- table = vrf_table (AFI_IP, SAFI_UNICAST, 0);
+ table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -1359,7 +1360,7 @@ DEFUN (show_ip_route_summary,
{
struct route_table *table;
- table = vrf_table (AFI_IP, SAFI_UNICAST, 0);
+ table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -1380,7 +1381,7 @@ DEFUN (show_ip_route_summary_prefix,
{
struct route_table *table;
- table = vrf_table (AFI_IP, SAFI_UNICAST, 0);
+ table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -1402,7 +1403,7 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
write = 0;
/* Lookup table. */
- stable = vrf_static_table (AFI_IP, safi, 0);
+ stable = zebra_vrf_static_table (AFI_IP, safi, VRF_DEFAULT);
if (! stable)
return -1;
@@ -1489,7 +1490,7 @@ DEFUN (show_ip_mroute,
struct rib *rib;
int first = 1;
- table = vrf_table (AFI_IP, SAFI_MULTICAST, 0);
+ table = zebra_vrf_table (AFI_IP, SAFI_MULTICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -1826,7 +1827,7 @@ DEFUN (show_ipv6_route,
struct rib *rib;
int first = 1;
- table = vrf_table (AFI_IP6, SAFI_UNICAST, 0);
+ table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -1860,7 +1861,7 @@ DEFUN (show_ipv6_route_prefix_longer,
int ret;
int first = 1;
- table = vrf_table (AFI_IP6, SAFI_UNICAST, 0);
+ table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -1907,7 +1908,7 @@ DEFUN (show_ipv6_route_protocol,
return CMD_WARNING;
}
- table = vrf_table (AFI_IP6, SAFI_UNICAST, 0);
+ table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -1946,7 +1947,7 @@ DEFUN (show_ipv6_route_addr,
return CMD_WARNING;
}
- table = vrf_table (AFI_IP6, SAFI_UNICAST, 0);
+ table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -1984,7 +1985,7 @@ DEFUN (show_ipv6_route_prefix,
return CMD_WARNING;
}
- table = vrf_table (AFI_IP6, SAFI_UNICAST, 0);
+ table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -2015,7 +2016,7 @@ DEFUN (show_ipv6_route_summary,
{
struct route_table *table;
- table = vrf_table (AFI_IP6, SAFI_UNICAST, 0);
+ table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -2036,7 +2037,7 @@ DEFUN (show_ipv6_route_summary_prefix,
{
struct route_table *table;
- table = vrf_table (AFI_IP6, SAFI_UNICAST, 0);
+ table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -2062,7 +2063,7 @@ DEFUN (show_ipv6_mroute,
struct rib *rib;
int first = 1;
- table = vrf_table (AFI_IP6, SAFI_MULTICAST, 0);
+ table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, VRF_DEFAULT);
if (! table)
return CMD_SUCCESS;
@@ -2093,7 +2094,7 @@ static_config_ipv6 (struct vty *vty)
write = 0;
/* Lookup table. */
- stable = vrf_static_table (AFI_IP6, SAFI_UNICAST, 0);
+ stable = zebra_vrf_static_table (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT);
if (! stable)
return -1;