Commit graph

16799 commits

Author SHA1 Message Date
Dan Williams
aef9e5f8b6 ppp: only request IPV6CP when IPv6 is enabled in the connection
NM always asks pppd to run IPV6CP which will complete if the modem supports
IPv6.  If the user doesn't want IPv6 then NM just ignores the result.  But
if the host has disabled IPv6, then pppd will fail to complete the connection
because pppd tries to assign the Link-Local address to the pppX interface,
and if IPv6 is disabled that fails and terminates the PPP session.

So only request IPV6CP when the user wants IPv6 on the connection; if they
have disabled IPv6 on their host then they can simply set ipv6.method=ignore.

https://mail.gnome.org/archives/networkmanager-list/2017-March/msg00047.html
(cherry picked from commit 8d4570d28d)
2017-03-22 08:36:16 -05:00
Beniamino Galvani
427a3e5cff manager: ensure proper disposal of unrealized devices
When remove_device() is called on an already unrealized device, we
should release it from master if necessary and clear its IP
configurations to avoid leaks.

https://bugzilla.redhat.com/show_bug.cgi?id=1433303
(cherry picked from commit 2e0c3d1dac)
2017-03-21 13:30:15 +01:00
Thomas Haller
6311bf6666 libnm: fix memleak of GUdevDevice in get_bus_name()
Fixes: f7b1b28202
(cherry picked from commit c033330c41)
2017-03-20 11:34:49 +01:00
Beniamino Galvani
238fc87298 device: fail DHCPv6 if a link-local address is not present
Instead of throwing an assertion, fail DHCPv6 when a IPv6 link-local
address is not configured on the device. There are different reasons
why the assertion may fail: for example the address was removed
externally; or the device is gone (and thus the platform already
received the notification of addresses removal) but the device is still
connecting because its disposal happens in an idle callback.

None of these deserves an assertion, which should only be for
programming errors.

https://bugzilla.redhat.com/show_bug.cgi?id=1432251
(cherry picked from commit 4987ec408a)
2017-03-15 16:35:47 +01:00
Thomas Haller
a006361fca libnm: add assertion to NMObject that a dbus-object is set
The libnm cache types don't have public _new() functions.
However, such types can be easily created using g_object_new()
directly from user code.

Such a usage is not supported. Add an assertion that a valid
dbus-object is present.

(cherry picked from commit 556b7c3b45)
2017-03-09 15:22:17 +01:00
Thomas Haller
8a857c4475 libnm: chain up NMRemoteConnection::constructed() function
Fixes: 0fdd71fe6e
(cherry picked from commit 9ed0e3705e)
2017-03-09 15:22:16 +01:00
Thomas Haller
5cd90717ad platform: filter out invisible links for cache lookup by name
Fixes: ad1d74d142
(cherry picked from commit f0e295d3d7)
2017-03-09 15:21:46 +01:00
Beniamino Galvani
7a05d2a228 dhcp/dhclient: parse "interface" statements
Until now any "interface" statement was ignored and any enclosed
statement for which we have a special handling was considered, even if
belonging to a different interface. This can cause wrong options to be
set in the generated dhclient configuration.

Change the code to parse "interface" statements and skip the content
if the interface doesn't match.

https://bugzilla.gnome.org/show_bug.cgi?id=778430
(cherry picked from commit d405cfd908)
2017-03-03 14:18:20 +01:00
Beniamino Galvani
f950df775f dns/resolved: consider configuration from unmanaged devices
The DNS configuration for VPN connections is associated to the VPN
device (tun, ppp, etc.) and that device can be unmanaged by NM: don't
ignore such configuration. We do the same for other DNS plugins.

https://bugzilla.gnome.org/show_bug.cgi?id=779087
(cherry picked from commit 913896721d)
2017-02-24 21:13:16 +01:00
Lubomir Rintel
662b1f8b7c tui: generate names for bonds, teams and bridges
This makes it more likely that the user will end up with a master
connection that has connection.interface-name property. This makes it
possible for ifcfg plugin to specify the master in the for of device
name (as opposed to UUID) for compatibility with the legacy network
tooling.

This is equivalent to what nmcli does.

