Commit graph

53 commits

Author SHA1 Message Date
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
Dan Winship 08e7fda63d data: add a server.conf example file
Add a server.conf example file, and install it to $(docdir)/examples.
2013-04-03 10:23:49 -04:00
Dan Winship 1d89bc0004 systemd: set KillMode=process
By default, when shutting NM down, systemd will kill everything in its
cgroup. But this can cause problems (eg, NM thinking that dhclient
crashed and then taking down an interface that it would otherwise have
left up). Fix this by setting KillMode=process, which tells systemd to
only kill NM itself, and let NM kill its children.

https://bugzilla.redhat.com/show_bug.cgi?id=876218
2013-01-04 11:53:03 -05:00
Dan Williams c200e3fddf systemd: restore D-Bus service alias name
Mistakenly removed while merging 86f14392fc
2012-09-25 15:35:57 -05:00
Pavel Šimerda 86f14392fc systemd: also install nm-wait-online on 'systemctl enable'
Inspired by openSUSE patches. There is no need to require
user/distributor manually enable nm-wait-online.
2012-09-25 15:03:39 -05:00
Jiří Klimeš 13bba719f9 systemd: suppress logging each message twice when run via systemd (rh #751275) 2012-02-07 14:59:53 +01:00
Michal Schmidt ffbb7df4b8 systemd: fix NetworkManager-wait-online.service to wait for link up (rh #710502)
Since commit 0ce4b6b412
NetworkManager-wait-online.service quits immediately if there is no link yet.
Fix it by removing the '-x' option.

But if we do just that, NM-w-o would add a useless 30 seconds delay in the
case when NM is not running at all.
Solve this by adding a Requisite= dependency on NM.

https://bugzilla.redhat.com/show_bug.cgi?id=710502
2011-06-17 14:02:39 +02:00
Bill Nottingham 0ce4b6b412 systemd: tweak NM-wait-online.service
1) Don't require NM, but run after it. This allows this service
to be installed without bringing up NetworkManager. Add -x so that
it exits if NM isn't running.

2) Install as a want of network.target, instead of multi-user.target.
This allows us to skip it if nothing requires network.target or the
legacy $network SysV capability.
2011-05-10 16:34:11 -05:00