From 7b68857542ac76ff35f5b3770f356e2df673e46d Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Wed, 22 Sep 2010 08:04:22 +0200 Subject: [PATCH] Bootstrap CoA home servers, as they can stand alone. For the next rev, loop over all home servers *first*, before creating the pools. --- src/main/realms.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/main/realms.c b/src/main/realms.c index 97f8acb..208f2e9 100644 --- a/src/main/realms.c +++ b/src/main/realms.c @@ -528,7 +528,7 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs, int pool_type) if (pool_type != home->type) { mismatch: cf_log_err(cf_sectiontoitem(cs), - "Server pool cannot include home server %s of type \"%s\"", + "Home server %s of unexpected type \"%s\"", name2, hs_type); goto error; } @@ -783,6 +783,11 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs, int pool_type) #endif } + /* + * Mark it as already processed + */ + cf_data_add(cs, "home_server", "added", NULL); + return 1; } @@ -1830,6 +1835,22 @@ int realms_init(CONF_SECTION *config) return 0; } } + + /* + * CoA home servers aren't tied to realms. + */ + for (cs = cf_subsection_find_next(config, NULL, "home_server"); + cs != NULL; + cs = cf_subsection_find_next(config, cs, "home_server")) { + /* + * Server was already loaded. + */ + if (cf_data_find(cs, "home_server")) continue; + + if (!home_server_add(rc, cs, HOME_TYPE_COA)) { + return 0; + } + } #endif -- 2.1.4