https://bugzilla.redhat.com/show_bug.cgi?id=1369091
(cherry picked from commit ff46158d9e)
2017-02-20 16:08:59 +01:00
Thomas Haller
a72ded7902 device/wifi: fix #if check for more-logging
Fixes: ae158bf178
(cherry picked from commit 35d4e8f7a0)
2017-02-19 19:16:37 +01:00
Beniamino Galvani
0429753dab libnm: disconnect signal from D-Bus proxies on dispose
https://bugzilla.gnome.org/show_bug.cgi?id=778615
(cherry picked from commit 5ae3db7515)
2017-02-18 10:29:05 +01:00
Thomas Haller
e107d0917b device/wifi: silence some logging for AP changes
We log updates of the Wi-Fi AP with a separate logging domain LOGD_WIFI_SCAN.
However, there is ony "update" message that is triggered every 6 seconds, which
becomes especially verbose.

Suppress this one and only log it when compiled --with-more-logging. And then
only log with level LOGL_TRACE, so the user still can filter this one out.

(cherry picked from commit ae158bf178)
2017-02-17 20:34:21 +01:00
Thomas Haller
803e1a04bb contrit/rpm: create source tarball from git immidiately in SOURCES directory
Instead of first creating it as "$TEMP/NetworkManager-${VERSION}.tar.xz"
and then copy it to "$TEMP/SOURCES".

(cherry picked from commit 5caa9d877b)
2017-02-17 19:45:02 +01:00
Thomas Haller
505e474631 contrit/rpm: print the used "$SOURCE" tarball in the summary output of build.sh
(cherry picked from commit b04868cb52)
2017-02-17 19:45:02 +01:00
Thomas Haller
1dbb6b3150 device/wifi: merge branch 'th/device-wifi-wait-for-scan-bgo770938'
https://bugzilla.gnome.org/show_bug.cgi?id=770938
https://bugzilla.gnome.org/show_bug.cgi?id=777831

(cherry picked from commit fe6204ffc7)
2017-02-17 19:43:59 +01:00
Thomas Haller
f270bc34b4 device/wifi: block autoconnect while scanning is in progress
We should only start autoconnecting after the scan is complete.
Otherwise, we might activate a shared connection or pick a
connection based on an incomplete scan list.

https://bugzilla.gnome.org/show_bug.cgi?id=770938
(cherry picked from commit 2ab2254dd7)
2017-02-17 19:39:31 +01:00
Thomas Haller
4bf493fcaf device: add get_autoconnect_allowed() virtual function
It allows derived classes to override the autoconnect-allowed
state.

We already have

- NM_DEVICE_AUTOCONNECT property, which is two parts:
  - NMDevicePrivate::autoconnect_user, which is settable via
    D-Bus by the use, to allow the device to autoconnect.
  - NMDevicePrivate::autoconnect_intern, which is set by
    internal decision.
- NM_DEVICE_AUTOCONNECT_ALLOWED signal, where other devices can
  subscribe to block autoconnect. Currently that is only used
  by NMDeviceOlpcMesh.

These two make up for nm_device_autoconnect_allowed().

Add another way to allow derived classes to disable autoconnect
temporarily. This could also be achieved by having the device
subscribe to NM_DEVICE_AUTOCONNECT_ALLOWED of self, or by adding
a signal slot. But a plain function pointer seems easier.

(cherry picked from commit 6eaded9071)
2017-02-17 19:39:28 +01:00
Thomas Haller
da37c8ac6c device: separately handle NMDevice's autoconnect by user and internal decision
The NMDevice's autoconnect property is settable via D-Bus and is is
also modified by internal decision, like when no PIN is available.

Certain internal actions cause clearing the internal autoconnect flag,
but they should not override the user desicion.

For example, when NM awaks from sleep it would reenable autoconnect,
but it should not reenable it for devices where the user explicitly
said that autoconnect is to be disabled.

Similarly, activating a device alone is not yet an instruction to
re-enable autoconnect. If the user consciously disables autoconnect,
it should stay enabled. On the other hand, activating a device should
reenable autoconnect if it was blocked by internal decision.

We need to track these two flags separately, and set them accordingly.

(cherry picked from commit 2f9166e6b9)
2017-02-17 19:39:25 +01:00
Thomas Haller
b8af01b455 wifi: also show the NM D-Bus path for the Wi-Fi AP in nm_wifi_ap_to_string()
(cherry picked from commit 257484e7ba)
2017-02-17 19:39:21 +01:00
Thomas Haller
7f7bed4736 wifi: only react on AP update signal when there are actual changes
Since we emit BSS_UPDATED signal before SCAN_DONE, it is very likely
that nothing actually changed. This clutters the logs with update
messages.

Also move the added/removed logging messages inside ap_add_remove().
We would call ap_add_remove() at several places without logging the
change.

