From e53fccd36c5c3da010f72a4cfbc851a2926398aa Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Thu, 4 Jan 2024 00:09:24 +0100 Subject: [PATCH] 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. --- l2tpns.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/l2tpns.c b/l2tpns.c index eb18f4f..209d637 100644 --- a/l2tpns.c +++ b/l2tpns.c @@ -1247,6 +1247,15 @@ void routes6set(sessionidt s, sessiont *sp, int add) if (!add || sessionbyipv6(sp->ipv6address) != s) 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); + } } //