Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd: Allow views to 'pretend' resolve nexthops #147

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions bgpd/bgp_nht.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ bgp_find_nexthop (struct bgp_info *path, int connected)
if (!bnc)
return 0;

/*
* We are cheating here. Views have no associated underlying
* ability to detect nexthops. So when we have a view
* just tell everyone the nexthop is valid
*/
if (path->peer && path->peer->bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
return 1;

if (connected && !(CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED)))
return 0;

Expand Down Expand Up @@ -196,7 +204,6 @@ bgp_find_or_add_nexthop (struct bgp *bgp, afi_t afi, struct bgp_info *ri,

bnc = rn->info;
bgp_unlock_node (rn);

if (is_bgp_static_route)
{
SET_FLAG(bnc->flags, BGP_STATIC_ROUTE);
Expand Down Expand Up @@ -239,10 +246,13 @@ bgp_find_or_add_nexthop (struct bgp *bgp, afi_t afi, struct bgp_info *ri,
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED);
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
}

if (!CHECK_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED))
if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
{
bnc->flags |= BGP_NEXTHOP_REGISTERED;
bnc->flags |= BGP_NEXTHOP_VALID;
}
else if (!CHECK_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED))
register_zebra_rnh(bnc, is_bgp_static_route);

if (ri && ri->nexthop != bnc)
{
/* Unlink from existing nexthop cache, if any. This will also free
Expand All @@ -260,7 +270,15 @@ bgp_find_or_add_nexthop (struct bgp *bgp, afi_t afi, struct bgp_info *ri,
else if (peer)
bnc->nht_info = (void *)peer; /* NHT peer reference */

return (bgp_isvalid_nexthop(bnc));
/*
* We are cheating here. Views have no associated underlying
* ability to detect nexthops. So when we have a view
* just tell everyone the nexthop is valid
*/
if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
return 1;
else
return (bgp_isvalid_nexthop(bnc));
}

void
Expand Down