Commit graph

24675 commits

Author SHA1 Message Date
Thomas Haller
501893c4bc man: document connectivity.enabled option in NetworkManager.conf manual
(cherry picked from commit 655e1aa97f)
2020-02-17 14:34:59 +01:00
Thomas Haller
99caa0c28f doc: clarify default values for ipv4.mdns and ipv4.llmnr settings
LLMNR and mDNS settings can have their global default value configured
in "NetworkManager.conf".

Global default values should work the way that all regular values of the property
can be configured explicitly in the connection profile. The special "default" value
only indicates to allow lookup of the global default, but it should not have a
meaning of its own.

Note that if mDNS/LLMNR settings are left unspecified, we will set the
argument to SetLinkMulticastDNS() and SetLinkLLMNR() functions to "",
which means that systemd-resolved decides on a default. Also, depending
on the DNS plugin, the default value differs. This is all fine however.
In this case, the ultimate default value depends on other things (like
the DNS plugin), but each possible value is in fact explicitly
configurable. We also do that for "ipv6.ip6-privacy".

Anyway, cleanup the documentation a bit and try to better explain what
the default is.

(cherry picked from commit 3d07708f59)
2020-02-17 13:47:25 +01:00
Beniamino Galvani
3a43575539 libnm-core: fix documentation of dns-priority property
Clarify that VPNs are considered first in case of same priority, and
also that it's the *best* default route that matters.

(cherry picked from commit bf4b53d453)
2020-02-12 11:10:20 +01:00
Beniamino Galvani
2be04221de dhcp: merge branch 'bg/nettools-request-free'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/409
(cherry picked from commit 2e53fd4561)
2020-02-11 09:28:39 +01:00
Beniamino Galvani
9a1bbef1b4 dhcp: nettools: move to failed state if event dispatch fails
(cherry picked from commit 45521b1b38)
2020-02-11 09:28:27 +01:00
Beniamino Galvani
14aadaadf2 n-dhcp4: avoid double free of NDhcp4Outgoing
n_dhcp4_c_connection_start_request() should take ownership of the
request only on success. On failure the request is freed by the
caller.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/355
(cherry picked from commit 43016d6ebd)
2020-02-11 09:28:26 +01:00
Beniamino Galvani
0bd30d8da0 team: merge branch 'bg/team-race-rh1798947'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/410
https://bugzilla.redhat.com/show_bug.cgi?id=1798947
(cherry picked from commit a119dac998)
2020-02-11 09:21:46 +01:00
Beniamino Galvani
a0c209b653 team: ignore bus name appearance when killing teamd
If we are currently killing teamd, we are not interested in knowing
when it becomes ready.

(cherry picked from commit 554e9be5b0)
2020-02-11 09:21:35 +01:00
Beniamino Galvani
77635adb50 team: ignore bus name appearance if we can't determine process id
If the GetConnectionUnixProcessID() call fails, the process that
registered on the bus has died and we should ignore the name
appearance event.

(cherry picked from commit e94d76382c)
2020-02-11 09:21:33 +01:00
Thomas Haller
dbd7083881 libnm: merge branch 'th/libnm-active-connection-delay-ready'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/405

(cherry picked from commit 2d3a1af5d6)
2020-02-10 19:04:46 +01:00
Thomas Haller
60877600c5 libnm: hide NMActiveConnection until NMRemoteConnection is ready
Generally, libnm's NMClient cache only wants to expose NMObjects that
are fully initalized. Most objects don't require anything special,
except NMRemoteConnection which waits for the GetSettings() call to complete.

NMObjects reference each other. For example, NMActiveConnection
references NMDevice and NMRemoteConnection. There is a desire that an
object is only ready, if the objects that it references are ready too.
In practice that is not done, because usually every objects references
other objects, that means all objects would be declared as non-ready
as long as any of them is still initializing. That does not seem
desirable. Instead, most objects (except NMRemoteConnection and now
NMActiveConnection) are considered ready and visible, once their first
notification completes. In case the objects reference any object that is
not yet ready, the references is NULL (but the source object is visible
already). This is also done this way, to cope with cycles where
objects reference each other. In practice, such cycles should not be
exposed by NetworkManager. However, libnm should be robust against that.

