Merge pull request #4846 from vivek-cumulus/rfc-5549-gua-fix-ra

Fix nexthop reg and RA enable for IPv4 route exchange using GUA IPv6 peering
This commit is contained in:
Sri Mohana Singamsetty 2019-08-20 09:07:54 -07:00 committed by GitHub
commit d1c6230236
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 14 deletions

View File

@ -96,6 +96,21 @@ static int bgp_holdtime_timer(struct thread *);
/* BGP FSM functions. */
static int bgp_start(struct peer *);
/* Register peer with NHT */
static int bgp_peer_reg_with_nht(struct peer *peer)
{
int connected = 0;
if (peer->sort == BGP_PEER_EBGP && peer->ttl == 1
&& !CHECK_FLAG(peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK)
&& !bgp_flag_check(peer->bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
connected = 1;
return bgp_find_or_add_nexthop(
peer->bgp, peer->bgp, family2afi(peer->su.sa.sa_family),
NULL, peer, connected);
}
static void peer_xfer_stats(struct peer *peer_dst, struct peer *peer_src)
{
/* Copy stats over. These are only the pre-established state stats */
@ -293,6 +308,11 @@ static struct peer *peer_xfer_conn(struct peer *from_peer)
if (from_peer)
peer_xfer_stats(peer, from_peer);
/* Register peer for NHT. This is to allow RAs to be enabled when
* needed, even on a passive connection.
*/
bgp_peer_reg_with_nht(peer);
bgp_reads_on(peer);
bgp_writes_on(peer);
thread_add_timer_msec(bm->master, bgp_process_packet, peer, 0,
@ -1382,7 +1402,6 @@ static int bgp_connect_fail(struct peer *peer)
int bgp_start(struct peer *peer)
{
int status;
int connected = 0;
bgp_peer_conf_if_to_su_update(peer);
@ -1439,17 +1458,10 @@ int bgp_start(struct peer *peer)
return -1;
}
/* Register to be notified on peer up */
if (peer->sort == BGP_PEER_EBGP && peer->ttl == 1
&& !CHECK_FLAG(peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK)
&& !bgp_flag_check(peer->bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
connected = 1;
else
connected = 0;
if (!bgp_find_or_add_nexthop(peer->bgp, peer->bgp,
family2afi(peer->su.sa.sa_family), NULL,
peer, connected)) {
/* Register peer for NHT. If next hop is already resolved, proceed
* with connection setup, else wait.
*/
if (!bgp_peer_reg_with_nht(peer)) {
if (bgp_zebra_num_connects()) {
if (bgp_debug_neighbor_events(peer))
zlog_debug("%s [FSM] Waiting for NHT",

View File

@ -680,17 +680,23 @@ static void bgp_show_nexthops(struct vty *vty, struct bgp *bgp, int detail,
continue;
for (rn = bgp_table_top(table[afi]); rn;
rn = bgp_route_next(rn)) {
struct peer *peer;
bnc = bgp_node_get_bgp_nexthop_info(rn);
if (!bnc)
continue;
peer = (struct peer *)bnc->nht_info;
if (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_VALID)) {
vty_out(vty,
" %s valid [IGP metric %d], #paths %d\n",
" %s valid [IGP metric %d], #paths %d",
inet_ntop(rn->p.family,
&rn->p.u.prefix, buf,
sizeof(buf)),
bnc->metric, bnc->path_count);
if (peer)
vty_out(vty, ", peer %s", peer->host);
vty_out(vty, "\n");
if (!detail)
continue;
@ -698,10 +704,13 @@ static void bgp_show_nexthops(struct vty *vty, struct bgp *bgp, int detail,
bgp_show_nexthops_detail(vty, bgp, bnc);
} else {
vty_out(vty, " %s invalid\n",
vty_out(vty, " %s invalid",
inet_ntop(rn->p.family,
&rn->p.u.prefix, buf,
sizeof(buf)));
if (peer)
vty_out(vty, ", peer %s", peer->host);
vty_out(vty, "\n");
if (CHECK_FLAG(bnc->flags,
BGP_NEXTHOP_CONNECTED))
vty_out(vty, " Must be Connected\n");