(cherry picked from commit c9dc0eba65)
2017-02-17 19:39:17 +01:00
Thomas Haller
b4fe07e96e supplicant: delay SCAN_DONE signal until all BSS are initialized
We initialize the BSS asyncronously. Don't declare SCAN_DONE
until all BSS are up.

Otherwise, especially during the very first scan we declare SCAN_DONE
when having no BSS yet. This wrongly removes the pending action
"wifi-scan", while "autoconnect" cannot happen as there are not BSS
yet. Thus we declare "startup-complete" too early.

Another issue is that we may start autoconnecting with an incomplete
scan list, and thus pick a non-preferred connections.

https://bugzilla.gnome.org/show_bug.cgi?id=777831
(cherry picked from commit e0f9677018)
2017-02-17 19:39:00 +01:00
Thomas Haller
13b17d44dc wifi: check for invalid BSSID in nm_wifi_ap_update_from_properties()
In nm_wifi_ap_new_from_properties(), we checked that the BSSID is valid
and bailed out otherwise. Since we call nm_wifi_ap_update_from_properties()
on a created BSSID, we should ensure there too that an update does not cause
the address to become invalid.

In the unlikely case where an update would change a previously valid address
to an invalid one, we would ignore the update.

Thus, move the check for addresses inside nm_wifi_ap_update_from_properties().

(cherry picked from commit e3a489180b)
2017-02-17 19:38:03 +01:00
Thomas Haller
c961c36c8f supplicant: merge NEW_BSS signal with BSS_UPDATED
Before, the NEW_BSS signal was not careful to emit the signal only when the BSS
is seen for the first time. Consequently, supplicant_iface_new_bss_cb() checked
whether it already knows about the new BSS.

Merge NEW_BSS and BSS_UPDATED. Now we emit BSS_UPDATED when either the
BSS is new or changed.

Also, in supplicant_iface_new_bss_cb() (now supplicant_iface_bss_updated_cb())
no longer constructs an @ap instance if we have a @found_ap.

In some situations there can be a value of having a separate ADD signal.
But only when there the consumers care, and if the consumers can trust that
ADD is not just an UPDATE. The only consumer doesn't care and it not not be
trusted, so merge the signals.

(cherry picked from commit 29a53b1cd7)
2017-02-17 19:38:00 +01:00
Thomas Haller
fbe98ba107 supplicant: cleanup network when cancelling "AddNetwork" request
If the assoc-request is cancelled while an "AddNetwork" request is
pending, we must cleanup the added network when the request succeeds.

The issue can also happen when NetworkManager shuts down and exits
the mainloop. This scenario is unsolved as the cleanup action
"RemoveNetwork" has no chance to run.

"AddBlob" works differently in that blogs are added with a specific name,
not like "AddNetwork", where a new D-Bus path is created. Maybe we should
also cleanup blobs that were added by us, but currently we don't.

(cherry picked from commit c47026715e)
2017-02-17 19:37:57 +01:00
Thomas Haller
a6d3d17f5e supplicant: remove unused return value from nm_supplicant_interface_request_scan()
It cannot fail, remove code that anticipates a failure of request-scan.

(cherry picked from commit dce13b6f11)
2017-02-17 19:37:55 +01:00
Thomas Haller
6ce8cf361a supplicant: use nm_clear_g_cancellable() helper
(cherry picked from commit da34034b95)
2017-02-17 19:37:52 +01:00
Thomas Haller
990810ed7c supplicant/trivial: move code around
(cherry picked from commit e16bf4f3db)
2017-02-17 19:37:17 +01:00
Thomas Haller
2735e614b7 supplicant: rework nm_supplicant_interface_set_config() to invoke result callback
Instead of having a NM_SUPPLICANT_INTERFACE_CONNECTION_ERROR signal to notify
about failures during AddNetwork/SelectNetwork, accept a callback to report
success/failure.

Thereby, rename nm_supplicant_interface_set_config() to
nm_supplicant_interface_assoc().

The async callback is guaranteed to:

 - be invoked exactly once, signalling success or failure
 - always being invoked asyncronously.

The pending request can be (synchronously) cancelled via
nm_supplicant_interface_disconnect() or by disposing the
interface instance. In those cases the callback will be invoked
too, with error code cancelled/disposing.

(cherry picked from commit 66c45d0fdc)
2017-02-17 19:37:15 +01:00
Thomas Haller
051fd25fc6 wifi: introduce enum type NMSupplicantInterfaceState instead of plain int
Also change the signature of the NM_SUPPLICANT_INTERFACE_STATE signal,
to have three "int" type arguments. Thereby also fix the subscribers
to this signal that wrongly had type guint32, instead of guint
(which happens to be the same underlying type, so no real problem).

