Commit graph

75 commits

Author SHA1 Message Date
Thomas Haller 6d7270e222 build/meson: cleanup configuration_data() for paths
We don't need such data duplicated. The build setup should
have only one configuration_data() for patching such values.

Now we only have one global, immutable data_conf dictionary with
configuration values. Note that none of the users of data_conf uses all
entries, but as the entries are basically only dependent on the
meson/configure option and valid for the entire project, this simplifies
to handling.
2019-11-22 15:59:31 +01:00
Iñigo Martínez 23b4dc5f77 meson: Rename variables related to pkg-config variables
Some variables belong to variables in their correspondent pkg-config
file.

These variables have been renamed to `dependency_variable` to
reflect the dependency and variables from pkg-config files they are
related to.

Some of these has also been fixed to use paths relative to
installation prefix.
2019-10-01 09:49:33 +02:00
Iñigo Martínez bfbcf8f3fe meson: Use generators placeholders
Functions derived from generators as `configure_file`,
`custom_target` and `i18n.merge_file` can use placeholders like
`@BASENAME@` that removes the extension from the input filename
string.

The output string has been replaced by this placeholder that
allows in some cases the use of less variables.
2019-10-01 09:49:33 +02:00
Beniamino Galvani a2e6e7f2a9 systemd: use busctl instead of dbus-send
While dbus-send may not be installed, busctl is shipped with systemd
and so it should be always available.
2019-09-17 09:29:34 +02:00
Lubomir Rintel 27d380b70e data: fix the ID_NET_DRIVER udev rule
Systemd v243 is complaining about the wrong substitution there. That is
sort of harmless, because systemd-udevd in that version doesn't need the
rule anyway. But still fix it, to avoid a warning.

Also, newer udevd's $PATH doesn't include sbin. That is also okay,
because we don't need the rule to actually work there. But fix it
anyway.

https://bugzilla.redhat.com/show_bug.cgi?id=1740655
2019-08-16 14:03:46 +02:00
Beniamino Galvani 7c2317a557 build: fix meson warning about 'install' arg in 'configure_file'
WARNING: Project targetting '>= 0.44.0' but tried to use feature
introduced in '0.50.0': install arg in configure_file

From the documentation:

 "install (added 0.50.0) When true, this generated file is installed
 during the install step, and install_dir must be set and not
 empty. When false, this generated file is not installed regardless of
 the value of install_dir. When omitted it defaults to true when
 install_dir is set and not empty, false otherwise."

The parameter can be omitted because install_dir is set.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/216
2019-08-05 16:05:30 +02:00
Thomas Haller 74641be816 settings: drop ibft settings plugin
The functionality of the ibft settings plugin is now handled by
nm-initrd-generator. There is no need for it anymore, drop it.

Note that ibft called iscsiadm, which requires CAP_SYS_ADMIN to work
([1]). We really want to drop this capability, so the current solution
of a settings plugin (as it is implemented) is wrong. The solution
instead is nm-initrd-generator.

Also, on Fedora the ibft was disabled and probably on most other
distributions as well. This was only used on RHEL.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1371201#c7
2019-06-20 16:06:44 +02:00
Thomas Haller acc335aad4 dispatcher/systemd: order NetworkManager-dispatcher.service Before=NetworkManager.service
During shutdown, systemd should first stop NetworkManager and then
the dispatcher service. Note that dispatcher service is D-Bus activated,
so the two services don't Want/Require each other. But the ordering
still matters.
2019-05-27 12:43:06 +02:00
Lubomir Rintel 4c78434a0b Revert "Do not manage Docker bridge interfaces"
The docker bridges are no special -- just regular externally created
bridges.

This reverts commit 0ce7327550.
2019-05-21 09:40:53 +02:00
Jonathan Kang 243af16c5b Add polkit action for Wi-Fi scans
Previously, Wi-Fi scans uses polkit action
"org.freedesktop.NetworkManager.network-control". This is introduced
in commit 5e3e19d0. But in a system with restrict polkit rules, for
example "org.freedesktop.NetworkManager.network-control" was set as
auth_admin. When you open the network panel of GNOME Control Center, a
polkit dialog will keep showing up asking for admin password, as GNOME
Control Center scans the Wi-Fi list every 15 seconds.

Fix that by adding a new polkit action
"org.freedesktop.NetworkManager.wifi.scan" so that distributions can
add specific rule to allow Wi-Fi scans.

[thaller@redhat.com: fix macro in "shared/nm-common-macros.h"]

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/68
2019-02-21 13:49:17 +01:00
Iñigo Martínez 35171b3c3f build: meson: Add trailing commas
Add missing trailing commas that avoids getting noise when another
file/parameter is added and eases reviewing changes[0].

