bgpd: simplify ebgp-multihop and ttl-security handling
Change to track configured value in ->ttl and ->gtsm_hops;
not the value set to sockopt. Instead, setting of socket's ttl
and minttl options are now merged to one function which calculates
it on demand. This greatly simplifies the code.
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 4cb6c14..010fd4d 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -2339,7 +2339,7 @@
/* Nexthop reachability check. */
if ((afi == AFI_IP || afi == AFI_IP6) && safi == SAFI_UNICAST)
{
- if (peer->sort == BGP_PEER_EBGP && peer->ttl == 1 &&
+ if (peer->sort == BGP_PEER_EBGP && peer_ttl (peer) == 1 &&
! CHECK_FLAG (peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))
connected = 1;
else
@@ -2391,7 +2391,7 @@
/* Nexthop reachability check. */
if ((afi == AFI_IP || afi == AFI_IP6) && safi == SAFI_UNICAST)
{
- if (peer->sort == BGP_PEER_EBGP && peer->ttl == 1 &&
+ if (peer->sort == BGP_PEER_EBGP && peer_ttl (peer) == 1 &&
! CHECK_FLAG (peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))
connected = 1;
else