Skip to content

[th/nmcli-gateway-clear-never-default] cli: unset "ipv[46].never-default" when setting "ipv[46].gateway"

Thomas Haller requested to merge th/nmcli-gateway-clear-never-default into master

Since commit c1907a21 ('libnm-core: remove gateway when never-default=yes in NMSettingIPConfig'), the gateway gets normalized away when the profile has never-default set.

That means,

  $ nmcli connection modify "$PROFILE" ipv4.never-default yes ipv4.gateway 192.168.77.1

does not set the gateway. Likewise, if your profile has already never-default enabled,

  $ nmcli connection modify "$PROFILE" ipv4.gateway 192.168.77.1

will have no effect. That is confusing and undesirable.

Note that we don't adjust the GObject property setter for "gateway" to clear never-default. I feel, setting one property in libnm should preferably not unset another (there are exceptions to the rule, like for team properties). However, for nmcli it's clear in which order properties are set, so this change is right for the client tool.

https://bugzilla.redhat.com/show_bug.cgi?id=1785039

Merge request reports