Commit graph

25447 commits

Author SHA1 Message Date
Thomas Haller
ad5fdd9d62 Revert "IPv6 SLAAC: Clamp received PIO and RIO Lifetime Values"
This reverts commit 0cbd9193cd.
This reverts commit a5290915d5.
2020-04-21 08:37:48 +02:00
Thomas Haller
a88be01da2 Revert "IPv6 SLAAC: Honor small PIO Valid Lifetimes"
This reverts commit 2da092b592.
2020-04-21 08:37:03 +02:00
Beniamino Galvani
1dfd35da20 wifi: change return type of p2p-connect D-Bus method call
Fix the following error when invoking the Connect() p2p method:

 call-p2p-connect: failed with Method “fi.w1.wpa_supplicant1.Interface.P2PDevice.Connect” returned type “(s)”, but expected “()”

Fixes: b83f07916a ('supplicant: large rework of wpa_supplicant handling')
(cherry picked from commit a5338affb5)
2020-04-20 17:13:39 +02:00
Thomas Haller
4938299a9b libnm: cleanup _nm_utils_dns_option_validate()
Avoid unnecessary string copies. Most option don't have a delimiter
and numerical argument, and there is no need to clone the string.

(cherry picked from commit 61a97f8b0f)
2020-04-20 15:55:52 +02:00
Thomas Haller
d78dadc9eb dns: add trust-ad DNS option only if all contributing settings agree
https://bugzilla.redhat.com/show_bug.cgi?id=1825285
(cherry picked from commit 5e47fb630b)
2020-04-20 15:55:51 +02:00
Thomas Haller
ccb043d78c libnm: document supported "ipv[46].dns-option" values
(cherry picked from commit e261e941fd)
2020-04-20 15:55:50 +02:00
Thomas Haller
24ab6b6cdc tests: abort test runner if exec fails
(cherry picked from commit 2ad8e6acae)
2020-04-20 11:52:11 +02:00
Beniamino Galvani
5b83609b01 libnm-core: add 'no-reload' and 'trust-ad' resolv.conf options
https://sourceware.org/git/?p=glibc.git;a=blob;f=resolv/res_init.c;h=95dce098aa7ec80f2e36f5c25022641d65e1d5e5;hb=9ea3686266dca3f004ba874745a4087a89682617#l681

https://bugzilla.redhat.com/show_bug.cgi?id=1825285
(cherry picked from commit 40b2cf7a0c)
2020-04-20 11:32:56 +02:00
Antonio Cardace
8d3b3a55b3 clients: merge branch 'ac/cli_hide_if_default'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/470

(cherry picked from commit f957359421)
2020-04-20 08:54:56 +02:00
Antonio Cardace
aacf8bd27d ethtool: refactor how options are hidden if default
Just use the new flag NMMetaPropertyInfo.

(cherry picked from commit a5916de599)
2020-04-20 08:54:55 +02:00
Antonio Cardace
486161cff4 bridge: make some advanced options hidden if default
The options are:
  * group-address
  * multicast-querier
  * multicast-query-use-ifaddr
  * multicast-router
  * vlan-stats-enabled
  * vlan-protocol

(cherry picked from commit 3af07fd415)
2020-04-20 08:54:55 +02:00
Thomas Haller
fc582312f7 cli: let _print_fill() hide option if NM_META_ACCESSOR_GET_OUT_FLAGS_HIDE is set
Regardless, whether the option is also currently the default.

(cherry picked from commit 69eca25391)
2020-04-20 08:54:55 +02:00
Antonio Cardace
fd37111986 clients: allow properties to be hidden if they have the default value
(cherry picked from commit b94fcb2a94)
2020-04-20 08:54:55 +02:00
Gilles Dartiguelongue
7b0130d5d7 build: remove subshells and fix invalid test syntax
Signed-off-by: Gilles Dartiguelongue <eva@gentoo.org>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/472
(cherry picked from commit e073491b9c)
2020-04-20 08:54:38 +02:00
Thomas Haller
1667be7cf5 contrib/rpm: fix spec file using bare words
error: bare words are no longer supported, please use "...":  no != "yes"
  error:                                                        ^
  error: /builds/NetworkManager/NetworkManager/contrib/fedora/rpm/NetworkManager.20200418-170120.dp5cp5/SPECS/NetworkManager.spec:596: bad %if condition:  no != "yes"

(cherry picked from commit ed94ab6e23)
2020-04-19 21:45:05 +02:00
Thomas Haller
c869d792a2 contrib/rpm: fix spec file using bare words
error: bare words are no longer supported, please use "...":  no != yes
  error: /builds/NetworkManager/NetworkManager/contrib/fedora/rpm/NetworkManager.20200418-163008.VM582H/SPECS/NetworkManager.spec:596: bad %if condition:  no != yes

