bgpd: Rejiggle exported nht function names and consolidate some code
* bgp_nht.h: Tweak the API a bit to simplify and make names a bit clearer on
function. Remove AFI argument, it's implied in both bgp_infos and peers.
(bgp_find_nexthop) this doesn't so much find a bnc, as check the bnc
for the given bgp_info is valid. Rename to (bgp_nexthop_check).
(bgp_find_or_add_nexthop) This ensures a bnc exists, so call it
(bgp_ensure_nexthop).
(bgp_unlink_nexthop_by_peer) Remove via peer.
* bgp_nht.c: Adjust to above.
(bgp_get_nexthop_rn) helper to get the rn.
(bgp_find_nexthop) further helper to get the bnc for path or peer.
(bgp_unlink_nexthop_check) helper to check whether a bnc should go.
(bgp_ensure_nexthop) Use the helpers.
* bgp_{route,fsm}.c: s/bgp_find_or_add_nexthop/bgp_ensure_nexthop/
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 67c50c4..9d86655 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -507,7 +507,7 @@
/* Reset peer synctime */
peer->synctime = 0;
}
-
+
/* Stop read and write threads when exists. */
BGP_READ_OFF (peer->t_read);
BGP_WRITE_OFF (peer->t_write);
@@ -720,8 +720,7 @@
! CHECK_FLAG (peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))
connected = 1;
- bgp_find_or_add_nexthop(family2afi(peer->su.sa.sa_family), NULL, peer,
- connected);
+ bgp_ensure_nexthop (NULL, peer, connected);
status = bgp_connect (peer);
switch (status)