Commit graph

15795 commits

Author SHA1 Message Date
Beniamino Galvani
a75d6b8fbb 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)
(cherry picked from commit 238fc87298)
2017-03-15 16:41:20 +01:00
Thomas Haller
135fa26dab libnm: chain up NMRemoteConnection::constructed() function
Fixes: 0fdd71fe6e
(cherry picked from commit 9ed0e3705e)
(cherry picked from commit 8a857c4475)
2017-03-09 15:22:55 +01:00
Thomas Haller
5843538252 platform: filter out invisible links for cache lookup by name
Fixes: ad1d74d142
(cherry picked from commit f0e295d3d7)
(cherry picked from commit 5cd90717ad)
2017-03-09 15:22:54 +01:00
Lubomir Rintel
f72c54a2cc 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:09:13 +01:00
Beniamino Galvani
6913311d47 platform: fix detection of primary/secondary addresses
ip4_addr_subnets_is_secondary() should fill the list of addresses in
the same subnet also when returning FALSE, because
nm_platform_ip4_address_sync() uses it.

Fixes: 2f68a50041
(cherry picked from commit a347962831)
2017-02-08 15:14:12 +01:00
Beniamino Galvani
8b36e99ffe platform: fix the order of addition of primary and secondary IPv4 addresses
nm_platform_ip4_address_sync() tries to apply the new configuration
with the minimum effort and doesn't delete addresses if they are
already present on the interface. This can break the ordering, as an
existing address would be promoted by kernel to primary, even if it
was last in our configuration.

Add some logic to ensure the correct order of addresses is always
enforced. This fixes situations like:

 # nmcli connection add type ethernet ifname eth0 con-name t \
                        ipv4.method manual \
                        ipv4.addresses "1.1.1.1/24,1.1.1.2/24,1.1.1.5/24"
 # nmcli connection up t

  => addresses are applied in the right order:
     inet 1.1.1.1/24 brd 1.1.1.255 scope global eth0
     inet 1.1.1.2/24 brd 1.1.1.255 scope global secondary eth0
     inet 1.1.1.5/24 brd 1.1.1.255 scope global secondary eth0

 # nmcli connection mod t ipv4.addresses "1.1.1.5/24,1.1.1.2/24,1.1.1.1/24"
 # nmcli device reapply eth0

  => order is wrong:
     inet 1.1.1.2/24 brd 1.1.1.255 scope global eth0
     inet 1.1.1.5/24 brd 1.1.1.255 scope global secondary eth0
     inet 1.1.1.1/24 brd 1.1.1.255 scope global secondary eth0

Co-Authored-By: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 2f68a50041)
2017-02-08 10:12:34 +01:00
Thomas Haller
e7ce496166 device/wifi: drop messing with wpa-supplicant's support for MAC address randomization
We no longer use wpa_supplicant for MAC address randomization. Instead, NetworkManager
handles it on it's own. It is actually important that supplicant does not interfere
when setting the MAC address of the device.

The code was only in effect when supplicant has a PreassocMacAddr property.
As this is a recent feature, the left-over code wasn't noticed until now.

https://mail.gnome.org/archives/networkmanager-list/2017-February/msg00003.html

Fixes: 767abfa690
(cherry picked from commit 0cb85f161e)
(cherry picked from commit 7ada0e0bc3)
2017-02-07 14:39:40 +01:00
Beniamino Galvani
3ddc18bb55 bond: fix crash in update_connection()
The value read from sysfs can be NULL.

