NetworkManager/libnm-core
Thomas Haller 23b1f8234d libnm/team: fix handling default values and stricter validate team config
For each artifical team property we need to track whether it was
explicitly set (i.e., present in JSON/GVariant or set by the user
via NMSettingTeam/NMSettingTeamPort API).

 --

As a plus, libnm is now no longer concerned with the underling default values
that teamd uses. For example, the effective default value for "notify_peers.count"
depends on the selected runner. But libnm does not need to care, it only cares
wheher the property is set in JSON or not. This also means that the default (e.g. as
interesting to `nmcli -o con show $PROFILE`) is independent from other properties
(like the runner).

Also change the default value for the GObject properties of
NMSettingTeam and NMSettingTeamPort to indicate the "unset" value.
For most properties, the default value is a special value that is
not a valid configuration itself.
For some properties the default value is itself a valid value, namely,
"runner.active", "runner.fast_rate", "port.sticky" and "port.prio".

As far as NMTeamSetting is concerned, it distinguishes between unset
value and set value (including the default value). That means,
when it parses a JSON or GVariant, it will remember whether the property
was present or not.

When using API of NMSettingTeam/NMSettingTeamPort to set a property to the
default value, it marks the property as unset. For example, setting
NM_SETTING_TEAM_RUNNER_ACTIVE to TRUE (the default), means that the
value will not be serialized to JSON/GVariant. For the above 4
properties (where the default value is itself a valid value) this is a
limitation of libnm API, as it does not allow to explicitly set
'"runner": { "active": true }'. See SET_FIELD_MODE_SET_UNLESS_DEFAULT,

Note that changing the default value for properties of NMSetting is problematic,
because it changes behavior for how settings are parsed from keyfile/GVariant.
For team settings that's not the case, because if a JSON "config" is
present, all other properties are ignore. Also, we serialize properties
to JSON/GVariant depending on whether it's marked as present, and not
whether the value is set to the default (_nm_team_settings_property_to_dbus()).

 --

While at it, sticter validate the settings. Note that if a setting is
initialized from JSON, the strict validation is not not performed. That
means, such a setting will always validate, regardless whether the values
in JSON are invalid according to libnm. Only when using the extended
properties, strict validation is turned on.

Note that libnm serializes the properties to GVariant both as JSON "config"
and extended properties. Since when parsing a setting from GVariant will
prefer the "config" (if present), in most cases also validation is
performed.

Likewise, settings plugins (keyfile, ifcfg-rh) only persist the JSON
config to disk. When loading a setting from file, strict validation is
also not performed.

The stricter validation only happens if as last operation one of the
artificial properties was set, or if the setting was created from a
GVariant that has no "config" field.

 --

