Commit graph

26863 commits

Author SHA1 Message Date
Andrew Zaborowski
f533ce5b95
iwd: Disable periodic scanning when connected
The automatic scanning every 20 seconds while connected has been
annoying users because of the extra connection latency, drop it.  The
UIs are supposed to be requesting scans whenever an AP list update is
needed (?).

(cherry picked from commit c2c68ce169)
2020-10-06 14:22:08 +02:00
Andrew Zaborowski
2a3b3ca38d
iwd: Disconnect signals in NMDeviceIwd's dispose
Fix a crash on device unplugging caused by keeping our signal handlers
for GDBusProxies connected after a call to dispose().  Do this by
replacing most cleanup steps by a nm_device_iwd_set_dbus_object(self, NULL)
call which is more meticulous.

(cherry picked from commit d2b0c5af63)
2020-10-06 14:22:07 +02:00
Thomas Haller
1b2bee0e76
build: fix "create-exports-NetworkManager.sh" to fail if "nm" fails
Despite `set -e`, the shell script does not fail if the command in the
here document fails. This can happen if binutils' "nm" fails.

  NM=/bin/false "./tools/create-exports-NetworkManager.sh" --called-from-build "."

(cherry picked from commit 7fe76f54e3)
2020-10-06 13:34:22 +02:00
Thomas Haller
8e94ad04ff
systemd: workaround compilation failures against old glibc
Building against older libc/kernel headers can fail, because our glue
code for systemd has issues. Fix them by forward declaring "struct
statx" and by disabling parts of "socket-util.c".

(cherry picked from commit b7e08f685d)
2020-10-05 23:14:31 +02:00
Beniamino Galvani
4adf6afda5 release: bump version to 1.27.90 (1.28-rc1) 2020-10-05 18:43:28 +02:00
Beniamino Galvani
42aa292907 NEWS: update 2020-10-05 18:33:19 +02:00
Beniamino Galvani
fa7f83b26a systemd: merge branch systemd into master 2020-10-05 17:10:24 +02:00
Beniamino Galvani
aaf882b859 systemd: update code from upstream (2020-10-05)
This is a direct dump from systemd git.

======

SYSTEMD_DIR=../systemd
COMMIT=b182195acc3f5eeb97b2b4b60d36796b399e5a01

(
  cd "$SYSTEMD_DIR"
  git checkout "$COMMIT"
  git reset --hard
  git clean -fdx
)

git ls-files -z :/src/systemd/src/ \
                :/shared/systemd/src/ \
                :/shared/nm-std-aux/unaligned.h | \
  xargs -0 rm -f

nm_copy_sd_shared() {
    mkdir -p "./shared/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./shared/systemd/$1"
}

nm_copy_sd_core() {
    mkdir -p "./src/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
}

nm_copy_sd_stdaux() {
    mkdir -p "./shared/nm-std-aux/"
    cp "$SYSTEMD_DIR/$1" "./shared/nm-std-aux/${1##*/}"
}

