Skip to content

prefix assignment increments wrong #9626

Closed

Description

@Gigadoc2

systemd version the issue has been seen with

#9613 (master + outstanding mr)
This bug is obscured by the bug fixed in #9613, but would probably also happen on v239

Used distribution

Arch Linux

Expected behaviour you didn't see
When networkd assigns available /64-prefixes to links with IPv6PrefixDelegation=dhcpv6, it should do so by choosing the next /64 from the available prefix.

Given that the prefix fdb8:5b81:100::/48 is available, the routes created by networkd should look like this:

fdb8:5b81:100::/64 dev ens5 metric 1024 pref medium
fdb8:5b81:100:1::/64 dev ens4 metric 1024 pref medium

Unexpected behaviour you saw
When networkd assigns available /64-prefixes, it instead chooses the first /64 out of the next /48 (which is not routed to the machine). It "increments the wrong nibble", so to speak.

With the prefix fdb8:5b81:100::/48 available, the routing table instead looks like this:

fdb8:5b81:100::/64 dev ens5 metric 1024 pref medium
fdb8:5b81:101::/64 dev ens4 metric 1024 pref medium

Steps to reproduce the problem

  • Set up a router to delegate a /48 to a machine running systemd-networkd with multiple interfaces ("dummy" bridges should suffice, though i tested with "real" virtio interfaces connected to other VMs)
  • On the interface connected to the upstream router, enable DHCPv6:
[Match]
Name=ens3

[Network]
Description=uplink
DHCP=yes
IPv6AcceptRA=yes
  • On the other interfaces enable IPv6PrefixDelegation:
[Match]
Name=ens4

[Network]
Description=downlink 1

IPForward=yes
IPv6PrefixDelegation=dhcpv6

[IPv6PrefixDelegation]
RouterLifetimeSec=600

(same thing for at least one other downlink interface)

Logs
Debug logs from networkd during prefix assignment:

