dhcpcd-discuss

Re: ipv6_newaddr: Invalid argument

Roy Marples

Sun Jan 12 10:58:01 2020

Hi Mike

On 10/01/2020 23:00, Mike Goodman wrote:
After a lot of web searches and reading, I still don't know how to apply that patch. I've searched the file system on the server to find a file which looks something like what the patch may be designed to alter. Nothing similar in the kernel directories no in any of /usr/bin/dhcpcd /usr/lib/dhcpcd /etc/dhcpcd.conf /usr/share/dhcpcd. I thought possibly a hook file in /etc/dhcpcd.conf but none there. Am I even in the right area?

Also, a question  - in line 5 which begins @@, is this correct - const struct as two words? I can see there is struct earlier in the line so probably correct.

So, I've got as far as a command which may work is I save what you've sent as something.patch then run patch patchtargetfile something.patch it may work, assuming I can find the patchtarget file and cd into the same directory?

Mea culpa!

To make life easy I've attached the patch this time.

tar -xaf dhcpcd-8.1.5.tar.xz
cd dhcpcd-8.1.5
patch -p1 </path/to/dhcpcd-128addr.patch
./configure
make

Test in console:
src/dhcpcd -dB

Let me know!
Should work.

Roy
diff --git a/src/ipv6.c b/src/ipv6.c
index 1e82cf0c..288f822a 100644
--- a/src/ipv6.c
+++ b/src/ipv6.c
@@ -1565,7 +1565,9 @@ ipv6_newaddr(struct interface *ifp, const struct in6_addr *addr,
 	tempaddr = false;
 #endif
 
-	if (ia->flags & IPV6_AF_AUTOCONF && !tempaddr) {
+	if (prefix_len == 128)
+		goto makepfx;
+	else if (ia->flags & IPV6_AF_AUTOCONF && !tempaddr) {
 		ia->prefix = *addr;
 		ia->dadcounter = ipv6_makeaddr(&ia->addr, ifp,
 		                               &ia->prefix,
@@ -1581,13 +1583,12 @@ ipv6_newaddr(struct interface *ifp, const struct in6_addr *addr,
 #else
 		return ia;
 #endif
-	} else if (ia->flags & (IPV6_AF_REQUEST | IPV6_AF_DELEGATEDPFX) &&
-	           prefix_len != 128)
-	{
+	} else if (ia->flags & (IPV6_AF_REQUEST | IPV6_AF_DELEGATEDPFX)) {
 		ia->prefix = *addr;
 		cbp = inet_ntop(AF_INET6, &ia->prefix, buf, sizeof(buf));
 		goto paddr;
 	} else {
+makepfx:
 		ia->addr = *addr;
 		if (ipv6_makeprefix(&ia->prefix,
 		                    &ia->addr, ia->prefix_len) == -1)

Follow-Ups:
Re: ipv6_newaddr: Invalid argumentMike Goodman
Re: ipv6_newaddr: Invalid argumentMike Goodman
References:
ipv6_newaddr: Invalid argumentMike Goodman
Re: ipv6_newaddr: Invalid argumentRoy Marples
Re: ipv6_newaddr: Invalid argumentMike Goodman
Re: ipv6_newaddr: Invalid argumentRoy Marples
Re: ipv6_newaddr: Invalid argumentMike Goodman
Archive administrator: postmaster@marples.name