config: add write support for NMConfig

System Internals / NetworkManager - Thomas Haller [redhat.com] - 2 July 2015 09:01 UTC

Internal configuration is written as keyfile to NMSTATEDIR"/NetworkManager-intern.conf"

Basically, the content of this file is merged with user configuration from "NetworkManager.conf" files. After loading the configuration, NMConfig exposes a merged view of user-provided settings and internal overwrites.

All sections/groups named [.intern*] are reserved for internal configuration values. They can be written by API, but are ignored when the user sets them via "NetworkManager.conf". For these internal sections, no conflicts can arise.

We can also overwrite individual properties from user configuration. In this case, we store the value we want to set, but also remember the value that the user configuration had, at the time of setting. If on a later reload the user configuration changed, we ignore our internal value -- as we assume that the user modified the value afterwards. We can also hide/delete value from user configuration. This works on a per-setting basis.

947fc9a config: add write support for NMConfig
man/NetworkManager.conf.xml.in | 17 +-
src/devices/nm-device.c | 2 +-
src/nm-config-data.c | 181 ++++++++++++++--
src/nm-config-data.h | 24 ++-
src/nm-config.c | 468 ++++++++++++++++++++++++++++++++++++++--
src/nm-config.h | 11 +
src/tests/config/test-config.c | 22 +-
7 files changed, 677 insertions(+), 48 deletions(-)

Upstream: cgit.freedesktop.org


  • Share