Fixes: 2324410a75
(cherry picked from commit 0683ad5db2)
2017-02-07 11:16:24 +01:00
Francesco Giudici
86490fbb1d 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)
2017-02-06 17:56:40 +01:00
Thomas Haller
2caf3b1f04 systemd: fix memleak in dhcp6_option_parse_domainname
https://github.com/systemd/systemd/pull/5114
419eaa8f8d
(cherry picked from commit c2d0b9eec0)
(cherry picked from commit 3a4c9676da)
2017-02-06 14:10:14 +01:00
Thomas Haller
d8cc0609f1 systemd: fix memleak in dhcp6_lease_set_domains
https://github.com/systemd/systemd/pull/5113
0b75a95ace
(cherry picked from commit 7cd2dfabec)
(cherry picked from commit d1fb96207e)
2017-02-06 14:10:12 +01:00
Thomas Haller
fa142d856c build: add missing GLIB_CFLAGS for compiling adsl device plugin
(cherry picked from commit cd267cceed)
(cherry picked from commit 38cef9de7a)
2017-01-29 12:27:58 +01:00
Thomas Haller
44ab1914a4 libnm-core: clear wifi.mac-address-randomization when unsetting wifi.cloned-mac-address
When a client clears wifi.cloned-mac-address, he clearly also want
to clear the deprected wifi.mac-address-randomization property.

Do that automatically in libnm.

https://mail.gnome.org/archives/networkmanager-list/2017-January/msg00060.html
(cherry picked from commit 7f63c875f9)
(cherry picked from commit 157b6d0ec4)
2017-01-28 17:19:55 +01:00
Thomas Haller
cb18faf2df ifcfg-rh: fix interpreting missing MAC_ADDRESS_RANDOMIZATION as permanent address
With commit 4f6c91d696, we aimed to
enable mac-address-randomization by default for Wi-Fi. That however
is not possible by default because it breaks various scenarios.
Also, later wifi.mac-address-randomization was deprecated in favor
of wifi.cloned-mac-address setting.

Both wifi.mac-address-randomization and wifi.cloned-mac-address support
global default values, so it is wrong to read a missing
MAC_ADDRESS_RANDOMIZATION setting as "NEVER" -- which due to
normalization also results in cloned-mac-address=permanent.

See also commit 46d53e1101 which does
something similar for keyfile.

This bug also prevents a user from clearing the cloned-mac-address:

  $ nmcli connection show "$CONN"
  ...
  802-11-wireless.cloned-mac-address:        permanent
  802-11-wireless.mac-address-randomization: never
  ...
  $ nmcli connection modify "$CONN: wifi.cloned-mac-address ''
  # ^ takes no effect

As workaround, you also need to clear mac-address-randomization:

  $ nmcli connection modify "$CONN: wifi.cloned-mac-address '' \
          wifi.mac-address-randomization default

https://mail.gnome.org/archives/networkmanager-list/2017-January/msg00060.html
(cherry picked from commit 27cba47957)
(cherry picked from commit 491ccd9d64)
2017-01-28 16:08:41 +01:00
mirh
b0ad0ff4d7 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)
2017-01-19 14:21:47 +01:00
Lubomir Rintel
263dc2dfd1 build: fix build with older gi
Fixes: 6c96aafaa9
(cherry picked from commit 22722b7732)
(cherry picked from commit b916d9dfe0)
2017-01-19 14:19:29 +01:00
Lubomir Rintel
bc2e0269a4 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)
2017-01-19 14:19:28 +01:00
Thomas Haller
d0ee773221 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)
2017-01-18 18:59:20 +01:00
Lubomir Rintel
b28b275c5e ifcfg-rh: write the master device name even if the master property is an UUID
We used MASTER, BRIDGE and TEAM_MASTER keys for a differnet purpose than the
network.service did, confusing the legacy tooling. Let's do our best to write
compatible configuration files:

* Add *_UUID properties that won't clash with initscripts
* Ignore non-*_UUID keys on read if *_UUID is present
* If the connection.master is an UUID of a connection with a
  connection.interface-name, write the uuid into the *_UUID key while setting
  the non-*_UUID key to the interface name for compatibility

https://bugzilla.redhat.com/show_bug.cgi?id=1369091
(cherry picked from commit 8b7b0d3fc2)
2017-01-12 19:08:31 +01:00
Thomas Haller
c0fa787c28 device: cleanup setting of ip-iface
Move the updating/setting of the ip-ifindex/ip-iface to one place.

Properties should be for the most part immutable/read-only, and only
at particular places modified. That way, it's easier to track who
changes a property.

Also, add a logging line with "ip-ifname" prefix.

https://mail.gnome.org/archives/networkmanager-list/2017-January/msg00011.html

