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_route.c b/bgpd/bgp_route.c
index 476ef05..9137143 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -134,7 +134,7 @@
if (binfo->attr)
bgp_attr_unintern (&binfo->attr);
- bgp_unlink_nexthop(binfo);
+ bgp_unlink_nexthop (binfo);
bgp_info_extra_free (&binfo->extra);
bgp_info_mpath_free (&binfo->mpath);
@@ -2345,7 +2345,7 @@
else
connected = 0;
- if (bgp_find_or_add_nexthop (afi, ri, NULL, connected))
+ if (bgp_ensure_nexthop (ri, NULL, connected))
bgp_info_set_flag (rn, ri, BGP_INFO_VALID);
else
{
@@ -2397,7 +2397,7 @@
else
connected = 0;
- if (bgp_find_or_add_nexthop (afi, new, NULL, connected))
+ if (bgp_ensure_nexthop (new, NULL, connected))
bgp_info_set_flag (rn, new, BGP_INFO_VALID);
else
{
@@ -3543,7 +3543,7 @@
/* Nexthop reachability check. */
if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK))
{
- if (bgp_find_or_add_nexthop (afi, ri, NULL, 0))
+ if (bgp_ensure_nexthop (ri, NULL, 0))
bgp_info_set_flag (rn, ri, BGP_INFO_VALID);
else
{
@@ -3572,7 +3572,7 @@
/* Nexthop reachability check. */
if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK))
{
- if (bgp_find_or_add_nexthop (afi, new, NULL, 0))
+ if (bgp_ensure_nexthop (new, NULL, 0))
bgp_info_set_flag (rn, new, BGP_INFO_VALID);
else
{
@@ -3692,7 +3692,7 @@
/* Nexthop reachability check. */
if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK))
{
- if (bgp_find_or_add_nexthop (afi, ri, NULL, 0))
+ if (bgp_ensure_nexthop (ri, NULL, 0))
bgp_info_set_flag (rn, ri, BGP_INFO_VALID);
else
{
@@ -3722,7 +3722,7 @@
/* Nexthop reachability check. */
if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK))
{
- if (bgp_find_or_add_nexthop (afi, new, NULL, 0))
+ if (bgp_ensure_nexthop (new, NULL, 0))
bgp_info_set_flag (rn, new, BGP_INFO_VALID);
else
{