diff options
-rw-r--r-- | accel-pppd/extra/ippool.c | 24 | ||||
-rw-r--r-- | accel-pppd/extra/net-snmp/sessionTable_data_access.c | 1 | ||||
-rw-r--r-- | accel-pppd/shaper/shaper.c | 2 |
3 files changed, 16 insertions, 11 deletions
diff --git a/accel-pppd/extra/ippool.c b/accel-pppd/extra/ippool.c index 80e3c56..757fb64 100644 --- a/accel-pppd/extra/ippool.c +++ b/accel-pppd/extra/ippool.c @@ -49,9 +49,12 @@ struct ipaddr_t static struct ipdb_t ipdb; static in_addr_t conf_gw_ip_address; +static int conf_shuffle; + +#ifdef RADIUS static int conf_vendor = 0; static int conf_attr = 88; // Framed-Pool -static int conf_shuffle; +#endif static int cnt; static LIST_HEAD(pool_list); @@ -102,7 +105,7 @@ static void parse_gw_ip_address(const char *val) //parses ranges like x.x.x.x/mask static int parse1(const char *str, uint32_t *begin, uint32_t *end) { - int n, f1, f2, f3, f4, m, mask = 0; + int n, f1, f2, f3, f4, m; n = sscanf(str, "%u.%u.%u.%u/%u",&f1, &f2, &f3, &f4, &m); if (n != 5) @@ -118,11 +121,10 @@ static int parse1(const char *str, uint32_t *begin, uint32_t *end) if (m == 0 || m > 32) return -1; - *begin = (f4 << 24) | (f3 << 16) | (f2 << 8) | f1; + *begin = (f1 << 24) | (f2 << 16) | (f3 << 8) | f4; - mask = htonl(~((1 << (32 - m)) - 1)); - *end = ntohl(*begin | ~mask); - *begin = ntohl(*begin); + m = m == 32 ? 0xffffffff : ((1 << (32 - m)) - 1); + *end = *begin | m; return 0; } @@ -130,9 +132,9 @@ static int parse1(const char *str, uint32_t *begin, uint32_t *end) //parses ranges like x.x.x.x-y static int parse2(const char *str, uint32_t *begin, uint32_t *end) { - int n, f1, f2, f3, f4, m; + int n, f1, f2, f3, f4, f5; - n = sscanf(str, "%u.%u.%u.%u-%u",&f1, &f2, &f3, &f4, &m); + n = sscanf(str, "%u.%u.%u.%u-%u",&f1, &f2, &f3, &f4, &f5); if (n != 5) return -1; if (f1 > 255) @@ -143,11 +145,11 @@ static int parse2(const char *str, uint32_t *begin, uint32_t *end) return -1; if (f4 > 255) return -1; - if (m < f4 || m > 255) + if (f5 < f4 || f5 > 255) return -1; - *begin = ntohl((f4 << 24) | (f3 << 16) | (f2 << 8) | f1); - *end = ntohl((m << 24) | (f3 << 16) | (f2 << 8) | f1); + *begin = (f1 << 24) | (f2 << 16) | (f3 << 8) | f4; + *end = (f1 << 24) | (f2 << 16) | (f3 << 8) | f5; return 0; } diff --git a/accel-pppd/extra/net-snmp/sessionTable_data_access.c b/accel-pppd/extra/net-snmp/sessionTable_data_access.c index 13ddfc5..41c7268 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_data_access.c +++ b/accel-pppd/extra/net-snmp/sessionTable_data_access.c @@ -236,6 +236,7 @@ sessionTable_container_load(netsnmp_container *container) rowreq_ctx->data->calling_sid = _strdup(ses->ctrl->calling_station_id); rowreq_ctx->data->called_sid = _strdup(ses->ctrl->called_station_id); + net = ses->net; ap_session_read_stats(ses, &stats); rowreq_ctx->data->rx_pkts = stats.rx_packets; rowreq_ctx->data->rx_bytes = stats.rx_bytes; diff --git a/accel-pppd/shaper/shaper.c b/accel-pppd/shaper/shaper.c index e0d9569..5f557b3 100644 --- a/accel-pppd/shaper/shaper.c +++ b/accel-pppd/shaper/shaper.c @@ -238,8 +238,10 @@ static void parse_string(const char *str, int dir, int *speed, int *burst, int * } } +#ifdef RADIUS if (conf_vendor == 9) return; +#endif val = strtol(str, &endptr, 10); if (*endptr == 0) { |