Commit graph

15057 commits

Author SHA1 Message Date
Lubomir Rintel
b45fd582cd libnm: order the property updates
Don't let a later property update finish than the sooner one.

This wouldn't happen most of time, apart from a special case when the
latter update of a object array property is to an empty list.
In that case the latter update would complete sooner and when the
earlier update finishes the list would contain objects which are
supposed to be gone already.

(cherry picked from commit 7007c9853c)
(cherry picked from commit 9cef2f5e83)
2017-03-16 17:57:51 +01:00
Lubomir Rintel
9be3e7df02 nm-object: initialize the object buffer to zero
(cherry picked from commit df46c59775)
(cherry picked from commit b2059059fd)
2017-03-16 17:57:12 +01:00
Francesco Giudici
984c634cdb libnm-core: remove INFERRABLE flag from dhcp-hostname property
When assuming a dhcp connection don't consider the DHCP "Host Name"
Option (12) passed in the DHCP request for the match of the available
connections.

https://bugzilla.redhat.com/show_bug.cgi?id=1393997
(cherry picked from commit 0ce7da1e22)
(cherry picked from commit 86490fbb1d)
2017-02-06 17:58:26 +01:00
Thomas Haller
4e53619502 build: add missing GLIB_CFLAGS for compiling adsl device plugin
(cherry picked from commit cd267cceed)
(cherry picked from commit 38cef9de7a)
(cherry picked from commit fa142d856c)
2017-01-29 12:45:53 +01:00
mirh
493da97d2d build: fix compilation with Python3
has_key() has long been dropped
https://docs.python.org/3.1/whatsnew/3.0.html#builtins

Should still work with anything from 2.3 onwards

https://github.com/NetworkManager/NetworkManager/pull/11
(cherry picked from commit 48402cd526)
(cherry picked from commit b0ad0ff4d7)
2017-01-19 14:22:22 +01:00
Lubomir Rintel
98083d63bd build: fix build with older gi
Fixes: 6c96aafaa9
(cherry picked from commit 22722b7732)
(cherry picked from commit b916d9dfe0)
(cherry picked from commit 263dc2dfd1)
2017-01-19 14:20:47 +01:00
Lubomir Rintel
d7aecc644a build: make the doc generator find the right libnm.so
At some point gobject-introspection added an API to add a library path
and stopped honoring the LD_LIBRARY_PATH (a bug, according to GI
documentation?).

(cherry picked from commit 6c96aafaa9)
(cherry picked from commit 2ee8462774)
(cherry picked from commit bc2e0269a4)
2017-01-19 14:20:46 +01:00
Thomas Haller
1f48f89459 supplicant: fix detection of EAP-FAST
At least with my supplicant, the capability is called
all-upper-case "FAST".

The check used case-insensitive, but that was broken
by a previous change.

Fixes: 9f5f141100
(cherry picked from commit 66ff601ecf)
(cherry picked from commit 1caae3743d)
(cherry picked from commit d0ee773221)
2017-01-18 19:00:51 +01:00
Beniamino Galvani
ff6ef0d696 vpn: add device route to VPN gateway if parent has no gateway
We set a dedicated route to reach the VPN gateway only if the parent
device has a gateway. If the parent device doesn't have a gateway (for
example in case of GSM connections) and the VPN gets the default
route, the VPN gateway will be contacted through the VPN itself, which
obviously doesn't work.

Set up a device route if the parent device doesn't provide a gateway.

