summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorFeng Lu <lu.feng@6wind.com>2015-05-22 11:40:06 +0200
committerVipin Kumar <vipin@cumulusnetworks.com>2015-10-30 00:12:52 -0700
commit8f527c5e7e6888a7fced25928ea22899259ab49f (patch)
treede7d234b3d65fa675852210803f577c045c2f675 /zebra/zebra_rib.c
parentf91386cb7dcc3992d34e220c04f8f1def00105fd (diff)
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> Conflicts: zebra/zebra_rib.c zebra/zebra_vty.c
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 0f25c76858..2b94c6a7c6 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -2689,7 +2689,7 @@ static_install_ipv4 (struct prefix *p, struct static_ipv4 *si)
struct prefix nh_p;
/* Lookup table. */
- table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT);
+ table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, si->vrf_id);
if (! table)
return;
@@ -2740,7 +2740,7 @@ static_install_ipv4 (struct prefix *p, struct static_ipv4 *si)
rib->instance = 0;
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;
rib->tag = si->tag;
@@ -2798,7 +2798,7 @@ static_uninstall_ipv4 (struct prefix *p, struct static_ipv4 *si)
struct prefix nh_p;
/* Lookup table. */
- table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT);
+ table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, si->vrf_id);
if (! table)
return;
@@ -2928,6 +2928,7 @@ static_add_ipv4 (struct prefix *p, struct in_addr *gate, const char *ifname,
si->distance = distance;
si->flags = flags;
si->tag = tag;
+ si->vrf_id = vrf_id;
if (gate)
si->gate.ipv4 = *gate;
@@ -3454,7 +3455,7 @@ static_install_ipv6 (struct prefix *p, struct static_ipv6 *si)
struct prefix nh_p;
/* 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;
@@ -3506,7 +3507,7 @@ static_install_ipv6 (struct prefix *p, struct static_ipv6 *si)
rib->instance = 0;
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;
rib->tag = si->tag;
@@ -3565,7 +3566,7 @@ static_uninstall_ipv6 (struct prefix *p, struct static_ipv6 *si)
struct prefix nh_p;
/* 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;
@@ -3686,6 +3687,7 @@ static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
si->distance = distance;
si->flags = flags;
si->tag = tag;
+ si->vrf_id = vrf_id;
switch (type)
{