Skip to content

settings: preserve existing connection flags on update

Beniamino Galvani requested to merge bg/connection-flags into main

We are passing to the plugin only 'sett_flags', which is the bitmask of flags to change and works together with 'sett_mask'; however, plugins interpret that value as the new flags value. The result is that if there is no change needed (0/0), the existing flags are lost. Simple reproducer:

  ip link add dummy1 type dummy
  ip link set dummy1 up
  ip addr add dev dummy1 fd01::12/64
  sleep 1

  # now, a external connection is created by NM

  echo "BEFORE:"
  cat /run/NetworkManager/system-connections/dummy1.nmconnection | grep "nm-generated\|volatile\|external"

  # just add a new address to the interface to make it lose
  # the external flag

  ip addr add dev dummy1 172.25.42.1/24
  sleep 1

  echo "AFTER:"
  cat /run/NetworkManager/system-connections/dummy1.nmconnection | grep "nm-generated\|volatile\|external"

Output:

  BEFORE:
  nm-generated=true
  volatile=true
  external=true
  AFTER:

Fixes: d35d3c46 ('settings: rework tracking settings connections and settings plugins')

Merge request reports