summaryrefslogtreecommitdiff
path: root/accel-pppd/ipdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pppd/ipdb.c')
-rw-r--r--accel-pppd/ipdb.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/accel-pppd/ipdb.c b/accel-pppd/ipdb.c
index 7c3ebb8..a7ef0a4 100644
--- a/accel-pppd/ipdb.c
+++ b/accel-pppd/ipdb.c
@@ -1,3 +1,5 @@
+#include <string.h>
+
#include "triton.h"
#include "ipdb.h"
@@ -71,6 +73,15 @@ void __export ipdb_put_ipv6_prefix(struct ap_session *ses, struct ipv6db_prefix_
it->owner->put_ipv6_prefix(ses, it);
}
+void __export build_ip6_addr(struct ipv6db_addr_t *a, uint64_t intf_id, struct in6_addr *addr)
+{
+ memcpy(addr, &a->addr, sizeof(*addr));
+
+ 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);
+}
void __export ipdb_register(struct ipdb_t *ipdb)
{