NetworkManager/src
Thomas Haller 07262b165d ifcfg-rh: clear all untouched, known keys before writing ifcfg-rh file
When we write a connection profile to ifcfg-rh file, we first load the
possibly existing file and modify it. The purpose is to preserve
variables that we don't know about, keep comments and preserve the order
of the variables.

Note that the writer sets a bunch of variables according to the
profile's setting. At various places the writer would explicitly
clear variables with svUnsetValue(). However, that was problematic:

- we would not unset all variables that we care about. We really should
  not leave previous variables if they make no sense anymore for the
  profile. The only thing we want to preserve are entirely unknown keys
  and comments. Note that when the writer omits to clear an unset variable,
  it usually does so assuming that the reader would anyway ignore the
  key, become some other key renders it irrelevant. Given the complexity
  of the reader and writer, that is often not the case and hard to ensure.

  We might have simply forgotten a svUnsetValue(), which was an easy
  to make mistake and hard to find (because you'd have to test with
  a pre-existing profile that happens to contain that key, which leaves
  countless combinations for testing.

  That means, a profile written by the writter might be interpreted
  differently by the reader depending on which pre-existing keys were set.

- it was cumbersome to explicitly call svUnsetValue().
  Note that for numbered tags in particular we would iterate the keys
  trying to unset them. For example for addresses (like "IPADDR5") we
  would iterate over the first 256 IPADDR keys, trying to unset them.
  That is horrible. For one, it doesn't cover the case where there might
  be more than 256 addresses. Also, it adds a significant overhead every
  time.
  While writing a ifcfg file currently is O(n^2) because setting one key
  is O(l), with l being the number of keys/lines. So, if you set n keys
  in a file with l lines, you get O(n*l). Which is basically O(n^2),
  because the number of lines and the number of keys to set usually
  corresponds.
  So when setting 256 times IPADDR, the overall complexity was still
  O(n^2 + 256 * n) and didn't change. However, the 256 factor here can
  be very significant.

We should not explicitly unset variables, we should always unset all
known variables that we don't explicitly set.

The svUnsetValue() calls are still there. They will be dropped next.
2019-12-21 12:44:23 +01:00
..
devices core: add and indicate NM_CAPABILITY_OVS capability on D-Bus 2019-12-21 11:33:59 +01:00
dhcp dhcp: nettools: check return value of g_file_set_contents() 2019-12-18 10:02:48 +01:00
dns all: rename time related function to spell out nsec/usec/msec/sec 2019-12-13 16:54:40 +01:00
dnsmasq meson: Improve the src build file 2019-10-01 09:49:33 +02:00
initrd initrd: don't use inet_aton() to parse IPv4 address 2019-12-05 12:36:13 +01:00
ndisc all: rename time related function to spell out nsec/usec/msec/sec 2019-12-13 16:54:40 +01:00
platform all: rename time related function to spell out nsec/usec/msec/sec 2019-12-13 16:54:40 +01:00
ppp all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
settings ifcfg-rh: clear all untouched, known keys before writing ifcfg-rh file 2019-12-21 12:44:23 +01:00
supplicant all: rename time related function to spell out nsec/usec/msec/sec 2019-12-13 16:54:40 +01:00
systemd systemd: merge branch systemd into master 2019-12-16 10:22:09 +01:00
tests all: rename time related function to spell out nsec/usec/msec/sec 2019-12-13 16:54:40 +01:00
vpn all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
main-utils.c all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
main-utils.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
main.c config: print config warnings during NetworkManager --print-config 2019-12-11 11:52:05 +01:00
meson.build meson: Improve the src build file 2019-10-01 09:49:33 +02:00
NetworkManagerUtils.c utils: alow matching ipv6 new method 'disable' 2019-11-18 11:07:18 +01:00
NetworkManagerUtils.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-act-request.c all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-act-request.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-active-connection.c core: don't use pointer value for pending action string in active-connection 2019-10-14 16:37:16 +02:00
nm-active-connection.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-audit-manager.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-audit-manager.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-auth-manager.c core: add main.auth-polkit option "root-only" 2019-12-11 11:52:05 +01:00
nm-auth-manager.h core: add main.auth-polkit option "root-only" 2019-12-11 11:52:05 +01:00
nm-auth-subject.c all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-auth-subject.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-auth-utils.c all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-auth-utils.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-checkpoint-manager.c all: use nm_dbus_path_not_empty() 2019-11-07 11:34:36 +01:00
nm-checkpoint-manager.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-checkpoint.c all: rename time related function to spell out nsec/usec/msec/sec 2019-12-13 16:54:40 +01:00
nm-checkpoint.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-config-data.c config: emit warning about invalid main.auth-polkit setting 2019-12-11 11:52:05 +01:00
nm-config-data.h config: add nm_config_data_get_warnings() to get additional warnings about wrong configuration 2019-12-11 11:52:05 +01:00
nm-config.c config: add nm_config_data_get_warnings() to get additional warnings about wrong configuration 2019-12-11 11:52:05 +01:00
nm-config.h core: add main.auth-polkit option "root-only" 2019-12-11 11:52:05 +01:00
nm-connectivity.c all: rename time related function to spell out nsec/usec/msec/sec 2019-12-13 16:54:40 +01:00
nm-connectivity.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-core-utils.c all: rename time related function to spell out nsec/usec/msec/sec 2019-12-13 16:54:40 +01:00
nm-core-utils.h core: remove 'legacy_unstable_byteorder' argument from client-id helpers 2019-12-02 17:50:40 +01:00
nm-dbus-manager.c all: rename time related function to spell out nsec/usec/msec/sec 2019-12-13 16:54:40 +01:00
nm-dbus-manager.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-dbus-object.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-dbus-object.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-dbus-utils.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-dbus-utils.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-dcb.c all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-dcb.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-dhcp4-config.c all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-dhcp4-config.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-dhcp6-config.c all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-dhcp6-config.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-dispatcher.c all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-dispatcher.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-firewall-manager.c all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-firewall-manager.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-hostname-manager.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-hostname-manager.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-iface-helper.c dhcp: support FQDN flags in the dhclient backend 2019-11-28 17:56:35 +01:00
nm-ip4-config.c all: add support for "scope" attribute for IPv4 routes 2019-11-28 00:11:15 +01:00
nm-ip4-config.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-ip6-config.c core: don't add prefix route for external addresses 2019-10-23 21:46:26 +02:00
nm-ip6-config.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-keep-alive.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-keep-alive.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-logging.c all: rename time related function to spell out nsec/usec/msec/sec 2019-12-13 16:54:40 +01:00
nm-logging.h core: move _LOG*() macros to "shared/nm-glib-aux/nm-logging-fwd.h" 2019-11-22 15:32:52 +01:00
nm-manager.c core: add and indicate NM_CAPABILITY_OVS capability on D-Bus 2019-12-21 11:33:59 +01:00
nm-manager.h manager: don't activate device if the parent is missing 2019-11-25 08:58:27 +01:00
nm-netns.c all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-netns.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-pacrunner-manager.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-pacrunner-manager.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-policy.c all: rename time related function to spell out nsec/usec/msec/sec 2019-12-13 16:54:40 +01:00
nm-policy.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-proxy-config.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-proxy-config.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-rfkill-manager.c all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-rfkill-manager.h all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
nm-session-monitor.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-session-monitor.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-sleep-monitor.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-sleep-monitor.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-test-utils-core.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-types.h core: track whether IP addresses are external 2019-10-23 17:44:38 +02:00
org.freedesktop.NetworkManager.conf wifi-p2p: rename Wi-Fi P2P 2019-02-01 17:02:57 +01:00