Page MenuHomeVyOS Platform

vyos.template.first_host_address() does not honor RFC4291 section 2.6.1
Closed, ResolvedPublicBUG

Description

The Subnet-Router anycast address is predefined. Its format is as follows:

|                         n bits                 |   128-n bits   |
+------------------------------------------------+----------------+
|                   subnet prefix                | 00000000000000 |
+------------------------------------------------+----------------+

The "subnet prefix" in an anycast address is the prefix that
identifies a specific link. This anycast address is syntactically
the same as a unicast address for an interface on the link with the
interface identifier set to zero.

Packets sent to the Subnet-Router anycast address will be delivered
to one router on the subnet. All routers are required to support the
Subnet-Router anycast addresses for the subnets to which they have
interfaces.

The Subnet-Router anycast address is intended to be used for
applications where a node needs to communicate with any one of the
set of routers.

Our code has:

@register_filter('first_host_address')
def first_host_address(text):
    """ Return first usable (host) IP address from given prefix.
    Example:
      - 10.0.0.0/24 -> 10.0.0.1
      - 2001:db8::/64 -> 2001:db8::
    """
    from ipaddress import ip_interface
    from ipaddress import IPv4Network
    from ipaddress import IPv6Network

    addr = ip_interface(text)
    if addr.version == 4:
        return str(addr.ip +1)
    return str(addr.ip)

Which uses the all zeroes address for the first host

Details

Version
1.3.5
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

c-po changed the task status from Open to In progress.
c-po claimed this task.
c-po triaged this task as Low priority.
c-po edited a custom field.
c-po moved this task from Open to Finished on the VyOS 1.4 Sagitta board.
c-po moved this task from Open to Finished on the VyOS 1.5 Circinus board.