Jul 17 18:55:52 networkd-pd-test systemd-networkd[357]: ens3: Acquiring DHCPv6 lease on NDisc request
Jul 17 18:55:52 networkd-pd-test systemd-networkd[357]: DHCPv6 CLIENT: Sent SOLICIT
Jul 17 18:55:52 networkd-pd-test systemd-networkd[357]: DHCPv6 CLIENT: Next retransmission in 1s
Jul 17 18:55:52 networkd-pd-test systemd-networkd[357]: DHCPv6 CLIENT: Computed IA NA T1 3600s and T2 5760s as both were zero
Jul 17 18:55:52 networkd-pd-test systemd-networkd[357]: DHCPv6 CLIENT: Computed IA PD T1 3600s and T2 5760s as both were zero
Jul 17 18:55:52 networkd-pd-test systemd-networkd[357]: DHCPv6 CLIENT: Recv ADVERTISE
Jul 17 18:55:52 networkd-pd-test systemd-networkd[357]: ens3: Removing address: fdb8:5b81:0:c999:a9ee:fe27:51d8:32a4/128 (valid for 1h 57min 30s)
Jul 17 18:55:52 networkd-pd-test systemd-networkd[357]: ens3: Updating address: 192.168.1.11/24 (valid for 1h 36min 38s)
Jul 17 18:55:52 networkd-pd-test systemd-networkd[357]: ens3: DHCP: No routes received from DHCP server: No data available
Jul 17 18:55:52 networkd-pd-test systemd-networkd[357]: ens3: Configured
Jul 17 18:55:52 networkd-pd-test systemd-networkd[357]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/network1/link/_32 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=26 reply_cookie=0 signature=sa{sv}as error-name=n/>
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: DHCPv6 CLIENT: Sent REQUEST
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: DHCPv6 CLIENT: Next retransmission in 962ms
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: DHCPv6 CLIENT: Computed IA NA T1 3600s and T2 5760s as both were zero
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: DHCPv6 CLIENT: Computed IA PD T1 3600s and T2 5760s as both were zero
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: DHCPv6 CLIENT: T1 expires in 1h 2min 6s
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: DHCPv6 CLIENT: T2 expires in 1h 37min
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: ens3: DHCPv6 address fdb8:5b81:0:c999:a9ee:fe27:51d8:32a4/128 timeout preferred 4500 valid 7200
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: ens3: Assigning up to 65536 prefixes from fdb8:5b81:100::/48
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: ens6: Link is not managed by us
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: lo: Link is not managed by us
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: RADV: Stopping IPv6 Router Advertisement daemon
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: RADV: Updated prefix fdb8:5b81:100::/64 preferred 1h 15min valid 2h
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: RADV: Started IPv6 Router Advertisement daemon
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: ens5: Assigned prefix 1/65536 fdb8:5b81:100::/64 to link
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: RADV: Stopping IPv6 Router Advertisement daemon
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: RADV: Updated prefix fdb8:5b81:101::/64 preferred 1h 15min valid 2h
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: RADV: Started IPv6 Router Advertisement daemon
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: ens4: Assigned prefix 2/65536 fdb8:5b81:100::/64 to link
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: Assertion 'callback' failed at ../systemd-stable/src/libsystemd/sd-netlink/sd-netlink.c:530, function sd_netlink_call_async(). Ignoring.
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: Could not send rtnetlink message: Invalid argument
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: ens3: DHCPv6 did not receive prefixes to delegate
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: DHCPv6 CLIENT: Recv REPLY
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: RADV: Next Router Advertisement in 11s
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: RADV: Next Router Advertisement in 5s
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: ens5: Could not read IPv6 address from DHCPv6 Prefix Delegation while adding route: Operation not supported
Jul 17 18:55:53 networkd-pd-test systemd-networkd[357]: ens4: Could not read IPv6 address from DHCPv6 Prefix Delegation while adding route: Operation not supported
Jul 17 18:55:54 networkd-pd-test systemd-networkd[357]: ens3: Updating address: fdb8:5b81:0:c999:a9ee:fe27:51d8:32a4/128 (valid for 1h 59min 59s)
Jul 17 18:55:59 networkd-pd-test systemd-networkd[357]: RADV: Next Router Advertisement in 15s
Jul 17 18:56:04 networkd-pd-test systemd-networkd[357]: LLDP: Successfully processed LLDP datagram.
Jul 17 18:56:04 networkd-pd-test systemd-networkd[357]: NDISC: No RA received before link confirmation timeout
Jul 17 18:56:04 networkd-pd-test systemd-networkd[357]: NDISC: Invoking callback for 't'.
Jul 17 18:56:05 networkd-pd-test systemd-networkd[357]: RADV: Next Router Advertisement in 6s
Jul 17 18:56:11 networkd-pd-test systemd-networkd[357]: RADV: Next Router Advertisement in 7s
Jul 17 18:56:14 networkd-pd-test systemd-networkd[357]: RADV: Next Router Advertisement in 11s
Jul 17 18:56:18 networkd-pd-test systemd-networkd[357]: RADV: Next Router Advertisement in 9min 13s

Additional Notes
The routing table entries and what networkd announces via Router Advertisements is consistent, e.g. the routing table looks like

fdb8:5b81:100::/64 dev ens5 metric 1024 pref medium
fdb8:5b81:101::/64 dev ens4 metric 1024 pref medium

and networkd actually announces fdb8:5b81:100::/64 on ens5 and fdb8:5b81:101::/64 on ens4. Hosts in both these networks can even reach each other.

Activity

  1. halvors commented on Jul 18, 2018

    @halvors

    The code actually finding these /64 network based on the /48 assigned thru prefix delegation is located here: https://github.com/systemd/systemd/blob/master/src/basic/in-addr-util.c#L182

    How this is currently done is just fine except that it needs to start to increment from within prefix space.

  2. poettering commented on Jul 18, 2018

    @poettering
    Member

    /cc @pfl

  3. self-assigned this
    on Jul 30, 2018
  4. pfl commented on Jul 31, 2018

    @pfl
    Contributor

    Looks like the code computing the next prefix should look like:

    -                r = in_addr_prefix_next(AF_INET6, &prefix, pd_prefix_len);
    +                r = in_addr_prefix_next(AF_INET6, &prefix, 64);
    

    but I need to write a test case to confirm this.

  5. flokli commented on Aug 19, 2018

    @flokli
    Contributor

    @pfl shouldn't this take a look at the requesting clients prefix-length field (if possible to satisfy), as described in https://tools.ietf.org/html/rfc3633#section-11.2 ?

  6. added a commit that references this issue on Aug 27, 2018
    37f5240
  7. added a commit that references this issue on Oct 31, 2018
    ba81c4f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions