]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Create peer_sort_lookup()
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 12 Feb 2020 18:26:19 +0000 (13:26 -0500)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Thu, 30 Jul 2020 20:39:41 +0000 (23:39 +0300)
The act of peer_sort() being called always set this value
even when we are just looking it up.  We need to seperate
out the idea of lookup from set.

For those places that this is immediately obvious that
this is a lookup switch over to using this function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_network.c
bgpd/bgp_route.c
bgpd/bgpd.c
bgpd/bgpd.h

index 4031d2dfde40301a67315ce252f310b7f7d63a08..a476c3a1182acd7e6ee9dfc00de0e849a2a8ba0d 100644 (file)
@@ -203,7 +203,7 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock)
        int ret = 0;
 
        /* In case of peer is EBGP, we should set TTL for this connection.  */
-       if (!peer->gtsm_hops && (peer_sort(peer) == BGP_PEER_EBGP)) {
+       if (!peer->gtsm_hops && (peer_sort_lookup(peer) == BGP_PEER_EBGP)) {
                ret = sockopt_ttl(peer->su.sa.sa_family, bgp_sock, peer->ttl);
                if (ret) {
                        flog_err(
index aa0e4934db9ed7d0d06de5718331a5798515d99d..e3e5a0a96d6e4a7116c53334e2ad069b86b30411 100644 (file)
@@ -833,8 +833,8 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
           pair (newm, existm) with the cluster list length. Prefer the
           path with smaller cluster list length.                       */
        if (newm == existm) {
-               if (peer_sort(new->peer) == BGP_PEER_IBGP
-                   && peer_sort(exist->peer) == BGP_PEER_IBGP
+               if (peer_sort_lookup(new->peer) == BGP_PEER_IBGP
+                   && peer_sort_lookup(exist->peer) == BGP_PEER_IBGP
                    && (mpath_cfg == NULL
                        || CHECK_FLAG(
                                   mpath_cfg->ibgp_flags,
index 9b0e81491a89bebc63f785bf963c2ebf93b744c8..bbe3adab5bea21193b9b26d2c711ded44ff8e728 100644 (file)
@@ -978,6 +978,11 @@ bgp_peer_sort_t peer_sort(struct peer *peer)
        return peer->sort;
 }
 
+bgp_peer_sort_t peer_sort_lookup(struct peer *peer)
+{
+       return peer->sort;
+}
+
 static void peer_free(struct peer *peer)
 {
        afi_t afi;
index 49e2a537fd7daa67d6cc4f50bbb01d18d3381086..cde4c63951651603d1d6ea7650afd768626d40f6 100644 (file)
@@ -1588,6 +1588,8 @@ extern struct peer *peer_unlock_with_caller(const char *, struct peer *);
 #define peer_lock(B) peer_lock_with_caller(__FUNCTION__, (B))
 
 extern bgp_peer_sort_t peer_sort(struct peer *peer);
+extern bgp_peer_sort_t peer_sort_lookup(struct peer *peer);
+
 extern int peer_active(struct peer *);
 extern int peer_active_nego(struct peer *);
 extern void bgp_recalculate_all_bestpaths(struct bgp *bgp);