(cherry picked from commit 78017f1bdc)
2017-01-12 13:28:53 +01:00
Beniamino Galvani
a25b3327c7 platform: don't update IPv6 temporary addresses
The kernel already takes care of adding and updating temporary
addresses when an address with IFA_F_MANAGETEMPADDR flag is added or
updated; doing it also in nm_platform_ip6_address_sync() can overwrite
the changes done by kernel, especially because since commit
0a0bca9c7f ("ip6-config: sort addresses only when reading the
property value") there is no guarantee that temporary addresses are
before the public ones in the IPv6 configuration.

Still delete temporary addresses, but don't add or update them.

(cherry picked from commit 1dbd9d7948)
2017-01-10 15:39:52 +01:00
Beniamino Galvani
fc56eff0ae settings: fix assertion when changing connection managed state
When a ifcfg-rh connection becomes unamanaged it is removed from the
connection list in NMSettings and marked as removed; it is however
kept alive in the plugin and can become managed again later. To avoid
failed assertions, the @removed flag of the NMSettingsConnection must
be cleared if the connection is not being disposed.

(cherry picked from commit a9384452ed)
2017-01-10 14:28:14 +01:00
Thomas Haller
2a960d3936 keyfile: fix interpreting missing wifi.mac-address-randomization as permanent address
With commit 4f6c91d696, we aimed to
enable mac-address-randomization by default for Wi-Fi. That however
is not possible by default because it breaks various scenarios.
Also, later wifi.mac-address-randomization was deprecated in favor
of wifi.cloned-mac-address setting.

Both wifi.mac-address-randomization and wifi.cloned-mac-address support
global default values, so it is wrong to read a missing
mac-address-randomization as "NEVER" -- which due to
normalization also results in cloned-mac-address=permanent.

(cherry picked from commit 46d53e1101)
2017-01-09 17:32:27 +01:00
Beniamino Galvani
48db5806f3 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)
2017-01-07 15:07:29 +01:00
Thomas Haller
8a281bf7b4 keyfile: fix memleak in keyfile reader's read_array_of_uint()
Fixes: 9559a7a260
(cherry picked from commit 8239edbb9b)
2017-01-05 12:33:21 +01:00
Lubomir Rintel
479a64a5b7 device: avoid a crash when L3 configuration fails
Don't call the IP check until at either IPv4 or IPv6 is actually
configured.

(cherry picked from commit aa71dbc6c4)
2017-01-05 09:39:41 +01:00
Thomas Haller
c5650d3500 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)
2017-01-04 09:43:22 +01:00
Thomas Haller
4369f102f6 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)
2017-01-04 09:42:59 +01:00
Thomas Haller
26f0d68e82 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)
2017-01-04 09:42:58 +01:00
Dan Williams
28cd59a016 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:12 -06:00
Lubomir Rintel
64a8a61822 release: bump version to 1.4.5 (development) 2016-12-16 13:31:38 +01:00
Lubomir Rintel
3c70a03cf5 release: bump version to 1.4.4 2016-12-16 11:38:36 +01:00
Thomas Haller
969bb5eead NEWS: clearify news entry and mention th/preserve-fake-perm-hwaddr-bgo772880 2016-12-16 10:09:31 +01:00
Lubomir Rintel
084a7c3a86 release: update NEWS 2016-12-15 20:47:15 +01:00
Thomas Haller
ea944d5b4c core: merge branch 'th/sysctl-ifname-race-bgo775613' (early part)
Backport some of the patches from "th/sysctl-ifname-race-bgo775613"
branch.

https://bugzilla.gnome.org/show_bug.cgi?id=775613
2016-12-15 19:38:19 +01:00
Thomas Haller
f0d20c945e all: use O_CLOEXEC for file descriptors
(cherry picked from commit 4bdee37771)
2016-12-15 17:52:33 +01:00
Thomas Haller
fea11a91a3 platform: refactor nmp_utils_sysctl_open_netdir()
- use nm_auto_close cleanup attribute
- optionally, return the found ifname
- don't stat "phy80211". If such an entity can be opened,
  just assume it's a directory.

