summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_rnh.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2019-08-28 16:01:38 +0200
committerPhilippe Guibert <philippe.guibert@6wind.com>2019-08-28 16:19:34 +0200
commit5a0bdc782c209e4cc57c549f313bfd6d1ca316eb (patch)
treee2e865a3ef61a582275f5edc90348de2fd17b134 /zebra/zebra_rnh.c
parentMerge pull request #4880 from ddutt/master (diff)
downloadfrr-5a0bdc782c209e4cc57c549f313bfd6d1ca316eb.tar.xz
frr-5a0bdc782c209e4cc57c549f313bfd6d1ca316eb.zip
zebra: nht resolution default configurable per vrf
even if vty commands were available, the default resolution command was working only for the first vrf configured. others were ignored. Also, for nexthop, resolution was working for all vrfs, and not the specific one. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/zebra_rnh.c')
-rw-r--r--zebra/zebra_rnh.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index da2fe4a30..666ebb70e 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -62,9 +62,6 @@ static int send_client(struct rnh *rnh, struct zserv *client, rnh_type_t type,
static void print_rnh(struct route_node *rn, struct vty *vty);
static int zebra_client_cleanup_rnh(struct zserv *client);
-int zebra_rnh_ip_default_route = 0;
-int zebra_rnh_ipv6_default_route = 0;
-
void zebra_rnh_init(void)
{
hook_register(zserv_client_close, zebra_client_cleanup_rnh);
@@ -656,7 +653,7 @@ zebra_rnh_resolve_nexthop_entry(struct zebra_vrf *zvrf, afi_t afi,
* match route to be exact if so specified
*/
if (is_default_prefix(&rn->p)
- && !rnh_resolve_via_default(rn->p.family)) {
+ && !rnh_resolve_via_default(zvrf, rn->p.family)) {
if (IS_ZEBRA_DEBUG_NHT_DETAILED)
zlog_debug(
"\tNot allowed to resolve through default prefix");
@@ -1213,3 +1210,12 @@ static int zebra_client_cleanup_rnh(struct zserv *client)
return 0;
}
+
+int rnh_resolve_via_default(struct zebra_vrf *zvrf, int family)
+{
+ if (((family == AF_INET) && zvrf->zebra_rnh_ip_default_route)
+ || ((family == AF_INET6) && zvrf->zebra_rnh_ipv6_default_route))
+ return 1;
+ else
+ return 0;
+}