Add route for session-specific subprefix of the ipv6 prefix

Otherwise with kernel acceleration we would only have the same /64 route
on all ppp devices. We need separate /96 routes on each ppp device for
packets of the /96 subprefix to be routed to the correct session.
This commit is contained in:
Samuel Thibault 2024-01-04 00:09:24 +01:00
parent 8c04e26f3f
commit e53fccd36c

View file

@ -1247,6 +1247,15 @@ void routes6set(sessionidt s, sessiont *sp, int add)
if (!add || sessionbyipv6(sp->ipv6address) != s) if (!add || sessionbyipv6(sp->ipv6address) != s)
route6set(s, sp->ipv6address, 128, add); route6set(s, sp->ipv6address, 128, add);
} }
else
{
in_addr_t addr_ipv4 = htonl(session[s].ip);
struct in6_addr addr;
memset(&addr, 0, sizeof(addr));
memcpy(&addr, &config->ipv6_prefix, 8);
memcpy(&addr.s6_addr[8], &addr_ipv4, 4);
route6set(s, addr, 96, add);
}
} }
// //