summaryrefslogtreecommitdiffstats
path: root/zebra/connected.c
diff options
context:
space:
mode:
authorFeng Lu <lu.feng@6wind.com>2015-05-22 11:40:02 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2015-06-02 07:46:17 +0200
commit0d0686f98e64017415071e590bde262f0ab5a4c9 (patch)
treea8ffef2548d24ce9a7662a20573d2a26a8e17142 /zebra/connected.c
parenta2854770ff839553c9444193e84a1593645fa848 (diff)
downloadquagga-0d0686f98e64017415071e590bde262f0ab5a4c9.tar.bz2
quagga-0d0686f98e64017415071e590bde262f0ab5a4c9.tar.xz
zebra: let FIB stand for its respective VRF
A new member "vrf_id" is added to "struct rib", reflecting the VRF which it belongs to. A new parameter "vrf_id" is added to the relative functions where need, except those: - which already have the parameter "vrf_id"; or - which have a parameter in type of "struct rib"; or - which have a parameter in type of "struct interface". All incoming routes are set to default VRF. In fact, all routes in FIB are kept in default VRF. And the logic is not changed. 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> [DL: conflicts fixed + compile warning fix] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'zebra/connected.c')
-rw-r--r--zebra/connected.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/zebra/connected.c b/zebra/connected.c
index 2db981b3..244f2911 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -192,12 +192,12 @@ connected_up_ipv4 (struct interface *ifp, struct connected *ifc)
return;
rib_add_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, NULL, ifp->ifindex,
- RT_TABLE_MAIN, ifp->metric, 0, SAFI_UNICAST);
+ ifp->vrf_id, RT_TABLE_MAIN, ifp->metric, 0, SAFI_UNICAST);
rib_add_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, NULL, ifp->ifindex,
- RT_TABLE_MAIN, ifp->metric, 0, SAFI_MULTICAST);
+ ifp->vrf_id, RT_TABLE_MAIN, ifp->metric, 0, SAFI_MULTICAST);
- rib_update ();
+ rib_update (ifp->vrf_id);
}
/* Add connected IPv4 route to the interface. */
@@ -304,11 +304,13 @@ connected_down_ipv4 (struct interface *ifp, struct connected *ifc)
return;
/* Same logic as for connected_up_ipv4(): push the changes into the head. */
- rib_delete_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0, SAFI_UNICAST);
+ rib_delete_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, ifp->vrf_id,
+ SAFI_UNICAST);
- rib_delete_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0, SAFI_MULTICAST);
+ rib_delete_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, ifp->vrf_id,
+ SAFI_MULTICAST);
- rib_update ();
+ rib_update (ifp->vrf_id);
}
/* Delete connected IPv4 route to the interface. */
@@ -330,7 +332,7 @@ connected_delete_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
connected_withdraw (ifc);
- rib_update();
+ rib_update (ifp->vrf_id);
}
#ifdef HAVE_IPV6
@@ -353,10 +355,10 @@ connected_up_ipv6 (struct interface *ifp, struct connected *ifc)
return;
#endif
- rib_add_ipv6 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, RT_TABLE_MAIN,
- ifp->metric, 0, SAFI_UNICAST);
+ rib_add_ipv6 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, ifp->vrf_id,
+ RT_TABLE_MAIN, ifp->metric, 0, SAFI_UNICAST);
- rib_update ();
+ rib_update (ifp->vrf_id);
}
/* Add connected IPv6 route to the interface. */
@@ -436,9 +438,10 @@ connected_down_ipv6 (struct interface *ifp, struct connected *ifc)
if (IN6_IS_ADDR_UNSPECIFIED (&p.prefix))
return;
- rib_delete_ipv6 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0, SAFI_UNICAST);
+ rib_delete_ipv6 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, ifp->vrf_id,
+ SAFI_UNICAST);
- rib_update ();
+ rib_update (ifp->vrf_id);
}
void
@@ -459,6 +462,6 @@ connected_delete_ipv6 (struct interface *ifp, struct in6_addr *address,
connected_withdraw (ifc);
- rib_update();
+ rib_update (ifp->vrf_id);
}
#endif /* HAVE_IPV6 */