Commit graph

22895 commits

Author SHA1 Message Date
Thomas Haller
f4afb38bd9 cli: fix crash in split_required_fields_for_con_show()
Depending on the architecture (calling convention), function
arguments are evaluated in one order or the other.

https://bugzilla.redhat.com/show_bug.cgi?id=1700409

Fixes: 34e60bf228 ('cli: cleanup split_required_fields_for_con_show()')
2019-04-16 16:00:32 +02:00
Lubomir Rintel
ba461085a2 build: document defaults consistently
[default=meh] instead of (default is meh) or (default: meh).

https://github.com/NetworkManager/NetworkManager/pull/344
2019-04-16 15:57:20 +02:00
Lubomir Rintel
b9b6e2367f build: default to internal DHCP client
Meson builds already seem to default this and RHEL & Fedora switched
already. Everyone else also should.

https://github.com/NetworkManager/NetworkManager/pull/345
2019-04-16 15:56:56 +02:00
Lubomir Rintel
9865b484fa build: drop HAVE_SYSTEMD define
It's unused.

https://github.com/NetworkManager/NetworkManager/pull/346
2019-04-16 15:54:34 +02:00
Lubomir Rintel
7bd06ce4c6 build: drop HAVE_WIFI define
It's unused.

https://github.com/NetworkManager/NetworkManager/pull/347
2019-04-16 15:54:21 +02:00
Lubomir Rintel
5801f89f4d all: goodbye libnm-glib
This removes libnm-glib, libnm-glib-vpn, and libnm-util for good.
The it has been replaced with libnm since NetworkManager 1.0, disabled
by default since 1.12 and no up-to-date distributions ship it for years
now.

Removing the libraries allows us to:

* Remove the horrible hacks that were in place to deal with accidental use
  of both the new and old library in a single process.
* Relief the translators of maintenance burden of similar yet different
  strings.
* Get rid of known bad code without chances of ever getting fixed
  (libnm-glib/nm-object.c and libnm-glib/nm-object-cache.c)
* Generally lower the footprint of the releases and our workspace

If there are some really really legacy users; they can just build
libnm-glib and friends from the NetworkManager-1.16 distribution. The
D-Bus API is stable and old libnm-glib will keep working forever.

https://github.com/NetworkManager/NetworkManager/pull/308
2019-04-16 15:52:27 +02:00
Thomas Haller
76584e8f1d 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"')
2019-04-16 15:27:34 +02:00
Thomas Haller
87c2b0e6cd cli: merge branch 'th/cli-select-connection'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/108
2019-04-16 09:16:14 +02:00
Thomas Haller
43d93e7c1f cli: tab complete only full D-Bus paths if there is no prefix
When tab completing connections by path name without any already
typed parts, only suggest full D-Bus paths. The numbers are duplicate
and not preferred.

Before:

    $ nmcli connection show path <TAB>
    Display all 118 possibilities? (y or n)
    1                                            46                                           /org/freedesktop/NetworkManager/Settings/29
    10                                           47                                           /org/freedesktop/NetworkManager/Settings/3
    11                                           48                                           /org/freedesktop/NetworkManager/Settings/30
    12                                           49                                           /org/freedesktop/NetworkManager/Settings/31
    13                                           5                                            /org/freedesktop/NetworkManager/Settings/32

Afterwards:

    $ nmcli connection show path <TAB>
    /org/freedesktop/NetworkManager/Settings/1   /org/freedesktop/NetworkManager/Settings/28  /org/freedesktop/NetworkManager/Settings/46
    ...

and

    $ nmcli connection modify path 4<TAB>
    4   40  41  42  43  44  45  46  47  48  49
2019-04-15 20:50:50 +02:00
Thomas Haller
68bd018a88 cli: prefer matching connections by "uuid" instead of "id"
Scripts should refer to connections by UUID. That means, whenever a
UUID matches, that is really what the user wants. The specifier "uuid"
must have precedence over "id" (and all others). That means, we must
search all connections.

For example:

    $ UUIDS=($(nmcli -g TYPE,UUID connection show | sed -n 's/802-11-wireless://p'))
    $ nmcli -f connection.id,connection.uuid connection show "${UUIDS[@]}"

in this case we must preferrably match by UUID, regardless of whether
a "connection.id" exists.

Note that if you have:

    $ nmcli connection show | grep fdf7b2d2-2858-3938-9b14-7f1b514a9a00
    b                                     fdf7b2d2-2858-3938-9b14-7f1b514a9a00  ethernet   --
    fdf7b2d2-2858-3938-9b14-7f1b514a9a00  ab9f3891-3420-335e-89da-f14c1b94c540  ethernet   --

then certain commands will still select all matching connections:

    $ nmcli -f connection.id,connection.uuid --mode multiline connection show fdf7b2d2-2858-3938-9b14-7f1b514a9a00
    connection.id:                          fdf7b2d2-2858-3938-9b14-7f1b514a9a00
    connection.uuid:                        ab9f3891-3420-335e-89da-f14c1b94c540

    connection.id:                          b
    connection.uuid:                        fdf7b2d2-2858-3938-9b14-7f1b514a9a00

