Commit graph

24619 commits

Author SHA1 Message Date
Thomas Haller
9bc56dcc9e libnm: fix exposing nm_wifi_p2p_peer_get_name() from D-Bus property
Fixes: ce0e898fb4 ('libnm: refactor caching of D-Bus objects in NMClient')
(cherry picked from commit e978eca644)
2020-01-15 14:02:21 +01:00
Thomas Haller
0c6ebcb6ed introspection: belatedly add Wi-Fi P2P peer "Name" property to D-Bus introspection file
Fixes: 00e64d1332 ('core/devices: Add P2P Wifi device and peer tracking')
(cherry picked from commit 109a6fd557)
2020-01-15 14:02:20 +01:00
Thomas Haller
072003c600 libnm: fix wrong assertion in nm_client_add_and_activate_connection2_finish()
Fixes: ce0e898fb4 ('libnm: refactor caching of D-Bus objects in NMClient')
(cherry picked from commit 51b39ceb33)
2020-01-15 12:32:24 +01:00
Benjamin Berg
00084d1ba8 libnm: fix interface and object path for P2P StartFind/StopFind calls
The change to use a GDBusConnection (7871105ff9) introduced a bug by
using the wrong hardcoded path and the wrong interface. Correct this
mistake again.

Fixes: 7871105ff9 ('libnm: implement nm_device_wifi_p2p_start_find()/nm_device_wifi_p2p_stop_find() by using GDBusConnection directly')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/399
(cherry picked from commit e8cc69c37e)
2020-01-15 12:03:02 +01:00
Thomas Haller
b0f99834ba initrd: merge branch 'lr/a-pair-of-ibft-fixes'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/393

(cherry picked from commit d60cb4d5de)
2020-01-14 16:45:41 +01:00
Thomas Haller
86b2858019 initrd/cmdline: minor style cleanups
(cherry picked from commit 9f95b797f1)
2020-01-14 16:45:41 +01:00
Lubomir Rintel
9fddb395d5 initrd/cmdline: obey rd.iscsi.ibft
Do process the connections from the iBFT block if the rd.iscsi.ibft or
rd.iscsi.ibft=1 argument is present.

This is supposed to fix what was originally reported by Kairui Song
<kasong@redhat.com> here: https://github.com/dracutdevs/dracut/pull/697

(cherry picked from commit 39e1e723de)
2020-01-14 16:45:41 +01:00
Lubomir Rintel
7ffac26a49 initrd/ibft-reader: don't set con.interface-name in iBFT connections
If an argument in form ip=eth0:ibft is specified, we'd first create a
wired connection with con.interface-name and then proceed completing it
from the iBFT block. At that point we also add the MAC address, so the
interface-name is no longer necessary..

Worse even, for VLAN connections, it results in an attempt to create
a VLAN with the same name as the parent wired device. Ooops.

Let's just drop it. MAC address is guarranteed to be there and does the
right thing for both plain wired devices as well as VLANs.

