summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2010-02-06 22:57:51 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2010-02-06 22:57:51 +0100
commit76b53a4e207696c535a45f4358a8e047ca936e45 (patch)
tree811a773920c3859f6e1c8c76cdf33ca30f993102
parentebae4770c949de41c64c9efbeaaef44adfb25790 (diff)
downloadbird-76b53a4e207696c535a45f4358a8e047ca936e45.tar
bird-76b53a4e207696c535a45f4358a8e047ca936e45.zip
Adds some log messages related to configure.
Also fixes a bug in the previous patch.
-rw-r--r--conf/conf.c12
-rw-r--r--nest/proto.c29
-rw-r--r--sysdep/unix/main.c3
3 files changed, 34 insertions, 10 deletions
diff --git a/conf/conf.c b/conf/conf.c
index bc0715a..58eb10a 100644
--- a/conf/conf.c
+++ b/conf/conf.c
@@ -57,7 +57,7 @@ static jmp_buf conf_jmpbuf;
struct config *config, *new_config, *old_config, *future_config;
static event *config_event;
-int shutting_down;
+int shutting_down, future_type;
bird_clock_t boot_time;
/**
@@ -201,6 +201,7 @@ config_do_commit(struct config *c, int type)
config = new_config = c;
if (old_config)
old_config->obstacle_count++;
+
DBG("sysdep_commit\n");
force_restart = sysdep_commit(c, old_config);
DBG("global_commit\n");
@@ -238,8 +239,8 @@ config_done(void *unused UNUSED)
break;
c = future_config;
future_config = NULL;
- log(L_INFO "Switching to queued configuration...");
- if (!config_do_commit(c, RECONFIG_HARD))
+ log(L_INFO "Reconfiguring to queued configuration");
+ if (!config_do_commit(c, future_type))
break;
}
}
@@ -290,8 +291,13 @@ config_commit(struct config *c, int type)
else
log(L_INFO "Queued new configuration");
future_config = c;
+ future_type = type;
return CONF_QUEUED;
}
+
+ if (!shutting_down)
+ log(L_INFO "Reconfiguring");
+
if (config_do_commit(c, type))
{
config_done(NULL);
diff --git a/nest/proto.c b/nest/proto.c
index 9ac05c1..e19c394 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -280,7 +280,7 @@ proto_reconfigure(struct proto *p, struct proto_config *oc, struct proto_config
if ((nc->protocol != oc->protocol) ||
(nc->disabled != oc->disabled) ||
(nc->table->table != oc->table->table) ||
- (proto_get_router_id(nc) == proto_get_router_id(oc)))
+ (proto_get_router_id(nc) != proto_get_router_id(oc)))
return 0;
int import_changed = (type != RECONFIG_SOFT) && ! filter_same(nc->in_filter, oc->in_filter);
@@ -312,10 +312,14 @@ proto_reconfigure(struct proto *p, struct proto_config *oc, struct proto_config
p->in_filter = nc->in_filter;
p->out_filter = nc->out_filter;
+ if (import_changed || export_changed)
+ log(L_INFO "Reloading protocol %s", p->name);
+
if (import_changed && ! p->reload_routes(p))
{
/* Now, the protocol is reconfigured. But route reload failed
and we have to do regular protocol restart. */
+ log(L_INFO "Restarting protocol %s", p->name);
p->disabled = 1;
proto_rethink_goal(p);
p->disabled = 0;
@@ -382,13 +386,20 @@ protos_commit(struct config *new, struct config *old, int force_reconfig, int ty
continue;
/* Unsuccessful, we will restart it */
- DBG("\t%s: power cycling\n", oc->name);
+ if (!p->disabled && !nc->disabled)
+ log(L_INFO "Restarting protocol %s", p->name);
+ else if (p->disabled && !nc->disabled)
+ log(L_INFO "Enabling protocol %s", p->name);
+ else if (!p->disabled && nc->disabled)
+ log(L_INFO "Disabling protocol %s", p->name);
+
PD(p, "Restarting");
p->cf_new = nc;
}
else
{
- DBG("\t%s: deleting\n", oc->name);
+ if (!shutting_down)
+ log(L_INFO "Removing protocol %s", p->name);
PD(p, "Unconfigured");
p->cf_new = NULL;
}
@@ -401,7 +412,8 @@ protos_commit(struct config *new, struct config *old, int force_reconfig, int ty
WALK_LIST(nc, new->protos)
if (!nc->proto)
{
- DBG("\t%s: adding\n", nc->name);
+ if (old_config) /* Not a first-time configuration */
+ log(L_INFO "Adding protocol %s", nc->name);
proto_init(nc);
}
DBG("\tdone\n");
@@ -878,9 +890,10 @@ proto_xxable(char *pattern, int xx)
cli_msg(-8, "%s: already disabled", p->name);
else
{
- cli_msg(-9, "%s: disabled", p->name);
+ log(L_INFO "Disabling protocol %s", p->name);
p->disabled = 1;
proto_rethink_goal(p);
+ cli_msg(-9, "%s: disabled", p->name);
}
break;
@@ -889,9 +902,10 @@ proto_xxable(char *pattern, int xx)
cli_msg(-10, "%s: already enabled", p->name);
else
{
- cli_msg(-11, "%s: enabled", p->name);
+ log(L_INFO "Enabling protocol %s", p->name);
p->disabled = 0;
proto_rethink_goal(p);
+ cli_msg(-11, "%s: enabled", p->name);
}
break;
@@ -900,6 +914,7 @@ proto_xxable(char *pattern, int xx)
cli_msg(-8, "%s: already disabled", p->name);
else
{
+ log(L_INFO "Restarting protocol %s", p->name);
p->disabled = 1;
proto_rethink_goal(p);
p->disabled = 0;
@@ -921,6 +936,8 @@ proto_xxable(char *pattern, int xx)
if (p->proto_state != PS_UP)
break;
+ log(L_INFO "Reloading protocol %s", p->name);
+
/* re-importing routes */
if (xx != XX_RELOAD_OUT)
if (! (p->reload_routes && p->reload_routes(p)))
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
index 6107b22..7a1ef28 100644
--- a/sysdep/unix/main.c
+++ b/sysdep/unix/main.c
@@ -314,7 +314,7 @@ void
sysdep_shutdown_done(void)
{
unlink(path_control_socket);
- log_msg(L_FATAL "System shutdown completed");
+ log_msg(L_FATAL "Shutdown completed");
exit(0);
}
@@ -476,6 +476,7 @@ main(int argc, char **argv)
async_dump_flag = 1;
#endif
+ log(L_INFO "Started");
DBG("Entering I/O loop.\n");
io_loop();