summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2017-10-16 15:51:28 +0300
committerDmitry Kozlov <xeb@mail.ru>2017-10-16 15:52:01 +0300
commit4bbecf70cc3ad33da75f0dd01d6b683f271f9bd0 (patch)
tree68a45853b49ddc855991de75a1bd09c0fb14a3a7
parentec3d2f2942172d79fe74a01f5c980873e01ff5dd (diff)
downloadaccel-ppp-4bbecf70cc3ad33da75f0dd01d6b683f271f9bd0.tar.gz
accel-ppp-4bbecf70cc3ad33da75f0dd01d6b683f271f9bd0.zip
move build_ip6_addr function to ipdb.c
-rw-r--r--accel-pppd/cli/show_sessions.c10
-rw-r--r--accel-pppd/ipdb.c11
-rw-r--r--accel-pppd/ipdb.h2
3 files changed, 13 insertions, 10 deletions
diff --git a/accel-pppd/cli/show_sessions.c b/accel-pppd/cli/show_sessions.c
index eabf95bc..47adb3a3 100644
--- a/accel-pppd/cli/show_sessions.c
+++ b/accel-pppd/cli/show_sessions.c
@@ -408,16 +408,6 @@ static void print_ip6_dp(struct ap_session *ses, char *buf)
sprintf(ptr, "/%i", a->prefix_len);
}
-static void 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);
-}
-
static void print_ip6(struct ap_session *ses, char *buf)
{
struct ipv6db_addr_t *a;
diff --git a/accel-pppd/ipdb.c b/accel-pppd/ipdb.c
index 7c3ebb82..a7ef0a44 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)
{
diff --git a/accel-pppd/ipdb.h b/accel-pppd/ipdb.h
index d461c88d..f2a6cee7 100644
--- a/accel-pppd/ipdb.h
+++ b/accel-pppd/ipdb.h
@@ -61,5 +61,7 @@ void ipdb_put_ipv6_prefix(struct ap_session *ses, struct ipv6db_prefix_t *it);
void ipdb_register(struct ipdb_t *);
+void build_ip6_addr(struct ipv6db_addr_t *a, uint64_t intf_id, struct in6_addr *addr);
+
#endif