Commit graph

15713 commits

Author SHA1 Message Date
Thomas Haller
7927d451fc tools: fix starting tests with D-Bus session with NMTST_NO_VALGRIND=1
When running

  NMTST_NO_VALGRIND=1 make check -j

we would not start separate D-Bus sessions, thus running tests with
valgrind enabled failed.

(cherry picked from commit c94dac0b5d)
2016-11-03 12:24:00 +01:00
Thomas Haller
a67eb9d8d0 logging: remove LOGD_HW alias for LOGD_PLATFORM
Since commit 1495853e01, LOGD_HW is renamed to
LOGD_PLATFORM. Remove the internal usage of the deprecated name.

Backport this patch to nm-1-4 because it avoids follow-up conflicts with
future backports. Also, it is a really trivial change, meaning, we only
replace the obsolte LOGD_HW name.

(cherry picked from commit 64951f07fb)

Conflicts:
    src/devices/nm-device.c
    src/devices/wwan/nm-modem.c
2016-11-03 12:23:07 +01:00
Thomas Haller
4d89a986ad libnm-core: fix memleak in nm-setting-vlan.c (priority_strv_to_maplist())
(cherry picked from commit f23320478d)
2016-11-02 15:29:16 +01:00
Beniamino Galvani
dbacb9ae09 ppp: add counter to D-Bus object path for PPP manager instances
There can be multiple PPP connections active, each with its own PPP
manager.

Fixes: c1dd3b6eed
(cherry picked from commit bc26f94d1e)
2016-11-02 13:24:27 +01:00
Thomas Haller
b14fe3ce08 core: don't unmanage devices on shutdown
... except Wi-Fi and devices that cannot assume connections at all.

https://bugzilla.redhat.com/show_bug.cgi?id=1371126
https://bugzilla.redhat.com/show_bug.cgi?id=1378418
(cherry picked from commit d298b7c96d)
2016-10-27 11:12:22 +02:00
Beniamino Galvani
c53496fe4a cli: completion: escape shell special characters "()&!"
https://bugzilla.gnome.org/show_bug.cgi?id=772629
(cherry picked from commit 108f04e71e)
2016-10-26 13:42:24 +02:00
Beniamino Galvani
940cb6eb87 wwan: fix wrong connection cast on device state change
nm_settings_connection_set_autoconnect_blocked_reason() must be called
on the settings-connection. Fixes the following:

GLib-GObject-WARNING **: invalid cast from 'NMSimpleConnection' to 'NMSettingsConnection'

Fixes: 06da353242
(cherry picked from commit 7034ea7aa3)
2016-10-26 13:28:07 +02:00
Thomas Haller
d831c2653d libnm: avoid possibly NULL address for NMDeviceVlan calling nm_utils_hwaddr_matches()
(cherry picked from commit c4198d45e3)
2016-10-24 10:33:21 +02:00
Thomas Haller
07d1842fe7 libnm: fix memleak in NMDeviceVxlan
(cherry picked from commit 7eb054d099)
2016-10-24 10:33:13 +02:00
Thomas Haller
7a8ed3fefd shared: make nm_str_not_empty() inline function instead of macro
It was a macro to pass on the non-const-ness of the argument, but
that just doesn't make sense.

That is a signature

  char *nm_str_not_empty (char *)

does not make sense, because you cannot transfer ownership
conditionally without additional checks to avoid a leak. Which makes
this form is pointless. For example:

    char *
    foo (void)
    {
        char *s;

        s = _create_value ();
        return nm_str_not_empty (s); /* leaks "" */
    }

(cherry picked from commit 34970e4141)
2016-10-24 10:33:07 +02:00
Thomas Haller
cbfdb72db2 ifcfg-rh: fix signature of link_changed() callback
Depending on how arguments are passed to the called function,
this could lead to a crash.

Maybe not on 32 bit machines where the size of the pointer is
the size of an int.

Maybe not on x86_64, where the arguments are passed in registers.

Fixes: b88c309167
(cherry picked from commit 548a5440e9)
2016-10-22 17:14:24 +02:00
Beniamino Galvani
b81cd79750 merge: branch 'bg/platform-unaligned-stats64-bgo772605'
https://bugzilla.gnome.org/show_bug.cgi?id=772605
(cherry picked from commit d7b32008b7)
2016-10-14 11:24:11 +02:00
Beniamino Galvani
84d213f7c5 platform: avoid unaligned access to link stats on 64bit architectures
The undefined behavior sanitizer complains with:

platform/nm-linux-platform.c:1482:31: runtime error: member access within misaligned address 0x61a000016fac for type 'struct rtnl_link_stats64', which requires 8 byte alignment
0x61a000016fac: note: pointer points here
  bc 00 17 00 bf 05 00 00  00 00 00 00 bf 05 00 00  00 00 00 00 b5 68 02 00  00 00 00 00 b5 68 02 00
              ^
