Commit Graph

27030 Commits

Author SHA1 Message Date
Sayed Shah
ec582d788c nmp-object: add space before parentheses 2020-08-07 13:20:31 +02:00
Thomas Haller
34ffd586cd keyfile: use NM_STR_HAS_SUFFIX_ASCII_CASE_WITH_MORE() to check filename suffix
In practice, we wouldn't need the _WITH_MORE() variants here, because
all the suffixes that we check start with a ".", and we check first
that the filename itself does not start with a ".".

However, it doesn't hurt to be explicit about this, and it has no
overhead at all.
2020-08-07 11:45:41 +02:00
Thomas Haller
cc8da77637 shared: add NM_STR_HAS_SUFFIX_WITH_MORE()/NM_STR_HAS_SUFFIX_ASCII_CASE_WITH_MORE() macros
They are like NM_STR_HAS_SUFFIX()/NM_STR_HAS_SUFFIX_ASCII_CASE(), but require that
the checked string is not identical to the suffix. They require some non-empty word
preceding the suffix.
2020-08-07 11:43:32 +02:00
Thomas Haller
07264a5dc1 shared: avoid "-Wmaybe-uninitialized" in _char_lookup_has()
shared/nm-glib-aux/nm-shared-utils.c: In function ‘nm_utils_escaped_tokens_escape_full’:
   shared/nm-glib-aux/nm-shared-utils.c:1569:26: error: ‘ch_lookup_as_needed.<U7d10>.table[0]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    1569 |  nm_assert (lookup->table[(guint8) 0] == 0);
         |                          ^
   shared/nm-glib-aux/nm-shared-utils.c:1569:26: error: ‘ch_lookup_as_needed.<U7d10>.table[0]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

Fixes: ae55b98e02 ('shared: add CharLookupTable type for nm_utils_strsplit_set_full()')
2020-08-07 11:38:50 +02:00
Thomas Haller
24c534225f l3cfg: merge branch 'th/l3cfg-5'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/600
2020-08-06 18:12:15 +02:00
Thomas Haller
d2beefa658 l3cfg: change l3cd for-each macros to take pointers instead of variable names
It's not a big difference and unclear which is preferable. It however
seems slighly clearer to require the user to provide a pointer, instead
of a variable for which the macro itself takes the reference.

It makes it clearer that the "iter" and "obj" arguments are modified
by the macro.
2020-08-06 18:12:02 +02:00
Thomas Haller
6bf5f014c8 shared: change NM_SWAP() macro to take pointer arguments
This makes the macro more function like. Also, taking a pointer
makes it a bit clearer that this possibly changes the value.

Of course, it's not a big difference to before, but this
form seems slightly preferable to me.
2020-08-06 18:12:01 +02:00
Thomas Haller
ae55b98e02 shared: add CharLookupTable type for nm_utils_strsplit_set_full()
It's not a large difference, whether we use a 256 array directly or a
struct. I guess, theoretically this gives the compiler some more
information about the type, like the alignment. Also, it seems nicer
to use a dedicated struct instead of a pointer array.
2020-08-06 18:12:01 +02:00
Thomas Haller
2222af9a91 shared: add nm_puint32_hash/nm_puint32_equals helpers
They are in practice idential to nm_pint_hash/nm_pint_equals. So, just
#define them.
2020-08-06 18:12:01 +02:00
Beniamino Galvani
9f4ab95c01 initrd: merge branch 'bg/initrd-wait-rh1853348'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/599
2020-08-06 16:55:31 +02:00
Beniamino Galvani
f114e16fdd initrd: wait for bootdev or all devices if rd.neednet=1
The network-legacy dracut module waits for all ethernet devices if the
command line contains rd.neednet=1. It also waits for the device
specified by 'bootdev='.

Do the same.

https://bugzilla.redhat.com/show_bug.cgi?id=1853348
2020-08-06 16:52:35 +02:00
Beniamino Galvani
0a006c0412 initrd: disable STP on bridges
NM enables by default STP on bridges, which causes a forwarding delay
of 15 seconds on boot. Disable it.
2020-08-06 16:52:35 +02:00
Antonio Cardace
ac6f21cae4 bond: merge branch 'ac/bond_reapply'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/598
2020-08-06 11:28:42 +02:00
Antonio Cardace
746dc119a6 bond: let 'reapply()' reapply all supported options
Reapply now handles all the options supported by kernel and NM, meaning
that some options are simply not allowed to be set while keeping the
bond up, one of those options is the mode for instance.

https://bugzilla.redhat.com/show_bug.cgi?id=1847814
2020-08-06 11:21:45 +02:00
Antonio Cardace
04d6ca1fb8 bond: fix can_reapply_change() false positives
can_reapply_change() would wrongly return true for
unsupported reapply values because it used 'nm_setting_bond_get_option_default()'
that is ill-named because it returns the overriden option other than
its default value.

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