(cherry picked from commit 76876e896c)
2016-12-15 17:52:33 +01:00
Kai-Heng Feng
e196ff7553 platform: wifi: use nmp_utils_open_sysctl() to check if device is wifi
Since function nmp_utils_open_sysctl() can avoid race condition, use it
in wifi_utils_is_wifi() to open sysfs and correctly check if it's a wifi
device.

https://bugzilla.gnome.org/show_bug.cgi?id=775613
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
(cherry picked from commit b95556eb78)
2016-12-15 17:52:33 +01:00
Kai-Heng Feng
8705a16d48 platform: add a new function nmp_utils_open_sysctl()
A race condition may happen when NetworkManager opens sysfs and udev
renames interface name at the same time. Thomas Haller provides a new
function [1] which can avoid the race condition when opening sysfs.

This patch is a direct copy from [1].

[1] https://mail.gnome.org/archives/networkmanager-list/2016-December/msg00004.html

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
(cherry picked from commit 713c74f6e4)
2016-12-15 17:52:32 +01:00
Thomas Haller
f16a9a2299 device/wwan: use nm_auto_close instead of gs_fd_close
(cherry picked from commit ed299cc860)
2016-12-15 17:52:32 +01:00
Thomas Haller
f39138ea48 shared: add nm_auto_close and nm_auto_fclose
We already have gs_fd_close, which however doesn't preserve
errno and only checks for fd != -1. Add our own define.

Downside is, we have to include stdio.h and errno.h,
which effectively ends up to be included *everywhere*.

(cherry picked from commit 312cea870d)
2016-12-15 17:51:04 +01:00
Beniamino Galvani
9afbaa86ce manager: merge branch 'bg/manager-state-bgo776001'
https://bugzilla.gnome.org/show_bug.cgi?id=776001

(cherry picked from commit a7938a5b2c)
2016-12-14 10:22:23 +01:00
Beniamino Galvani
c7167c9088 manager: don't upgrade the state when connectivity check fails
If a connection is ACTIVATED and another one is ACTIVATING but there
is no global connectivity, we currently set the manager state to
CONNECTING and start a connectivity check to verify whether the
manager state can be promoted to CONNECTED_GLOBAL.

If this connectivity check fails, we shouldn't promote a CONNECTING
state to CONNECTED_SITE.

Fixes: 084da69a30
(cherry picked from commit 7375822c95)
2016-12-14 10:21:53 +01:00
Beniamino Galvani
151dbe10b1 manager: don't update the manager state in get_property()
The manager state is already computed every time an active connection
changes state, it is not necessary to call nm_manager_update_state()
also when the property is read.

Moreover, nm_manager_update_state() emits a "notify::state" signal
which causes a re-read of the property by the nm-exported-object,
resulting in a nested execution of nm_manager_update_state().

(cherry picked from commit 4cc45ee291)
2016-12-14 10:21:50 +01:00
Beniamino Galvani
a9135e983d core: merge branch 'bg/ip-order-rh1394500'
https://bugzilla.redhat.com/show_bug.cgi?id=1394500
(cherry picked from commit 207a747064)
2016-12-09 23:31:02 +01:00
Beniamino Galvani
2ea42eee5a ip6-config: sort addresses only when reading the property value
Don't change the address order from configuration, but instead sort
addresses just before returning them to clients.

(cherry picked from commit 0a0bca9c7f)
2016-12-09 14:30:57 +01:00
Beniamino Galvani
450572cff4 ip6-config: add nm_ip6_config_set_privacy()
(cherry picked from commit 803a79f778)
2016-12-09 14:30:46 +01:00
Beniamino Galvani
6633eaf75c ip6-config: cache addresses variants
(cherry picked from commit ed4d5889c7)
2016-12-09 14:18:58 +01:00
Beniamino Galvani
6fdea664a4 ip4-config: sort addresses only when reading the property value
Don't change the address order from configuration, but instead sort
addresses just before returning them to clients.

(cherry picked from commit 9609d4da1d)
2016-12-09 14:18:56 +01:00
Beniamino Galvani
996f325f67 ip4-config: cache addresses variants
(cherry picked from commit 5ce81e23b7)
2016-12-09 14:18:54 +01:00