summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2020-02-12 13:26:19 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2020-02-12 14:45:06 -0500
commitbf0d28dcf70f1418c860c9f3ef0124ba071566b0 (patch)
treefb6572395cbfb44b5d4c4de45ac05c5b4f53e462
parentefa618369a8cd05c245fae58e125a3451c098b66 (diff)
bgpd: Create peer_sort_lookup()
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>
-rw-r--r--bgpd/bgp_network.c2
-rw-r--r--bgpd/bgp_route.c4
-rw-r--r--bgpd/bgpd.c5
-rw-r--r--bgpd/bgpd.h2
4 files changed, 10 insertions, 3 deletions
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index 8b585704d8..8759a88444 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -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(
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 34580788bd..f65e12ed90 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -914,8 +914,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,
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 34581b66fc..39d280f130 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -961,6 +961,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;
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 548dfe4683..0467f6c1a8 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -1731,6 +1731,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);