Page MenuHomeVyOS Platform

IPv6 address validation issue
Closed, InvalidPublicBUG

Description

The address validation seems to have issues with IPv6 addresses which ends in "0"

vyos@vyos# set interfaces ethernet eth0 address 2a10:ffff:ffff::/64

  Error: 2a10:ffff:ffff::/64 is not a valid IP host

I've also tried 2a10:ffff:ffff::0/64 which does not work either.
2a10:ffff:ffff::1/64 will be accpeted tho.

2a10:ffff:ffff:: is a valid IPv6 address and should be accepted

Details

Difficulty level
Easy (less than an hour)
Version
VyOS 1.4-rolling-202305310317
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

Validator doesn't allow setting network address to the interface
the same way you can't add 10.2.3.0/24 to interface
But natively it seems working

vyos@r14# sudo ip a add 10.5.0.0/24 dev eth0
[edit]
vyos@r14# ping 10.5.0.0
PING 10.5.0.0 (10.5.0.0) 56(84) bytes of data.
64 bytes from 10.5.0.0: icmp_seq=1 ttl=64 time=0.062 ms
^C

Well, in an example like yours, using the network address as an IP is not really best practice even tho its works.
So, the validator forces the users to do it the right way, which is probably a good thing.

But even there are some exeptions, point-to-point connections are commonly using an /31 subnet.
In such cases the network address is also used and there is no broadcast address reserved.
So, 10.5.0.0/31 is then actually a fully valid IP address.

Also if you take 10.5.0.0/22 as an example, there is nothing wrong with using an .0 address within the subnet.

This is mostly also applying to IPv6
But probably occures even more ofthen that an IP address ends with a "0" / ::

There are no network or broadcast addresses in v6 like there are in v4. The first address (ex: 2a10:ffff:ffff::/64) is the Anycast address for "All Routers" on a subnet in v6 land.

Duplicate address detection *should* prevent this from being assigned.

If you want to use Point to Points, use /127s.

dmbaturin edited projects, added Invalid; removed VyOS 1.4 Sagitta (1.4.0-epa1), Restricted Project, VyOS 1.5 Circinus.
dmbaturin subscribed.

The validator correctly handled addresses that end with zero if they valid host addresses. It rejects such addresses iff they are the first addresses of their subnets: in IPv4 because it's the network address, in IPv6 because it's the Subnet-Router anycast address (https://www.rfc-editor.org/rfc/rfc4291#section-2.6.1).

Otherwise it works fine:

$ ./src/ipaddrcheck --is-ipv6-host 2001:db8:dead:beef::/32 && echo Yes
Yes

$ ./src/ipaddrcheck --is-ipv4-host 10.5.0.0/31 && echo Yes
Yes

$ ./src/ipaddrcheck --is-ipv4-host 10.5.1.0/22 && echo Yes
Yes

Also, a word of caution for everyone who tests what's possible by trying it out in the Linux kernel: the kernel allows you to go completely against all RFCs and even set a custom broadcast address. I'm not kidding. ;)
So, "Linux allows it" isn't always an argument for a well-behaved system.