diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2021-08-26 12:56:02 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2021-08-26 12:56:02 +0300 |
commit | 5daf0f6782b769600855f745aa0a2e514a06a8aa (patch) | |
tree | c386bac3188c0825393a290393eaf68616fdacba /accel-pppd | |
parent | a77f448266e90d6706517cb91a699be080268eb3 (diff) | |
parent | 2224396d8d184e2c267a9958408e0606541e9d0b (diff) | |
download | accel-ppp-5daf0f6782b769600855f745aa0a2e514a06a8aa.tar.gz accel-ppp-5daf0f6782b769600855f745aa0a2e514a06a8aa.zip |
Merge branch 'master' of github.com:accel-ppp/accel-ppp
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/ctrl/ipoe/dhcpv4.c | 6 | ||||
-rw-r--r-- | accel-pppd/logs/log_file.c | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/accel-pppd/ctrl/ipoe/dhcpv4.c b/accel-pppd/ctrl/ipoe/dhcpv4.c index ffbbcfe..f1d9c46 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))] &= (1l << ((end - 1) % (8 * sizeof(long)) + 1)) - 1; + r->free[(end - 1) / ( 8 * sizeof(long))] &= (1ul << ((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] &= ~(1l << (k - 1)); + serv->range->free[i] &= ~(1lu << (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))] |= 1l << (n % (8 * sizeof(long))); + serv->range->free[n / (8 * sizeof(long))] |= 1lu << (n % (8 * sizeof(long))); pthread_mutex_unlock(&serv->range->lock); } diff --git a/accel-pppd/logs/log_file.c b/accel-pppd/logs/log_file.c index 216ff5a..42d9f3f 100644 --- a/accel-pppd/logs/log_file.c +++ b/accel-pppd/logs/log_file.c @@ -265,8 +265,10 @@ static void general_log(struct log_target_t *t, struct log_msg_t *msg, struct ap static struct ap_private *find_pd(struct ap_session *ses, void *pd_key) { struct ap_private *pd; + struct list_head *pos, *next; - list_for_each_entry(pd, &ses->pd_list, entry) { + list_for_each_safe(pos, next, &ses->pd_list) { + pd = list_entry(pos->next, typeof(*pd), entry); if (pd->key == pd_key) { return pd; } @@ -551,8 +553,8 @@ static void ev_ctrl_started(struct ap_session *ses) } memset(fpd, 0, sizeof(*fpd)); fpd->pd.key = &pd_key3; - list_add_tail(&fpd->pd.entry, &ses->pd_list); INIT_LIST_HEAD(&fpd->msgs); + list_add_tail(&fpd->pd.entry, &ses->pd_list); } } |