summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* format: replace tabs for indentation in code commentsac/clang-formatThomas Haller2020-09-28395-15940/+15940
| | | | | | | | | | | | 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]')
* all: reformat all with new clang-format styleAntonio Cardace2020-09-28859-341016/+353811
| | | | | | | | | | | | 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>
* cli: use C comment to not break clang-formattingAntonio Cardace2020-09-281-2/+1
| | | | | | | 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>
* libnm-core: turn off clang-format for 'glib-mkenums'Antonio Cardace2020-09-283-25/+31
| | | | | | | | | glib-mkenums doesn't work with enums on single line or with enums entries that span multiple lines, turn off automatic formatting for these special cases to not break docs generation. Signed-off-by: Antonio Cardace <acardace@redhat.com>
* clients: exclude code region of nm-meta-setting-desc.c from formattingAntonio Cardace2020-09-281-0/+4
| | | | Signed-off-by: Antonio Cardace <acardace@redhat.com>
* tools: update script for new code-styleAntonio Cardace2020-09-281-5/+20
| | | | Signed-off-by: Antonio Cardace <acardace@redhat.com>
* gitlab-ci: add clang-format test on fedora 33 which run clang-format 11Antonio Cardace2020-09-281-0/+12
| | | | Signed-off-by: Antonio Cardace <acardace@redhat.com>
* checkpatch.pl: adjust checking for indentation/tabsThomas Haller2020-09-281-14/+2
| | | | | | | | | | Our new format gets enforced by clang-format, and we now only use four space indentation, instead of tabs. Adjust the checkpatch script to account for that. Also, now there are probably no cases left where we want to see any tabs in our sources. Complain about any tabs we find.
* clang-format: add clang-format proposed code-style fileAntonio Cardace2020-09-281-1/+1
| | | | Signed-off-by: Antonio Cardace <acardace@redhat.com>
* all: merge branch 'th/getpwuid'Thomas Haller2020-09-289-82/+109
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/635
| * all: use nm_utils_name_to_uid() instead of getpwnam()th/getpwuidThomas Haller2020-09-253-24/+1
| |
| * all: use nm_utils_uid_to_name() instead of getpwuid()Thomas Haller2020-09-256-58/+26
| | | | | | | | | | We shouldn't use non-threadsafe API. We don't really know what other threads (e.g. GDBus' helper thread or GResolver) are doing.
| * shared: add nm_utils_uid_to_name()/nm_utils_name_to_uid() helpersThomas Haller2020-09-252-0/+82
|/ | | | | | | | | | | These are inspired by systemd. We should replace our calls to getpwuid() and getpwnam() with their thread safe variants. We run possibly multiple threads (e.g. helper threads from GDBus and GResolver). It's hard to be sure that they don't also access the functions.
* systemd: merge branch systemd into masterThomas Haller2020-09-2448-790/+1317
|\
| * systemd: update code from upstream (2020-09-24)Thomas Haller2020-09-2447-786/+1311
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a direct dump from systemd git. ====== SYSTEMD_DIR=../systemd COMMIT=960b585ba116cc09055d3f5540a0c73e088d37e4 ( 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"
* | shared,libnm: avoid mixing signed and unsigned integers in ↵Thomas Haller2020-09-242-4/+4
| | | | | | | | netmask_to_prefix()/prefix_to_netmask()
* | initrd: merge branch 'bg/initrd-mac-iface'Beniamino Galvani2020-09-242-28/+133
|\ \ | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/632
| * | initrd: fix parsing IPv6 prefix lengthbg/initrd-mac-ifaceBeniamino Galvani2020-09-232-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | The generator didn't accept prefix lengths > 32 for IPv6: $ src/initrd/nm-initrd-generator --stdout -- ip=[fd01::1]:::40::ens0 <warn> [1600851580.7875] cmdline-reader: Invalid IP mask: 40 https://bugzilla.redhat.com/show_bug.cgi?id=1879795
| * | initrd: accept mac address as interface specifierBeniamino Galvani2020-09-232-25/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | The interface can be specified either by name or MAC address: ip=192.0.2.2:::::eth0 ip=192.0.2.2:::::00-11-22-33-44-55 https://bugzilla.redhat.com/show_bug.cgi?id=1879795
* | | l3cfg: merge branch 'th/l3cfg-10'Thomas Haller2020-09-2419-538/+1361
|\ \ \ | | | | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/629
| * | | l3cfg/tests: add unit test for NML3CfgThomas Haller2020-09-245-9/+377
| | | |
| * | | l3cfg/device: drop NML3Cfg references from NMDevice for nowThomas Haller2020-09-241-297/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding NML3Cfg support is a large effort that is done in parallel. While already parts of the code is merged, it is not actually used yet. Remove the parts from NMDevice that interact with NML3Cfg before we actually start using it. The point is that we might want to do a release before switching over to the new way. For that release, we should not have the unused code in NMDevice. This patch will later be restored and extended.
| * | | l3cfg: fix leaking l3_config_datas array in NML3CfgThomas Haller2020-09-241-37/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | But also take a reference whenever we have any configurations registered. Registering a configuration means to automatically keep the instance alive. Any user must take care to unregister again when it no longer requires the configuration.
| * | | l3cfg: various fixes for l3cfgThomas Haller2020-09-245-147/+244
| | | |
| * | | platform/tests: add nmtstp_platform_ip_addresses_assert() test helperThomas Haller2020-09-242-0/+153
| | | |
| * | | platform/tests: add nmtstp_platform_ip_address_find() test utilThomas Haller2020-09-242-0/+63
| | | |
| * | | platform: add NM_PLATFORM_IP[46]_ADDRESS_INIT() helper macrosThomas Haller2020-09-241-1/+7
| | | |
| * | | tests: use in_addr_t type for IPv4 addresses in test helpersThomas Haller2020-09-241-2/+2
| | | |
| * | | tests: mark static variables in test helpers as thread localThomas Haller2020-09-241-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We should avoid static variables in general, but for test helpers they are often convenient. Mark them as thread local to make them safer to use. The only downsides may only be some runtime overhead, which is negligible for unit tests.
| * | | l3cfg: add nm_l3_config_data_log() functionThomas Haller2020-09-242-0/+270
| | | |
| * | | l3cfg: let l3cfg emit signal on idle handler for platform changesThomas Haller2020-09-244-2/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently all NMDevice instance register to the platform change signals, then if a signal for their IP ifindex appears, they schedule a task on an idle handler. That is wasteful. NML3Cfg already gets a notification on an idle handler and can just re-emit it to the respective listeners. With this, there is only one subscriber to the platform signals (NMNetns) which then multiplexes the signals to the right NML3Cfg instances, and further.
| * | | l3cfg: add nm_l3cfg_has_commited_ipv6_pending_dad() functionThomas Haller2020-09-242-0/+54
| | | | | | | | | | | | | | | | | | | | This will be used for tracking IPv6 addresses that still have DAD pending. Currently, NMDevice does it differently (see "dad6").
| * | | l3cfg: add nm_l3_config_data_lookup_address_6() helperThomas Haller2020-09-242-0/+25
| | | |
| * | | platform: refactor nm_platform_ip6_address_get() function to accept pointer ↵Thomas Haller2020-09-246-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | instead of "struct in6_addr" While C is fine with accepting structs as function arguments, we usually don't do that for IPv6 addresses. Accept a pointer instead.
| * | | l3cfg: track both the commited and the currently merged l3cd instanceThomas Haller2020-09-242-40/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The caller may want to know the merge NML3ConfigData as it would be used for the next commit, without already committing it. Track both the NML3ConfigData instance that is merged from the registered items, and the one that was used the last time during commit.
| * | | l3cfg: allow %NULL argument for nm_l3_config_data_ref()Thomas Haller2020-09-241-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's often convenient not to require the caller to check for %NULL. On the other hand, there are cases where having a %NULL instance is a bug, so gracefully accepting %NULL might hide bugs. Still, change it.
| * | | shared: add NM_PRINT_FMT_QUOTED2() helper macroThomas Haller2020-09-241-0/+3
|/ / /
* | | license: add Daniel to RELICENSE.mdThomas Haller2020-09-241-0/+1
| | | | | | | | | | | | https://mail.gnome.org/archives/networkmanager-list/2020-September/msg00010.html
* | | libnm, shared: merge branch 'th/hwaddr-cleanup'Thomas Haller2020-09-236-88/+83
|\ \ \
| * | | libnm: relax asserting argument for nm_utils_hwaddr_len()Thomas Haller2020-09-231-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nm_utils_hwaddr_len() isn't very useful. It's documented to only accept two possible input values (ARPHRD_ETHER and ARPHRD_INFINIBAND) for which the respective return values are well known. In particular, asserting that the input value is one of the two values means it becomes harder to extend the function (and make it more useful). Because, then the user would need to call: #if NM_VERSION > NM_VERSION_1_XX len = nm_utils_hwaddr_len (ARPHDR_FOO); #else len = 0 #endif and then it would introduce an unnecessary run time dependency on NM_VERSION_1_XX. Instead, just document to return 0 if the value is not supported.
| * | | cloud-setup: add code comment to nmcs_utils_hwaddr_normalize()Thomas Haller2020-09-231-1/+3
| | | |
| * | | shared: move nm_utils_hwaddr_ntoa_buf() to shared/ as _nm_utils_hwaddr_ntoa()Thomas Haller2020-09-235-22/+20
| | | | | | | | | | | | | | | | | | | | The name is better as it mirrors nm_utils_hwaddr_aton(). Also, move it to shared/ so it can be reused (and inlined).
| * | | shared: move _nm_utils_hwaddr_aton() to shared/Thomas Haller2020-09-233-40/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _nm_utils_hwaddr_aton() is only a wrapper around nm_utils_hexstr2bin_full(). But it abstracts the "right" parameters for what we consider a valid MAC address and what not. As such, this function is useful. Move it to "shared/" and replace the dupicate macro hwaddr_aton() with it.
| * | | libnm: cleanup nm_utils_hwaddr_canonical() and nm_utils_hwaddr_valid()Thomas Haller2020-09-231-21/+17
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - only call hwaddr_aton() once per function. Also, pass it sizeof(buf) as buffer size, it seems more correct. - the only downside is that we now would always first parse up to 20 characters, before comparing the requested length. Previously, a MAC address that was too long was rejected earlier (and the parsing aborted earlier). But that is a tiny overhead, also we expect that in common cases the MAC addresses are in fact of the right size, then there is no difference.
* | | all/style: remove duplicate semicolon (";;") in sourcesThomas Haller2020-09-2313-17/+17
| | |
* | | license: add Kjartan to RELICENSE.mdThomas Haller2020-09-231-0/+1
| | | | | | | | | | | | https://mail.gnome.org/archives/networkmanager-list/2020-September/msg00008.html
* | | all: require a semicolon after NM_CACHED_QUARK_FCN()Thomas Haller2020-09-2310-19/+19
| | |
* | | clang-format: proposed styleAntonio Cardace2020-09-231-2/+2
| | |
* | | contrib/release: implement "rc1" release modeThomas Haller2020-09-231-19/+71
| | |
* | | libnm: hide nm_setting_ip_config_next_valid_dns_option() function from headersThomas Haller2020-09-223-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nm_setting_ip_config_next_valid_dns_option() API was added in libnm 1.2, but it was never exported in the ABI of libnm. It thus was unusable, and any user trying to link against it would have been unable to do so. Hide the API now entirely. It doesn't seem a very nice API. If we want to allow the user to validate option names, we should expose such a function to validate an option (not to fetch the next valid option from a profile). Fixes: 019943bb5d9e ('libnm-core: add dns-options property to NMSettingIPConfig')