diff options
author | Feng Lu <lu.feng@6wind.com> | 2015-05-22 11:40:02 +0200 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2015-06-02 07:46:17 +0200 |
commit | 0d0686f98e64017415071e590bde262f0ab5a4c9 (patch) | |
tree | a8ffef2548d24ce9a7662a20573d2a26a8e17142 /zebra/zserv.c | |
parent | a2854770ff839553c9444193e84a1593645fa848 (diff) | |
download | quagga-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/zserv.c')
-rw-r--r-- | zebra/zserv.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/zebra/zserv.c b/zebra/zserv.c index 432c3182..85f448c4 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -36,6 +36,7 @@ #include "privs.h" #include "network.h" #include "buffer.h" +#include "vrf.h" #include "zebra/zserv.h" #include "zebra/router-id.h" @@ -473,7 +474,7 @@ zsend_ipv6_nexthop_lookup (struct zserv *client, struct in6_addr *addr) struct nexthop *nexthop; /* Lookup nexthop. */ - rib = rib_match_ipv6 (addr); + rib = rib_match_ipv6 (addr, VRF_DEFAULT); /* Get output stream. */ s = client->obuf; @@ -540,7 +541,7 @@ zsend_ipv4_nexthop_lookup (struct zserv *client, struct in_addr addr) struct nexthop *nexthop; /* Lookup nexthop - eBGP excluded */ - rib = rib_match_ipv4_safi (addr, SAFI_UNICAST, 1, NULL); + rib = rib_match_ipv4_safi (addr, SAFI_UNICAST, 1, NULL, VRF_DEFAULT); /* Get output stream. */ s = client->obuf; @@ -679,7 +680,7 @@ zsend_ipv4_import_lookup (struct zserv *client, struct prefix_ipv4 *p) struct nexthop *nexthop; /* Lookup nexthop. */ - rib = rib_lookup_ipv4 (p); + rib = rib_lookup_ipv4 (p, VRF_DEFAULT); /* Get output stream. */ s = client->obuf; @@ -842,6 +843,9 @@ zread_ipv4_add (struct zserv *client, u_short length) p.prefixlen = stream_getc (s); stream_get (&p.prefix, s, PSIZE (p.prefixlen)); + /* VRF ID */ + rib->vrf_id = VRF_DEFAULT; + /* Nexthop parse. */ if (CHECK_FLAG (message, ZAPI_MESSAGE_NEXTHOP)) { @@ -972,7 +976,7 @@ zread_ipv4_delete (struct zserv *client, u_short length) api.metric = 0; rib_delete_ipv4 (api.type, api.flags, &p, nexthop_p, ifindex, - client->rtm_table, api.safi); + VRF_DEFAULT, api.safi); return 0; } @@ -998,7 +1002,7 @@ zread_ipv4_nexthop_lookup_mrib (struct zserv *client, u_short length) struct rib *rib; addr.s_addr = stream_get_ipv4 (client->ibuf); - rib = rib_match_ipv4_multicast (addr, NULL); + rib = rib_match_ipv4_multicast (addr, NULL, VRF_DEFAULT); return zsend_ipv4_nexthop_lookup_mrib (client, addr, rib); } @@ -1076,11 +1080,13 @@ zread_ipv6_add (struct zserv *client, u_short length) api.metric = 0; if (IN6_IS_ADDR_UNSPECIFIED (&nexthop)) - rib_add_ipv6 (api.type, api.flags, &p, NULL, ifindex, zebrad.rtm_table_default, api.metric, - api.distance, api.safi); + rib_add_ipv6 (api.type, api.flags, &p, NULL, ifindex, + VRF_DEFAULT, zebrad.rtm_table_default, api.metric, + api.distance, api.safi); else - rib_add_ipv6 (api.type, api.flags, &p, &nexthop, ifindex, zebrad.rtm_table_default, api.metric, - api.distance, api.safi); + rib_add_ipv6 (api.type, api.flags, &p, &nexthop, ifindex, + VRF_DEFAULT, zebrad.rtm_table_default, api.metric, + api.distance, api.safi); return 0; } @@ -1143,9 +1149,11 @@ zread_ipv6_delete (struct zserv *client, u_short length) api.metric = 0; if (IN6_IS_ADDR_UNSPECIFIED (&nexthop)) - rib_delete_ipv6 (api.type, api.flags, &p, NULL, ifindex, client->rtm_table, api.safi); + rib_delete_ipv6 (api.type, api.flags, &p, NULL, ifindex, VRF_DEFAULT, + api.safi); else - rib_delete_ipv6 (api.type, api.flags, &p, &nexthop, ifindex, client->rtm_table, api.safi); + rib_delete_ipv6 (api.type, api.flags, &p, &nexthop, ifindex, VRF_DEFAULT, + api.safi); return 0; } |