summaryrefslogtreecommitdiff
path: root/accel-pppd/ipdb.c
diff options
context:
space:
mode:
authorxebd <xeb@mail.ru>2018-01-13 15:24:04 +0300
committerGitHub <noreply@github.com>2018-01-13 15:24:04 +0300
commit28d4f7446c7e8e901109d1d90928c09b9ee4d49d (patch)
treed884d23c46fffc52247bce87781a9f8656a1ff82 /accel-pppd/ipdb.c
parente25f03bf144dbe7121bc5710aafbd45f71215436 (diff)
parentabaa43a307fa7a790dd34034c5fd8013dbd0488c (diff)
downloadaccel-ppp-28d4f7446c7e8e901109d1d90928c09b9ee4d49d.tar.gz
accel-ppp-28d4f7446c7e8e901109d1d90928c09b9ee4d49d.zip
Merge pull request #35 from themiron/ipv6-pool-fixes
Ipv6 pool fixes
Diffstat (limited to 'accel-pppd/ipdb.c')
-rw-r--r--accel-pppd/ipdb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/accel-pppd/ipdb.c b/accel-pppd/ipdb.c
index a7ef0a44..dd8c61c9 100644
--- a/accel-pppd/ipdb.c
+++ b/accel-pppd/ipdb.c
@@ -77,10 +77,14 @@ void __export build_ip6_addr(struct ipv6db_addr_t *a, uint64_t intf_id, struct i
{
memcpy(addr, &a->addr, sizeof(*addr));
+ if (a->prefix_len == 128)
+ return;
+
if (a->prefix_len <= 64)
*(uint64_t *)(addr->s6_addr + 8) = intf_id;
else
- *(uint64_t *)(addr->s6_addr + 8) |= intf_id & ((1 << (128 - a->prefix_len)) - 1);
+ *(uint64_t *)(addr->s6_addr + 8) |= intf_id & htobe64((1 << (128 - a->prefix_len)) - 1);
+
}
void __export ipdb_register(struct ipdb_t *ipdb)