Commit graph

20525 commits

Author SHA1 Message Date
Thomas Haller
c740726b57 dhcp: fix leak in dhclient's dhclient_start()
Fixes: 5d6d5cd136
(cherry picked from commit c87faf07a1)
(cherry picked from commit 8f9240de96)
2018-09-10 14:38:52 +02:00
Beniamino Galvani
3a2c6f81f6 core: fix wireless bitrate property name on D-Bus
In commit 297d4985ab ("core/dbus: rework D-Bus implementation to use
lower layer GDBusConnection API") the Device.Wireless 'Bitrate'
property on D-Bus was accidentally changed to 'BitRate'. Revert the
old name.

Reported-by: Joseph Conley <joseph.j.conley@gmail.com>
Fixes: 297d4985ab

https://mail.gnome.org/archives/networkmanager-list/2018-September/msg00004.html
(cherry picked from commit c882633d48)
2018-09-07 09:52:57 +02:00
Beniamino Galvani
a0b4aff370 core: merge branch 'bg/rh1542366'
https://bugzilla.redhat.com/show_bug.cgi?id=1542366
(cherry picked from commit c7c989804f)
2018-09-05 17:19:15 +02:00
Beniamino Galvani
17a89f7061 manager: don't update ifindex of existing devices
When NM has to rebuild the platform cache, it first generates ADD and
then REMOVE events for the links.  So, if an interface is removed and
readded, platform will emit the ADDED event with a new ifindex while
the device with old ifindex still exists.

In such case the manager currently updates the device's ifindex but
this causes problems as the DNS manager tracks configurations by their
ifindex and so the configurations for the old device will become
stale.

Fix this by removing the device and adding it again when we detect a
change of ifindex on a device that already had valid one.

https://bugzilla.redhat.com/show_bug.cgi?id=1542366
(cherry picked from commit 281974b932)
2018-09-05 17:18:52 +02:00
Beniamino Galvani
fb83d62395 device: clear queued IP config sources when the device is unrealized
If the device is later realized again, we assert that there aren't any
IP config changes queued. Therefore, they must be cleared on
unrealize().

(cherry picked from commit 9ed07fbb46)
2018-09-05 17:18:49 +02:00
Thomas Haller
1c56be4090 libnm/keyfile: fix double free in keyfile's get_bytes()
Fixes: 5e7b14af03
(cherry picked from commit fcf254c03a)
2018-09-04 07:45:45 +02:00
Thomas Haller
478804780d libnm: fix leaking private-key in nm_setting_802_1x_set_phase2_private_key()
(cherry picked from commit 98ca7022e3)
2018-09-04 07:45:44 +02:00
Beniamino Galvani
74fc6f30b2 libnm-core: support private keys encrypted with AES-{192,256}-CBC
https://github.com/NetworkManager/NetworkManager/pull/189
(cherry picked from commit 93f85edcce)
2018-08-30 09:57:33 +02:00
Thomas Haller
f326feaba3 wifi: don't use :1 bitfield for gboolean type
gboolean is a typedef for "int".

While older compilers might treat such bitfields as unsigned ([1]),
commonly such a bitfield is signed and can only contain the values 0
and -1.

We only want to use numeric 1 for TRUE, hence, creating such bitfields
is wrong, or at least error prone.

In fact, in this case it's a bug, because later we compare
it with a regular gboolean

  if (priv->scanning != new_scanning)

[1] https://lgtm.com/rules/1506024027114/

Fixes: e0f9677018
(cherry picked from commit 610ca87016)
2018-08-26 18:33:45 +02:00
Lubomir Rintel
5810c46b11 utils/test: don't assert on debug level messages
They come and go in GLib core for all sorts of purposes. Don't let that
break our tests.

(cherry picked from commit 3e8eef5389)
2018-08-23 11:04:36 +02:00
Lubomir Rintel
0550003ef0 ip4-config: fix a typo 2018-08-19 13:55:35 +02:00
Lubomir Rintel
7af38dc4fc po/ja: translations from the Red Hat translators 2018-08-19 13:55:10 +02:00
Beniamino Galvani
5b31dfb1a5 cli: remove assertion in nmc_device_state_to_color()
nmcli should not fail when the state device state is > ACTIVATED.
Just return an unknown color code like we used to do, and like we do
for connections.

Fixes: 31aa2cfe29

https://bugzilla.gnome.org/show_bug.cgi?id=796834
(cherry picked from commit c955d91d4b)
2018-08-10 10:14:40 +02:00
Lubomir Rintel
adc0849895 man/openvswitch: advise to use "master" instead of "conn.master"
It does some extra magic -- normalizes the value and initializes
slave-type.

https://bugzilla.redhat.com/show_bug.cgi?id=1519176
(cherry picked from commit 57d4286d54)
2018-08-06 19:00:39 +02:00
Thomas Haller
0a3755c179 version: fix compile error due to NM_AVAILABLE_IN_1_12_2 macro
Fixes: 8d09660481

https://mail.gnome.org/archives/networkmanager-list/2018-July/msg00023.html
2018-07-31 14:21:08 +02:00
Lubomir Rintel
e2bc6ba935 release: bump version to 1.12.3 (development) 2018-07-25 12:32:34 +02:00
Lubomir Rintel
1e74a4b43e release: bump version to 1.12.2 2018-07-25 12:21:34 +02:00
Lubomir Rintel
e4c40c809f release: update NEWS 2018-07-25 12:17:57 +02:00
Lubomir Rintel
834f7946f6 contrib/rpm: add RHEL connectivity checking package
https://github.com/NetworkManager/NetworkManager/pull/166
(cherry picked from commit c40dbeb49a)
2018-07-25 12:16:30 +02:00
Lubomir Rintel
50e4afdcd8 contrib/rpm: use whitespace consistently
Double newline is used to visually separate sections.

(cherry picked from commit 3f449654f7)
2018-07-25 12:16:29 +02:00
Lubomir Rintel
be106d6e19 build: do not randomize tests by default
We don't want the users to default to running the code paths in tests that
we didn't check before. They may end up failing randomly.

(cherry picked from commit 9c6ff7fe18)
2018-07-24 20:19:04 +02:00
Lubomir Rintel
c252851f00 rpm: own /etc/sysconfig/network-scripts
We don't rely on initscripts. If they're gone, we still use the
directory.

(cherry picked from commit 0413704470)
2018-07-24 20:18:16 +02:00
Lubomir Rintel
8d09660481 libnm: add accessors for ovs port/bridge slaves
(cherry picked from commit 5f30a2b525)
2018-07-24 19:08:38 +02:00
Lubomir Rintel
9e015bab81 devices/ovs: expose slaves on D-Bus for OVS bridges and ports
[lkundrak@v3.sk: changed 1.14 to 1.12.2]

(cherry picked from commit 8d65f636e1)
2018-07-24 19:08:38 +02:00
Lubomir Rintel
995ed66cda all/trivial: grammar fix
(cherry picked from commit 889961f8b6)
2018-07-24 19:08:38 +02:00
Thomas Haller
f0c84b5240 gitignore: ignore config-extra.h
Master added the generated header "config-extra.h".
That file does not exist on this branch, so when
switching branches, this file shows up as untracked.

Just let git ignore it.
2018-07-24 17:35:34 +02:00
Thomas Haller
80fa0604d0 connectivity: merge branch 'th/connectivity-busy-loop-fix'
(cherry picked from commit 057c7b94a0)
2018-07-24 17:31:48 +02:00
Thomas Haller
660e308dd2 connectivity: avoid busy looping with connectivity-check failed
It seems, curl_multi_socket_action() can fail with

  connectivity check failed: 4

where "4" means CURLM_INTERNAL_ERROR.

When that happens, it also seems that the file descriptor may still have data
to read, so the glib IO callback _con_curl_socketevent_cb() will be called in
an endless loop. Thereby, keeping the CPU busy with doing nothing (useful).

Workaround by disabling polling on the file descriptor when something
goes wrong.

Note that optimally we would cancel the affected connectivity-check
right away. However, due to the design of libcurl's API, from within
_con_curl_socketevent_cb() we don't know which connectivity-checks
are affected by a failure on this file descriptor. So, all we can do
is avoid polling on the (possibly) broken file descriptor. Note that
we anyway always schedule a timeout of last resort for each check. Even
if something goes very wrong, we will fail the check within 15 seconds.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=903996
(cherry picked from commit 884a28b28c)
2018-07-24 17:31:32 +02:00
Thomas Haller
4af9ae13e0 connectivity: add compile time check that "curl_socket_t" is a typedef to plain "int"
On non-Windows, libcurl's "curl_socket_t" type is just a typedef for
int. We rely on that, because we use it as file descriptor.

Add a compile time check to ensure that.

(cherry picked from commit 970af59731)
2018-07-24 17:31:32 +02:00
Thomas Haller
a54ffc6c01 connectivity/trivial: rename socket argument in multi_socket_cb() callback
"s" might be a good name for a temporary string.

But here it's really a file descriptor. Call it "fd".

(cherry picked from commit cd0bd8a2ee)
2018-07-24 17:31:32 +02:00
Thomas Haller
abd994d916 connectivity/trivial: rename local functions to avoid "curl" prefix
Since this is "C" there are not namespaces and libraries commonly choose
a particular name prefix for their symbols.

In case of libcurl, that is "curl_".

We should avoid using the same name prefix, and choose something distinct.

(cherry picked from commit a24f118a1f)
2018-07-24 17:31:32 +02:00
Lubomir Rintel
7e8425de52 setting-connection: fix ovs-port parent setting verification
$ nmcli c add type ovs-port ifname ovsport0
  Error: Failed to add 'ovs-port-ovsport0' connection: connection.type:
      Only 'ovs-port' connections can be enslaved to 'ovs-bridge'

nm_streq0() is not good here. It fails (with a wrong error message) even
when the slave_type is not set, which it shouldn't since slave_type can
be normalized. The real problem is the lack of the master property.

This fixes the condition:

  $ nmcli c add type ovs-port ifname ovsport0
  Error: Failed to add 'ovs-port-ovsport0' connection: connection.master:
    A connection with a 'ovs-port' setting must have a master.

Corrects the error message:

  $ nmcli c add con-name br0 type bridge
  $ nmcli c add type ovs-port ifname ovsport0 parent br0
  Error: Failed to add 'bridge-slave-ovsport0' connection: connection.slave-type:
    'ovs-port' connections must be enslaved to 'ovs-bridge', not 'bridge'

And gets rid of a confusing nm_streq0 use when comparing the type, since
at that point type must not be NULL anymore.

Fixes: 4199c976da
(cherry picked from commit 354140e8d3)
2018-07-13 20:54:58 +02:00
Jan Alexander Steffens (heftig)
461f511227 wifi/ifd: Allow D-Bus activation to launch iwd
iwd does not ship activation configuration yet; until then we simply
fail the way we already do.

https://bugzilla.gnome.org/show_bug.cgi?id=796805
(cherry picked from commit 21f955b4dd)
2018-07-13 20:54:17 +02:00
Beniamino Galvani
87cd30c7d9 device: destroy pending acd-managers when the device disconnects
We previously kept any acd-manager running if the device was
disconnected. It was possible to trigger a crash by setting a long
dad-timeout and interrupting the activation request:

  nmcli con add type ethernet ifname eth0 con-name eth0+ ip4 1.2.3.4/32
  nmcli con mod eth0+ ipv4.dad-timeout 10000
  nmcli -w 2 con up eth0+
  nmcli con down eth0+

After this, the n-acd timer would fire after 10 seconds and try to
disconnect an already disconnected device, throwing the assertion:

  NetworkManager:ERROR:src/devices/nm-device.c:9845:
  activate_stage5_ip4_config_result: assertion failed: (req)

Fixes: 28f6e8b4d2
(cherry picked from commit 260cded3d6)
2018-07-11 17:28:22 +02:00
Thomas Haller
d2b4a6c35b connectivity: downgrade verbosity of error logging
Such failures during connectivity checks, may happen frequently
and due to external causes. Don't log with error level to avoid
spamming the logfile.

(cherry picked from commit ca9981eb5d)
2018-07-11 16:44:28 +02:00
Beniamino Galvani
9748aef7c7 manager: accept non-null device for VPN activations
Commit 10753c3616 ("manager: merge VPN handling into
_new_active_connection()") added a check to fail the activation of
VPNs when a device is passed to ActivateConnection(), since the device
argument is ignored for VPNs.

This broke activating VPNs from nm-applet as nm-applet sets both the
specific_object (parent-connection) and device arguments in the
activation request.

Note that we already check in _new_active_connection() that when a
device is supplied, it matches the device of the parent
connection. Therefore, the check can be dropped.

Reported-by: Michael Biebl <biebl@debian.org>
Fixes: 10753c3616

https://github.com/NetworkManager/NetworkManager/pull/159
(cherry picked from commit e205664ba8)
2018-07-09 13:41:42 +02:00
Thomas Haller
ffcd74e9e4 build/meson: fix meson build without pppd
Fixes: 1cdb36b8de
(cherry picked from commit 530b82a372)
2018-07-09 12:31:36 +02:00
Jan Tojnar
e117fc0b2d ppp-manager: use configured pppd path
Path to pppd can be set via configure flag but the source code ignores it.

Let's use PPPD_PATH like other calls of nm_utils_find_helper do.

https://bugzilla.gnome.org/show_bug.cgi?id=796752
(cherry picked from commit 1cdb36b8de)
2018-07-09 11:34:44 +02:00
Jan Tojnar
d23af045f6 meson: define PPPD_PATH variable
configure.ac defines it just like it defines other PATH variables
for use with nm_utils_find_helper. Meson for some reason did not.

https://bugzilla.gnome.org/show_bug.cgi?id=796752
(cherry picked from commit f3c1e7f6ab)
2018-07-09 11:34:43 +02:00
Michael Biebl
d34e5e29f4 Increase timeout in test-nm-client to 30s
On slow architectures it can take longer then 3s for the test service to
start up.

(cherry picked from commit 7ab7dc9487)
2018-07-05 17:00:30 +02:00
Beniamino Galvani
a03b867ba4 libnm: add (allow-none) annotations to nm_device_reapply()
The @connection argument can be NULL; add the (allow-none) annotation
otherwise calling the API with a NULL argument through GObject
introspection fails with:

 Argument 1 does not allow None as a value

Fixes: 278fd4fb0f
(cherry picked from commit f396826466)
2018-07-04 14:13:28 +02:00
Beniamino Galvani
fa5fa51f4b platform: change temp variable name in NLA_PUT_TYPE()
__tmp clashes with htole16() on s390x.

Fixes: 4120ad2431

https://github.com/NetworkManager/NetworkManager/pull/151
(cherry picked from commit 4888ee7e83)
2018-07-01 18:42:35 +02:00
Thomas Haller
b693daf6ba libnm: fix missing symbols in libnm ABI
Also backport the ABI to 1.12.2 (and thus, don't bother
initially adding the API as libnm_1_14_0).

(cherry picked from commit b26efa5b68)
2018-06-30 12:40:14 +02:00
Thomas Haller
ae6661fdce release: bump version to 1.12.1 (development) 2018-06-29 17:18:00 +02:00
Thomas Haller
8964dbe8bc release: bump version to 1.12.0 2018-06-29 17:06:25 +02:00
Thomas Haller
db8696f164 release: update NEWS 2018-06-29 17:01:42 +02:00
Thomas Haller
e0dc1da411 release: fix NEWS entry for NM_DISPATCHER_ACTION
This was not backported to nm-1-10 branch.
2018-06-29 17:01:42 +02:00
Thomas Haller
f3d1cf8100 device: merge branch 'th/device-dad-handling-rh1593210'
While this fixes rh#1593210 and CI test "ipv6_keep_external_routes",
it breaks CI test "ipv6_add_static_address_manually_not_active". See
related bug rh#1585078. It seems in the short term, the fix is more
important than the new issue, hence merging.

https://bugzilla.redhat.com/show_bug.cgi?id=1593210
https://github.com/NetworkManager/NetworkManager/pull/144

(cherry picked from commit 8076a6f003)
2018-06-29 16:43:31 +02:00
Thomas Haller
1609344eda device: only check for IPv6 DAD and link-local address on actively managed devices
In device_ipx_changed() we only keep track of dad6_failed_addrs
addresses if the device's state is > DISCONNECTED.

For the same reason, we should also do that in queued_ip_config_change().

But it's worse. If the device is in state disconnected, and the user
externally adds IPv6 addresses, we will end up in queued_ip_config_change().
It is easily possible that "need_ipv6ll" ends up being TRUE, which results
in a call to check_and_add_ipv6ll_addr() and later possibly

  ip_config_merge_and_apply (self, AF_INET6, TRUE);

This in turn will modify the IP configuration on the device, although
the device may be externally managed and NetworkManager shouldn't touch it.

https://bugzilla.redhat.com/show_bug.cgi?id=1593210
(cherry picked from commit 890c748643)
2018-06-29 16:43:10 +02:00
Thomas Haller
e7ea66eb1a device: emit IP address changes in queued_ip_config_change() only once
We first iterate over addresses that might have failed IPv6 DAD and
update the state in NMNDisc.

However, while we do that, don't yet invoke the changed signal.
Otherwise, we will invoke it multiple times (in case multiple addresses
failed). Instead, keep track of whether something changed, and handle
it once a bit later.

(cherry picked from commit f312620276)
2018-06-29 16:43:10 +02:00