Commit Graph

21088 Commits

Author SHA1 Message Date
Lubomir Rintel
96571ec621 build: ensure libnm-core is around before mkenums puts files there
It's not sufficient to make nm-core-enum-types.[ch] depend on the
dirstamp, because they also depend on their own stamps that are to be
placed in libnm-core.

  $ make libnm-core/nm-core-enum-types.h.stamp
    GEN      libnm-core/nm-core-enum-types.h
  /bin/sh: libnm-core/nm-core-enum-types.h.tmp: No such file or directory
  ../../Makefile.glib:107: recipe for target 'libnm-core/nm-core-enum-types.h.stamp' failed
  make: *** [libnm-core/nm-core-enum-types.h.stamp] Error 1
2017-03-23 17:41:04 +01:00
Beniamino Galvani
e832461c0e ifcfg-rh: fix coding style 2017-03-23 17:19:21 +01:00
Francesco Giudici
3ebe71cf06 dns: avoid cleaning resolv.conf on exit if not needed
When rc-manager=file other services may overwrite resolv.conf at any
time. We don't support merging configurations in resolv.conf but we can
be more tolerant avoiding updating resolv.conf when not strictly needed.
In this case, if the last write of resolv.conf had no nameservers (nor
options), reset the "dns_touched" flag in order to avoid resetting
resolv.conf when quitting (so, potentially overwriting some other
service configuration there).

https://bugzilla.redhat.com/show_bug.cgi?id=1426748
2017-03-23 17:05:19 +01:00
Iain Lane
6a77258f4e nm-manager: Use g_dbus_message_new_method_error_literal()
GLib 2.52 added a G_GNUC_PRINTF attribute to
g_dbus_message_new_method_error(). This triggered warning in
NetworkManager when built with -Wformat, which is an error when built
with -Werror=format-security. It seems that gcc isn't smart enough to
see that (foo = "bar") should be treated as a literal.

Fortunately there is a g_dbus_message_new_method_error_literal()
function which does not take printf-style arguments, and we don't need
them, so we can use that.

This patch was originally by Rico Tzschichholz <ricotz@ubuntu.com>, and
was submitted to Launchpad at

https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1650972
https://bugzilla.gnome.org/show_bug.cgi?id=780444
2017-03-23 13:11:15 +01:00
Thomas Haller
9e4f3655f0 connectivity: remove verbose trace logging 2017-03-23 12:08:05 +01:00
Thomas Haller
8ddc3e308c platform: remove debug logging messages from "nmp-object.c" 2017-03-23 11:55:34 +01:00
Thomas Haller
3ac07f381e connectivity: fix clearing timer-id in curl_timeout_cb()
Fixes: 7307dea9c4
2017-03-22 21:00:24 +01:00
Lubomir Rintel
08cc81d450 connectivity: fix the connectivity check timeout
CURLOPT_CONNECTTIMEOUT or CURLOPT_TIMEOUT only make sense if libcurl is
handling the I/O loop (the "easy" interface); we need to implement our
own timeout.
2017-03-22 19:06:41 +00:00
Lubomir Rintel
d7e470b0aa connectivity: conclude the check as soon as we see enough bytes
No need to read the full response into memory.
2017-03-22 18:52:56 +00:00
Lubomir Rintel
ac0f454cfb connectivity: conclude the check as soon as we see the magic header
No need to read the rest of the reponse.
2017-03-22 18:52:56 +00:00
Lubomir Rintel
71b8d16eb8 connectivity: split out the finish of the connectivity checking
Factor out the conclusion of the connectivity check. This will allow us
to finish the connectivity check on other occassions than a successful
connection end. Most importantly on timeouts; but it will also allow us
to short-circuit the check when we conclude it without reading the full
response.
2017-03-22 18:52:56 +00:00
Lubomir Rintel
6bc3ada0ec connectivity: cosmetic fixes 2017-03-22 18:52:50 +00:00
Lubomir Rintel
faad17f9e8 contrib/rpm: enable libpsl on Fedora only 2017-03-22 13:01:23 +01:00
Thomas Haller
9faba2cf96 udev: merge branch 'th/gudev-bgo780308'
https://bugzilla.gnome.org/show_bug.cgi?id=780308
2017-03-22 12:52:40 +01:00
Thomas Haller
6808bf8195 udev: add and use nm_udev_utils_property_decode() function
DRY.
2017-03-22 12:41:06 +01:00
Thomas Haller
c7ccdf5fc8 libnm/udev: cache and reuse udev instance for NMDevice
No need to create a separate NMUdevClient instance for all devices.
Instead, have one "struct udev" instance in NMClient and pass
it down during object construction.
2017-03-22 12:41:06 +01:00
Thomas Haller
c48c13b8e5 udev: only create monitor in NMUdevClient when needed
GUdevClient always creates a monitor instance, even if there are no subsystems
or handlers defined. Hence the first iteration of NMUdevClient did that as
well.