(cherry picked from commit be78a12012)
2020-04-19 21:45:04 +02:00
Beniamino Galvani
c5f0d325ad ifcfg-rh: add PKEY_ID to well-known keys
Fixes: 81e6fe963e ('ifcfg-rh: add functions to detect well-known ifcfg-rh keys')
(cherry picked from commit 70916a1183)
2020-04-17 09:50:40 +02:00
Thomas Haller
f00d306ae7 keyfile: minor cleanup handling error in read_array_of_uint()
Why "if (length > G_MAXUINT)"? This is never going to hit. Also,
we probably should actual missing keys handle differently from
empty lists. If @error is set, return without setting the property.

(cherry picked from commit 2cf31bfef0)
2020-04-15 22:41:02 +02:00
Thomas Haller
97139f5e3d keyfile: avoid assertion failure in nm_keyfile_plugin_kf_get_{string,integer}_list()
g_key_file_get_integer_list() can return %NULL without setting an error.
That is the case if the key is set to an empty value.

For X sake, this API. Read the documentation and figure out whether
the function can return %NULL without reporting an error.

Anyway, avoid the assertion failure.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/412
(cherry picked from commit 8f46425b11)
2020-04-15 22:41:02 +02:00
Thomas Haller
432d1c6eb5 keyfile: cleanup mac_address_parser()
(cherry picked from commit 12c2aacea7)
2020-04-15 22:41:02 +02:00
Piotr Drąg
54ef718d5b po: mark broken translations as fuzzy
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/468
(cherry picked from commit 304fabf381)
2020-04-14 09:23:44 +02:00
Piotr Drąg
7061934d6a po: update Polish (pl) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/466
2020-04-14 09:13:08 +02:00
Beniamino Galvani
f80826fbb2 release: bump version to 1.23.90 (1.24-rc1) 2020-04-10 17:55:22 +02:00
Antonio Cardace
f93d0ea3fd
release: update NEWS 2020-04-10 17:52:44 +02:00
Antonio Cardace
bdcd15a62b
bond: merge branch 'ac/bond_mode_fix'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/464
2020-04-10 17:49:01 +02:00
Antonio Cardace
2a5d9eb60b
bond: small cleanups
* Use an enum instead of a string, is faster for comparisons.
* Add debug assertions
* Have NMBondMode enum correspond to Kernel numbering
2020-04-10 17:46:22 +02:00
Antonio Cardace
d73a98a3e8
nm-setting-bond: also accept bond mode as a numerical id
That corresponds to how the Kernel numbers the different modes.
2020-04-10 17:46:18 +02:00
Thomas Haller
2f20878dbf man: fix obsolete references to monitor-connection-files in manual pages
monitor-connection-files was deprecated and disabled by default for a long
time. In the meantime, it has no effect at all.

Remove references from the manual pages.
2020-04-10 15:02:20 +02:00
Gennadij Latyshev
6cbbdb63fb po: update Russian (ru) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/348
2020-04-10 14:02:58 +02:00
Thomas Haller
f3ca61e6e4 shared/trivial: fix typo in code comment and reword 2020-04-10 10:55:22 +02:00
Thomas Haller
5f668ee389 cli: merge branch 'th/cli-command-cleanup'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/460
2020-04-10 10:48:56 +02:00
Thomas Haller
3e1e63e57d cli/polkit: make parsing polkit-agent-helper-1 protocol more conforming
- in io_watch_have_data(), ensure that we handle incomplete lines
that don't yet have a newline by waiting for more data. That means,
if the current content of the in_buffer does not have a newline, we
wait longer.

- in io_watch_have_data(), implement (and ignore) certain commands
instead of failing the request.

- in io_watch_have_data(), no longer g_compress() the entire line.
"polkitagenthelper-pam.c" never backslash escapes the command, it
only escapes the arguments. Of course, there should be no difference
in practice, except that we don't want to handle escape sequences
in the commands.

- in io_watch_have_data(), compare SUCCESS/FAILURE literally.
"polkitagenthelper-pam.c" never appends any trailing garbage to these
commands, and we shouldn't handle that (although "polkitagentsession.c"
does).

- when io_watch_have_data() completes with success, we cannot destroy
AuthRequest right away. It probably still has data pending that we first
need to write to the polkit helper. Wait longer, and let io_watch_can_write()
complete the request.

- ensure we always answer the GDBusMethodInvocation. Otherwise, it gets
leaked.

- use NMStrBuf instead of GString.
2020-04-10 10:44:57 +02:00
Thomas Haller
277925c36a cli/polkit: suppress stderr from polkit-agent-helper when prompting for polkit authentication
Otherwise, we get an additional error message form the helper:

  $ nmcli --ask device wifi rescan
  System policy prevents Wi-Fi scans
  (action_id: org.freedesktop.NetworkManager.wifi.scan)
  password (user): •••••••
  polkit-agent-helper-1: pam_authenticate failed: Authentication failure
  Error: org.freedesktop.NetworkManager.wifi.scan request failed: not authorized.