Fixes: 9bd07336ef ('bond: bond options logic rework')
2020-08-06 11:21:45 +02:00
Antonio Cardace
2e70391033 shared: extend NM_IN_STRSET and NM_IN_SET to support up to 20 args
https://bugzilla.redhat.com/show_bug.cgi?id=1847814
2020-08-06 11:21:45 +02:00
Li-Hao Liao (Leon Liao)
3ba31aad58 platform: add the NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE status check
In some cases, the wow is not configured and the
NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE is set.
So, add the NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE status check.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/597
2020-08-06 11:02:54 +02:00
Beniamino Galvani
7bf7223ece dhcp: merge branch 'bg/dhcpv6-hostname-rh1858344'
Fix setting hostname from DHCPv6

https://bugzilla.redhat.com/show_bug.cgi?id=1858344
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/589
2020-08-06 10:25:04 +02:00
Beniamino Galvani
1f74ea52f5 policy: get the DHCPv6 hostname from the FQDN option
There isn't any 'host-name' option for DHCPv6. Read instead the
'fqdn-fqdn' option that carries the FQDN assigned by the server to the
client.
2020-08-06 10:16:09 +02:00
Beniamino Galvani
1621a6ddb1 dhcp: export the DHCPv6 FQDN option
The dhclient backend already exports all the option passed by
dhclient, including the FDQN. Export it also for the systemd backend.
2020-08-06 10:16:09 +02:00
Thomas Haller
e438219463 shared/c-stdaux: reimport
git subtree pull --prefix shared/c-stdaux git@github.com:c-util/c-stdaux.git master --squash
2020-08-05 16:40:16 +02:00
Thomas Haller
51291dc7f3 Squashed 'shared/c-stdaux/' changes from 3b35c47d2bee..ffa3dcc36533
ffa3dcc36533 all: fix minor typo in code comment

git-subtree-dir: shared/c-stdaux
git-subtree-split: ffa3dcc365331e31eb0c0f73ccd258e7a29a162a
2020-08-05 16:39:28 +02:00
Thomas Haller
0c5880078a shared/c-siphash: reimport
git subtree pull --prefix shared/c-siphash git@github.com:c-util/c-siphash.git master --squash
2020-08-05 16:38:00 +02:00
Thomas Haller
2203db4ded Squashed 'shared/c-siphash/' changes from 996b79578d94..d8b3a7a8f40e
d8b3a7a8f40e all: fix minor typo in documentation

git-subtree-dir: shared/c-siphash
git-subtree-split: d8b3a7a8f40e9ab94a0acaa7e44f74aa919ef64a
2020-08-05 16:37:21 +02:00
Thomas Haller
ebe7d49fb7 shared/n-acd: reimport
git subtree pull --prefix shared/n-acd git@github.com:nettools/n-acd.git master --squash
2020-08-05 16:35:23 +02:00
Thomas Haller
aef4332f7f Squashed 'shared/n-acd/' changes from 0237ba54bef7..5c43b8a010a6
5c43b8a010a6 all: fix minor typos

git-subtree-dir: shared/n-acd
git-subtree-split: 5c43b8a010a6f4585c98ea180759eb4bf9bb1509
2020-08-05 16:34:45 +02:00
Thomas Haller
2539e3a826 nettools: reimport nettools' n-dhcp4
git subtree pull --prefix shared/n-dhcp4/ git@github.com:nettools/n-dhcp4.git master --squash
2020-08-05 16:33:09 +02:00
Thomas Haller
5a5be392f2 Squashed 'shared/n-dhcp4/' changes from 5aeb53d149b4..03d38e83e558
03d38e83e558 n-dhcp4: fix BPF filter endianness issue
aa6d7207a76c all: fix minor typos

git-subtree-dir: shared/n-dhcp4
git-subtree-split: 03d38e83e558802a82cb0e4847cb1f1ef75ccd16
2020-08-05 16:32:08 +02:00
Thomas Haller
06e7d72265 l3cfg: merge branch 'th/l3cfg-4'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/595
2020-08-05 16:30:34 +02:00
Thomas Haller
79db3972d7 l3cfg: rework merging NML3ConfigData to give more control over how to merge
NML3Cfg will need more control about how to merge the NML3ConfigData
instances. For example, it will need to intercept IPv4 addresses to
perform ACD.

For that, move the bulk of the merging code to NML3Cfg and expose the
low-level function nm_l3_config_data_merge().

