summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorxebd <xeb@mail.ru>2022-07-27 12:36:44 +0300
committerGitHub <noreply@github.com>2022-07-27 12:36:44 +0300
commit61ba3af1d1e204df000fd78add1dbe1139eb5df7 (patch)
treef96d8eb95d9981073553ecebea1d7f5096b8679a /accel-pppd
parent847ccb49a7e0958d778fc772a266a0f8695f591c (diff)
parenta184c94f3f8c8e8bc56ebd9527646567a06e8e59 (diff)
downloadaccel-ppp-61ba3af1d1e204df000fd78add1dbe1139eb5df7.tar.gz
accel-ppp-61ba3af1d1e204df000fd78add1dbe1139eb5df7.zip
Merge pull request #54 from telirebarry/fix-ipv6-netns
Fix ipv6 inside netns
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/ipv6/dhcpv6.c5
-rw-r--r--accel-pppd/ipv6/nd.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/accel-pppd/ipv6/dhcpv6.c b/accel-pppd/ipv6/dhcpv6.c
index 91b396c3..cefbcfd8 100644
--- a/accel-pppd/ipv6/dhcpv6.c
+++ b/accel-pppd/ipv6/dhcpv6.c
@@ -76,7 +76,10 @@ static void ev_ses_started(struct ap_session *ses)
if (a->prefix_len == 0 || IN6_IS_ADDR_UNSPECIFIED(&a->addr))
return;
+ net->enter_ns();
sock = net->socket(AF_INET6, SOCK_DGRAM, 0);
+ net->exit_ns();
+
if (!sock) {
log_ppp_error("dhcpv6: socket: %s\n", strerror(errno));
return;
@@ -85,7 +88,7 @@ static void ev_ses_started(struct ap_session *ses)
net->setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &f, sizeof(f));
if (net->setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, ses->ifname, strlen(ses->ifname))) {
- log_ppp_error("ipv6_nd: setsockopt(SO_BINDTODEVICE): %s\n", strerror(errno));
+ log_ppp_error("dhcpv6: setsockopt(SO_BINDTODEVICE): %s\n", strerror(errno));
close(sock);
return;
}
diff --git a/accel-pppd/ipv6/nd.c b/accel-pppd/ipv6/nd.c
index 943ed6d3..297e4d63 100644
--- a/accel-pppd/ipv6/nd.c
+++ b/accel-pppd/ipv6/nd.c
@@ -284,7 +284,9 @@ static int ipv6_nd_start(struct ap_session *ses)
int val;
struct ipv6_nd_handler_t *h;
+ net->enter_ns();
sock = net->socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
+ net->exit_ns();
if (sock < 0) {
log_ppp_error("socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6): %s\n", strerror(errno));