Commit graph

10865 commits

Author SHA1 Message Date
Thomas Haller
dcec33798e platform/netlink: fix overrun in attribute iteration in nla_ok()
See-also: 123dc07bcc
See-also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1045b03e07d85f3545118510a587035536030c1c
(cherry picked from commit c295d45a3b)
(cherry picked from commit ec1c512e40)
2018-10-10 12:17:13 +02:00
Lubomir Rintel
89b7f638ed devices/olpc: correct the signal handler arguments
Commit 631ca806 ("devices/wifi: flip meaning of scanning allowed
signal") added a "periodic" argument, but the OLPC companion handler was
not adjusted. Fix it now.

https://github.com/NetworkManager/NetworkManager/pull/222

Fixes: 631ca80692
(cherry picked from commit aa0e395530)
2018-10-09 20:24:23 +02:00
Thomas Haller
5583fffddb ppp: cleanup logging in impl_ppp_manager_set_ifindex()
It's enough that all code paths in impl_ppp_manager_set_ifindex() log exactly
one message. Also, give all messages the same prefix, so that it's clear where
they come from.

(cherry picked from commit 2a45c32e8c)
(cherry picked from commit d3ba511cce)
2018-10-04 20:50:22 +02:00
Thomas Haller
b366f89bea ppp: downgrade warning about repeated SetIfindex calls from ppp plugin
In src/ppp/nm-pppd-plugin.c, it seems that pppd can invoke
phasechange(PHASE_RUNNING:) multiple times. Hence, the plugin
calls SetIfindex multiple times too. In nm-ppp-manager.c, we
want to make sure that the ifindex does not change after it
was set once. However, calling SetIfindex with the same ifindex
is not something worth warning. Just log a debug message and nothing.

Maybe the plugin should remember that it already set the ifindex,
and avoid multiple D-Bus calls. But it's unclear that that is desired.
For now, just downgrade the warning.

(cherry picked from commit 4a4439835d)
(cherry picked from commit d3e0a0f9b3)
2018-10-04 20:49:52 +02:00
Thomas Haller
7a8b692226 ppp: avoid strncpy() in ppp plugin nm_phasechange()
strncpy() is deemed insecure, and it raises at least an eyebrow.
While it's save in this case, just avoid it.

(cherry picked from commit 4d11eba8c5)
(cherry picked from commit 2f6af40cd5)
2018-10-04 20:44:26 +02:00
Beniamino Galvani
6f6a810189 wifi: support hidden ssid in AP mode
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/48
(cherry picked from commit 5d97e76c7d)
(cherry picked from commit f235d57a3a)
2018-09-27 14:16:37 +02:00
Thomas Haller
3dbd264418 connectivity: fix crash when removing easy-handle from curl callback
libcurl does not allow removing easy-handles from within a curl
callback.

That was already partly avoided for one handle alone. That is, when
a handle completed inside a libcurl callback, it would only invoke the
callback, but not yet delete it. However, that is not enough, because
from within a callback another handle can be cancelled, leading to
the removal of (the other) handle and a crash:

  ==24572==    at 0x40319AB: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==24572==    by 0x52DDAE5: Curl_close (url.c:392)
  ==24572==    by 0x52EC02C: curl_easy_cleanup (easy.c:825)
  ==24572==    by 0x5FDCD2: cb_data_free (nm-connectivity.c:215)
  ==24572==    by 0x5FF6DE: nm_connectivity_check_cancel (nm-connectivity.c:585)
  ==24572==    by 0x55F7F9: concheck_handle_complete (nm-device.c:2601)
  ==24572==    by 0x574C12: concheck_cb (nm-device.c:2725)
  ==24572==    by 0x5FD887: cb_data_invoke_callback (nm-connectivity.c:167)
  ==24572==    by 0x5FD959: easy_header_cb (nm-connectivity.c:435)
  ==24572==    by 0x52D73CB: chop_write (sendf.c:612)
  ==24572==    by 0x52D73CB: Curl_client_write (sendf.c:668)
  ==24572==    by 0x52D54ED: Curl_http_readwrite_headers (http.c:3904)
  ==24572==    by 0x52E9EA7: readwrite_data (transfer.c:548)
  ==24572==    by 0x52E9EA7: Curl_readwrite (transfer.c:1161)
  ==24572==    by 0x52F4193: multi_runsingle (multi.c:1915)
  ==24572==    by 0x52F5531: multi_socket (multi.c:2607)
  ==24572==    by 0x52F5804: curl_multi_socket_action (multi.c:2771)

Fix that, by never invoking any callbacks when we are inside a libcurl
callback. Instead, the handle is marked for completion and queued. Later,
we complete all queue handles separately.

While at it, drop the @error argument from NMConnectivityCheckCallback.
It was only used to signal cancellation. Let's instead signal that via
status NM_CONNECTIVITY_CANCELLED.

https://bugzilla.gnome.org/show_bug.cgi?id=797136
https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1792745
https://bugzilla.opensuse.org/show_bug.cgi?id=1107197
https://github.com/NetworkManager/NetworkManager/pull/207

Fixes: d8a31794c8
(cherry picked from commit fa40fc6d76)
(cherry picked from commit 7f05debf99)
2018-09-17 18:23:29 +02:00
Thomas Haller
6c1cbe4d61 vpn: disconnect signal handlers from proxy in NMVpnConnection::dispose()
We cannot be sure who holds a reference to the proxy, and
who is gonna call us back after the VPN connection instance
is destroyed.

(cherry picked from commit 6ebb9091d2)
(cherry picked from commit f71f9b54a8)
2018-09-14 15:25:06 +02:00
Thomas Haller
0e633c232d vpn: fix assertion during "SecretsRequired" in unexpected state
Got this assertion:

    NetworkManager[12939]: <debug> [1536917977.4868] active-connection[0x563d8fd34540]: set state deactivated (was deactivating)
    ...
    NetworkManager[12939]: nm-openvpn[1106] <info>  openvpn[1132]: send SIGTERM
    NetworkManager[12939]: nm-openvpn[1106] <info>  wait for 1 openvpn processes to terminate...
    NetworkManager[12939]: nm-openvpn[1106] <warn>  openvpn[1132] exited with error code 1
    NetworkManager[12939]: <info>  [1536917977.5035] vpn-connection[0x563d8fd34540,2fdeaea3-975f-4325-8305-83ebca5eaa26,"my-openvpn-Red-Hat",0]: VPN plugin: requested secrets; state disconnected (9)
    NetworkManager[12939]: plugin_interactive_secrets_required: assertion 'priv->vpn_state == STATE_CONNECT || priv->vpn_state == STATE_NEED_AUTH' failed

Meaning. We should either ensure that secrets_required_cb() signal callback
is disconnected from proxy's signal, or we gracefully handle callbacks at
unexpected moments. Do the latter.

(cherry picked from commit 92344dd084)
(cherry picked from commit 011dd919fa)
2018-09-14 15:25:05 +02:00
Thomas Haller
6c4c12c796 wifi: fix leaking fake AP in NMDeviceWifi's act_stage1_prepare()
Fixes: 96f40dcdcd
(cherry picked from commit ef61d7909f)
(cherry picked from commit d08530ac4b)
2018-09-13 16:29:28 +02:00
Beniamino Galvani
3abddc3328 dns: dnsmasq: avoid crash when no reverse domains exist
ip_data->domains.reverse can be NULL when the device is being removed
and has no IP configuration for a short moment.

Fixes: 6409e7719c

https://bugzilla.gnome.org/show_bug.cgi?id=797022
(cherry picked from commit f0c075f050)
(cherry picked from commit 8309a7a696)
2018-09-13 15:09:08 +02:00
Beniamino Galvani
ca0f147bf4 core: handle route metric when reapplying dynamic IP methods
For dynamic IP methods (DHCP, IPv4LL, WWAN) the route metric is set at
activation/renewal time using the value from static configuration. To
support runtime change we need to update the dynamic configuration in
place and tell the DHCP client the new value to use for future
renewals.

https://bugzilla.redhat.com/show_bug.cgi?id=1528071
(cherry picked from commit b9e6433a02)
2018-09-12 09:52:06 +02:00
Beniamino Galvani
d83dba3e3d dhcp: allowing changing route metric and route table
(cherry picked from commit 9ca56089eb)
2018-09-12 09:52:04 +02:00
Thomas Haller
482fcb2501 ppp-manager: avoid crash with nonexisting link in impl_ppp_manager_set_ifindex()
Fixes: dd98ada33f
(cherry picked from commit 30a469e0bb)
(cherry picked from commit 7c50748dcc)
2018-09-11 21:43:36 +02:00
Frederic Danis
3392c43958 ppp-manager: fix pppd not exiting correctly on modem hangup
When unplugging an USB 3G modem device, pppd does not exit correctly and
we have the following traces:

Sep 10 07:58:24.616465 ModemManager[1158]: <info>  (tty/ttyUSB0): released by device '/sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0/usb4/4-1'
Sep 10 07:58:24.620314 pppd[2292]: Modem hangup
Sep 10 07:58:24.621368 ModemManager[1158]: <info>  (tty/ttyUSB1): released by device '/sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0/usb4/4-1'
Sep 10 07:58:24.621835 ModemManager[1158]: <warn>  (ttyUSB1): could not re-acquire serial port lock: (5) Input/output error
Sep 10 07:58:24.621358 NetworkManager[1871]: <debug> ppp-manager: set-ifindex 4
Sep 10 07:58:24.621369 NetworkManager[1871]: <warn>  ppp-manager: can't change the ifindex from 4 to 4
Sep 10 07:58:24.623982 NetworkManager[1871]: <info>  device (ttyUSB0): state change: activated -> unmanaged (reason 'removed', sys-iface-state: 'removed')
Sep 10 07:58:24.624411 NetworkManager[1871]: <debug> kill child process 'pppd' (2292): wait for process to terminate after sending SIGTERM (15) (send SIGKILL in 1500 milliseconds)...
Sep 10 07:58:24.624440 NetworkManager[1871]: <debug> modem-broadband[ttyUSB0]: notifying ModemManager about the modem disconnection
Sep 10 07:58:24.626591 NetworkManager[1871]: <debug> modem-broadband[ttyUSB0]: notifying ModemManager about the modem disconnection
Sep 10 07:58:24.681016 NetworkManager[1871]: <warn>  modem-broadband[ttyUSB0]: failed to disconnect modem: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface 'org.freedesktop.ModemManager1.Modem.Simple' on object at path /org/freedesktop/ModemManager1/Modem/0
Sep 10 07:58:26.126817 NetworkManager[1871]: <debug> kill child process 'pppd' (2292): process not terminated after 1502368 usec. Sending SIGKILL signal
Sep 10 07:58:26.128121 NetworkManager[1871]: <info>  device (ppp0): state change: disconnected -> unmanaged (reason 'unmanaged', sys-iface-state: 'removed')
Sep 10 07:58:26.135571 NetworkManager[1871]: <debug> kill child process 'pppd' (2292): terminated by signal 9 (1511158 usec elapsed)

This is due to nm-ppp-plugin waiting on SetIfIndex call until timeout,
which is longer than termination process timeout.

Calling g_dbus_method_invocation_return_value() on error fixes this.

Fixes: dd98ada33f

https://mail.gnome.org/archives/networkmanager-list/2018-September/msg00010.html
(cherry picked from commit e66e4d0e71)
(cherry picked from commit b3ca8abe38)
2018-09-11 21:43:29 +02:00
Thomas Haller
c740726b57 dhcp: fix leak in dhclient's dhclient_start()
Fixes: 5d6d5cd136
(cherry picked from commit c87faf07a1)
(cherry picked from commit 8f9240de96)
2018-09-10 14:38:52 +02:00
Beniamino Galvani
3a2c6f81f6 core: fix wireless bitrate property name on D-Bus
In commit 297d4985ab ("core/dbus: rework D-Bus implementation to use
lower layer GDBusConnection API") the Device.Wireless 'Bitrate'
property on D-Bus was accidentally changed to 'BitRate'. Revert the
old name.

Reported-by: Joseph Conley <joseph.j.conley@gmail.com>
Fixes: 297d4985ab

https://mail.gnome.org/archives/networkmanager-list/2018-September/msg00004.html
(cherry picked from commit c882633d48)
2018-09-07 09:52:57 +02:00
Beniamino Galvani
17a89f7061 manager: don't update ifindex of existing devices
When NM has to rebuild the platform cache, it first generates ADD and
then REMOVE events for the links.  So, if an interface is removed and
readded, platform will emit the ADDED event with a new ifindex while
the device with old ifindex still exists.

In such case the manager currently updates the device's ifindex but
this causes problems as the DNS manager tracks configurations by their
ifindex and so the configurations for the old device will become
stale.

Fix this by removing the device and adding it again when we detect a
change of ifindex on a device that already had valid one.

https://bugzilla.redhat.com/show_bug.cgi?id=1542366
(cherry picked from commit 281974b932)
2018-09-05 17:18:52 +02:00
Beniamino Galvani
fb83d62395 device: clear queued IP config sources when the device is unrealized
If the device is later realized again, we assert that there aren't any
IP config changes queued. Therefore, they must be cleared on
unrealize().

(cherry picked from commit 9ed07fbb46)
2018-09-05 17:18:49 +02:00
Thomas Haller
f326feaba3 wifi: don't use :1 bitfield for gboolean type
gboolean is a typedef for "int".

While older compilers might treat such bitfields as unsigned ([1]),
commonly such a bitfield is signed and can only contain the values 0
and -1.

We only want to use numeric 1 for TRUE, hence, creating such bitfields
is wrong, or at least error prone.

In fact, in this case it's a bug, because later we compare
it with a regular gboolean

  if (priv->scanning != new_scanning)

[1] https://lgtm.com/rules/1506024027114/

Fixes: e0f9677018
(cherry picked from commit 610ca87016)
2018-08-26 18:33:45 +02:00
Lubomir Rintel
9e015bab81 devices/ovs: expose slaves on D-Bus for OVS bridges and ports
[lkundrak@v3.sk: changed 1.14 to 1.12.2]

(cherry picked from commit 8d65f636e1)
2018-07-24 19:08:38 +02:00
Thomas Haller
660e308dd2 connectivity: avoid busy looping with connectivity-check failed
It seems, curl_multi_socket_action() can fail with

  connectivity check failed: 4

where "4" means CURLM_INTERNAL_ERROR.

When that happens, it also seems that the file descriptor may still have data
to read, so the glib IO callback _con_curl_socketevent_cb() will be called in
an endless loop. Thereby, keeping the CPU busy with doing nothing (useful).

Workaround by disabling polling on the file descriptor when something
goes wrong.

Note that optimally we would cancel the affected connectivity-check
right away. However, due to the design of libcurl's API, from within
_con_curl_socketevent_cb() we don't know which connectivity-checks
are affected by a failure on this file descriptor. So, all we can do
is avoid polling on the (possibly) broken file descriptor. Note that
we anyway always schedule a timeout of last resort for each check. Even
if something goes very wrong, we will fail the check within 15 seconds.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=903996
(cherry picked from commit 884a28b28c)
2018-07-24 17:31:32 +02:00
Thomas Haller
4af9ae13e0 connectivity: add compile time check that "curl_socket_t" is a typedef to plain "int"
On non-Windows, libcurl's "curl_socket_t" type is just a typedef for
int. We rely on that, because we use it as file descriptor.

Add a compile time check to ensure that.

(cherry picked from commit 970af59731)
2018-07-24 17:31:32 +02:00
Thomas Haller
a54ffc6c01 connectivity/trivial: rename socket argument in multi_socket_cb() callback
"s" might be a good name for a temporary string.

But here it's really a file descriptor. Call it "fd".

(cherry picked from commit cd0bd8a2ee)
2018-07-24 17:31:32 +02:00
Thomas Haller
abd994d916 connectivity/trivial: rename local functions to avoid "curl" prefix
Since this is "C" there are not namespaces and libraries commonly choose
a particular name prefix for their symbols.

In case of libcurl, that is "curl_".

We should avoid using the same name prefix, and choose something distinct.

(cherry picked from commit a24f118a1f)
2018-07-24 17:31:32 +02:00
Jan Alexander Steffens (heftig)
461f511227 wifi/ifd: Allow D-Bus activation to launch iwd
iwd does not ship activation configuration yet; until then we simply
fail the way we already do.

https://bugzilla.gnome.org/show_bug.cgi?id=796805
(cherry picked from commit 21f955b4dd)
2018-07-13 20:54:17 +02:00
Beniamino Galvani
87cd30c7d9 device: destroy pending acd-managers when the device disconnects
We previously kept any acd-manager running if the device was
disconnected. It was possible to trigger a crash by setting a long
dad-timeout and interrupting the activation request:

  nmcli con add type ethernet ifname eth0 con-name eth0+ ip4 1.2.3.4/32
  nmcli con mod eth0+ ipv4.dad-timeout 10000
  nmcli -w 2 con up eth0+
  nmcli con down eth0+

After this, the n-acd timer would fire after 10 seconds and try to
disconnect an already disconnected device, throwing the assertion:

  NetworkManager:ERROR:src/devices/nm-device.c:9845:
  activate_stage5_ip4_config_result: assertion failed: (req)

Fixes: 28f6e8b4d2
(cherry picked from commit 260cded3d6)
2018-07-11 17:28:22 +02:00
Thomas Haller
d2b4a6c35b connectivity: downgrade verbosity of error logging
Such failures during connectivity checks, may happen frequently
and due to external causes. Don't log with error level to avoid
spamming the logfile.

(cherry picked from commit ca9981eb5d)
2018-07-11 16:44:28 +02:00
Beniamino Galvani
9748aef7c7 manager: accept non-null device for VPN activations
Commit 10753c3616 ("manager: merge VPN handling into
_new_active_connection()") added a check to fail the activation of
VPNs when a device is passed to ActivateConnection(), since the device
argument is ignored for VPNs.

This broke activating VPNs from nm-applet as nm-applet sets both the
specific_object (parent-connection) and device arguments in the
activation request.

Note that we already check in _new_active_connection() that when a
device is supplied, it matches the device of the parent
connection. Therefore, the check can be dropped.

Reported-by: Michael Biebl <biebl@debian.org>
Fixes: 10753c3616

https://github.com/NetworkManager/NetworkManager/pull/159
(cherry picked from commit e205664ba8)
2018-07-09 13:41:42 +02:00
Thomas Haller
ffcd74e9e4 build/meson: fix meson build without pppd
Fixes: 1cdb36b8de
(cherry picked from commit 530b82a372)
2018-07-09 12:31:36 +02:00
Jan Tojnar
e117fc0b2d ppp-manager: use configured pppd path
Path to pppd can be set via configure flag but the source code ignores it.

Let's use PPPD_PATH like other calls of nm_utils_find_helper do.

https://bugzilla.gnome.org/show_bug.cgi?id=796752
(cherry picked from commit 1cdb36b8de)
2018-07-09 11:34:44 +02:00
Beniamino Galvani
fa5fa51f4b platform: change temp variable name in NLA_PUT_TYPE()
__tmp clashes with htole16() on s390x.

Fixes: 4120ad2431

https://github.com/NetworkManager/NetworkManager/pull/151
(cherry picked from commit 4888ee7e83)
2018-07-01 18:42:35 +02:00
Thomas Haller
1609344eda device: only check for IPv6 DAD and link-local address on actively managed devices
In device_ipx_changed() we only keep track of dad6_failed_addrs
addresses if the device's state is > DISCONNECTED.

For the same reason, we should also do that in queued_ip_config_change().

But it's worse. If the device is in state disconnected, and the user
externally adds IPv6 addresses, we will end up in queued_ip_config_change().
It is easily possible that "need_ipv6ll" ends up being TRUE, which results
in a call to check_and_add_ipv6ll_addr() and later possibly

  ip_config_merge_and_apply (self, AF_INET6, TRUE);

This in turn will modify the IP configuration on the device, although
the device may be externally managed and NetworkManager shouldn't touch it.

https://bugzilla.redhat.com/show_bug.cgi?id=1593210
(cherry picked from commit 890c748643)
2018-06-29 16:43:10 +02:00
Thomas Haller
e7ea66eb1a device: emit IP address changes in queued_ip_config_change() only once
We first iterate over addresses that might have failed IPv6 DAD and
update the state in NMNDisc.

However, while we do that, don't yet invoke the changed signal.
Otherwise, we will invoke it multiple times (in case multiple addresses
failed). Instead, keep track of whether something changed, and handle
it once a bit later.

(cherry picked from commit f312620276)
2018-06-29 16:43:10 +02:00
Thomas Haller
b638edf4a0 device: refactor handling dad6_failed_addrs in queued_ip_config_change()
Whenever we process queued IP changes, we must handle all pending
dad6_failed_addrs. This is, to ensure we don't accumulate more
and more addresses in the list.

Rework the code, by stealing the entire list once at the beginning

    dad6_failed_addrs = g_steal_pointer (&priv->dad6_failed_addrs);

and free it at the end:

    g_slist_free_full (dad6_failed_addrs, (GDestroyNotify) nmp_object_unref);

This makes it easier to see, that we always process all addresses in
priv->dad6_failed_addrs.

(cherry picked from commit e2c13af805)
2018-06-29 16:43:10 +02:00
Thomas Haller
f5b48bd973 device: split handling for dad6_failed_addrs and dad6_ip6_config in queued_ip_config_change()
There is no change in behavior, however don't handle dad6_failed_addrs
and dad6_ip6_config in the same block.

While both parts are related to IPv6 DAD, they do something rather
different:

 - the first block, checks all candidates from dad6_failed_addrs whether
   they actually indicate DAD failed, and handles them by notifying
   NMNDisc about failed addresses.

 - the second block, checks whether we have now all addresses from
   dad6_ip6_config that we are waiting for.

Split the blocks.

(cherry picked from commit 3fcdba1a19)
2018-06-29 16:43:10 +02:00
Thomas Haller
b86d8968d5 device: simplify postponing IP config change in queued_ip_config_change()
We don't need to cancel the current idle-action and schedule a new
one. Just return and wait to be called again.

Also, drop the logging. Similarly, we don't log the postponing for
the previous case either.

(cherry picked from commit 63cf5bd249)
2018-06-29 16:43:10 +02:00
Thomas Haller
171001c34d device: clear dad6_failed_addrs in _cleanup_ip_pre()
We also cancel the idle handler

  nm_clear_g_source (&priv->queued_ip_config_id_x[IS_IPv4])

which means, nobody is going to process these addresses (at least
for the moment).

The purpose of "dad6_failed_addrs" is to keep track of addresses that
might be interesting for checking about DAD failures. If we are no
longer reacting on IP changes (because the idle handler was removed),
we also no longer need these addresses.

(cherry picked from commit dbb936e5c8)
2018-06-29 16:43:10 +02:00
Thomas Haller
3ce80c8d65 device: simplify handling of IP config changes while initializing link
This simplifies commit 31ca7962f8.

We don't need the boolean flags like "queued_ip4_config_pending" to
track whether we received any platform signals while being not yet
initialized in platform (udev, NM_UNMANAGED_PLATFORM_INIT).

In general, as long as the device is NM_UNMANAGED_PLATFORM_INIT,
all platform signals are ignored. And when the device becomes managed,
we schedule anyway an initial config-change.

(cherry picked from commit 18ecc4b4f1)
2018-06-29 16:43:10 +02:00
Beniamino Galvani
5ccd7f7fd7 device: clear the dhcp grace-period source id
Fixes: 17009ed91d
(cherry picked from commit db1867bafd)
2018-06-29 16:12:14 +02:00
Timothy Redaelli
bb9ce74a59 contrib/rpm: Use Open vSwitch instead of OpenVSwitch
The correct naming is Open vSwitch so use it instead of OpenVSwitch

[lkundrak@v3.sk: added some more cases of the same]

https://github.com/NetworkManager/NetworkManager/pull/150

Fixes: 830a5a14cb
(cherry picked from commit 9be0c3330d)
2018-06-28 20:40:13 +02:00
Thomas Haller
dbd48f260e logging: warn about invalid logging backends and drop "debug" backend
"debug" was documentation in `man NetworkManager.conf` as a valid
logging backend. However, it was completely ignored by
nm_logging_syslog_openlog().
In fact, it makes not sense. Passing debug = TRUE to
nm_logging_syslog_openlog(), means that all messages will be
printed to stderr in addition to syslog/journal. However, when
NetworkManager is daemonizing, stderr is closed.
Whether NetworkManager is daemonizing depends entirely on command
line options --no-daemon and --debug. Hence, the logging backend "debug"
from the configuration file either conflicts or is redundant.

Also, adjust logging backend description in `man NetworkManager.conf`.

Also, log a warning about invalid/unsupported logging backend.

(cherry picked from commit 2ccf6168dc)
2018-06-27 09:21:33 +02:00
Thomas Haller
a64b424da3 logging/trivial: add code comment about logging-backend
(cherry picked from commit 504ad2aeed)
2018-06-27 09:21:33 +02:00
Thomas Haller
1b83cab13b logging: move fetching monotonic timestamp to end of nm_logging_syslog_openlog()
It just makes more sense to first fully setup logging, and then fetching
the timestamp. In practice, the effect previously was very similar.

(cherry picked from commit 2912155584)
2018-06-27 09:21:33 +02:00
Thomas Haller
64e14855f7 main: warn about invalid logging domains configuration using nm-log
Delay warning about invalid domains until we setup syslog and nm-logging.
Preferably, we don't log anything by directly printing to stdout/stderr.

(cherry picked from commit 4439b6a35d)
2018-06-27 09:21:33 +02:00
Thomas Haller
b4844435be main: accept invalid logging configuration in NetworkManager.conf gracefully
https://bugzilla.redhat.com/show_bug.cgi?id=1593519
(cherry picked from commit 11303fd2d1)
2018-06-27 09:21:33 +02:00
Thomas Haller
5be0ad48e8 main: free error variable in main() at exit
Just try to free everything that was allocated. Don't leak
error in case of failure.

(cherry picked from commit 9e20ba6646)
2018-06-27 09:21:33 +02:00
Beniamino Galvani
4c2e7b6d4d bond: fix setting num_grat_arp option
'num_grat_arp' and 'num_unsol_na' are actually the same attribute on
kernel side, so if only 'num_grat_arp' is set in configuration, we
first write its value and then overwrite it with the 'num_unsol_na'
default value (1). Instead, just write one of the two option.

https://bugzilla.redhat.com/show_bug.cgi?id=1591734
(cherry picked from commit 42b0bef33c)
2018-06-25 10:53:42 +02:00
Beniamino Galvani
b445c59f2e device: rework mtu priority handling
If commit_mtu() is called multiple times and dev->get_configured_mtu()
returns @is_user_config=FALSE, only the first call changes the
MTU. So, for example, when the parent MTU of a VLAN changes, we apply
the new MTU only the first time.

Rework the handling of MTU in NMDevice, and store the source of the
configured MTU. When commit_mtu() is called again, we ask the subclass
a MTU to configure and apply it only if the source has higher
priority, or when the parent MTU changed.

(cherry picked from commit 2f8917237f)
2018-06-23 12:03:43 +02:00
Beniamino Galvani
ccecc6db59 device: introduce mtu source
Instead of returning a boolean @is_user_config value from
get_configured_mtu(), return an mtu-source enum with possible values
NONE,CONNECTION. This enum will be expanded later; for now there is no
change in behavior.

(cherry picked from commit 9f8b0697de)
2018-06-23 12:03:40 +02:00