(cherry picked from commit 59ead70952)
2020-01-14 16:45:41 +01:00
Thomas Haller
4665bb9fc5 n-dhcp4: fix integer context in n_dhcp4_client_probe_transition_nak() on 32 bit
Fixes: 218782a9a3 ('n-dhcp4: restart the transaction after a NAK')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/339
(cherry picked from commit de818bf610)
2020-01-14 16:28:51 +01:00
Beniamino Galvani
8c2f8b3193 release: bump version to 1.22.5 (development) 2020-01-09 18:20:15 +01:00
Beniamino Galvani
76b6f2a6ba release: bump version to 1.22.4 2020-01-09 18:20:15 +01:00
Beniamino Galvani
c54291e8f7 release: update NEWS 2020-01-09 18:20:15 +01:00
Beniamino Galvani
78ecbe3c5d n-dhcp4: use C_CLAMP() macro instead of c_clamp()
The latter requires __auto_type which is not available in GCC versions
older than 4.9. Fix the following compile error on RHEL 7.8:

 CC       src/src_libNetworkManagerBase_la-NetworkManagerUtils.lo
 shared/n-dhcp4/src/n-dhcp4-c-probe.c: In function 'n_dhcp4_client_probe_transition_nak':
 shared/n-dhcp4/src/n-dhcp4-c-probe.c:1008:17: error: unknown type name '__auto_type'
                  probe->ns_nak_restart_delay = c_clamp(probe->ns_nak_restart_delay * 2,
                  ^
 shared/n-dhcp4/src/n-dhcp4-c-probe.c:1008:17: error: unknown type name '__auto_type'
 shared/n-dhcp4/src/n-dhcp4-c-probe.c:1008:17: error: unknown type name '__auto_type'

Fixes: 218782a9a3 ('n-dhcp4: restart the transaction after a NAK')
(cherry picked from commit 3a9b069c41)
2020-01-09 13:21:16 +01:00
Beniamino Galvani
9921415c6b dhcp: merge branch 'bg/nettools-fixes-pt2'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/387
(cherry picked from commit 7129e669c0)
2020-01-09 09:48:09 +01:00
Beniamino Galvani
92b382e2f8 dhcp: nettools: handle 'retracted' event as 'expired'
The 'retracted' event is emitted when the client receives a NAK in the
rebooting, requesting, renewing or rebinding state, while 'expired'
means that the client wasn't able to renew the lease before expiry.

In both cases the old lease is no longer valid and n-dhcp4 keep trying
to get a lease, so the two events should be handlded in the same way.

Note that the systemd client doesn't have a 'retracted' event and
considers all NAKs as 'expired' events.

(cherry picked from commit 2523000b36)
2020-01-09 09:47:57 +01:00
Beniamino Galvani
ae5b9343d2 n-dhcp4: restart the transaction after a NAK
It is not enough to set the INIT state after a NAK; a timeout
(ns_deferred) must be set so that it is added to the event fd. The
client retries immediately the first time, so that in the successful
case it gets an address quickly. To avoid flooding the network in case
of servers always replying with NAKs, next attempts are done with
intervals from 2 seconds to 5 minutes using exponential backoff. See
also systemd commit [1].

[1] 1d1a3e0afb

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/325
(cherry picked from commit 218782a9a3)
2020-01-09 09:47:56 +01:00
Beniamino Galvani
2e1d3ae572 n-dhcp4: allow calling listen() on already listening connection
When the client enters the INIT state, it calls listen() on the
connection connection to create the packet socket. However, if the
client is coming from the REBOOTING state after a NAK, the connection
is already in the listening state; do nothing in such case.

(cherry picked from commit 4bcdc3c1eb)
2020-01-09 09:47:54 +01:00
Thomas Haller
568c19f07d device/wifi: fix memleak parsing SSID arguments for "RequestScan"
Oddly enough, valgrind was not complaining about this leak...

Fixes: 87b2d783b6 ('core: accept 'ssids':aay option in RequestScan() dictionary parameter')
(cherry picked from commit 5ed1edc02a)
2020-01-08 12:16:11 +01:00
Antonio Cardace
6d58932875 platform/linux: add support for /31 prefixes on IPv4 point-to-point links
Previously NetworkManager would wrongly add a broadcast address for the
network prefix that would collide with the IP address of the host on
the other end of the point-to-point link thus exhausting the IP address
space of the /31 network and preventing communication between the two
nodes.

Configuring a /31 address before this commit:
	IP addr -> 10.0.0.0/31, broadcast addr -> 10.0.0.1

If 10.0.0.1 is configured as a broadcast address the communication
with host 10.0.0.1 will not be able to take place.

Configuring a /31 address after this commit:
	IP addr -> 10.0.0.0/31, no broadcast address

Thus 10.0.0.0/31 and 10.0.0.1/31 are able to correctly communicate.

See RFC-3021. https://tools.ietf.org/html/rfc3021

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/295

https://bugzilla.redhat.com/show_bug.cgi?id=1764986
(cherry picked from commit fa144b5ae9)
2020-01-07 17:15:25 +01:00
Andika Triwidada
0423c6a038 po: update Indonesian (id) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/379
2020-01-02 09:51:26 +01:00
Beniamino Galvani
202c556d94 release: bump version to 1.22.3 (development) 2019-12-24 15:53:38 +01:00
Beniamino Galvani
eacbbabd13 release: bump version to 1.22.2 2019-12-24 15:53:38 +01:00
Beniamino Galvani
f207472dfa release: update NEWS 2019-12-24 15:53:38 +01:00
Thomas Haller
0766d7bb0c core,libnm: merge branch 'th/capability-ovs-rh1785147'
https://bugzilla.redhat.com/show_bug.cgi?id=1785147

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/370

(cherry picked from commit 74b2d6cadd)
2019-12-24 14:45:52 +01:00
Thomas Haller
d7356546ea libnm: add nm_client_get_capabilities() to expose server Capabilities
I hesitated to add this to libnm, because it's hardly used.

However, we already fetch the property during GetManagedObjects(),
we we should make it accessible, instead of requiring the user to
make another D-Bus call.

(cherry picked from commit 21b008d0ff)
2019-12-24 14:37:46 +01:00
Thomas Haller
682ad94e4b libnm: handle boxed GType properties in nm_utils_g_param_spec_is_default()
(cherry picked from commit 453e56c6e9)
2019-12-24 14:37:46 +01:00
Thomas Haller
4b1053da91 core: add and indicate NM_CAPABILITY_OVS capability on D-Bus
https://bugzilla.redhat.com/show_bug.cgi?id=1785147
(cherry picked from commit 785da51d83)
2019-12-24 14:37:46 +01:00
Thomas Haller
0d21129701 version: add NM_DEPRECATED_IN_1_22_2/NM_AVAILABLE_IN_1_22_2 macros 2019-12-24 14:35:40 +01:00
Beniamino Galvani
295acd68a7 merge: branch 'bg/nettools-fixes'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/368
(cherry picked from commit b93fcddfdf)
2019-12-23 16:45:57 +01:00
Beniamino Galvani
46ad3aa4f3 dhcp: nettools: start from init-reboot phase when reusing address
If we know the address used previously, also tell the client to start
from the init-reboot phase, so that it will start with a DHCP request
instead of a discover.

(cherry picked from commit 6af6f70d81)
2019-12-23 16:45:44 +01:00
Beniamino Galvani
bee319bf94 dhcp: nettools: fix parsing of classless routes option
Fixes: 6adade6f21 ('dhcp: add nettools dhcp4 client')
(cherry picked from commit dd3114deb0)
2019-12-23 16:45:43 +01:00
Beniamino Galvani
09597c105e dhcp: test parsing of domain-search option
Add a test for the parsing of the the domain-search option.

(cherry picked from commit c9fbdf3cb0)
2019-12-23 16:45:41 +01:00
Beniamino Galvani
5586a07f2f n-dhcp4: handle invalid return codes gracefully
Instead of terminating the program when the dispatch function returns
an invalid return code, log an error message and convert the error
code to a valid, generic one.

https://bugs.archlinux.org/task/64880
(cherry picked from commit 36f8822c9b)
2019-12-23 16:45:40 +01:00
Beniamino Galvani
6017d78734 n-dhcp4: use packet socket in rebinding state
After t1, the client tries to renew the lease by contacting via the
udp socket the server specified in the server-id option. If this
fails, after t2 it tries to contact any server using broadcast. For
this to work, the packet socket must be used.

(cherry picked from commit f860e929c0)
2019-12-23 16:45:39 +01:00
Beniamino Galvani
965219a4cd n-dhcp4: support init-reboot state
Currently the client always starts from the INIT state (i.e. sending a
discover message). If a requested-ip was specified by the caller, it
is added as an option in the discover.

It was reported that some DHCP servers don't respond to discover
messages with the requested-ip option set [1][2].

The RFC allows to skip the discover by entering the INIT-REBOOT state
and starting directly with a broadcast request message containing the
requested IP address. Implement that.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1781856
[2] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/310

(cherry picked from commit af03b77980)
2019-12-23 16:45:37 +01:00
Beniamino Galvani
0a428153f8 n-dhcp4: fix logging broadcast messages
Log the broadcast address instead of the server IP as destination when
needed.

(cherry picked from commit 30798e0af4)
2019-12-23 16:45:36 +01:00
Piotr Drąg
cf904cd4a2 po: update Polish (pl) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/372
2019-12-22 08:08:56 +01:00
Thomas Haller
cb49f35bd1 libnm: use designated initalizers for NMSriovVF and VFVlan
(cherry picked from commit d65aabd518)
2019-12-20 14:52:08 +01:00
Thomas Haller
49376697c6 libnm: fix type annotation for nm_sriov_vf_get_vlan_ids()
Otherwise, this function cannot really be used via generated bindings.
Also, it's the only way to actually retrieve the set vlan-ids, without
it, you wouldn't know which ones are set.

Fixes: a9b4532fa7 ('libnm-core: add SR-IOV setting')
(cherry picked from commit c4a728217d)
2019-12-20 14:52:04 +01:00
Thomas Haller
7efcf00059 libnm: emit property changed signal when setting NM_CLIENT_DBUS_CONNECTION
(cherry picked from commit 3ae97cc543)
2019-12-19 15:01:19 +01:00
Beniamino Galvani
fc41827874 dhcp: nettools: check return value of g_file_set_contents()
Found by covscan:

 NetworkManager-1.22.0/src/dhcp/nm-dhcp-nettools.c:945: check_return:
 Calling "g_file_set_contents" without checking return value (as is
 done elsewhere 16 out of 20 times).

Fixes: 9f89516928 ('dhcp: nettools: read/write lease files')
(cherry picked from commit cfc418f887)
2019-12-18 10:04:36 +01:00
Beniamino Galvani
9e5bb9d62f shared: add missing va_end() to _nm_dbus_error_is()
Found by covscan:

   NetworkManager-1.22.0/shared/nm-glib-aux/nm-dbus-aux.c:361:
   missing_va_end: va_end was not called for "ap".

Fixes: ce36494c0a ('shared: add nm_dbus_error_is() helper')
(cherry picked from commit 0de4fd6ebc)
2019-12-18 10:04:34 +01:00
Beniamino Galvani
ea22135384 dhcp: nettools: fix parsing of search domains option
'first' was never modified and so the dot was never added.

Fixes: 6adade6f21 ('dhcp: add nettools dhcp4 client')

https://bugzilla.redhat.com/show_bug.cgi?id=1783981
(cherry picked from commit 9aa00a8a14)
2019-12-17 14:35:05 +01:00
Thomas Haller
e4e6104c0c release: bump version to 1.22.1 (development) 2019-12-17 09:24:20 +01:00
Thomas Haller
7fe734f8bc release: bump version to 1.22.0 2019-12-17 09:24:16 +01:00
Thomas Haller
eae4ef7982 NEWS: update 2019-12-17 09:24:09 +01:00
Thomas Haller
f343f6f31d libnm/secret-agent: remove unused variable
Fixes: f0d3243f2b ('libnm/secret-agent: fix race registering secret agent')
(cherry picked from commit 5f9bcc91c7)
2019-12-17 09:00:00 +01:00
Thomas Haller
bfd41a34c0 libnm: merge branch 'th/secret-agent-register-race'
https://bugzilla.redhat.com/show_bug.cgi?id=1781084

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/364

(cherry picked from commit 85042e7244)
2019-12-16 18:55:26 +01:00
Thomas Haller
793e390c22 libnm/secret-agent: fix reseting timeout when registration completes
Fixes: f0d3243f2b ('libnm/secret-agent: fix race registering secret agent')
(cherry picked from commit 1f9dabcb73)
2019-12-16 18:54:58 +01:00
Thomas Haller
494cbe144d libnm/secret-agent: fix race registering secret agent
When NetworkManager starts, NMSecretAgentOld gets a name-owner changed
signal and registers right away.

Especially since commit ce0e898fb4 ('libnm: refactor caching of D-Bus
objects in NMClient') this hits a race where NetworkManager does not yet
export the org.freedesktop.NetworkManager.AgentManager interface and
the registration fails:

   GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.NetworkManager.AgentManager” on object at path /org/freedesktop/NetworkManager/AgentManager

Previously, when NMClient recevied a name-owner changed, that would
block the main loop long enough to avoid the race. Note that NMClient
has nothing to do with NMSecretAgentOld, however in practice all
applications that use NMSecretAgentOld also use NMClient.

While we should fix the race server-side, we also need to work around it
in the client. Retry.

Also, make the async request actually cancellable and actually honor the passed
GCancellable.

Check output:

    $ LIBNM_CLIENT_DEBUG=trace ./clients/cli/nmcli agent secret |& grep secret-agent
    libnm-dbus: <trace> [21399.04862] secret-agent[2f2af4ee102d7570]: create new instance
    libnm-dbus: <trace> [21399.04863] secret-agent[2f2af4ee102d7570]: init-sync
    libnm-dbus: <trace> [21404.08147] secret-agent[2f2af4ee102d7570]: name owner changed: (null)
    libnm-dbus: <trace> [21404.09085] secret-agent[2f2af4ee102d7570]: name owner changed: ":1.2504"
    libnm-dbus: <trace> [21404.09085] secret-agent[2f2af4ee102d7570]: register: starting asynchronous registration...
    libnm-dbus: <trace> [21404.09178] secret-agent[2f2af4ee102d7570]: register: registration failed with error "GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.NetworkManager.AgentManager” on object at path /org/freedesktop/NetworkManager/AgentManager". Retry in 0 msec...
    libnm-dbus: <trace> [21404.09178] secret-agent[2f2af4ee102d7570]: register: retry registration...
    libnm-dbus: <trace> [21404.09195] secret-agent[2f2af4ee102d7570]: register: registration failed with error "GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.NetworkManager.AgentManager” on object at path /org/freedesktop/NetworkManager/AgentManager". Retry in 4 msec...
    libnm-dbus: <trace> [21404.09236] secret-agent[2f2af4ee102d7570]: register: retry registration...
    [...]
    libnm-dbus: <trace> [21405.01782] secret-agent[2f2af4ee102d7570]: register: registration failed with error "GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.NetworkManager.AgentManager” on object at path /org/freedesktop/NetworkManager/AgentManager". Retry in 128 msec...
    libnm-dbus: <trace> [21405.03063] secret-agent[2f2af4ee102d7570]: register: retry registration...
    libnm-dbus: <trace> [21405.03068] secret-agent[2f2af4ee102d7570]: register: registration failed with error "GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.NetworkManager.AgentManager” on object at path /org/freedesktop/NetworkManager/AgentManager". Retry in 128 msec...
    libnm-dbus: <trace> [21405.04354] secret-agent[2f2af4ee102d7570]: register: retry registration...
    libnm-dbus: <trace> [21406.01097] secret-agent[2f2af4ee102d7570]: register: registration succeeded

(cherry picked from commit f0d3243f2b)
2019-12-16 18:54:33 +01:00