[0] https://gitlab.gnome.org/GNOME/dconf/merge_requests/11#note_291585
2018-12-20 13:50:34 +01:00
Lubomir Rintel b385ad0159 all: say Wi-Fi instead of "wifi" or "WiFi"
Correct the spelling across the *entire* tree, including translations,
comments, etc. It's easier that way.

Even the places where it's not exposed to the user, such as tests, so
that we learn how is it spelled correctly.
2018-11-29 17:53:35 +01:00
Michael Biebl 90f71c0f99 systemd: don't make NetworkManager D-Bus activatable
If the NetworkManager daemon has been stopped manually we don't want it
to be autostarted by a client request.

[lkundrak@v3.sk: The auto-activation is probably more surprising than useful.
Services that need NetworkManager API should depend on NetworkManager service
directly.

I have no idea what purpose does the D-Bus service file serve nowadays,
but it looks rather hacky (really, activating /bin/false) and the comment
in it suggests that the autoactivating behavior was not intended anyway.
Debian has been shipping this for quite some time and no complains have been
heard.]

https://github.com/NetworkManager/NetworkManager/pull/230
2018-10-12 12:54:02 +02:00
Andrei Dziahel 0ce7327550 Do not manage Docker bridge interfaces
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/15
2018-09-21 11:18:00 +02:00
Christian Kellner 89af7fbfa6 all: add support for thunderbolt networking
Load the thunderbolt-net module if we see a host-to-host connection
and configure the resulting ethernet connection automatically to be
a link-local only one. The latter is done by setting a new udev
property "NM_AUTO_DEFAULT_LINK_LOCAL_ONLY" which is picked up when
we configure the connection for the device.

https://github.com/NetworkManager/NetworkManager/pull/97
2018-04-19 14:20:04 +02:00
Alan Jenkins 167e42a87e systemd: make enablement of n-m-wait-online.service follow n-m.service
This is the approach used by systemd-networkd.

I don't understand the logic that caused systemd-networkd to make the change -
9e49656037

Instead, I am suggesting it for consistency, and because it seems to me this is the
exact correct behaviour. Because if you enable NetworkManager, and rely on it to
configure your network devices, then network mounts will not start correctly at boot
time unless you also enable NetworkManager-wait-online.service.

Enabling NetworkManager-wait-online.service does not cause unnecessary serialization
of the boot process; it is only pulled in if something else (like a network mount)
pulls in network-online.target.

I am suggesting this in response to reading this user support request [1].

[1] https://unix.stackexchange.com/questions/429604/fstab-not-automatically-mounting-smb-storage

[thaller@redhat.com: reworded commit message]

https://github.com/NetworkManager/NetworkManager/pull/76
2018-03-14 10:24:45 +01:00
Iñigo Martínez 03637ad8b5 build: add initial support for meson build system
meson is a build system focused on speed an ease of use, which
helps speeding up the software development. This patch adds meson
support along autotools.

[thaller@redhat.com: rebased patch and adjusted for iwd support]

https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00022.html
2017-12-13 15:48:50 +01:00
Thomas Haller 28b97f02f6 systemd: let "NetworkManager-wait-online.service" require "NetworkManager.service"
`systemctl start network-online.target` should suffice to start
"NetworkManager.service".

That would work because
 - "network-online.target" has "Wants=NetworkManager-wait-online.service"
 - "NetworkManager-wait-online.service" has "Require=NetworkManager.service".

But previously, "NetworkManager-wait-online.service" would just
fail with missing dependency.

See also https://github.com/systemd/systemd/pull/6065 which does the
same for networkd's wait-online serice, and see rh#1452866 for a
use-case.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1452866
2017-11-02 15:21:42 +01:00
Lubomir Rintel 830a5a14cb device: add support for OpenVSwitch devices 2017-10-30 21:46:55 +01:00
James Henstridge 4dd30b784c manager: add connectivity-check-{available,enabled} properties.
https://bugzilla.gnome.org/show_bug.cgi?id=785117
2017-08-17 22:31:47 +02:00
Thomas Haller a675a619f4 systemd: update service unit file to use dbus-send for ExecReload
instead of `kill -HUP`. We support "org.freedesktop.NetworkManager.Reload"
D-Bus method for a long time now. Use it because it is synchronous.
2017-06-07 11:11:51 +02:00
Yuri Chornoivan 4c6edb22b7 all: fix typos in documentation and comments
https://bugzilla.gnome.org/show_bug.cgi?id=780199

