summaryrefslogtreecommitdiff
path: root/shared
Commit message (Collapse)AuthorAgeFilesLines
* n-dhcp4: arm timers in bound stateBeniamino Galvani2019-09-181-1/+1
| | | | | | | Arm timers when the bound state is reached, otherwise the lease is never renewed. https://github.com/nettools/n-dhcp4/pull/4
* all: SPDX header conversionLubomir Rintel2019-09-1062-922/+65
| | | | | $ find * -type f |xargs perl contrib/scripts/spdx.pl $ git rm contrib/scripts/spdx.pl
* shared/tests: add nmtst_keyfile_get_num_keys() helperThomas Haller2019-08-271-0/+23
|
* shared/hash: implement nm_hash_obfuscate_ptr() as inline function instead of ↵Thomas Haller2019-08-231-9/+9
| | | | | | | | | | | | | | macro There is really no reason for this to be a macro. Our hash-related helpers (like nm_hash_update_val()) are macros because they do some shenigans to accept arguments of different (compile-time) types. But the arguments for nm_hash_obfuscate_ptr() are well known and expected of a certain form. Note that with "-O2" some quick testing shows that the compiler no longer inlines the function. But I guess that's fine, probably the compiler knows best anyway.
* shared: allow negative timestamps for nm_utils_monotonic_timestamp_as_boottime()Thomas Haller2019-08-211-7/+11
|
* shared: use nm_auto_unref_gtypeclass in _nm_utils_enum_from_str_full()Thomas Haller2019-08-161-2/+1
|
* shared,all: return boolean success from nm_utils_file_get_contents()Thomas Haller2019-08-083-110/+109
| | | | | | | | | | | | | | | | | | | | | | ... and nm_utils_fd_get_contents() and nm_utils_file_set_contents(). Don't mix negative errno return value with a GError output. Instead, return a boolean result indicating success or failure. Also, optionally - output GError - set out_errsv to the positive errno (or 0 on success) Obviously, the return value and the output arguments (contents, length, out_errsv, error) must all agree in their success/failure result. That means, you may check any of the return value, out_errsv, error, and contents to reliably detect failure or success. Also note that out_errsv gives the positive(!) errno. But you probably shouldn't care about the distinction and use nm_errno_native() either way to normalize the value.
* shared: let nm_utils_file_set_contents() return a errno error codeThomas Haller2019-08-082-22/+19
| | | | | | | | | | | | | | | | nm_utils_file_set_contents() is a re-implementation of g_file_set_contents(), as such it returned merely a boolean success value. It's sometimes interesting to get the native error code. Let the function deviate from glib's original g_file_set_contents() and return the error code (as negative value) instead. This requires all callers to change. Also, it's potentially a dangerous change, as this is easy to miss. Note that nm_utils_file_get_contents() also returns an errno, and already deviates from g_file_get_contents() in the same way. This patch resolves at least the inconsistency with nm_utils_file_get_contents().
* shared: add nm_c_list_elem_find_first() helper macroThomas Haller2019-08-081-9/+20
| | | | | | | | | | | | | - add nm_c_list_elem_find_first() macro that takes a predicate and returns the first match. This macro has a non-function-like behavior, which we often try to avoid because macros should behave like functions. In this case it's however convenient, so let's do it. Also, despite being non-function-like, it should be pretty hard to use wrongly. - rename nm_c_list_elem_find_first() to nm_c_list_elem_find_first_ptr().
* n-dhcp4: allocate memory of right size in n_dhcp4_client_probe_option_new()Thomas Haller2019-08-081-1/+1
| | | | | | Non-critical, as the allocated memory was larger than needed. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/224
* build: fix meson warning about path separator in targetBeniamino Galvani2019-08-052-21/+25
| | | | | | | | | | Fix the following: WARNING: Target "nm-utils/tests/test-shared-general" has a path separator in its name. This is not supported, it can cause unexpected failures and will become a hard error in the future. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/217
* n-dhcp4: remove dead codeBeniamino Galvani2019-08-021-4/+1
| | | | Reported by coverity.
* n-dhcp4: avoid "-Werror=declaration-after-statement" warning with static_assertThomas Haller2019-08-021-2/+2
| | | | | | | | | | | | | | | When we build n-dhcp4 for NetworkManager we get a compiler warning. This can also be reproduced by building n-dhcp4 alone: $ CFLAGS='-Werror=declaration-after-statement' meson build && ninja -C build ... [36/47] Compiling C object 'src/25a6634@@ndhcp4-private@sta/n-dhcp4-outgoing.c.o'. FAILED: src/25a6634@@ndhcp4-private@sta/n-dhcp4-outgoing.c.o ccache cc -Isrc/25a6634@@ndhcp4-private@sta -Isrc -I../src -Isubprojects/c-list/src -I../subprojects/c-list/src -Isubprojects/c-siphash/src -I../subprojects/c-siphash/src -Isubprojects/c-stdaux/src -I../subprojects/c-stdaux/src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c11 -g -D_GNU_SOURCE -Werror=declaration-after-statement -fPIC -fvisibility=hidden -fno-common -MD -MQ 'src/25a6634@@ndhcp4-private@sta/n-dhcp4-outgoing.c.o' -MF 'src/25a6634@@ndhcp4-private@sta/n-dhcp4-outgoing.c.o.d' -o 'src/25a6634@@ndhcp4-private@sta/n-dhcp4-outgoing.c.o' -c ../src/n-dhcp4-outgoing.c ../src/n-dhcp4-outgoing.c: In function ‘n_dhcp4_outgoing_new’: ../src/n-dhcp4-outgoing.c:63:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 63 | static_assert(N_DHCP4_NETWORK_IP_MINIMUM_MAX_SIZE >= N_DHCP4_OUTGOING_MAX_PHDR + | ^~~~~~~~~~~~~
* n-acd: fix leaking socket handle in n_acd_socket_new() when setsockopt() failsThomas Haller2019-08-021-2/+4
| | | | Found by Coverity.
* shared: refactor nm_utils_g_slist_strlist_cmp() to avoid dead-code warning ↵th/coverityThomas Haller2019-08-021-3/+8
| | | | | | | from Coverity Coverity sees that "return 0" cannot be reached. Refactor the code, to avoid the warning.
* shared: try avoid coverity warning in _nm_utils_user_data_unpack()Thomas Haller2019-08-021-1/+1
| | | | | | | | | | Coverity says CID 202453 (#1 of 1): Wrong sizeof argument (SIZEOF_MISMATCH)suspicious_sizeof: Passing argument user_data of type gconstpointer and argument (gsize)nargs * 8UL /* sizeof (gconstpointer) */ to function g_slice_free1 is suspicious. Let's pass instead the "data" pointer. It's the same, but maybe that avoids the warning.
* shared: explicitly ignore return value of g_utf8_validate()Thomas Haller2019-08-021-1/+1
| | | | | | | Coverity doesn't like us ignoring the return value, although we really only care about the "p" output pointer. Try casting the result to (void), maybe that silences Coverity.
* shared: fix non-serious bug with bogus condition in assertion in ↵Thomas Haller2019-08-011-1/+1
| | | | nm_key_file_db_ref()
* shared: add NM_HASH_SEED_16() macroThomas Haller2019-07-311-0/+3
|
* release: bump version to 1.21.0 (development)1.21.0-devThomas Haller2019-07-291-0/+1
|
* systemd: merge branch systemd into masterThomas Haller2019-07-2634-163/+452
|\
| * systemd: update code from upstream (2019-07-26)Thomas Haller2019-07-2631-159/+1917
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a direct dump from systemd git. ====== SYSTEMD_DIR=../systemd COMMIT=608807c163921b0dfbaf646b3ec19fc9b71e6451 ( cd "$SYSTEMD_DIR" git checkout "$COMMIT" git reset --hard git clean -fdx ) git ls-files -z :/src/systemd/src/ \ :/shared/systemd/src/ \ :/shared/nm-utils/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_nmutils() { mkdir -p "./shared/nm-utils/" cp "$SYSTEMD_DIR/$1" "./shared/nm-utils/${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-dhcp6-client.h" nm_copy_sd_core "src/systemd/sd-dhcp6-lease.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_nmutils "src/basic/unaligned.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/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_socket.h" nm_copy_sd_shared "src/basic/missing_stat.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.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/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"
* | shared: add nm_g_slice_free() helperThomas Haller2019-07-251-0/+5
| | | | | | | | | | | | How odd that such a macro does not exist yet. It seems like the majorities of calls to g_slice_free() could be replaced by this.
* | core: improve code comment and add assertion to ↵Thomas Haller2019-07-251-7/+9
| | | | | | | | nm_utils_monotonic_timestamp_as_boottime()
* | config: simplify no-auto-default list handling and sort entriesThomas Haller2019-07-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | - don't let no_auto_default_from_file() do any preprocessing of the lines that it reads. It merely splits the lines at '\n' and utf8safe-unescapes them. This was previously duplicated also by NMConfigData's property setter. We don't need to do it twice. - sort the lines. This makes the entire handling O(n*ln(n)) instead of O(n^2). Also, sorting effectively normalizes the content, and it's desirable to have one true representation of what we write.
* | shared: accept %NULL strings in nm_utils_strv_sort()Thomas Haller2019-07-251-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | In particular when calling nm_utils_strv_sort() with a positive length argument, then this is not a %NULL terminated strv arrary. That may mean that it makes sense for the input array to contain %NULL strings. Use a strcmp() function that accepts %NULL too. While this is not used at the moment, I think nm_utils_strv_sort() should accept %NULL strings beause otherwise it's a possibly unexpected restriction of its API. The function should handle sensible input gracefully.
* | shared: add nm_strcmp0_p_with_data() helperThomas Haller2019-07-252-0/+10
| |
* | shared: add nm_strcmp_with_data()Thomas Haller2019-07-252-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is like strcmp(), but has a signature suitable for GCompareDataFunc. This is necessary with nm_utils_ptrarray_find_binary_search() to search a sorted strv array. The fault is here really C, which doesn't allow inline static functions. So, you need all kinds of slightly different flavors for the same callbacks (with or without user-data). Note that glib2 internally just casts strcmp() to GCompareDataFunc ([1]), relying on the fact how arguments are passed to the function and ignoring the additional user-data argument. But I find that really ugly and probably not permissible in general C. Dunno whether POSIX would guarantee for this to work. I'd rather not do such function pointer casts. [1] https://gitlab.gnome.org/GNOME/glib/blob/0c0cf59858abb3f8464bc55f596f9fbf599ac251/glib/garray.c#L1792
* | shared: add nm_utils_clock_gettime_*() utilThomas Haller2019-07-232-0/+39
| | | | | | | | | | | | | | | | Using clock_gettime() directly is a bit inconvenient. We usually want to combine the fields of struct timespec into one timestamp (for example, in unit nanoseconds). Add a helper function to do that.
* | shared: suppress -Werror=stringop-overflow= warning in nm_strndup_a()Thomas Haller2019-07-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nm_strndup_a() uses strncpy() because we want the behavior of clearing out the memory after the first NUL byte. But that can cause a compiler warning: CC src/settings/plugins/keyfile/libNetworkManager_la-nms-keyfile-utils.lo In file included from ../../shared/nm-default.h:279, from ../../src/settings/plugins/keyfile/nms-keyfile-utils.c:20: In function ‘_nm_strndup_a_step’, inlined from ‘nms_keyfile_loaded_uuid_is_filename’ at ../../src/settings/plugins/keyfile/nms-keyfile-utils.c:65:9: ../../shared/nm-glib-aux/nm-macros-internal.h:1661:3: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=] 1661 | strncpy (s, str, len); | ^~~~~~~~~~~~~~~~~~~~~ ../../src/settings/plugins/keyfile/nms-keyfile-utils.c: In function ‘nms_keyfile_loaded_uuid_is_filename’: ../../src/settings/plugins/keyfile/nms-keyfile-utils.c:48:8: note: length computed here 48 | len = strlen (filename); | ^~~~~~~~~~~~~~~~~ It's true that the len argument of _nm_strndup_a_step() depends on the string length of the source string. But in this case it's safe, because we checked that the destination buffer is exactly the right size too. By that reasoning we should use memcpy() or strcpy(), but both are unsuitable. That is because we want nm_strndup_a() to behave like strndup(), which means we need to handle cases where the len argument is larger than the string length of the source string. That is, we want always to return a buffer of size len+1, but we want to copy only the characters up to the first NUL byte, and clear out the rest. That's what strncpy() does for us. Silence the warning.
* | shared: add NM_CMP_DIRECT_STRCMP() macroThomas Haller2019-07-101-0/+3
| |
* | shared: optimize nm_utils_error_set() for string literalsThomas Haller2019-07-101-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If there is only one argument, we can assume this is a plain string. That is especially the case, because g_set_error() is G_GNUC_PRINTF() and would warn if this would be a format string with missing parameters. This is for convenience. Previously, one was compelled to explicitly choose between nm_utils_error_set_literal() and nm_utils_error_set(). Now, it automatically chooses. Note that there are a few things that won't work, like nm_utils_error_set (error, code, "bogus %u escape"); But that's good. You get a compiler warning (as you used to) and it's clear in this case you really need nm_utils_error_set_literal().
* | shared: add nm_pdirect_hash()/nm_pdirect_equal()Thomas Haller2019-07-102-0/+31
| | | | | | | | | | | | | | | | | | This follows a pointer to a pointer and compares them. In a sense it's like nm_pstr_*(), which follow a pointer to a string. However, these functions use direct pointer comparison. The purpose is when you hash a key that has as first field a pointer value (and then compare them by pointer equality).
* | n-dhcp4: client/probe: fix memory leakBeniamino Galvani2019-07-051-0/+1
| | | | | | | | | | | | | | | | | | The probe takes a reference to the current lease and so it must release it upon destruction. Signed-off-by: Beniamino Galvani <bgalvani@redhat.com> https://github.com/nettools/n-dhcp4/pull/1
* | n-dhcp4: client/connection: fix memory leakBeniamino Galvani2019-07-051-0/+1
| | | | | | | | | | | | | | | | Free the request when the connection gets destroyed. Signed-off-by: Beniamino Galvani <bgalvani@redhat.com> https://github.com/nettools/n-dhcp4/pull/1
* | shared: add nm_sd_dns_name_to_wire_format()Beniamino Galvani2019-07-052-0/+14
| | | | | | | | | | | | Add nm_sd_dns_name_to_wire_format() based on systemd utilities to convert a name into its wire format according to RFC 1035 section 3.1. It will be used to build the content of the DHCP FQDN option.
* | systemd: add dns-domain utils to systemd static libraryBeniamino Galvani2019-07-053-0/+1503
| | | | | | | | | | | | | | dns-domain.c contains useful functions for manipulating DNS names. Add it to the systemd static library we build in shared/, similarly to what we already do for other utility files that were originally in src/systemd/src/basic/.
* | n-dhcp4: avoid {net,linux}/if.h clashes on old distrosTom Gundersen2019-07-054-7/+8
| | | | | | | | | | | | | | In particular, avoid including linux/netdevice.h from headers. This is not a problem on newer distros, but required for CentOS 7.6. Signed-off-by: Tom Gundersen <teg@jklm.no>
* | shared/n-dhcp4: avoid c_min() macro to work with old GCCTom Gundersen2019-07-052-4/+13
| | | | | | | | | | This is required for the CI to pass, as CentOS has a too old version of GCC. Ideally this patch should be dropped.
* | dhcp: add nettools dhcp4 clientTom Gundersen2019-07-051-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is inspired by the existing systemd integration, with a few differences: * This parses the WPAD option, which systemd requested, but did not use. * We hook into the DAD handling, only making use of the configured address once DAD has completed successfully, and declining the lease if it fails. There are still many areas of possible improvement. In particular, we need to ensure the parsing of all options are compliant, as n-dhcp4 treats all options as opaque, unlike sd-dhcp4. We probably also need to look at how to handle failures and retries (in particular if we decline a lease). We need to query the current MTU at client startu, as well as the hardware broadcast address. Both these are provided by the kernel over netlink, so it should simply be a matter of hooking that up with NM's netlink layer. Contribution under LGPL2.0+, in addition to stated licenses.
* | systemd: merge branch systemd into masterBeniamino Galvani2019-07-0534-407/+710
|\ \ | |/
| * systemd: update code from upstream (2019-07-04)Beniamino Galvani2019-07-0433-407/+704
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a direct dump from systemd git. ====== SYSTEMD_DIR=../systemd COMMIT=52d8bcd131e7f3c9b7629412302e1ea46ddb70ca ( cd "$SYSTEMD_DIR" git checkout "$COMMIT" git reset --hard git clean -fdx ) git ls-files -z :/src/systemd/src/ \ :/shared/systemd/src/ \ :/shared/nm-utils/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_nmutils() { mkdir -p "./shared/nm-utils/" cp "$SYSTEMD_DIR/$1" "./shared/nm-utils/${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/shared/dns-domain.c" nm_copy_sd_core "src/shared/dns-domain.h" 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-dhcp6-client.h" nm_copy_sd_core "src/systemd/sd-dhcp6-lease.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_nmutils "src/basic/unaligned.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/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_socket.h" nm_copy_sd_shared "src/basic/missing_stat.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.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/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/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"
* | shared: gracefully accept %NULL strings for NM_STR_HAS_PREFIX() and ↵Thomas Haller2019-07-041-4/+9
| | | | | | | | | | | | | | NM_STR_HAS_SUFFIX() In case it wasn't obvious to a caller, allow %NULL as valid string argument. Just be a bit more forgiving and fault-tolerant.
* | shared: add nm_c_list_elem_free_steal() utilThomas Haller2019-07-021-0/+12
| |
* | libnm: add nm_connection_to_dbus_full() with options argumentThomas Haller2019-06-281-1/+1
| | | | | | | | No options are implemented yet.
* | shared: add nm_utils_strv_dup() utilThomas Haller2019-06-282-0/+58
| |
* | shared: add nm_c_list_free_all() macroThomas Haller2019-06-281-0/+10
| |
* | shared: add nm_clear_error() and patch g_clear_error() to use this inlinable ↵Thomas Haller2019-06-261-0/+24
| | | | | | | | variant
* | shared/glib: unconditionally redefine g_object_ref()/g_object_ref_sink() as ↵Thomas Haller2019-06-261-2/+10
| | | | | | | | typesafe macro
* | shared: add nm_utils_file_stat() utilThomas Haller2019-06-262-0/+27
| | | | | | | | | | A small convenience function to call stat(). The difference is that the function returns an error code.