This is a (another) change in behavior.
2019-06-04 15:48:15 +02:00
..
tests libnm/team: fix handling default values and stricter validate team config 2019-06-04 15:48:15 +02:00
meson.build libnm: add "libnm-core/nm-team-utils.h" 2019-05-23 18:09:49 +02:00
nm-connection-private.h build: refine the NETWORKMANAGER_COMPILATION define 2018-01-08 12:38:53 +01:00
nm-connection.c libnm: pass connection to compare_property() function 2019-05-01 13:46:32 +02:00
nm-connection.h Revert "libnm-core: don't serialize synthetic properties in nm_setting_to_string()" 2019-01-07 10:09:10 +01:00
nm-core-enum-types.c.template libnm,cli: add NMSettingWireGuard 2019-02-22 11:00:10 +01:00
nm-core-enum-types.h.template build: use template files for enum types' sources generation 2017-12-18 11:25:06 +01:00
nm-core-internal.h libnm: rework team handling of JSON config 2019-05-23 18:09:49 +02:00
nm-core-types-internal.h platform/wireguard: rework parsing wireguard links in platform 2018-09-07 11:24:17 +02:00
nm-core-types.h libnm,cli: add NMSettingWireGuard 2019-02-22 11:00:10 +01:00
nm-crypto-gnutls.c shared: move most of "shared/nm-utils" to "shared/nm-glib-aux" 2019-04-18 18:59:09 +02:00
nm-crypto-impl.h libnm/crypto: refactor to use enum for supported ciphers 2018-09-04 07:38:30 +02:00
nm-crypto-nss.c shared: move most of "shared/nm-utils" to "shared/nm-glib-aux" 2019-04-18 18:59:09 +02:00
nm-crypto.c shared: move most of "shared/nm-utils" to "shared/nm-glib-aux" 2019-04-18 18:59:09 +02:00
nm-crypto.h libnm/crypto: mark nm_crypto_make_des_aes_key() as test-only function 2018-09-04 07:38:30 +02:00
nm-dbus-interface.h lldp: support IEEE 802.3 TLVs 2019-03-27 10:47:24 +01:00
nm-dbus-utils.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-errors.c Revert "libnm: don't assert for success of g_dbus_error_register_error()" 2019-05-22 20:04:08 +02:00
nm-errors.h wifi-p2p: strict validate options argument to "StartFind" 2019-02-05 13:55:32 +01:00
nm-json.c libnm-core: don't use RTLD_DEEPBIND when building with asan 2018-02-15 15:34:03 +01:00
nm-json.h shared: move most of "shared/nm-utils" to "shared/nm-glib-aux" 2019-04-18 18:59:09 +02:00
nm-keyfile-internal.h keyfile: add helper functions to record loaded UUID files 2018-12-03 12:09:57 +01:00
nm-keyfile-utils.c shared: add "shared/nm-glib-aux/nm-keyfile-aux.h" 2019-05-07 16:41:21 +02:00
nm-keyfile-utils.h libnm: add NMWireGuardPeer and libnm support for peers 2019-02-22 11:00:10 +01:00
nm-keyfile.c libnm/keyfile: don't parse JSON config in keyfile reader twice 2019-05-23 18:09:49 +02:00
nm-property-compare.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-property-compare.h build: refine the NETWORKMANAGER_COMPILATION define 2018-01-08 12:38:53 +01:00
nm-setting-6lowpan.c libnm-core: reorder code in settings 2019-01-15 09:55:24 +01:00
nm-setting-6lowpan.h libnm-core: add NMSetting{6Lowpan,Wpan}Class to a public header 2018-06-29 22:34:23 +02:00
nm-setting-8021x.c libnm: mark static "eap_methods_table" array as const 2019-05-16 13:43:07 +02:00
nm-setting-8021x.h docs: use numeric values in enum definitions in public headers 2019-02-19 16:08:11 +01:00
nm-setting-adsl.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-setting-adsl.h libnm-core: sensible docstrings for NMSettings* 2017-03-17 10:15:11 +01:00
nm-setting-bluetooth.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-setting-bluetooth.h core/bluetooth: add NAP type 2017-05-31 20:15:52 +02:00
nm-setting-bond.c libnm: pass connection to compare_property() function 2019-05-01 13:46:32 +02:00
nm-setting-bond.h libnm-core: sensible docstrings for NMSettings* 2017-03-17 10:15:11 +01:00
nm-setting-bridge-port.c libnm: pass connection to compare_property() function 2019-05-01 13:46:32 +02:00
nm-setting-bridge-port.h all: support bridge vlan ranges 2019-04-18 09:39:28 +02:00
nm-setting-bridge.c libnm: pass connection to compare_property() function 2019-05-01 13:46:32 +02:00
nm-setting-bridge.h all: support bridge vlan ranges 2019-04-18 09:39:28 +02:00
nm-setting-cdma.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-setting-cdma.h libnm-core: sensible docstrings for NMSettings* 2017-03-17 10:15:11 +01:00
nm-setting-connection.c libnm: pass connection to compare_property() function 2019-05-01 13:46:32 +02:00
nm-setting-connection.h libnm-core: add connection.llmnr property 2018-09-06 09:07:41 +02:00
nm-setting-dcb.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-setting-dcb.h all: don't use gchar/gshort/gint/glong but C types 2018-07-11 12:02:06 +02:00
nm-setting-dummy.c libnm-core: reorder code in settings 2019-01-15 09:55:24 +01:00
nm-setting-dummy.h libnm-core: sensible docstrings for NMSettings* 2017-03-17 10:15:11 +01:00
nm-setting-ethtool.c shared: build helper "libnm-libnm-core-{intern|aux}.la" library for libnm-core 2019-04-18 18:59:09 +02:00
nm-setting-ethtool.h libnm: add missing NM_AVAILABLE_IN_1_14 macro to new API 2018-09-14 16:54:40 +02:00
nm-setting-generic.c libnm-core: reorder code in settings 2019-01-15 09:55:24 +01:00
nm-setting-generic.h libnm-core: sensible docstrings for NMSettings* 2017-03-17 10:15:11 +01:00
nm-setting-gsm.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-setting-gsm.h settings,gsm: deprecate and stop using 'number' property 2018-12-19 08:54:50 +01:00
nm-setting-infiniband.c libnm/infiniband: lift restriction of MTU to 2044 for IPoIB in "datagram" mode 2019-04-05 16:27:17 +02:00
nm-setting-infiniband.h libnm-core: sensible docstrings for NMSettings* 2017-03-17 10:15:11 +01:00
nm-setting-ip-config.c doc: replace "Split DNS" with "Conditional Forwarding" 2019-05-17 12:08:45 +02:00
nm-setting-ip-config.h libnm: add missing NM_AVAILABLE_IN_1_18 markers to nm_ip_routing_rule_*() API 2019-04-21 12:42:38 +02:00
nm-setting-ip-tunnel.c libnm: fix range of MTU property to uint32 for ip-tunnel 2019-04-05 16:27:17 +02:00
nm-setting-ip-tunnel.h ip-tunnel: add support for tunnel flags 2018-01-05 18:25:08 +01:00
nm-setting-ip4-config.c libnm: unify property-to-dbus handling of NMSetting 2019-05-01 13:46:32 +02:00
nm-setting-ip4-config.h libnm-core: sensible docstrings for NMSettings* 2017-03-17 10:15:11 +01:00
nm-setting-ip6-config.c libnm: unify property-to-dbus handling of NMSetting 2019-05-01 13:46:32 +02:00
nm-setting-ip6-config.h libnm-core: add ipv6.dhcp-duid property 2018-06-08 18:23:31 +02:00
nm-setting-macsec.c shared: move most of "shared/nm-utils" to "shared/nm-glib-aux" 2019-04-18 18:59:09 +02:00
nm-setting-macsec.h macsec: enable send-sci by default and make the option configurable 2018-06-14 15:13:11 +02:00
nm-setting-macvlan.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-setting-macvlan.h libnm-core: sensible docstrings for NMSettings* 2017-03-17 10:15:11 +01:00
nm-setting-match.c libnm-core: reorder code in settings 2019-01-15 09:55:24 +01:00
nm-setting-match.h all: add 'match' setting 2018-08-11 09:41:07 +02:00
nm-setting-olpc-mesh.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-setting-olpc-mesh.h libnm-core: sensible docstrings for NMSettings* 2017-03-17 10:15:11 +01:00
nm-setting-ovs-bridge.c libnm-core: reorder code in settings 2019-01-15 09:55:24 +01:00
nm-setting-ovs-bridge.h libnm-core: add ovs-bridge setting 2017-10-30 17:40:08 +01:00
nm-setting-ovs-interface.c libnm-core: reorder code in settings 2019-01-15 09:55:24 +01:00
nm-setting-ovs-interface.h libnm-core: add ovs-interface setting 2017-10-30 17:40:08 +01:00
nm-setting-ovs-patch.c libnm-core: reorder code in settings 2019-01-15 09:55:24 +01:00
nm-setting-ovs-patch.h libnm-core: add ovs-patch setting 2017-10-30 17:40:08 +01:00
nm-setting-ovs-port.c libnm-core: cleanup NMSetting's class initialization 2019-01-15 09:55:24 +01:00
nm-setting-ovs-port.h libnm-core: add ovs-port setting 2017-10-30 17:40:08 +01:00
nm-setting-ppp.c libnm-core: reorder code in settings 2019-01-15 09:55:24 +01:00
nm-setting-ppp.h libnm-core: sensible docstrings for NMSettings* 2017-03-17 10:15:11 +01:00
nm-setting-pppoe.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-setting-pppoe.h libnm,clients: add 'parent' property to PPPoE setting 2017-08-05 08:03:15 +02:00
nm-setting-private.h libnm: unify property-to-dbus handling of NMSetting 2019-05-01 13:46:32 +02:00
nm-setting-proxy.c libnm-core: reorder code in settings 2019-01-15 09:55:24 +01:00
nm-setting-proxy.h libnm-core: sensible docstrings for NMSettings* 2017-03-17 10:15:11 +01:00
nm-setting-serial.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-setting-serial.h libnm-core: sensible docstrings for NMSettings* 2017-03-17 10:15:11 +01:00
nm-setting-sriov.c libnm: use macro and designated initializers for NMVariantAttributeSpec 2019-05-07 20:58:17 +02:00
nm-setting-sriov.h libnm-core: add SR-IOV setting 2018-07-11 16:16:22 +02:00
nm-setting-tc-config.c libnm: unify property-to-dbus handling of NMSetting 2019-05-01 13:46:32 +02:00
nm-setting-tc-config.h libnm: don't return deep-copied strv array from nm_tc_qdisc_get_attribute_names() 2019-04-20 08:09:52 +02:00
nm-setting-team-port.c libnm/team: fix handling default values and stricter validate team config 2019-06-04 15:48:15 +02:00
nm-setting-team-port.h all: don't use gchar/gshort/gint/glong but C types 2018-07-11 12:02:06 +02:00
nm-setting-team.c libnm/team: fix handling default values and stricter validate team config 2019-06-04 15:48:15 +02:00
nm-setting-team.h libnm: mark NMTeamLinkWatcher arguments as const in API 2019-05-23 18:09:49 +02:00
nm-setting-tun.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-setting-tun.h libnm-core: sensible docstrings for NMSettings* 2017-03-17 10:15:11 +01:00
nm-setting-user.c libnm: pass connection to compare_property() function 2019-05-01 13:46:32 +02:00
nm-setting-user.h all: remove consecutive empty lines 2018-04-30 16:24:52 +02:00
nm-setting-vlan.c libnm: unify property-to-dbus handling of NMSetting 2019-05-01 13:46:32 +02:00
nm-setting-vlan.h all: replace "it's" with "its" where needed 2018-04-18 14:14:07 +02:00
nm-setting-vpn.c libnm: pass connection to compare_property() function 2019-05-01 13:46:32 +02:00
nm-setting-vpn.h all: remove consecutive empty lines 2018-04-30 16:24:52 +02:00
nm-setting-vxlan.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-setting-vxlan.h libnm-core: sensible docstrings for NMSettings* 2017-03-17 10:15:11 +01:00
nm-setting-wifi-p2p.c shared: build helper "libnm-libnm-core-{intern|aux}.la" library for libnm-core 2019-04-18 18:59:09 +02:00
nm-setting-wifi-p2p.h core/setting-wifi-p2p: Add WFD IEs property to P2P settings 2019-02-21 10:10:20 +01:00
nm-setting-wimax.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-setting-wimax.h libnm-core: sensible docstrings for NMSettings* 2017-03-17 10:15:11 +01:00
nm-setting-wired.c libnm: unify property-to-dbus handling of NMSetting 2019-05-01 13:46:32 +02:00
nm-setting-wired.h libnm/docs: fix enum definition that confuses gtk-doc 2019-02-22 10:12:13 +01:00
nm-setting-wireguard.c libnm: pass connection to compare_property() function 2019-05-01 13:46:32 +02:00
nm-setting-wireguard.h libnm: change nm_wireguard_peer_set_endpoint() API to allow validation 2019-03-07 17:54:25 +01:00
nm-setting-wireless-security.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-setting-wireless-security.h all: fix misspellings 2019-01-24 17:19:44 +01:00
nm-setting-wireless.c libnm: pass connection to compare_property() function 2019-05-01 13:46:32 +02:00
nm-setting-wireless.h docs: use numeric values in enum definitions in public headers 2019-02-19 16:08:11 +01:00
nm-setting-wpan.c libnm-core: reorder code in settings 2019-01-15 09:55:24 +01:00
nm-setting-wpan.h core/setting-wpan: add page and channel properties 2018-10-07 15:46:02 +02:00
nm-setting.c libnm: add init_from_dbus() virtual function to NMSetting 2019-05-23 18:09:49 +02:00
nm-setting.h libnm: add init_from_dbus() virtual function to NMSetting 2019-05-23 18:09:49 +02:00
nm-simple-connection.c libnm-core: reorder code in settings 2019-01-15 09:55:24 +01:00
nm-simple-connection.h include: use double-quotes to include our own headers 2017-03-09 14:12:35 +01:00
nm-team-utils.c libnm/team: fix handling default values and stricter validate team config 2019-06-04 15:48:15 +02:00
nm-team-utils.h libnm/team: fix handling default values and stricter validate team config 2019-06-04 15:48:15 +02:00
nm-utils-private.h libnm: move team link-watchers to/from variant to "nm-team-setting.c" 2019-05-23 18:09:49 +02:00
nm-utils.c libnm: move team link-watchers to/from variant to "nm-team-setting.c" 2019-05-23 18:09:49 +02:00
nm-utils.h libnm: rename and expose nm_utils_base64secret_decode() in libnm 2019-03-07 17:54:25 +01:00
nm-version.h release: bump version to 1.19.0 (development) 2019-04-13 18:54:31 +02:00
nm-vpn-dbus-interface.h all: remove consecutive empty lines 2018-04-30 16:24:52 +02:00
nm-vpn-editor-plugin.c libnm-core: reorder code in settings 2019-01-15 09:55:24 +01:00
nm-vpn-editor-plugin.h all: remove consecutive empty lines 2018-04-30 16:24:52 +02:00
nm-vpn-plugin-info.c nm: Fix syntax on introspection annotations 2019-03-07 10:04:41 +01:00
nm-vpn-plugin-info.h gobject-introspection: made several fixes to the annotations 2018-03-26 12:45:49 +02:00