dhcpcd-discuss

Re: ipv6_newaddr: Invalid argument

Breno Leitao

Tue Jun 18 15:10:46 2019

Hi Roy,

On 6/18/19 9:08 AM, Roy Marples wrote:
> Hi Breno
> 
> On 17/06/2019 17:15, Breno Leitao wrote:
>> I have a Linux system where dhcpcd is responsible for all the IPv6
>> network config, and Linux has autoconf disabled
>> (/proc/sys/net/ipv6/conf/all/autoconf = 0).
>>
>> Everything works pretty well, but I am getting the following error
>> from time to time, which is annoying:
>>
>>      ipv6_newaddr: Invalid argument
>>
>> The problem seems to be related to ipv6_newaddr() being called with a
>> package with IPV6_AF_AUTOCONF set, and prefix = 128.
>>
>> Since the package is IPV6_AF_AUTOCONF, then ipv6_makeaddr() is called,
>> and it returns EINVAL as saw above:
>>
>>      if (prefix_len < 0 || prefix_len > 120) {
>>          errno = EINVAL;
>>           return -1;
>>       }
> 
> Are you sure?
> It's very unlikely SLAAC would emit a /128 prefix - it would service
> literally no purpose.
> A /128 prefix is used for DHCPv6 addresses for use on a lower matching
> prefix handed out by RA.
> 
> Could you add this to /etc/dhcpcd.conf and then restart it and email me
> the log please?
> debug
> logfile /var/log/dhcpcd.log

Sure. I also did patch dhcpcd to dump the prefix to grab what we have
been receiving. Something as:

  @@ -344,6 +344,19 @@ ipv6_makeaddr(struct in6_addr *addr, str
   {
   	const struct ipv6_addr *ap;
   	int dad;
  +  int i =0;
  +
  +  printf("Address:  ");
  +  for (i = 0; i < 16; i++)
  +    printf("%hhx ", ((char *) addr)[i]);
  +  printf("\n");
  +
  +  printf("Prefix:  ");
  +  for (i = 0; i < 16; i++)
  +    printf("%hhx ", ((char *) prefix)[i]);
  +  printf("\n");
  +
  +  printf("Prefix len = %d\n", prefix_len);

 	  if (prefix_len < 0 || prefix_len > 120) {
 		  errno = EINVAL;

In this case, this is the "full log":

  eth0: 	IAID 84:f6:a0:7a
  eth0: delaying IPv6 router solicitation for 0.6 seconds
  eth0: soliciting an IPv6 router
  eth0: sending Router Solicitation
  eth0: Router Advertisement from fe80::7270:8bff:fe48:3bbf
  Address:  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  Prefix:  26 20 1 d c0 82 24 14 0 0 0 0 0 0 f 4d
  Prefix len = 128
  ipv6_newaddr: Invalid argument
  eth0: adding default route via fe80::7270:8bff:fe48:3bbf
  eth0: executing `/usr/libexec/dhcpcd-run-hooks' ROUTERADVERT
  eth0: No DHCPv6 instruction in RA
  eth0: Router Advertisement from fe80::200:5eff:fe00:201
  Address:  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  Prefix:  26 20 1 d c0 82 24 14 0 0 0 0 0 0 0 0
  Prefix len = 64
  eth0: adding address 2620:10d:c082:2414:aa1e:84ff:fef6:a07a/64
  eth0: pltime 120 seconds, vltime 120 seconds

>> Since I am new to the IPv6 world, I was wondering if I should enable
>> dhcpcd to handle temporary address (IPV6_MANAGETEMPADDR), but, looking
>> further, it seems this option is disabled on Linux:
>>
>>      #if defined(IN6_IFF_TEMPORARY) && !defined(__linux__)
>>      #define IPV6_MANAGETEMPADDR
>>      #endif
> 
> Linux does not allow userland to set temporary addresses.
> However, it does allow userland to mark addresses as the basis for
> managing temporary addresses from, which is almost as good.
> 
>> That said, I am wondering if I am reading the problem properly, and if
>> my debug makes any sense.
> 
> Generally when Linux users report the error you are seeing, it's because
> the kernel headers are mismatched from the actual kernel you are running.
> Let us look at the dhcpcd debug log first and try and work more out.

That said, I think the problem is on network side, and dhcpcd just
complained about a "invalid" RA.

Thank you for your insight.
Breno

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