2020-04-10 10:44:56 +02:00
Thomas Haller
d4a20fe360 cli/polkit: rework parsing identities for polkit request
The identities are in a nested dictionary of variants. We only want
to pick the "unix-user" values that we can handle.
2020-04-10 10:44:54 +02:00
Thomas Haller
b0759e9662 cli/polkit: reject unknown D-Bus methods 2020-04-10 10:44:53 +02:00
Thomas Haller
0dbb9c279e cli/polkit: rename NM_POLKIT_LISTENER_SIGNAL_REQUEST signal to "request-sync"
The response is blocking, which generally is rather ugly. Let's not fix
that now, but at least rename the signal so that it clearly points this
out.
2020-04-10 10:44:52 +02:00
Thomas Haller
7d91208218 cli/polkit: avoid G_DECLARE_FINAL_TYPE() in nm-polkit-listener.h
G_DECLARE_FINAL_TYPE() is glib 2.44, while we currently still only require glib 2.40.
2020-04-10 10:44:51 +02:00
Thomas Haller
2384033b05 shared: fix returning EAGAIN from nm_utils_fd_read()
We cannot just swallow EAGAIN and pretend that not bytes were read.

read() returning zero means end of file. The caller needs to distinguish
between end of file and EAGAIN.
2020-04-10 10:44:50 +02:00
Thomas Haller
8c637e693a shared/strbuf: fix signedness of integer comparison in nm_str_buf_append_printf() 2020-04-10 10:44:48 +02:00
Thomas Haller
741258a928 shared/strbuf: rename private, mutable fields in NMStrBuf structure
NMStrBuf is not an opaque structure, so that we can allocate it on the
stack or embed it in a struct.

But most of the fields should not be touched outside of the
implementation.

Also, "len" and "allocated" fields may be accessed directly, but
they should not be modified.

Rename the fields to make that clearer.
2020-04-10 10:44:47 +02:00
Thomas Haller
560b840a11 shared/strbuf: add nm_str_buf_is_initalized() helper 2020-04-10 10:44:46 +02:00
Thomas Haller
19fff8444e shared/strbuf: add nm_str_buf_erase() helper 2020-04-10 10:44:45 +02:00
Thomas Haller
f8efed528d shared/strbuf: add nm_str_buf_get_str_unsafe() helper function to give direct access to string buffer 2020-04-10 10:44:44 +02:00
Thomas Haller
7dc467bbbc shared/strbuf: add nm_str_buf_set_size() helper function 2020-04-10 10:44:43 +02:00
Thomas Haller
a2d52669aa shared/strbuf: add nm_str_buf_ensure_trailing_c() helper function 2020-04-10 10:44:42 +02:00
Thomas Haller
64894182ca shared/strbuf: expose read only value for "allocated" buffer size
We cannot actually mark the field as const, because then you could no
longer initialize a variable that contains a NMStrBuf with designated
initializers.

We also want to keep the "_allocated" alias, for the only places that
are allowed to mutate the field: inside "nm-str-buf.h". Add an alias
for that field, that is allowed to be read, provided that you don't
modify it!

The alternative would be a nm_str_buf_get_allocated() accessor, but
that seems unnecessarily verbose when you could just access the field.
2020-04-10 10:44:41 +02:00
Thomas Haller
7ff170a28f shared/strbuf: don't have const values in NMStrBuf
Before, if a struct had a field of type NMStrBuf (which is sensible to do),
then you could not longer initialize the entire struct with

  *ptr = (Type) { };

because NMStrBuf contained const fields.

The user should never set these fields directly and use nm_str_buf_*() to modify
them them. But no longer mark them as const, because that breaks valid
use cases.
2020-04-10 10:44:40 +02:00
Thomas Haller
43ba2cb933 shared/strbuf: allow forward declaring "struct _NMStrBuf" 2020-04-10 10:44:39 +02:00
Thomas Haller
abacc1e919 shared/strbuf: only clear the bytes that we actually wrote to
The allocated buffes are not known to be written. It is unnecessary to
clear them.

If the user writes sensitive data to those locations, without using
the NMStrBuf API, then it is up to the user to bzero the memory
accordingly.
2020-04-10 10:44:38 +02:00
Thomas Haller
d1c2572e11 shared: add NM_UTILS_GET_NEXT_REALLOC_SIZE_1000 define
When we have a buffer that we want to grow exponentially with
nm_utils_get_next_realloc_size(), then there are certain buffer
sizes that are better suited.

For example, if you have an empty NMStrBuf (len == 0), and you
want to allocate roughly one kilobyte, then 1024 is a bad choice,
because nm_utils_get_next_realloc_size() will give you 2024 bytes.

NM_UTILS_GET_NEXT_REALLOC_SIZE_1000 might be better in this case.
2020-04-10 10:44:37 +02:00