Killed protocol->priority. Protocol startup should be clean and hack-free now.
It seems everything still works (except for disable/enable/restart which hangs sometimes, but it's another story).
This commit is contained in:
parent
54aaa89ada
commit
3ea1ba632b
5 changed files with 3 additions and 25 deletions
3
TODO
3
TODO
|
@ -27,10 +27,9 @@ Core
|
||||||
- config: when parsing prefix, check zero bits
|
- config: when parsing prefix, check zero bits
|
||||||
- config: useless rules when protocols disabled
|
- config: useless rules when protocols disabled
|
||||||
- config: better datetime format
|
- config: better datetime format
|
||||||
|
- config: long disable/enable/restart sequences hang
|
||||||
|
|
||||||
- krt: rescan interfaces when route addition fails?
|
- krt: rescan interfaces when route addition fails?
|
||||||
- krt: does PERSIST mode have any sense if kernel syncer is shut down as last?
|
|
||||||
- krt: check behaviour wrt. reconfiguration of routing tables
|
|
||||||
|
|
||||||
- tagging of external routes?
|
- tagging of external routes?
|
||||||
|
|
||||||
|
|
21
nest/proto.c
21
nest/proto.c
|
@ -49,17 +49,7 @@ static void proto_rethink_goal(struct proto *p);
|
||||||
static void
|
static void
|
||||||
proto_enqueue(list *l, struct proto *p)
|
proto_enqueue(list *l, struct proto *p)
|
||||||
{
|
{
|
||||||
int pri = p->proto->priority;
|
add_tail(l, &p->n);
|
||||||
|
|
||||||
if (!pri)
|
|
||||||
add_tail(l, &p->n);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
struct proto *q = HEAD(*l);
|
|
||||||
while (q->n.next && q->proto->priority >= pri)
|
|
||||||
q = (struct proto *) q->n.next;
|
|
||||||
insert_node(&p->n, q->n.prev);
|
|
||||||
}
|
|
||||||
p->last_state_change = now;
|
p->last_state_change = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +314,7 @@ protos_dump_all(void)
|
||||||
|
|
||||||
WALK_LIST(p, active_proto_list)
|
WALK_LIST(p, active_proto_list)
|
||||||
{
|
{
|
||||||
debug(" protocol %s (pri=%d): state %s/%s\n", p->name, p->proto->priority,
|
debug(" protocol %s state %s/%s\n", p->name,
|
||||||
p_states[p->proto_state], c_states[p->core_state]);
|
p_states[p->proto_state], c_states[p->core_state]);
|
||||||
if (p->in_filter)
|
if (p->in_filter)
|
||||||
debug("\tInput filter: %s\n", filter_name(p->in_filter));
|
debug("\tInput filter: %s\n", filter_name(p->in_filter));
|
||||||
|
@ -424,13 +414,6 @@ proto_notify_state(struct proto *p, unsigned ps)
|
||||||
ASSERT(ops == PS_DOWN || ops == PS_START);
|
ASSERT(ops == PS_DOWN || ops == PS_START);
|
||||||
ASSERT(cs == FS_HUNGRY);
|
ASSERT(cs == FS_HUNGRY);
|
||||||
DBG("%s: Scheduling meal\n", p->name);
|
DBG("%s: Scheduling meal\n", p->name);
|
||||||
if (p->proto->priority) /* FIXME: Terrible hack to get synchronous device/kernel startup! */
|
|
||||||
{
|
|
||||||
p->proto_state = ps;
|
|
||||||
p->core_state = FS_FEEDING;
|
|
||||||
proto_feed(p);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
cs = FS_FEEDING;
|
cs = FS_FEEDING;
|
||||||
p->attn->hook = proto_feed;
|
p->attn->hook = proto_feed;
|
||||||
ev_schedule(p->attn);
|
ev_schedule(p->attn);
|
||||||
|
|
|
@ -35,7 +35,6 @@ struct protocol {
|
||||||
char *name;
|
char *name;
|
||||||
char *template; /* Template for automatic generation of names */
|
char *template; /* Template for automatic generation of names */
|
||||||
unsigned debug; /* Default debugging flags */
|
unsigned debug; /* Default debugging flags */
|
||||||
int priority; /* Protocol priority (usually 0) */
|
|
||||||
int name_counter; /* Counter for automatic name generation */
|
int name_counter; /* Counter for automatic name generation */
|
||||||
|
|
||||||
void (*preconfig)(struct protocol *, struct config *); /* Just before configuring */
|
void (*preconfig)(struct protocol *, struct config *); /* Just before configuring */
|
||||||
|
|
|
@ -89,7 +89,6 @@ dev_reconfigure(struct proto *p, struct proto_config *new)
|
||||||
struct protocol proto_device = {
|
struct protocol proto_device = {
|
||||||
name: "Direct",
|
name: "Direct",
|
||||||
template: "direct%d",
|
template: "direct%d",
|
||||||
priority: 90,
|
|
||||||
init: dev_init,
|
init: dev_init,
|
||||||
reconfigure: dev_reconfigure
|
reconfigure: dev_reconfigure
|
||||||
};
|
};
|
||||||
|
|
|
@ -161,7 +161,6 @@ kif_reconfigure(struct proto *p, struct proto_config *new)
|
||||||
struct protocol proto_unix_iface = {
|
struct protocol proto_unix_iface = {
|
||||||
name: "Device",
|
name: "Device",
|
||||||
template: "device%d",
|
template: "device%d",
|
||||||
priority: 100,
|
|
||||||
preconfig: kif_preconfig,
|
preconfig: kif_preconfig,
|
||||||
init: kif_init,
|
init: kif_init,
|
||||||
start: kif_start,
|
start: kif_start,
|
||||||
|
@ -801,7 +800,6 @@ krt_reconfigure(struct proto *p, struct proto_config *new)
|
||||||
struct protocol proto_unix_kernel = {
|
struct protocol proto_unix_kernel = {
|
||||||
name: "Kernel",
|
name: "Kernel",
|
||||||
template: "kernel%d",
|
template: "kernel%d",
|
||||||
priority: 80,
|
|
||||||
preconfig: krt_preconfig,
|
preconfig: krt_preconfig,
|
||||||
postconfig: krt_postconfig,
|
postconfig: krt_postconfig,
|
||||||
init: krt_init,
|
init: krt_init,
|
||||||
|
|
Loading…
Reference in a new issue