summaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-05-08 13:04:22 +0200
committerMartin Mares <mj@ucw.cz>2000-05-08 13:04:22 +0200
commit79681f4a19d0eca6e40d919a387099f5646f29bc (patch)
tree5756dd4df12b31b9517b406c53b74980238ff1f6 /proto
parent94e935d8a2e02f18e3731624720e8f84be5e9f15 (diff)
downloadbird-79681f4a19d0eca6e40d919a387099f5646f29bc.tar
bird-79681f4a19d0eca6e40d919a387099f5646f29bc.zip
Link the instance to the global BGP list as soon as possible.
Diffstat (limited to 'proto')
-rw-r--r--proto/bgp/bgp.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index ecaa9e3..b7f65d1 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -290,7 +290,8 @@ bgp_incoming_connection(sock *sk, int dummy)
WALK_LIST(n, bgp_list)
{
struct bgp_proto *p = SKIP_BACK(struct bgp_proto, bgp_node, n);
- if (ipa_equal(p->cf->remote_ip, sk->daddr))
+ if (ipa_equal(p->cf->remote_ip, sk->daddr) &&
+ (p->p.proto_state == PS_START || p->p.proto_state == PS_UP))
{
BGP_TRACE(D_EVENTS, "Incoming connection from %I port %d", sk->daddr, sk->dport);
if (p->incoming_conn.sk)
@@ -338,12 +339,6 @@ bgp_start_neighbor(struct bgp_proto *p)
{
p->local_addr = p->neigh->iface->addr->ip;
DBG("BGP: local=%I remote=%I\n", p->local_addr, p->next_hop);
- if (!bgp_counter++)
- init_list(&bgp_list);
- bgp_setup_listen_sk();
- if (!bgp_linpool)
- bgp_linpool = lp_new(&root_pool, 4080);
- add_tail(&bgp_list, &p->bgp_node);
bgp_initiate(p);
}
@@ -400,6 +395,13 @@ bgp_start(struct proto *P)
p->incoming_conn.state = BS_IDLE;
p->startup_delay = 0;
+ if (!bgp_counter++)
+ init_list(&bgp_list);
+ bgp_setup_listen_sk();
+ if (!bgp_linpool)
+ bgp_linpool = lp_new(&root_pool, 4080);
+ add_tail(&bgp_list, &p->bgp_node);
+
/*
* Before attempting to create the connection, we need to lock the
* port, so that are sure we're the only instance attempting to talk