summaryrefslogtreecommitdiff
path: root/accel-pppd/ipv6/dhcpv6.c
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2017-12-25 17:57:53 +0300
committerDmitry Kozlov <xeb@mail.ru>2017-12-25 17:57:53 +0300
commit4c8340c4abe04d896de8e0a190ec412d4ce4f30f (patch)
treef18a8b4f56c8007bcbcafd6ec6fe43af5d5f6cfd /accel-pppd/ipv6/dhcpv6.c
parentcd9bb5cfe3afec23ef62f2aa2ed82e6dd04a32f9 (diff)
downloadaccel-ppp-xebd-4c8340c4abe04d896de8e0a190ec412d4ce4f30f.tar.gz
accel-ppp-xebd-4c8340c4abe04d896de8e0a190ec412d4ce4f30f.zip
ipv6: implemented special handling of /128 prefixes
If prefix length is 128 then send RA with 64 prefix length and add point-to-point ipv6 address on interface
Diffstat (limited to 'accel-pppd/ipv6/dhcpv6.c')
-rw-r--r--accel-pppd/ipv6/dhcpv6.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/accel-pppd/ipv6/dhcpv6.c b/accel-pppd/ipv6/dhcpv6.c
index d99165c..2122f29 100644
--- a/accel-pppd/ipv6/dhcpv6.c
+++ b/accel-pppd/ipv6/dhcpv6.c
@@ -166,6 +166,9 @@ static void build_addr(struct ipv6db_addr_t *a, uint64_t intf_id, struct in6_add
{
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
@@ -310,10 +313,14 @@ static void dhcpv6_send_reply(struct dhcpv6_packet *req, struct dhcpv6_pd *pd, i
ia_addr->valid_lifetime = htonl(conf_valid_lifetime);
if (!a->installed) {
- if (a->prefix_len > 64)
- ip6route_add(ses->ifindex, &a->addr, a->prefix_len, 0);
- else {
- struct in6_addr addr;
+ struct in6_addr addr, peer_addr;
+ if (a->prefix_len == 128) {
+ memcpy(addr.s6_addr, &a->addr, 8);
+ memcpy(addr.s6_addr + 8, &ses->ipv6->intf_id, 8);
+ memcpy(peer_addr.s6_addr, &a->addr, 8);
+ memcpy(peer_addr.s6_addr + 8, &ses->ipv6->peer_intf_id, 8);
+ ip6addr_add_peer(ses->ifindex, &addr, &peer_addr);
+ } else {
memcpy(addr.s6_addr, &a->addr, 8);
memcpy(addr.s6_addr + 8, &ses->ipv6->intf_id, 8);
ip6addr_add(ses->ifindex, &addr, a->prefix_len);