nm_copy_sd_core "src/libsystemd-network/arp-util.c"
nm_copy_sd_core "src/libsystemd-network/arp-util.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd_core "src/libsystemd-network/lldp-internal.h"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.c"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.h"
nm_copy_sd_core "src/libsystemd-network/lldp-network.c"
nm_copy_sd_core "src/libsystemd-network/lldp-network.h"
nm_copy_sd_core "src/libsystemd-network/network-internal.c"
nm_copy_sd_core "src/libsystemd-network/network-internal.h"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd_core "src/libsystemd-network/sd-lldp.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-source.h"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.h"
nm_copy_sd_core "src/libsystemd/sd-event/sd-event.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.h"
nm_copy_sd_core "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd_core "src/systemd/_sd-common.h"
nm_copy_sd_core "src/systemd/sd-dhcp-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp-lease.h"
nm_copy_sd_core "src/systemd/sd-dhcp-option.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-option.h"
nm_copy_sd_core "src/systemd/sd-event.h"
nm_copy_sd_core "src/systemd/sd-id128.h"
nm_copy_sd_core "src/systemd/sd-ipv4acd.h"
nm_copy_sd_core "src/systemd/sd-ipv4ll.h"
nm_copy_sd_core "src/systemd/sd-lldp.h"
nm_copy_sd_core "src/systemd/sd-ndisc.h"
nm_copy_sd_shared "src/basic/alloc-util.c"
nm_copy_sd_shared "src/basic/alloc-util.h"
nm_copy_sd_shared "src/basic/async.h"
nm_copy_sd_shared "src/basic/cgroup-util.h"
nm_copy_sd_shared "src/basic/env-file.c"
nm_copy_sd_shared "src/basic/env-file.h"
nm_copy_sd_shared "src/basic/env-util.c"
nm_copy_sd_shared "src/basic/env-util.h"
nm_copy_sd_shared "src/basic/errno-util.h"
nm_copy_sd_shared "src/basic/escape.c"
nm_copy_sd_shared "src/basic/escape.h"
nm_copy_sd_shared "src/basic/ether-addr-util.c"
nm_copy_sd_shared "src/basic/ether-addr-util.h"
nm_copy_sd_shared "src/basic/extract-word.c"
nm_copy_sd_shared "src/basic/extract-word.h"
nm_copy_sd_shared "src/basic/fd-util.c"
nm_copy_sd_shared "src/basic/fd-util.h"
nm_copy_sd_shared "src/basic/fileio.c"
nm_copy_sd_shared "src/basic/fileio.h"
nm_copy_sd_shared "src/basic/format-util.c"
nm_copy_sd_shared "src/basic/format-util.h"
nm_copy_sd_shared "src/basic/fs-util.c"
nm_copy_sd_shared "src/basic/fs-util.h"
nm_copy_sd_shared "src/basic/hash-funcs.c"
nm_copy_sd_shared "src/basic/hash-funcs.h"
nm_copy_sd_shared "src/basic/hashmap.c"
nm_copy_sd_shared "src/basic/hashmap.h"
nm_copy_sd_shared "src/basic/hexdecoct.c"
nm_copy_sd_shared "src/basic/hexdecoct.h"
nm_copy_sd_shared "src/basic/hostname-util.c"
nm_copy_sd_shared "src/basic/hostname-util.h"
nm_copy_sd_shared "src/basic/in-addr-util.c"
nm_copy_sd_shared "src/basic/in-addr-util.h"
nm_copy_sd_shared "src/basic/io-util.c"
nm_copy_sd_shared "src/basic/io-util.h"
nm_copy_sd_shared "src/basic/list.h"
nm_copy_sd_shared "src/basic/log.h"
nm_copy_sd_shared "src/basic/macro.h"
nm_copy_sd_shared "src/basic/memory-util.c"
nm_copy_sd_shared "src/basic/memory-util.h"
nm_copy_sd_shared "src/basic/mempool.c"
nm_copy_sd_shared "src/basic/mempool.h"
nm_copy_sd_shared "src/basic/missing_fcntl.h"
nm_copy_sd_shared "src/basic/missing_random.h"
nm_copy_sd_shared "src/basic/missing_socket.h"
nm_copy_sd_shared "src/basic/missing_stat.h"
nm_copy_sd_shared "src/basic/missing_syscall.h"
nm_copy_sd_shared "src/basic/missing_type.h"
nm_copy_sd_shared "src/basic/parse-util.c"
nm_copy_sd_shared "src/basic/parse-util.h"
nm_copy_sd_shared "src/basic/path-util.c"
nm_copy_sd_shared "src/basic/path-util.h"
nm_copy_sd_shared "src/basic/prioq.c"
nm_copy_sd_shared "src/basic/prioq.h"
nm_copy_sd_shared "src/basic/process-util.c"
nm_copy_sd_shared "src/basic/process-util.h"
nm_copy_sd_shared "src/basic/random-util.c"
nm_copy_sd_shared "src/basic/random-util.h"
nm_copy_sd_shared "src/basic/set.h"
nm_copy_sd_shared "src/basic/signal-util.c"
nm_copy_sd_shared "src/basic/signal-util.h"
nm_copy_sd_shared "src/basic/siphash24.h"
nm_copy_sd_shared "src/basic/socket-util.c"
nm_copy_sd_shared "src/basic/socket-util.h"
nm_copy_sd_shared "src/basic/sort-util.h"
nm_copy_sd_shared "src/basic/sparse-endian.h"
nm_copy_sd_shared "src/basic/stat-util.c"
nm_copy_sd_shared "src/basic/stat-util.h"
nm_copy_sd_shared "src/basic/stdio-util.h"
nm_copy_sd_shared "src/basic/string-table.c"
nm_copy_sd_shared "src/basic/string-table.h"
nm_copy_sd_shared "src/basic/string-util.c"
nm_copy_sd_shared "src/basic/string-util.h"
nm_copy_sd_shared "src/basic/strv.c"
nm_copy_sd_shared "src/basic/strv.h"
nm_copy_sd_shared "src/basic/strxcpyx.c"
nm_copy_sd_shared "src/basic/strxcpyx.h"
nm_copy_sd_shared "src/basic/time-util.c"
nm_copy_sd_shared "src/basic/time-util.h"
nm_copy_sd_shared "src/basic/tmpfile-util.c"
nm_copy_sd_shared "src/basic/tmpfile-util.h"
nm_copy_sd_shared "src/basic/umask-util.h"
nm_copy_sd_shared "src/basic/user-util.h"
nm_copy_sd_shared "src/basic/utf8.c"
nm_copy_sd_shared "src/basic/utf8.h"
nm_copy_sd_shared "src/basic/util.c"
nm_copy_sd_shared "src/basic/util.h"
nm_copy_sd_shared "src/shared/dns-domain.c"
nm_copy_sd_shared "src/shared/dns-domain.h"
nm_copy_sd_shared "src/shared/web-util.c"
nm_copy_sd_shared "src/shared/web-util.h"
nm_copy_sd_stdaux "src/basic/unaligned.h"
2020-10-05 16:56:33 +02:00
Thomas Haller
6220b08c78
platform: reorder fields in NMPClass struct
Almost always we don't care about the order of our fields inside
structs. Hence, choose an order in which holes due to memory alignment
are minimized.
2020-10-05 15:54:09 +02:00
Thomas Haller
0d7bf62aac
test/trivial: rename ASSERT_nmp_cache_is_consistent() function to nmtst_assert_nmp_cache_is_consistent()
We sometimes expose test-only functions as part of our API, to give direct
access to unit tests. Such functions should have a "NMTST" prefix. Rename.
2020-10-05 15:46:42 +02:00
Thomas Haller
f2b5812af3
platform: add typedefs for casting functions pointers to improve formatting
The autogenerated formating in these cases is rather ugly. Instead,
introduce a typedef and use that for casting the function pointer.
2020-10-05 15:46:42 +02:00
Thomas Haller
c6308162cf
platform: fix formatting for _vt_cmd_plobj_id_cmp()/_vt_cmd_plobj_id_hash_update() 2020-10-05 15:46:42 +02:00
Thomas Haller
978145f8ba
shared: return NULL from nm_malloc_maybe_a() when asking for zero bytes
The documentation of g_alloca()/alloca() isn't clear about what
happens when asking for zero bytes. Make it clear, by always returning
NULL.

