Commit graph

12665 commits

Author SHA1 Message Date
Beniamino Galvani
b0d84e84fa device/team: fix tiny memory leak
Fixes: 10f9b6c58b
(cherry picked from commit dc4d0a4200)
2016-02-01 22:32:20 +01:00
Thomas Haller
5d4d0fd7e6 connectivity: fix calling parent dispose()
(cherry picked from commit 2bf4960ec1)
2016-02-01 13:26:04 +01:00
Dan Williams
cb54c14cd5 platform: ignore permanent MAC addresses of all ones (FF:FF:FF:FF:FF:FF)
Drivers are stupid, and just like the platform ignores an all zeros
permanent address, so should it ignore all ones.

NetworkManager[509]: <debug> [1453743778.854919] [devices/nm-device.c:8885] nm_device_update_hw_address(): [0x190370] (eth0): hardware address now 86:18:52:xx:xx:xx
NetworkManager[509]: <debug> [1453743778.855438] [devices/nm-device.c:9138] constructed(): [0x190370] (eth0): read initial MAC address 86:18:52:xx:xx:xx
NetworkManager[509]: <debug> [1453743778.861602] [devices/nm-device.c:9148] constructed(): [0x190370] (eth0): read permanent MAC address FF:FF:FF:FF:FF:FF

(cherry picked from commit d442dcd174)
2016-01-29 17:41:16 -06:00
Lubomir Rintel
38ad5c9f3a ifcfg,keyfile: fix temporary file races (CVE-2016-0764)
Two of these raised Coverity's eyebrows.

CID 59389 (#1 of 1): Insecure temporary file (SECURE_TEMP)
5.  secure_temp: Calling mkstemp without securely setting umask first.

CID 59388 (#1 of 1): Insecure temporary file (SECURE_TEMP)
1.  secure_temp: Calling mkstemp without securely setting umask first.

Last one raised mine.

When a connection is edited and saved, there's a small window during which and
unprivileged authenticated local user can read out connection secrets (e.g. a
VPN or Wi-Fi password). The security impact is perhaps of low severity as
there's no way to force another user to save their connection.

(cherry picked from commit 60b7ed3bdc)
2016-01-29 20:36:18 +01:00
Dan Williams
f2773e525c wwan: retry connect on some errors and save them for log messages
First, cb751012a2 mistakenly converted the
act_stage_context_step() in connect_ready() to connect_context_clear()
instead of connect_context_step().  This would cause the IP Type retry
logic to fail and no further types to be tried.  It also throws
away the ctx->first_error and causes all errors that MM returns on the
connect attempt to be dropped on the floor.

Second, not all errors should cause an advance to the next IP Type,
since some errors aren't related to it.  Specifically, MM_CORE_ERROR_RETRY
when using Simple.Connect() means that a timeout was reached
in the internal connect logic, not a modem or network error.  In
that case, try the connect again with the same IP Type before advancing
to the next type.

Fixes: cb751012a2

Tested-by: Ladislav Michl <ladis@linux-mips.org>
Tested-by: Tore Anderson <tore@fud.no>
(cherry picked from commit 1cf4727766)
2016-01-28 12:28:21 -06:00
Thomas Haller
30bedd0b39 bluez: own reference to connection provider in NMBluezDevice
(cherry picked from commit 53233bb04c)
2016-01-27 14:23:34 +01:00
Thomas Haller
81a9d84d60 bluez: own reference to connection provider in NMBluezManager
(cherry picked from commit 94dcffc475)
2016-01-27 14:23:33 +01:00
Thomas Haller
c354f30f57 bluez: fix invoking parent dispose() function in NMBluezManager
Fixes: bf5a6ad443
(cherry picked from commit 7cc54d5bb9)
2016-01-27 14:23:32 +01:00
Thomas Haller
5ab7e899aa libnm-glib: fix another memory leak around update_permissions()
This time in init_async_got_permissions().

Thereby, just use gs_unref_hash and gs_free_error for cleanup.

(cherry picked from commit 8029f59e4f)
2016-01-26 12:35:16 +01:00
Thomas Haller
1deae2a284 libnm-glib: fix crash due to uninitalized pointer in get_permissions_reply()
If the D-Bus call failed with error, @permissions would stay uninitialized.

Fixes: f2399a6976
Fixes: 808f012603

(cherry picked from commit e0601d501a)
2016-01-26 12:08:19 +01:00
Dan Williams
808f012603 libnm-glib: fix leak in get_permissions_reply()
(cherry picked from commit f2399a6976)
2016-01-26 12:07:55 +01:00
Dan Williams
d4b15684f3 wwan: rework connection flow to send PIN earlier and fix autoconnect
Modems often don't expose all the required properties until they have
been unlocked, and that includes the IP types supported by the modem.

With an autoconnect WWAN connection where the SIM requires a PIN, there
were two problems:

1) the PIN is a secret and we don't have it until it's explicitly requested
during the activation process, so we cannot gate GSM connection availability
on whether a PIN is present since this happens long before we request secrets

2) when the modem is locked it may not report the supported IP types, which
caused an auto-activation to fail early becuase IP compatibility is checked
before the PIN is sent to the modem