I think that can be avoided however. We only need a monitor when there is
a event handler subscribed. Contrary to GUdevClient, we know that from the
very beginning.
2017-03-22 12:41:06 +01:00
Thomas Haller
e32839838e udev: drop libgudev in favor of libudev
libgudev is just a wrapper around libudev. We can
use libudev directly and drop the dependency for
libgudev.
2017-03-22 12:41:06 +01:00
Lubomir Rintel
edaa7d064e merge: branch 'lr/rp-filter'
https://bugzilla.gnome.org/show_bug.cgi?id=780155
2017-03-22 12:21:56 +01:00
Lubomir Rintel
cae3cef60f device: apply a loose IPv4 rp_filter when it would interfere with multihoming
The IPv4 Strict Reverse Path Forwarding filter (RFC 3704) drops legitimate
traffic when the same route is present on multiple interfaces, which is a
pretty common scenario for IPv4 hosts. In particular, if the traffic is
routable via multiple interfaces it drops traffic incoming via the device that
has lower metric on the route to the originating network.

Among other things, this disrupts existing connection when the user connected
to the Internet via Wi-Fi activates a Wired Ethernet connection that also has a
default route. Also, the Strict filter (and Reverse Path filters in general)
provide practically no value to hosts that have a default route.

The solution this patch uses is to detect scenarios where Strict filter is
known to interfere and switch to a saner RP filter on the affected links.
Routes to the same network on multiple interfaces is a good indication the RP
filter would drop the legitimate traffice from the link with a lower metric.
This includes the default routes.

In such cases, we switch to the Loose Reverse Path Forwarding. This addresses
the problems the multihomed hosts face, at the cost of disabling filtering
altogether when a default route is present. A Feasible Path Reverse Path
Forwarding would address the main problems with the Strict filter, but it's
not implemented by the Linux kernel.
2017-03-22 12:21:39 +01:00
Lubomir Rintel
56e7e657b6 device: add convenience routines for IPv4 sysctls 2017-03-22 12:21:39 +01:00
Lubomir Rintel
1b60b76871 route-manager: emit a signal when IPv4 routes change
The devices will use this to reconsider their RP filtering decisions.
2017-03-22 12:21:39 +01:00
Lubomir Rintel
75faf5bb77 route-manager: add routine to query route shadowing for a link
If a route is shadowed by another route to the same network it's a good
indication we're multihoming and want to disable the Strict RP filtering.
2017-03-22 12:21:39 +01:00
Dan Williams
8d4570d28d ppp: only request IPV6CP when IPv6 is enabled in the connection
NM always asks pppd to run IPV6CP which will complete if the modem supports
IPv6.  If the user doesn't want IPv6 then NM just ignores the result.  But
if the host has disabled IPv6, then pppd will fail to complete the connection
because pppd tries to assign the Link-Local address to the pppX interface,
and if IPv6 is disabled that fails and terminates the PPP session.

So only request IPV6CP when the user wants IPv6 on the connection; if they
have disabled IPv6 on their host then they can simply set ipv6.method=ignore.

https://mail.gnome.org/archives/networkmanager-list/2017-March/msg00047.html
2017-03-22 12:20:25 +01:00
Lubomir Rintel
7d8f489933 merge: branch 'lr/fg/libcurl_bgo752642'
https://bugzilla.gnome.org/show_bug.cgi?id=752642
2017-03-22 12:09:49 +01:00
Francesco Giudici
7307dea9c4 connectivity: switch connectivity checking to libcurl
[lkundrak@v3.sk: removed libsoup altogether, implemented TODOs and fixed
the poll condition handling]

Co-authored-by: Lubomir Rintel <lkundrak@v3.sk>
2017-03-22 12:09:39 +01:00
Lubomir Rintel
724b600a71 dns-manager: turn DOMAIN_IS_VALID into a function 2017-03-22 12:09:39 +01:00
Lubomir Rintel
c05befd5aa dns-manager: use libpsl directly
...instead of via libsoup. This makes it possible to do gTLD suffix checking
even if we're building without libsoup support.
2017-03-22 12:09:39 +01:00
Beniamino Galvani
80dfb8cdab core,libnm-core: use same route attribute names of iproute2
Users are probably more familiar with iproute2 route option names than
kernel ones.

