From bf1aec970e9ac0600266fe7a045847a62f18ac3b Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Fri, 19 Jun 2009 23:49:34 +0200 Subject: Adds support for soft reconfiguration. --- nest/proto.c | 21 ++++++++++++--------- nest/protocol.h | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'nest') diff --git a/nest/proto.c b/nest/proto.c index ef0587b..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 */ diff --git a/nest/protocol.h b/nest/protocol.h index eee3a74..0f9d59d 100644 --- a/nest/protocol.h +++ b/nest/protocol.h @@ -55,7 +55,7 @@ void protos_build(void); void proto_build(struct protocol *); void protos_preconfig(struct config *); void protos_postconfig(struct config *); -void protos_commit(struct config *new, struct config *old, int force_restart); +void protos_commit(struct config *new, struct config *old, int force_restart, int type); void protos_dump_all(void); #define GA_UNKNOWN 0 /* Attribute not recognized */ -- cgit v1.2.3