Commit Graph

28470 Commits

Author SHA1 Message Date
Beniamino Galvani
a48edd0410 core,libnm: don't touch device TC configuration by default
NetworkManager supports a very limited set of qdiscs. If users want to
configure a unsupported qdisc, they need to do it outside of
NetworkManager using tc.

The problem is that NM also removes all qdiscs and filters during
activation if the connection doesn't contain a TC setting. Therefore,
setting TC configuration outside of NM is hard because users need to
do it *after* the connection is up (for example through a dispatcher
script).

Let NM consider the presence (or absence) of a TC setting in the
connection to determine whether NM should configure (or not) qdiscs
and filters on the interface. We already do something similar for
SR-IOV configuration.

Since new connections don't have the TC setting, the new behavior
(ignore existing configuration) will be the default. The impact of
this change in different scenarios is:

 - the user previously configured TC settings via NM. This continues
   to work as before;

 - the user didn't set any qdiscs or filters in the connection, and
   expected NM to clear them from the interface during activation.
   Here there is a change in behavior, but it seems unlikely that
   anybody relied on the old one;

 - the user didn't care about qdiscs and filters; NM removed all
   qdiscs upon activation, and so the default qdisc from kernel was
   used. After this change, NM will not touch qdiscs and the default
   qdisc will be used, as before;

 - the user set a different qdisc via tc and NM cleared it during
   activation. Now this will work as expected.

So, the new default behavior seems better than the previous one.