[thaller@redhat.com: reworded commit message]
2017-03-17 15:11:20 +01:00
Thomas Haller 4be9b4a2cb build: move policy file from "policy/" to "data/" 2016-11-03 14:18:23 +01:00
Thomas Haller 8fa3314736 build: merge "data/Makefile.am" into toplevel Makefile 2016-10-21 17:37:57 +02:00
Thomas Haller 9aee7b493e doc: add comment to systemd's NetworkManager.service about ibft requiring CAP_SYS_ADMIN
We don't want to enable this upstream, but make the requirement
more discoverable by documenting it and put a comment to
NetworkManager.service.

https://bugzilla.redhat.com/show_bug.cgi?id=1371201
2016-09-02 15:39:08 +02:00
Michael Biebl fe7d12a010 systemd: add Documentation to service files
Reference the nm-online and NetworkManager man page in the corresponding
service files.

https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Documentation=

https://bugzilla.gnome.org/show_bug.cgi?id=767168
2016-06-02 21:27:14 +02:00
Michael Biebl c8199b7de0 systemd: use RemainAfterExit=yes for NetworkManager-wait-online.service
RemainAfterExit=yes is typically used for Type=oneshot services.
systemd-networkd-wait-online.service uses it, so we should as well.

See
https://www.freedesktop.org/software/systemd/man/systemd.service.html#RemainAfterExit=
https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=

https://bugzilla.gnome.org/show_bug.cgi?id=767170
2016-06-02 20:59:10 +02:00
Thomas Haller 1d0e0eeffd manager: add Reload() D-Bus command
Add new Reload D-Bus command to reload NetworkManager configuration.

For now, this is like sending SIGHUP to the process. There are several
advantages here:

  - it is guarded via PolicyKit authentication while signals
    can only be sent by root.

  - the user can wait for the reload to be complete instead of sending
    an asynchronous signal. For now, we operation completes after
    nm_config_reload() returns, but later we could delay the response
    further until specific parts are fully reloaded.

  - SIGHUP reloads everything including re-reading configuration from
    disk while SIGUSR1 reloads just certain parts such as writing out DNS
    configuration anew.
    Now, the Reload command has a flags argument which is more granular
    in selecting parts which are to be reloaded. For example, via
    signals the user can:

      1) send SIGUSR1: this writes out the DNS configuration to
         resolv.conf and possibly reloads other parts without
         re-reading configuration and without restarting the DNS plugin.
      2) send SIGHUP: this reloads configuration from disk,
         writes out resolv.conf and restarts the DNS plugin.

    There is no way, to only restart the DNS plugin without also reloading
    everything else.
2016-06-01 19:06:34 +02:00
Thomas Haller 9c3187027c systemd: order NetworkManager.serivce after network-pre.target
https://bugzilla.gnome.org/show_bug.cgi?id=761001
2016-01-23 16:54:33 +01:00
Lubomir Rintel ba24a12739 systemd: add chroot capability
CAP_SYS_CHROOT is needed for openvpn hardening.
2016-01-22 22:12:43 +01:00
Lubomir Rintel c1cf3c25c8 linux-platform: treat gadget devices as ethernet devices
Also, don't manage them by default. Whatver created it should take care of
management.
2016-01-21 11:33:59 +01:00
Thomas Haller bf54a5bfba systemd: add "After=dbus.service" to NetworkManager.service
Order NetworkManager after dbus. Otherwise during shutdown, both service are killed
together and possibly NetworkManager can no longer use D-Bus during shutdown. It
will need it however to communicate with VPN plugins and wpa-supplicant.

Related: https://bugs.freedesktop.org/show_bug.cgi?id=89847#c14
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1214466
2016-01-21 11:01:36 +01:00
Martin Pitt b42098f4d0 systemd: stop blocking network.target in NetworkManager-wait-online.service
network.target is a very early boot target which basically says "I can start
opening sockets now". It has nothing to do with being connected to the internet
and is often required by early boot services as well.

Drop the unnecessary and wrong Wants=/Before=network.target to avoid dependency
cycles and boot delays.

https://bugzilla.gnome.org/show_bug.cgi?id=746039
https://launchpad.net/1430280
2015-10-30 11:37:09 +01:00
Martin Pitt c8ca35bff9 systemd: install NetworkManager-wait-online.service into network-online.target
This unit "implements" network-online.target, which is fairly independent from
multi-user.target, so specify the correct install target.

