summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_attr.c2
-rw-r--r--bgpd/bgp_fsm.c4
-rw-r--r--bgpd/bgp_nexthop.h1
-rw-r--r--bgpd/bgp_nht.c7
-rw-r--r--bgpd/bgp_nht.h5
-rw-r--r--bgpd/bgp_route.c12
6 files changed, 17 insertions, 14 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index e0c5cc8937..9ae46dbb3b 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -2249,7 +2249,7 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
size_t mpattrlen_pos = 0;
if (! bgp)
- bgp = bgp_get_default ();
+ bgp = peer->bgp;
/* Remember current pointer. */
cp = stream_get_endp (s);
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 5683c15444..19bd59f5bf 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -1267,8 +1267,8 @@ bgp_start (struct peer *peer)
if ((peer->ttl == 1) || (peer->gtsm_hops == 1))
connected = 1;
- bgp_find_or_add_nexthop(family2afi(peer->su.sa.sa_family), NULL, peer,
- connected);
+ bgp_find_or_add_nexthop(peer->bgp, family2afi(peer->su.sa.sa_family),
+ NULL, peer, connected);
status = bgp_connect (peer);
switch (status)
diff --git a/bgpd/bgp_nexthop.h b/bgpd/bgp_nexthop.h
index 4d582465f7..cee967303f 100644
--- a/bgpd/bgp_nexthop.h
+++ b/bgpd/bgp_nexthop.h
@@ -52,6 +52,7 @@ struct bgp_nexthop_cache
void *nht_info; /* In BGP, peer session */
LIST_HEAD(path_list, bgp_info) paths;
unsigned int path_count;
+ struct bgp *bgp;
};
extern int bgp_nexthop_lookup (afi_t, struct peer *peer, struct bgp_info *,
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index df479bf25a..c460f0ee68 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -89,8 +89,8 @@ bgp_unlink_nexthop (struct bgp_info *path)
}
int
-bgp_find_or_add_nexthop (afi_t afi, struct bgp_info *ri, struct peer *peer,
- int connected)
+bgp_find_or_add_nexthop (struct bgp *bgp, afi_t afi, struct bgp_info *ri,
+ struct peer *peer, int connected)
{
struct bgp_node *rn;
struct bgp_nexthop_cache *bnc;
@@ -124,6 +124,7 @@ bgp_find_or_add_nexthop (afi_t afi, struct bgp_info *ri, struct peer *peer,
bnc = bnc_new();
rn->info = bnc;
bnc->node = rn;
+ bnc->bgp = bgp;
bgp_lock_node(rn);
if (connected)
SET_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED);
@@ -432,7 +433,7 @@ evaluate_paths (struct bgp_nexthop_cache *bnc)
{
struct bgp_node *rn;
struct bgp_info *path;
- struct bgp *bgp = bgp_get_default();
+ struct bgp *bgp = bnc->bgp;
int afi;
struct peer *peer = (struct peer *)bnc->nht_info;
diff --git a/bgpd/bgp_nht.h b/bgpd/bgp_nht.h
index 0897d43a06..2c779802b5 100644
--- a/bgpd/bgp_nht.h
+++ b/bgpd/bgp_nht.h
@@ -40,13 +40,14 @@ extern int bgp_find_nexthop(struct bgp_info *p, int connected);
* object. If not found, create a new object and register with ZEBRA for
* nexthop notification.
* ARGUMENTS:
+ * bgp - BGP instance
* a - afi: AFI_IP or AF_IP6
* p - path for which the nexthop object is being looked up
* peer - The BGP peer associated with this NHT
* connected - True if NH MUST be a connected route
*/
-extern int bgp_find_or_add_nexthop(afi_t a, struct bgp_info *p,
- struct peer *peer, int connected);
+extern int bgp_find_or_add_nexthop(struct bgp *bgp, afi_t a,
+ struct bgp_info *p, struct peer *peer, int connected);
/**
* bgp_unlink_nexthop() - Unlink the nexthop object from the path structure.
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index f37f3179ae..7e0c604645 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -3052,7 +3052,7 @@ bgp_update_main (struct peer *peer, struct prefix *p, u_int32_t addpath_id,
else
connected = 0;
- if (bgp_find_or_add_nexthop (afi, ri, NULL, connected))
+ if (bgp_find_or_add_nexthop (bgp, afi, ri, NULL, connected))
bgp_info_set_flag (rn, ri, BGP_INFO_VALID);
else
{
@@ -3109,7 +3109,7 @@ bgp_update_main (struct peer *peer, struct prefix *p, u_int32_t addpath_id,
else
connected = 0;
- if (bgp_find_or_add_nexthop (afi, new, NULL, connected))
+ if (bgp_find_or_add_nexthop (bgp, afi, new, NULL, connected))
bgp_info_set_flag (rn, new, BGP_INFO_VALID);
else
{
@@ -4158,7 +4158,7 @@ bgp_static_update_rsclient (struct peer *rsclient, struct prefix *p,
/* Nexthop reachability check. */
if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK))
{
- if (bgp_find_or_add_nexthop (afi, ri, NULL, 0))
+ if (bgp_find_or_add_nexthop (bgp, afi, ri, NULL, 0))
bgp_info_set_flag (rn, ri, BGP_INFO_VALID);
else
{
@@ -4187,7 +4187,7 @@ bgp_static_update_rsclient (struct peer *rsclient, struct prefix *p,
/* Nexthop reachability check. */
if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK))
{
- if (bgp_find_or_add_nexthop (afi, new, NULL, 0))
+ if (bgp_find_or_add_nexthop (bgp, afi, new, NULL, 0))
bgp_info_set_flag (rn, new, BGP_INFO_VALID);
else
{
@@ -4307,7 +4307,7 @@ bgp_static_update_main (struct bgp *bgp, struct prefix *p,
/* Nexthop reachability check. */
if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK))
{
- if (bgp_find_or_add_nexthop (afi, ri, NULL, 0))
+ if (bgp_find_or_add_nexthop (bgp, afi, ri, NULL, 0))
bgp_info_set_flag (rn, ri, BGP_INFO_VALID);
else
{
@@ -4337,7 +4337,7 @@ bgp_static_update_main (struct bgp *bgp, struct prefix *p,
/* Nexthop reachability check. */
if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK))
{
- if (bgp_find_or_add_nexthop (afi, new, NULL, 0))
+ if (bgp_find_or_add_nexthop (bgp, afi, new, NULL, 0))
bgp_info_set_flag (rn, new, BGP_INFO_VALID);
else
{