https://bugzilla.redhat.com/show_bug.cgi?id=1928078
2021-06-03 09:01:57 +02:00
Thomas Haller
04ae0d905c NEWS: update 2021-06-02 23:13:59 +02:00
Thomas Haller
5d50e7d78d Revert "libnm: introduce the new get_ports() in bridge/bond API"
Let's instead add a generic nm_device_get_ports() function.
Also, only adding new API is maybe not sufficient. We should
at the same time deprecate and alias the D-Bus API, like was done
for commit 067a3d6c08 ('nm-device: expose via D-Bus the 'hw-address'
property').

This reverts commit 754143f4e8.
2021-06-02 12:05:26 +02:00
Fernando Fernandez Mancera
754143f4e8 libnm: introduce the new get_ports() in bridge/bond API
This patch is introducing get_ports() in bridge and bond API. In
addition, the existing get_slaves() functions are being marked as
deprecated.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/878
2021-06-02 09:20:29 +02:00
Thomas Haller
8327312c51 wifi: fix parsing Microsoft Network Cost IE
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/734

Fixes: 5307b1ed73 ('wifi: guess metered flag based on Network Cost information element')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/879
2021-06-02 08:44:52 +02:00
Thomas Haller
bae22a45d8 lgtm: suppress lgtm[cpp/duplicate-include-guard] warning in ethtool header
lgtm.com doesn't like this:

  Query pack:com.lgtm/cpp-queries
  Query ID:cpp/duplicate-include-guard

  Using the same include guard macro in more than one header file may
  cause unexpected behavior from the compiler.

both for src/libnm-base/nm-ethtool-utils-base.h and
src/libnm-client-public/nm-ethtool-utils.h. But this is intentional,
because these two files are supposed to be identical (but compiled
twice, under different context).

Suppress the warning.
2021-06-01 17:54:07 +02:00
Thomas Haller
dd4cccbe66 lgtm: suppress [cpp/alloca-in-loop] warnings for lgtm.com
The warning is not right. There is no unguarded number of alloca()
calls inside a loop. Suppress the warnings.
2021-06-01 17:45:39 +02:00
Thomas Haller
bc05f4b750 core: avoid lgtm warning in _sleep_duration_convert_ms_to_us()
return x < G_MAXULONG ? (gulong) x : G_MAXULONG;
  ^^^ Comparison is always true because x <= 4294967295000.
2021-06-01 17:39:28 +02:00
Thomas Haller
ecd5d07b3a glib-aux: move forward declaration of inet_ntop() out of function scope
lgtm.com doesn't like this:

  Query pack:com.lgtm/cpp-queries
  Query ID:cpp/function-in-block

  Functions should always be declared at file scope. It is confusing
  to declare a function at block scope, and the visibility of the function
  is not what would be expected.
2021-06-01 17:32:33 +02:00
Thomas Haller
43c99f0b99 po: make update-po
$ make -C po update-po
2021-06-01 17:18:00 +02:00
Thomas Haller
aa76c260a7 systemd: merge branch systemd into main
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/876
2021-06-01 14:26:51 +02:00
Thomas Haller
4a2fe09853 man: mark [main].dns=unbound as deprecated 2021-06-01 13:54:16 +02:00
Beniamino Galvani
4eeafaf654 merge: branch 'anonymous-identity-fix' into 'main'
Two fixes related to EAP anonymous identity

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/869
2021-06-01 10:01:00 +00:00
Andrew Zaborowski
6aa8062f33 iwd: If no EAP anonymous identity set fall back to identity
Mimic the behaviour of wpa_supplicant where the "secure" identity in
TTLS and PEAP (802-1x.identity) is used as a fallback in the anonymous
identity (802-1x.anonymous_identity) if that is not provided.  This is
needed to keep the profiles compatible between the two wifi backends,
for users of poorly configured WPA-Enterprise networks that require the
user login to be sent in phase 1 or in both phases.

The code responsible for this mechanism in wpa_supplicant, at the time
of writing, is
https://w1.fi/cgit/hostap/tree/src/eap_peer/eap.c?id=c733664be9dd3763c03f2da2cb32a23775dde388#n1688
and offers no comment about the privacy implications.
2021-06-01 09:02:42 +00:00
Andrew Zaborowski
3bc16323fa libnm: Fix error message conditions in verity_ttls
In two similar ``if () {} else if () {} else if () {} else {}`` sequences
the latter two {} blocks were unreachable.  In the
identity/anonymous-identity case, anonymous-identity is optional,
wpa_supplicant will fall back to identity, so only check that (a likely
privacy issue because no NM or wpa_s documentation explains that the
"secure" identity is also sent in plaintext if anonymous_identity is
missing.)

In the phase2_auth/phase2_autheap case change the message to make it
clear that exactly one of the properties is expected to be present.
Drop the empty string checks because those cases is validated later in
verify() anyway.
2021-06-01 09:02:42 +00:00
Thomas Haller
5740ed67cb platform/netlink: don't reallocate ancillary data for recvmsg() on truncation
Coverity thinks there is a problem here:

    Error: TAINTED_SCALAR (CWE-20): [#def233]
    NetworkManager-1.31.5/src/libnm-platform/nm-netlink.c:1437: tainted_argument: Calling function "recvmsg" taints argument "msg".
    NetworkManager-1.31.5/src/libnm-platform/nm-netlink.c:1458: tainted_data: Passing tainted expression "msg.msg_controllen" to "g_realloc", which uses it as an allocation size.
    NetworkManager-1.31.5/src/libnm-platform/nm-netlink.c:1458: remediation: Ensure that tainted values are properly sanitized, by checking that their values are within a permissible range.
    # 1456|
    # 1457|           msg.msg_controllen *= 2;
    # 1458|->         msg.msg_control = g_realloc(msg.msg_control, msg.msg_controllen);
    # 1459|           goto retry;
    # 1460|       }

but the problem is not the tainted data. The problem is how should
we handle MSG_CTRUNC? If we reach MSG_CTRUNC we already lost a message.
Retrying to receive the next message is not going to fix that and is
wrong.

Also, there really is no reason why any truncation should happen. The only
ancillary data that should be present is the sender information, and for
that our buffer is supposed to be large enough.

So, simply ignore truncation. It shouldn't happen, if it happened we
cannot recover from it (aside failing an assertion), and all we really
care are the retrieved credentials. If truncation happened, we might
not have retrieved the credentials, but then that is for the caller
to handle (by rejecting the message as untrusted).

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/872
2021-06-01 09:37:36 +02:00
Thomas Haller
ff922f89f4 contrib/rpm: update comments in default NetworkManager.conf
Changing "NetworkManager.conf" is problematic, because the package management
system will detect if the user modified the file and leave .rpmnew files (or
similar).

Still, we only recently modified the file already to mention Libera.Chat.
So now is the time for more rewording.
2021-06-01 09:35:07 +02:00
Thomas Haller
f53dd5b929 man: document that NetworkManager.conf may be empty 2021-06-01 09:06:18 +02:00
Thomas Haller
e50fb9d70f systemd: update code from upstream (2021-05-29)
This is a direct dump from systemd git.

======

SYSTEMD_DIR=../systemd
COMMIT=d65c5d04f9c6d6c943e67e677161caed782fe7a7

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

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

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

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

nm_copy_sd_stdaux() {
    mkdir -p "./src/libnm-std-aux/"
    cp "$SYSTEMD_DIR/$1" "./src/libnm-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-common.c"
nm_copy_sd_core "src/libsystemd-network/network-common.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/dns-def.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/ordered-set.c"
nm_copy_sd_shared "src/basic/ordered-set.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/ratelimit.c"
nm_copy_sd_shared "src/basic/ratelimit.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/fundamental/macro-fundamental.h"
nm_copy_sd_shared "src/fundamental/string-util-fundamental.c"
nm_copy_sd_shared "src/fundamental/string-util-fundamental.h"
nm_copy_sd_shared "src/fundamental/type.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/log-link.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"
2021-05-30 09:50:13 +02:00
Thomas Haller
8b629dc16a systemd: merge branch systemd into master 2021-05-30 09:46:18 +02:00
Thomas Haller
6439c243e7 systemd: move "src/core/systemd" to "src/libnm-systemd-core"
This follows the recently introduced naming scheme and directory layout.
"libnm-systemd-core" is an independent component, and as such should no
be inside "src/core/".

Move it.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/875
2021-05-30 09:45:05 +02:00
Thomas Haller
54ada3c993 all: move "src/core/systemd/" directory to "src/libnm-systemd-core/"
Like commit 69f2699fe059 ('systemd: move "src/core/systemd" to
"src/libnm-systemd-core"').
2021-05-28 12:04:38 +02:00
Thomas Haller
f63723f75e examples/trivial: fix black formatting of python code 2021-05-27 14:08:47 +02:00
Thomas Haller
cb933c5955 libnmc-base: make transfer of memory ownership in try_spawn_vpn_auth_helper() clearer
This is confusing Coverity:

  Error: RESOURCE_LEAK (CWE-772): [#def249] [important]
  NetworkManager-1.31.5/src/libnmc-base/nm-secret-agent-simple.c:810: alloc_fn: Storage is returned from allocation function "g_string_free".
  NetworkManager-1.31.5/src/libnmc-base/nm-secret-agent-simple.c:810: var_assign: Assigning: "auth_dialog_request_str" = storage returned from "g_string_free(auth_dialog_request, 0)".
  NetworkManager-1.31.5/src/libnmc-base/nm-secret-agent-simple.c:822: noescape: Resource "auth_dialog_request_str" is not freed or pointed-to in "g_output_stream_write_async".
  NetworkManager-1.31.5/src/libnmc-base/nm-secret-agent-simple.c:822: noescape: Resource "auth_dialog_request_str" is not freed or pointed-to in "g_output_stream_write_async".
  NetworkManager-1.31.5/src/libnmc-base/nm-secret-agent-simple.c:838: leaked_storage: Variable "auth_dialog_request_str" going out of scope leaks the storage it points to.
  #  836|                                 data);
  #  837|
  #  838|->     return TRUE;
  #  839|   }
  #  840|

Maybe this works better to avoid the warning. At least, it also
documents it better to the reader.
2021-05-27 10:42:10 +02:00
Thomas Haller
ea60f273af cli: minor cleanup of code in "devices.c"
- declare each variable on a separate line.

- use nm_auto_free_gstring instead of explicit free.
2021-05-27 10:42:10 +02:00
Thomas Haller
550434a026 cli: workaround coverity false positive in "devices.c"
Error: RESOURCE_LEAK (CWE-772): [#def268] [important]
    NetworkManager-1.31.5/src/nmcli/devices.c:1367: alloc_fn: Storage is returned from allocation function "g_string_free".
    NetworkManager-1.31.5/src/nmcli/devices.c:1367: leaked_storage: Ignoring storage allocated by "g_string_free(security_str, 0)" leaks it.
    # 1365|       g_ptr_array_add(info->output_data, arr);
    # 1366|
    # 1367|->     g_string_free(security_str, FALSE);
    # 1368|   }
    # 1369|

    Error: RESOURCE_LEAK (CWE-772): [#def269] [important]
    NetworkManager-1.31.5/src/nmcli/devices.c:1451: alloc_fn: Storage is returned from allocation function "g_string_free".
    NetworkManager-1.31.5/src/nmcli/devices.c:1451: leaked_storage: Ignoring storage allocated by "g_string_free(slaves_str, 0)" leaks it.
    # 1449|       print_data(&nmc->nmc_config, &nmc->pager_data, out_indices, NULL, 0, &out);
    # 1450|
    # 1451|->     g_string_free(slaves_str, FALSE);
    # 1452|
    # 1453|       return TRUE;

    Error: RESOURCE_LEAK (CWE-772): [#def270] [important]
    NetworkManager-1.31.5/src/nmcli/devices.c:1517: alloc_fn: Storage is returned from allocation function "g_string_free".
    NetworkManager-1.31.5/src/nmcli/devices.c:1517: leaked_storage: Ignoring storage allocated by "g_string_free(slaves_str, 0)" leaks it.
    # 1515|       print_data(&nmc->nmc_config, &nmc->pager_data, out_indices, NULL, 0, &out);
    # 1516|
    # 1517|->     g_string_free(slaves_str, FALSE);
    # 1518|
    # 1519|       return TRUE;
2021-05-27 10:34:41 +02:00
Thomas Haller
e6975b208e l3cfg: merge branch 'th/l3cfg-19'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/864
2021-05-27 10:06:59 +02:00
Thomas Haller
8258ce6cf6 l3cfg: minor adjustments for L3Cfg code 2021-05-27 10:06:44 +02:00
Thomas Haller
1ce02ffd50 l3cfg: emit signal when NML3ConfigData changes 2021-05-27 10:06:43 +02:00
Thomas Haller
8e4b3d7367 l3cfg: use NMRefString for strings in NML3ConfigData
The entire point of NML3ConfigData is to be immutable and merging them.
"Merging" means to combine existing settings, hence NMRefString can be
used to share the same string instance.
2021-05-27 09:56:45 +02:00
Thomas Haller
11be05e6cc l3cfg: add proxy properties to NML3ConfigData 2021-05-27 09:56:44 +02:00
Thomas Haller
cdd3745161 l3cfg: fix assertion in nm_l3_config_data_get_domains()
Sealed instances are allowed for calling the getter.
2021-05-27 09:56:43 +02:00
Thomas Haller
acfc977974 l3cfg: fix crash in nm_l3_config_data_log() by mixing up arguments 2021-05-27 09:56:43 +02:00
Thomas Haller
2d0ac5f5fe dhcp/nettools: fix crash with empty DHCP option 40 (NIS domain name)
nm_utils_buf_utf8safe_escape() returns NULL for an empty string.

Fixes: 6c8a9e8bd6 ('dhcp/nettools: validate nis-domain option (40) differently')
2021-05-27 09:56:42 +02:00
Thomas Haller
bf9fab47ad dhcp/systemd: handle private options 249,252 specially
nettools plugin represents the way how to do it, and other plugins
should mimic that behavior. The nettools implementation adds private
DHCP options as hex, except the options

  - 249 (Microsoft Classless Static Route)
  - 252 (Web Proxy Auto Discovery Protocol)

Adjust systemd plugin to do the same.

For 252, we now parse the "wpad" option differently. The change in
behavior is that the property is now no longer exposed as hexstring,
but as backslash escaped plain text.

For 249, the option is not implemented. But stop adding the option as
hex-string too.
2021-05-27 09:56:42 +02:00
Thomas Haller
5bbe8d2154 core/dhcp: add nm_dhcp_state_to_string() helper 2021-05-27 09:56:42 +02:00
Thomas Haller
5ce91adeff libnm/trivial: rename _nm_keyfile_equals() to _nm_keyfile_equal() 2021-05-27 09:56:41 +02:00
Thomas Haller
41a6e40bb9 glib-aux/trivial: add comment when nm_utils_buf_utf8safe_escape() returns NULL 2021-05-27 09:56:41 +02:00
Thomas Haller
7c148b53ab glib-aux/trivial: fix typo in code comment 2021-05-27 09:56:40 +02:00
Thomas Haller
1c00330a7f glib-aux/trivial: rename nm_ref_string_equals_str() to nm_ref_string_equal_str() 2021-05-27 09:56:40 +02:00
Thomas Haller
96d9baacdb glib-aux/trivial: rename nm_{pint,puint32}_equals() to nm_\1_equal()
Our "_equal()" methods are commonly spelled without 's'.
2021-05-27 09:56:40 +02:00
Thomas Haller
043cdda00b glib-aux: add nm_ref_string_{equal,cmp}() helpers 2021-05-27 09:56:39 +02:00
Thomas Haller
8f5684543f glib-aux: add nm_ref_string_reset_str() helper 2021-05-27 09:56:39 +02:00
Thomas Haller
ac8c3a7111 glib-aux: improve nm_ref_string_equals_str() to work for non-C-strings
A NMRefString tracks the length seprately, it thus may not be a NUL terminated
string (although, there is always a NUL character at the end of the buffer).

As such, the previous implementation did not work correctly in when comparing
for example NMRefString("a\0b") with "a". There was even a comment hinting
to that fact. Instead of making obscure comments, fix the implementation to
behave always correctly.
2021-05-27 09:56:39 +02:00
Thomas Haller
ce7c28c514 glib-aux: add nm_g_source_sentinel_get() util
This helper is useful to get a dummy GSource instance that can be
refed, unrefed and destroyed. It can act as a replacement for
a timeout source with infinite timeout.
2021-05-27 09:56:39 +02:00
Thomas Haller
a9776e7ed9 glib-aux: add NM_HASH_OBFUSCATE_PTR_STR_BUF_SIZE define 2021-05-27 09:56:39 +02:00
Thomas Haller
dc89f466ff glib-aux: add nm_assert_is_ternary() helper 2021-05-27 09:56:38 +02:00
Thomas Haller
881b42c454 dhcp: fix nm_dhcp_lease_data_parse_cstr() to correctly detect NUL chars
Fixes: 784932550c ('dhcp/nettools: validate and normalize Host Name Option (12)')
2021-05-27 09:56:38 +02:00
Thomas Haller
0fb4ba5bef trivial: fix coding style issue 2021-05-27 09:56:18 +02:00
Thomas Haller
cbaeadb0a4 libnm/docs: document nm_utils_is_uuid() as deprecated
However, don't also use the NM_DEPRECATED_IN_1_32 macro, because that
causes annoying compiler warnings.

There is no replacement for the function in libnm, nor is it planned
to add one. So users may still call it, but they are now warned by
documentation that it may not be a good idea.
2021-05-27 09:29:22 +02:00