https://mail.gnome.org/archives/networkmanager-list/2017-February/msg00021.html
(cherry picked from commit 5a03de7051)
2017-02-17 19:37:06 +01:00
Thomas Haller
408e988a55 contrib/rpm: add explict configure options for building NetworkManager in "build_clean.sh"
When we create a source tarball, documentation and other generated files
are disted. Those files depend on the configure options when creating
the tarball. For example, the generated man pages contain the compile time
configurable default values.

For that reason, it is generally better to regenerate the documentation when
building NetworkManager. However, let's set explict configure options to
have a more reproducible way to generate the tarball.

When doing a release, you should not just call `make dist`. Instead, the
proper way of creating an official source tarball is:

  $ ./contrib/fedora/rpm/build_clean.sh --srpm

(cherry picked from commit 432717cf47)
2017-02-15 23:29:57 +01:00
Thomas Haller
9dde8263da build: fix dist-ing "man/common.ent.in"
(cherry picked from commit 4179cbb677)
2017-02-15 23:29:56 +01:00
Thomas Haller
8d18e13ace build: fix out-of-tree build generating "man/common.ent"
Fixes: 4de6f603e3
(cherry picked from commit 03efe8dba7)
2017-02-15 23:29:55 +01:00
Thomas Haller
d5b98617ad build: use sed instead of AC_SUBST() to generate man/common.ent
Otherwise, substitions are not properly expanded.

For example

- "AC_SUBST(nmrundir, '${runstatedir}'/$PACKAGE, [NetworkManager runtime state directory])"
  gives ${runstatedir}/NetworkManager/resolv.conf

- "AC_SUBST(nmrundir, "${runstatedir}/$PACKAGE", [NetworkManager runtime state directory])"
  gives ${prefix}/var/run/NetworkManager/resolv.conf

