2020-12-23 22:21:36 +01:00
|
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
2020-01-14 10:42:24 +01:00
|
|
|
|
2017-11-25 11:39:06 +01:00
|
|
|
src_inc = include_directories('.')
|
|
|
|
|
|
2019-09-07 23:00:41 +02:00
|
|
|
daemon_nm_default_dep = declare_dependency(
|
2019-09-09 11:40:11 +02:00
|
|
|
sources: libnm_core_enum_sources[1],
|
2019-09-07 23:00:41 +02:00
|
|
|
include_directories: src_inc,
|
|
|
|
|
dependencies: libnm_core_nm_default_dep,
|
|
|
|
|
)
|
|
|
|
|
|
2017-11-25 11:39:06 +01:00
|
|
|
install_data(
|
|
|
|
|
'org.freedesktop.NetworkManager.conf',
|
2018-10-18 12:50:20 +02:00
|
|
|
install_dir: dbus_conf_dir,
|
2017-11-25 11:39:06 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
subdir('systemd')
|
|
|
|
|
|
2018-01-07 15:39:42 +01:00
|
|
|
core_plugins = []
|
2017-11-25 11:39:06 +01:00
|
|
|
|
2019-09-09 11:40:11 +02:00
|
|
|
daemon_c_flags = ['-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DAEMON']
|
2017-12-18 20:33:30 +01:00
|
|
|
|
2017-11-25 11:39:06 +01:00
|
|
|
sources = files(
|
|
|
|
|
'dhcp/nm-dhcp-client.c',
|
|
|
|
|
'dhcp/nm-dhcp-manager.c',
|
dhcp: add nettools dhcp4 client
This is inspired by the existing systemd integration, with a few differences:
* This parses the WPAD option, which systemd requested, but did not use.
* We hook into the DAD handling, only making use of the configured address
once DAD has completed successfully, and declining the lease if it fails.
There are still many areas of possible improvement. In particular, we need
to ensure the parsing of all options are compliant, as n-dhcp4 treats all
options as opaque, unlike sd-dhcp4. We probably also need to look at how
to handle failures and retries (in particular if we decline a lease).
We need to query the current MTU at client startu, as well as the hardware
broadcast address. Both these are provided by the kernel over netlink, so
it should simply be a matter of hooking that up with NM's netlink layer.
Contribution under LGPL2.0+, in addition to stated licenses.
2019-05-13 20:02:48 +02:00
|
|
|
'dhcp/nm-dhcp-nettools.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
'dhcp/nm-dhcp-systemd.c',
|
|
|
|
|
'dhcp/nm-dhcp-utils.c',
|
2019-06-06 12:27:06 +02:00
|
|
|
'dhcp/nm-dhcp-options.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
'ndisc/nm-lndp-ndisc.c',
|
|
|
|
|
'ndisc/nm-ndisc.c',
|
2018-01-14 14:43:34 +01:00
|
|
|
'platform/nm-netlink.c',
|
2018-06-09 13:56:21 +02:00
|
|
|
'platform/wifi/nm-wifi-utils-nl80211.c',
|
|
|
|
|
'platform/wifi/nm-wifi-utils.c',
|
2018-05-18 16:40:28 +02:00
|
|
|
'platform/wpan/nm-wpan-utils.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
'platform/nm-linux-platform.c',
|
|
|
|
|
'platform/nm-platform.c',
|
|
|
|
|
'platform/nm-platform-utils.c',
|
|
|
|
|
'platform/nmp-netns.c',
|
|
|
|
|
'platform/nmp-object.c',
|
2019-03-11 11:37:40 +01:00
|
|
|
'platform/nmp-rules-manager.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
'main-utils.c',
|
|
|
|
|
'NetworkManagerUtils.c',
|
|
|
|
|
'nm-core-utils.c',
|
core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API
Previously, we used the generated GDBusInterfaceSkeleton types and glued
them via the NMExportedObject base class to our NM types. We also used
GDBusObjectManagerServer.
Don't do that anymore. The resulting code was more complicated despite (or
because?) using generated classes. It was hard to understand, complex, had
ordering-issues, and had a runtime and memory overhead.
This patch refactors this entirely and uses the lower layer API GDBusConnection
directly. It replaces the generated code, GDBusInterfaceSkeleton, and
GDBusObjectManagerServer. All this is now done by NMDbusObject and NMDBusManager
and static descriptor instances of type GDBusInterfaceInfo.
This adds a net plus of more then 1300 lines of hand written code. I claim
that this implementation is easier to understand. Note that previously we
also required extensive and complex glue code to bind our objects to the
generated skeleton objects. Instead, now glue our objects directly to
GDBusConnection. The result is more immediate and gets rid of layers of
code in between.
Now that the D-Bus glue us more under our control, we can address issus and
bottlenecks better, instead of adding code to bend the generated skeletons
to our needs.
Note that the current implementation now only supports one D-Bus connection.
That was effectively the case already, although there were places (and still are)
where the code pretends it could also support connections from a private socket.
We dropped private socket support mainly because it was unused, untested and
buggy, but also because GDBusObjectManagerServer could not export the same
objects on multiple connections. Now, it would be rather straight forward to
fix that and re-introduce ObjectManager on each private connection. But this
commit doesn't do that yet, and the new code intentionally supports only one
D-Bus connection.
Also, the D-Bus startup was simplified. There is no retry, either nm_dbus_manager_start()
succeeds, or it detects the initrd case. In the initrd case, bus manager never tries to
connect to D-Bus. Since the initrd scenario is not yet used/tested, this is good enough
for the moment. It could be easily extended later, for example with polling whether the
system bus appears (like was done previously). Also, restart of D-Bus daemon isn't
supported either -- just like before.
Note how NMDBusManager now implements the ObjectManager D-Bus interface
directly.
Also, this fixes race issues in the server, by no longer delaying
PropertiesChanged signals. NMExportedObject would collect changed
properties and send the signal out in idle_emit_properties_changed()
on idle. This messes up the ordering of change events w.r.t. other
signals and events on the bus. Note that not only NMExportedObject
messed up the ordering. Also the generated code would hook into
notify() and process change events in and idle handle, exhibiting the
same ordering issue too.
No longer do that. PropertiesChanged signals will be sent right away
by hooking into dispatch_properties_changed(). This means, changing
a property in quick succession will no longer be combined and is
guaranteed to emit signals for each individual state. Quite possibly
we emit now more PropertiesChanged signals then before.
However, we are now able to group a set of changes by using standard
g_object_freeze_notify()/g_object_thaw_notify(). We probably should
make more use of that.
Also, now that our signals are all handled in the right order, we
might find places where we still emit them in the wrong order. But that
is then due to the order in which our GObjects emit signals, not due
to an ill behavior of the D-Bus glue. Possibly we need to identify
such ordering issues and fix them.
Numbers (for contrib/rpm --without debug on x86_64):
- the patch changes the code size of NetworkManager by
- 2809360 bytes
+ 2537528 bytes (-9.7%)
- Runtime measurements are harder because there is a large variance
during testing. In other words, the numbers are not reproducible.
Currently, the implementation performs no caching of GVariants at all,
but it would be rather simple to add it, if that turns out to be
useful.
Anyway, without strong claim, it seems that the new form tends to
perform slightly better. That would be no surprise.
$ time (for i in {1..1000}; do nmcli >/dev/null || break; echo -n .; done)
- real 1m39.355s
+ real 1m37.432s
$ time (for i in {1..2000}; do busctl call org.freedesktop.NetworkManager /org/freedesktop org.freedesktop.DBus.ObjectManager GetManagedObjects > /dev/null || break; echo -n .; done)
- real 0m26.843s
+ real 0m25.281s
- Regarding RSS size, just looking at the processes in similar
conditions, doesn't give a large difference. On my system they
consume about 19MB RSS. It seems that the new version has a
slightly smaller RSS size.
- 19356 RSS
+ 18660 RSS
2018-02-26 13:51:52 +01:00
|
|
|
'nm-dbus-object.c',
|
|
|
|
|
'nm-dbus-utils.c',
|
2020-07-29 19:30:22 +02:00
|
|
|
'nm-netns.c',
|
|
|
|
|
'nm-l3-config-data.c',
|
2020-09-16 19:14:20 +02:00
|
|
|
'nm-l3-ipv4ll.c',
|
2020-07-29 19:30:22 +02:00
|
|
|
'nm-l3cfg.c',
|
|
|
|
|
'nm-ip-config.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
'nm-ip4-config.c',
|
|
|
|
|
'nm-ip6-config.c',
|
2018-10-18 12:50:20 +02:00
|
|
|
'nm-logging.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
deps = [
|
2019-09-07 23:00:41 +02:00
|
|
|
daemon_nm_default_dep,
|
2019-09-03 09:48:59 +02:00
|
|
|
libn_dhcp4_dep,
|
2020-01-02 07:37:59 +01:00
|
|
|
libnm_keyfile_dep,
|
2019-09-09 11:40:11 +02:00
|
|
|
libnm_core_dep,
|
2019-09-07 23:00:41 +02:00
|
|
|
libnm_systemd_shared_dep,
|
2019-09-03 09:48:59 +02:00
|
|
|
libnm_udev_aux_dep,
|
2019-09-10 12:54:46 +02:00
|
|
|
libsystemd_dep,
|
|
|
|
|
libudev_dep,
|
2017-11-25 11:39:06 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
if enable_wext
|
2018-06-09 13:56:21 +02:00
|
|
|
sources += files('platform/wifi/nm-wifi-utils-wext.c')
|
2017-11-25 11:39:06 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
libnetwork_manager_base = static_library(
|
2018-01-09 08:05:15 +01:00
|
|
|
nm_name + 'Base',
|
2017-11-25 11:39:06 +01:00
|
|
|
sources: sources,
|
|
|
|
|
dependencies: deps,
|
2019-09-09 11:40:11 +02:00
|
|
|
c_args: daemon_c_flags,
|
2017-11-25 11:39:06 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
sources = files(
|
2018-04-05 15:19:27 +02:00
|
|
|
'devices/nm-acd-manager.c',
|
2018-05-22 16:25:54 +02:00
|
|
|
'devices/nm-device-6lowpan.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
'devices/nm-device-bond.c',
|
|
|
|
|
'devices/nm-device-bridge.c',
|
|
|
|
|
'devices/nm-device.c',
|
|
|
|
|
'devices/nm-device-dummy.c',
|
|
|
|
|
'devices/nm-device-ethernet.c',
|
|
|
|
|
'devices/nm-device-ethernet-utils.c',
|
|
|
|
|
'devices/nm-device-factory.c',
|
|
|
|
|
'devices/nm-device-generic.c',
|
|
|
|
|
'devices/nm-device-infiniband.c',
|
|
|
|
|
'devices/nm-device-ip-tunnel.c',
|
|
|
|
|
'devices/nm-device-macsec.c',
|
|
|
|
|
'devices/nm-device-macvlan.c',
|
|
|
|
|
'devices/nm-device-ppp.c',
|
|
|
|
|
'devices/nm-device-tun.c',
|
|
|
|
|
'devices/nm-device-veth.c',
|
|
|
|
|
'devices/nm-device-vlan.c',
|
2019-12-05 10:36:54 +01:00
|
|
|
'devices/nm-device-vrf.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
'devices/nm-device-vxlan.c',
|
2018-03-13 13:42:38 +00:00
|
|
|
'devices/nm-device-wireguard.c',
|
2018-03-09 16:26:25 +01:00
|
|
|
'devices/nm-device-wpan.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
'devices/nm-lldp-listener.c',
|
|
|
|
|
'dhcp/nm-dhcp-dhclient.c',
|
|
|
|
|
'dhcp/nm-dhcp-dhclient-utils.c',
|
|
|
|
|
'dhcp/nm-dhcp-dhcpcanon.c',
|
|
|
|
|
'dhcp/nm-dhcp-dhcpcd.c',
|
|
|
|
|
'dhcp/nm-dhcp-listener.c',
|
|
|
|
|
'dns/nm-dns-dnsmasq.c',
|
|
|
|
|
'dns/nm-dns-manager.c',
|
|
|
|
|
'dns/nm-dns-plugin.c',
|
|
|
|
|
'dns/nm-dns-systemd-resolved.c',
|
|
|
|
|
'dns/nm-dns-unbound.c',
|
|
|
|
|
'dnsmasq/nm-dnsmasq-manager.c',
|
|
|
|
|
'dnsmasq/nm-dnsmasq-utils.c',
|
|
|
|
|
'ppp/nm-ppp-manager-call.c',
|
settings: rework tracking settings connections and settings plugins
Completely rework how settings plugin handle connections and how
NMSettings tracks the list of connections.
Previously, settings plugins would return objects of (a subtype of) type
NMSettingsConnection. The NMSettingsConnection was tightly coupled with
the settings plugin. That has a lot of downsides.
Change that. When changing this basic relation how settings connections
are tracked, everything falls appart. That's why this is a huge change.
Also, since I have to largely rewrite the settings plugins, I also
added support for multiple keyfile directories, handle in-memory
connections only by keyfile plugin and (partly) use copy-on-write NMConnection
instances. I don't want to spend effort rewriting large parts while
preserving the old way, that anyway should change. E.g. while rewriting ifcfg-rh,
I don't want to let it handle in-memory connections because that's not right
long-term.
--
If the settings plugins themself create subtypes of NMSettingsConnection
instances, then a lot of knowledge about tracking connections moves
to the plugins.
Just try to follow the code what happend during nm_settings_add_connection().
Note how the logic is spread out:
- nm_settings_add_connection() calls plugin's add_connection()
- add_connection() creates a NMSettingsConnection subtype
- the plugin has to know that it's called during add-connection and
not emit NM_SETTINGS_PLUGIN_CONNECTION_ADDED signal
- NMSettings calls claim_connection() which hocks up the new
NMSettingsConnection instance and configures the instance
(like calling nm_settings_connection_added()).
This summary does not sound like a lot, but try to follow that code. The logic
is all over the place.
Instead, settings plugins should have a very simple API for adding, modifying,
deleting, loading and reloading connections. All the plugin does is to return a
NMSettingsStorage handle. The storage instance is a handle to identify a profile
in storage (e.g. a particular file). The settings plugin is free to subtype
NMSettingsStorage, but it's not necessary.
There are no more events raised, and the settings plugin implements the small
API in a straightforward manner.
NMSettings now drives all of this. Even NMSettingsConnection has now
very little concern about how it's tracked and delegates only to NMSettings.
This should make settings plugins simpler. Currently settings plugins
are so cumbersome to implement, that we avoid having them. It should not be
like that and it should be easy, beneficial and lightweight to create a new
settings plugin.
Note also how the settings plugins no longer care about duplicate UUIDs.
Duplicated UUIDs are a fact of life and NMSettings must handle them. No
need to overly concern settings plugins with that.
--
NMSettingsConnection is exposed directly on D-Bus (being a subtype of
NMDBusObject) but it was also a GObject type provided by the settings
plugin. Hence, it was not possible to migrate a profile from one plugin to
another.
However that would be useful when one profile does not support a
connection type (like ifcfg-rh not supporting VPN). Currently such
migration is not implemented except for migrating them to/from keyfile's
run directory. The problem is that migrating profiles in general is
complicated but in some cases it is important to do.
For example checkpoint rollback should recreate the profile in the right
settings plugin, not just add it to persistent storage. This is not yet
properly implemented.
--
Previously, both keyfile and ifcfg-rh plugin implemented in-memory (unsaved)
profiles, while ifupdown plugin cannot handle them. That meant duplication of code
and a ifupdown profile could not be modified or made unsaved.
This is now unified and only keyfile plugin handles in-memory profiles (bgo #744711).
Also, NMSettings is aware of such profiles and treats them specially.
In particular, NMSettings drives the migration between persistent and non-persistent
storage.
Note that a settings plugins may create truly generated, in-memory profiles.
The settings plugin is free to generate and persist the profiles in any way it
wishes. But the concept of "unsaved" profiles is now something explicitly handled
by keyfile plugin. Also, these "unsaved" keyfile profiles are persisted to file system
too, to the /run directory. This is great for two reasons: first of all, all
profiles from keyfile storage in fact have a backing file -- even the
unsaved ones. It also means you can create "unsaved" profiles in /run
and load them with `nmcli connection load`, meaning there is a file
based API for creating unsaved profiles.
The other advantage is that these profiles now survive restarting
NetworkManager. It's paramount that restarting the daemon is as
non-disruptive as possible. Persisting unsaved files to /run improves
here significantly.
--
In the past, NMSettingsConnection also implemented NMConnection interface.
That was already changed a while ago and instead users call now
nm_settings_connection_get_connection() to delegate to a
NMSimpleConnection. What however still happened was that the NMConnection
instance gets never swapped but instead the instance was modified with
nm_connection_replace_settings_from_connection(), clear-secrets, etc.
Change that and treat the NMConnection instance immutable. Instead of modifying
it, reference/clone a new instance. This changes that previously when somebody
wanted to keep a reference to an NMConnection, then the profile would be cloned.
Now, it is supposed to be safe to reference the instance directly and everybody
must ensure not to modify the instance. nmtst_connection_assert_unchanging()
should help with that.
The point is that the settings plugins may keep references to the
NMConnection instance, and so does the NMSettingsConnection. We want
to avoid cloning the instances as long as they are the same.
Likewise, the device's applied connection can now also be referenced
instead of cloning it. This is not yet done, and possibly there are
further improvements possible.
--
Also implement multiple keyfile directores /usr/lib, /etc, /run (rh #1674545,
bgo #772414).
It was always the case that multiple files could provide the same UUID
(both in case of keyfile and ifcfg-rh). For keyfile plugin, if a profile in
read-only storage in /usr/lib gets modified, then it gets actually stored in
/etc (or /run, if the profile is unsaved).
--
While at it, make /etc/network/interfaces profiles for ifupdown plugin reloadable.
--
https://bugzilla.gnome.org/show_bug.cgi?id=772414
https://bugzilla.gnome.org/show_bug.cgi?id=744711
https://bugzilla.redhat.com/show_bug.cgi?id=1674545
2019-06-13 17:12:20 +02:00
|
|
|
'settings/plugins/keyfile/nms-keyfile-storage.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
'settings/plugins/keyfile/nms-keyfile-plugin.c',
|
|
|
|
|
'settings/plugins/keyfile/nms-keyfile-reader.c',
|
|
|
|
|
'settings/plugins/keyfile/nms-keyfile-utils.c',
|
|
|
|
|
'settings/plugins/keyfile/nms-keyfile-writer.c',
|
|
|
|
|
'settings/nm-agent-manager.c',
|
|
|
|
|
'settings/nm-secret-agent.c',
|
|
|
|
|
'settings/nm-settings.c',
|
|
|
|
|
'settings/nm-settings-connection.c',
|
|
|
|
|
'settings/nm-settings-plugin.c',
|
settings: rework tracking settings connections and settings plugins
Completely rework how settings plugin handle connections and how
NMSettings tracks the list of connections.
Previously, settings plugins would return objects of (a subtype of) type
NMSettingsConnection. The NMSettingsConnection was tightly coupled with
the settings plugin. That has a lot of downsides.
Change that. When changing this basic relation how settings connections
are tracked, everything falls appart. That's why this is a huge change.
Also, since I have to largely rewrite the settings plugins, I also
added support for multiple keyfile directories, handle in-memory
connections only by keyfile plugin and (partly) use copy-on-write NMConnection
instances. I don't want to spend effort rewriting large parts while
preserving the old way, that anyway should change. E.g. while rewriting ifcfg-rh,
I don't want to let it handle in-memory connections because that's not right
long-term.
--
If the settings plugins themself create subtypes of NMSettingsConnection
instances, then a lot of knowledge about tracking connections moves
to the plugins.
Just try to follow the code what happend during nm_settings_add_connection().
Note how the logic is spread out:
- nm_settings_add_connection() calls plugin's add_connection()
- add_connection() creates a NMSettingsConnection subtype
- the plugin has to know that it's called during add-connection and
not emit NM_SETTINGS_PLUGIN_CONNECTION_ADDED signal
- NMSettings calls claim_connection() which hocks up the new
NMSettingsConnection instance and configures the instance
(like calling nm_settings_connection_added()).
This summary does not sound like a lot, but try to follow that code. The logic
is all over the place.
Instead, settings plugins should have a very simple API for adding, modifying,
deleting, loading and reloading connections. All the plugin does is to return a
NMSettingsStorage handle. The storage instance is a handle to identify a profile
in storage (e.g. a particular file). The settings plugin is free to subtype
NMSettingsStorage, but it's not necessary.
There are no more events raised, and the settings plugin implements the small
API in a straightforward manner.
NMSettings now drives all of this. Even NMSettingsConnection has now
very little concern about how it's tracked and delegates only to NMSettings.
This should make settings plugins simpler. Currently settings plugins
are so cumbersome to implement, that we avoid having them. It should not be
like that and it should be easy, beneficial and lightweight to create a new
settings plugin.
Note also how the settings plugins no longer care about duplicate UUIDs.
Duplicated UUIDs are a fact of life and NMSettings must handle them. No
need to overly concern settings plugins with that.
--
NMSettingsConnection is exposed directly on D-Bus (being a subtype of
NMDBusObject) but it was also a GObject type provided by the settings
plugin. Hence, it was not possible to migrate a profile from one plugin to
another.
However that would be useful when one profile does not support a
connection type (like ifcfg-rh not supporting VPN). Currently such
migration is not implemented except for migrating them to/from keyfile's
run directory. The problem is that migrating profiles in general is
complicated but in some cases it is important to do.
For example checkpoint rollback should recreate the profile in the right
settings plugin, not just add it to persistent storage. This is not yet
properly implemented.
--
Previously, both keyfile and ifcfg-rh plugin implemented in-memory (unsaved)
profiles, while ifupdown plugin cannot handle them. That meant duplication of code
and a ifupdown profile could not be modified or made unsaved.
This is now unified and only keyfile plugin handles in-memory profiles (bgo #744711).
Also, NMSettings is aware of such profiles and treats them specially.
In particular, NMSettings drives the migration between persistent and non-persistent
storage.
Note that a settings plugins may create truly generated, in-memory profiles.
The settings plugin is free to generate and persist the profiles in any way it
wishes. But the concept of "unsaved" profiles is now something explicitly handled
by keyfile plugin. Also, these "unsaved" keyfile profiles are persisted to file system
too, to the /run directory. This is great for two reasons: first of all, all
profiles from keyfile storage in fact have a backing file -- even the
unsaved ones. It also means you can create "unsaved" profiles in /run
and load them with `nmcli connection load`, meaning there is a file
based API for creating unsaved profiles.
The other advantage is that these profiles now survive restarting
NetworkManager. It's paramount that restarting the daemon is as
non-disruptive as possible. Persisting unsaved files to /run improves
here significantly.
--
In the past, NMSettingsConnection also implemented NMConnection interface.
That was already changed a while ago and instead users call now
nm_settings_connection_get_connection() to delegate to a
NMSimpleConnection. What however still happened was that the NMConnection
instance gets never swapped but instead the instance was modified with
nm_connection_replace_settings_from_connection(), clear-secrets, etc.
Change that and treat the NMConnection instance immutable. Instead of modifying
it, reference/clone a new instance. This changes that previously when somebody
wanted to keep a reference to an NMConnection, then the profile would be cloned.
Now, it is supposed to be safe to reference the instance directly and everybody
must ensure not to modify the instance. nmtst_connection_assert_unchanging()
should help with that.
The point is that the settings plugins may keep references to the
NMConnection instance, and so does the NMSettingsConnection. We want
to avoid cloning the instances as long as they are the same.
Likewise, the device's applied connection can now also be referenced
instead of cloning it. This is not yet done, and possibly there are
further improvements possible.
--
Also implement multiple keyfile directores /usr/lib, /etc, /run (rh #1674545,
bgo #772414).
It was always the case that multiple files could provide the same UUID
(both in case of keyfile and ifcfg-rh). For keyfile plugin, if a profile in
read-only storage in /usr/lib gets modified, then it gets actually stored in
/etc (or /run, if the profile is unsaved).
--
While at it, make /etc/network/interfaces profiles for ifupdown plugin reloadable.
--
https://bugzilla.gnome.org/show_bug.cgi?id=772414
https://bugzilla.gnome.org/show_bug.cgi?id=744711
https://bugzilla.redhat.com/show_bug.cgi?id=1674545
2019-06-13 17:12:20 +02:00
|
|
|
'settings/nm-settings-storage.c',
|
|
|
|
|
'settings/nm-settings-utils.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
'supplicant/nm-supplicant-config.c',
|
|
|
|
|
'supplicant/nm-supplicant-interface.c',
|
|
|
|
|
'supplicant/nm-supplicant-manager.c',
|
|
|
|
|
'supplicant/nm-supplicant-settings-verify.c',
|
|
|
|
|
'vpn/nm-vpn-connection.c',
|
|
|
|
|
'vpn/nm-vpn-manager.c',
|
|
|
|
|
'nm-active-connection.c',
|
|
|
|
|
'nm-act-request.c',
|
|
|
|
|
'nm-audit-manager.c',
|
|
|
|
|
'nm-auth-manager.c',
|
|
|
|
|
'nm-auth-utils.c',
|
2018-03-02 05:55:21 +01:00
|
|
|
'nm-dbus-manager.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
'nm-checkpoint.c',
|
|
|
|
|
'nm-checkpoint-manager.c',
|
|
|
|
|
'nm-config.c',
|
|
|
|
|
'nm-config-data.c',
|
2018-02-19 19:50:18 +01:00
|
|
|
'nm-connectivity.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
'nm-dcb.c',
|
2020-02-20 14:09:33 +01:00
|
|
|
'nm-dhcp-config.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
'nm-dispatcher.c',
|
|
|
|
|
'nm-firewall-manager.c',
|
|
|
|
|
'nm-hostname-manager.c',
|
2018-10-10 17:10:01 +02:00
|
|
|
'nm-keep-alive.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
'nm-manager.c',
|
|
|
|
|
'nm-pacrunner-manager.c',
|
|
|
|
|
'nm-policy.c',
|
|
|
|
|
'nm-proxy-config.c',
|
|
|
|
|
'nm-rfkill-manager.c',
|
|
|
|
|
'nm-session-monitor.c',
|
2018-10-18 12:50:20 +02:00
|
|
|
'nm-sleep-monitor.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
)
|
|
|
|
|
|
2018-09-11 14:12:10 +02:00
|
|
|
nm_deps = [
|
2019-09-07 23:00:41 +02:00
|
|
|
daemon_nm_default_dep,
|
2017-11-25 11:39:06 +01:00
|
|
|
dl_dep,
|
2019-09-10 12:54:46 +02:00
|
|
|
libn_acd_dep,
|
2017-11-25 11:39:06 +01:00
|
|
|
libndp_dep,
|
2018-01-07 15:39:42 +01:00
|
|
|
libudev_dep,
|
2018-08-26 20:14:35 +02:00
|
|
|
logind_dep,
|
2017-11-25 11:39:06 +01:00
|
|
|
]
|
|
|
|
|
|
2019-09-10 12:54:46 +02:00
|
|
|
nm_links = [
|
|
|
|
|
libnetwork_manager_base,
|
|
|
|
|
libnm_systemd_core,
|
|
|
|
|
libnm_systemd_shared,
|
|
|
|
|
]
|
|
|
|
|
|
2017-11-25 11:39:06 +01:00
|
|
|
if enable_concheck
|
2018-09-11 14:12:10 +02:00
|
|
|
nm_deps += libcurl_dep
|
2017-11-25 11:39:06 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if enable_libaudit
|
2018-09-11 14:12:10 +02:00
|
|
|
nm_deps += libaudit_dep
|
2017-11-25 11:39:06 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if enable_libpsl
|
2018-09-11 14:12:10 +02:00
|
|
|
nm_deps += libpsl_dep
|
2017-11-25 11:39:06 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if enable_selinux
|
2018-09-11 14:12:10 +02:00
|
|
|
nm_deps += selinux_dep
|
2017-11-25 11:39:06 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
libnetwork_manager = static_library(
|
2018-01-09 08:05:15 +01:00
|
|
|
nm_name,
|
2017-11-25 11:39:06 +01:00
|
|
|
sources: sources,
|
2018-09-11 14:12:10 +02:00
|
|
|
dependencies: nm_deps,
|
2019-09-09 11:40:11 +02:00
|
|
|
c_args: daemon_c_flags,
|
2019-09-10 12:54:46 +02:00
|
|
|
link_with: nm_links,
|
2017-11-25 11:39:06 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
executable(
|
2020-08-03 17:33:31 +02:00
|
|
|
'nm-iface-helper',
|
|
|
|
|
'nm-iface-helper.c',
|
|
|
|
|
dependencies: [
|
|
|
|
|
daemon_nm_default_dep,
|
|
|
|
|
dl_dep,
|
|
|
|
|
libndp_dep,
|
|
|
|
|
libudev_dep,
|
|
|
|
|
libn_acd_dep,
|
|
|
|
|
],
|
2019-09-09 11:40:11 +02:00
|
|
|
c_args: daemon_c_flags,
|
2019-09-10 12:54:46 +02:00
|
|
|
link_with: nm_links,
|
2018-01-11 12:34:40 +01:00
|
|
|
link_args: ldflags_linker_script_binary,
|
2017-11-25 11:39:06 +01:00
|
|
|
link_depends: linker_script_binary,
|
|
|
|
|
install: true,
|
2018-10-18 12:50:20 +02:00
|
|
|
install_dir: nm_libexecdir,
|
2017-11-25 11:39:06 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if enable_tests
|
2019-09-10 12:54:46 +02:00
|
|
|
test_c_flags = daemon_c_flags + ['-DNETWORKMANAGER_COMPILATION_TEST']
|
|
|
|
|
if require_root_tests
|
|
|
|
|
test_c_flags += ['-DREQUIRE_ROOT_TESTS=1']
|
|
|
|
|
endif
|
|
|
|
|
|
2017-11-25 11:39:06 +01:00
|
|
|
sources = files(
|
|
|
|
|
'ndisc/nm-fake-ndisc.c',
|
|
|
|
|
'platform/tests/test-common.c',
|
2018-10-18 12:50:20 +02:00
|
|
|
'platform/nm-fake-platform.c',
|
2017-11-25 11:39:06 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
libnetwork_manager_test = static_library(
|
2018-01-09 08:05:15 +01:00
|
|
|
nm_name + 'Test',
|
2017-11-25 11:39:06 +01:00
|
|
|
sources: sources,
|
2019-09-07 23:00:41 +02:00
|
|
|
dependencies: daemon_nm_default_dep,
|
2019-09-10 12:54:46 +02:00
|
|
|
c_args: test_c_flags,
|
2018-10-18 12:50:20 +02:00
|
|
|
link_with: libnetwork_manager,
|
2017-11-25 11:39:06 +01:00
|
|
|
)
|
|
|
|
|
|
2019-09-10 12:54:46 +02:00
|
|
|
libnetwork_manager_test_dep = declare_dependency(
|
2019-09-09 11:40:11 +02:00
|
|
|
dependencies: daemon_nm_default_dep,
|
2018-10-18 12:50:20 +02:00
|
|
|
link_with: libnetwork_manager_test,
|
2017-11-25 11:39:06 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
subdir('dnsmasq/tests')
|
|
|
|
|
subdir('ndisc/tests')
|
|
|
|
|
subdir('platform/tests')
|
|
|
|
|
subdir('supplicant/tests')
|
|
|
|
|
subdir('tests')
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
subdir('dhcp')
|
|
|
|
|
|
|
|
|
|
if enable_ppp
|
|
|
|
|
subdir('ppp')
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
subdir('devices')
|
2018-09-19 13:34:55 +02:00
|
|
|
subdir('initrd')
|
2017-11-25 11:39:06 +01:00
|
|
|
subdir('settings/plugins')
|
2018-09-11 14:12:10 +02:00
|
|
|
|
|
|
|
|
# NetworkManager binary
|
|
|
|
|
|
2019-08-28 11:54:11 +02:00
|
|
|
create_exports_networkmanager = join_paths(source_root, 'tools', 'create-exports-NetworkManager.sh')
|
2018-09-11 14:12:10 +02:00
|
|
|
symbol_map_name = 'NetworkManager.ver'
|
|
|
|
|
|
2018-09-18 10:14:09 +02:00
|
|
|
# libNetworkManager.a, as built by meson doesn't contain all symbols
|
|
|
|
|
# from libNetworkManagerBase.a and other static libraries, unless we
|
|
|
|
|
# add dependencies with link_whole, only supported in meson >= 0.46.
|
|
|
|
|
# Create an executable with full symbols that we use in place of the
|
|
|
|
|
# library to enumerate the symbols.
|
build: fix generating "NetworkManager.ver" with LTO
We use a linker version script "NetworkManager.ver", to hide
symbols from NetworkManager that are not used. That is important
due to our habit of using internal helper libraries that we link
statically everywhere, without handpicking the symbols we actually
need. We want the tooling to get rid of unnecessary symbols.
However, NetworkManager loads shared libraries for settings and device
plugins. These libraries require symbols from the NetworkManager binary,
but which one depends on build options. Hence, we also generate
"NetworkManager.ver" by the "tools/create-exports-NetworkManager.sh"
script.
For that the script uses "nm" to find symbols that are undefined in the
plugin libraries but defined in NetworkManager. With autotools the
script looked at "./src/.libs/libNetworkManager.a" to find the present
symbols. Note that for meson that already didn't work, and we build
instead an intermediate NetworkManager binary first (with all symbols
exposed). With LTO, "nm" doesn't find all symbols in
"./src/.libs/libNetworkManager.a", and consequently they are not
exported and dropped/hidden.
This also causes unit tests to fail with LTO, because our test script
"tools/check-exports.sh" catches such bugs.
Fix that by also with autotools generate a complete "NetworkManager-all-sym"
binary that is used to generate "NetworkManager.ver", before rebuilding
"NetworkManager" again.
2020-08-12 12:30:30 +02:00
|
|
|
network_manager_all_sym = executable(
|
|
|
|
|
'NetworkManager-all-sym',
|
2018-09-18 10:14:09 +02:00
|
|
|
'main.c',
|
|
|
|
|
dependencies: nm_deps,
|
2019-09-09 11:40:11 +02:00
|
|
|
c_args: daemon_c_flags,
|
|
|
|
|
link_args: '-Wl,--no-gc-sections',
|
2018-09-18 10:14:09 +02:00
|
|
|
link_whole: [libnetwork_manager, libnetwork_manager_base, libnm_core],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# this uses symbols from nm-full-symbols instead of libNetworkManager.a
|
2018-09-11 14:12:10 +02:00
|
|
|
ver_script = custom_target(
|
|
|
|
|
symbol_map_name,
|
|
|
|
|
output: symbol_map_name,
|
build: fix generating "NetworkManager.ver" with LTO
We use a linker version script "NetworkManager.ver", to hide
symbols from NetworkManager that are not used. That is important
due to our habit of using internal helper libraries that we link
statically everywhere, without handpicking the symbols we actually
need. We want the tooling to get rid of unnecessary symbols.
However, NetworkManager loads shared libraries for settings and device
plugins. These libraries require symbols from the NetworkManager binary,
but which one depends on build options. Hence, we also generate
"NetworkManager.ver" by the "tools/create-exports-NetworkManager.sh"
script.
For that the script uses "nm" to find symbols that are undefined in the
plugin libraries but defined in NetworkManager. With autotools the
script looked at "./src/.libs/libNetworkManager.a" to find the present
symbols. Note that for meson that already didn't work, and we build
instead an intermediate NetworkManager binary first (with all symbols
exposed). With LTO, "nm" doesn't find all symbols in
"./src/.libs/libNetworkManager.a", and consequently they are not
exported and dropped/hidden.
This also causes unit tests to fail with LTO, because our test script
"tools/check-exports.sh" catches such bugs.
Fix that by also with autotools generate a complete "NetworkManager-all-sym"
binary that is used to generate "NetworkManager.ver", before rebuilding
"NetworkManager" again.
2020-08-12 12:30:30 +02:00
|
|
|
depends: [network_manager_all_sym, core_plugins],
|
2019-08-28 11:54:11 +02:00
|
|
|
command: [create_exports_networkmanager, '--called-from-build', source_root],
|
2018-09-11 14:12:10 +02:00
|
|
|
)
|
|
|
|
|
|
2019-09-10 12:54:46 +02:00
|
|
|
ldflags = [
|
|
|
|
|
'-rdynamic',
|
|
|
|
|
'-Wl,--version-script,@0@'.format(ver_script.full_path()),
|
|
|
|
|
]
|
2018-09-11 14:12:10 +02:00
|
|
|
|
|
|
|
|
network_manager = executable(
|
|
|
|
|
nm_name,
|
|
|
|
|
'main.c',
|
|
|
|
|
dependencies: nm_deps,
|
2019-09-09 11:40:11 +02:00
|
|
|
c_args: daemon_c_flags,
|
2018-09-11 14:12:10 +02:00
|
|
|
link_with: libnetwork_manager,
|
|
|
|
|
link_args: ldflags,
|
|
|
|
|
link_depends: ver_script,
|
|
|
|
|
install: true,
|
2018-10-18 12:50:20 +02:00
|
|
|
install_dir: nm_sbindir,
|
2018-09-11 14:12:10 +02:00
|
|
|
)
|
2018-09-18 10:14:09 +02:00
|
|
|
|
|
|
|
|
if enable_tests
|
2019-09-10 12:54:46 +02:00
|
|
|
foreach plugin: core_plugins
|
|
|
|
|
plugin_path = plugin.full_path()
|
|
|
|
|
|
|
|
|
|
test(
|
|
|
|
|
'sym/' + plugin_path.split('/')[-1],
|
|
|
|
|
network_manager,
|
|
|
|
|
args: '--version',
|
|
|
|
|
env: ['LD_BIND_NOW=1', 'LD_PRELOAD=' + plugin_path],
|
|
|
|
|
)
|
2018-09-18 10:14:09 +02:00
|
|
|
endforeach
|
|
|
|
|
endif
|
2018-11-09 18:08:45 +01:00
|
|
|
|
|
|
|
|
test(
|
|
|
|
|
'check-config-options',
|
2019-08-28 11:54:11 +02:00
|
|
|
find_program(join_paths(source_root, 'tools', 'check-config-options.sh')),
|
|
|
|
|
args: source_root,
|
2018-11-09 18:08:45 +01:00
|
|
|
)
|