networkd: [Route] PreferredSource not working in *.network files

Bug #1812760 reported by Daniel Axtens
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
systemd
Fix Released
Undecided
Unassigned
systemd (Ubuntu)
Fix Released
Medium
Dimitri John Ledkov
Bionic
Fix Released
Medium
Dan Streetman
Cosmic
Fix Released
Medium
Dan Streetman
Disco
Fix Released
Medium
Dimitri John Ledkov

Bug Description

[Impact]

Users cannot create IPv6 routes that specify PreferredSource. This means that users cannot specify a number of valid IPv6 routes that are useful in some circumstances. These routes can be created with the 'ip' tool, just not with systemd.

This was reported upstream in systemd issue #5882 is fixed by pulling in the changes in systemd PR #11375 - https://github.com/systemd/systemd/pull/11375

[Test Case]

Start a Bionic or Cosmic VM.

Add the following netplan yaml (adjust for ethernet card and MAC):

network:
    version: 2
    ethernets:
        ens3:
            dhcp4: true
            match:
                macaddress: 52:54:00:e2:c2:d7
            set-name: ens3
            addresses: ["fd8f:1d7d:b141::2/64", "fd8f:1d7d:b141::200/64"]
            routes:
              - to: "a::/16"
                via: "fd8f:1d7d:b141::1"
                from: "fd8f:1d7d:b141::2"
              - to: "fd8f:1d7d:b141::/64"
                scope: link
                from: "fd8f:1d7d:b141::2"
                metric: 255

Run netplan apply or reboot. Wait ~10s.

Alternately, to test without netplan, configure systemd-networkd with:

[Match]
Name=ens3

[Network]
DHCP=ipv4
LinkLocalAddressing=ipv6
Address=fd8f:1d7d:b141::2/64
Address=fd8f:1d7d:b141::200/64

[Route]
Destination=a::/16
Gateway=fd8f:1d7d:b141::1
PreferredSource=fd8f:1d7d:b141::2

[Route]
Destination=fd8f:1d7d:b141::/64
PreferredSource=fd8f:1d7d:b141::2
Scope=link
Metric=255

[DHCP]
UseMTU=true
RouteMetric=100

Currently, ip -6 route will not include a route to "a::/16", and will not include the route to "fd8f:1d7d:b141::/64" that has "fd8f:1d7d:b141::2" as the source address - both those addresses will be missing.

Correct behaviour is for ip -6 route to report the following:

ubuntu@b-np:~$ ip -6 route
a::/16 via fd8f:1d7d:b141::1 dev ens3 proto static src fd8f:1d7d:b141::2 metric 1024 pref medium
fd8f:1d7d:b141::/64 dev ens3 proto static src fd8f:1d7d:b141::2 metric 255 pref medium
fd8f:1d7d:b141::/64 dev ens3 proto kernel metric 256 pref medium
fe80::/64 dev ens3 proto kernel metric 256 pref medium

Check before and after upgrade that 'systemctl status network-online.target' shows that the target has been reached.

[Regression Potential]

This changes the state machine in systemd which configures the links. It passes systemd's internal tests, and has been approved by systemd maintainers, but it remains possible that the changes will break the configuration of obscure network setups.

The backport requires pulling in two further commits that also change behaviour: currently systemd deletes all addresses and routes that were attached to an interface. With this change, it will only delete those that are not specified in the configuration files. A side effect of this is that restarting networkd will not cause remove/add netlink events to be emitted for these addresses, so if anyone is relying on this behavior this will break compatibility; but that is an unlikely thing to be relying on, and it seems worth this risk to reduce unnecessary network state changes.

Related branches

