Commit graph

15819 commits

Author SHA1 Message Date
Beniamino Galvani
2e32ec587b release: bump version to 1.4.6 2017-07-17 13:44:50 +02:00
Beniamino Galvani
29cbe0d7fb release: update NEWS 2017-07-17 11:02:22 +02:00
Thomas Haller
fb9c302af7 clients: fix appending integer to result in nmc_property_set_bytes()
(cherry picked from commit d76c190dc7)
(cherry picked from commit 06d3c95e4f)
2017-05-23 16:39:44 +02:00
Beniamino Galvani
e4750efb23 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)
2017-05-23 16:34:37 +02:00
Thomas Haller
faba5b7078 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)
2017-05-02 18:30:09 +02:00
Thomas Haller
bd21d1054a 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)
2017-04-26 21:14:13 +02:00
Beniamino Galvani
1c06d66a05 vlan: use parent interface mtu as default
VLANs already inherit the MTU from parent device when manually
activated. At boot, since the vlan interface is created before
activating the parent, the MTU is left to the default value.

Fix this by inheriting the MTU from parent when activating the
VLAN. Note that this change is effective only when the connection has
an actual IPv4 configuration; for all other cases users should
explicitly set the desired MTU value in the 'ethernet.mtu' property.

See master commit 7dde8d8106 ("vlan: use parent interface mtu as default")

https://bugzilla.redhat.com/show_bug.cgi?id=1439166
2017-04-24 18:38:58 +02:00
Thomas Haller
c625a3c7e2 libnm: diconnect signal handler for NMObject from GDBusProxy
Similar to commit 0429753dab from
nm-1-6 branch.

Related: https://bugzilla.gnome.org/show_bug.cgi?id=778615
https://bugzilla.redhat.com/show_bug.cgi?id=1436603
2017-04-24 14:47:56 +02:00
Lubomir Rintel
2f92d8cee1 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)
2017-04-24 09:56:44 +02:00
Thomas Haller
304615f301 build: fix type on Makefile.am
Fixes: 3cc00dd550
(cherry picked from commit e824dd34f0)
(cherry picked from commit 2ebc390734)
2017-04-20 15:54:57 +02:00
Thomas Haller
e391fe98a9 ifcfg: also read DEFROUTE and GATEWAY from alias files
Also accept DEFROUTE and GATEWAY when they are defined in
alias files -- provided, that they are not yet defined
in the main ifcfg file.

(cherry picked from commit 3cc00dd550)
(cherry picked from commit 4c595997f2)
2017-04-20 15:48:22 +02:00
Thomas Haller
faf1ffc5cc ifcfg: ensure ipv4.method is not "disabled" when reading IP addresses from alias files
When the main ifcfg file contains no IP addresses, the method
will be "disabled". Later, when reading IP addresses for the
aliases, we must ensure that the method is manual.

Otherwise, validation fails with

  ip.addresses: this property is not allowed for method=disabled

(cherry picked from commit a8f0d88596)
(cherry picked from commit be1daa4580)
2017-04-20 15:45:27 +02:00
Beniamino Galvani
369b323b2d device,default-route-manager: merge branch 'th/default-route-resync'
(cherry picked from commit 6197c27f24)
2017-04-03 13:33:11 +02:00
Thomas Haller
6cc6c42993 default-route-manager: decryptify logging line for default-route-manager
The default route manager logs for each entry relevant information,
in a compact but cryptic way:

  default-route: entry[0/dev:0x5633d5528560:enp0s25:1:+sync]: record:add    0.0.0.0/0 via 192.168.0.1 dev 2 metric 100 mss 0 rt-src user (100)

The flag whether a route is configured or not, was only expressed
via 0|1. Change that to log instead:

  default-route: entry[0/dev:0x5633d5528560:enp0s25:+has:+sync]: record:add    0.0.0.0/0 via 192.168.0.1 dev 2 metric 100 mss 0 rt-src user (100)

(cherry picked from commit 82bfb6c46d)
2017-04-03 13:30:50 +02:00
Thomas Haller
9e81a33949 default-route-manager: alyways force a sync of the default route
Whenever we call update for a non-assumed, synced route, we must
force a resync with the platform. Even if according to our internal
book-keeping the route is already configured, the route may have
been removed externally. So we cannot assume that everything is
still up-to-date.

https://bugzilla.redhat.com/show_bug.cgi?id=1431268
(cherry picked from commit c3c251ea12)
2017-04-03 13:30:49 +02:00
Thomas Haller
cd7c79e83f default-route-manager: simplify determining synced flag in _ipx_update_default_route()
No change in behavior at all. The same logic applies, but this should
be simpler to understand.

(cherry picked from commit 0b3ba99409)
2017-04-03 13:28:37 +02:00
Lubomir Rintel
1eebc0ca01 settings-connection: fix Save()
Avoid using new_settings when they are none. Also, don't shortcut when
the connection hasn't been changed -- let the settings plugin decide if
it needs to rewrite the connection.

(cherry picked from commit b47340fd3f)
(cherry picked from commit 58c9a41959)
2017-03-24 10:42:37 +01:00
Iain Lane
dec4423a9d nm-manager: Use g_dbus_message_new_method_error_literal()
GLib 2.52 added a G_GNUC_PRINTF attribute to
g_dbus_message_new_method_error(). This triggered warning in
NetworkManager when built with -Wformat, which is an error when built
with -Werror=format-security. It seems that gcc isn't smart enough to
see that (foo = "bar") should be treated as a literal.

Fortunately there is a g_dbus_message_new_method_error_literal()
function which does not take printf-style arguments, and we don't need
them, so we can use that.

This patch was originally by Rico Tzschichholz <ricotz@ubuntu.com>, and
was submitted to Launchpad at

https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1650972
https://bugzilla.gnome.org/show_bug.cgi?id=780444
(cherry picked from commit 6a77258f4e)
(cherry picked from commit 1715ec53c1)
2017-03-23 13:14:46 +01:00
Dan Williams
fcba6a2881 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:26:28 -05:00
Thomas Haller
aab4e2fdaa po: make update-po 2017-03-22 11:16:41 +01:00
Thomas Haller
51652d9360 zanata: update project-version 2017-03-21 15:25:31 +01:00
Beniamino Galvani
f0eb192d8c 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)
(cherry picked from commit 427a3e5cff)
2017-03-21 13:35:43 +01:00
Thomas Haller
42eb57c0c1 libnm: fix memleak of GUdevDevice in get_bus_name()
Fixes: f7b1b28202
(cherry picked from commit c033330c41)
(cherry picked from commit 6311bf6666)
2017-03-20 11:35:15 +01:00
Lubomir Rintel
b2059059fd nm-object: initialize the object buffer to zero
(cherry picked from commit df46c59775)
2017-03-16 17:56:41 +01:00
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