summaryrefslogtreecommitdiff
path: root/zebra/kernel_socket.c
diff options
context:
space:
mode:
authorFeng Lu <lu.feng@6wind.com>2015-05-22 11:40:02 +0200
committerVipin Kumar <vipin@cumulusnetworks.com>2015-10-29 23:38:03 -0700
commit78104b9bad14a3185178cedc0dd41d1b1c5db493 (patch)
tree68f6ae364369a27d9d39b0c76a878f225f3cc259 /zebra/kernel_socket.c
parent8b87bdf4165979e072b3417dbf82300d18ca7d96 (diff)
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> Conflicts: zebra/connected.c zebra/kernel_socket.c zebra/rib.h zebra/rt_netlink.c zebra/zebra_rib.c zebra/zserv.c Conflicts: zebra/connected.c zebra/interface.c zebra/kernel_socket.c zebra/rib.h zebra/rt_netlink.c zebra/rtread_getmsg.c zebra/zebra_rib.c zebra/zebra_vty.c zebra/zserv.c
Diffstat (limited to 'zebra/kernel_socket.c')
-rw-r--r--zebra/kernel_socket.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 03f3eaeb6a..a1002a4d86 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -32,6 +32,7 @@
#include "table.h"
#include "rib.h"
#include "privs.h"
+#include "vrf.h"
#include "zebra/interface.h"
#include "zebra/zserv.h"
@@ -870,8 +871,8 @@ rtm_read (struct rt_msghdr *rtm)
int ret;
if (! IS_ZEBRA_DEBUG_RIB)
return;
- ret = rib_lookup_ipv4_route (&p, &gate);
- inet_ntop (AF_INET, &p.prefix, buf, INET_ADDRSTRLEN);
+ ret = rib_lookup_ipv4_route (&p, &gate, VRF_DEFAULT);
+ prefix2str (&p, buf, sizeof(buf));
switch (rtm->rtm_type)
{
case RTM_ADD:
@@ -935,16 +936,16 @@ rtm_read (struct rt_msghdr *rtm)
*/
if (rtm->rtm_type == RTM_CHANGE)
rib_delete_ipv4 (ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p,
- NULL, 0, 0, SAFI_UNICAST);
+ NULL, 0, VRF_DEFAULT, SAFI_UNICAST);
if (rtm->rtm_type == RTM_GET
|| rtm->rtm_type == RTM_ADD
|| rtm->rtm_type == RTM_CHANGE)
rib_add_ipv4 (ZEBRA_ROUTE_KERNEL, 0, zebra_flags,
- &p, &gate.sin.sin_addr, NULL, 0, 0, 0, 0, SAFI_UNICAST);
+ &p, &gate.sin.sin_addr, NULL, 0, VRF_DEFAULT, 0, 0, SAFI_UNICAST);
else
rib_delete_ipv4 (ZEBRA_ROUTE_KERNEL, 0 zebra_flags,
- &p, &gate.sin.sin_addr, 0, 0, SAFI_UNICAST);
+ &p, &gate.sin.sin_addr, 0, VRF_DEFAULT, SAFI_UNICAST);
}
#ifdef HAVE_IPV6
if (dest.sa.sa_family == AF_INET6)
@@ -977,16 +978,16 @@ rtm_read (struct rt_msghdr *rtm)
*/
if (rtm->rtm_type == RTM_CHANGE)
rib_delete_ipv6 (ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p,
- NULL, 0, 0, SAFI_UNICAST);
+ NULL, 0, VRF_DEFAULT, SAFI_UNICAST);
if (rtm->rtm_type == RTM_GET
|| rtm->rtm_type == RTM_ADD
|| rtm->rtm_type == RTM_CHANGE)
rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, 0, zebra_flags,
- &p, &gate.sin6.sin6_addr, ifindex, 0, 0, 0, SAFI_UNICAST);
+ &p, &gate.sin6.sin6_addr, ifindex, VRF_DEFAULT, 0, 0, SAFI_UNICAST);
else
rib_delete_ipv6 (ZEBRA_ROUTE_KERNEL, 0, zebra_flags,
- &p, &gate.sin6.sin6_addr, ifindex, 0, SAFI_UNICAST);
+ &p, &gate.sin6.sin6_addr, ifindex, VRF_DEFAULT, SAFI_UNICAST);
}
#endif /* HAVE_IPV6 */
}