summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accel-pppd/ctrl/l2tp/l2tp.c13
-rw-r--r--accel-pppd/ctrl/pptp/pptp.c13
-rw-r--r--accel-pppd/iprange.c27
-rw-r--r--accel-pppd/iprange.h10
4 files changed, 57 insertions, 6 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c
index 72264aa5..76c679c7 100644
--- a/accel-pppd/ctrl/l2tp/l2tp.c
+++ b/accel-pppd/ctrl/l2tp/l2tp.c
@@ -4910,6 +4910,19 @@ static void load_config(void)
}
conf_ip_pool = conf_get_opt("l2tp", "ip-pool");
+
+ switch (iprange_check_activation()) {
+ case IPRANGE_DISABLED:
+ log_warn("l2tp: iprange module disabled, improper IP configuration of PPP interfaces may cause kernel soft lockup\n");
+ break;
+ case IPRANGE_NO_RANGE:
+ log_warn("l2tp: no IP address range defined in section [%s], incoming L2TP connections will be rejected\n",
+ IPRANGE_CONF_SECTION);
+ break;
+ default:
+ /* Makes compiler happy */
+ break;
+ }
}
static void l2tp_init(void)
diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c
index 0a0afa4d..ec20586f 100644
--- a/accel-pppd/ctrl/pptp/pptp.c
+++ b/accel-pppd/ctrl/pptp/pptp.c
@@ -773,6 +773,19 @@ static void load_config(void)
}
conf_ip_pool = conf_get_opt("pptp", "ip-pool");
+
+ switch (iprange_check_activation()) {
+ case IPRANGE_DISABLED:
+ log_warn("pptp: iprange module disabled, improper IP configuration of PPP interfaces may cause kernel soft lockup\n");
+ break;
+ case IPRANGE_NO_RANGE:
+ log_warn("pptp: no IP address range defined in section [%s], incoming PPTP connections will be rejected\n",
+ IPRANGE_CONF_SECTION);
+ break;
+ default:
+ /* Makes compiler happy */
+ break;
+ }
}
static void pptp_init(void)
diff --git a/accel-pppd/iprange.c b/accel-pppd/iprange.c
index 6281a745..d2b896f1 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);
diff --git a/accel-pppd/iprange.h b/accel-pppd/iprange.h
index 88a2486a..39bd8ba2 100644
--- a/accel-pppd/iprange.h
+++ b/accel-pppd/iprange.h
@@ -3,6 +3,16 @@
#include <netinet/in.h>
+
+#define IPRANGE_CONF_SECTION "client-ip-range"
+
+enum iprange_status {
+ IPRANGE_DISABLED,
+ IPRANGE_NO_RANGE,
+ IPRANGE_ACTIVE,
+};
+
+enum iprange_status iprange_check_activation(void);
int iprange_client_check(in_addr_t ipaddr);
int iprange_tunnel_check(in_addr_t ipaddr);