Also, add a static assertion that @alloca_maxlen is a well-defined
positive integer.
2020-10-02 11:51:33 +02:00
Thomas Haller
456d26d816
platform/tests: fix bug in nmtstp_ip_address_check_lifetime() calculating timeouts with unsigned integers
As one of the arguments in unsigned, the calculation is performed as
unsigned integers. That can actually lead to the wrong result. Fix it by
casting to the right (signed) types.
2020-10-01 17:37:15 +02:00
Thomas Haller
dc559a9af7
platform/trivial: use in_addr_t type for address in nm_platform_ip4_address_get() 2020-10-01 17:35:14 +02:00
Thomas Haller
f7f979cda6
shared: add nm_ether_addr_to_string() helper 2020-10-01 17:35:14 +02:00
Thomas Haller
c36eedf4d8
shared: add ether_addr field of type NMEtherAddr to NMIPAddr union 2020-10-01 17:35:13 +02:00
Thomas Haller
77ad359442
l3cfg: merge branch 'th/l3cfg-11'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/637
2020-09-30 10:41:09 +02:00
Thomas Haller
e83a6f5898
l3cfg: combine notify_type and payload data in NM_L3Cfg_SIGNAL_NOTIFY signal
Emitting signals is relatively expensive, because the arguments have to be packed
into a GValue. Avoid some overhad by only passing one signal argument: the notify-data
which also contains the type. Also with this we can use g_cclosure_marshal_VOID__POINTER.

Also, it's nice to have the type field part of the notify-data. Because clearly
the notify-data union is unusable without knowing the type. That means, if a user
passes the notify-data to a function, they anyway would also need to pass along
the type.
2020-09-30 09:49:24 +02:00
Thomas Haller
ef198d0202
l3cfg: in NML3Cfg also track the current NMPlatformLink of the platform cache
NML3Cfg tends to perform actions on an idle handler. That means, when
it configures something on platform, it tends to ignore the changes and
process them later.

That means the currently tracked NMPObject with the platform link may
not be the same as NMPlatform currently has cached.