This has the undesired effect that when you call AddAndActivate(), then
the NMActiveConnection might already be visible while its
NMRemoteConnection isn't. That means, ac.get_connection() will
initially return NULL, until the remote connection becomes ready.
Also add a special handling that NMActiveConnection waits for their
NMRemoteConnection to be ready, before being ready itself.

Fixes: ce0e898fb4 ('libnm: refactor caching of D-Bus objects in NMClient')
(cherry picked from commit 425412a363)
2020-02-10 19:04:46 +01:00
Thomas Haller
ef09aac69b libnm: minor cleanup of libnm trace logging
(cherry picked from commit 6b745e0725)
2020-02-10 19:04:46 +01:00
Beniamino Galvani
ff7545704e n-dhcp4: fix initialization of the 'secs' DHCP header field
Due to wrong type conversions, the value was always zero.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/341
(cherry picked from commit df6129d93a)
2020-02-10 16:41:07 +01:00
Thomas Haller
68fa338e34 contrib/REQUIRED_PACKAGES: fix script to work without GNU which installed
`which` is convenient, but not installed in Fedora container images.
Fix detection of whether to use `dnf` or `yum`.

(cherry picked from commit 5cc8ca4038)
2020-02-10 13:35:49 +01:00
Thomas Haller
27664ff425 contrib/REQUIRED_PACKAGES: ignore for non-existing packages "dbus-python", "pygobject3-base" on Fedora 32
These packages no longer exist on Fedora 32 and dnf fails due to
that. Ignore such errors.

