Commit graph

12645 commits

Author SHA1 Message Date
Thomas Haller
baefcdbade device: clear queued_state callback in dispose
dispose() calls _cleanup_generic_pre() which in turn already calls
nm_device_queued_state_clear(). So we would expect that at the end
of dispose() no queued-state is pending.

However, there there are crashes reports in queued_set_state() with the
device instance already destructed (rh#1270247). Add this check trying
to avoid the crash and closing in on the cause.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1180827
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1270247
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1298009
(cherry picked from commit 76f90812f4)
2016-01-19 13:16:23 +01:00
Beniamino Galvani
8213479247 device: merge branch 'bg/device-zero-mac-fix-rh1288110'
https://bugzilla.redhat.com/show_bug.cgi?id=1288110
2016-01-11 14:57:10 +01:00
Beniamino Galvani
8d5eeda5eb device: wait for valid MAC before making ethernet devices available
In certain situations, ethernet links first appear with a zero MAC
address and then the MAC changes some time later. Currently NM does
not deal correctly with this scenario since it initializes wrong
@initial_hwaddr and @permanent_hwaddr on the device and tries to
immediately activate it.

To fix this, initialize the device's addresses only when the MAC
becomes valid and make the device available only at that point.

(cherry picked from commit 92149f223f)
2016-01-11 14:56:48 +01:00
Beniamino Galvani
7296a88c3c device/trivial: split out nm_device_update_initial_hw_address()
(cherry picked from commit 2a0a9aa2e4)
2016-01-11 14:56:48 +01:00
Beniamino Galvani
958ac50182 core: simplify generation of default connection for new devices
Instead of using a signal for triggering the generation of a default
connection when the device becomes managed, let the manager wait for a
transition to UNAVAILABLE or DISCONNECTED states.

This partially reverts b3b0b46250 ("device: retry creation of
default connection after link is initialized").

(cherry picked from commit 44789e3291)
2016-01-11 14:56:48 +01:00
Matthew Millar
49107121ab build: fix missing <gio/gio.h> include for "nm-dns-manager.c"
When compiling with

  ./configure \
    --without-libsoup \
    --disable-concheck \
    --with-resolvconf=/xx/yy/resolvconf

we must explicitly include <gio/gio.h>.

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

[thaller@redhat.com: original patch modified to always include gio.h]
2016-01-11 12:53:34 +01:00
Thomas Haller
288eb02280 build: minor change creating symlinks in install-exec-hook for nmtui
(cherry picked from commit 39d6976e89)
2016-01-07 17:42:51 +01:00
Michael Biebl
c96b1ca343 build: use symlinks for nmtui
Make /usr/bin/nmtui-* symbolic links to /usr/bin/nmtui.

https://bugzilla.gnome.org/show_bug.cgi?id=759824
(cherry picked from commit 39fc73eed9)
2016-01-07 17:42:50 +01:00
Thomas Haller
a213db5113 wifi: merge branch 'th/wifi-device-creation-bgo760154'
https://bugzilla.gnome.org/show_bug.cgi?id=760154

(cherry picked from commit 06e0595401)
2016-01-06 22:41:00 +01:00
Thomas Haller
7a3940a027 wifi: refactor creation of NMDeviceWifi/NMDeviceOlpcMesh to initialize in constructed() method
(cherry picked from commit 1a835ad3d0)
2016-01-06 22:37:18 +01:00
Thomas Haller
ccd2ec7b34 wifi: don't fail construction of NMDeviceWifi in constructor
We cannot abort the construction of a GLib object instance
like we did for NMDeviceWifi and NMDeviceOlpcMesh when
nm_platform_wifi_get_capabilities() failed.

Instead, check the capabilities first (in the factory method)
and only create the object instance when the device can be handled.

https://bugzilla.gnome.org/show_bug.cgi?id=760154
(cherry picked from commit 044de4cea2)
2016-01-06 22:34:29 +01:00
Thomas Haller
75131ed654 wifi-olpc: refactor NMDeviceOlpcMesh to hold pointer to NMManager
Objects that register to a signal of a singleton should own a reference
to the singleton to ensure the proper lifetime of the singleton upon shutdown.

(cherry picked from commit e2e22eb574)
2016-01-06 22:25:26 +01:00
Beniamino Galvani
2f012d80d7 device/infiniband: take interface down to set transport mode
With some drivers it is necessary to take the interface down to set
the transport mode.

https://bugzilla.redhat.com/show_bug.cgi?id=1281301
(cherry picked from commit 5bf0697f65)
2016-01-05 19:01:16 +01:00
Beniamino Galvani
cbcb848e6d device: update @ip_iface only if IP interface exists
If @ip_ifindex is zero, the IP interface has disappeared and
there's no point in updating @ip_iface.

Actually, unconditionally updating @ip_iface is dangerous because it
breaks the assumption used by other functions (as
nm_device_get_ip_ifindex()) that a non-NULL @ip_iface implies a valid
@ip_ifindex. This was causing the scary failure:

  devices/nm-device.c:666:get_ip_iface_identifier: assertion failed: (ifindex)

https://bugzilla.redhat.com/show_bug.cgi?id=1268617
(cherry picked from commit ed536998f9)
2016-01-05 18:44:10 +01:00
Beniamino Galvani
8204c2a196 ppp-manager: clear @ppp_watch_id upon pppd termination
Set @ppp_watch_id to zero upon pppd termination, otherwise the call to
g_source_remove(priv->ppp_watch_id) in dispose() could trigger a failed
assertion.

(cherry picked from commit 5f93f01015)
2016-01-05 18:44:08 +01:00
Thomas Haller
11aa07ed93 core: fix failure to configure routes due to wrong device-route for IPv4 peer-addresses
As in the case of a OpenVPN connection, we might add an address like:
  10.8.0.58/32 ptp 10.8.0.57

In this case, kernel would automatically add a device-route like:
  10.8.0.57/32 via 0.0.0.0 dev 32 metric 0 mss 0 src rtprot-kernel scope link pref-src 10.8.0.58

nm_ip4_config_commit() checks all IP addresses to figure out
the present device-routes. Then the routes are synced by NMRouteManager.
Due to a bug, we would not consider the peer-address, but the local-address
and configure a route 10.8.0.58/32, instead of 10.8.0.57/32.

That stays mostly unnoticed, because usually the peer and the local-address are
in the same subnet, so that there is no difference (/32 is an example of the
peer-address being in a different subnet).

It also seems that due to a bug fixed by df4e535752 this issue didn't surface.
Probably because we would not notice the 10.8.0.57/32 right away and thus
nm_route_manager_ip4_route_sync() would not wrongly delete it.

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

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809195
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809494
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809526
https://bugs.archlinux.org/task/47535
https://bugzilla.redhat.com/show_bug.cgi?id=1294309
https://mail.gnome.org/archives/networkmanager-list/2015-December/msg00059.html
2016-01-05 10:16:41 +01:00
Beniamino Galvani
a232f885c2 man: fix typos
(cherry picked from commit 2ef3c1047d)
2015-12-24 09:58:33 +01:00
Lubomir Rintel
c163759fe4 release: bump version to 1.0.10 2015-12-23 14:59:08 +01:00
Lubomir Rintel
7f58a83a8c release: update NEWS 2015-12-23 14:56:55 +01:00
Lubomir Rintel
c29906d9ff po: fix some typos in Galician translation
(cherry picked from commit dff1829c99)
2015-12-23 14:52:56 +01:00
Lubomir Rintel
4429f2af1b po: merge in master translations 2015-12-23 14:32:21 +01:00
Lubomir Rintel
676f3079b8 po: update-po 2015-12-23 14:32:18 +01:00
Rafael Fontenelle
904dad1e8d po: update Brazilian Portuguese translation
https://bugzilla.gnome.org/show_bug.cgi?id=759747
2015-12-23 14:01:00 +01:00
Anders Jonsson
8a6a52c4e9 po: update Swedish translation
https://bugzilla.gnome.org/show_bug.cgi?id=759637
2015-12-23 13:54:50 +01:00
Beniamino Galvani
86ceade93a device/vlan: fix failed assertion in parent_hwaddr_changed()
Parent MAC can be NULL if the interface has gone, fix the following
failed assertion:

  [devices/nm-device-vlan.c:107] parent_hwaddr_changed(): (vlan1): parent hardware address changed
  nm_device_set_hw_addr: assertion 'addr != NULL' failed

While at it, improve logging by printing the new MAC address.

Fixes: e6d7fee5a6
(cherry picked from commit e1d06d7a0b)
2015-12-22 15:18:44 +01:00
Thomas Haller
668c1e6d22 macros: add NM_PRINT_FMT_QUOTE_STRING() macro
(cherry picked from commit 6bcc1eda0b)
2015-12-22 15:18:44 +01:00
Thomas Haller
2583110ef9 libnm-util: allow unknown setting types in nm_connection_get_virtual_iface_name()
Allow calling nm_connection_get_virtual_iface_name() on a non-verified
connection by not asserting asserting against a valid base-setting.

On nma-1-0 branch, nm-applet can crash with:

    #3  0x00007ffff2993a7a in g_assertion_message_expr (domain=0x7ffff51fad86 "libnm-util", file=0x7ffff51fb728 "nm-connection.c", line=320, func=0x7ffff51fc028 "_get_type_setting", expr=<optimized out>) at gtestutils.c:2444
    #4  0x00007ffff51ac52f in _get_type_setting (connection=0xa3c160 [NMRemoteConnection]) at nm-connection.c:320
    #5  0x00007ffff51ac341 in nm_connection_get_virtual_iface_name (connection=0xa3c160 [NMRemoteConnection]) at nm-connection.c:1436
    #6  0x0000000000415bdc in add_virtual_items (type=type@entry=0x43c11d "bridge", all_devices=all_devices@entry=0x7f6580, all_connections=all_connections@entry=0x9354a0, menu=menu@entry=0x922990 [GtkMenu], applet=applet@entry=0x6cc000 [NMApplet]) at applet.c:1640
    #7  0x00000000004176f6 in nma_menu_add_devices (menu=menu@entry=0x922990 [GtkMenu], applet=applet@entry=0x6cc000 [NMApplet]) at applet.c:1713
    #8  0x0000000000418315 in nma_menu_show_cb (menu=0x922990 [GtkMenu], applet=0x6cc000 [NMApplet]) at applet.c:1974

where the connection type is "tun".

Note that libnm accepts invalid connections and exposes them to the
user (albeit issuing a warning). Later on there are many places where
that can lead to further g_return*(), which is ugly indeed.
At least, we should not assert against valid connections (because that
crashes the user) and there is a well known fact that the base setting
will be missing for tun settings. No need to even warn about that in
nm_connection_get_virtual_iface_name() (we already got the warning
during replace_settings).

(cherry picked from commit 8c27a370ff)
2015-12-18 14:51:06 +01:00
Thomas Haller
c9e24ff528 cli: fix spelling in error message
https://bugzilla.gnome.org/show_bug.cgi?id=759555

(cherry picked from commit 0959109b19)
2015-12-17 12:28:14 +01:00
Piotr Drąg
ab07a0cb1d po: update Polish (pl) translation (bgo #759562)
https://bugzilla.gnome.org/show_bug.cgi?id=759562

(cherry picked from commit d612cccc4f)
2015-12-17 12:19:20 +01:00
Milo Casagrande
07ee7ca027 po: update Italian (it) translation (bgo #759577)
https://bugzilla.gnome.org/show_bug.cgi?id=759577
2015-12-17 12:10:15 +01:00
Dan Williams
65118df457 adsl: look up ATM index before construction
Fixes a crash if we can't read the ATM index.  We need the ATM
index, and we can't do anything with the device before we have it,
so don't bother creating one if we we can't get it.

NetworkManager[9662]: <error> [1449678770.705541] [nm-device-adsl.c:607] constructor(): (atmtcp0): error reading ATM device index

(NetworkManager:9662): GLib-GObject-CRITICAL **: object NMDeviceAdsl 0x1e8f880 finalized while still in-construction

(NetworkManager:9662): GLib-GObject-CRITICAL **: Custom constructor for class NMDeviceAdsl returned NULL (which is invalid). Please use GInitable instead.
**
NetworkManager-adsl:ERROR:nm-atm-manager.c:121:adsl_add: assertion failed: (device)

(cherry picked from commit 9bb96b00a5)
2015-12-16 09:38:38 -06:00
Dan Williams
48c9a1fcc6 adsl: fix detection of br2684 ("nas") interface (bgo #759001)
At some point the platform changed to no longer ask the kernel for
interfaces when one wasn't in its cache, but to wait for netlink
events to be notified of the new interface.  That broke some assumptions
that the ADSL code was making, causing a crash.

Rework the ADSL br2684 interface to clean up a couple of things
(get rid of 'disposed', consolidate dispose/deactivate cleanup) and
watch for the br2684 interface to show up with a periodic timeout.

(cherry picked from commit 29f4de09a5)
2015-12-16 09:35:05 -06:00
Lubomir Rintel
fb2dced9c3 build: bump soup requirement to 2.40
The dns-manager uses some newer API.

(cherry picked from commit 7873b1761d)
2015-12-16 14:31:12 +01:00
Lubomir Rintel
d0c3dac64b build: use soup 2.32
We already use 2.32 API and also use API that was replaced with new one after
2.42 and deprecated in 2.53.

(cherry picked from commit 15f1cd09d9)
2015-12-16 14:31:07 +01:00
Beniamino Galvani
2469083902 clients: fix build with old GLib
G_DEFINE_QUARK is only available since 2.34, include
"nm-glib-compat.h" to fix the following error:

 ./../common/nm-vpn-helpers.c: In function ‘G_DEFINE_QUARK’:
 ./../common/nm-vpn-helpers.c:54:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Fixes: dca2ded7e8
2015-12-14 16:30:25 +01:00
Jiří Klimeš
5745e954a1 merge: enable VPN secrets for nmtui/nmcli secret agent (rh #975185)
It allows nmcli and nmtui to ask for VPN passwords and thus successfully
activate VPN connections.
There is a special handling for OpenConnect, because the user does not know
the secrets. They have to be obtained by authenticating to OpenConnect server.

https://bugzilla.redhat.com/show_bug.cgi?id=975185
2015-12-12 22:33:51 +01:00
Jiří Klimeš
71cfa4fb79 tui: prefill a secret in the entry if we have a value
(cherry picked from commit a1536fe3d1)
2015-12-12 22:31:37 +01:00
Jiří Klimeš
3f2dd0b2a9 tui: allow connecting to OpenConnect
by running "openconnect --authenticate" and getting secrets from it

(cherry picked from commit 2e345faa7e)
2015-12-12 22:31:10 +01:00
Jiří Klimeš
19756e874d cli: do not present secrets from openconnect to the user for confirmation
It is pointless to present them and require user to press Return for each
password prompt.

(cherry picked from commit fb62fc76cb)
2015-12-12 22:30:48 +01:00
Jiří Klimeš
7acbf23b89 cli: make asking VPN secrets for OpenConnect really work
by running nm_vpn_openconnect_authenticate_helper() and filling the obtained
secrets to the array sent to NM.

(cherry picked from commit 45fc268890)
2015-12-12 22:30:09 +01:00
Jiří Klimeš
348ba7645b clients: add a helper function to get required openconnect VPN secrets
OpenConnect needs three secrets - COOKIE, HOST and FINGERPRINT. They can be
obtained by authenticating to the server. This can be performed by running
"openconnect --authenticate <host>" and the three values are printed to stdout.

Note that the function may (probably will) interactively ask user for
his credentials.

Alternatively, it would be possible to dlopen() libopenconnect and call its
functions. However, as that would be more complicated and would also require
implementing functionality that openconnect simply does for free for us, it is
not worth it, I think.

(cherry picked from commit ea54b7f2c0)
2015-12-12 22:29:25 +01:00
Jiří Klimeš
d6b98449a8 clients: add vpn_type member to secret structure in secret agent
It is useful to know what VPN type the secret belongs to.

(cherry picked from commit 8dfafac17c)
2015-12-12 22:29:03 +01:00
Jiří Klimeš
dca2ded7e8 clients: move vpn_get_secret_names() to nm-vpn-helpers
It should eventually move into libnm and ideally the data be obtained from VPN
plugins.

(No functional change, only moving the function).

(cherry picked from commit 6dd1e2673e)
2015-12-12 22:28:33 +01:00
Jiří Klimeš
9d18afb0e5 clients: enable VPN secrets for nmtui/nmcli secret agent (rh #975185)
It allows nmcli and nmtui to ask for VPN passwords and thus successfully
activate VPN connections.

https://bugzilla.redhat.com/show_bug.cgi?id=975185

(cherry picked from commit de86c23fbe)
2015-12-12 22:27:38 +01:00
Thomas Haller
088604f62e platform: fix memleak in _nl_link_parse_info_data()
Fixes: e9f364548a
2015-12-10 18:04:40 +01:00
Thomas Haller
5810502d19 platform: fix memleak in _nl_sock_flush_data()
Fixes: 9a16ce0876
(cherry picked from commit eeb7d20ee0)
2015-12-10 18:00:08 +01:00
Thomas Haller
feaa4e5b9a platform: EAGAIN is equal to EWOULDBLOCK
The macro EWOULDBLOCK is another name for EAGAIN; they are always the
  same in the GNU C Library.

  https://www.gnu.org/savannah-checkouts/gnu/libc/manual/html_node/Error-Codes.html

Otherwise, we would need a workaround for EWOULDBLOCK too, because
libnl maps that to NLE_FAILURE. So we would have to detect EAGAIN
as (nle == -NLE_FAILURE && errno == EWOULDBLOCK).

(cherry picked from commit d2fab2df54)
2015-12-10 17:57:22 +01:00
Thomas Haller
df4e535752 platform: fix event_handler_read_netlink_one() wrongly returning with nothing to read
When the errno was accidentally set to EAGAIN or EWOULDBLOCK,
we would only read one single message and return that there is
nothing to read.

This means, if there were more then one messages ready to read,
we would only read the first one and return to the main-loop
(which then again calls back to platform as more data is ready
to be read).

(cherry picked from commit 10b684b827)
2015-12-10 17:20:12 +01:00
Thomas Haller
a89feb474b tests/valgrind: rename name of logfile for valgrind run
Change the name of the file where to store the results
of the valgrind run.

Previously the file had a prefix "valgrind-", which is inconvinient.
Instead, have the file using the same name as the test executable,
with a ".valgrind-log" suffix.

(cherry picked from commit ce238a7074)
2015-12-05 20:36:24 +01:00
Beniamino Galvani
83f4c1c9bf core: strip trailing dot from domain search list
dhclient adds a trailing dot to domain search list entries received
from the server, while the same domains received by other means
(dhcpcd on RA) don't have the final dot. The result is that
resolv.conf can be populated with duplicated entries.

Fix this by stripping the trailing dot when a new search domain is
added to a IP configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=758777
(cherry picked from commit 6e990cf97b)
2015-12-05 10:08:15 +01:00