diff options
| author | Guillaume Nault <g.nault@alphalink.fr> | 2016-05-09 21:41:00 +0200 |
|---|---|---|
| committer | Dmitry Kozlov <xeb@mail.ru> | 2016-05-11 13:26:02 +0300 |
| commit | f21ca06be19609f12584ddc96620d21b9a7b32a5 (patch) | |
| tree | 5d9eaa5b6b97f80fbc3e09fc0740e5edba83a616 /accel-pppd/iprange.c | |
| parent | 448d99b34e18c94cabe9c41e12fd678212acf103 (diff) | |
| download | accel-ppp-f21ca06be19609f12584ddc96620d21b9a7b32a5.tar.gz accel-ppp-f21ca06be19609f12584ddc96620d21b9a7b32a5.zip | |
iprange: don't warn about empty iprange config if no modules depend on it
Move warning messages to PPTP and L2TP modules. No other module
actually uses iprange, so it's perfectly valid to disable it, or at
least to not configure any range, when PPTP and L2TP aren't used.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd/iprange.c')
| -rw-r--r-- | accel-pppd/iprange.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/accel-pppd/iprange.c b/accel-pppd/iprange.c index 6281a74..d2b896f 100644 --- a/accel-pppd/iprange.c +++ b/accel-pppd/iprange.c @@ -168,11 +168,8 @@ static bool load_ranges(struct list_head *list, const char *conf_sect) struct conf_option_t *opt; struct iprange_t *r; - if (!s) { - log_emerg("iprange: section '%s' not found in config file, pptp and l2tp probably will not work...\n", conf_sect); - + if (!s) return false; - } list_for_each_entry(opt, &s->items, entry) { /* Ignore parsing errors, parse_iprange() already logs suitable @@ -182,7 +179,6 @@ static bool load_ranges(struct list_head *list, const char *conf_sect) continue; if (!r) { - log_warn("iprange: iprange module disabled, improper IP address assignment may cause kernel soft lockup!\n"); free_ranges(list); return true; @@ -207,6 +203,25 @@ static int check_range(struct list_head *list, in_addr_t ipaddr) return -1; } +enum iprange_status __export iprange_check_activation(void) +{ + bool disabled; + bool empty; + + pthread_mutex_lock(&iprange_lock); + disabled = conf_disable; + empty = list_empty(&client_ranges); + pthread_mutex_unlock(&iprange_lock); + + if (disabled) + return IPRANGE_DISABLED; + + if (empty) + return IPRANGE_NO_RANGE; + + return IPRANGE_ACTIVE; +} + int __export iprange_client_check(in_addr_t ipaddr) { int res; @@ -241,7 +256,7 @@ static void iprange_load_config(void *data) LIST_HEAD(old_ranges); bool disable; - disable = load_ranges(&new_ranges, "client-ip-range"); + disable = load_ranges(&new_ranges, IPRANGE_CONF_SECTION); pthread_mutex_lock(&iprange_lock); list_replace(&client_ranges, &old_ranges); |
