Commit graph

15064 commits

Author SHA1 Message Date
Thomas Haller
27be61ec79 wifi: fix leaking fake AP in NMDeviceWifi's act_stage1_prepare()
Fixes: 96f40dcdcd
(cherry picked from commit ef61d7909f)
(cherry picked from commit d08530ac4b)
(cherry picked from commit 6c4c12c796)
(cherry picked from commit 4a345b2e78)
(cherry picked from commit ae112d0070)
(cherry picked from commit 0a95b1a593)
(cherry picked from commit 087fb85969)
2018-09-13 16:32:01 +02:00
Thomas Haller
8b4c1cddfe clients: fix appending integer to result in nmc_property_set_bytes()
(cherry picked from commit d76c190dc7)
(cherry picked from commit 06d3c95e4f)
(cherry picked from commit fb9c302af7)
2017-05-23 16:44:07 +02:00
Beniamino Galvani
d4cbae9aa0 clients: fix setter for 802-1x.password-raw
The property is a GBytes, not a GByteArray.

https://bugzilla.gnome.org/show_bug.cgi?id=782836
(cherry picked from commit 30393ee236)
(cherry picked from commit cc6c9468fc)
(cherry picked from commit e4750efb23)
2017-05-23 16:44:06 +02:00
Thomas Haller
9cf9e21247 policy: fix memleak in lookup_callback() and cancelling
When the operation is cancelled, we must not touch user_data. Note that
NM_POLICY_GET_PRIVATE() theoretically doesn't dereference the pointer
(does it?) but doing pointer arithmetic on a dangling pointer is a very
ugly thing to do.

And of course, the memleak.

Fixes: 5c716c8af8
Fixes: a2cdf63204
(cherry picked from commit 3215508293)
(cherry picked from commit f1469558c0)
(cherry picked from commit faba5b7078)
2017-05-02 18:32:24 +02:00
Thomas Haller
0ae3131534 device: fix restricting Generic connection by interface-name
NMDeviceGeneric:check_connection_compatible() doesn't check for a
matching interface name. It relies on the parent implementation to
do that.

The parent implementation calls nm_manager_get_connection_iface().
That fails for NM_SETTING_GENERIC_SETTING_NAME, because that one has
no factory. Maybe this imbalance of having no factory for the Generic device
is wrong, but usually factories only match a distinct set of device
types, while the generic factory would handle them all (as last resort).

Without this, activating a generic connection might activate the
wrong interface.

(cherry picked from commit 3876b10a47)
(cherry picked from commit 753a2cc4d9)
(cherry picked from commit bd72919b47)
(cherry picked from commit bd21d1054a)
2017-04-26 21:19:59 +02:00
Lubomir Rintel
2623afb442 sparse: avoid clash with __bitwise and __force from 4.10 linux/types.h
It also used __bitwise and __force. It seems easier to rename
our versions since they are local to this one single header.

Also, undefine them afteerwards, so that we don't pollute the
preprocessor macro namespace.

https://github.com/systemd/systemd/pull/5061
(cherry picked from commit 13b2ac2214)
(cherry picked from commit 2f92d8cee1)
2017-04-25 13:07:07 +02:00
Thomas Haller
90d341e300 libnm: fix memleak of GUdevDevice in get_bus_name()
Fixes: f7b1b28202
(cherry picked from commit c033330c41)
(cherry picked from commit 6311bf6666)
(cherry picked from commit 42eb57c0c1)
2017-03-20 11:35:42 +01:00
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