diff options
author | Vladislav Grishenko <themiron@mail.ru> | 2018-02-08 19:12:01 +0500 |
---|---|---|
committer | Vladislav Grishenko <themiron@mail.ru> | 2018-02-08 19:19:18 +0500 |
commit | 2e4477498304db90061df3d387728e26a9232a5d (patch) | |
tree | 4968a3476c7c89ec29a04e7e7daaeb66745cfa51 /accel-pppd/ipv6 | |
parent | 841e9d29c82b2e5c5bc162a14125d6e285d3b32a (diff) | |
download | accel-ppp-2e4477498304db90061df3d387728e26a9232a5d.tar.gz accel-ppp-2e4477498304db90061df3d387728e26a9232a5d.zip |
ipv6: dhcpv6: fix PD linklocal route for ipoe clients
peer linklocal address can't be negotiated in ipoe mode unlike ppp,
so route may lead to nowhere with non-working PD routing as result.
so, instead of guessing peer link-local address, use dhcpv6 client
src address as the gateway.
since dhcpv6 clients are onlink and there's no dhcpv6 relay support
(yet), dhcpv6 source would be exactly final linklocal address, no
matter ppp or ipoe is in use.
fine tune commit abaa43a307fa7a790dd34034c5fd8013dbd0488c
Diffstat (limited to 'accel-pppd/ipv6')
-rw-r--r-- | accel-pppd/ipv6/dhcpv6.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/accel-pppd/ipv6/dhcpv6.c b/accel-pppd/ipv6/dhcpv6.c index 2227342..84d36ca 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; |