From 671c54b1876b2b46a37cc587a114a2b5cf9ed2d0 Mon Sep 17 00:00:00 2001 From: Telire Barry Date: Wed, 22 Jun 2022 16:55:48 +0200 Subject: ipv6_nd: fix ipv6 auto-configuration in netns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ipv6 auto-configuration generate error when link is terminated inside netns. The error message is : "ipv6_nd: setsockopt(SO_BINDTODEVICE): No such device" This error is generated because socket is not created inside the netns but it’s created in the default netns. This fix allow to create the socket in the right place. to propose this fix, i was inspired by : issue : https://phabricator.accel-ppp.org/T68 commit : https://github.com/accel-ppp/accel-ppp/commit/f1d616d91914be493b6a32a96323fa871733f8e0 --- accel-pppd/ipv6/nd.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'accel-pppd') diff --git a/accel-pppd/ipv6/nd.c b/accel-pppd/ipv6/nd.c index 943ed6d..297e4d6 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)); -- cgit v1.2.3 From 26270ec4e1057977be1e45da1c86217e1b6357f6 Mon Sep 17 00:00:00 2001 From: Telire Barry Date: Wed, 22 Jun 2022 17:12:32 +0200 Subject: ipv6_dhcp: fix create ipv6 socket inside netns This fix allow to create the socket inside the netns for ipv6-dhcp module. --- accel-pppd/ipv6/dhcpv6.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'accel-pppd') diff --git a/accel-pppd/ipv6/dhcpv6.c b/accel-pppd/ipv6/dhcpv6.c index cc7f1f3..0a0a2c1 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; -- cgit v1.2.3 From a184c94f3f8c8e8bc56ebd9527646567a06e8e59 Mon Sep 17 00:00:00 2001 From: Telire Barry Date: Fri, 24 Jun 2022 11:27:47 +0200 Subject: ipv6_dhcp:change log message with appropriate file name This commit proposes to modify the log message in dhcpv6.c to include the correct file name. It avoids confusion when reading the logs --- accel-pppd/ipv6/dhcpv6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'accel-pppd') diff --git a/accel-pppd/ipv6/dhcpv6.c b/accel-pppd/ipv6/dhcpv6.c index 0a0a2c1..12701ce 100644 --- a/accel-pppd/ipv6/dhcpv6.c +++ b/accel-pppd/ipv6/dhcpv6.c @@ -88,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; } -- cgit v1.2.3