diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2011-01-26 22:47:10 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2011-01-26 22:47:10 +0300 |
commit | 419de8f6910e4fd5d442068ad5ae41b530169470 (patch) | |
tree | f28b69928983f8c772f40e873ce571379e9fa546 /accel-pppd/extra/shaper_tbf.c | |
parent | b997d19f3b6e3087bffb072dd326c4b5311143b5 (diff) | |
download | accel-ppp-419de8f6910e4fd5d442068ad5ae41b530169470.tar.gz accel-ppp-419de8f6910e4fd5d442068ad5ae41b530169470.zip |
dynamicaly check if radius module loaded (so not more require to rebuild project without RADIUS to switch to chap-secrets)
Diffstat (limited to 'accel-pppd/extra/shaper_tbf.c')
-rw-r--r-- | accel-pppd/extra/shaper_tbf.c | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/accel-pppd/extra/shaper_tbf.c b/accel-pppd/extra/shaper_tbf.c index ddd7e35..cc0ff22 100644 --- a/accel-pppd/extra/shaper_tbf.c +++ b/accel-pppd/extra/shaper_tbf.c @@ -1161,27 +1161,29 @@ static void load_config(void) const char *opt; #ifdef RADIUS - opt = conf_get_opt("tbf", "vendor"); - if (opt) - conf_vendor = parse_vendor_opt(opt); - - opt = conf_get_opt("tbf", "attr"); - if (opt) { - conf_attr_down = parse_attr_opt(opt); - conf_attr_up = parse_attr_opt(opt); - } + if (triton_module_loaded("radius")) { + opt = conf_get_opt("tbf", "vendor"); + if (opt) + conf_vendor = parse_vendor_opt(opt); + + opt = conf_get_opt("tbf", "attr"); + if (opt) { + conf_attr_down = parse_attr_opt(opt); + conf_attr_up = parse_attr_opt(opt); + } - opt = conf_get_opt("tbf", "attr-down"); - if (opt) - conf_attr_down = parse_attr_opt(opt); - - opt = conf_get_opt("tbf", "attr-up"); - if (opt) - conf_attr_up = parse_attr_opt(opt); + opt = conf_get_opt("tbf", "attr-down"); + if (opt) + conf_attr_down = parse_attr_opt(opt); + + opt = conf_get_opt("tbf", "attr-up"); + if (opt) + conf_attr_up = parse_attr_opt(opt); - if (conf_attr_up <= 0 || conf_attr_down <= 0) { - log_emerg("tbf: incorrect attribute(s), tbf disabled...\n"); - return; + if (conf_attr_up <= 0 || conf_attr_down <= 0) { + log_emerg("tbf: incorrect attribute(s), tbf disabled...\n"); + return; + } } #endif @@ -1260,8 +1262,10 @@ static void __init init(void) load_config(); #ifdef RADIUS - triton_event_register_handler(EV_RADIUS_ACCESS_ACCEPT, (triton_event_func)ev_radius_access_accept); - triton_event_register_handler(EV_RADIUS_COA, (triton_event_func)ev_radius_coa); + if (triton_module_loaded("radius")) { + triton_event_register_handler(EV_RADIUS_ACCESS_ACCEPT, (triton_event_func)ev_radius_access_accept); + triton_event_register_handler(EV_RADIUS_COA, (triton_event_func)ev_radius_coa); + } #endif triton_event_register_handler(EV_CTRL_FINISHED, (triton_event_func)ev_ctrl_finished); triton_event_register_handler(EV_SHAPER, (triton_event_func)ev_shaper); |