summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl
diff options
context:
space:
mode:
authorDmitriyEshenko <snooppy@mail.ua>2021-06-16 11:54:31 +0300
committerDmitriyEshenko <snooppy@mail.ua>2021-06-16 11:54:31 +0300
commita1a2b79240511222868a60960d51f12adbe0d7d4 (patch)
treea0dbfdb9e66291369e75c359b0672e1fac89a909 /accel-pppd/ctrl
parent26ea71ec55687d897c9aabed22ebaec67dbe56a3 (diff)
downloadaccel-ppp-a1a2b79240511222868a60960d51f12adbe0d7d4.tar.gz
accel-ppp-a1a2b79240511222868a60960d51f12adbe0d7d4.zip
ipoe: T41: Fix address range shifting
Diffstat (limited to 'accel-pppd/ctrl')
-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);
}