dhcpcd-discuss

Re: dhcpcd-9.1.0 released

Roy Marples

Mon Jun 01 16:25:47 2020

On 31/05/2020 17:39, Juergen Daubert wrote:
On Sun, May 31, 2020 at 04:41:36PM +0100, Roy Marples wrote:
Hi Jurgen

On 31/05/2020 16:18, Juergen Daubert wrote:
thanks for the new release, however it seems to be broken again
for a ipv4-only host, using -4 doesn't help. This is on a CRUX
linux system.

Does this patch fix it?

Sorry, no. Exact the same error messages.

OK, new patch to try.
Attached as it's slightly larger.
Discard the old patch.

Roy
diff --git a/src/privsep-inet.c b/src/privsep-inet.c
index 8bf0474c..48fb19a2 100644
--- a/src/privsep-inet.c
+++ b/src/privsep-inet.c
@@ -170,8 +170,8 @@ ps_inet_startcb(void *arg)
 	}
 #endif
 #ifdef DHCP6
-	if ((ctx->options & (DHCPCD_DHCP6 | DHCPCD_MASTER)) ==
-	    (DHCPCD_DHCP6 | DHCPCD_MASTER))
+	if ((ctx->options & (DHCPCD_IPV6 | DHCPCD_MASTER)) ==
+	    (DHCPCD_IPV6 | DHCPCD_MASTER))
 	{
 		ctx->dhcp6_rfd = dhcp6_openudp(0, NULL);
 		if (ctx->dhcp6_rfd == -1)
diff --git a/src/privsep-root.c b/src/privsep-root.c
index 942fdd84..04e19742 100644
--- a/src/privsep-root.c
+++ b/src/privsep-root.c
@@ -607,19 +607,26 @@ ps_root_startcb(void *arg)
 	 * but makes life very easy for unicasting DHCPv6 in non master
 	 * mode as we no longer care about address selection. */
 #ifdef INET
-	ctx->udp_wfd = xsocket(PF_INET, SOCK_RAW | SOCK_CXNB, IPPROTO_UDP);
-	if (ctx->udp_wfd == -1)
-		return -1;
+	if (ctx->options & DHCPCD_IPV4) {
+		ctx->udp_wfd = xsocket(PF_INET,
+		    SOCK_RAW | SOCK_CXNB, IPPROTO_UDP);
+		if (ctx->udp_wfd == -1)
+			logerr("%s: dhcp_openraw", __func__);
+	}
 #endif
 #ifdef INET6
-	ctx->nd_fd = ipv6nd_open(false);
-	if (ctx->nd_fd == -1)
-		return -1;
+	if (ctx->options & DHCPCD_IPV6) {
+		ctx->nd_fd = ipv6nd_open(false);
+		if (ctx->udp_wfd == -1)
+			logerr("%s: ipv6nd_open", __func__);
+	}
 #endif
 #ifdef DHCP6
-	ctx->dhcp6_wfd = dhcp6_openraw();
-	if (ctx->dhcp6_wfd == -1)
-		return -1;
+	if (ctx->options & DHCPCD_IPV6) {
+		ctx->dhcp6_wfd = dhcp6_openraw();
+		if (ctx->udp_wfd == -1)
+			logerr("%s: dhcp6_openraw", __func__);
+	}
 #endif
 
 #ifdef PLUGIN_DEV

Follow-Ups:
Re: dhcpcd-9.1.0 releasedJuergen Daubert
References:
dhcpcd-9.1.0 releasedRoy Marples
Re: dhcpcd-9.1.0 releasedJuergen Daubert
Re: dhcpcd-9.1.0 releasedRoy Marples
Re: dhcpcd-9.1.0 releasedJuergen Daubert
Archive administrator: postmaster@marples.name