Commit graph

26144 commits

Author SHA1 Message Date
Thomas Haller
12e4a4a5df
modem: suppress deprecated warning from libmm for MM_MODEM_CAPABILITY_LTE_ADVANCED
On Ubuntu 20.10, we build against ModemManager 1.14.0 and get a compiler warning:

  ../src/devices/wwan/nm-modem-broadband.c: In function 'try_create_connect_properties':
  ../src/devices/wwan/nm-modem-broadband.c:492:2: error: 'MMModemCapabilityDeprecated' is deprecated [-Werror=deprecated-declarations]
    492 |  if (MODEM_CAPS_3GPP (ctx->caps)) {
        |  ^~

Suppress it.

An alternative would be to drop the flag entirely. It seems the flag
was never used (and never will be used). But if that's true, there is
little harm done checking it. If it's not true, we better keep checking
for older versions.

0cd76bf1c4
(cherry picked from commit 03dc759026)
2020-06-30 18:01:59 +02:00
Thomas Haller
e249262506
platform/tests: avoid test failures accepting route added signals
/route/ip6: NMPlatformSignalAssert: ../src/platform/tests/test-route.c:331, test_ip6_route(): failure to accept signal [0,2] times: ip6-route-changed-added ifindex 0 (3 times received)

(cherry picked from commit 3d542b55ed)
2020-06-30 18:01:58 +02:00
Thomas Haller
a32e0d7ce3
gitlab-ci: enable python black check in gitlab-ci
(cherry picked from commit 8c3ee4e857)
2020-06-29 09:26:43 +02:00
Thomas Haller
0ba2af495e
gitlab-ci: run checkpatch test against fedora:32 target
(cherry picked from commit 70f3ad6785)
2020-06-29 09:26:43 +02:00
Thomas Haller
a5d293c367
build: for signing use key from git's user.signingkey
(cherry picked from commit 53bb23b403)
2020-06-29 09:25:34 +02:00
Thomas Haller
326e0e8252
release: cleanup temporary release-branch and avoid prompt for ftpadmin install
(cherry picked from commit 0748bd989d)
2020-06-28 19:17:31 +02:00
Thomas Haller
29019eeb45
release: bump version to 1.25.91 (1.26-rc2) (development) 2020-06-28 19:03:43 +02:00
Thomas Haller
783e4086a9
release: fix "rc" release build and add option to suppress check for local branches
(cherry picked from commit 99f834842a)
2020-06-28 19:03:00 +02:00
Beniamino Galvani
2a9f5f25b2 NEWS: update 2020-06-28 18:37:09 +02:00
Thomas Haller
d4adb65fd6
release: fix RC_VERSION for release script
The release candidate -rc1 has version "1.y.90", -rc2 has "1.y.91", and so
on. Fix the script.

(cherry picked from commit 7f93fd8e7b)
2020-06-28 18:36:21 +02:00
Thomas Haller
a9247f6dd9
release: fix release script for "rc"
(cherry picked from commit 8e9e6fd024)
2020-06-28 18:08:25 +02:00
Beniamino Galvani
c3e8ec6717 platform: merge branch 'ac/local_route'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/526
(cherry picked from commit 3e21357888)
2020-06-28 17:47:54 +02:00
Antonio Cardace
5247e2f8f5 setting-ip-config: validate route attributes in verify()
It's better to verify these route attributes so that the user can be
notified early if something is not supported or invalid.

The downside is that some incorrect profiles (with invalid route attributes)
that previously would work since this commit will not anymore as
the incorrect bits don't get ignored but rejected instead.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/407
https://bugzilla.redhat.com/show_bug.cgi?id=1821787
(cherry picked from commit 7781f78435)
2020-06-28 17:47:35 +02:00
Antonio Cardace
c4528f221b platform: add support for local routes
Also update unit tests.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/407
https://bugzilla.redhat.com/show_bug.cgi?id=1821787
(cherry picked from commit 5d0d13f570)
2020-06-28 17:47:27 +02:00
Antonio Cardace
c7d61a53e5
NEWS: update
(cherry picked from commit cfe349b971)
2020-06-28 17:41:07 +02:00
Antonio Cardace
7018f20293
nmcs-gcp: merge branch 'ac/gcp_cloud_support'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/546
https://bugzilla.redhat.com/show_bug.cgi?id=1821787

(cherry picked from commit ccbae2422e)
2020-06-28 17:40:22 +02:00
Antonio Cardace
10abdedb1a
nmcs-gcp: add support for Google Cloud Platform load balancers
This add a provider implementation for GCP that when detected fetches
the ip addresses of configured internal load balancers.

Once this information is fetched from the metadata server it instructs
NetworkManager to add local routes for each found forwarded-ip.

https://bugzilla.redhat.com/show_bug.cgi?id=1821787
(cherry picked from commit a2b699f40f)
2020-06-28 17:40:22 +02:00
Antonio Cardace
8581038450
nmcs-main: support adding additional routes
This allows a provider to only add additional routes to the applied profile

https://bugzilla.redhat.com/show_bug.cgi?id=1821787
(cherry picked from commit 75a84677ca)
2020-06-28 17:40:21 +02:00
Antonio Cardace
23c11af7f5
nmcs-http: add param to GET API to set custom HTTP headers
https://bugzilla.redhat.com/show_bug.cgi?id=1821787
(cherry picked from commit 053bce438b)
2020-06-28 17:40:21 +02:00
Antonio Cardace
c8965f906e
main: remove unused argument
(cherry picked from commit 1095cef9a1)
2020-06-28 17:40:21 +02:00
Antonio Cardace
1f27c36288
nmcs: fix indentation
(cherry picked from commit d46da9072a)
2020-06-28 17:40:21 +02:00
Antonio Cardace
0d22e6b2fe
nm-shared-utils: add util to parse out lines from a string
https://bugzilla.redhat.com/show_bug.cgi?id=1821787
(cherry picked from commit aa5959a595)
2020-06-28 17:40:20 +02:00
Antonio Cardace
20a6fa7d1b
nmcs: add error message when a HTTP request times out
https://bugzilla.redhat.com/show_bug.cgi?id=1821787
(cherry picked from commit 3bd30f6064)
2020-06-28 17:40:20 +02:00
Antonio Cardace
b7d53f0d3a
nmcs-http: remove the timeout once expired
libcurl's documentation for CURLMOPT_TIMERFUNCTION requires the
application to install a non-repeating timer.

https://curl.haxx.se/libcurl/c/CURLMOPT_TIMERFUNCTION.html

So let's remove the GSource once expired.

Fixes: 69f048bf0c ('cloud-setup: add tool for automatic IP configuration in cloud')
(cherry picked from commit e09bd2339a)
2020-06-28 17:40:20 +02:00
Antonio Cardace
f5487645d8
nmcs-http: fix multiple HTTP request bug
Since just a single pointer is used to store the socket's GSource
if more than 1 consecutive request was done through the same
HTTP provider the 2nd request would clear the GSource associated to
the second request causing the 1st HTTP request to never complete
and end up in a expired timeout.

Use a hashtable instead so we can correctly track all requests.

https://bugzilla.redhat.com/show_bug.cgi?id=1821787

Fixes: 69f048bf0c ('cloud-setup: add tool for automatic IP configuration in cloud')
(cherry picked from commit 427fbc85f0)
2020-06-28 17:40:13 +02:00
Beniamino Galvani
2b5ba370a6 device: clean up exported IP6 config when flushing addresses
After flushing addresses and routes, it's also necessary to update the
exported IP6 configuration.

https://bugzilla.redhat.com/show_bug.cgi?id=1848888
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/551

Fixes: e302f5ff77 ('device: flush IP configuration of slaves during activation')
(cherry picked from commit 071104124b)
2020-06-28 17:00:03 +02:00
Thomas Haller
af3c8bcb45
core,libnm: merge branch 'th/kernel-cmdline-match'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/550

(cherry picked from commit d18d75f89c)
2020-06-26 13:33:42 +02:00
Thomas Haller
3ced486f41
libnm/match: extend syntax for match patterns with '|', '&', '!' and '\\'
For simple matches like match.interface-name, match.driver, and
match.path, arguably what we had was fine. There each element
(like "eth*") is a wildcard for a single name (like "eth1").

However, for match.kernel-command-line, the elements match individual
command line options, so we should have more flexibility of whether
a parameter is optional or mandatory. Extend the syntax for that.

- the elements can now be prefixed by either '|' or '&'. This makes
  optional or mandatory elements, respectively. The entire match
  evaluates to true if all mandatory elements match (if any) and
  at least one of the optional elements (if any).
  As before, if neither '|' nor '&' is specified, then the element
  is optional (that means, "foo" is the same as "|foo").

- the exclamation mark is still used to invert the match. If used
  alone (like "!foo") it is a shortcut for defining a mandatory match
  ("&!foo").

- the backslash can now be used to escape the special characters
  above. Basically, the special characters ('|', '&', '!') are
  stripped from the start of the element. If what is left afterwards
  is a backslash, it also gets stripped and the remainder is the
  pattern. For example, "\\&foo" has the pattern "&foo" where
  '&' is no longer treated specially. This special handling of
  the backslash is only done at the beginning of the element (after
  the optional special characters). The remaining string is part
  of the pattern, where backslashes might have their own meaning.

This change is mostly backward compatible, except for existing matches
that started with one of the special characters '|', '&', '!', and '\\'.

(cherry picked from commit 824ad6275d)
2020-06-26 13:33:41 +02:00
Thomas Haller
1149dff6a1
core/tests: add unit test for nm_utils_kernel_cmdline_match_check()
(cherry picked from commit fa56e52a4f)
2020-06-26 13:33:41 +02:00
Thomas Haller
8d30c11e0c
core: move matching of kernel command line to separate function
(cherry picked from commit e0f4817148)
2020-06-26 13:33:41 +02:00
Thomas Haller
5b7d39f8e1
docs: fix escaping XML in "tools/generate-docs-nm-settings-docs-gir.py"
The gtk-doc text that the tool receives is not XML, it's a plain text.
When setting the plain text as XML attribute, we need to properly escape
it. The previous XML escape code was naive, and didn't cover for a
plain ampersand.

(cherry picked from commit 1641cc1d03)
2020-06-26 13:33:41 +02:00
Thomas Haller
c590f3c071
shared: return non-const pointer from nm_str_buf_get_str()
It's more convenient in certain cases. The user is allowed
to modified the content of the returned buffer.

(cherry picked from commit de4df9f529)
2020-06-26 10:31:07 +02:00
Thomas Haller
bf9ea4ea71
shared: avoid copying empty string in nm_str_buf_append_printf()
(cherry picked from commit 081650eb67)
2020-06-26 10:31:06 +02:00
Beniamino Galvani
27c84a505c libnm: fix wrong assertion in nm_client_check_connectivity_finish()
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/476

Fixes: b44d883d92 ('libnm: implement nm_client_check_connectivity_async() by using GDBusConnection directly')
(cherry picked from commit d0a2eb8f05)
2020-06-25 14:13:53 +02:00
Beniamino Galvani
a1de36d917 libnm: omit nm_device_*_get_hw_address() from introspection output
When the get_hw_address() method is called on a device object through
GObject-introspection, the device-specific
(e.g. nm_device_ethernet_get_hw_address()) C function is called
instead of the more generic nm_device_get_hw_address().

Those device-specific functions were deprecated in commit 067a3d6c08
('nm-device: expose via D-Bus the 'hw-address' property') and so libnm
will print out deprecation warnings like:

 DeprecationWarning: NM.DeviceEthernet.get_hw_address is deprecated

Omit the device-specific function from the introspection output so
that the generic function will be called instead.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/544
(cherry picked from commit 3124a05d83)
2020-06-25 11:05:11 +02:00
Beniamino Galvani
13eb192966 initrd: merge branch 'bg/initrd-ipv6'
https://bugzilla.redhat.com/show_bug.cgi?id=1848943
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/548
(cherry picked from commit 4efd4e0a61)
2020-06-24 14:55:11 +02:00
Beniamino Galvani
440a0b4078 initrd: set ipv6.method=auto when the autoconfiguration field is 'none'
The 7th field of:

 ip=<client-IP>:[<peer>]:<gateway-IP>:<netmask>:<client_hostname>:<interface>:{none|off|dhcp|on|any|dhcp6|auto6|ibft}:[:[<mtu>][:<macaddr>]]

specifies which kind of autoconfiguration to do. 'none' and 'off' mean
static addresses.

The old network module of dracut used to leave kernel IPv6
autoconfiguration enabled when IPv4 static addresses were
configured. With NM, this corresponds to enabling IPv6 auto method.

https://bugzilla.redhat.com/show_bug.cgi?id=1848943
(cherry picked from commit a39eb9ac14)
2020-06-24 14:54:50 +02:00
Beniamino Galvani
0e15a5e1be initrd: generate connections with IPv6 method 'auto' instead of 'ignore'
When the initrd generator creates a connection with IPv6 method
'ignore', the kernel will do IPv6 autoconfiguration on the
interface. However, it is preferable to let NetworkManager configure
the interface directly instead of relying on kernel. Therefore, change
the IPv6 method to 'auto'. Note that we still set ipv6.may-fail to
'yes' so that a failure during IPv6 autoconfiguration doesn't bring
down the interface.

(cherry picked from commit f6d654b18f)
2020-06-24 14:54:49 +02:00
Thomas Haller
a259e10946
shared,core: merge branch 'th/strsplit-quoted-kernel-cmdline'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/549

(cherry picked from commit 827dfacf0f)
2020-06-24 09:02:18 +02:00
Thomas Haller
254528acb6
core: use nm_utils_strsplit_quoted() for splitting the kernel command line
The kernel command line supports escaping and quoting (at least,
according to systemd's parser, which is our example to follow).

Use nm_utils_strsplit_quoted() which supports that.

(cherry picked from commit 27041e9f05)
2020-06-24 09:02:17 +02:00
Thomas Haller
5d2b609e7e
shared: add nm_utils_strsplit_quoted()
We want to parse "/proc/cmdline". That is space separated with support
for quoting and escaping. Our implementation becomes part of stable
behavior, and we should interpret the kernel command line the same way
as the system does. That means, our implementation should match
systemd's.

(cherry picked from commit 10779d545a)
2020-06-24 09:02:17 +02:00
Thomas Haller
61a37bdf13
tests: add nmtst_extract_first_word_all() for testing
We usually don't want to use internal API of systemd for our own
purposes. Here, we will use it to check our implementation against
systemd's. Add an accessor to extract_first_word() for testing.

(cherry picked from commit 2a6ecf2128)
2020-06-24 09:02:17 +02:00
Thomas Haller
4c443ec269
shared: add nm_str_buf_append_c_repeated() helper
(cherry picked from commit a2142e884b)
2020-06-24 09:02:16 +02:00
Thomas Haller
3ed95f308f
shared: make NM_STR_BUF_INIT() an inline function
In the previous form, NM_STR_BUF_INIT() was a macro. That makes sense,
however it's not really possible to make that a macro without evaluating
the reservation length multiple times. That means,

    NMStrBuf strbuf = NM_STR_BUF_INIT (nmtst_get_rand_uint32 () % 100, FALSE);

leads to a crash. That is unfortunate, so instead make it an inline
function that returns a NMStrBut struct. Usually, we avoid functions
that returns structs, but here we do it.

(cherry picked from commit c6809df4cd)
2020-06-24 09:02:16 +02:00
Thomas Haller
5216e5c012
shared: allow empty NMStrBuf buffers with un-allocated memory
Previously, for simplicity, NMStrBuf did not support buffers without any
data allocated. However, supporting that has very little
overhead/complexity, so do it.

Now you can initialize buffers to have no data allocated, and when
appending data, it will automatically grow.

(cherry picked from commit 83c79bc7a8)
2020-06-24 09:01:41 +02:00
Thomas Haller
1d1098f638
libnm: avoid deprecation warning about NMUtilsPredicateStr
NMUtilsPredicateStr got introduced in 1.26.0 API. However, marking the typedef
to be available only in 1.26, causes a compiler warning when using the header:

    /usr/include/libnm/nm-setting.h:372:39: error: ‘NMUtilsPredicateStr’ is deprecated: Not available before 1.26 [-Werror=deprecated-declarations]
      372 |                                       NMUtilsPredicateStr predicate);
          |                                       ^~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors

Avoid that. It's not a problem in practice, because all users of the typedef
are functions that are marked to be available in 1.26 themselves.

(cherry picked from commit 8a13b02d96)
2020-06-22 13:27:19 +02:00
Thomas Haller
6ae1f0e459
libnm: return NULL for boxed strv properties of NMSettingMatch
The API does not allow to distinguish between an unset (NULL) or empty
strv array. For example, nm_setting_match_get_paths() never returns
%NULL, but returns an empty strv array.

On the other hand, the GObject properties of type G_TYPE_STRV have a
default value of %NULL. That means, also the getter should map both
unset and empty to %NULL.

Note that this is a change in behavior w.r.t. 1.24.0 API, where
match.interface-name property would return an empty strv array.
Regrading the other API, this is no change because it is new API
and we will fix it before 1.26.0 release.

(cherry picked from commit 62263e706f)
2020-06-22 12:18:26 +02:00
Thomas Haller
092ab227d5
shared: add nm_strvarray_get_strv_non_empty() helper
(cherry picked from commit d69f057a65)
2020-06-22 12:18:21 +02:00
Beniamino Galvani
3951396de7 settings: fix assertion when updating default wired connection
The connection is expected to have the NM_GENERATED flag, since it has
a default wired device.

Fixes: d35d3c468a ('settings: rework tracking settings connections and settings plugins')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/471
(cherry picked from commit 4aefad5673)
2020-06-22 09:55:04 +02:00
Thomas Haller
28644556e1
shared: fix string truncation in nm_str_buf_append_printf()
If g_vsnprintf() returns that it wants to write 5 characters, it
really needs space for 5+1 characters. If we have 5 characters
available, it would have written "0123\0", which leaves the buffer
broken.

Fixes: eda47170ed ('shared: add NMStrBuf util')
(cherry picked from commit fd34fe50a2)
2020-06-21 22:34:16 +02:00