Commit 4ef09506 authored by Ondřej Zajíček's avatar Ondřej Zajíček

Fixes a problem with BGP protocols and implicit router IDs.

parent d93a43a5
......@@ -31,6 +31,7 @@ list active_proto_list;
static list inactive_proto_list;
static list initial_proto_list;
static list flush_proto_list;
static struct proto *initial_device_proto;
static event *proto_flush_event;
......@@ -248,6 +249,8 @@ protos_postconfig(struct config *c)
DBG("\n");
}
extern struct protocol proto_unix_iface;
static struct proto *
proto_init(struct proto_config *c)
{
......@@ -257,6 +260,9 @@ proto_init(struct proto_config *c)
q->proto_state = PS_DOWN;
q->core_state = FS_HUNGRY;
proto_enqueue(&initial_proto_list, q);
if (p == &proto_unix_iface)
initial_device_proto = q;
add_tail(&proto_list, &q->glob_node);
PD(q, "Initializing%s", q->disabled ? " [disabled]" : "");
return q;
......@@ -413,6 +419,14 @@ protos_commit(struct config *new, struct config *old, int force_reconfig, int ty
DBG("\tdone\n");
DBG("Protocol start\n");
/* Start device protocol first */
if (initial_device_proto)
{
proto_rethink_goal(initial_device_proto);
initial_device_proto = NULL;
}
WALK_LIST_DELSAFE(p, n, initial_proto_list)
proto_rethink_goal(p);
}
......@@ -741,8 +755,6 @@ proto_notify_state(struct proto *p, unsigned ps)
}
}
extern struct protocol proto_unix_iface;
static void
proto_flush_all(void *unused UNUSED)
{
......
......@@ -798,6 +798,10 @@ bgp_start(struct proto *P)
p->startup_timer->hook = bgp_startup_timeout;
p->startup_timer->data = p;
p->local_id = proto_get_router_id(P->cf);
if (p->rr_client)
p->rr_cluster_id = p->cf->rr_cluster_id ? p->cf->rr_cluster_id : p->local_id;
p->remote_id = 0;
p->source_addr = p->cf->source_addr;
......@@ -874,11 +878,8 @@ bgp_init(struct proto_config *C)
p->local_as = c->local_as;
p->remote_as = c->remote_as;
p->is_internal = (c->local_as == c->remote_as);
p->local_id = proto_get_router_id(C);
p->rs_client = c->rs_client;
p->rr_client = c->rr_client;
if (p->rr_client)
p->rr_cluster_id = c->rr_cluster_id ? c->rr_cluster_id : p->local_id;
p->igp_table = get_igp_table(c);
return P;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment