Commit Graph

22921 Commits

Author SHA1 Message Date
Thomas Haller
48f1cdc735 dcb: fix invalid assertion in dcb's do_helper()
https://bugzilla.redhat.com/show_bug.cgi?id=1700408

Fixes: a55c10754a ('dcb: cleanup do_helper() in "nm-dcb.c"')
(cherry picked from commit 76584e8f1d)
2019-04-16 15:30:14 +02:00
Piotr Drąg
a5bfbf7fe8 po: update Polish (pl) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/110
2019-04-15 15:37:35 +02:00
Thomas Haller
5d804fcba7 release: bump version to 1.17.90 (1.18-rc1) 2019-04-13 18:52:11 +02:00
Thomas Haller
a0a577e2e4 release: update NEWS 2019-04-13 18:43:48 +02:00
Thomas Haller
09839d5946 platform: merge branch 'th/platform-rules-cleanup'
https://github.com/NetworkManager/NetworkManager/pull/341
2019-04-13 18:23:21 +02:00
Thomas Haller
f41b4cacd4 platform: support weakly tracked routing rules in NMPRulesManager
Policy routing rules are global, and unlike routes not tied to an interface by ifindex.
That means, while we take full control over all routes of an interface during a sync,
we need to consider that multiple parties can contribute to the global set of rules.
That might be muliple connection profiles providing the same rule, or rules that are added
externally by the user. NMPRulesManager mediates for that.

This is done by NMPRulesManager "tracking" rules.

Rules that are not tracked by NMPRulesManager are completely ignored (and
considered externally added).

When tracking a rule, the caller provides a track-priority. If multiple
parties track a rule, then the highest (absolute value of the) priority
wins.

If the highest track-priority is positive, NMPRulesManager will add the rule if
it's not present.

When the highest track-priority is negative, then NMPRulesManager will remove the
rule if it's present (enforce its absence).

The complicated part is, when a rule that was previously tracked becomes no
longer tracked. In that case, we need to restore the previous state.

If NetworkManager added the rule earlier, then untracking the rule
NMPRulesManager will remove the rule again (restore its previous absent
state).

By default, if NetworkManager had a negative tracking-priority and removed the
rule earlier (enforced it to be absent), then when the rule becomes no
longer tracked, NetworkManager will not restore the rule.
Consider: the user adds a rule externally, and then activates a profile that
enforces the absence of the rule (causing NetworkManager to remove it).
When deactivating the profile, by default NetworkManager will not
restore such a rule! It's unclear whether that is a good idea, but it's
also unclear why the rule is there and whether NetworkManager should
really restore it.

Add weakly tracked rules to account for that. A tracking-priority of
zero indicates such weakly tracked rules. The only difference between an untracked
rule and a weakly tracked rule is, that when NetworkManager earlier removed the
rule (due to a negative tracking-priority), it *will* restore weakly
tracked rules when the rules becomes no longer (negatively) tracked.
And it attmpts to do that only once.

Likewise, if the rule is weakly tracked and already exists when
NMPRulesManager starts posively tracking the rule, then it would not
remove again, when no longer positively tracking it.
2019-04-13 18:22:58 +02:00
Thomas Haller
e18c92ee28 platform: add nmp_rules_manager_track_from_platform()
Track all the rules that are currenlty in platform.
2019-04-13 18:17:16 +02:00
Thomas Haller
dd9e646306 platform: minor fixes in NMPRuleManager (assert and types)
- fix the argument type to be "gint32" and not "int".

- assert in nmp_rules_manager_track_default() for the input
  arguments.

- use boolean bitfield in private data.
2019-04-13 18:17:16 +02:00
Thomas Haller
563894be8c platform/trivial: rename priority in NMPRuleManager to track_priority
The name "priority" is overused. Also rules have a "priority", but that'
something else.

Rename the priority of how rules are tracked by NMPRuleManager to
"track_priority".
2019-04-13 18:17:16 +02:00
Thomas Haller
f281c62e53 platform: drop track_default argument from nmp_rules_manager_new()
All that setting track-default does, is calling nmp_rules_manager_track_default()
when the rules are first accessed.

That is not right API. Since nmp_rules_manager_track_default() is already public
API (good), every caller that wishes this behavior should track these routes explicitly.
2019-04-13 18:17:16 +02:00
Thomas Haller
6fe1a38de0 libnm: merge branch 'lr/tc-attrs-part1'
https://github.com/NetworkManager/NetworkManager/pull/343
2019-04-13 18:12:18 +02:00
Lubomir Rintel
65831ee84c core/qdisc: add support for attributes 2019-04-12 18:04:04 +02:00
Lubomir Rintel
f5f90a0d69 core/qdisc: drop useless code
The call to nm_utils_parse_variant_attributes() is useless. The following
_tc_read_common_opts() call does the same thing. This was probably left
in place by accident.
2019-04-12 18:03:09 +02:00
Lubomir Rintel
817b55cf06 nmcli: fix an error message when the tc qdisc kind is missing
Before:

  # nmcli c modify eth666 tc.qdiscs root
  Error: failed to modify tc.qdiscs: '(null)' is not a valid kind The valid syntax is: '[root | parent <handle>] [handle <handle>] <qdisc>'.

After:

  # nmcli c modify eth666 tc.qdiscs root
  Error: failed to modify tc.qdiscs: kind is missing. The valid syntax is: '[root | parent <handle>] [handle <handle>] <kind>'.
2019-04-12 17:30:15 +02:00
Beniamino Galvani
549112c1ba merge: branch 'bg/sanitizers'
Fix build with sanitizers, and other memory fixes

https://github.com/NetworkManager/NetworkManager/pull/342
2019-04-12 11:31:13 +02:00
Beniamino Galvani
82c74eb4e2 device: fix memory leak 2019-04-12 11:19:58 +02:00
Beniamino Galvani
ade14408d7 policy: fix memory leak 2019-04-12 11:19:58 +02:00
Beniamino Galvani
834dfd72c5 libnm-core: fix wrong memory access in tests
==16725==ERROR: AddressSanitizer: global-buffer-overflow on address 0x0000005a159f at pc 0x00000046fc1b bp 0x7fff6038f900 sp 0x7fff6038f8f0
READ of size 1 at 0x0000005a159f thread T0
    #0 0x46fc1a in _do_test_unescape_spaces libnm-core/tests/test-general.c:7791
    #1 0x46fe5b in test_nm_utils_unescape_spaces libnm-core/tests/test-general.c:7810
    #2 0x7f4ac5fe7fc9 in test_case_run gtestutils.c:2318
    #3 0x7f4ac5fe7fc9 in g_test_run_suite_internal gtestutils.c:2403
    #4 0x7f4ac5fe7e83 in g_test_run_suite_internal gtestutils.c:2415
    #5 0x7f4ac5fe7e83 in g_test_run_suite_internal gtestutils.c:2415
    #6 0x7f4ac5fe8281 in g_test_run_suite gtestutils.c:2490
    #7 0x7f4ac5fe82a4 in g_test_run (/lib64/libglib-2.0.so.0+0x772a4)
    #8 0x48240d in main libnm-core/tests/test-general.c:7994
    #9 0x7f4ac5dc9412 in __libc_start_main (/lib64/libc.so.6+0x24412)
    #10 0x423ffd in _start (/home/bgalvani/work/NetworkManager/libnm-core/tests/test-general+0x423ffd)

0x0000005a159f is located 49 bytes to the right of global variable '*.LC370' defined in 'libnm-core/tests/test-general.c' (0x5a1560) of size 14
  '*.LC370' is ascii string 'nick-5, green'
0x0000005a159f is located 1 bytes to the left of global variable '*.LC371' defined in 'libnm-core/tests/test-general.c' (0x5a15a0) of size 1
  '*.LC371' is ascii string ''
SUMMARY: AddressSanitizer: global-buffer-overflow libnm-core/tests/test-general.c:7791 in _do_test_unescape_spaces
2019-04-12 11:19:58 +02:00
Beniamino Galvani
2fe9141960 clients: disable asan leak detection in client tests
Leak detection adds unhelpful messages to the stderr of nmcli, making
tests fail. For example:

 =================================================================
 ==17156==ERROR: LeakSanitizer: detected memory leaks

 Direct leak of 256 byte(s) in 2 object(s) allocated from:
     #0 0x7f08c7e27c88 in realloc (/lib64/libasan.so.5+0xefc88)
     #1 0x7f08c7546e7d in g_realloc (/lib64/libglib-2.0.so.0+0x54e7d)
2019-04-12 11:19:58 +02:00
Beniamino Galvani
366f9867eb build: fix build with sanitizers
Add missing linker flags.
2019-04-12 11:19:58 +02:00
Thomas Haller
8c3fc3c503 all: merge branch 'th/strsplit-pt2'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/105
2019-04-12 11:11:53 +02:00
Thomas Haller
afc258519d ifcfg-rh: refactor parsing bond options
Don't use g_strsplit_set() if all we want to do is split the
string at the first '='.
2019-04-12 11:10:18 +02:00
Thomas Haller
7887909564 ifcfg-rh: refactor parse_full_ip6_address() to use nm_utils_parse_inaddr_prefix_bin()
We already have code that parses exactly this kinds of string:
nm_utils_parse_inaddr_prefix_bin(). Use it.

Also, it doesn't use g_strsplit_set() to separate a string at the first
'/'. Total overkill.
2019-04-12 11:10:18 +02:00
Thomas Haller
0d3bf9729a dispatcher/tests: cleanup tests
- use cleanup macros everywhere.

- In particular use nm_auto_clear_variant_builder to free the
  GVariantBuilder in the error cases. Note that the error cases
  anyway are asserted against, so during a normal test run there
  was no leak. But we should not write software like that.

- use nm_utils_strsplit_set_with_empty() instead of g_strsplit_set().
  We should use our variant also in unit-tests, because that way the
  function gets more test coverage. And it likely performs better
  anyway.
2019-04-12 11:10:07 +02:00
Thomas Haller
03b6be8319 ifupdown: replace g_strsplit_set() by nm_utils_strsplit_set()
Note that nm_utils_strsplit_set() drops empty tokens (consecutive delimiters).
This is what all callers here want anyway.
2019-04-12 11:07:25 +02:00
Thomas Haller
f28a618889 shared: add nm_auto_clear_variant_builder 2019-04-12 11:07:25 +02:00
Beniamino Galvani
246c2dbe9a merge: branch 'bg/unmanaged-sw-dev-rh1679230'
https://bugzilla.redhat.com/show_bug.cgi?id=1679230
https://github.com/NetworkManager/NetworkManager/pull/340
2019-04-12 10:35:09 +02:00
Beniamino Galvani
c0d5b58332 core: don't realize unmanaged software devices
Currently, if user configuration or settings specify that a software
device is unmanaged, for example:

 [device-bond-unmanaged]
 match-device=interface-name:bond*
 managed=0

or

 [keyfile]
 unmanaged-devices=interface-name:bond*

and there is a connection for the device with autoconnect=yes, NM
creates the platform link and a realized device in unmanaged
state. Fix this, the device should not be realized if it is unmanaged.

https://bugzilla.redhat.com/show_bug.cgi?id=1679230
2019-04-12 10:34:20 +02:00
Beniamino Galvani
adbf368511 device: allow matching device spec from any state
nm_device_spec_match_list_full() calls
nm_device_get_permanent_hw_address() which freezes the MAC address, so
currently callers must avoid the function when the device is not
completely platform-initialized.

Instead, use nm_device_get_permanent_hw_address_full() to avoid
freezing the MAC when the device is not platform-initialized. In this
way nm_device_spec_match_list_full() can be called from any state
without side effects.
2019-04-12 10:34:20 +02:00
Thomas Haller
7b6a3aaf29 cli: fix typo in nmcli usage output
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/157
2019-04-12 09:56:51 +02:00
Thomas Haller
da4f229805 libnm,shared: bzero secrets on failure in nm_utils_base64secret_decode()
Now that unbase64mem_full() understands a secure flag, we can
get this right.
2019-04-12 07:39:50 +02:00
Thomas Haller
d3d45fd1f9 systemd: merge branch systemd into master 2019-04-12 07:33:52 +02:00
Thomas Haller
2b1ea1613d systemd: update code from upstream (2019-04-11)
This is a direct dump from systemd git.

======

SYSTEMD_DIR=../systemd
COMMIT=03abeb0baf7fe97c98a98d745b75c7d33e2f632e

