802-3-ethernet.wake-on-lan nmcli strange behavior

Thomas Haller thaller at redhat.com
Tue Aug 6 11:42:10 UTC 2024


On Tue, 2024-08-06 at 13:29 +0200, Íñigo Huguet wrote:
> wake-on-lan is a flags type property. Because of that, when you do
> `set wake-on-lan magic`, nmcli/NM sets the `magic` single flag, not
> the whole value of `wake-on-lan`. Sadly, there are at least 2
> problems:
> 1. The special values "default" and "ignore" are treated internally
> just as a normal flag. However, they should be treated as special
> values that don't make sense if any other else is set.
> 2. none/disable/disabled are added in the code as special values to
> clear all the other values. However, nmcli is probably trying to add
> it as an individual flag again, instead of replacing the whole value
> of the variable. And as it's value is 0x00, it has no effect (it's
> like prev_value |= 0x00).

3. in the interactive editor, "set" really means "append"/"add". We can
see that with list-typed properties (like ipv4.addresses), where it
makes some sense. It also does an add for flag-typed properties. I
think that was  a bug when initially implemented, but that behavior was
intentionally kept so far. Maybe it should be fixed and add instead a
"add"/"append" command.


But why us `nmcli connection edit`? With `nmcli connection modify` you
can also change multiple properties at once:

  $ nmcli --offline connection add type ethernet 802-3-ethernet.wake-on-lan default | \
      nmcli --offline connection modify 802-3-ethernet.wake-on-lan magic
  ...

For good reasons, you would have the same problem with the +802-3-
ethernet.wake-on-lan modifier:

  $ nmcli --offline connection add type ethernet 802-3-ethernet.wake-on-lan default | \
      nmcli --offline connection modify +802-3-ethernet.wake-on-lan magic
  Error: Error writing connection: 802-3-ethernet.wake-on-lan: Wake-on-LAN mode 'default' and 'ignore' are exclusive flags

I think the latter example shows correct behavior.

If there is anything to fix, then that "set" in interactive mode does
not do an append. But that's a change in behavior... in an interactive
tool, so OK(??).


Maybe the real answer is: don't use `nmcli connection edit`. IMO it
should have never been added.


Thomas

> 
> I've created a bug report for it:
> https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1593
> 
> On Mon, Jul 29, 2024 at 8:38 PM Marco Moock <mm at dorfdsl.de> wrote:
> > 
> > Hello!
> > 
> > nmcli> print 802-3-ethernet.wake-on-lan
> > 802-3-ethernet.wake-on-lan: magic, default
> > nmcli> set 802-3-ethernet.wake-on-lan
> > Allowed values for 'wake-on-lan' property: phy, unicast, multicast,
> > broadcast, arp, magic, default, ignore, none, disable, disabled
> > Enter 'wake-on-lan' value: magic
> > nmcli> save
> > Error: connection verification failed: 802-3-ethernet.wake-on-lan:
> > Wake-on-LAN mode 'default' and 'ignore' are exclusive flags
> > You may try running 'verify fix' to fix errors.
> > nmcli>
> > 
> > From where does the "ignore" come here?
> > 
> > Why doesn't it clear the property when using none?
> > 
> > nmcli> set 802-3-ethernet.wake-on-lan
> > Allowed values for 'wake-on-lan' property: phy, unicast, multicast,
> > broadcast, arp, magic, default, ignore, none, disable, disabled
> > Enter 'wake-on-lan' value: none
> > nmcli> print 802-3-ethernet.wake-on-lan
> > 802-3-ethernet.wake-on-lan: magic, default
> > nmcli>
> > 
> > ethtool says: Supports Wake-on: pumbg
> > 
> > 
> > --
> > Gruß
> > Marco
> > 
> 
> 



More information about the Networkmanager mailing list