Also, add a callback function to nm_l3_config_data_merge(), to give
control over how to merge.
2020-08-05 12:47:56 +02:00
Thomas Haller
25d404dadb l3cfg: add more API to NML3ConfigData 2020-08-05 12:47:56 +02:00
Thomas Haller
37e5ebbf70 l3cfg: forward declare NML3ConfigData in "nm-types.h" 2020-08-05 12:47:56 +02:00
Thomas Haller
60ad076094 l3cfg: add nm_l3_config_data_set_source()
It's useful to have a NML3ConfigData track the source.
Previously, NMIP4Config tracks the source per MTU. But the
source really belongs to the entire setting.
2020-08-05 12:47:55 +02:00
Thomas Haller
9798a90d53 l3cfg: rename NML3ConfigData instances from l3cfg to l3cd
The name l3cfg is nicer, but it would make you think that it's an
NML3Cfg instance, when it's really NML3ConfigData.
2020-08-05 12:47:55 +02:00
Thomas Haller
c9409f8692 core: add NMIPConfig as base class for NMIP[46]Config
NMIP[46]Config will become much simpler than it is today.
It's sole responsibility will be to expose current settings
on D-Bus, in it's function as a NMDBusObject subtype.

However, it still make sense to let them share a common base class.
Add it.
2020-08-05 12:47:55 +02:00
Thomas Haller
adec7bd887 core: change NM_IS_IP_CONFIG() to have no additional argument
NM_IS_IP_CONFIG() is a standard name for GObject related macros. Next,
we will add NMIPConfig object, so this macro (and name) will have a use.

Rename, and adjust the existing macro to avoid the name conflict.
2020-08-05 12:47:55 +02:00
Thomas Haller
fea6be41cc core: add nm_dbus_object_unexport_on_idle() helper
It's important that we don't unexport an object, until all our references
to the path are cleared. That is not so easy to guarantee, so add a helper
method to unexport on an idle handler. In many cases there is little harm
in delaying an object going away.
2020-08-05 12:47:55 +02:00
Thomas Haller
43d031d37f core: merge IPv4/IPv6 implementations of nm_utils_ip_{addresses,routes}_to_dbus() 2020-08-05 12:47:55 +02:00
Thomas Haller
52c9504ef4 core: extract helper functions for creating address/route variant for D-Bus
This code will change, but in essence we will still need such a function
to convert a list of addresses/routes to D-Bus. Extract the code, so it
can be better reused and adjusted.
2020-08-05 12:47:55 +02:00
Thomas Haller
3acddf9dc6 dhcp: cleanup "nm-dhcp-utils.c"
- use nm_utils_strsplit_set() instead of g_strsplit().
  It avoids pointless extra allocations and strips empty entries.

- use cleanup attribute and return early (instead of "goto error").
2020-08-05 12:47:55 +02:00
Thomas Haller
f1ccd9fe71 dhcp/nettools: don't use systemd header "hostname-util.h" in "nm-dhcp-nettools.c"
We must not use systemd API directly, except via the adapter headers
that expose a subset of the API.

In this case, we already have our own implementation. Use it.
2020-08-05 12:47:55 +02:00
Thomas Haller
5da502a1e1 shared,core: extend nm_utils_is_specific_hostname() and move to shared
nm_utils_is_specific_hostname() is basically to check whether the
hostname is localhost (and also handle "(null)").

In that sense, it's similar to systemd's is_localhost(). Extend or
variant to

  - be case insensitive (like is_localhost()).

  - accept more variants of localhost/localdomain names as special.
2020-08-05 12:47:55 +02:00
Thomas Haller
00c6823ecc shared: add nm_strcmp_ascii_case_with_data() helper 2020-08-05 10:22:11 +02:00
Thomas Haller
a46940d0d7 shared: add NM_STR_HAS_SUFFIX_ASCII_CASE() macro 2020-08-05 10:22:11 +02:00
Thomas Haller
3b64d88a93 shared: add NM_IN_STRSET_ASCII_CASE() macro 2020-08-05 10:22:10 +02:00
Thomas Haller
b16b42266d shared: make implementation for NM_IN_STRSET() more reusable 2020-08-05 10:22:10 +02:00
Thomas Haller
3c846baa83 shared: add nm_strv_ptrarray_get_unsafe() helper
It's called "unsafe" because the returned pointer array is not
NULL terminated. This is due to a limitation of GPtrArray which
doesn't support that. If you want a NULL terminated strv array,
use a GArray based API, like nm_strvarray_*().
2020-08-05 10:22:10 +02:00
Thomas Haller
77c000aa0b shared/tests: add nmtst_assert_ip_address() 2020-08-05 10:22:10 +02:00
Thomas Haller
5150e45fcc shared/tests: add static assert to ensure proper alignment of NMIPAddr struct 2020-08-05 10:22:10 +02:00
Thomas Haller
26d768a2b6 contributing: add section about our git-notes refs/notes/bugs 2020-08-05 09:56:02 +02:00