https://bugzilla.redhat.com/show_bug.cgi?id=1403660
(cherry picked from commit ae5adc9e21)
(cherry picked from commit 48db5806f3)
2017-01-07 15:18:21 +01:00
Thomas Haller
92f057ca1d keyfile: fix memleak in keyfile reader's read_array_of_uint()
Fixes: 9559a7a260
(cherry picked from commit 8239edbb9b)
(cherry picked from commit 8a281bf7b4)
2017-01-05 12:33:54 +01:00
Lubomir Rintel
3807e2b3bc dhcp: drop an unused fariable
Fixes: 1c58ce0d74
Fixes: 58c6c12f47
(cherry picked from commit f9821a1669)
2017-01-04 10:03:30 +01:00
Thomas Haller
0961c4b969 libnm/docs: merge fix for generating API documentation fro enums (bgo#776848)
https://bugzilla.gnome.org/show_bug.cgi?id=776848

(cherry picked from commit 44ab504cf7)
(cherry picked from commit c5650d3500)
2017-01-04 09:56:12 +01:00
Thomas Haller
205f4ce025 libnm: explicitly set enum values in public nm-dbus-interface.h headers
Previously, due to a bug in "tools/enums-to-docbook.pl", enum values
without explicit numeric value were wrongly parsed. That is fixed,
but still explicitly set the value in the public header.

(cherry picked from commit 9d2207b46d)
(cherry picked from commit 4369f102f6)
2017-01-04 09:54:46 +01:00
Thomas Haller
70d14820e6 docs: fix handling enums without explicit numeric value in "tools/enums-to-docbook.pl"
Previously, an enum that didn't explicitly specify a numeric value
would wrongly start counting at 1.

E.g.

  typedef enum {
     MY_VAL,
  } Name;

would result in documentation with MY_VAL=1.

https://bugzilla.gnome.org/show_bug.cgi?id=776848
(cherry picked from commit 36ec46e8f8)
(cherry picked from commit 26f0d68e82)
2017-01-04 09:54:45 +01:00
Beniamino Galvani
e4d263f1db 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)
2017-01-02 08:47:11 +01:00
Dan Williams
3b225f893e wifi: don't request new PSK for locally-generated WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY errors
This usually indicates that the driver missed beacons from the AP, due to driver bugs
or faulty power-save management.  It doesn't mean that the PSK is wrong.

(cherry picked from commit 0c5aa6e48b)
2016-12-20 10:07:34 -06:00
Beniamino Galvani
e4a9bcde82 dhcp: merge branch 'th/dhcp-helper-sync-notify-rh1372854'
https://bugzilla.redhat.com/show_bug.cgi?id=1372854
(cherry picked from commit 42519abdbf)
2016-12-12 15:27:51 +01:00
Thomas Haller
d6ee12bd7c dhcp: call synchronous Notify D-Bus method from nm-dhcp-helper
A D-Bus signal is asynchronous and it can happen that nm-dhcp-helper
emits the "Event" signal before the server is able to register a handler:

   NM_DHCP_HELPER=/usr/libexec/nm-dhcp-helper
   nmcli general logging level TRACE
   for i in `seq 1 500`; do $NM_DHCP_HELPER & done
   journalctl -u NetworkManager --since '1 min ago' | grep "didn't have associated interface" | wc -l
    499

Avoid that, by calling the synchronous D-Bus method "Notify".

Interestingly, this race seem to exist since 2007.

Actually, we called g_dbus_connection_signal_subscribe() from inside
GDBusServer:new-connection signal. So it is not clear how such a race
could exist. I was not able to reproduce it by putting a sleep
before g_dbus_connection_signal_subscribe(). On the other hand, there
is bug rh#1372854 and above reproducer which strongly indicates that
events can be lost under certain circumstances.
Now we instead g_dbus_connection_register_object() from the
new-connection signal. According to my tests there was no more race
as also backed by glib's documentation. Still, keep a simple retry-loop
in nm-dhcp-helper just to be sure.

https://bugzilla.redhat.com/show_bug.cgi?id=1372854
https://bugzilla.redhat.com/show_bug.cgi?id=1373276
(cherry picked from commit 2856a658b3)
2016-12-12 09:34:45 +01:00
Thomas Haller
cb0d31229c dhcp: add new header "nm-dhcp-helper-api.h"
(cherry picked from commit 7684b68c49)
2016-12-12 09:34:45 +01:00
Thomas Haller
704e5a7709 dhcp-helper: refactor logging to use logging macros
(cherry picked from commit cc89996c9e)
2016-12-12 09:34:45 +01:00
Thomas Haller
602163346e dhcp-helper: refactor error handling
Don't exit(1) from fatal_error() because that skips destroying
local variables in main(). Just return regularly.