(cherry picked from commit 4de6f603e3)
2017-02-15 21:47:14 +01:00
Lubomir Rintel
0770d7e68e release: bump version to 1.6.3 (development) 2017-02-15 15:59:50 +01:00
Lubomir Rintel
037a12f96e release: bump version to 1.6.2 2017-02-15 13:26:14 +01:00
Lubomir Rintel
cef2c19623 release: update NEWS 2017-02-15 13:16:21 +01:00
Beniamino Galvani
78f2ab7cb8 dhcp: dhclient: reset the request list if conf file contains 'request'
After commit 2049e97d9e ("dhcp: refactor parsing of 'request' and
'also request' options") NM parses all the existing 'request' and
'also request' from the original configuration file and appends them
as 'also request' to avoid duplicates and conflicts.

So if the original file contains 'request x' (which means "request
only option x instead of builtin defaults"), we would translate it
into 'also request x', which appends the option to the builtin
defaults, causing duplicates in the DHCP request as dhclient seems not
smart enough to sanitize the list by itself.

To fix this, ensure that the request list is reset if the
configuration file contains a 'request'.

Fixes: 2049e97d9e

https://bugzilla.gnome.org/show_bug.cgi?id=778430
(cherry picked from commit f71e1379d6)
2017-02-14 11:37:11 +01:00
Beniamino Galvani
e940198c37 cli: fix setting of private key password
We can't pass the password obtained from
nm_setting_802_1x_get_*private_key_password() to
nm_setting_802_1x_set_*private_key() as the latter also frees the old
password.

Fixes: afd2811028
(cherry picked from commit b2146a43e5)
2017-02-13 15:53:31 +01:00
Thomas Haller
85140df117 all: merge branch 'th/device-pending-action-bgo777831' (part 2, wifi-scan)
Delay startup complete until Wi-Fi device completed scan and
autoactivation.

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

(cherry picked from commit f3504c9bc2)
2017-02-10 14:47:38 +01:00
Thomas Haller
8b95169791 device/wifi: prevent clearing pending wifi scan action during inactive supplicant
<debug> [1486325858.0691] device[0x563b8fba42e0] (wlp3s0): wifi-scan: scan-done callback: successful
    <debug> [1486325858.0692] device[0x563b8fba42e0] (wlp3s0): wifi-scan: scheduled in 23 seconds (interval now 33 seconds)
    <debug> [1486325858.0692] device[0x563b8fba42e0] (wlp3s0): remove_pending_action (0): 'wifi-scan'
    <trace> [1486325858.0692] properties-changed[0x563b8fba42e0]: ignoring notification for prop has-pending-action on type NMDeviceWifi
    <debug> [1486325858.0692] manager: check_if_startup_complete returns FALSE because of enp0s25
    <info>  [1486325858.0697] device (wlp3s0): supplicant interface state: ready -> inactive
    <debug> [1486325858.0698] device[0x563b8fba42e0] (wlp3s0): wifi-scan: scanning requested
    <debug> [1486325858.0698] device[0x563b8fba42e0] (wlp3s0): wifi-scan: (0) probe scanning SSID <hidden>
    <debug> [1486325858.0698] device[0x563b8fba42e0] (wlp3s0): wifi-scan: (1) probe scanning SSID "aaa"
    <trace> [1486325858.0699] device[0x563b8fba42e0] (wlp3s0): set-hw-addr: no MAC address change needed (2A:71:5D:54:85:1F)
    <debug> [1486325858.0699] device[0x563b8fba42e0] (wlp3s0): add_pending_action (1): 'wifi-scan'

(cherry picked from commit 94127d3f9e)
2017-02-10 14:47:18 +01:00
Thomas Haller
29b6ba0cd4 device/wifi: don't emit wrong SCAN_DONE signal when "Scan" request completes
scan_request_cb() handles the answer from the D-Bus "Scan" method.
At that point, the scan is not yet done, it merely started. It is
wrong to already signal SCAN_DONE.

The only place where we want to signal SCAN_DONE is when we actually
receive the "ScanDone" D-Bus signal.

(cherry picked from commit 75356841fb)
2017-02-10 14:47:18 +01:00
Thomas Haller
9977609b7a device/wifi: first emit NEW_BSS signals before SCAN_DONE
In the SCAN_DONE handler, NMDeviceWifi resets the flag that indicates
that a current scan request is pending. We need to first obtain the
new APs (NEW_BSS) before signalling SCAN_DONE.

(cherry picked from commit 40a4cc5b2d)
2017-02-10 14:47:18 +01:00
Thomas Haller
442ea0348d device/wifi: don't reschedule idle handler for schedule_ap_list_dump()
(cherry picked from commit e4a9942ba8)
2017-02-10 14:47:18 +01:00
Thomas Haller
f9c95bdd23 device/wifi: cache GObject property "scanning"
Cache the value for accessing the GObject property
NM_DEVICE_WIFI_SCANNING.

Re-evaluating the property every time by checking the
supplicant interface is ugly because it might change
under the hood. It should only change if (and only if)
we emit a notify changed signal.

Also, avoid accessing
  nm_supplicant_interface_get_scanning (priv->sup_iface)
without checking whether priv->sup_iface is not NULL.

(cherry picked from commit 4e84472b47)
2017-02-10 14:47:18 +01:00
Thomas Haller
a57a1940c2 device/wifi/trivial: reorder code in "nm-device-wifi.c"
(cherry picked from commit 1b7f03d1a5)
2017-02-10 14:47:18 +01:00
Thomas Haller
b8f3039d87 device/wifi: give wifi-scan related logging message common prefix
Add a prefix "wifi-scan: " to related logging messages for easier searching
the logfiles.

(cherry picked from commit a2798c18b6)
2017-02-10 14:47:18 +01:00
Thomas Haller
023bceb41c device/wifi: ensure consistent timestamp for dumping Wi-Fi AP
When we dump a list of APs, determine one timestamp for "now",
instead of re-evaluating it every time.

This ensures that all APs are printed with the same understanding
of the current timestamp.

(cherry picked from commit 5e4d13271c)
2017-02-10 14:47:18 +01:00
Thomas Haller
1272f3cc04 device/wifi: log scanning related messages with LOGD_WIFI instead of LOGD_WIFI_SCAN
LOGD_WIFI_SCAN is there to avoid flodding the log with continous scan
results. It should not be used for messages related to scheduling scan
requests.

This is especially important, because LOGD_WIFI_SCAN domain is not
included in LOGD_DEFAULT.

(cherry picked from commit d5657d003c)
2017-02-10 14:47:18 +01:00
Thomas Haller
36196b5a82 device/wifi: refactor logging of Wi-Fi AP by preserving logging context of device
The _LOGD() macros of NMDeviceWifi print a logging context for each
line, that is, they add a prefix with the device name.

Replace nm_wifi_ap_dump() by nm_wifi_ap_to_string() and let device
log a message about the AP.

Also, update the format for printing the AP. Now, all fields are
separated by space.

(cherry picked from commit d98fa31ddd)
2017-02-10 14:47:18 +01:00