Fixes: 54e58eb96b
2017-03-22 12:04:25 +01:00
Beniamino Galvani
d3b1e08c9a Merge branch 'bg/wext-refresh-ifname-bgo779788'
https://bugzilla.gnome.org/show_bug.cgi?id=779788
2017-03-21 18:51:38 +01:00
Beniamino Galvani
c26471e7de wifi-utils: nl80211: use logging macros 2017-03-21 18:46:52 +01:00
Beniamino Galvani
dda2b84ccc wifi-utils: wext: use logging macros 2017-03-21 18:46:52 +01:00
Beniamino Galvani
f4a8a7f2a6 shared: increase max number of args for _NM_UTILS_MACRO_REST
30 should be enough for anybody.
2017-03-21 18:46:52 +01:00
Beniamino Galvani
ed8da2cd25 wifi-utils: fix use of errno
It can be overwritten when other arguments are evaluated.
2017-03-21 18:46:52 +01:00
Beniamino Galvani
3860c2fbe3 wifi-utils: don't cache interface name
For nl80211, we don't care about the interface name and only use it
when formatting error messages. For wext, an up-to-date interface name
should be obtained every time to minimize the chance of race
conditions when the interface is renamed.
2017-03-21 18:46:52 +01:00
Beniamino Galvani
7de4912ff0 libnm: fix emission of NMActiveConnection::state notify signal
state_changed_proxy() updates the value of @state and must also emit
the notify signal for it.

Without this, when the PropertiesChanged signal carrying the change of
'state' arrives after StateChanged, we notice that the value of @state
doesn't change and don't emit the notify, causing a loss of the state
change event.

Fixes: 40ffb962be

https://bugzilla.redhat.com/show_bug.cgi?id=1433883
2017-03-21 17:52:58 +01:00
Thomas Haller
9749fdbf34 po: make update-po 2017-03-21 15:07:17 +01:00
Piotr Drąg
531b05f3d6 po: update Polish (pl) translation (bgo #780277)
https://bugzilla.gnome.org/show_bug.cgi?id=780277
2017-03-21 14:58:08 +01:00
Yuri Chornoivan
e2c526f071 po: update Ukrainian (uk) translation (bgo#780201)
https://bugzilla.gnome.org/show_bug.cgi?id=780201
2017-03-21 14:55:24 +01:00
Thomas Haller
6c2895f875 po: import Zanata translations 2017-03-21 14:55:00 +01:00
Beniamino Galvani
2e0c3d1dac manager: ensure proper disposal of unrealized devices
When remove_device() is called on an already unrealized device, we
should release it from master if necessary and clear its IP
configurations to avoid leaks.

https://bugzilla.redhat.com/show_bug.cgi?id=1433303
2017-03-21 13:25:36 +01:00
Thomas Haller
714504faf2 libnm/nm-vpn-connection: un-deprecate the NMVpnStateReason use in a header
Otherwise merely including a header would trigger a deprecation warhing.
The signal slot is not really used anyway.
2017-03-20 14:51:11 +01:00
Thomas Haller
c033330c41 libnm: fix memleak of GUdevDevice in get_bus_name()
Fixes: f7b1b28202
2017-03-20 11:28:58 +01:00
Thomas Haller
b33b15ae76 doc: fix generate-setting-docs.py for supporting Python 3 sorted() style
Python 3 has no "cmp" argument to sorted().

Fixes: b0da972f5f
2017-03-20 11:12:40 +01:00
Thomas Haller
b869d9cc0d device: add spec "driver:" to match devices
Changing the MAC address of devices is known to fail with
certain drivers. Add a device-spec to allow disabling it
for for such devices.

Related: https://bugzilla.gnome.org/show_bug.cgi?id=777523
2017-03-17 17:40:00 +01: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
5022e3b8ee libnm: revert coercing NMVpnConnectionStateReason to NMActiveConnectionStateReason
NMVpnConnectionStateReason is no longer used and replaced by
NMActiveConnectionStateReason. However, the old enums should
stay in place as they were:

Otherwise:
  #define NMVpnConnectionStateReason NMActiveConnectionStateReason
causes compiler warnings:
  NMVpnConnectionStateReason x;
  x = NM_VPN_CONNECTION_STATE_REASON_UNKNOWN;             // -Wenum-conversion
  if (x == NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS) { } // -Wenum-compare

Similarly, a user who didn't upgrade shall continue to get the
old GType for NM_TYPE_VPN_CONNECTION_STATE_REASON.

In practice, old users will have no issues using the old enum
the places where it worked before.
The only use of the deprecated enum is in vpn_state_changed()
signal slot of NMVpnConnection. This makes the signal slot
itself deprecated. However, NMVpnConnection is an NMObject and commonly
created within libnm itself, not by the user. It is very unlikely that
a user of libnm subclassed NMVpnConnection and makes use of the
vpn_state_changed() signal slot. So, deprecate it without replacement.

Fixes: a91369f80d
2017-03-17 13:00:32 +01:00
Thomas Haller
e65aa9e6ff trivial/whitespace: remove non-leading tabs 2017-03-17 10:58:33 +01:00
Thomas Haller
fa262e3dc4 libnm: fix chaining up NMActiveConnection::constructed()
Fixes: 40ffb962be
2017-03-17 10:50:42 +01:00
Lubomir Rintel
1e4f1892e0 merge: branch 'lr/active-connection-state-changed'
https://bugzilla.gnome.org/show_bug.cgi?id=779627
2017-03-17 10:21:57 +01:00