diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-07-07 16:14:54 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-07-07 16:14:54 +0400 |
commit | 0ae39b3ccab604fadaa28918dc5ff717c73f5bd2 (patch) | |
tree | 5b397655afaea867b8df9eab45474d12c3f7eb39 /accel-pppd/iprange.c | |
parent | 8f09e27527fd88189a66ddf425d30a9f244199bc (diff) | |
download | accel-ppp-0ae39b3ccab604fadaa28918dc5ff717c73f5bd2.tar.gz accel-ppp-0ae39b3ccab604fadaa28918dc5ff717c73f5bd2.zip |
iprange: accept network with null mask (which actually disables iprange module)
Diffstat (limited to 'accel-pppd/iprange.c')
-rw-r--r-- | accel-pppd/iprange.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/accel-pppd/iprange.c b/accel-pppd/iprange.c index 315a572f..c3bf2fec 100644 --- a/accel-pppd/iprange.c +++ b/accel-pppd/iprange.c @@ -42,7 +42,7 @@ static struct iprange_t *parse1(const char *str) return NULL; if (f4 > 255) return NULL; - if (m == 0 || m > 32) + if (m > 32) return NULL; r = _malloc(sizeof(*r)); @@ -94,11 +94,8 @@ static void load_ranges(struct list_head *list, const char *conf_sect) } list_for_each_entry(opt, &s->items, entry) { - if (!strcmp(opt->name, "disable")) { - conf_disable = 1; - log_emerg("iprange: iprange module disabled so improper ip address assigning may cause kernel soft lockup!\n"); - continue; - } + if (!strcmp(opt->name, "disable")) + goto disable; r = parse1(opt->name); if (!r) r = parse2(opt->name); @@ -106,8 +103,15 @@ static void load_ranges(struct list_head *list, const char *conf_sect) log_emerg("iprange: cann't parse '%s' in '%s'\n", opt->name, conf_sect); _exit(EXIT_FAILURE); } + if (r->begin == r->end) + goto disable; list_add_tail(&r->entry, list); } + + return; +disable: + conf_disable = 1; + log_emerg("iprange: iprange module disabled so improper ip address assigning may cause kernel soft lockup!\n"); } static int check_range(struct list_head *list, in_addr_t ipaddr) |