Commit Graph

1103 Commits

Author SHA1 Message Date
Thomas Haller
ee9e1ceefc shared: avoid allocating temporary buffer for nm_utils_named_values_from_strdict()
Iterating hash tables gives an undefined order. Often we want to have
a stable order, for example when printing the content of a hash or
when converting it to a "a{sv}" variant.

How to achieve that best? I think we should only iterate the hash once,
and not require additional lookups. nm_utils_named_values_from_strdict()
achieves that by returning the key and the value together. Also, often
we only need the list for a short time, so we can avoid heap allocating
the list, if it is short enough. This works by allowing the caller to
provide a pre-allocated buffer (usually on the stack) and only as fallback
allocate a new list.
2020-06-19 17:07:25 +02:00
Thomas Haller
4d6b96b48f shared: make NMUtilsNamedValue.value_ptr non const
If the value pointer is const, it is commonly inconvenient and requires
a cast. Requiring casts on a common base does not increase type safety,
but is annoying.
2020-06-19 17:07:19 +02:00
Thomas Haller
edfe9fa9a2 glib: always re-implement g_steal_pointer()
g_steal_pointer() is marked as GLIB_AVAILABLE_STATIC_INLINE_IN_2_44,
that means we get a deprecated warning. Avoid that. We anyway
re-implement the macro so that we can use it before 2.44 and so
that it always does the typeof() cast.
2020-06-15 15:56:30 +02:00
Thomas Haller
ecf32c2c8f systemd: merge branch systemd into master 2020-06-13 17:08:22 +02:00
Thomas Haller
bbf57b114e systemd: update code from upstream (2020-06-13)
This is a direct dump from systemd git.

======

SYSTEMD_DIR=../systemd
COMMIT=6d0f38017c7476883103080372505d4811112346