platform/nm-linux-platform.c:1483:29: runtime error: member access within misaligned address 0x61a000016fac for type 'struct rtnl_link_stats64', which requires 8 byte alignment
0x61a000016fac: note: pointer points here
  bc 00 17 00 bf 05 00 00  00 00 00 00 bf 05 00 00  00 00 00 00 b5 68 02 00  00 00 00 00 b5 68 02 00
              ^
platform/nm-linux-platform.c:1484:31: runtime error: member access within misaligned address 0x61a000016fac for type 'struct rtnl_link_stats64', which requires 8 byte alignment
0x61a000016fac: note: pointer points here
  bc 00 17 00 bf 05 00 00  00 00 00 00 bf 05 00 00  00 00 00 00 b5 68 02 00  00 00 00 00 b5 68 02 00
              ^
platform/nm-linux-platform.c:1485:29: runtime error: member access within misaligned address 0x61a000016fac for type 'struct rtnl_link_stats64', which requires 8 byte alignment
0x61a000016fac: note: pointer points here
  bc 00 17 00 bf 05 00 00  00 00 00 00 bf 05 00 00  00 00 00 00 b5 68 02 00  00 00 00 00 b5 68 02 00
              ^

That's because the pointer returned by nla_data() is only
32bit-aligned and using it to access structure members can cause
issues on some 64bit architectures.

Use the unaligned_read_ne64() macro to access the structure members.

https://bugzilla.gnome.org/show_bug.cgi?id=772605
(cherry picked from commit 89bcf50f61)
2016-10-14 11:23:51 +02:00
Beniamino Galvani
be59f64773 shared: add unaligned.h
The file, imported from systemd sources, contains macros for accessing
potentially unaligned data in a safe way (i.e. byte-wise).

(cherry picked from commit 22cc119da5)
2016-10-14 11:23:31 +02:00
Beniamino Galvani
0c3a5f77d0 libnm: disconnect devices' signals when disposing manager
We connect signal handlers to devices when they appear, but don't
disconnect the handlers when the manager instance is destroyed. This
can cause crashes as device_ac_changed() is called on an invalid
manager instance.

Disconnect the handlers from dispose().

https://bugzilla.redhat.com/show_bug.cgi?id=1383758
(cherry picked from commit 0a61317870)
2016-10-14 10:48:19 +02:00
Beniamino Galvani
82b953d707 supplicant: fix cancellation of interface association
The @assoc_cancellable was never initialized and thus ineffective; fix
this.

Furthermore, we only cancel it in nm_supplicant_interface_disconnect()
as we expect that clients call the function before destroying the
interface. Don't assume this and also cancel it in dispose().

