summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxebd <xeb@mail.ru>2021-06-16 12:00:16 +0300
committerGitHub <noreply@github.com>2021-06-16 12:00:16 +0300
commit7f90e753fcc63b6581e8ca96ea2da693a8de495c (patch)
treea0dbfdb9e66291369e75c359b0672e1fac89a909
parent26ea71ec55687d897c9aabed22ebaec67dbe56a3 (diff)
parenta1a2b79240511222868a60960d51f12adbe0d7d4 (diff)
downloadaccel-ppp-7f90e753fcc63b6581e8ca96ea2da693a8de495c.tar.gz
accel-ppp-7f90e753fcc63b6581e8ca96ea2da693a8de495c.zip
Merge pull request #18 from DmitriyEshenko/16062021-fix-addr-range
ipoe: T41: Fix address range shifting
-rw-r--r--accel-pppd/ctrl/ipoe/dhcpv4.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/accel-pppd/ctrl/ipoe/dhcpv4.c b/accel-pppd/ctrl/ipoe/dhcpv4.c
index d671b5b6..ffbbcfe4 100644
--- a/accel-pppd/ctrl/ipoe/dhcpv4.c
+++ b/accel-pppd/ctrl/ipoe/dhcpv4.c
@@ -105,7 +105,7 @@ static struct dhcpv4_iprange *parse_range(const char *str)
pthread_mutex_init(&r->lock, NULL);
end -= start;
- r->free[(end - 1) / ( 8 * sizeof(long))] &= (1 << ((end - 1) % (8 * sizeof(long)) + 1)) - 1;
+ r->free[(end - 1) / ( 8 * sizeof(long))] &= (1l << ((end - 1) % (8 * sizeof(long)) + 1)) - 1;
r->free[0] &= ~3;
return r;
@@ -1179,7 +1179,7 @@ int dhcpv4_get_ip(struct dhcpv4_serv *serv, uint32_t *yiaddr, uint32_t *siaddr,
for (i = serv->range->pos; i < serv->range->len; i++) {
k = ffsl(serv->range->free[i]);
if (k) {
- serv->range->free[i] &= ~(1 << (k - 1));
+ serv->range->free[i] &= ~(1l << (k - 1));
serv->range->pos = i;
pthread_mutex_unlock(&serv->range->lock);
*yiaddr = htonl(serv->range->startip + i * 8 * sizeof(long) + k - 1);
@@ -1207,7 +1207,7 @@ void dhcpv4_put_ip(struct dhcpv4_serv *serv, uint32_t ip)
return;
pthread_mutex_lock(&serv->range->lock);
- serv->range->free[n / (8 * sizeof(long))] |= 1 << (n % (8 * sizeof(long)));
+ serv->range->free[n / (8 * sizeof(long))] |= 1l << (n % (8 * sizeof(long)));
pthread_mutex_unlock(&serv->range->lock);
}