(
  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-06-13 15:38:01 +02:00
Thomas Haller
393bc8c8f6 shared: add nm_utils_buf_utf8safe_escape_cp() helper 2020-06-11 16:49:26 +02:00
Thomas Haller
39127758bd shared: add nm_utils_ether_addr_equal(), nm_utils_ether_addr_cmp() 2020-06-11 12:00:52 +02:00
Thomas Haller
fce73b1c82 shared: add nm_g_variant_builder_add_sv_*() helpers 2020-06-11 12:00:52 +02:00
Thomas Haller
3f19c1fa52 shared/tests: add nmtst_assert_variant_bytestring() helper 2020-06-11 12:00:49 +02:00
Thomas Haller
caa70a50d7 all: move "shared/nm-libnm-aux" to "libnm/nm-libnm-aux"
Like the previous commit. Move code that depends on libnm out
of shared to avoid circular dependency.

Also add a readme file explaining the reason for existence of
the helper library.
2020-06-11 10:53:50 +02:00
Thomas Haller
a9408e3497 all: move "shared/nm-libnm-core-aux" to "libnm-core/nm-libnm-core-aux"
Like the previous commit. Move code that depends on libnm-core out
of shared to avoid circular dependency.

Also add a readme file explaining the reason for existence of
the helper libraries nm-libnm-core-intern and nm-libnm-core-aux.
2020-06-11 10:53:50 +02:00
Thomas Haller
e17a067e68 all: move "shared/nm-libnm-core-intern" to "libnm-core/nm-libnm-core-intern"
The "shared" directory is used by libnm-core, it should thus only depend on
code that is in the "shared" directory. Otherwise there is a circular
dependency, and meson's subdir() does not work nicely.

Also, libnm-core is really part of (and also an extension of) libnm-core,
so it belongs there.

I guess, the original idea was that this is also an extension for libnm,
so another project could take these utility functions (by copying them
into their source tree) and use them. That is still possible, it's
just that the sources are no longer under the shared directory.

Also add a readme to explain the non-obvious meaning of these files.
2020-06-11 10:53:50 +02:00
Thomas Haller
b760dee8c8 all: move "shared/nm-keyfile" to "libnm-core/nm-keyfile"
Originally, these files were part of libnm-core and linked together.
However, that is a licensing violation, because the code is GPL-2.0+
licensed, while libnm-core also gets linked with libnm (it must thus
be LGPL-2.1+). The original intent behind moving the code to "shared/"
was to avoid the licensing issue, but also to prepare when we would add
a separate, GPL licensed libnm-keyfile. However, currently we hope to
be able to relicense the code, so that it actually could be exposed as
part of libnm. This is work in progress at ([1]).

[1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/ ## 517

Anyway, the current directory layout is problematic. libnm-keyfile
depends on libnm-core, while libnm-core depends on code under shared.
That means, there is a circular dependency and meson's subdir() does
not work well.

Move the code.
2020-06-11 10:53:50 +02:00
Thomas Haller
96c9703b50 core: add "external" flag for connections of external devices
When a device is not marked as unmanaged, but also not actively managed
by NetworkManager, then NetworkManager will generate an in-memory
profile to represent the active state, if the device is up and
configured (with an IP address).

Such profiles are commonly named like "eth0", and they are utterly
confusing to users, because they look as if NetworkManager actually
manages the device, when it really just shows that somebody else configures
the device.

We should express this better in the UI, hence add flags to indicate
that.

In practice, such profiles are UNSAVED, NM_GENERATED, and VOLATILE. But
add an explicit flag to represent that.

https://bugzilla.redhat.com/show_bug.cgi?id=1816202
2020-06-10 19:45:46 +02:00
Beniamino Galvani
f695dd8de3 libnm-core: support variant attributes of type int32 and uint64 2020-06-08 15:31:41 +02:00
Beniamino Galvani
f768bd8091 shared: add FIXME about interpretation of variant-attribute bytestrings 2020-06-08 15:31:41 +02:00
Thomas Haller
e2f83d4e92 keyfile: add NMKeyfileHandlerFlags
nm_keyfile_read() and nm_keyfile_write() will be public API.
As such, it must be flexible and extendible for future needs.
There is already the handler callback that fully solves this
(e.g. a future handler event could request whether a certain
behavior is enabled or not).

As additional possibility for future extension, add a flags
argument. Currently no flags are implemented.
2020-06-05 09:17:21 +02:00
Thomas Haller
00b3a3505a keyfile: add nm_keyfile_handler_data_warn_get() and construct message lazy
Add an accessor for the warning event.

Also, as we now have an accessor, we can construct the warning
message only if it actually needed.
2020-06-05 09:17:20 +02:00
Thomas Haller
4230a1d4fb keyfile: add accessors for NMKeyfileHandlerData
For introspection/bindings it is cumbersome to access the
fields of the NMKeyfileHandlerData struct. Instead add accessor
functions.

Also, we wouldn't want to expose the struct in public API directly,
because it makes it harder to extend it without breaking ABI.
2020-06-05 09:17:20 +02:00
Thomas Haller
7d47a8fdbf keyfile: add handler context for all parser callbacks
From inside a callback 4 properties are potentially interesting
to all callbacks: the currenty group, key, setting and property-name.

Refactor the code to track these properties in NMKeyfileHandlerData
and distinguish between the property name and the keyfile key.
2020-06-05 09:17:19 +02:00
Thomas Haller
5c67b72bb7 keyfile: use cleanup attribute for GBytes and GByteArray 2020-06-05 09:17:19 +02:00
Thomas Haller
021726e54e keyfile: don't check for info->error before calling handle_warn()
When an error gets set, we should abort right away. We should
not come into a situation where we would try to emit another warning.

Don't check for a condition that should never happen and assert
against it.
2020-06-05 09:17:19 +02:00
Thomas Haller
8afb8ba819 keyfile: style cleanup calling handle_warn() 2020-06-05 09:17:18 +02:00
Thomas Haller
ab7d0c62f9 keyfile: rework error reporting from read/write handler
Setting the error on the callback does not work well from bindings.
Instead, let bindings call a (future) nm_keyfile_handler_data_fail_with_error()
function on the handler_data to indicate failure.
2020-06-05 09:17:18 +02:00
Thomas Haller
e3d7ba89e5 keyfile: rename handler variable in KeyfileReaderInfo and KeyfileWriterInfo 2020-06-05 09:17:18 +02:00
Thomas Haller
0bfdb26973 keyfile: add NMKeyfileHandlerData typedef for arguments of keyfile callbacks
As the keyfile handler callback will become public API, it needs to be
usable via bindings. A plain void pointer is not usable. Instead, add
a new type that can be used via introspection.
2020-06-05 09:17:18 +02:00
Thomas Haller
18c1fe6ed8 keyfile: merge NMKeyfile{Read,Write}Type as NMKeyfileHandlerType
This will become public API. The enum for read and write callback
serves very similar purposes. Merge them so that we have fewer
types in the public API.
2020-06-05 09:17:14 +02:00
Thomas Haller
65b6fc7871 nettools: reimport nettools' n-dhcp4 and rework logging
git subtree pull --prefix shared/n-dhcp4/ git@github.com:nettools/n-dhcp4.git master --squash
2020-06-03 22:34:22 +02:00
Thomas Haller
53f27cfd40 shared/n-acd: reimport
git subtree pull --prefix shared/n-acd git@github.com:nettools/n-acd.git master --squash
2020-06-03 22:14:39 +02:00
Thomas Haller
fc11843fdc shared/c-siphash: reimport
git subtree pull --prefix shared/c-siphash git@github.com:c-util/c-siphash.git master --squash
2020-06-03 22:10:22 +02:00
Thomas Haller
f9641b6b47 shared/c-rbtree: reimport
git subtree pull --prefix shared/c-rbtree git@github.com:c-util/c-rbtree.git master --squash
2020-06-03 22:08:05 +02:00
Thomas Haller
a75d7de78b shared/c-stdaux: reimport
git subtree pull --prefix shared/c-stdaux git@github.com:c-util/c-stdaux.git master --squash
2020-06-03 22:05:14 +02:00
Thomas Haller
70c71151c6 shared/c-list: reimport
git subtree pull --prefix shared/c-list git@github.com:c-util/c-list.git master --squash
2020-06-03 22:00:56 +02:00
Thomas Haller
82a468c9ad keyfile: suppress bogus warning about [ethernet-s390-options] setting
S390 options are stored in a separate [ethernet-s390-options] section.
This group must not be interpreted as a NMSetting name, otherwise we
log a bogus warning:

  <warn>  [1590523563.7757] keyfile: ethernet-s390-options: invalid setting name 'ethernet-s390-options'

Fixes: cf9b8d3bad ('libnm/keyfile: implement ethernet.s390-options in keyfile')
2020-05-26 22:45:10 +02:00
Thomas Haller
618ae93b94 libnm: rename nm_setting_gendata_*() API to nm_setting_option_*()
We are going to expose some of this API in libnm.

The name "gendata" (for "generic data") is not very suited. Instead,
call the public API nm_setting_option_*(). This also brings no naming
conflict, because currently no API exists with such naming.

Rename the internal API, so that it matches the API that we are going
to expose next.
2020-05-22 15:58:08 +02:00
Thomas Haller
dcb4ed2cb1 ethtool: add and use _NM_ETHTOOL_ID_FEATURE_AS_IDX() macro 2020-05-22 15:58:08 +02:00
Thomas Haller
1f4b190934 platform: make states of NMEthtoolCoalesceState indexed by ethtool_id
We already have NMEthtoolID to handle coalesce options in a way that is
convenient programmatically. That is, we can iterate over all valid
coalesce options (it's just an integer) and use that in a more generic
way.

If NMEthtoolCoalesceState names all fields explicitly, we need explicit
code that names each coalesce option. Especially since NMEthtoolCoalesceState
is an internal and intermediate data structure, this is cumbersome
and unnecessary.

Thereby it also fixes the issue that nm_platform_ethtool_init_coalesce() has a
NMPlatform argument without actually needing it.
nm_platform_ethtool_init_coalesce() does not operate on a NMPlatform
instance, and should not have the appearance of being a method of
NMPlatform.
2020-05-22 15:58:08 +02:00
Antonio Cardace
e04e5a5c2a ifcfg-rh: add support for ethtool ring settings
Also update unit tests.

https://bugzilla.redhat.com/show_bug.cgi?id=1614700
2020-05-20 10:55:01 +02:00
Antonio Cardace
7109ac667a ethtool: add ring settings
This is the initial support for ring settings and only allows
getting/setting, nothing is yet implemented in nm-device.

Also add unit test.

https://bugzilla.redhat.com/show_bug.cgi?id=1614700
2020-05-20 10:55:01 +02:00
Thomas Haller
0480448e66 n-dhcp4: style fix in n_dhcp4_client_probe_transition_accept()
The upstream fix also doesn't have this whitespace.
Keep the sources in sync.

0be7033dd9
2020-05-18 09:54:28 +02:00
Thomas Haller
ef9fe85096 shared: move _nm_utils_format_variant_attributes*() API to "shared/nm-glib-aux"
This has no dependency on libnm, libnm-core, or src. Move it to the
general purpose toolbox.
2020-05-14 17:21:12 +02:00
Thomas Haller
3c581cbb78 build: fix redefinition of VALGRIND define in "nm-sd-adapt-shared.h"
When configuring with sanitizers enabled, ./configure.ac sets
-DVALGRIND=1 in the CFLAGS.

This causes a compilation error later:

  $ /bin/sh ./libtool  --tag=CC   --mode=compile gcc ... -DVALGRIND=1 ... src/dhcp/nm-dhcp-nettools.c
  ...
  In file included from src/dhcp/nm-dhcp-nettools.c:16:
  ./shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h:73: error: "VALGRIND" redefined [-Werror]
   #define VALGRIND 0
2020-05-13 17:21:01 +02:00
Thomas Haller
bb19f6e29c shared: add NM_UTILS_NAMED_VALUE_INIT() macro 2020-05-13 10:28:04 +02:00
Thomas Haller
0f22f77b1c shared: support stripping whitespace from nm_utils_buf_utf8safe_unescape()
When parsing user input if is often convenient to allow stripping whitespace.
Especially with escaped strings, the user could still escape the whitespace,
if the space should be taken literally.

Add support for that to nm_utils_buf_utf8safe_unescape().

Note that this is not the same as calling g_strstrip() before/after
unescape. That is, because nm_utils_buf_utf8safe_unescape() correctly
preserves escaped whitespace. If you call g_strstrip() before/after
the unescape, you don't know whether the whitespace is escaped.
2020-05-13 10:28:04 +02:00
Thomas Haller
5fe447d4a6 shared: assert that nm_utils_buf_utf8safe_unescape() doesn't reallocate memory
We want to use the function to unescape (compress) secrets. As such, we want
to be sure that no secrets are leaked in memory due to growing the buffer with
realloc. In fact, reallocation should never happen. Assert for that.

As reallocation cannot happen, we could directly fill a buffer with
API like nm_utils_strbuf_*(). But NMStrBuf has low overhead even in this
case.
2020-05-13 10:28:04 +02:00
Antonio Cardace
b0240db068 ethtool: add coalesce settings
This is the initial support for coalesce settings and only allows
getting/setting, nothing is yet implemented in nm-device.

Also add unit test.

https://bugzilla.redhat.com/show_bug.cgi?id=1614700
2020-05-13 10:15:23 +02:00
Antonio Cardace
858fb211ad keyfile: add support for uint32 variant types when using gendata
https://bugzilla.redhat.com/show_bug.cgi?id=1614700
2020-05-13 10:15:23 +02:00
Thomas Haller
0d7d2425c4 ethtool: accept %NULL as argument for nm_ethtool_data_get_by_optname()/nm_ethtool_id_get_by_name()
Often it is useful to not accept %NULL as input argument, to catch bugs.
For simple functions like nm_ethtool_id_get_by_name(), such limitations
are more annoying than helpful. Gracefully accept %NULL and treat is
like an invalid ethtool option.
2020-05-11 16:18:22 +02:00
Thomas Haller
2027ff50af ethtool: use NM_MORE_ASSERT_ONCE() in _ASSERT_data() to assert immutable data only once
_ASSERT_data() checks static, immutable data. Even with more asserts enabled,
there is no need to do that every time. Use NM_MORE_ASSERT_ONCE().

Note that NM_MORE_ASSERT_ONCE() will return constant FALSE, when build
without a sufficiently high assertion level. That means, the compiler
will just optimize the rest away.
2020-05-11 14:47:43 +02:00
Thomas Haller
2929392855 all: use "int/char" instead of "gint/gchar" typedefs
This is also recommended by our checkpatch.pl script.
2020-05-08 12:56:29 +02:00