(cherry picked from commit bb489163db)
2016-12-12 09:34:45 +01:00
Thomas Haller
99ec04debd dhcp-listener/trivial: rename field to track connections in NMDhcpListener
It's not "signal-handles", as it currently tracks the registration ID of
type int. Rename it, it is effectively the list of connections that we
track.

(cherry picked from commit 2dd3a5245f)
2016-12-12 09:34:45 +01:00
Thomas Haller
b63ef470af dhcp-listener: add logging macros to nm-dhcp-listener.c
(cherry picked from commit d37cd04fe0)
2016-12-12 09:34:45 +01:00
Thomas Haller
20406d1a1d dhcp-listener: refactor type definition and embed private data in @self
(cherry picked from commit 822f01a8fd)
2016-12-12 09:34:44 +01:00
Thomas Haller
3c690e751f shared: add _NM_GET_PRIVATE() macro
(cherry picked from commit 2cae9ba348)
2016-12-12 09:34:44 +01:00
Thomas Haller
a2c39cddbf shared: add NM_MIN()/NM_MAX() macros to replace glib's MIN()/MAX()
(cherry picked from commit b2016fd2a5)
2016-12-12 09:34:44 +01:00
Thomas Haller
58c6c12f47 dhcp: prefix logging messages with "dhcp"
(cherry picked from commit 1c58ce0d74)
2016-12-12 09:34:44 +01:00
Thomas Haller
11b667bdc2 shared: add also "shared/nm-utils/nm-vpn-plugin-macros.h"
It has the very similar purpose as "nm-utils/nm-vpn-plugin-utils.[ch]", except
that is is header-only.

(cherry picked from commit af507cd089)
2016-12-12 09:34:44 +01:00
Thomas Haller
5d5367462d device: fix activation_source_schedule() for rescheduling the same function
Fixes: 78ca961c0f
(cherry picked from commit 994f1ca96e)
(cherry picked from commit baac746abb)
2016-12-08 13:56:43 +01:00
Beniamino Galvani
567220aa83 release: bump version to 1.2.7 (development) 2016-12-02 14:37:04 +01:00
Beniamino Galvani
0001318d9f release: bump version to 1.2.6 2016-12-02 14:04:00 +01:00
Beniamino Galvani
6fe4aa4628 release: update NEWS 2016-12-02 14:00:56 +01:00
Beniamino Galvani
b749f7d31b manager: fix state transition on resuming from sleep
When going to sleep, we unmanage devices setting the unmanaged flags
immediately but delaying the state transition (because we do it from
another state transition). The signal handler can be executed after
the wake and, especially, after we have already re-managed the device,
making the device unmanaged again.

Detect such situation and force the state to UNMANAGED (which will
also clear any pending state change), so that later we manage the
device again and it will try to activate any available connection.

Fixes: 81ea812362

https://bugzilla.redhat.com/show_bug.cgi?id=1382526
(cherry picked from commit 5f1e36e026)
2016-11-29 22:48:18 +01:00
Jiří Klimeš
0c97448a91 agent: don't clear "error", g_simple_async_result_take_error() overtakes it
From valgrind:
==21921== Invalid free() / delete / delete[] / realloc()
==21921==    at 0x4C2CD5A: free (vg_replace_malloc.c:530)
==21921==    by 0x81C4F2D: g_free (gmem.c:189)
==21921==    by 0x81AB021: g_error_free (gerror.c:491)
==21921==    by 0x81AB325: g_clear_error (gerror.c:674)
==21921==    by 0x767B555: reg_request_cb (nm-secret-agent-old.c:616)
==21921==    by 0x7A211F2: g_task_return_now (gtask.c:1107)
==21921==    by 0x7A21228: complete_in_idle_cb (gtask.c:1121)
==21921==    by 0x81BF6B9: g_main_dispatch (gmain.c:3154)
==21921==    by 0x81BF6B9: g_main_context_dispatch (gmain.c:3769)
==21921==    by 0x81BFA6F: g_main_context_iterate.isra.29 (gmain.c:3840)
==21921==    by 0x81BFB1B: g_main_context_iteration (gmain.c:3901)
==21921==    by 0x7A4748C: g_application_run (gapplication.c:2381)
==21921==    by 0x118AEF: main (main.c:81)

It caused memory corruption and may result in strange nm-applet crashes.