(cherry picked from commit bdd45e6afa)
2020-02-10 13:35:48 +01:00
Thomas Haller
3632a0162a platform: merge branch 'th/platform-ethtool-gcc10-warnings'
(cherry picked from commit e658938ac5)
2020-02-10 13:34:33 +01:00
Thomas Haller
c1417087c8 platform: fix GCC warning about zero-length array in nmp_utils_ethtool_get_permanent_address()
GCC 10 complains about accesses to elements of zero-length arrays that
overlap other members of the same object:

  src/platform/nm-platform-utils.c: In function ‘nmp_utils_ethtool_get_permanent_address’:
  src/platform/nm-platform-utils.c:854:29: error: array subscript 0 is outside the bounds of an interior zero-length array ‘__u8[0]’ {aka ‘unsigned char[0]’} [-Werror=zero-length-bounds]
    854 |  if (NM_IN_SET (edata.e.data[0], 0, 0xFF)) {
  ./shared/nm-glib-aux/nm-macros-internal.h:731:20: note: in definition of macro ‘_NM_IN_SET_EVAL_N’

Fix this warning.

(cherry picked from commit d892a35395)
2020-02-10 13:34:33 +01:00
Thomas Haller
286bb2f029 platform: fix GCC warning about zero-length array in ethtool_get_stringset()
GCC 10 complains about accesses to elements of zero-length arrays that
overlap other members of the same object:

 src/platform/nm-platform-utils.c: In function ‘ethtool_get_stringset’:
 src/platform/nm-platform-utils.c:355:27: error: array subscript 0 is outside the bounds of an interior zero-length array ‘__u32[0]’ {aka ‘unsigned int[0]’} [-Werror=zero-length-bounds]
   355 |  len = sset_info.info.data[0];
       |        ~~~~~~~~~~~~~~~~~~~^~~
 In file included from src/platform/nm-platform-utils.c:12:
 /usr/include/linux/ethtool.h:647:8: note: while referencing ‘data’
   647 |  __u32 data[0];
       |        ^~~~

Fix this warning.

(cherry picked from commit 16e1e44c5e)
2020-02-10 13:34:33 +01:00
Thomas Haller
273fcf51bd Revert "platform: fix GCC warning about zero-lenght array (2)"
This reverts commit 5076fc0ca0.

(cherry picked from commit 0931c4f2ea)
2020-02-10 13:34:33 +01:00
Thomas Haller
f140e21689 Revert "platform: fix GCC warning about zero-lenght array (1)"
I think this solution is not right, because "char buf" is not guaranteed
to have the correct alignment. Revert, and solve it differently.

This reverts commit 6345a66153.

(cherry picked from commit 1fd7e45139)
2020-02-10 13:34:33 +01:00
Beniamino Galvani
a1b0edd24b ovs: wait that link disappears before continuing with deactivation
When we deactivate a virtual device, we usually schedule the deletion
of the link in an idle handler. That action will be executed at a
later time when the device is already in the disconnected state.

Similarly, for ovs interfaces we send the deletion command to the
ovsdb and then proceed to the disconnected state.

However, in the first case there is the guarantee that the link will
be deleted at some point, while for ovs interfaces it may happen that
ovs decides to reuse the same link if there is an addition
queued. Since reusing the same link confuses NM, let's implement
deactivate_async() for ovs-interfaces and wait that the link actually
goes away before proceeding.

https://bugzilla.redhat.com/show_bug.cgi?id=1782701
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/402
(cherry picked from commit 623a1e1f99)
2020-02-05 22:32:52 +01:00
Beniamino Galvani
047ab7f4af shared: redefine G_SOURCE_FUNC
G_SOURCE_FUNC has attribute GLIB_AVAILABLE_MACRO_IN_2_58, which means
that the compiler will emit a warning when GLIB_VERSION_MAX_ALLOWED <
GLIB_VERSION_2_58. We currently define GLIB_VERSION_MAX_ALLOWED as
GLIB_VERSION_2_40. Redefine the macro to fix the following build error
when using glib >= 2.63.5 (the version in which the attribute was
added):

  CC       shared/nm-glib-aux/libnm_glib_aux_la-nm-shared-utils.lo
 shared/nm-glib-aux/nm-shared-utils.c: In function ‘nm_g_unix_fd_source_new’:
 shared/nm-glib-aux/nm-shared-utils.c:3679:13: error: Not available before  [-Werror]
  3679 |  g_source_set_callback (source, G_SOURCE_FUNC (source_func), user_data, destroy_notify);

Fixes: 9c5741ccd2 ('shared/nm-glib: add compat implementation for G_SOURCE_FUNC()')
(cherry picked from commit 7f801685b2)
2020-02-05 14:33:11 +01:00
Beniamino Galvani
8d900b5bec merge: branch 'bg/gcc10'
Fix build using GCC 10.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/406
(cherry picked from commit 9a971849b5)
2020-02-03 15:32:55 +01:00
Beniamino Galvani
972b0db460 n-dhcp4: fix uninitialized variable
Properly initialize 'overload' when the space in the file section
ends.

 shared/n-dhcp4/src/n-dhcp4-outgoing.c: In function ‘n_dhcp4_outgoing_append’:
 shared/n-dhcp4/src/n-dhcp4-outgoing.c:198:17: error: ‘overload’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

(cherry picked from commit b2620e798a)
2020-02-03 15:32:03 +01:00
Beniamino Galvani
1bb93b7289 clients: add missing 'extern' keyword
(cherry picked from commit 482e5f04ea)
2020-02-03 15:31:31 +01:00
Beniamino Galvani
c02b0181cf platform: fix GCC warning about zero-lenght array (2)
GCC 10 complains about accesses to elements of zero-length arrays that
overlap other members of the same object:

  src/platform/nm-platform-utils.c: In function ‘nmp_utils_ethtool_get_permanent_address’:
  src/platform/nm-platform-utils.c:854:29: error: array subscript 0 is outside the bounds of an interior zero-length array ‘__u8[0]’ {aka ‘unsigned char[0]’} [-Werror=zero-length-bounds]
    854 |  if (NM_IN_SET (edata.e.data[0], 0, 0xFF)) {
  ./shared/nm-glib-aux/nm-macros-internal.h:731:20: note: in definition of macro ‘_NM_IN_SET_EVAL_N’

Fix this warning.

(cherry picked from commit 5076fc0ca0)
2020-02-03 15:31:30 +01:00
Beniamino Galvani
a7c1b324fd platform: fix GCC warning about zero-lenght array (1)
GCC 10 complains about accesses to elements of zero-length arrays that
overlap other members of the same object:

 src/platform/nm-platform-utils.c: In function ‘ethtool_get_stringset’:
 src/platform/nm-platform-utils.c:355:27: error: array subscript 0 is outside the bounds of an interior zero-length array ‘__u32[0]’ {aka ‘unsigned int[0]’} [-Werror=zero-length-bounds]
   355 |  len = sset_info.info.data[0];
       |        ~~~~~~~~~~~~~~~~~~~^~~
 In file included from src/platform/nm-platform-utils.c:12:
 /usr/include/linux/ethtool.h:647:8: note: while referencing ‘data’
   647 |  __u32 data[0];
       |        ^~~~

Fix this warning.

(cherry picked from commit 6345a66153)
2020-02-03 15:31:28 +01:00
Beniamino Galvani
311872ddca build: use -fcommon when building libnm-core
Building with GCC 10 gives the following error:

 multiple definition of_nm_jansson_json_object_iter_key';
 libnm/.libs/liblibnm.a(libnm_core_la-nm-json.o):/builddir/build/BUILD/NetworkManager-1.23.1/libnm-core/nm-json.c:24: first defined here /usr/bin/ld:
 libnm/.libs/liblibnm.a(libnm_core_la-nm-team-utils.o):/usr/include/jansson.h:202: multiple definition of _nm_jansson_json_object_iter';

This happens because GCC 10 defaults to -fno-common and so multiple
definitions of the same global variable are not merged together.

_nm_jansson_json_* symbols are defined in nm-json.c as void pointers
and, due to the following macros in nm-json.h:

 #define json_object_iter_next   (*_nm_jansson_json_object_iter_next)
 ...

the function declaration in jansson.h:

 void *json_object_iter_next(json_t *object, void *iter);

becomes a global variable as well:

 void *(*_nm_jansson_json_object_iter_next)(json_t *object, void *iter);

So, the symbol is present in nm-json.o and all other object files that
include nm-json.h, and -fcommon is required. Without it, it would be
necessary to define the symbols only in one place (for example,
nm-json.c), but then static inline functions from the jannson.h header
would still refer to the original (missing) jansson functions.

For the moment, just use -fcommon.

(cherry picked from commit d2d6a68697)
2020-02-03 15:31:19 +01:00
Beniamino Galvani
7ba2040caa all: remove wrong CURL option initialization
curl_multi_setopt() accepts CURLMOPT_* options, not CURLOPT_*
ones. Found by GCC 10:

clients/cloud-setup/nm-http-client.c:700:38: error: implicit conversion from ‘enum <anonymous>’ to ‘CURLMoption’ [-Werror=enum-conversion]
  700 |    curl_multi_setopt (priv->mhandle, CURLOPT_VERBOSE, 1);

Fixes: 69f048bf0c ('cloud-setup: add tool for automatic IP configuration in cloud')
(cherry picked from commit c11ac34f4c)
2020-02-03 15:31:18 +01:00
Antonio Cardace
4e756b1f44 release: bump version to 1.22.7 (development) 2020-01-31 10:46:12 +01:00
Antonio Cardace
5966766b65 release: bump version to 1.22.6 2020-01-31 10:46:12 +01:00
Antonio Cardace
81913280ef release: update NEWS 2020-01-31 10:46:07 +01:00
Beniamino Galvani
dff2ca0a18 dhcp: merge branch 'bg/dhcp-timeout-rh1791378'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/404/diffs
https://bugzilla.redhat.com/show_bug.cgi?id=1791378
(cherry picked from commit fc7af10cca)
2020-01-30 15:43:46 +01:00
Beniamino Galvani
d2354387d9 ndisc: remove upper bound for IPv6 autoconfiguration timeout
As it is possible to configure an arbitrarily large DHCP timeout, it
should be possible to also set a large timeout for IPv6
autoconfiguration. Currently the timeout can only be changed via
sysctl. Leave the lower bound because the default kernel sysctl value
is 3 * 4 = 12 seconds and so without the lower limit the default
timeout would change from 30 to 12 seconds for every user, which seems
a big change and could possibly break users' setup.

https://bugzilla.redhat.com/show_bug.cgi?id=1795957
(cherry picked from commit d8e1f4c8ef)
2020-01-30 15:43:18 +01:00
Beniamino Galvani
6c1daa4fa9 device: accept new leases in NM_DEVICE_IP_STATE_DONE
If the current lease expires, we start the grace period in which the
clients starts again from the INIT DHCP state (i.e. sending DISCOVER
messages). If it is able to obtain a new lease, it must be accepted or
otherwise the client will not renew it.

(cherry picked from commit df75c21b4d)
2020-01-30 15:43:16 +01:00
Beniamino Galvani
5182ca8782 dhcp: introduce EXTENDED state for renewals
Currently the DHCP client reports the BOUND state not only when the
lease is obtained initially but also when it is renewed. Having a
different state for the renewal will be used by NMDevice in the next
patch to determine whether the lease needs to be accept()ed or not.

(cherry picked from commit a4ddb56923)
2020-01-30 15:42:58 +01:00
Beniamino Galvani
a01198863a n-dhcp4: move back to INIT after lease expires
Move back to INIT state after the lease expires, as per section 4.4.5
of RFC 2131. Previously the client just moved to EXPIRED, closed the
connection and cleared the probe, leaving to the caller of the library
the choice to create a new client instance and to start from
scratch. However, it seems more useful that the client, once
initialized, always tries to get a lease even after an expiration.

(cherry picked from commit 182a8021f3)
2020-01-30 15:42:57 +01:00
Beniamino Galvani
4505c25270 dhcp: derive the grace period duration from the timeout property
Currently the duration of the DHCP grace period (in which we try to
acquire a new lease after expiration) is hardcoded to 480
seconds. That value seems arbitrary and too long for the default
configuration. Since we already have a property that allows the user
to configure how long NM should try to get the lease initially, it
makes sense to use it also for retries after lease expirations.

In particular, setting the ipvx.dhcp-timeout to a high value extends
also the grace period to a very long time, potentially forever.

(cherry picked from commit aee78ca788)
2020-01-30 15:42:56 +01:00
Beniamino Galvani
4b32506f5e device: change return type of get_dhcp_timeout()
(cherry picked from commit d0caad7a8d)
2020-01-30 15:42:55 +01:00
Beniamino Galvani
66d90dc382 device: move code around
(cherry picked from commit 70f1ee0ffb)
2020-01-30 15:42:54 +01:00
Beniamino Galvani
2c0af106a4 po: RHEL 8.2 translations - fr,ja,zh-CN
(cherry picked from commit e3a3e8bd51)
2020-01-30 14:07:35 +01:00
Thomas Haller
26d6ac5385 supplicant: fix memory corruption with wrong argument to NM_SUPPLICANT_INTERFACE_GROUP_FORMATION_FAILURE signal
The signal is unused (and should be removed).

Still, the parameter passed to g_signal_emit() is a C string, not a
GVariant. I think as there are no subscribers, glib wouldn't actually
do anything with the arguments. Though, I am not sure whether glib still
tries to initialize a GValue with a GVariant type, leading to a crash.

Fixes: f05b7a78c9 ('supplicant: Track P2P Group information, creation and destruction')
(cherry picked from commit c106008091)
2020-01-30 11:44:10 +01:00
Beniamino Galvani
fa61147fc0 merge: branch 'bg/virt-dev-check-master'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/403
https://bugzilla.redhat.com/show_bug.cgi?id=1795919
(cherry picked from commit 4bdf8c31d3)
2020-01-29 16:47:49 +01:00
Beniamino Galvani
82f1129005 manager: check for master existence before realizing the device
If we find out that no compatible master connection exists, we
shouldn't realize the slave in the first place.

(cherry picked from commit ab57b575a0)
2020-01-29 16:47:36 +01:00
Beniamino Galvani
51d7941b0e manager: skip activation of a virtual device if master is missing
Don't realize a virtual device if the master is missing because in
such case the autoactivation can't start and a stale link will be
created.

(cherry picked from commit 336bfcabc4)
2020-01-29 16:47:34 +01:00
Antonio Cardace
11c989bb04 nm-device: add new pending action to keep the device busy when in between states
Add a 'in-state-change' pending action to be sure the device always has a
pending when transitioning between states (this prevents callbacks to mark
startup as complete while running _set_state_full()).

This is needed as during the 'failed'->'disconnected' the pending action 'activation-*'
for the device is removed resulting in an empty pending_actions list which then
triggers 'check_if_startup_complete()' that will find no pending action and mark
startup as complete even if the device could have been activated with another connection.

https://bugzilla.redhat.com/show_bug.cgi?id=1759956
(cherry picked from commit f583aec806)
2020-01-29 12:02:52 +01:00
Will Dietz
00feb26d70 build/meson: fix missing slash when detecting resolvconf/netconfig binaries
Fix detection for /usr/local/sbin/{resolvconf,netconfig}.
(and no longer automatically use "/usr/local/sbinnetconfig" if present)

Fixes: 5a0cef2f36 ('build: meson: uniform handling of rc managers')

[thaller@redhat.com: commit message adjusted]

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/349
(cherry picked from commit 2b17f246f0)
2020-01-28 16:12:17 +01:00
Beniamino Galvani
df4859bb31 dhcp: merge branch 'bg/nettools-dup-options-issue324'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/401
(cherry picked from commit b9820162f2)
2020-01-25 11:44:07 +01:00
Beniamino Galvani
6f66ff845f dhcp: don't add server-id option to the parameter request list
The option is mandatory in the replies from server and so we don't
need to ask for it. dhclient doesn't do it either. But especially, it
seems that requesting the option causes some broken server
implementations to send duplicate instances of the option.

So, remove the option from the parameter request list of the internal
nettools and systemd DHCP implementation.

(cherry picked from commit 541db78259)
2020-01-25 11:43:53 +01:00
Beniamino Galvani
cafaa63ec6 n-dhcp4: accept options that are longer than requested
If the server sends a packet with multiple instances of the same
option, they are concatenated during n_dhcp4_incoming_linearize() and
evaluated as a single option as per section 7 of RFC 3396.

However, there are broken server implementations that send
self-contained options in multiple copies. They are reassembled to
form a single instance by the nettools client, which then fails to
parse them because they have a length greater than the expected one.

This problem can be reproduced by starting a server with:

  dnsmasq --bind-interfaces --interface veth1 -d
          --dhcp-range=172.25.1.100,172.25.1.200,1m
	  --dhcp-option=54,172.25.1.1

In this way dnsmasq sends a duplicate option 54 (server-id) when the
client requests it in the 'parameter request list' option, as
dhcp=systemd and dhcp=nettools currently do.

While this is a violation of the RFC by the server, both isc-dhcp and
systemd-networkd client implementations have mechanisms to deal with
this situation. dhclient simply takes the first bytes of the
aggregated option. systemd-networkd doesn't follow RFC 3396 and
doesn't aggregate multiple options; it considers only the last
occurrence of each option.

Change the parsing code to accept options that are longer than
necessary.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/324
(cherry picked from commit 1cbf9d22a5)
2020-01-25 11:43:52 +01:00