Commit graph

60 commits

Author SHA1 Message Date
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
Pavel Šimerda afd30f5f3b implement systemd network-online.target properly (bgo #728965)
Make network-online.target depend on NetworkManager-wait-online.service
just as is done in Fedora. This makes network-online.target work with
NetworkManager as described in systemd documentation.

An alternative way would be to use a combination of setting
Install.WantedBy to network-online.target and enabling the service by
default. This alternative approach is currently used by
systemd-networkd.

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

Acked-By: Dan Williams <dcbw@redhat.com>
2014-05-30 22:23:08 +02:00
Dan Winship d53357f420 dispatcher: tell systemd to not kill dispatcher children
You're supposed to be able to use dispatcher scripts to spawn
long-running processes, but currently systemd will kill them when
nm-dispatcher exits. Fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=725492
2014-04-18 11:32:12 -04:00
Jiří Klimeš 520d2814ba systemd: update NetworkManager-wait-online.service to wait for startup 2014-03-31 08:37:10 +02:00
Dan Winship 7481c64ad5 systemd: add "Before=network.service" on Fedora/RHEL (rh #1034983)
On Fedora/RHEL, NetworkManager.service needs to be started before
network.service, or else network.service may try to bring up NM's
devices itself.
2013-12-17 09:45:18 -05:00
Dan Williams 75c64763f6 systemd: fix up dispatcher unit install (rh #948433)
Lennart sez:

"Oh, I wasn't aware it is short-lived only. In that case, drop the
multi-user.target bit, and just make it create the dbus alias.

[Install]
Alias=dbus-org.freedesktop.nm-dispatcher.service

And yeah, adding Also=NetworkManager-dispatcher.service to
NetworkManager.service certainly would be a good idea."
2013-08-06 15:58:55 -05:00
Dan Winship 17e91fd46a core: change the rules for ignore-carrier
The previous ignore-carrier rules did not work well with dynamic IP
(dhcp/slaac) connections. Change the rule so that only static IP
connections can be activated when carrier is not present (but both
static and dynamic connections will remain up when carrier is lost).
2013-07-22 11:30:21 -04:00
Colin Walters 841ca9bb84 server.conf: We're no longer a sample, reword introduction
Now we actually change configuration, explain that better.
2013-07-22 11:30:21 -04:00
Colin Walters 8e37935875 Merge some comments from server.conf into "man NetworkManager.conf"
The latter should have the full+canonical description, and the config
file comments should be very brief, and link to it for more info.
2013-07-22 11:30:21 -04:00
Colin Walters 31d1f288f5 server.conf: Remove dns=none example
This is covered in the manpage adequately, and we want this file to be
actual options now, not just commented out ones.
2013-07-22 11:30:21 -04:00
Dan Winship 328dea9c5c core: make monitor-connection-files be false by default 2013-07-22 11:30:21 -04:00
Dan Winship 1f81851017 core: add monitor-connection-files=false and ReloadConnections
Add a "monitor-connection-files" config option, which can be set to
"false" to disable automatic reloading of connections on file change.

To go with this, add a new ReloadConnections method on
o.fd.NM.Settings that can be used to manually reload connections, and
add an nm-cli command to call it.
2013-06-14 12:57:47 -03:00
Dan Williams db3ad9bc90 systemd: update for network-online.target for systemd >= 200 (rh #787314)
systemd's new network-online target abstracts the "wait until
networking is up" stuff, and NM-wait-online implements that
functionality.  Thus NM-wait-online should be ordered before
(and thus be a dependency of) network-online.
2013-06-03 11:30:35 -05:00
Dan Williams 06a415d9ea systemd: add service for dispatcher (rh #948433) 2013-06-03 10:53:07 -05:00
Dan Winship 8d44136dce main: add --debug, fix logging under systemd
When run with --no-daemon, NM used to duplicate all syslog output to
stderr, for ease of debugging. But this meant it had to tell systemd
to ignore stderr, so you wouldn't get duplicated log entries. But that
meant we lost error messages that didn't go through nm_log. (eg,
g_warning()s and g_return_if_fail()s).

Fix this by making --no-daemon no longer duplicate syslog output to
stderr, and removing the "StandardError=null" from the systemd service
file. To get the old behavior, you can use --debug instead of
--no-daemon.

https://bugzilla.gnome.org/show_bug.cgi?id=700550
2013-05-21 09:30:09 -03:00
Colin Walters 8b3d609404 build: Fix srcdir != builddir 2013-04-03 10:19:49 -05:00