summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxebd <xeb@mail.ru>2018-02-15 10:26:31 +0300
committerGitHub <noreply@github.com>2018-02-15 10:26:31 +0300
commit946bc4d4c33b0467eb9c3133e7251d8ed3e03a9d (patch)
tree4968a3476c7c89ec29a04e7e7daaeb66745cfa51
parent841e9d29c82b2e5c5bc162a14125d6e285d3b32a (diff)
parent2e4477498304db90061df3d387728e26a9232a5d (diff)
downloadaccel-ppp-946bc4d4c33b0467eb9c3133e7251d8ed3e03a9d.tar.gz
accel-ppp-946bc4d4c33b0467eb9c3133e7251d8ed3e03a9d.zip
Merge pull request #38 from themiron/ipoe-pd-gateway
ipv6: dhcpv6: fix PD linklocal route for ipoe clients
-rw-r--r--accel-pppd/ipv6/dhcpv6.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/accel-pppd/ipv6/dhcpv6.c b/accel-pppd/ipv6/dhcpv6.c
index 22273428..84d36caa 100644
--- a/accel-pppd/ipv6/dhcpv6.c
+++ b/accel-pppd/ipv6/dhcpv6.c
@@ -167,7 +167,7 @@ static void ev_ses_finished(struct ap_session *ses)
_free(pd);
}
-static void insert_dp_routes(struct ap_session *ses, struct dhcpv6_pd *pd)
+static void insert_dp_routes(struct ap_session *ses, struct dhcpv6_pd *pd, struct in6_addr *addr)
{
struct ipv6db_addr_t *p;
struct in6_rtmsg rt6;
@@ -179,10 +179,9 @@ static void insert_dp_routes(struct ap_session *ses, struct dhcpv6_pd *pd)
rt6.rtmsg_ifindex = ses->ifindex;
rt6.rtmsg_flags = RTF_UP;
- if (conf_route_via_gw) {
+ if (conf_route_via_gw && addr && !IN6_IS_ADDR_UNSPECIFIED(addr)) {
rt6.rtmsg_flags |= RTF_GATEWAY;
- rt6.rtmsg_gateway.s6_addr32[0] = htonl(0xfe800000);
- memcpy(rt6.rtmsg_gateway.s6_addr + 8, &ses->ipv6->peer_intf_id, 8);
+ memcpy(&rt6.rtmsg_gateway, addr, sizeof(rt6.rtmsg_gateway));
}
list_for_each_entry(p, &ses->ipv6_dp->prefix_list, entry) {
@@ -372,7 +371,7 @@ static void dhcpv6_send_reply(struct dhcpv6_packet *req, struct dhcpv6_pd *pd, i
if (req->hdr->type == D6_REQUEST || req->rapid_commit) {
pd->dp_iaid = ia_na->iaid;
if (!pd->dp_active)
- insert_dp_routes(ses, pd);
+ insert_dp_routes(ses, pd, &req->addr.sin6_addr);
}
f2 = 1;