Daniel Axtens (daxtens)
Changed in systemd (Ubuntu):
status: Confirmed → In Progress
assignee: nobody → Daniel Axtens (daxtens)
Daniel Axtens (daxtens)
tags: added: sts
Dan Streetman (ddstreet)
Changed in systemd (Ubuntu Bionic):
status: New → In Progress
Changed in systemd (Ubuntu Cosmic):
status: New → In Progress
Changed in systemd (Ubuntu Bionic):
importance: Undecided → Medium
Changed in systemd (Ubuntu Cosmic):
importance: Undecided → Medium
Changed in systemd (Ubuntu Disco):
importance: Undecided → Medium
Changed in systemd (Ubuntu Cosmic):
assignee: nobody → Daniel Axtens (daxtens)
Changed in systemd (Ubuntu Bionic):
assignee: nobody → Daniel Axtens (daxtens)
Changed in systemd (Ubuntu Disco):
status: In Progress → Fix Committed
assignee: Daniel Axtens (daxtens) → Dimitri John Ledkov (xnox)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 240-5ubuntu3

---------------
systemd (240-5ubuntu3) disco; urgency=medium

  * debian/tests: blacklist upstream test-24-unit-tests on ppc64le.
    Fails, not a regression as it's a new test case, which was never before
    executed on ppc64le.
    File: debian/tests/upstream
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=8062b9a2712c390010d2948eaf764a1b52e68715

 -- Dimitri John Ledkov <email address hidden> Sat, 02 Feb 2019 11:05:12 +0100

Changed in systemd (Ubuntu Disco):
status: Fix Committed → Fix Released
Changed in systemd (Ubuntu Cosmic):
status: In Progress → Triaged
Dan Streetman (ddstreet)
Changed in systemd (Ubuntu Cosmic):
assignee: Daniel Axtens (daxtens) → Dan Streetman (ddstreet)
Changed in systemd (Ubuntu Bionic):
assignee: Daniel Axtens (daxtens) → Dan Streetman (ddstreet)
Changed in systemd (Ubuntu Cosmic):
status: Triaged → In Progress
Revision history for this message
Steve Langasek (vorlon) wrote :

I've extended the test case to require an explicit check that 'network-online.target' is still handled as expected after this change.

description: updated
Revision history for this message
Steve Langasek (vorlon) wrote :

And added some more on regression potential.