Rework connection activation flow into a series of concrete steps, where the
PIN is sent to the modem if required, and only after the modem is actually
unlocked does the connection proceed.  This does mean that any connection
marked 'autoconnect' can theoretically enable a PIN-locked modem even if
the connection has no PIN defined, but there's no good way around that.
NetworkManager would activate the connection

(cherry picked from commit cb751012a2)
2016-01-25 12:40:08 -06:00
Dan Williams
7878e91b77 core: only run availability recheck transition if required
Device subclasses can call nm_device_recheck_available() at any time,
and the function would change the device's state to UNKNOWN in cases
where the device was available already.  For WWAN devices, availability
is rechecked every time the modem state changes, resulting in:

NetworkManager[28919]: <info>  (ttyUSB4): modem state changed, 'disabled' --> 'enabling' (reason: user-requested)
NetworkManager[28919]: <debug> [1445538582.116727] [devices/nm-device.c:2769] recheck_available(): [0x23bd710] (ttyUSB4): device is available, will transition to unknown
NetworkManager[28919]: <info>  (ttyUSB4): modem state changed, 'enabling' --> 'searching' (reason: user-requested)
NetworkManager[28919]: <debug> [1445538582.776317] [devices/nm-device.c:2769] recheck_available(): [0x23bd710] (ttyUSB4): device is available, will transition to unknown

(cherry picked from commit d9c6b9f3dd)
2016-01-25 12:40:08 -06:00
Thomas Haller
859099f353 systemd: order NetworkManager.serivce after network-pre.target
https://bugzilla.gnome.org/show_bug.cgi?id=761001
(cherry picked from commit 9c3187027c)
2016-01-23 16:57:56 +01:00
Beniamino Galvani
936a70bf4a manager: cleanup active connections upon exit
When connection sharing is enabled, the removal of iptables rules is
delegated to the NMActRequest destructor; but for this to work it is
required that the object is properly dereferenced upon NM termination.

Clean up the active connections which are in DEACTIVATED state when
quitting, so that they are unexported and destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=692673
(cherry picked from commit e3a6ba6756)
2016-01-23 10:19:43 +01:00
Beniamino Galvani
eadb0051dc core: list iptables sharing rules in the right order
The rules were added to the list using g_slist_append() and then
applied one at time using "iptables --insert" which puts them at the
beginning of the chain, reversing the initial order.

Instead, list them in the desired order and use g_slist_prepend() to
achieve the same result. This has no functional changes.

(cherry picked from commit 8cba3e046e)
2016-01-23 10:19:39 +01:00
Lubomir Rintel
b95c88284d linux-platform: treat gadget devices as ethernet devices
Also, don't manage them by default. Whatver created it should take care of
management.

(cherry picked from commit c1cf3c25c8)
2016-01-21 15:28:44 +01:00
Thomas Haller
bd27102277 wifi: assert against returning cached NMSupplicantInterface instances
nm_supplicant_manager_iface_get() returning a cached instance leads to
a crash when the first owner releases the object, as no ownership is
transferred.

That was fixed on master by commit f1fba3eb02.
Instead of backporting the entire refactoring (which also asserts against
reuse), just disallow reusing here.

The assertion should not be hit. If it would we need to investigate.
Also, this way the assertion avoids a hard crash.

https://bugzilla.redhat.com/show_bug.cgi?id=1298007
2016-01-21 15:05:03 +01:00
Thomas Haller
69e8b4678d 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
(cherry picked from commit bf54a5bfba)
2016-01-21 11:01:54 +01:00
Dan Williams
74572aa182 build: remove spurious comma from configure.ac
(cherry picked from commit 701c05ad69)
2016-01-20 12:22:42 -06:00
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