DBG("protos_commit:\n");
if (old)
{
+ /* First, add dynamic protocols to the new config */
WALK_LIST(oc, old->protos)
{
- p = oc->proto;
- sym = cf_find_symbol(new, oc->name);
-
- /* Handle dynamic protocols */
- if (!sym && oc->parent && !new->shutdown)
+ if (oc->parent && !cf_find_symbol(new, oc->name) && !new->shutdown)
{
struct symbol *parsym = cf_find_symbol(new, oc->parent->name);
if (parsym && parsym->class == SYM_PROTO)
cfg_mem = NULL;
}
}
+ }
+
+ WALK_LIST(oc, old->protos)
+ {
+ p = oc->proto;
+ sym = cf_find_symbol(new, oc->name);
if (sym && sym->class == SYM_PROTO && !new->shutdown)
{
bsprintf(fmt, "%s%%0%dd", pp->cf->dynamic_name, pp->cf->dynamic_name_digits);
+ /* The parent protocol must not be not-yet-reconfigured, otherwise we would
+ mix-up different generations of configuration */
+ ASSERT(pp->p.cf->global == config);
+
/* This is hack, we would like to share config, but we need to copy it now */
new_config = config;
cfg_mem = config->mem;