summaryrefslogtreecommitdiffstats
path: root/nest/proto.c
diff options
context:
space:
mode:
Diffstat (limited to 'nest/proto.c')
-rw-r--r--nest/proto.c51
1 files changed, 39 insertions, 12 deletions
diff --git a/nest/proto.c b/nest/proto.c
index 0ad7229..2af077b 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -269,6 +269,7 @@ proto_init(struct proto_config *c)
* @old: old configuration or %NULL if it's boot time config
* @force_reconfig: force restart of all protocols (used for example
* when the router ID changes)
+ * @type: type of reconfiguration (RECONFIG_SOFT or RECONFIG_HARD)
*
* Scan differences between @old and @new configuration and adjust all
* protocol instances to conform to the new configuration.
@@ -281,15 +282,17 @@ proto_init(struct proto_config *c)
* When a protocol exists in the old configuration, but it doesn't in the
* new one, it's shut down and deleted after the shutdown completes.
*
- * When a protocol exists in both configurations, the core decides whether
- * it's possible to reconfigure it dynamically (it checks all the core properties
- * of the protocol and if they match, it asks the reconfigure() hook of the
- * protocol to see if the protocol is able to switch to the new configuration).
- * If it isn't possible, the protocol is shut down and a new instance is started
- * with the new configuration after the shutdown is completed.
+ * When a protocol exists in both configurations, the core decides
+ * whether it's possible to reconfigure it dynamically - it checks all
+ * the core properties of the protocol (changes in filters are ignored
+ * if type is RECONFIG_SOFT) and if they match, it asks the
+ * reconfigure() hook of the protocol to see if the protocol is able
+ * to switch to the new configuration. If it isn't possible, the
+ * protocol is shut down and a new instance is started with the new
+ * configuration after the shutdown is completed.
*/
void
-protos_commit(struct config *new, struct config *old, int force_reconfig)
+protos_commit(struct config *new, struct config *old, int force_reconfig, int type)
{
struct proto_config *oc, *nc;
struct proto *p, *n;
@@ -310,8 +313,8 @@ protos_commit(struct config *new, struct config *old, int force_reconfig)
&& nc->preference == oc->preference
&& nc->disabled == oc->disabled
&& nc->table->table == oc->table->table
- && filter_same(nc->in_filter, oc->in_filter)
- && filter_same(nc->out_filter, oc->out_filter)
+ && ((type == RECONFIG_SOFT) || filter_same(nc->in_filter, oc->in_filter))
+ && ((type == RECONFIG_SOFT) || filter_same(nc->out_filter, oc->out_filter))
&& p->proto_state != PS_DOWN)
{
/* Generic attributes match, try converting them and then ask the protocol */
@@ -512,6 +515,9 @@ static void
proto_fell_down(struct proto *p)
{
DBG("Protocol %s down\n", p->name);
+ ASSERT(p->stats.imp_routes == 0);
+
+ bzero(&p->stats, sizeof(struct proto_stats));
rt_unlock_table(p->table);
proto_rethink_goal(p);
}
@@ -693,9 +699,30 @@ proto_do_show(struct proto *p, int verbose)
buf);
if (verbose)
{
- cli_msg(-1006, "\tPreference: %d", p->preference);
- cli_msg(-1006, "\tInput filter: %s", filter_name(p->in_filter));
- cli_msg(-1006, "\tOutput filter: %s", filter_name(p->out_filter));
+ cli_msg(-1006, " Preference: %d", p->preference);
+ cli_msg(-1006, " Input filter: %s", filter_name(p->in_filter));
+ cli_msg(-1006, " Output filter: %s", filter_name(p->out_filter));
+
+ if (p->proto_state != PS_DOWN)
+ {
+ cli_msg(-1006, " Routes: %u imported, %u exported, %u preferred",
+ p->stats.imp_routes, p->stats.exp_routes, p->stats.pref_routes);
+ cli_msg(-1006, " Route change stats: received rejected filtered ignored accepted");
+ cli_msg(-1006, " Import updates: %10u %10u %10u %10u %10u",
+ p->stats.imp_updates_received, p->stats.imp_updates_invalid,
+ p->stats.imp_updates_filtered, p->stats.imp_updates_ignored,
+ p->stats.imp_updates_accepted);
+ cli_msg(-1006, " Import withdraws: %10u %10u --- %10u %10u",
+ p->stats.imp_withdraws_received, p->stats.imp_withdraws_invalid,
+ p->stats.imp_withdraws_ignored, p->stats.imp_withdraws_accepted);
+ cli_msg(-1006, " Export updates: %10u %10u %10u --- %10u",
+ p->stats.exp_updates_received, p->stats.exp_updates_rejected,
+ p->stats.exp_updates_filtered, p->stats.exp_updates_accepted);
+ cli_msg(-1006, " Export withdraws: %10u --- --- --- %10u",
+ p->stats.exp_withdraws_received, p->stats.exp_withdraws_accepted);
+ }
+
+ cli_msg(-1006, "");
}
}