diff options
author | Martin Mares <mj@ucw.cz> | 1998-10-17 13:05:18 +0200 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 1998-10-17 13:05:18 +0200 |
commit | 47b793064c25c8adcab48cacc018be1675f2448a (patch) | |
tree | c6924c3fb31bf8cd7d650ad8e6c52c395457eca9 /nest/proto.c | |
parent | d92882be9b1bfcc1a8e8a7bd552bdec4831694aa (diff) | |
download | bird-47b793064c25c8adcab48cacc018be1675f2448a.tar bird-47b793064c25c8adcab48cacc018be1675f2448a.zip |
Solve chicken-and-egg problems with protocol startup. We now queue all inactive
protocols and don't send route/interface updates to them and when they come up,
we resend the whole route/interface tables privately.
Removed the "scan interface list after protocol start" work-around.
Diffstat (limited to 'nest/proto.c')
-rw-r--r-- | nest/proto.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/nest/proto.c b/nest/proto.c index 478eb77..6db5a0e 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -15,9 +15,12 @@ #include "lib/resource.h" #include "lib/lists.h" #include "nest/confile.h" +#include "nest/route.h" +#include "nest/iface.h" list protocol_list; list proto_list; +list inactive_proto_list; void * proto_new(struct protocol *pr, unsigned size) @@ -30,7 +33,7 @@ proto_new(struct protocol *pr, unsigned size) p->name = pr->name; p->debug = pr->debug; p->pool = rp_new(&root_pool, pr->name); - add_tail(&proto_list, &p->n); + add_tail(&inactive_proto_list, &p->n); return p; } @@ -40,6 +43,7 @@ protos_preconfig(void) struct protocol *p; init_list(&proto_list); + init_list(&inactive_proto_list); debug("Protocol preconfig\n"); WALK_LIST(p, protocol_list) { @@ -61,18 +65,27 @@ protos_postconfig(void) } } +static void +proto_start(struct proto *p) +{ + rem_node(&p->n); + if (p->start) + p->start(p); + if_feed_baby(p); + rt_feed_baby(p); + add_tail(&proto_list, &p->n); +} void protos_start(void) { - struct proto *p; + struct proto *p, *n; debug("Protocol start\n"); - WALK_LIST(p, proto_list) + WALK_LIST_DELSAFE(p, n, inactive_proto_list) { debug("...%s\n", p->name); - if (p->start) - p->start(p); + proto_start(p); } } @@ -89,6 +102,8 @@ protos_dump_all(void) if (p->dump) p->dump(p); } + WALK_LIST(p, inactive_proto_list) + debug(" inactive %s\n", p->name); } void |