Instead, track them both, and extend the API so that it's clear that
there is a difference. You now need to say whether you want the instance
from the platform cache (the "next") or the currently used instance. Of
course, after the idle handler runs, "next" and the current one
converge.

This is useful because we want to reason about the link state (also) by
looking a our NML3Cfg instance. Since it already is connected to
platform, it can expose the same NMPObject.
2020-09-30 09:49:23 +02:00
Thomas Haller
5ed1027cab
l3cfg: cleanup nm_l3cfg_platform_commit() API and function to schedule commit on idle
- add nm_l3cfg_platform_commit_on_idle_schedule() so that internal (and
  external) code can schedule a commit on an idle handler. This already
  existed, but is exposed now.

- rename nm_l3cfg_platform_commit() to simply nm_l3cfg_commit(). There
  is no other form than "platform" commit, so the name was
  unnecessarily long.

- also don't let nm_l3cfg_commit() return a boolean success. It's not
  useful, because commits can be triggered internally (by NML3Cfg
  itself) or by other users. Instead, there is the "post-commit" event,
  and anybody who cares about such a failure would need to handle it
  there.
2020-09-30 09:49:23 +02:00
Thomas Haller
11c80ccf19
l3cfg: add NM_L3_CONFIG_NOTIFY_TYPE_PLATFORM_CHANGE notification
Our NML3Cfg instance is the IP configuration manage of one ifindex.
Often users have an NML3Cfg instance at hand, but they still need to
react to platform signals. Instead of requiring those users to register
their own signal (which also gets notifications about uninteresting
interfaces), re-emit the signal from NML3Cfg.

We already had NM_L3_CONFIG_NOTIFY_TYPE_PLATFORM_CHANGE_ON_IDLE which
does something similar, but collects multiple changes and emits them
on an idle handler.
2020-09-30 09:49:22 +02:00
Thomas Haller
432d7f2151
l3cfg: add NM_L3_CONFIG_MERGE_FLAGS_ONLY_FOR_ACD merge flag
This flag indicates that the NML3ConfigData should be ignored for most
purposes, except for doing ACD.

Note that as users can call nm_l3cfg_add_config() multiple times for
the same NML3ConfigData, a higher layer that enables ACD/IPv4LL can
then decide to actually use the configuration, while some layers
only have it hooked up to do ACD.
2020-09-30 09:49:22 +02:00
Thomas Haller
b4aa35e72d
l3cfg: extend nm_l3cfg_add_config() to accept default route table and metric
Now that NMPlatformIP[46]Route can contain a wildcard table/metric, we
can set the effectivey table/metric per NML3ConfigData that we merge.
Pass it to nm_l3cfg_add_config().
2020-09-30 09:49:21 +02:00
Thomas Haller
9cf49804d8
l3cfg: add nm_l3cfg_get_multi_idx() accessor 2020-09-30 09:49:21 +02:00
Thomas Haller
02ad6416fd
platform: add flags to NMPlatformIP[46]Route to allow overriding the route table and metric
When we (for example) receive a DHCP lease, we track the routes that
should be configured via NMPlatformIP[46]Route instances. Thus, this
structure does not only track the routes that are configured (and
cached in NMPlatform), but it is also used to track the routes that
we want to configure.

This is also the case with the "rt_source" field, which represents the
NMIPConfigSource enum for routes that we want to configure, but
for routes in the cache it corresponds to rtm_protocol.

Note that NMDhcpClient creates NMIP4Config instances, which tracks the
routes as NMPlatformIP4Route instances. Previously, NMDhcpClient didn't
have any way to leave the table/metric undecided, but this information
isn't part of the DHCP lease tself. Instead, NMDevice knows the table/metric
to use. This has various problems:

  - NMDhcpClient needs to know the table/metric, for no other purpose
    than to set the value when creating the NMIP4Config instance for the
    lease. We first pass the information down, only so that it can be
    returned with the lease information.

  - during reapply or when connectivity check changes, the effectively
    used table/metric can change. Previously, we would have to
    re-generate the NMIP4Config instances.

Improve that by allowing to leave the table/metric undecided. Higher
layers can decide the effective metric to use.
2020-09-30 09:49:21 +02:00
Thomas Haller
1558e9a323
platform: have union in NMPLinkAddress for NMEtherAddr 2020-09-30 09:49:21 +02:00
Thomas Haller
f74b7718b3
shared: add typedefs for integers for different endianness
Kernel uses such typedefs (__le32) and systemd too (le32_t).
As we don't want to rely on systemd headers in our code
base, let's also define them.

