summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* device: remove the possibility of inheriting the unmanaged condition from ↵ac/vlanAna Cabral2022-10-153-22/+17
| | | | | | | | | | | | | the parent of a device This commit is part of a broader change that eliminates inheriting the unmanaged condition from the parent of a device, for all device types: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1418 What motivates this change are the unncessary issues brought by this inheritance. You can see some problems described here: https://bugzilla.redhat.com/show_bug.cgi?id=2110307#c0.
* device: remove the unmanaged inheritance from the parent for macvlan devicesAna Cabral2022-10-151-36/+1
| | | | | | | | | | | This commit is part of a broader change that eliminates inheriting the unmanaged condition from the parent of a device, for all device types: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1418 What motivates this change are the unncessary issues brought by this inheritance. You can see some problems described here: https://bugzilla.redhat.com/show_bug.cgi?id=2110307#c0.
* device: remove the unmanaged inheritance from the parent for macsec devicesAna Cabral2022-10-151-36/+1
| | | | | | | | | | | This commit is part of a broader change that eliminates inheriting the unmanaged condition from the parent of a device, for all device types: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1418 What motivates this change are the unncessary issues brought by this inheritance. You can see some problems described here: https://bugzilla.redhat.com/show_bug.cgi?id=2110307#c0.
* device: remove the unmanaged inheritance from the parent for 6lowpan devicesAna Cabral2022-10-151-37/+0
| | | | | | | | | | | This commit is part of a broader change that eliminates inheriting the unmanaged condition from the parent of a device, for all device types: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1418 What motivates this change are the unncessary issues brought by this inheritance. You can see some problems described here: https://bugzilla.redhat.com/show_bug.cgi?id=2110307#c0.
* device: allow configuration of VLAN on an unmanaged interfaceAna Cabral2022-10-151-35/+0
| | | | | | | | | | | | | | | | | | | | | It is not possible to configure a VLAN interface on unmanaged NIC. This forces users who only want to create a VLAN interface to take ownership over possibly shared underlying NIC. In OpenShift, the SR-IOV operator is currently not using NetworkManager to configure VFs. When it starts working with a NIC, it explicitly makes it unmanaged. Then, users cannot create a VLAN interface on PFs managed by the operator. This commit eliminates this issue by allowing configuring VLAN on an interface without requesting it to be managed by NetworkManager. This commit is part of a broader change that eliminates inheriting the unmanaged condition from the parent of a device, for all device types: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1418 https://bugzilla.redhat.com/show_bug.cgi?id=2110307
* team: log port config when it's setLubomir Rintel2022-10-141-0/+1
| | | | | | | Log the port config at trace level. Helps making debugging less miserable. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1423
* team: don't log failures to connect to teamd on error levelLubomir Rintel2022-10-141-20/+32
| | | | | | | | | | | | | | ensure_teamd_connection() is called from multiple spots. Sometimes we call opportunistically without having started teamd (e.g. when on update_connection() when generating a connection for teaming device that was created) and handle the failure to connect gracefully. Let's not pollute the logs with things on ERROR level that are not actually serious. Replace the logging statements with DEBUG or WARN depending on whether we expect ensure_teamd_connection() to actually succeed. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1422
* team: set port configuration even if it's emptyLubomir Rintel2022-10-141-16/+14
| | | | | | | | | | | | | | | Call teamdctl_port_config_update_raw() when we're attaching a port even if all of team-slave setting properties are default. This is done to ensure teamd "knows" about the port (that is, "teamdctl ... port present" returns success) when we're done activating the slave connection. It will pick it up anyway from netlink, but that can happen after the activation is done, resulting in a possible race. Fixes-test: @remove_active_team_profile https://bugzilla.redhat.com/show_bug.cgi?id=2102375 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1421
* po: update Hungarian (hu) translationBalázs Úr2022-10-141-3828/+4485
| | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1425
* libnm: merge branch 'th/nmclient-wait-shutdown'Thomas Haller2022-10-147-48/+683
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1414
| * libnm: add nm_client_wait_shutdown() function for cleaning up NMClientThomas Haller2022-10-145-42/+618
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a fire-and-forget function to wait for shutdown to be complete. It's not entirely trivial to ensure all resources of NMClient are cleaned up. That matters only if NMClient uses a temporary GMainContext that the user wants to release while the application continues. For example, to do some short-lived operations an a worker thread. It's not trivial also because glib provides no convenient API to integrate a GMainContext in another GMainContext. We have that code as nm_utils_g_main_context_create_integrate_source(), so add a helper function to allow the user to do this. The function allows to omit the callback, in which case the caller wouldn't know when shutdown is complete. That would still be useful however, when integrating the client's context into the caller's context, so that the client's context gets automatically iterated until completion. The following test script will run out of file descriptors, when wait_shutdown() is not used: #!/bin/python import gi gi.require_version("NM", "1.0") from gi.repository import NM, GLib for i in range(1200): print(f">>>{i}") ctx = GLib.MainContext() ctx.push_thread_default() nmc = NM.Client.new() ctx.pop_thread_default() def cb(unused, result, i): try: NM.Client.wait_shutdown_finish(result) except Exception: # cannot happen assert False else: print(f">>>>> {i} complete") nmc.wait_shutdown(True, None, cb, i) while GLib.MainContext.default().iteration(False): pass
| * libnm: add "initialized-{good,bad}" flags to NMClientInstanceFlagsThomas Haller2022-10-143-6/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When using async initialization with GAsyncInitable, the user usually can only know that initialization is complete by passing a callback. In simple cases, that can be cumbersome. Also expose a flag that allows to poll that information. Reuse the existing NM_CLIENT_INSTANCE_FLAGS for that. There is an ugliness here, that suddenly there are instance flags that cannot be set, but are still returned by the getter. But as this is a relatively obscure feature, it seems more lightweight to implement it this way (instead of adding a separate property and getter function).
| * glib-aux/tests: add nmtst_true_once() helperThomas Haller2022-10-141-0/+22
|/
* dns: merge branch 'bg/dns-sort'Beniamino Galvani2022-10-141-1/+8
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1427
| * dns: sort the ip-data list when a new element is addedBeniamino Galvani2022-10-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | In nm_dns_manager_set_ip_config() we try to avoid calling update_dns() unless something changes, because updating DNS is expensive and can trigger other actions such as a new hostname resolution. When we add a new ip_data, even if the new element is equivalent to the old one that was removed, we need to sort the list again. Fixes: ce0a36d20fa6 ('dns: better track l3cd changes') https://bugzilla.redhat.com/show_bug.cgi?id=2098574
| * dns: add comment explaining the purpose of `any_removed`Beniamino Galvani2022-10-131-1/+7
|/
* nmcli: fix typo 'exiting' -> 'existing'gaoxingwang2022-10-121-1/+1
| | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1115 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1424
* trivial: fix indentationThomas Haller2022-10-112-2/+2
|
* all: avoid "-Wunreachable-code-generic-assoc" warning with _Generic()Thomas Haller2022-10-113-77/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | Clang 15 ([1], [2]) added Added the -Wunreachable-code-generic-assoc diagnostic flag (grouped under the -Wunreachable-code flag) which is enabled by default and warns the user about _Generic selection associations which are unreachable because the type specified is an array type or a qualified type. This causes compiler warnings with various uses of _Generic(): ../src/libnm-glib-aux/nm-shared-utils.h:2489:12: error: due to lvalue conversion of the controlling expression, association of type 'const char *const *const' will never be selected becaus e it is qualified [-Werror,-Wunreachable-code-generic-assoc] return nm_strv_find_first((const char *const *) strv->pdata, strv->len, str); ^ ../src/libnm-glib-aux/nm-shared-utils.h:475:25: note: expanded from macro 'nm_strv_find_first' _nm_strv_find_first(NM_CAST_STRV_CC(list), (len), (needle)) ^ ../src/libnm-glib-aux/nm-macros-internal.h:397:22: note: expanded from macro 'NM_CAST_STRV_CC' const char *const*const: (const char *const*) (value), \ ^ Clang is correct. [1] https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#improvements-to-clang-s-diagnostics [2] https://reviews.llvm.org/D125259
* all: fix deprecated function declaration without a prototypeThomas Haller2022-10-116-11/+11
| | | | | | | | | | | | | | | | | | | | | Clang 15 now (correctly) warns about this: ../src/libnm-core-impl/nm-vpn-plugin-info.c:201:40: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] _nm_vpn_plugin_info_get_default_dir_etc() ^ void ../src/libnm-core-impl/nm-vpn-plugin-info.c:213:40: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] _nm_vpn_plugin_info_get_default_dir_lib() ^ void ../src/libnm-core-impl/nm-vpn-plugin-info.c:226:41: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] _nm_vpn_plugin_info_get_default_dir_user() ^ void ../src/libnm-core-impl/nm-vpn-plugin-info.c:315:29: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] nm_vpn_plugin_info_list_load() ^ void
* man/nmcli: document variables affecting fancy outputLubomir Rintel2022-10-111-1/+40
| | | | | | Notably, PAGER, TERM and NO_COLORS. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1419
* platform: use NM_STR_HAS_PREFIX() where appropriateThomas Haller2022-10-111-22/+22
| | | | | | | | Prefer it over strncmp(), because it seems easier to understand (to me). Prefer it over g_str_has_prefix(), because it can directly expand to a plain strncmp() -- instead of first humping to glib, then calling strlen() before calling strncmp().
* platform: in _linktype_get_type() check for devtype before the interface nameThomas Haller2022-10-111-9/+11
| | | | | I think the devtype should be checked first, before the interface name. Checking by name seems really very hacky, move that last.
* platform: also recognize rmnet/ccmni with ARPHRD_RAWIP typeRatchanan Srirattanamet2022-10-111-5/+16
| | | | | | | | | | | | | Turns out, modern rmnet_* devices doesn't use ARPHRD_ETHER arptype, but ARPHRD_RAWIP. Also complicating the fact is that ARPHRD_RAWIP is actually added in v4.14, but devices using kernel before that version define this value as "530" in an out-of-tree patch [1]. Recognize this case and check explicitly for 3 values of arptype. [1] https://github.com/LineageOS/android_kernel_google_msm-4.9/commit/54948008c293fdf48552a5c39c91c09c3eb76ed2 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1392
* release: bump version to 1.41.3 (development)1.41.3-devBeniamino Galvani2022-10-112-2/+2
|
* gitlab-ci: update ci-templates versionThomas Haller2022-10-112-7/+7
|
* gitlab-ci: enable F38 container and regenerate containersThomas Haller2022-10-112-6/+38
|
* cli: fix translation string for error message in set_property()Thomas Haller2022-10-111-2/+3
| | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1112
* glib-aux: merge branch 'th/uuid-generate-strv-null'Thomas Haller2022-10-117-57/+139
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1417
| * glib-aux: extend nm_uuid_generate_from_strings() to honor NULL valuesThomas Haller2022-10-113-36/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you call nm_uuid_generate_from_strings_strv(uuid_type, type_arg, v1, v2); you'd probably expect that both values are honored in some way. However, if v1 happened to be NULL, then previously v2 would be ignored. Extend nm_uuid_generate_from_strings() to accept also NULL values and pass on the length. Currently, there are no users of nm_uuid_generate_from_strings(), so nobody is affected by this change. Also extend nm_uuid_generate_from_strings_strv() to take a length argument. It still accepts "-1" to take the input strv as a NULL terminated array. If a positive length is provided to nm_uuid_generate_from_strings_strv(), it hashes the same UUID as the respective NULL terminated array. But of course only, if there is no NULL inside the array. If there are any NULLs, a distinct UUID gets generated.
| * glib-aux: add and use nm_uuid_generate_from_strings_old()Thomas Haller2022-10-116-21/+19
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For a long time we have a function like nm_uuid_generate_from_strings(). This was recently reworked and renamed, but it preserved behavior. Preserving behavior is important for this function, because for the existing users, we need to keep generating the same UUIDs. Originally, this function was a variadic function with NULL sentinel. That means, when you write nm_uuid_generate_from_strings(uuid_type, type_arg, v1, v2, v3, NULL); and v2 happens to be NULL, then v3 is ignored. That is most likely not what the user intended. Maybe they had a bug and v2 should not be NULL. But nm_uuid_generate_from_strings() should not require that all arguments are non-NULL and it should not ignore arguments after the first NULL. For example, one user works around this via uuid = nm_uuid_generate_from_strings_old("ibft", s_hwaddr, s_vlanid ? "V" : "v", s_vlanid ? s_vlanid : "", s_ipaddr ? "A" : "DHCP", s_ipaddr ? s_ipaddr : ""); which is cumbersome and ugly. That will be fixed next, by adding a function that doesn't suffer from this problem. But "this problem" is part of the API of the function, we cannot just change it. Instead, rename it and all users, so they can keep doing the same. New users of course should no longer use the "old" function.
* glib-aux,libnmc: merge branch 'th/setting-info-binsearch'Thomas Haller2022-10-115-83/+265
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1369
| * libnm: use binary search for nm_meta_setting_infos_by_gtype() for libnmcThomas Haller2022-10-112-8/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The file "nm-meta-setting-base-impl.c" is shared by "libnm-core-impl" and "libnmc-setting". For "libnm-core-impl" it uses a efficient lookup from the gtype. For "libnmc-setting", that class information is not available, so it did a linear search. Instead, do a binary search. Tested: diff --git a/src/libnm-core-impl/nm-meta-setting-base-impl.c b/src/libnm-core-impl/nm-meta-setting-base-impl.c index 3434c858391f..62c366d2ca42 100644 --- a/src/libnm-core-impl/nm-meta-setting-base-impl.c +++ b/src/libnm-core-impl/nm-meta-setting-base-impl.c @@ -821,6 +821,11 @@ nm_meta_setting_infos_by_gtype(GType gtype) { const NMMetaSettingInfo *setting_info; +#if _NM_META_SETTING_BASE_IMPL_LIBNM + return _infos_by_gtype_binary_search(gtype); +#endif + nm_assert_not_reached(); + #if _NM_META_SETTING_BASE_IMPL_LIBNM setting_info = _infos_by_gtype_from_class(gtype); #else diff --git a/src/libnm-core-impl/tests/test-setting.c b/src/libnm-core-impl/tests/test-setting.c index 85d549eb766c..65fcafd076c9 100644 --- a/src/libnm-core-impl/tests/test-setting.c +++ b/src/libnm-core-impl/tests/test-setting.c @@ -5134,6 +5134,29 @@ main(int argc, char **argv) { nmtst_init(&argc, &argv, TRUE); + { + gs_unref_object NMConnection *con = NULL; + guint8 ctr = 0; + guint i; + + con = nmtst_create_minimal_connection("test", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL); + + nm_connection_add_setting(con, nm_setting_wired_new()); + + nmtst_connection_normalize(con); + nmtst_assert_connection_verifies_without_normalization(con); + + for (i = 0; i < 10000000; i++) { + ctr += GPOINTER_TO_UINT(nm_connection_get_setting(con, NM_TYPE_SETTING_WIRED)); + ctr += GPOINTER_TO_UINT(nm_connection_get_setting(con, NM_TYPE_SETTING_CONNECTION)); + ctr += GPOINTER_TO_UINT(nm_connection_get_setting(con, NM_TYPE_SETTING_PROXY)); + ctr += GPOINTER_TO_UINT(nm_connection_get_setting(con, NM_TYPE_SETTING_WIREGUARD)); + ctr += GPOINTER_TO_UINT(nm_connection_get_setting(con, NM_TYPE_SETTING_IP4_CONFIG)); + } + + return !!ctr; + } + g_test_add_func("/libnm/test_connection_uuid", test_connection_uuid); g_test_add_func("/libnm/settings/test_nm_meta_setting_types_by_priority", Results of `make src/libnm-core-impl/tests/test-setting && libtool --mode=execute perf stat -r 5 -B src/libnm-core-impl/tests/test-setting`: 1) previous linear search: 3,182.81 msec 2) bsearch not inlined: 1,611.19 msec 3) bsearch open-coded: 1,214.45 msec 4) bsearch inlined: 1,167.70 msec 5) lookup from class: 1,147.64 msec 1) previous implementation 2) using nm_array_find_bsearch() 3) manually implementing binary search 4) using nm_array_find_bsearch_inline() 5) only available to libnm-core as it uses internal meta data Note that for "libnm-core-impl" the implementation was already fast (5), and it didn't change. It only changed to binary search for "libnmc-setting", which arguably is a less strong use-case.
| * libnm: cleanup implementations for nm_meta_setting_infos_by_gtype()Thomas Haller2022-10-112-52/+62
| | | | | | | | | | | | | | | | | | | | | | | | The file "nm-meta-setting-base-impl.c" is present twice in our source tree and compiled twice. Once with internal headers of libnm-core and once with only public headers. Consequently, there are two implementations for nm_meta_setting_infos_by_gtype(), one that can benefit from internal access to the data structure, and the one for libnmc, which cannot. Refactor the implementations, in the hope to have it clearer.
| * glib-aux: add an inlinable version of nm_array_find_bsearch()Thomas Haller2022-10-112-31/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To implement binary search is not very hard. It's almost easy enough to just open-code it, without using the existing nm_array_find_bsearch() function. In particular, because nm_array_find_bsearch() won't be inlined, and thus it is slower than implementing it by hand. Add nm_array_find_bsearch_inline() as a variant that will be inlined. This actually is as fast as reimplementing it by hand (I measured), which takes away any reason to avoid the function. However, our headers get huge. That may be a problem for complication time. To counter that a bit, only define the function when the caller requests it with a NM_WANT_NM_ARRAY_FIND_BSEARCH_INLINE define.
| * std-aux: add _nm_always_inline for "__attribute__((__always_inline__))"Thomas Haller2022-10-111-0/+1
|/
* tools: avoid Python 3 f-string in "generate-docs-nm-property-infos.py"Thomas Haller2022-10-071-1/+1
| | | | | | We also need to build with python2. No f-strings. Fixes: 8fc7b6df12ed ('tools: rework generating documentation from libnm meta data')
* std-aux: workaround unused variable warning with clang 14 and nm_auto ↵Thomas Haller2022-10-071-2/+2
| | | | cleanup attribute
* ovs: wait that links disappear during initial cleanupBeniamino Galvani2022-10-071-23/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | At startup, we remove from ovsdb any existing interface created by NM and later an interface with the same name might be readded. This can cause race conditions. Consider this series of events: 1. at startup NM removes the entry from ovsdb; 2. ovsdb reports success; 3. NM inserts an interface with the same name again; 4. ovs-vswitch monitors ovsdb changes, and gets events for removal and insertion. Depending on how those events are split in different batches, it might decide: 4a. to delete the link and add it back, or 4b. to keep the existing link because the delete and insertion cancel out each other. When NM sees the link staying in platform, it doesn't know if it's because of 4b or because 4a will happen eventually. To avoid this ambiguity, after ovsdb reports the successful deletion NM should also wait that the link disappears from platform. Unfortunately, this means that ovsdb gets a dependency to the platform code. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1386
* glib-aux: use nm_assert() in nm_{ptr,}array_find_bsearch()Thomas Haller2022-10-071-10/+19
| | | | | | | | | | | | | | | These checks don't seem very useful, to have them enabled in production code. What is actually the real danger of messing up with binary search, is that the input array is not properly sorted. Asserting for that would be way more useful, but also likely too expensive to be worth it. Checking that the input arguments are not NULL/zero, is not that useful, because we "usually" won't make such mistakes. While at it, declare each local variable on a separate line.
* policy: track the autoconnect retries in devices for multi-connectFernando Fernandez Mancera2022-10-073-10/+157
| | | | | | | | | | | | | | | | | | For connections with multi-connect property set to "multiple", the autoconnect-retries should be tracked per device and not per connection. That means, if autoconnect-retries is set to 2, each device using that connection should retry to autoconnect 2 times. The device autoconnect retries is -2 by default. This is a special value, in NMPolicy context, if the connection used is multi-connect the device value will be set to match the connection retries. Each time the device picks a different connection, it will reset the device autoconnect retries to -2 and if needed, sync. with the connection retries. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1387 https://bugzilla.redhat.com/show_bug.cgi?id=2039734
* device: fix hanging port devices when controller goes down while port is not ↵Thomas Haller2022-10-071-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fully attached This partly reverts 1fe8166fc9fb ('device: only deactivate when the master we've enslaved to goes away'). If the controller fails while the port is not yet fully attached, before this patch the following happened: <info> [1664299566.1065] device (bond0): state change: ip-config -> failed (reason 'config-failed', sys-iface-state: 'managed') ... <warn> [1664299566.1073] device (bond0): Activation: failed for connection 'bond0' <trace> [1664299566.1073] device[6b76ac7314eb0b53] (bond0): master: release one slave a9f10ea824bb1725/eth1 (not enslaved) (configure) <debug> [1664299566.1073] device[a9f10ea824bb1725] (eth1): unmanaged: flags set to [!sleeping,!by-type,!platform-init,!user-explicit,!user-settings,!user-conf=0x0/0x179/managed], forget [is-slave=0x800], reason removed) ... <info> [1664299566.1080] device (eth1): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed') Note that now eth1 has no controller, but it lingers in "ip-config" state indefinitely. If we look at a case where the port is already attached we see: <info> [1664299540.9661] device (bond0): state change: secondaries -> failed (reason 'config-failed', sys-iface-state: 'managed') ... <warn> [1664299540.9667] device (bond0): Activation: failed for connection 'bond0' <trace> [1664299540.9667] device[6b76ac7314eb0b53] (bond0): master: release one slave a9f10ea824bb1725/eth1 (enslaved) (configure) <debug> [1664299540.9667] platform: (eth1) link: releasing 10 from master 'bond0' (80) ... <info> [1664299540.9740] device (bond0): detached bond port eth1 ... <debug> [1664299540.9749] device[a9f10ea824bb1725] (eth1): Activation: connection 'eth1' master failed ... <warn> [1664299540.9749] device (eth1): queue-state[secondaries, reason:none, id:520]: replace previously queued state change ... <debug> [1664299540.9750] device[a9f10ea824bb1725] (eth1): queue-state[deactivating, reason:dependency-failed, id:533]: queue state change <debug> [1664299540.9751] device[a9f10ea824bb1725] (eth1): unmanaged: flags set to [!sleeping,!by-type,!platform-init,!user-explicit,!user-settings,!user-conf=0x0/0x179/managed], forget [is-slave=0x800], reason removed) ... <debug> [1664299541.0201] device[a9f10ea824bb1725] (eth1): enslaved to unknown device 0 (??) ... <debug> [1664299541.0227] device[a9f10ea824bb1725] (eth1): queue-state[deactivating, reason:dependency-failed, id:533]: change state <info> [1664299541.0228] device (eth1): state change: ip-check -> deactivating (reason 'dependency-failed', sys-iface-state: 'managed') Fix that by not ignoring the nm_device_slave_notify_release() call. Now we get: <info> [1664391684.9757] device (bond0): state change: ip-config -> failed (reason 'config-failed', sys-iface-state: 'managed') ... <debug> [1664391684.9759] active-connection[69c2b12d61f5b171]: set state deactivated (was activating) <debug> [1664391684.9760] active-connection[142bb8240f6a696d]: check-master-ready: already signalled (state activating, master 0x56116f1480a0 is in state deactivated) ... <debug> [1664391684.9762] manager: ActivatingConnection now (none) ... <warn> [1664391684.9763] device (bond0): Activation: failed for connection 'bond0' <trace> [1664391684.9763] device[142828814dec6e26] (bond0): master: release one slave 720791275fe8a68c/eth1 (not enslaved) (configure) <debug> [1664391684.9763] device[720791275fe8a68c] (eth1): Activation: connection 'eth1' master failed ... <debug> [1664391684.9764] device[720791275fe8a68c] (eth1): queue-state[deactivating, reason:dependency-failed, id:3047]: queue state change <debug> [1664391684.9765] device[720791275fe8a68c] (eth1): unmanaged: flags set to [!sleeping,!by-type,!platform-init,!user-explicit,!user-settings,!user-conf=0x0/0x179/managed], forget [is-slave=0x800], reason removed) ... <debug> [1664391684.9797] device[720791275fe8a68c] (eth1): queue-state[deactivating, reason:dependency-failed, id:3047]: change state <info> [1664391684.9797] device (eth1): state change: config -> deactivating (reason 'dependency-failed', sys-iface-state: 'managed') Commit 1fe8166fc9fb ('device: only deactivate when the master we've enslaved to goes away') added the "return", but it seems to also add it in cases where we need to handle this. Restrict the return to cases if we do "no-config". https://bugzilla.redhat.com/show_bug.cgi?id=2130287 Fixes: 1fe8166fc9fb ('device: only deactivate when the master we've enslaved to goes away') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1406
* glib-aux/trivial: style fixThomas Haller2022-10-061-0/+1
|
* core: wait for carrier before resolving hostname via DNSBeniamino Galvani2022-10-062-3/+33
| | | | | | | | | If there is no carrier on a device, don't try to resolve the hostname on it. Instead, subscribe to carrier change notifications and retry again once carrier goes up. https://bugzilla.redhat.com/show_bug.cgi?id=2118817 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1402
* libnm: embed address family in NMSettingIPConfigClass for ↵Thomas Haller2022-10-064-18/+36
| | | | | | | | | | | | NM_SETTING_IP_CONFIG_GET_ADDR_FAMILY() The G_TYPE_INSTANCE_GET_CLASS() macro is just one pointer dereference (self)->g_class, plus additional assertions with debug builds. As such, it is as fast as it gets. Embed the address family there, and implement NM_SETTING_IP_CONFIG_GET_ADDR_FAMILY() that way. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1395
* libnm: merge branch 'th/connection-path-as-ref-str'Thomas Haller2022-10-067-13/+83
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1394
| * libnm: use NMRefString for nm_connection_get_path()Thomas Haller2022-10-066-12/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NMConnection is an interface, implemented by NMSimpleConnection and NMRemoteConnection. For the most part, an NMConnection is only the content of the profile (the settings). The "path" of the connection refers to the D-Bus path, and wouldn't really make sense of the NMConnection interface or the NMSimpleConnection type. As such, the daemon (which only uses NMConnection and NMSimpleConnection) never sets the path. Only libnm does. NMClient uses NMRefString extensively for the D-Bus interface and the path is already internalized. Take advantage of that. It is very likely, that we are able to share the path instance in libnm at which point it makes sense to use NMRefString. Also, during nm_simple_connection_new_clone(), we can just take another reference instead of cloning the string.
| * glib-aux: reorder comparison in nm_ref_string_equal_str()Thomas Haller2022-10-061-1/+1
| | | | | | | | | | We usually compare first for pointer equality. It seems to make more sense this way. Swap.
| * glib-aux: add nm_ref_string_reset() helperThomas Haller2022-10-061-0/+17
|/
* docs: merge branch 'th/generate-docs'Thomas Haller2022-10-065-123/+418
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1410