summaryrefslogtreecommitdiffstats
path: root/zebra/rt_netlink.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/rt_netlink.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/rt_netlink.c')
-rw-r--r--zebra/rt_netlink.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 45ebf20e..cf6ce0cd 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -36,6 +36,7 @@
#include "rib.h"
#include "thread.h"
#include "privs.h"
+#include "vrf.h"
#include "zebra/zserv.h"
#include "zebra/rt.h"
@@ -743,7 +744,7 @@ netlink_routing_table (struct sockaddr_nl *snl, struct nlmsghdr *h)
if (!tb[RTA_MULTIPATH])
rib_add_ipv4 (ZEBRA_ROUTE_KERNEL, flags, &p, gate, src, index,
- table, metric, 0, SAFI_UNICAST);
+ VRF_DEFAULT, table, metric, 0, SAFI_UNICAST);
else
{
/* This is a multipath route */
@@ -759,6 +760,7 @@ netlink_routing_table (struct sockaddr_nl *snl, struct nlmsghdr *h)
rib->distance = 0;
rib->flags = flags;
rib->metric = metric;
+ rib->vrf_id = VRF_DEFAULT;
rib->table = table;
rib->nexthop_num = 0;
rib->uptime = time (NULL);
@@ -808,8 +810,8 @@ netlink_routing_table (struct sockaddr_nl *snl, struct nlmsghdr *h)
memcpy (&p.prefix, dest, 16);
p.prefixlen = rtm->rtm_dst_len;
- rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, flags, &p, gate, index, table,
- metric, 0, SAFI_UNICAST);
+ rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, flags, &p, gate, index, VRF_DEFAULT,
+ table, metric, 0, SAFI_UNICAST);
}
#endif /* HAVE_IPV6 */
@@ -942,8 +944,8 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
if (h->nlmsg_type == RTM_NEWROUTE)
{
if (!tb[RTA_MULTIPATH])
- rib_add_ipv4 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, src, index, table,
- metric, 0, SAFI_UNICAST);
+ rib_add_ipv4 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, src, index, VRF_DEFAULT,
+ table, metric, 0, SAFI_UNICAST);
else
{
/* This is a multipath route */
@@ -959,6 +961,7 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
rib->distance = 0;
rib->flags = 0;
rib->metric = metric;
+ rib->vrf_id = VRF_DEFAULT;
rib->table = table;
rib->nexthop_num = 0;
rib->uptime = time (NULL);
@@ -1001,7 +1004,8 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
}
}
else
- rib_delete_ipv4 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, index, table, SAFI_UNICAST);
+ rib_delete_ipv4 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, index, VRF_DEFAULT,
+ SAFI_UNICAST);
}
#ifdef HAVE_IPV6
@@ -1022,9 +1026,11 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
}
if (h->nlmsg_type == RTM_NEWROUTE)
- rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, index, table, metric, 0, SAFI_UNICAST);
+ rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, index, VRF_DEFAULT, table,
+ metric, 0, SAFI_UNICAST);
else
- rib_delete_ipv6 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, index, table, SAFI_UNICAST);
+ rib_delete_ipv6 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, index, VRF_DEFAULT,
+ SAFI_UNICAST);
}
#endif /* HAVE_IPV6 */