提交 c2d18621 authored 作者: Chris Parker's avatar Chris Parker

Updated module to handle new radius_deadtime option in radiusclient

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7792 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 8969d1a4
...@@ -40,6 +40,7 @@ SWITCH_MODULE_DEFINITION(mod_radius_cdr, mod_radius_cdr_load, NULL, NULL); ...@@ -40,6 +40,7 @@ SWITCH_MODULE_DEFINITION(mod_radius_cdr, mod_radius_cdr_load, NULL, NULL);
static char cf[] = "mod_radius_cdr.conf"; static char cf[] = "mod_radius_cdr.conf";
static char my_dictionary[PATH_MAX]; static char my_dictionary[PATH_MAX];
static char * my_deadtime; /* 0 */
static char * my_timeout; /* 5 */ static char * my_timeout; /* 5 */
static char * my_retries; /* 3 */ static char * my_retries; /* 3 */
static char my_servers[SERVER_MAX][255]; static char my_servers[SERVER_MAX][255];
...@@ -58,7 +59,7 @@ static rc_handle * my_radius_init(void) ...@@ -58,7 +59,7 @@ static rc_handle * my_radius_init(void)
rad_config = rc_config_init(rad_config); rad_config = rc_config_init(rad_config);
if (rad_config == NULL) { if (rad_config == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Error initializing radius config!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error initializing radius config!\n");
rc_destroy(rad_config); rc_destroy(rad_config);
return NULL; return NULL;
} }
...@@ -66,14 +67,14 @@ static rc_handle * my_radius_init(void) ...@@ -66,14 +67,14 @@ static rc_handle * my_radius_init(void)
/* Some hardcoded ( for now ) defaults needed to initialize radius */ /* Some hardcoded ( for now ) defaults needed to initialize radius */
if (rc_add_config(rad_config, "auth_order", "radius", "mod_radius_cdr.c", 0) != 0) { if (rc_add_config(rad_config, "auth_order", "radius", "mod_radius_cdr.c", 0) != 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"[mod_radius_cdr] failed setting auth_order = radius\n"); "setting auth_order = radius failed\n");
rc_destroy(rad_config); rc_destroy(rad_config);
return NULL; return NULL;
} }
if (rc_add_config(rad_config, "seqfile", "/var/run/radius.seq", "mod_radius_cdr.c", 0) != 0) { if (rc_add_config(rad_config, "seqfile", "/var/run/radius.seq", "mod_radius_cdr.c", 0) != 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"failed setting seqfile = /var/run/radius.seq\n"); "setting seqfile = /var/run/radius.seq failed\n");
rc_destroy(rad_config); rc_destroy(rad_config);
return NULL; return NULL;
} }
...@@ -96,16 +97,23 @@ static rc_handle * my_radius_init(void) ...@@ -96,16 +97,23 @@ static rc_handle * my_radius_init(void)
return NULL; return NULL;
} }
if (rc_add_config(rad_config, "radius_deadtime", my_deadtime, cf, 0) != 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"setting radius_deadtime = %s failed\n", my_deadtime);
rc_destroy(rad_config);
return NULL;
}
if (rc_add_config(rad_config, "radius_timeout", my_timeout, cf, 0) != 0) { if (rc_add_config(rad_config, "radius_timeout", my_timeout, cf, 0) != 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"failed setting radius_timeout = %s failed\n", my_timeout); "setting radius_timeout = %s failed\n", my_timeout);
rc_destroy(rad_config); rc_destroy(rad_config);
return NULL; return NULL;
} }
if (rc_add_config(rad_config, "radius_retries", my_retries, cf, 0) != 0) { if (rc_add_config(rad_config, "radius_retries", my_retries, cf, 0) != 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"failed setting radius_retries = %s failed\n", my_retries); "setting radius_retries = %s failed\n", my_retries);
rc_destroy(rad_config); rc_destroy(rad_config);
return NULL; return NULL;
} }
...@@ -113,7 +121,7 @@ static rc_handle * my_radius_init(void) ...@@ -113,7 +121,7 @@ static rc_handle * my_radius_init(void)
/* Read the dictionary file(s) */ /* Read the dictionary file(s) */
if (rc_read_dictionary(rad_config, rc_conf_str(rad_config, "dictionary")) != 0) { if (rc_read_dictionary(rad_config, rc_conf_str(rad_config, "dictionary")) != 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"failed reading dictionary file(s): %s\n", my_dictionary); "reading dictionary file(s): %s\n", my_dictionary);
rc_destroy(rad_config); rc_destroy(rad_config);
return NULL; return NULL;
} }
......
...@@ -6,6 +6,18 @@ ...@@ -6,6 +6,18 @@
<param name="radius_retries" value="3"/> <param name="radius_retries" value="3"/>
<!-- number of seconds to wait between retries --> <!-- number of seconds to wait between retries -->
<param name="radius_timeout" value="5"/> <param name="radius_timeout" value="5"/>
<!-- The length of time in seconds that we skip a nonresponsive RADIUS
server for transaction requests. Server(s) being in the "dead" state
are tried only after all other non-dead servers have been tried and
failed or timeouted. The deadtime interval starts when the server
does not respond to an authentication/accounting request transmissions.
When the interval expires, the "dead" server would be re-tried again,
and if it's still down then it will be considered "dead" for another
such interval and so on. This option is no-op if there is only one
server in the list. Set to 0 in order to disable the feature. -->
<param name="radius_deadtime" value="0"/>
<!-- accounting servers, up to 8 allowed --> <!-- accounting servers, up to 8 allowed -->
<!-- value is "host:port:secret", port is optional --> <!-- value is "host:port:secret", port is optional -->
<!-- use IP ADDRESSES, not hostnames --> <!-- use IP ADDRESSES, not hostnames -->
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论