This only makes a difference for commands that must pick only one profile:

    $ nmcli connection modify fdf7b2d2-2858-3938-9b14-7f1b514a9a00 con-name new-name
2019-04-15 20:50:50 +02:00
Thomas Haller
87d16e935c cli: drop unnecessary NULL sentinel from nmc_complete_strings()
Since commit 62b939de4e ('cli: add nmc_complete_strv() which takes a
string array for completion that may contain NULL'), the sentinel is
no longer needed.
2019-04-15 20:50:50 +02:00
Piotr Drąg
f917fabde4 po: update Polish (pl) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/111
2019-04-15 15:35:12 +02:00
Thomas Haller
5974c6ae7f shared/n-acd: reimport
git subtree pull --prefix shared/n-acd git@github.com:nettools/n-acd.git master --squash
2019-04-14 17:23:50 +02:00
Thomas Haller
90a0edce06 Squashed 'shared/n-acd/' changes from 9eb7bf7173..5470816839
5470816839 test: increase timeout on test-veth
d44dfa1ba7 build: update c-stdaux
26b10b6514 build: pull in submodule updates
7817fc0a95 n-acd: switch to c-stdaux
5033b2ecdd n-acd: include dependency headers
aaf2a66788 build: update README
b9448eff98 build: pull in c-stdaux
8ac364e9a3 test: raise MEMLOCK if possible
3cd197162e ci: drop root
0289a33412 test: allow running without root
67a343fe87 build: update email address
3c364ba95f build: bump version
d0f7d71fa1 build: document build configuration options
014b00cd27 build: fill in NEWS
180990288a n-acd: document API
79904585df build: update submodules
8185e6ed89 build: reduce boilerplate

git-subtree-dir: shared/n-acd
git-subtree-split: 54708168399f1662c652b5931608e5077ef462f6
2019-04-14 17:23:35 +02:00
Thomas Haller
6d513f4bf2 shared/c-siphash: reimport
git subtree pull --prefix shared/c-siphash git@github.com:c-util/c-siphash.git master --squash
2019-04-14 17:23:25 +02:00
Thomas Haller
085b4e0388 Squashed 'shared/c-siphash/' changes from 211cfc5abc..7c42c59258
7c42c59258 build: use c-stdaux
d81d68ff83 build: sync with c-util
e858efbc45 build: pull in c-stdaux

git-subtree-dir: shared/c-siphash
git-subtree-split: 7c42c592581906fef19458372b8db2b643278211
2019-04-14 17:23:16 +02:00
Thomas Haller
72de3d45cc shared/c-rbtree: reimport
git subtree pull --prefix shared/c-rbtree git@github.com:c-util/c-rbtree.git master --squash
2019-04-14 17:23:01 +02:00
Thomas Haller
7d5c09c3ca Squashed 'shared/c-rbtree/' changes from bf627e0c32..b46392d25d
b46392d25d build: use c-stdaux
61f21750be build: pull in c-stdaux
31fcf75afe build: sync with c-util
fec7b8f2da ci: add run with -DNDEBUG

git-subtree-dir: shared/c-rbtree
git-subtree-split: b46392d25de7a7bab67d48ef18bf8350b429cff5
2019-04-14 17:22:29 +02:00
Thomas Haller
06136cdd42 shared/c-list: reimport
git subtree pull --prefix shared/c-list git@github.com:c-util/c-list.git master --squash
2019-04-14 17:22:04 +02:00
Thomas Haller
5fceb23fa4 Squashed 'shared/c-list/' changes from dda36d30c7..2e4b605c62
2e4b605c62 test: clear NDEBUG
4605727902 build: sync with c-util

git-subtree-dir: shared/c-list
git-subtree-split: 2e4b605c6217cd3c8a1ef773f82f5cc329ba650d
2019-04-14 17:19:19 +02:00
Thomas Haller
68a3bc9523 shared: patch c-stdaux.h to not include <stdatomic.h>
c-stdaux is C11 and so is NetworkManager too.
But we build on Ubunut 14.04, where we have not all C11 parts
in place.

Since the header is not actually used (at the moment), patch out
the include.
2019-04-14 17:17:52 +02:00
Thomas Haller
8d911088ab build: include c-stdaux in c-util and nettools tools
This is now a dependency for the internal tools. Add the
include directive first, before upgrading the libraries.
2019-04-14 12:59:48 +02:00
Thomas Haller
5eab3c9987 shared/c-stdaux: merge initial import of 'shared/c-stdaux'
Imported c-stdaux code with command:

  git subtree add --prefix shared/c-stdaux git@github.com:c-util/c-stdaux.git master --squash

To update the library use:

  git subtree pull --prefix shared/c-stdaux git@github.com:c-util/c-stdaux.git master --squash
2019-04-14 11:45:49 +02:00
Thomas Haller
21141429e5 Squashed 'shared/c-stdaux/' content from commit 11930d2592
git-subtree-dir: shared/c-stdaux
git-subtree-split: 11930d259212605a15430523472ef54e0c7654ee
2019-04-14 11:16:55 +02:00
Thomas Haller
606980c3ea release: update NEWS 2019-04-13 18:57:38 +02:00
Thomas Haller
8849edbd64 release: bump version to 1.19.0 (development) 2019-04-13 18:54:31 +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