description: updated
Changed in systemd (Ubuntu Cosmic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-cosmic
Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello Daniel, or anyone else affected,

Accepted systemd into cosmic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/systemd/239-7ubuntu10.9 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-cosmic to verification-done-cosmic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-cosmic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in systemd (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed-bionic
Revision history for this message
Steve Langasek (vorlon) wrote :

Hello Daniel, or anyone else affected,

Accepted systemd into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/systemd/237-3ubuntu10.14 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Richard Laager (rlaager) wrote :

I was an affected user. I have confirmed that the package from bionic-proposed works. I do not have any systems installed with Cosmic.

tags: added: verification-done-bionic
removed: verification-needed-bionic
tags: added: verification-failed verification-failed-bionic
removed: verification-done-bionic verification-needed
Revision history for this message
Dan Streetman (ddstreet) wrote :

@seb128 if you found a problem/regression, please add a comment; I'm reverting your marking this bug as verification-failed because I don't know why you marked it that way without explanation.

tags: added: verification-done-bionic verification-needed
removed: verification-failed verification-failed-bionic
Revision history for this message
Dan Streetman (ddstreet) wrote :

cosmic:

root@systemd-c:~# dpkg -l | grep libsystemd0
ii libsystemd0:amd64 239-7ubuntu10.8 amd64 systemd utility library
root@systemd-c:~# netplan apply
root@systemd-c:~# ip -6 r
::1 dev lo proto kernel metric 256 pref medium
fd8f:1d7d:b141::/64 dev ens3 proto kernel metric 256 pref medium
fe80::/64 dev ens3 proto kernel metric 256 pref medium

root@systemd-c:~# dpkg -l | grep libsystemd0
ii libsystemd0:amd64 239-7ubuntu10.9 amd64 systemd utility library
root@systemd-c:~# netplan apply
root@systemd-c:~# ip -6 r
::1 dev lo proto kernel metric 256 pref medium
a::/16 via fd8f:1d7d:b141::1 dev ens3 proto static src fd8f:1d7d:b141::2 metric 1024 pref medium
fd8f:1d7d:b141::/64 dev ens3 proto static src fd8f:1d7d:b141::2 metric 255 pref medium
fd8f:1d7d:b141::/64 dev ens3 proto kernel metric 256 pref medium
fe80::/64 dev ens3 proto kernel metric 256 pref medium

tags: added: verification-done verification-done-cosmic
removed: verification-needed verification-needed-cosmic
Revision history for this message
Sebastien Bacher (seb128) wrote :

Sorry, I forgot to comment here, but I did subscribe you to the regression bug #1818340. Tagging again verification-failed until the other report is cleared of to be a regression with the SRU, so we avoid accidentally copying a buggy version to -updates

tags: added: verification-failed verification-failed-bionic
removed: verification-done verification-done-bionic
Revision history for this message
Dan Streetman (ddstreet) wrote :

bionic:

root@systemd-b:~# dpkg -l | grep libsystemd0
ii libsystemd0:amd64 237-3ubuntu10.13 amd64 systemd utility library
root@systemd-b:~# netplan apply
root@systemd-b:~# ip -6 r
fd8f:1d7d:b141::/64 dev ens3 proto kernel metric 256 pref medium
fe80::/64 dev ens3 proto kernel metric 256 pref medium

root@systemd-b:~# dpkg -l | grep libsystemd0
ii libsystemd0:amd64 237-3ubuntu10.14 amd64 systemd utility library
root@systemd-b:~# netplan apply
root@systemd-b:~# ip -6 r
a::/16 via fd8f:1d7d:b141::1 dev ens3 proto static src fd8f:1d7d:b141::2 metric 1024 pref medium
fd8f:1d7d:b141::/64 dev ens3 proto static src fd8f:1d7d:b141::2 metric 255 pref medium
fd8f:1d7d:b141::/64 dev ens3 proto kernel metric 256 pref medium
fe80::/64 dev ens3 proto kernel metric 256 pref medium

Revision history for this message
Dan Streetman (ddstreet) wrote :

verified test case for this bug passes b/c, but pending bug 1818340 per comment 9

Revision history for this message
Dan Streetman (ddstreet) wrote :

backport for this bug is incomplete/incorrect - the patches only partially introduce state handling changes from upstream, and introduce serious regressions as shown in bug 1818340.

Reverting these patches for now, until re-evaluation of the backport can be done.

tags: added: verification-failed-cosmic
removed: verification-done-cosmic
Dan Streetman (ddstreet)
Changed in systemd (Ubuntu Bionic):
status: Fix Committed → In Progress
Changed in systemd (Ubuntu Cosmic):
status: Fix Committed → In Progress
Dan Streetman (ddstreet)
tags: removed: verification-failed verification-failed-bionic verification-failed-cosmic
Revision history for this message
Dan Streetman (ddstreet) wrote :

note that the SRU pending page lists this bug as part of the current b/c sru for system, (versions 239-7ubuntu10.10 and 237-3ubuntu10.15) but the patches for this bug have been removed from that sru, so this bug no longer applies to that specific sru and should not block its release.

Dan Streetman (ddstreet)
description: updated
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello Daniel, or anyone else affected,

Accepted systemd into cosmic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/systemd/239-7ubuntu10.13 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-cosmic to verification-done-cosmic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-cosmic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in systemd (Ubuntu Cosmic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-cosmic
Changed in systemd (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed-bionic
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello Daniel, or anyone else affected,

Accepted systemd into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/systemd/237-3ubuntu10.20 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Richard Laager (rlaager) wrote :
Download full text (3.3 KiB)

I was able to verify this on Bionic:

rlaager@bison:~$ ip -6 route show
2600:2600::/64 dev ens3 proto kernel metric 256 pref medium
fe80::/64 dev ens3 proto kernel metric 256 pref medium
default via 2600:2600::254 dev ens3 proto static metric 1024 pref medium
rlaager@bison:~$ sudo apt update
...
rlaager@bison:~$ sudo apt install -t bionic-proposed systemd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-image-4.15.0-34-generic linux-image-4.15.0-36-generic linux-image-4.15.0-43-generic linux-modules-4.15.0-34-generic linux-modules-4.15.0-36-generic linux-modules-4.15.0-43-generic
  linux-modules-extra-4.15.0-34-generic linux-modules-extra-4.15.0-36-generic linux-modules-extra-4.15.0-43-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libnss-resolve libnss-systemd libsystemd0
Suggested packages:
  systemd-container policykit-1
Recommended packages:
  libpam-systemd
The following packages will be upgraded:
  libnss-resolve libnss-systemd libsystemd0 systemd
4 upgraded, 0 newly installed, 0 to remove and 80 not upgraded.
Need to get 3,318 kB of archives.
After this operation, 3,072 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirror.steadfast.net/ubuntu bionic-proposed/main amd64 libnss-systemd amd64 237-3ubuntu10.20 [105 kB]
Get:2 http://mirror.steadfast.net/ubuntu bionic-proposed/universe amd64 libnss-resolve amd64 237-3ubuntu10.20 [107 kB]
Get:3 http://mirror.steadfast.net/ubuntu bionic-proposed/main amd64 systemd amd64 237-3ubuntu10.20 [2,902 kB]
Get:4 http://mirror.steadfast.net/ubuntu bionic-proposed/main amd64 libsystemd0 amd64 237-3ubuntu10.20 [204 kB]
Fetched 3,318 kB in 0s (13.0 MB/s)
(Reading database ... 64877 files and directories currently installed.)
Preparing to unpack .../libnss-systemd_237-3ubuntu10.20_amd64.deb ...
Unpacking libnss-systemd:amd64 (237-3ubuntu10.20) over (237-3ubuntu10.15) ...
Preparing to unpack .../libnss-resolve_237-3ubuntu10.20_amd64.deb ...
Unpacking libnss-resolve:amd64 (237-3ubuntu10.20) over (237-3ubuntu10.15) ...
Preparing to unpack .../systemd_237-3ubuntu10.20_amd64.deb ...
Unpacking systemd (237-3ubuntu10.20) over (237-3ubuntu10.15) ...
Preparing to unpack .../libsystemd0_237-3ubuntu10.20_amd64.deb ...
Unpacking libsystemd0:amd64 (237-3ubuntu10.20) over (237-3ubuntu10.15) ...
Setting up libsystemd0:amd64 (237-3ubuntu10.20) ...
Processing triggers for ureadahead (0.100.0-20) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up systemd (237-3ubuntu10.20) ...
Setting up libnss-resolve:amd64 (237-3ubuntu10.20) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for dbus (1.12.2-1ubuntu1) ...
Setting up libnss-systemd:amd64 (237-3ubuntu10.20) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
rlaager@bison:~$ sudo systemctl daemon-reload
rlaager@bison:~$ sudo netplan apply
rlaager@bison:~$ ip -6 route show
2600:2600::/64 dev ens3 proto static src 2600:2600::26 metric 255 pref medium
2600:2600::/64 dev ens3 proto kernel metric 2...

Read more...

tags: added: verification-done-bionic
removed: verification-needed-bionic
Revision history for this message
Dan Streetman (ddstreet) wrote :

cosmic (using systemd-networkd config from description test case):

ubuntu@lp1812760-c:~$ dpkg -l |grep 'ii systemd '
ii systemd 239-7ubuntu10.12 amd64 system and service manager
ubuntu@lp1812760-c:~$ ip -6 r
::1 dev lo proto kernel metric 256 pref medium
fd8f:1d7d:b141::/64 dev ens3 proto kernel metric 256 pref medium
fe80::/64 dev ens3 proto kernel metric 256 pref medium

ubuntu@lp1812760-c:~$ dpkg -l |grep 'ii systemd '
ii systemd 239-7ubuntu10.13 amd64 system and service manager
ubuntu@lp1812760-c:~$ ip -6 r
::1 dev lo proto kernel metric 256 pref medium
a::/16 via fd8f:1d7d:b141::1 dev ens3 proto static src fd8f:1d7d:b141::2 metric 1024 pref medium
fd8f:1d7d:b141::/64 dev ens3 proto static src fd8f:1d7d:b141::2 metric 255 pref medium
fd8f:1d7d:b141::/64 dev ens3 proto kernel metric 256 pref medium
fe80::/64 dev ens3 proto kernel metric 256 pref medium

tags: added: verification-done verification-done-cosmic
removed: verification-needed verification-needed-cosmic
Revision history for this message
Dan Streetman (ddstreet) wrote :

changing upstream github bug watch to manual, as the import of github issue status seems broken

Changed in systemd:
importance: Unknown → Undecided
status: Unknown → New
status: New → Fix Released
Revision history for this message
Dan Streetman (ddstreet) wrote :

as this upload covers two bugs, let's put the autopkgtest regression analysis into the other bug 1818282

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 239-7ubuntu10.13

---------------
systemd (239-7ubuntu10.13) cosmic; urgency=medium

  [ Ioanna Alifieraki ]
  * d/p/backport_network-fix-return-value-of-routing_policy_rule_get.patch,
    d/p/backport_network-remove-routing-policy-rule-from-foreign.patch,
    d/p/backport_network-do-not-remove-rule-when-requested-by-existing-links.patch:
      - Fix RoutingPolicyRule does not apply correctly (LP: #1818282)

  [ Dan Streetman ]
  * d/p/networkd-Track-address-configuration.patch,
    d/p/networkd-Use-only-a-generic-CONFIGURING-state.patch,
    d/p/networkd-don-t-remove-route.patch,
    d/p/networkd-don-t-remove-ip-address.patch,
    d/p/Move-link_check_ready-to-later-in-the-file.patch,
    d/p/network-set-_configured-flags-to-false-before-reques.patch,
    d/p/Install-routes-after-addresses-are-ready.patch:
      - PreferredSource not working in *.network files (LP: #1812760)
  * Specify Ubuntu's Vcs-Git

 -- Dan Streetman <email address hidden> Thu, 04 Apr 2019 07:29:38 -0400

Changed in systemd (Ubuntu Cosmic):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for systemd has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 237-3ubuntu10.20

---------------
systemd (237-3ubuntu10.20) bionic; urgency=medium

  [ Ioanna Alifieraki ]
  * d/p/backport_network-fix-return-value-of-routing_policy_rule_get.patch,
    d/p/backport_network-remove-routing-policy-rule-from-foreign.patch,
    d/p/backport_network-do-not-remove-rule-when-requested-by-existing-links.patch:
    - Fix RoutingPolicyRule does not apply correctly (LP: #1818282)

  [ Dan Streetman ]
  * d/p/fix-test-22.patch
    - fix TEST-22 failures
  * d/p/networkd-Track-address-configuration.patch,
    d/p/networkd-Use-only-a-generic-CONFIGURING-state.patch,
    d/p/networkd-don-t-remove-route.patch,
    d/p/networkd-don-t-remove-ip-address.patch,
    d/p/Move-link_check_ready-to-later-in-the-file.patch,
    d/p/network-set-_configured-flags-to-false-before-reques.patch,
    d/p/Install-routes-after-addresses-are-ready.patch:
    - PreferredSource not working in *.network files (LP: #1812760)

  [ Dimitri John Ledkov ]
  * Specify Ubuntu's Vcs-Git

 -- Dan Streetman <email address hidden> Thu, 04 Apr 2019 07:29:38 -0400

Changed in systemd (Ubuntu Bionic):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.