(cherry picked from commit 544f7d3683)
(cherry picked from commit eb9b2de778)
2016-11-25 15:41:23 +01:00
Beniamino Galvani
6c505f0928 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)
(cherry picked from commit 82b953d707)
2016-11-12 14:29:15 +01:00
Thomas Haller
7f37f2fdae libnm-core: fix memleak in nm-setting-vlan.c (priority_strv_to_maplist())
(cherry picked from commit f23320478d)
(cherry picked from commit 4d89a986ad)
2016-11-02 15:29:34 +01:00
Beniamino Galvani
84563b7a6d 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)
(cherry picked from commit dbacb9ae09)
2016-11-02 13:28:15 +01:00
Beniamino Galvani
8ecc5e37d3 cli: completion: escape shell special characters "()&!"
https://bugzilla.gnome.org/show_bug.cgi?id=772629
(cherry picked from commit 108f04e71e)
2016-10-26 13:43:43 +02:00
Thomas Haller
b1e7cf62ee libnm: avoid possibly NULL address for NMDeviceVlan calling nm_utils_hwaddr_matches()
(cherry picked from commit c4198d45e3)
(cherry picked from commit d831c2653d)
2016-10-24 10:43:35 +02:00
Thomas Haller
520970d118 libnm: fix memleak in NMDeviceVxlan
(cherry picked from commit 7eb054d099)
(cherry picked from commit 07d1842fe7)
2016-10-24 10:43:33 +02:00
Thomas Haller
9bfa908952 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)
(cherry picked from commit cbfdb72db2)
2016-10-22 17:14:54 +02:00
Beniamino Galvani
55365d8aa1 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:53:09 +02:00
Beniamino Galvani
5968629938 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 10:01:14 +02:00
Lubomir Rintel
bb45adeda0 setting-vpn: whatever is in vpn.secrets always is a secrets
Even when there's no <secret>-flags key for it in vpn-data.

This is essentially to fix regression in the way openconnect uses the VPN
secrets:

Openconnect auth helper is essentially a web browser that fills in an arbitrary
HTML (or XML) form that's used to get the session cookie. The actual secret the
service needs is the cookie itself.

However, what needs to be remembered includes the form data. What data can be
in the form is installation dependent and can not be known in advance. Thus the
flags for it can't be currently set in the connection. The auth helper is not
capable of setting the flags either, because it can only return secrets.

Prior to 1424f249e we treated vpn.secrets without the flags as system secrets
and store them in the connection. Since that commit we just filter them away,
which broke user configurations.

This restores the behavior or treating everyting in vpn.secrets as secrets and
falling back to system secrets.

Another way would be to find a way to flag the secrets, perhaps by
extending the auth helper protocol to be able to store non-secret
properties too.

https://bugzilla.gnome.org/show_bug.cgi?id=768737
https://bugzilla.redhat.com/show_bug.cgi?id=1332491

(cherry picked from commit 9b96bfaa72)
2016-10-12 12:54:43 +02:00
Dan Williams
ccbbb26e9b 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:55:02 -05:00
Beniamino Galvani
3dcad00c8a 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)
(cherry picked from commit 6c4a6f2b75)
2016-09-22 11:48:47 +02:00
Beniamino Galvani
c173fc9639 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:35:07 +02:00
Thomas Haller
7b2d17c1bf core: merge branch 'th/dbus-property-changed-source-iface-bgo770629-v2'
https://bugzilla.gnome.org/show_bug.cgi?id=770629
https://bugzilla.redhat.com/show_bug.cgi?id=1371920

(cherry picked from commit 673282ece6)
(cherry picked from commit c87b89bf8f)
2016-09-02 20:45:40 +02:00
Thomas Haller
6ccd12f6ce NEWS: update file with changes to PropertiesChanged signal
(cherry picked from commit 56bd86fd0c)
(cherry picked from commit e0eca5cec9)
2016-09-02 20:35:47 +02:00
Thomas Haller
1a6dc084a4 exported-object: use _NMLOG2() macro for logging property-changed signal
(cherry picked from commit ba713e8381)
(cherry picked from commit db4375277c)
2016-09-02 20:35:46 +02:00