They have of course very little effect beside making it clearer to
the reviewer that a certain variable is not supposed to be in native
endianness.
2020-09-30 09:49:20 +02:00
Thomas Haller
b019950eaf
shared: include "stdint.h" in our base headers
While we often use and prefer the glib typedefs (like guint32), there
are places where we want to use the fixed width integer types from C99.

In particular, next we will introduce typedefs like nm_le64_t for
integers in different endianness.

Also, here we are about "nm-std-aux", so the glib typedefs are not
available.

I feel a header like <stdint.h> is such a basic C requirement, that
is should just be available to us everywhere.
2020-09-30 09:49:20 +02:00
Thomas Haller
d9ca728005
shared: add nm_ether_addr_cmp()/nm_ether_addr_equal() helpers 2020-09-30 09:49:20 +02:00
Thomas Haller
f37dd5d394
shared: move NM_CMP*() macros to "nm-std-aux.h"
I would need these macros earlier in "nm-glib-aux/nm-shared-utils.h",
so it would be sufficient to just move them.

However, when I already move them, move them to "nm-std-aux/nm-std-aux.h"
because they don't need a glib dependency.
2020-09-30 09:48:26 +02:00
Thomas Haller
1c3f7d823e
libnm/trivial: fix indentation for NMSettingWirelessWakeOnWLan enum 2020-09-29 18:23:18 +02:00
Thomas Haller
f9d0489123
all: use C-style comments for "clang-format on|off" 2020-09-29 18:22:18 +02:00
Thomas Haller
88071abb43
all: unify comment style for SPDX-License-Identifier tag
Our coding style recommends C style comments (/* */) instead of C++
(//). Also, systemd (which we partly fork) uses C style comments for
the SPDX-License-Identifier.

Unify the style.

  $ sed -i '1 s#// SPDX-License-Identifier: \([^ ]\+\)$#/* SPDX-License-Identifier: \1 */#' -- $(git ls-files -- '*.[hc]' '*.[hc]pp')
2020-09-29 16:50:53 +02:00
Thomas Haller
36b761fcaa
contrib: add "nm-code-format-container.sh" to reformat working directory in container
We use clang-format to format our code, and the exact format depends on
the clang version. Currently we use clang-11, as packaged in Fedora 33.

Add a script that runs a Fedora 33 container with podman and reformats
the current working directory.

Usage:

  ./contrib/scripts/nm-code-format-container.sh
2020-09-29 13:37:58 +02:00
Thomas Haller
20ebacbea2
libnm: cleanup handling of "connection.permissions" and improve validation
Previously, both nm_setting_connection_add_permission() and the GObject
property setter would merely assert that the provided values are valid
(and otherwise don't do anything). That is bad for handling errors.

For example, we use the property setter to initialize the setting from
keyfile and GVariant (D-Bus). That means, if a user provides an invalid
permissions value, we would emit a g_critical() assertion failure, but
otherwise ignore the configuration. What we instead need to do is to
accept the value, and afterwards fail verification. That way, a proper error
message can be generated.

  $ mcli connection add type ethernet autoconnect no ifname bogus con-name x connection.permissions 'bogus:'

  (process:429514): libnm-CRITICAL **: 12:12:00.359: permission_new: assertion 'strchr (uname, ':') == NULL' failed

  (process:429514): libnm-CRITICAL **: 12:12:00.359: nm_setting_connection_add_permission: assertion 'p != NULL' failed
  Connection 'x' (2802d117-f84e-44d9-925b-bfe26fd85da1) successfully added.
  $ $  nmcli -f connection.permissions connection show x
  connection.permissions:                 --

While at it, also don't track the permissions in a GSList. Tracking one
permission in a GSList requires 3 allocations (one for the user string,
one for the Permission struct, and one for the GSList struct). Instead,
use a GArray. That is still not great, because GArray cannot be embedded
inside NMSettingConnectionPrivate, so tracking one permission also
requires 3 allocations (which is really a fault of GArray). So, GArray
is not better in the common case where there is only one permissions. But even
in the worst case (only one entry), GArray is no worse than GSList.

Also change the API of nm_setting_connection_add_permission().
Previously, the function would assert that the arguments are in
a certain form (strcmp (ptype, "user") == 0), but still document
the such behaviors like regular operation ("[returns] %FALSE if @ptype
or @pitem was invalid"). Don't assert against the function arguments.
Also, if you first set the user to "fo:o", then
nm_setting_connection_add_permission() would accept it -- only at
a later phase, the property setter would assert against such values.
Also, the function would return %FALSE both if the input value was
invalid (an error) and if the value already existed. I think the
function should not treat a duplicate entry like a badly formatted
input.
Now the function does much less asserting of the arguments, but will
return %FALSE only if the values are invalid. And it will silently ignore
duplicate entries.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/636
2020-09-29 11:56:32 +02:00
Thomas Haller
7c6a99eb40
core: merge branch 'th/device-get-applied-connection-no-privs'
https://bugzilla.redhat.com/show_bug.cgi?id=1882380

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/634
2020-09-29 11:51:41 +02:00
Thomas Haller
549b126a5c
device: allow non-privileged users to call device.GetAppliedConnection()
Compare to the connection's GetSettings() call, which is not protected
by policykit permissions. It only checks that the requesting user is
allowed according to "connection.permission".

Previously, device's GetAppliedConnection() requires "network-control"
permissions. This although it only reads a profile, without modifying
anything. That seems unnecessary, also because in the common case the
applied connection is identical to the current settings connection, and
the latter can be read without special permissions.

Don't require a special policykit permission to read the applied
connection.

https://bugzilla.redhat.com/show_bug.cgi?id=1882380
2020-09-29 11:51:14 +02:00
Thomas Haller
eef6c3f88e
core: add nm_auth_is_invocation_in_acl_set_error() helper 2020-09-29 11:51:14 +02:00
Thomas Haller
e8f72a2e4b
gitlab-ci: combine tests for checkpatch/black/msgfmt and nm-code-format.sh
There is no need spawn up two containers (and install similar packages, doing so is
resource intensive), to run two different tests. We can run them in the same
container.

At this point Fedora 33 is not yet fully released. But it will happen soon, so the
image is stable enough for these kinds of tests (and will only get more
stable in the following weeks).

Also no longer collect an artifact with the test output. The test output
is already nicely visible in the gitlab-ci UI. No need to collect it
separately.
2020-09-29 09:46:02 +02:00
Thomas Haller
0e71236d08
contributing: update CONTRIBUTING file with new style guide 2020-09-29 09:19:29 +02:00
Thomas Haller
12823f60af
format: replace tabs with spaces in sheell scripts 2020-09-29 09:19:29 +02:00
Thomas Haller
8841d529e1
format: manually replace remaining tabs with spaces and reformat 2020-09-29 09:12:27 +02:00
Thomas Haller
89ed75df16
format: use spaces instead of indentation for manually formatted parts in "nm-meta-setting-desc.c" 2020-09-29 08:58:11 +02:00
Thomas Haller
2bc3588c1d
all/systemd: reformat ./{shared,src}/systemd/ with new clang-format style
./contrib/scripts/nm-code-format.sh -i
2020-09-28 20:01:29 +02:00
Thomas Haller
8435deecfa
contrib: let "nm-code-format.sh" handle files under ./{shared,src}/systemd/
Only the files under ./{shared,src}/systemd/src are copied from systemd.
The other files should be reformatted too.
2020-09-28 20:01:23 +02:00
Antonio Cardace
e284a23d8c
all: merge branch 'ac/clang-format'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/617
Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-09-28 18:20:54 +02:00
Thomas Haller
740b092fda
format: replace tabs for indentation in code comments
sed -i \
     -e 's/^'$'\t'' \*/     */g' \
     -e 's/^'$'\t\t'' \*/         */g' \
     -e 's/^'$'\t\t\t'' \*/             */g' \
     -e 's/^'$'\t\t\t\t'' \*/                 */g' \
     -e 's/^'$'\t\t\t\t\t'' \*/                     */g' \
     -e 's/^'$'\t\t\t\t\t\t'' \*/                         */g' \
     -e 's/^'$'\t\t\t\t\t\t\t'' \*/                             */g' \
     $(git ls-files -- '*.[hc]')
2020-09-28 16:07:52 +02:00
Antonio Cardace
328fb90f3e
all: reformat all with new clang-format style
Run:

    ./contrib/scripts/nm-code-format.sh -i
    ./contrib/scripts/nm-code-format.sh -i

Yes, it needs to run twice because the first run doesn't yet produce the
final result.

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-09-28 16:07:51 +02:00
Antonio Cardace
b4d8e69cd4
cli: use C comment to not break clang-formatting
clang-format will re-format this in multiple lines, use C comment
to not break compilation after applying code-style with clang-format.

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-09-28 16:01:23 +02:00