Commit graph

31892 commits

Author SHA1 Message Date
Thomas Haller
0837d43fdd
libnm/trivial: rename internal connection-get-setting methods
This function will be exposed on the internal header. Rename to
_nm_connection_get_setting_by_metatype().

(cherry picked from commit 27cbf584bd)
2023-06-30 17:59:51 +02:00
Thomas Haller
c965896038
core: merge branch 'th/auto-activate-rework'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1597

(cherry picked from commit c07146bd0e)
2023-06-30 17:59:19 +02:00
Thomas Haller
cef0c31b2c
core: simplify tracking of delete_on_deactivate idle action
Before commit a42682d44f ('device: take reference to device object
before 'delete_on_deactivate''), we used a weak pointer to track the
idle action.

As we now use a strong reference, we can store all data about the idle
action in NMDevice itself. Drop DeleteOnDeactivateData.

(cherry picked from commit b48c314328)
2023-06-30 17:58:53 +02:00
Thomas Haller
d412eb8aca
core: assert that devices are not registered when disposing NMPolicy
NMDevice holds a reference to NMManager, which holds a reference to NMPolicy.
It is not possible that we try to dispose NMPolicy while there are still devices
registered. That would be a bug, that we need to find and solve
differently. Add an assertion instead of trying to handle it.

(cherry picked from commit aede228974)
2023-06-30 17:58:53 +02:00
Thomas Haller
3b05cbc33b
core: don't take reference on NMDevice to track auto-activate
Add an assertion to nm_policy_device_recheck_auto_activate_schedule(),
that the device is currently registered in NMPolicy. Calling it outside
would be odd, and likely a bug.

But if we only register the auto-activate while being registered, we
don't need to take an additional reference. We know that the object must
be be alive (also, we have assertions that in fact it is still alive).

(cherry picked from commit 0dd4724446)
2023-06-30 17:58:53 +02:00
Thomas Haller
5fddc6d723
core: rework tracking of auto-activating devices in NMPolicy
Hook the information for tracking the activation of a device, to the
NMDevice itself. Sure, that slightly couples the NMPolicy closer to
NMDevice, but the result is still simpler code because we don't need a
separate ActivateData.

It also means we can immediately tell whether the auto activation check
for NMDevice is already scheduled and don't need to search through the
list.

(cherry picked from commit a22e5080a0)
2023-06-30 17:58:51 +02:00
Thomas Haller
35946a9fb6
core: add nm_manager_get_policy() accessor
NMPolicy really should be merged into NMManager. It has not a clear responsiblity
so that there are two separate objects only makes things confusing. Anyway. It
is permissible to look up the NMPolicy instance of a NMManager. Add an accessor.

(cherry picked from commit 520fcc8667)
2023-06-30 17:57:27 +02:00
Thomas Haller
4558c23209
core: call nm_manager_device_recheck_auto_activate_schedule() from "nm-manager.c"
No need to call down to the device, to call back up to the NMManager.

(cherry picked from commit a81925ad32)
2023-06-30 17:57:26 +02:00
Thomas Haller
0c449ef4d8
core: rename nm_device_emit_recheck_auto_activate() to nm_device_recheck_auto_activate_schedule()
It's the better name. Especially since there is no more signal involved,
the term "emit" doesn't match.

Note also how the previous approach using a signal tried to abstract
what is happening. So we were no longer rechecking-autoconnect, instead,
we were emitting-a-signal-to-recheck-autoconnect. Just be plain about
what it is doing and don't go through a layer of signal.

(cherry picked from commit 751b927cf2)
2023-06-30 17:57:26 +02:00
Thomas Haller
3382e666b2
core: drop NM_DEVICE_RECHECK_AUTO_ACTIVATE signal and call policy directly
GObject signals don't make the code easier to understand, on the
contrary.  They may have their purpose, when objects truly must/should
not be aware of each other, and need to be composed very loosely. That
is not the case here.

There really is only one subscriber to NM_DEVICE_RECHECK_AUTO_ACTIVATE
signal, and it only makes sense this way. Instead of going through a
signal invocation, just call the well known method directly. It becomes
clearer who calls this code (and it has a lower overhead).

When using cscope/ctags it also is easier to follow the code because the
tools understand function calls.

(cherry picked from commit 3c59c6b393)
2023-06-30 17:57:25 +02:00
Thomas Haller
65d127461b
core: use GSource for tracking reset_connections_retries idle action
The numeric source IDs are discouraged. Use a GSource instead.

(cherry picked from commit aa2569a9cd)
2023-06-30 17:57:02 +02:00
Thomas Haller
7e49e32f18
core: use GSource for tracking _device_recheck_auto_activate_all_cb idle action
The numeric source IDs are discouraged. Use a GSource instead.

(cherry picked from commit 1559c37b9f)
2023-06-30 17:56:13 +02:00
Thomas Haller
a446ee2e1b
core: rename internal function nm_policy_device_recheck_auto_activate_all_schedule()
The "all" variant is strongly related to nm_policy_device_recheck_auto_activate_schedule().
Rename, so that the names express that better.

(cherry picked from commit 886786ee0b)
2023-06-30 17:56:13 +02:00
Thomas Haller
073d3a619f
core: expose and rename nm_policy_device_recheck_auto_activate_schedule()
Let's simplify this part of the code. This is the first step.

(cherry picked from commit f1c15f0ae7)
2023-06-30 17:56:13 +02:00
Thomas Haller
72f9cfe8bc
core: don't trigger recheck to auto activate for deleted devices
The delete_on_deactivate_link_delete() handler may be called after the
device was already removed from NMManager. Don't allow that.

Check whether the device is still exported on D-Bus as indication.

(cherry picked from commit 49c1e01519)
2023-06-30 17:56:13 +02:00
Thomas Haller
e74e71d0bc
core: merge branch 'th/rh2152864-ovs-autoactivate'
https://bugzilla.redhat.com/show_bug.cgi?id=2152864
Fixes-test: @NM_reboot_openvswitch_vlan_configuration_var2

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1603

(cherry picked from commit e66b93b01e)

(cherry picked from commit 3989b1c1580339cd1e12e108387b06d9ec461207)
2023-06-30 17:55:48 +02:00
Thomas Haller
a4bce9e89b
device: trigger a recheck to autoconnect when unrealizing ovs-interface
NM_reboot_openvswitch_vlan_configuration_var2 test exposes a race. What
the test does, is to create OVS profiles and repeatedly restart
NetworkManager, checking that those profiles autoconnect and the OVS
configuration gets created.

There is a race, where:

- the OVS interface exists, and an NMDeviceOvsInterface is created
- first ovsdb cleans up old interfaces, sending a json request.
- OVS deletes the interface, and NetworkManager first picks up the
  platform signal (there is a race here, usually the ovsdb request
  completes first, which will cleanup the NMDeviceOvsInterface in
  a different way).
- when the device gets unrealized, we don't schedule a
  check-autoactivate, so the device stays down.

See https://bugzilla.redhat.com/show_bug.cgi?id=2152864#c5 for a log
file with more details.

What should instead happen, is to autoactivate the OVS interface, which
then also fully configures the port and bridge interfaces.

Explicitly schedule an autoactivate when unrealizing devices.

Note that there are now several cases, where NetworkManager autoconnects
more eagerly. This even affects some CI tests and user-visible behavior.
But I think relying on "just don't call nm_device_emit_recheck_auto_activate()
to hope that autoconnect doesn't happen is wrong. It must always be
possible to trigger an autoconnect check, and the right thing must
happen. We only don't trigger autoconnect checks *all* the time, because
it would be a waste of CPU resources, but whenever we slightly suspect
that an autoconnect may happen, we must be allowed to trigger a check.
If a device is in a condition where it previously did not autoconnect,
and it also *should* not autoconnect, then we need to fix the code that
evaluates whether an autoconnect may happen (not avoid triggering a
check).

https://bugzilla.redhat.com/show_bug.cgi?id=2152864
Fixes-test: @NM_reboot_openvswitch_vlan_configuration_var2
(cherry picked from commit e699dff46a)
(cherry picked from commit aac8d0cc0cda41da3ddbe952b658ed06a26369e0)
2023-06-30 17:55:48 +02:00
Thomas Haller
f3a68c88a4
device: block autoconnect of profile when deleting device
Currently, when we delete a device then autoconnect does not kick in
right away. But that is only, because we happen not to schedule a
"autoactivate" recheck.

What should be happen, is that rechecking whether to autoconnect is
always allowed, and that we have the necessary state to know that
autoconnect currently should not work.

Instead, block autoconnect of the involved profile. That makes sense,
because clearly we don't want to autoconnect right again after `nmcli
device delete $iface`.

(cherry picked from commit 14d429dd17)
(cherry picked from commit 53a3368bd600746c30798fb95113a8ccc5d48de3)
2023-06-30 17:55:48 +02:00
Thomas Haller
d07827dfe1
device: minor cleanup of code path in delete_cb()
(cherry picked from commit c68cbcb8fa)
(cherry picked from commit ae430f37ed64f7a78ee6912b39687a174113714d)
2023-06-30 17:55:48 +02:00
Thomas Haller
24ababea80
core: expose accessors to NMManager in NMSettings, NMSettingsConnection, NMDevice
We should avoid using the NM_MANAGER_GET singleton. Everybody already
has a manager instance. Expose it and allow to use it.

(cherry picked from commit 20f791d8fe)
2023-06-30 17:55:37 +02:00
Beniamino Galvani
2ddb4e5942 dns: fix tracking of best ip config
When a IP configuration has type "best", it is the configuration with
the best (lowest) metric default route for the specific address
family. Therefore, there can be only one best configuration for
address family.

When a new configuration is added as best, make sure it is the only
one for the address family.

This reverts commit 0abc14b3a0.

Fixes: 0abc14b3a0 ('core: remove unused best_ip_config_[46] field in NMDnsManager')

https://lists.freedesktop.org/archives/networkmanager/2023-June/000123.html
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1331
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1683
(cherry picked from commit 646e041523)
2023-06-29 15:17:53 +02:00
Thomas Haller
94e1225303
release: bump version to 1.42.9 (development) 2023-06-28 13:24:13 +02:00
Thomas Haller
7c6da25396
release: bump version to 1.42.8 2023-06-28 13:24:13 +02:00
Thomas Haller
ee696868d2
NEWS: update 2023-06-28 12:11:28 +02:00
Gris Ge
18ce5f43bd setting-connection: Unblock autoconnect upon finish of Reapply
The activation of a connection will clear the block of autoconnect,
we should do the same for reapply.

Signed-off-by: Gris Ge <fge@redhat.com>
(cherry picked from commit 0486efd358)
2023-06-27 19:53:54 +08:00
Thomas Haller
cbb07f0fc2
NEWS: update 2023-06-27 13:32:15 +02:00
Thomas Haller
695b60a6cc
ppp: merge branch 'th/pppd-so-rename'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1312

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1660

(cherry picked from commit 6f9f90417e)
2023-06-27 12:35:01 +02:00
Thomas Haller
8083bf1c7d
ppp/autotools: add missing check for symbols of libnm-ppp-plugin
(cherry picked from commit 0a7145a061)
2023-06-27 12:35:01 +02:00
Thomas Haller
1c736a44b4
ppp: fix plugin name for "rp-pppoe.so" with ppp 2.5
Between ppp 2.4.8 and 2.4.9, "rp-pppoe.so" was renamed to "pppoe.so" (and a
symlink created). Between 2.4.9 and 2.5.0, the symlink was dropped.

See-also: b2c36e6c0e

I guess, NetworkManager always meant to use ppp's "(rp-)pppoe.so"
plugin, and never the library from the rp-pppoe project.
If a user actually wants to use the plugin from rp-pppoe project, then
this is going to break.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1312

Fixes: afe80171b2 ('ppp: move ppp code to "nm-pppd-compat.c"')
(cherry picked from commit 84e21d8bbc)
2023-06-27 12:35:01 +02:00
Thomas Haller
65756dca7f
ppp: detect the ppp version in the configure script
Previously, the ppp version was only detected (and used) at one place,
in "nm-pppd-compat.c", after including the ppp headers. That was nice
and easy.

However, with that way, we could only detect it after including ppp
headers, and given the ugliness of ppp headers, we only want to include
them in "nm-pppd-compat.c" (and nowhere else).

In particular, 'nm-pppd-compat.c" uses symbols from the ppp daemon, it
thus can only be linked into a ppp plugin, not in NetworkManager core
itself. But at some places we will need to know the ppp version, outside
of the ppp plugin and "nm-pppd-compat.c".

Additionally, detect it at configure time and place it in "config.h".
There is a static assert that we are in agreement with the two ways of
detection.

(cherry picked from commit 3e66c0bde1)
2023-06-27 12:35:00 +02:00
qyecst
867609eaba
man: fix description of environment variable NM_CONFIG_ENABLE_TAG
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1670
(cherry picked from commit 7aebda5631)
2023-06-26 09:49:02 +02:00
Thomas Haller
c66ae93415
platform/tests: check errno on failure to umount() in test_netns_bind_to_path()
The umount() call failed in a test. Rework the assertion, so
we might see the errno of the problem.

(cherry picked from commit 1a0fa85397)
2023-06-13 15:59:28 +02:00
Thomas Haller
e06432cc7f
platform/tests: skip test_netns_bind_to_path() test on failure
Our copr builds start to fail, since the copr builds updated to Fedora
38 ([1]).

  ERROR: src/core/platform/tests/test-link-linux - Bail out! nm:ERROR:src/core/platform/tests/test-link.c:3486:test_netns_bind_to_path: assertion failed (nmtstp_run_command("ip netns exec " P_NETNS_BINDNAME " true") == 0): (65280 == 0)

The cause is not understood, but it seems not worth investigating.
Just skip the test.

[1] https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/KOR3HE2VHHIPDBLDLXTYRMON6JQXCHMW/#J4K5VB5SA6I5P2ZLI65OHNQ6X7SINSHA

(cherry picked from commit 8dfca3d552)
2023-06-12 12:28:04 +02:00
Thomas Haller
268819367e
cloud-setup: merge branch 'th/cloud-setup-fix-cancellation'
https://bugzilla.redhat.com/show_bug.cgi?id=2207812

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1654

(cherry picked from commit 7e6a6dd275)
2023-06-12 10:40:19 +02:00
Thomas Haller
98be3dd5ac
cloud-setup: clear error variable in nmcs_device_reapply()
This is rather bad, because if we reach the "goto again" case,
the error variable is not cleared. Subsequently passing the
error location to nm_device_reapply_finish() will trigger a glib
warning.

Fixes: 29b0420be7 ('nm-cloud-setup: set preserve-external-ip flag during reapply')
(cherry picked from commit c70a5470be)
2023-06-12 10:40:19 +02:00
Thomas Haller
0a033798ac
cloud-setup: fix terminating in the middle of reconfiguring the system
Once we start reconfiguring the system, we need to finish on all
interfaces. Otherwise, we might reconfigure some interfaces, abort
and leave the network broken. When that happens, a subsequent run
might also be unable to recover, because we are unable to reach the
HTTP meta data service.

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

Fixes: 69f048bf0c ('cloud-setup: add tool for automatic IP configuration in cloud')
(cherry picked from commit dab114f038)
2023-06-12 10:40:19 +02:00
Thomas Haller
707febe83b
device: only remember "forwarding" sysctl the first time in _dev_ipac6_start()
Fixes: 4c48301594 ('device: don't reset "net.ipv6.conf.$IFACE.forwarding"')
(cherry picked from commit 6050da93bd)
2023-06-08 15:08:12 +02:00
Thomas Haller
f578051b40
device: don't reset "net.ipv6.conf.$IFACE.forwarding"
According to systemd, IPv6 forwarding is special anyway, and they only
enable forwarding for "net.ipv6.conf.all.forwarding" ([1]).

Since commit 46e63e03af ('device: announce the managed IPv6
configuration with ipv6.method=shared') we support "ipv6.method=shared"
and enable forwarding for IPv6, on the interface. Whether that makes
sense is questionable, given [1] and the claim that setting it
per-interface is not useful.

Anyway, since that change we always reset the "forwarding" sysctl to
zero, when we don't enable shared mode. That is not right, because the
user didn't explicitly ask for that (and there is no configuration
option like systemd-networkd's "IPForward=" setting to control that).

What we instead should do, not touch/reset the sysctl, unless we really
want to.

No longer set "forwarding" to zero by default. And only restore the
previous value (_dev_sysctl_save_ip6_properties()) if we actually
changed the value to "1".

[1] b8fba0cded/src/network/networkd-sysctl.c (L79)

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/923

Fixes: 46e63e03af ('device: announce the managed IPv6 configuration with ipv6.method=shared')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1616
(cherry picked from commit 4c48301594)
2023-06-08 15:07:51 +02:00
Thomas Haller
26e789bdcf
platform/tests: fix infiniband_partition_delete() in fake platform
Fixes: 9c323261ea ('platform: use nm_utils_new_infiniband_name()')
(cherry picked from commit 6b28c2867b)
2023-06-08 10:44:42 +02:00
Thomas Haller
c6977592c3
cloud-setup: fix _aliyun_base() initializing base URL
Fixes: f3404435a9 ('cloud-setup: configure secondary ip in Aliyun cloud')
(cherry picked from commit 62104477c3)
2023-06-08 10:43:09 +02:00
Thomas Haller
d4b1cb7276
ppp: merge branch 'th/ppp25'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1272
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1558

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1607

(cherry picked from commit 5df19f5b26)
2023-06-05 11:40:20 +02:00
Thomas Haller
facd2ae916
ppp: move ppp code to "nm-pppd-compat.c"
Using the ppp code is rather ugly.

Historically, the pppd headers don't follow a good naming convention,
and define things that cause conflicts with our headers:

  /usr/include/pppd/patchlevel.h:#define VERSION          "2.4.9"
  /usr/include/pppd/pppd.h:typedef unsigned char  bool;

Hence we had to include the pppd headers in certain order, and be
careful.

ppp 2.5 changes API and cleans that up. But since we need to support
also old versions, it does not immediately simplify anything.

Only include "pppd" headers in "nm-pppd-compat.c" and expose a wrapper
API from "nm-pppd-compat.h". The purpose is that "nm-pppd-compat.h"
exposes clean names, while all the handling of ppp is in the source
file.

(cherry picked from commit afe80171b2)
2023-06-05 11:40:19 +02:00
Eivind Næss
521f936567
ppp, adding support for compiling against pppd-2.5.0
This change does the following
* Adding in nm-pppd-compat.h to mask details regarding different
  versions of pppd.
* Fix the nm-pppd-plugin.c regarding differences in API between
  2.4.9 (current) and latet pppd 2.5.0 in master branch
* Additional fixes to the configure.ac to appropriately set defines used
  for compilation

(cherry picked from commit 8469c09a50)
2023-06-05 11:40:19 +02:00
Eivind Næss
89bde5c9ca
build: detect pppd version via pkg-config for PPPD_PLUGIN_DIR
Ppp 2.5 adds a pkg-config file, so we can detect the version.
Use it.

[thaller@redhat.com: split out patch]

(cherry picked from commit 0324098afa)
2023-06-05 11:40:19 +02:00
Thomas Haller
46bf0ed6e7
ifcfg: merge branch 'th/fix-ifcfg-infiniband-p-key'
https://bugzilla.redhat.com/show_bug.cgi?id=2209164

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1646

(cherry picked from commit 01ab5ce4a8)
2023-06-05 11:01:40 +02:00
Thomas Haller
d8f7fec9e0
ifcfg: better handle non-full-membership PKEY_ID with new PKEY_ID_NM variable
Infiniband profiles can have a p-key set. Both in kernel API
("create_child" sysctl) and in NetworkManager API, that key can range
from 0x0001 to 0xFFFF (0x8000 excluded). NetworkManager does not support
renaming the interface, so kernel always assigns the interface name
"$PHYSDEV.$PKEY_ID" (with $PKEY_ID as 4 character hex digits).

Note that the highest bit in the p-key (0x8000) is the full-membership
flag. Internally, kernel only supports full-membership so when we create
for example "ib0.00c1" and "ib0.80c1" interfaces, their actually used
p-key is in both cases 0x80c1 and you can see it with `ip -d link`.
Nonetheless, kernel and NetworkManager allow to configure the p-key
without the highest bit set, and the result differs in the interface
name.

Note that initscripts' ifup-ib0 would always internally coerce the
PKEY_ID variable to have the high bit set ([1]). It also would require
that the `DEVICE=` variable is specified and matches the expected
interface name. So both these configurations are identical and valid:

  DEVICE=ib0.80c1
  PHYSDEV=ib0
  PKEY_ID=0x80c1

and

  DEVICE=ib0.80c1
  PHYSDEV=ib0
  PKEY_ID=0x00c1

Historically, NetworkManager would also implement the same restrictions
([2], [3], [4]). That meant, not all valid NetworkManager infiniband
profiles could be expressed as  ifcfg file. For example, NetworkManager
allows to have "connection.interface-name" (`DEVICE=`) unset (which
ifup-ib and ifcfg reader did not allow). Also, NetworkManager would
allow configuring a "infiniband.p-key" without full membership flag, and
the reader would mangle that.

This caused various problems to the point that when you configure an
infiniband.p-key with a non-full-membership key, the ifcfg-rh written by
NetworkManager was invalid. Either, you could leave
"connection.interface-name" unset, but then the reader would complain
about missing `DEVICE=`. Or, we could write `DEVICE=ib0.00c1;
PKEY_ID=0x00c1`, which was invalid as we expected `DEVICE=ib0.80c1`.

This was addressed by rhbz 2122703 ([5]). The fix was to

  - not require a `DEVICE=` ([6]).
  - don't mangle the `PKEY_ID=` in the reader ([7]).

which happened in 1.41.2 and 1.40.2 (rhel-8.8).

With this change, we could persist any valid infiniband profile to ifcfg
format. We also could read back any valid ifcfg file that NetworkManager
would have written in the past (note that it could not write valid ifcfg
files previously, if the p-key didn't have the full-membership key set).

The problem is, that users were used to edit ifcfg files by hand, and
users would have files with:

  DEVICE=ib0.80c1
  PHYSDEV=ib0
  PKEY_ID=0x00c1

This files had worked before, but now failed to verify as we would
expect `DEVICE=ib0.00c1`. Also, there was a change in behavior that
PKEY_ID is now interpreted without the high bit set. This is reported as
rhbz 2209164 ([8]).

We will do several things to fix that:

1) we now normalize the "connection.interface-name" to be valid. It was
  not useful to set it anyway, as it was redundant. Complaining about a
  redundant setting, which makes little sense to configure, is not useful.
  This is done by [9].

2) we now again treat PKEY_ID= as if it had 0x8000 flag set. This was done by
  [10].

With step 1) and 2), we are able to read any existing ifcfg files out
there in the way we did before 1.41.2.

There is however one piece missing. When we now create a profile using
nmcli/libnm/D-Bus, which has a non-full-membership p-key, then the
profile gets mangled in the process.

If the user uses NetworkManager API to configure an interface and
chooses a non-full-membership p-key, then this should work the same as
with keyfile plugin (or on rhel-9, where keyfile is the default). Note
that before 1.41.2 it didn't work at all, when the user used ifcfg-rh
backend. Likely(?) there are no users who rely on creating such a profile
with nmcli/libnm/D-Bus and expect to automatically have the p-key
normalized. That didn't work before 1.41.2 and didn't behave that way
between 1.41.2 and now.

This patch fixes that by introducing a new key PKEY_ID_NM= for holding
the real p-key. Now ifcfg backend is consistent with handling infiniband
profiles, and old, hand-written ifcfg files still work as before.

There is of course change in behavior, that ifcfg files between 1.41.2
and now were interpreted differently. But that is bug 2209164 ([8]) and
what we fix here.

For now strong reasons, we keep writing the PKEY_ID to file too. It's
redundant, but that is what a human might expect there.

[1]  05333c3602/f/rdma.ifup-ib (_75)
[2]  https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/1.40.0/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c#L5386
[3]  cb5606cf1c (a7a78fccb2c8c945fd09038656ae734c1b0349ab_3493_3532)
[4]  cb5606cf1c (a7a78fccb2c8c945fd09038656ae734c1b0349ab_3493_3506)
[5]  https://bugzilla.redhat.com/show_bug.cgi?id=2122703
[6]  4c32dd9d25
[7]  a4fe16a426
[8]  https://bugzilla.redhat.com/show_bug.cgi?id=2209164
[9]  4610fd67e6
[10] f8e5e07355

(cherry picked from commit 5e3e38f291)
2023-06-05 10:59:13 +02:00
Thomas Haller
0b56618b19
ifcfg-rh/tests: add test for infiniband profile with PKEY_ID in ifcfg format
https://bugzilla.redhat.com/show_bug.cgi?id=2209164
(cherry picked from commit 0d0704eaa0)
2023-06-05 10:53:29 +02:00
Thomas Haller
1b7d30a7b3
infiniband: merge branch 'th/ifcfg-infiniband-p-key-rh2209164'
https://bugzilla.redhat.com/show_bug.cgi?id=2209164

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1637

(cherry picked from commit d16ac4b774)
2023-05-25 22:27:42 +02:00
Thomas Haller
8a4c0e1851
ifcfg-rh: adjust infiniband p-key for later normalization when writing to file
(cherry picked from commit 82f5bff882)
2023-05-25 22:25:11 +02:00
Thomas Haller
00c44d743f
libnm: truncate too long interface name in nm_setting_infiniband_create_virtual_interface_name()
This is the same what kernel does, when the parent name is so long
that it would result in a too long overall name.

We need that the result is still a valid interface name.

(cherry picked from commit 1009f1f11f)
2023-05-25 22:25:11 +02:00