(
  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/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"
2019-04-12 07:20:42 +02:00
Beniamino Galvani
a94ccc9acc clients: fix assertion when requesting gsm pin secret
[root@gsm-r5s4-01 ~]# nmcli  connection up id gsm
  **
  libnmc:ERROR:clients/common/nm-secret-agent-simple.c:171:_secret_real_new_plain: assertion failed: ((secret_type == NM_SECRET_AGENT_SECRET_TYPE_SECRET) == nm_setting_get_secret_flags (setting, property, ((void *)0), ((void *)0)))
  Aborted (core dumped)

The pin is a secret property.

https://bugzilla.redhat.com/show_bug.cgi?id=1698495
2019-04-11 13:50:09 +02:00
Thomas Haller
c210ad9d26 Revert "contrib/rpm: drop --with-libnm-glib from build_clean"
Since we restored libnm-glib in commit b027723e00,
also revert this commit.

This reverts commit 0750ff1f81.
2019-04-11 11:40:20 +02:00
Thomas Haller
8aefac804c connectivity: fix build with --disable-concheck
Fixes: 2cec94bacc ('connectivity: use systemd-resolved for resolving the check endpoint')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/155
2019-04-10 21:22:22 +02:00
Thomas Haller
ad77eed0d5 all: merge branch 'th/strsplit'
https://github.com/NetworkManager/NetworkManager/pull/332
2019-04-10 15:06:21 +02:00
Thomas Haller
a1425a4c91 shared: pre-calculate number of tokens in nm_utils_strsplit_set_full()
Instead of growing the buffer for the tokens (and reallocating),
do one pre-run over the string and count the delimiters. This
way we know how much space we need and we don't need to
reallocate.

Interestingly, this is notably slower than the previous implementation,
because previously if would not bother determining the right number of
tokens but just over-allocate with a reasonable guess of 8 and grow the
buffer exponentially. Still, I like this better because while it may
be slower in common scenarios, it allocates the exact number of buffer
space.
2019-04-10 15:05:57 +02:00
Thomas Haller
c1f340401f ifcfg-rh: various cleanups using the cleanup attribute 2019-04-10 15:05:57 +02:00
Thomas Haller
3e0366a3ff all: replace g_strsplit_set() by nm_utils_strsplit_set*() 2019-04-10 15:05:57 +02:00
Thomas Haller
34e60bf228 cli: cleanup split_required_fields_for_con_show()
- return early and use cleanup attribute for freeing memory
- use nm_utils_strsplit_set_with_empty() instead of g_strsplit_set().
2019-04-10 15:05:57 +02:00
Thomas Haller
c9ca7d0637 cli: cleanup nm_vpn_openconnect_authenticate_helper() 2019-04-10 15:05:57 +02:00
Thomas Haller
b33e2b72da ibft: cleanup read_connections() 2019-04-10 15:05:57 +02:00
Thomas Haller
a55c10754a dcb: cleanup do_helper() in "nm-dcb.c" 2019-04-10 15:05:57 +02:00
Thomas Haller
994df9244f dhcp: cleanup nm_dhcp_dhclient_create_config() 2019-04-10 15:05:57 +02:00
Thomas Haller
e072489cc6 dhcp: cleanup nm_dhcp_dhclient_read_duid() 2019-04-10 15:05:57 +02:00
Thomas Haller
be4fd39ab9 dhcp: cleanup grab_request_options() 2019-04-10 15:05:57 +02:00
Thomas Haller
f00d71cec1 dhcp: cleanup nm_dhcp_dhclient_save_duid() 2019-04-10 15:05:57 +02:00
Thomas Haller
a15e70889c dhcp: cleanup ip4_process_dhclient_rfc3442_routes()
- use nm_utils_strsplit_set_full() instead of g_strsplit_set() to avoid allocating
  a full strv array.
- refactor the code to return early and use cleanup attribute for freeing
  memory.
- return TRUE/FALSE from process_dhclient_rfc3442_route(). It's simpler to
  understand than returning the moved pointer and a success output variable.
2019-04-10 15:05:57 +02:00
Thomas Haller
5c1f93943e shared: add NM_UTILS_STRSPLIT_SET_FLAGS_PRESERVE_EMPTY flag for nm_utils_strsplit_set_full()
Previously, nm_utils_strsplit_set_full() would always remove empty
tokens. Add a flag NM_UTILS_STRSPLIT_SET_FLAGS_PRESERVE_EMPTY to avoid
that.

This makes nm_utils_strsplit_set_full() return the same result as
g_strsplit_set() and a direct replacement for it -- except for "",
where we return %NULL.
2019-04-10 15:05:57 +02:00