summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorFeng Lu <lu.feng@6wind.com>2015-05-22 11:40:06 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2015-06-02 07:48:34 +0200
commit7aaf4ea990398335bd40b56cc9586ab6a7178a4f (patch)
tree12800739e1a926cff27d4d676323be35318ef8ac /zebra/zebra_rib.c
parent8970f74ec77f93eb862ab8803d9d7c76c7128940 (diff)
downloadquagga-7aaf4ea990398335bd40b56cc9586ab6a7178a4f.tar.bz2
quagga-7aaf4ea990398335bd40b56cc9586ab6a7178a4f.tar.xz
zebra: configure static routes in any VRF
Introduce new commands to configure static routes in any VRF, by appending the old static route commands with a new parameter "vrf N". A new parameter "const char *vrf_id_str" is added to the functions zebra_static_ipv4() and static_ipv6_func() to get the configured VRF ID. A new member "vrf_id" is added to the "struct static_ipv4" and "struct static_ipv6", indicating which VRF this static route is configured in. But till now, no interface can exist in any non-default VRF. So these static routes in non-default VRFs are kept inactive. 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_rib.c')
-rw-r--r--zebra/zebra_rib.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 8bd4ecc8..68ae397b 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -2290,7 +2290,7 @@ static_install_ipv4 (safi_t safi, struct prefix *p, struct static_ipv4 *si)
struct route_table *table;
/* Lookup table. */
- table = zebra_vrf_table (AFI_IP, safi, VRF_DEFAULT);
+ table = zebra_vrf_table (AFI_IP, safi, si->vrf_id);
if (! table)
return;
@@ -2332,7 +2332,7 @@ static_install_ipv4 (safi_t safi, struct prefix *p, struct static_ipv4 *si)
rib->type = ZEBRA_ROUTE_STATIC;
rib->distance = si->distance;
rib->metric = 0;
- rib->vrf_id = VRF_DEFAULT;
+ rib->vrf_id = si->vrf_id;
rib->table = zebrad.rtm_table_default;
rib->nexthop_num = 0;
@@ -2384,7 +2384,7 @@ static_uninstall_ipv4 (safi_t safi, struct prefix *p, struct static_ipv4 *si)
struct route_table *table;
/* Lookup table. */
- table = zebra_vrf_table (AFI_IP, safi, VRF_DEFAULT);
+ table = zebra_vrf_table (AFI_IP, safi, si->vrf_id);
if (! table)
return;
@@ -2490,6 +2490,7 @@ static_add_ipv4_safi (safi_t safi, struct prefix *p, struct in_addr *gate,
si->type = type;
si->distance = distance;
si->flags = flags;
+ si->vrf_id = vrf_id;
if (gate)
si->gate.ipv4 = *gate;
@@ -2836,7 +2837,7 @@ static_install_ipv6 (struct prefix *p, struct static_ipv6 *si)
struct route_node *rn;
/* Lookup table. */
- table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT);
+ table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, si->vrf_id);
if (! table)
return;
@@ -2879,7 +2880,7 @@ static_install_ipv6 (struct prefix *p, struct static_ipv6 *si)
rib->type = ZEBRA_ROUTE_STATIC;
rib->distance = si->distance;
rib->metric = 0;
- rib->vrf_id = VRF_DEFAULT;
+ rib->vrf_id = si->vrf_id;
rib->table = zebrad.rtm_table_default;
rib->nexthop_num = 0;
@@ -2932,7 +2933,7 @@ static_uninstall_ipv6 (struct prefix *p, struct static_ipv6 *si)
struct nexthop *nexthop;
/* Lookup table. */
- table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT);
+ table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, si->vrf_id);
if (! table)
return;
@@ -3031,6 +3032,7 @@ static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
si->type = type;
si->distance = distance;
si->flags = flags;
+ si->vrf_id = vrf_id;
switch (type)
{