X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Frealms.c;h=7abf7f0242dd5ddb7cff01759b2115e38df538c6;hb=afe7358fdedae3032f0cd2d746981f6c11ba141a;hp=f51465862ce8f4332361fb2579330eaf38a38099;hpb=c43099c9aaea0e6f7e3ab8d0db8f5660725ba862;p=freeradius.git diff --git a/src/main/realms.c b/src/main/realms.c index f514658..7abf7f0 100644 --- a/src/main/realms.c +++ b/src/main/realms.c @@ -387,6 +387,10 @@ static CONF_PARSER home_server_config[] = { }; +static void null_free(UNUSED void *data) +{ +} + static int home_server_add(realm_config_t *rc, CONF_SECTION *cs, int pool_type) { const char *name2; @@ -417,6 +421,13 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs, int pool_type) home->name = name2; home->cs = cs; + /* + * For zombie period calculations. We want to count + * zombies from the time when the server starts, instead + * of from 1970. + */ + home->last_packet = time(NULL); + /* * Authentication servers have a default "no_response_fail = 0". * Accounting servers have a default "no_response_fail = 1". @@ -521,7 +532,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; } @@ -776,6 +787,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", null_free, null_free); + return 1; } @@ -1823,6 +1839,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 @@ -2154,11 +2186,6 @@ home_server *home_server_ldb(const char *realmname, * the 'hints' file. */ request->proxy->vps = paircopy(request->packet->vps); - - /* - * Set the source IP address for proxying. - */ - request->proxy->src_ipaddr = found->src_ipaddr; } /*