https://bugzilla.redhat.com/show_bug.cgi?id=1383628
(cherry picked from commit 0539725aef)
2016-10-14 10:07:58 +02:00
Beniamino Galvani
d5b3bf8ee7 libnm: merge branch 'bg/libnm-activation-stuck-rh1367752'
https://bugzilla.redhat.com/show_bug.cgi?id=1367752
(cherry picked from commit aae26ebed3)
2016-10-13 16:28:32 +02:00
Beniamino Galvani
10fbc47d32 cli: connections: fail the activation if the ac deactivates
Since commit ac888de151 ("cli/connections: fail the activation when
the active connection disappears") we rely only on the disappearing of
the active-connection to determine the failure of an activation.

libnm can collapse a 'added' and a 'removed' signal if they are
received closer enough and thus we may miss the removal of the active
connection. Restore the detection of failure based on
active-connection state.

(cherry picked from commit 79a357b07a)
2016-10-13 16:28:06 +02:00
Beniamino Galvani
41823a0774 libnm: make waiting objects fail when an object initialization fails
Previously, when the load of an object failed and there were other
objects waiting for it, those objects would remain waiting
forever. Make them fail as well.

(cherry picked from commit f4a0ab757f)
2016-10-13 16:28:03 +02:00
Beniamino Galvani
cfe74bc01a session-monitor: fix parsing of ConsoleKit database
The section name is "Session", not "CkSession".  Restore the correct
value, changed by commit 0de60b300e ("session: merge
nm-session-monitor-* modules").

Fixes: 0de60b300e

https://bugzilla.gnome.org/show_bug.cgi?id=772640
(cherry picked from commit db9589f0ce)
2016-10-13 09:48:45 +02:00
Beniamino Galvani
edf4bf2f35 session-monitor: use logging macros
Use logging macros and also, print the session tracking method during
startup for debugging purposes.

(cherry picked from commit 0e7f834a6f)
2016-10-13 09:48:10 +02:00
Dan Williams
58e01e9c98 wwan/ppp: send explicit port speed to pppd when port speed is zero (rh #1281731)
Some TTY drivers or devices appear to ignore port speed and always
report zero.  Technically this means the port is hung up and control
lines should be disconnected, but with USB devices many of the serial
port attributes are meaningless and ignored by some devices.

pppd requires the port's speed to be greater than zero, and will
exit immediately when that is not the case, even though these
modems will work fine.  Passing an explicit speed to pppd in this
case works around the issue, as pppd attempts to set that speed
on the port and doesn't actually care if that operation fails.

https://bugzilla.redhat.com/show_bug.cgi?id=1281731
(cherry picked from commit 01de14b1ddcd011ebc2f4676e5950b9ec890c698)
2016-10-07 14:54:50 -05:00
Thomas Haller
7ae2f0f6f4 core: remove unnecessary includes to netlink/route library
We no longer use libnl-route-3 library in NetworkManager. Remove the
unnecessary includes.

(cherry picked from commit 3ceaef90fe)
2016-10-07 21:37:56 +02:00
Beniamino Galvani
11e3c88295 cli: properly set multiple addresses in questionnaire mode
Pass the '+' modifier to set_property() for IPv4 and IPv6 addresses to
append the new address to existing ones instead of overwriting them.

Fixes: 2f45665559

https://bugzilla.redhat.com/show_bug.cgi?id=1380165
(cherry picked from commit 984d4f0684)
2016-10-04 14:30:01 +02:00
Beniamino Galvani
7bf10b4cca release: bump version to 1.4.3 (development) 2016-09-30 17:43:14 +02:00
Beniamino Galvani
fa4913a521 release: bump version to 1.4.2 2016-09-30 17:37:44 +02:00
Beniamino Galvani
efd27743cb release: update NEWS 2016-09-30 16:51:16 +02:00
Lubomir Rintel
371a1e2d87 libnm-core/tests: disable the JSON validation check without jansson
(cherry picked from commit 67999ef2d3)
2016-09-27 18:39:00 +02:00
Lubomir Rintel
9fc48c31a0 device: consider a device with slaves configured
Do assume connections for it.

https://bugzilla.redhat.com/show_bug.cgi?id=1333983
(cherry picked from commit c3586ce01a)
2016-09-26 17:56:07 +02:00
Beniamino Galvani
626eb5df29 crypto: don't try to decrypt PKCS#8 key if no password is supplied
crypto_verify_private_key_data() must try to decrypt the key only when
a password is supplied.

Previously the decrypt test always passed because we detected an
unsupported cipher and faked success. Now since version 3.5.4 gnutls
supports PBES1-DES-CBC-MD5 and the key is actually decrypted when a
password is supplied.

Also, don't assert that a wrong password works because we're now able
to actually verify it (only with recent gnutls).

https://bugzilla.gnome.org/show_bug.cgi?id=771623
(cherry picked from commit 0e96d23733)
2016-09-23 18:27:39 +02:00
Lubomir Rintel
5b65fd9136 contrib/rpm: require at least the version of glib we built against
glib neither versions its symbols nor bumps SONAME on API changes, so rpm can't
figure out the correct dependencies itself.

https://bugzilla.redhat.com/show_bug.cgi?id=1378809
(cherry picked from commit e59ed6451f)
2016-09-23 12:33:27 +02:00
Thomas Haller
8e6a706e20 libnm: relax comparison of bond-option for INFERRABLE match
When comparing the bond-settings of an activated device against
the settings from the connection, some properties might easily
differ. Hack them around in NMSettingBond:compare_property().

For example:

the setting in the connection has:
    [bond]
    mode=active-backup

later, the device gets:
    [bond]
    active_slave=inf_ib0
    fail_over_mac=active
    mode=active-backup

Note that the fail_over_mac changes due to:
  kernel: nm-bond: enslaved VLAN challenged slave inf_ib0. Adding VLANs will be blocked as long as inf_ib0 is part of bond nm-bond
  kernel: nm-bond: The slave device specified does not support setting the MAC address
  kernel: nm-bond: Setting fail_over_mac to active for active-backup mode

https://bugzilla.redhat.com/show_bug.cgi?id=1375558
(cherry picked from commit 0fb723e720)
2016-09-22 18:34:39 +02:00
Thomas Haller
f6c0c2d46e device: fix nm_utils_match_connection() for NMSettingInfiniband:mac-address
<debug> [1474469475.3318] Connection 'inf_ib0' differs from candidate 't-inf' in infiniband.mac-address
    <debug> [1474469475.3318] manager: (inf_ib0): generated connection 'inf_ib0'

https://bugzilla.redhat.com/show_bug.cgi?id=1375558
(cherry picked from commit 78957c0d39)
2016-09-22 16:49:15 +02:00
Thomas Haller
766f040681 macros: simplify NM_IN_SET() and NM_IN_STRSET() macros
and support up to 16 arguments.

(cherry picked from commit b1fd5a06c4)
2016-09-22 16:39:36 +02:00
Beniamino Galvani
6c4a6f2b75 device: fix NULL pointer dereference in dhcp6_start()
Don't crash when nm_device_dhcp6_renew() calls dhcp6_start() with NULL
@reason.

Fixes: d1295b12e9
(cherry picked from commit dbf0b343ec)
2016-09-22 11:44:12 +02:00
Beniamino Galvani
6f3921c8f8 cli: merge branch 'jk/nmcli-complete-regression-rh1375933'
https://bugzilla.redhat.com/show_bug.cgi?id=1375933
(cherry picked from commit a875603355)
2016-09-19 17:06:33 +02:00
Jiří Klimeš
a695ed8ad6 cli: fix yes/no completion in questionnaire mode
(cherry picked from commit 52723bd743)
2016-09-19 17:05:14 +02:00
Jiří Klimeš
afb65df37a cli: tab-complete "Interface name [*]" in questionnaire mode
(cherry picked from commit 08a74c272b)
2016-09-19 17:05:12 +02:00
Jiří Klimeš
ebfa947e83 cli: enable bash completion for some more properties of add/modify
connection.interface-name
mavclan.tap
mavclan.parent
ip-tunnel.parent
vxlan.parent

(cherry picked from commit c2ef397867)
2016-09-19 17:05:11 +02:00
Jiří Klimeš
68be811f81 cli: fix completion/add missing functions for '--complete-args' (rh #1375933)
This makes bash completion work again for 'nmcli connection add'.

Fixes: 8b39090597

https://bugzilla.redhat.com/show_bug.cgi?id=1375933
(cherry picked from commit 61a56aa3db)
2016-09-19 17:05:10 +02:00
Jiří Klimeš
9d88543617 cli: (trivial) move gen_func_ifnames() from devices.c to common.c
and rename it to nmc_rl_gen_func()

(cherry picked from commit 1f0ba2e487)
2016-09-19 17:05:08 +02:00
Jiří Klimeš
5984bdd895 cli: (trivial): remove stray %s
(cherry picked from commit 4b90b7b774)
2016-09-19 17:05:07 +02:00
Beniamino Galvani
b0463880fc manager: emit device-removed signal when a device unrealizes
The 'device-added' and 'device-removed' signals indicate when the
value of the 'Devices' property changes. The property only returns
realized devices and so if a device unrealizes we should emit the
removed signal for it.

Fixes: 5da37a129c

https://bugzilla.gnome.org/show_bug.cgi?id=771324
(cherry picked from commit cdedd2b53e)
2016-09-16 16:29:05 +02:00
Beniamino Galvani
dbb67694cb device: fix crash reapplying connection to slave devices
Slave devices don't have IPv4 and IPv6 configuration and so special
care must be taken when comparing their methods.

https://bugzilla.redhat.com/show_bug.cgi?id=1376446
(cherry picked from commit 8f92ead6e2)
2016-09-16 14:23:11 +02:00
Beniamino Galvani
5dfb3ec72c clients: fix check on secret request path
priv->path is NULL when the agent handles all requests (for example
when executing "nmcli agent").

Fixes: f3099db28e
(cherry picked from commit 2a391348b6)
2016-09-15 10:27:52 +02:00
Beniamino Galvani
1064dcafbe clients: merge branch 'bg/clients-agent-message-rh1351272'
https://bugzilla.redhat.com/show_bug.cgi?id=1351272
(cherry picked from commit 73c649f365)
2016-09-15 08:33:20 +02:00
Beniamino Galvani
b7b3f54f98 clients: fix matching of connection path
Since we use g_str_has_prefix() to match a request_id with the
connection path, there can be wrong matches. For example:

 request_id: /org/freedesktop/NetworkManager/Settings/10/802-1x
 connection: /org/freedesktop/NetworkManager/Settings/1

would match. Add a trailing slash to the connection path stored in the
agent to prevent this.

(cherry picked from commit f666efed0d)
2016-09-15 08:32:58 +02:00
Beniamino Galvani
9b443db451 clients: handle secret requests only for current connection
The path was checked only when serving the enqueued requests but not
for new ones. Fix this by moving the check to
request_secrets_from_ui().

Fixes: 991df80408

https://bugzilla.redhat.com/show_bug.cgi?id=1351272
(cherry picked from commit f3099db28e)
2016-09-15 08:32:54 +02:00
Beniamino Galvani
b632f2984b clients: add secrets request message for wired and DSL connections
(cherry picked from commit 2c1adaae5e)
2016-09-15 08:32:52 +02:00
Beniamino Galvani
b8e34bcdb3 clients: don't show "(null)" prompt for secrets
If the caller doesn't provide a message, simply don't show it.

(cherry picked from commit a80af27fc9)
2016-09-15 08:32:51 +02:00