Migrate deprecated "CriticalConnection" attribute to "KeepConfiguration" (systemd-networkd)

Bug #1896799 reported by Chris Aumann
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Netplan
Triaged
Medium
Unassigned

Bug Description

With systemd-v243 (which is the default since focal), the "CriticalConnection" attribute was
revamped into "KeepConfiguration" [1], addressing several issues, especially in high-availability
environents [2][3].

The new "KeepConfiguration" setting can take multiple arguments, according to the documentation
[4]:

> Takes a boolean or one of "static", "dhcp-on-stop", "dhcp". When "static", systemd-networkd will
> not drop static addresses and routes on starting up process. When set to "dhcp-on-stop",
> systemd-networkd will not drop addresses and routes on stopping the daemon. When "dhcp", the
> addresses and routes provided by a DHCP server will never be dropped even if the DHCP lease
> expires. This is contrary to the DHCP specification, but may be the best choice if, e.g., the
> root filesystem relies on this connection. The setting "dhcp" implies "dhcp-on-stop", and "yes"
> implies "dhcp" and "static". Defaults to "no".

If I understand the code correctly, it still uses "CriticalConnection" when setting "critical: true" in the netplan configuration.

- [1] https://github.com/systemd/systemd/pull/12511/files
- [2] https://github.com/systemd/systemd/issues/12050
- [3] https://chr4.org/blog/2019/01/21/make-keepalived-play-nicely-with-netplan-slash-systemd-network/
- [4] https://systemd.network/systemd.network.html#KeepConfiguration=

I could dedicate some time working working on this if help is wanted.

Revision history for this message
Lukas Märdian (slyon) wrote :

Thanks for your report, pull requests are always welcome!

This might also be related to: https://bugs.launchpad.net/netplan/+bug/1815101

Changed in netplan:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Hans van den Bogert (hbogert) wrote :

If some guidance can be given, then I'm up to implementing this as well.

Revision history for this message
Lukas Märdian (slyon) wrote :

Thank you very much, have a look how the "CriticalConnection" stanza is written here and feel free to open a pull request on GitHub: https://github.com/canonical/netplan/blob/main/src/networkd.c#L924

Revision history for this message
Chris Aumann (chr4) wrote :

I've added a pull request here: https://github.com/canonical/netplan/pull/409, feel free to review/ contribute/ give feedback!

Revision history for this message
Danilo Egea Gondolfo (danilogondolfo) wrote :

Hi Chris, thanks for bringing this to our attention and for your PR.

I just took a look at it today. Please check my comments in https://github.com/canonical/netplan/pull/409#issuecomment-1729410106

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.