NetworkManager/src/libnm-core-public
Thomas Haller 98b3056604
core: preserve external ports during checkpoint rollback
When we have a bridge interface with ports attached externally (that is,
not by NetworkManager itself), then it can make sense that during
checkpoint rollback we want to keep those ports attached.

During rollback, we may need to deactivate the bridge device and
re-activate it. Implement this, by setting a flag before deactivating,
which prevents external ports to be detached. The flag gets cleared,
when the device state changes to activated (the following activation)
or unmanaged.

This is an ugly solution, for several reasons.

For one, NMDevice tracks its ports in the "slaves" list. But what
it does is ugly. There is no clear concept to understand what it
actually tacks. For example, it tracks externally added interfaces
(nm_device_sys_iface_state_is_external()) that are attached while
not being connected. But it also tracks interfaces that we want to attach
during activation (but which are not yet actually enslaved). It also tracks
slaves that have no actual netdev device (OVS). So it's not clear what this
list contains and what it should contain at any point in time. When we skip
the change of the slaves states during nm_device_master_release_slaves_all(),
it's not really clear what the effects are. It's ugly, but probably correct
enough. What would be better, if we had a clear purpose of what the
lists (or several lists) mean. E.g. a list of all ports that are
currently, physically attached vs. a list of ports we want to attach vs.
a list of OVS slaves that have no actual netdev device.

Another problem is that we attach state on the device
("activation_state_preserve_external_ports"), which should linger there
during the deactivation and reactivation. How can we be sure that we don't
leave that flag dangling there, and that the desired following activation
is the one we cared about? If the follow-up activation fails short (e.g. an
unmanaged command comes first), will we properly disconnect the slaves?
Should we even? In practice, it might be correct enough.

Also, we only implement this for bridges. I think this is where it makes
the most sense. And after all, it's an odd thing to preserve unknown,
external things during a rollback -- unknown, because we have no knowledge
about why these ports are attached and what to do with them.

Also, the change doesn't remember the ports that were attached when the
checkpoint was created. Instead, we preserve all ports that are attached
during rollback. That seems more useful and easier to implement. So we
don't actually rollback to the configuration when the checkpoint was
created. Instead, we rollback, but keep external devices.

Also, we do this now by default and introduce a flag to get the previous
behavior.

https://bugzilla.redhat.com/show_bug.cgi?id=2035519
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/ # 909
2022-03-03 11:25:14 +01:00
..
meson.build bond: add support of queue_id of bond port 2021-08-26 23:04:31 +02:00
nm-connection.h all: adjust glib-mkenums annotations for automated formatting 2022-02-08 11:14:01 +01:00
nm-core-types.h bond: add support of queue_id of bond port 2021-08-26 23:04:31 +02:00
nm-dbus-interface.h core: preserve external ports during checkpoint rollback 2022-03-03 11:25:14 +01:00
nm-errors.h build: move "libnm-core/" to "src/" and split it 2021-02-18 19:46:51 +01:00
nm-keyfile.h all: adjust glib-mkenums annotations for automated formatting 2022-02-08 11:14:01 +01:00
nm-setting-6lowpan.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-8021x.h all: adjust glib-mkenums annotations for automated formatting 2022-02-08 11:14:01 +01:00
nm-setting-adsl.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-setting-bluetooth.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-setting-bond-port.h bond: add support of queue_id of bond port 2021-08-26 23:04:31 +02:00
nm-setting-bond.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-setting-bridge-port.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-bridge.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-cdma.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-setting-connection.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-setting-dcb.h all: adjust glib-mkenums annotations for automated formatting 2022-02-08 11:14:01 +01:00
nm-setting-dummy.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-ethtool.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-generic.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-gsm.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-hostname.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-infiniband.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-setting-ip-config.h all: adjust glib-mkenums annotations for automated formatting 2022-02-08 11:14:01 +01:00
nm-setting-ip-tunnel.h all: adjust glib-mkenums annotations for automated formatting 2022-02-08 11:14:01 +01:00
nm-setting-ip4-config.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-ip6-config.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-macsec.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-macvlan.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-match.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-setting-olpc-mesh.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-setting-ovs-bridge.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-ovs-dpdk.h openvswitch: Add ovs-dpdk n_rxq property 2022-01-10 22:48:30 +00:00
nm-setting-ovs-external-ids.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-setting-ovs-interface.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-ovs-patch.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-ovs-port.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-ppp.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-pppoe.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-setting-proxy.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-serial.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-setting-sriov.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-tc-config.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-setting-team-port.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-team.h all: adjust glib-mkenums annotations for automated formatting 2022-02-08 11:14:01 +01:00
nm-setting-tun.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-user.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-veth.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-vlan.h libnm: drop unnecessary /*clang-format off*/ 2022-02-08 11:14:01 +01:00
nm-setting-vpn.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-setting-vrf.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-vxlan.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-wifi-p2p.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-wimax.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting-wired.h all: adjust glib-mkenums annotations for automated formatting 2022-02-08 11:14:01 +01:00
nm-setting-wireguard.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-setting-wireless-security.h all: adjust glib-mkenums annotations for automated formatting 2022-02-08 11:14:01 +01:00
nm-setting-wireless.h all: adjust glib-mkenums annotations for automated formatting 2022-02-08 11:14:01 +01:00
nm-setting-wpan.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-setting.h all: adjust glib-mkenums annotations for automated formatting 2022-02-08 11:14:01 +01:00
nm-simple-connection.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-utils.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-version-macros.h.in version: add 1.38 macros 2022-02-18 16:06:04 +01:00
nm-version.h version: add 1.38 macros 2022-02-18 16:06:04 +01:00
nm-vpn-dbus-interface.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-vpn-editor-plugin.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-vpn-plugin-info.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
README.md build: move "libnm-core/" to "src/" and split it 2021-02-18 19:46:51 +01:00

libnm-core-public

This contains (mostly) header files only, which are also part of the public API of libnm.

Also, this API is implemented by the static library libnm-core-impl, which in turn is statically linked into NetworkManager core and libnm.

These headers can be used by anybody who either:

Note that there is also one source file: nm-core-enum-types.c. This source file really belongs to libnm-core-impl but it is here because it's a generated file and so far I couldn't figure out how to generate nm-core-enum-types.h here while moving nm-core-enum-types.c to libnm-core-impl.

Aside nm-core-enum-types.c, this directory only provides header files. Users should add this directory (both srcdir and builddir) to the include search path, because libnm users are used to include these headers unqualified (like #include "nm-setting.h).