diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-07-19 19:09:24 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-07-19 19:09:24 +0400 |
commit | a60d08c8ca66de1844a430cc487a725e4c0e0d54 (patch) | |
tree | 2c05a0acafefbfd22c2d8cc4093ae7ba6946b8c1 /accel-pppd/ctrl/ipoe/dhcpv4.c | |
parent | 09b155588131d8ed6f380aec467d0fa7749933b8 (diff) | |
download | accel-ppp-a60d08c8ca66de1844a430cc487a725e4c0e0d54.tar.gz accel-ppp-a60d08c8ca66de1844a430cc487a725e4c0e0d54.zip |
ipoe: implemented L4-Redirect radius attribute
ipoe: implemented client address, router address and mask to be passed via radius
Diffstat (limited to 'accel-pppd/ctrl/ipoe/dhcpv4.c')
-rw-r--r-- | accel-pppd/ctrl/ipoe/dhcpv4.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/accel-pppd/ctrl/ipoe/dhcpv4.c b/accel-pppd/ctrl/ipoe/dhcpv4.c index f1a8876..08da43a 100644 --- a/accel-pppd/ctrl/ipoe/dhcpv4.c +++ b/accel-pppd/ctrl/ipoe/dhcpv4.c @@ -721,6 +721,22 @@ int dhcpv4_get_ip(struct dhcpv4_serv *serv, uint32_t *yiaddr, uint32_t *siaddr, void dhcpv4_put_ip(struct dhcpv4_serv *serv, uint32_t ip) { int n = ntohl(ip) - serv->range->startip; + + if (n <= 0 || n / (8 * sizeof(long)) >= serv->range->len) + return; + + pthread_mutex_lock(&serv->range->lock); + serv->range->free[n / (8 * sizeof(long))] |= 1 << (n % (8 * sizeof(long))); + pthread_mutex_unlock(&serv->range->lock); +} + +void dhcpv4_reserve_ip(struct dhcpv4_serv *serv, uint32_t ip) +{ + int n = ntohl(ip) - serv->range->startip; + + if (n <= 0 || n / (8 * sizeof(long)) >= serv->range->len) + return; + pthread_mutex_lock(&serv->range->lock); serv->range->free[n / (8 * sizeof(long))] |= 1 << (n % (8 * sizeof(long))); pthread_mutex_unlock(&serv->range->lock); |