https://bugzilla.gnome.org/show_bug.cgi?id=746039
https://launchpad.net/1430280
2015-10-30 11:37:09 +01:00
Lubomir Rintel 97a962a788 systemd: grant the daemon a license to kill kids
It's for their own good. Otherwise stale dnsmasq instances haunt the shared
connections.
2015-10-08 19:23:53 +02:00
Michael Biebl 1e03758262 Split out the bits which determine ID_NET_DRIVER or DRIVERS into separate udev rules file
Those are not required with systemd-udevd v210 or newer. This way
distros which have a new enough version of udev can skip installing
84-nm-drivers.rules. While at it, don't use absolute paths for sed and
ethtool.
2015-08-31 22:41:17 +02:00
Lubomir Rintel 9a65f63cb9 udev-rules: avoid ifname shell expansion 2015-08-19 15:13:11 +02:00
Lubomir Rintel bafc26d008 udev-rules: one less useless use of cat 2015-08-18 08:45:42 +02:00
Beniamino Galvani 9366bd7f90 udev-rules: only invoke ethtool for existing interfaces
ethtool may cause the auto-loading of a kernel module for non-existing
interface-names. Avoid that by checking whether such an interface exists.
2015-08-18 08:45:42 +02:00
Lubomir Rintel b0f3250dfb Revert "udev-rules: only invoke ethtool for existing interfaces"
This reverts commit 44fee0f6ff.

Bad quoting here. Also, this is not quite the best fix for the issue,
filtering on ACTION=="add" is probably a bit more elegant.
2015-08-18 08:45:42 +02:00
Beniamino Galvani 44fee0f6ff udev-rules: only invoke ethtool for existing interfaces
ethtool may cause the auto-loading of a kernel module for non-existing
interface-names. Avoid that by checking whether such an interface exists.

This is inherently racy.
2015-08-11 18:31:46 +02:00
Beniamino Galvani 28c231d686 systemd: require CAP_AUDIT_WRITE for NetworkManager service
We need it to write messages to kernel auditing log.
2015-08-04 09:32:12 +02:00
Lubomir Rintel 4ffd57f83d service: harden the NetworkManager service a bit
Tested with dnsmasq (ipv4.method=shared), openvpn & vpnc.

https://bugzilla.gnome.org/show_bug.cgi?id=750598
2015-07-01 16:26:15 +02:00
Dan Williams 2599dadc28 platform: don't use udev for link type determination
This allows us to always announce links when the kernel advertises
them, instead of waiting for udev.
2015-05-01 14:18:28 -05:00
Thomas Haller a858b383c3 systemd: make NetworkManager reloadable via SIGHUP
Since f9e4af2, parts of the configuration can be reloaded
by sending SIGHUP to NetworkManager. Add ExecReload option
to service file to support reloading by sending a signal.

Note that 'man 5 systemd.service' advices to use a blocking
command instead of a sending a signal. Later we should add a
D-Bus method to allow reloading synchronously. For now, this
is better then nothing.

https://mail.gnome.org/archives/networkmanager-list/2015-April/msg00042.html
2015-04-17 18:28:50 +02:00
Lubomir Rintel ceea3c6782 data: move OLPC MESH udev rules away from callouts
No idea why was it there in the first place.

This also fixes a bug that the rules file was conditionally included in dist
depending on presence of udev dir at configure time.
2015-03-23 15:13:02 +01:00
Lubomir Rintel 7ba30cfd26 data: add udev rules to make emulated ethernet devices default unmanaged
There are some out-of-tree drivers that create devices masquerading as
ethernets which are supposed to use their own management tools. Avoid touching
them.

The rules should be run after 80-net-setup-link.rules, so that the
ID_NET_DRIVER is set.
2015-03-23 15:13:02 +01:00
Mikko Rapeli fe95185f6f core: tell systemd to restart NetworkManager.service if it exited with failure (bgo #741587)
Crashed NetworkManager.service was not restarted by systemd.

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>

https://bugzilla.gnome.org/show_bug.cgi?id=741587
2014-12-16 16:21:15 -06:00
Dan Williams 4cc13befd3 dispatcher: rename executable to 'nm-dispatcher' 2014-06-06 13:43:45 -05:00
Thomas Haller 16d34bfe82 build: fix installing network-online.target for existing link
When reinstalling NM on the same location, it would fail with

    Making install in data
    make[1]: Entering directory `/home/data/src/NetworkManager/data'
    make[2]: Entering directory `/home/data/src/NetworkManager/data'
    install -d /opt/test/lib/systemd/system/network-online.target.wants
    ln -s /opt/test/lib/systemd/system/NetworkManager-wait-online.service /opt/test/lib/systemd/system/network-online.target.wants
    ln: failed to create symbolic link ‘/opt/test/lib/systemd/system/network-online.target.wants/NetworkManager-wait-online.service’: File exists
    make[2]: *** [install-exec-local] Error 1

https://bugzilla.gnome.org/show_bug.cgi?id=728965

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-02 16:05:46 +02:00