Commit graph

121 commits

Author SHA1 Message Date
Michael Biebl
10e58f7c3c typo fix: allows to -> allows one to
Detected by lintian:

Example:
I: network-manager: typo-in-manual-page "allows to" "allows one to" [usr/share/man/man5/NetworkManager.conf.5.gz:1266]
2025-03-26 19:22:01 +01:00
Íñigo Huguet
1fdcfb7abe libnm: macvlan: specify that promiscuous affects to the parent
Fixes: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1732
Fixes: 4d0192e661 ('libnm-core: add NMSettingMacvlan')
2025-03-24 15:16:04 +01:00
Beniamino Galvani
4422b14704 core, libnm: support per-connection DNS URIs
Accept name servers with a URI syntax in the ipv4.dns and ipv6.dns
properties; and accept them everywhere else in the core and libnm.
2025-01-07 15:41:44 +01:00
Roman Pavelka
38d1bcee3b ip: configurable address pool and lease time of DHCP server in shared mode
Introduce a new options to NMSettingIpConfig. When set, ipv4.shared-dhcp-range
and ipv4.shared-dhcp-lease-time can be passed to dnsmasq to allow configuration
of DHCP server address pool range and lease time.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/941
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2028
2024-12-11 09:20:15 +01:00
Wen Liang
658aef0fa1 connection: Support connection.ip-ping-addresses
We have encountered multiple incidents where users face connectivity
issues after booting, particularly due to hardware like switches that do
not pass traffic for a few seconds after startup. And services such as
NFS fail to mount because they try to initiate before the network is
fully reachable. Therefore, we are supporting
`connection.ip-ping-addresses` and `connection.ip-ping-timeout` to
allow administrators to configure the network to verify connectivity to
a specific target(such as a service like NFS) instead of relying on
gateway reachability, which may not always be relevant in certain
network configurations.

Resolves: https://issues.redhat.com/browse/RHEL-21160
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2034
https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/-/merge_requests/1797
2024-11-05 14:04:26 -05:00
Íñigo Huguet
380458b0ee ip-config: Fix the nmcli docs for the renamed dhcp-send-hostname
In nmcli we have renamed dhcp-send-hostname and dhcp-send-hostname-v2 to
dhcp-send-hostname-deprecated and dhcp-send-hostname so users don't need
to worry about the details of the weird workarounds that we sometimes
need to do to expand and/or deprecate some properties.

However, the autogenerated documentation didn't include this names. Add
---nmcli--- specific documentation, adding a new property-infos field
called "rename" with the new name used in nmcli. This field can be used
for more properties if we use the same strategy in the future.
2024-10-24 17:03:10 -04:00
Wen Liang
51ea910cc2 device: Support configuring dhcp-send-hostname globally
The user does not want to send machine hostname to the DHCP server
globally by default to avoid ddns record getting created in IPAM.
otherwise, IPAM creates ddns records which might interfere with user's
regular host record. Thus, introduce the ternary property
dhcp_send_hostname_v2 to warrant this behavior.

Notice that we set the GSpec of dhcp-send-hostname-v2 to int, because
defining it as enum would make that it cannot be expanded in a backwards
compatible way if we need to add more values: old clients using libnm
would reject it due to the new value being unknown. Follow the same
strategy than _nm_setting_property_define_direct_enum, defining the
NMSettInfoPropertType as enum, but the glib's GSpec as int.

Resolves: https://issues.redhat.com/browse/RHEL-56565
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2029
https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/-/merge_requests/1765
2024-10-24 17:03:10 -04:00
Beniamino Galvani
0e5815ba84 libnm: add new property "ipvX.routed-dns" 2024-10-23 15:38:33 +02:00
Beniamino Galvani
b6676aa8ef libnm,nmcli: introduce new ipv4.dhcp-ipv6-only-preferred property
Add a new "ipv4.dhcp-ipv6-only-preferred" property to control the
"IPv6-Only Preferred" DHCPv4 option (RFC 8925). The option indicates
that a host supports an IPv6-only mode and is willing to forgo
obtaining an IPv4 address if the network provides IPv6 connectivity.
2024-10-23 15:01:18 +02:00
Josef Ouano
a47d44cffd wwan: added additional initial eps bearer settings
Added the following settings for initial EPS bearer:
- Username
- Password
- Allowed Auth
- APN Type Setting
2024-10-17 07:53:49 +02:00
Fernando Fernandez Mancera
d238ff487b ipvlan: add support to IPVLAN interface
This patch add support to IPVLAN interface. IPVLAN is a driver for a
virtual network device that can be used in container environment to
access the host network. IPVLAN exposes a single MAC address to the
external network regardless the number of IPVLAN device created inside
the host network. This means that a user can have multiple IPVLAN
devices in multiple containers and the corresponding switch reads a
single MAC address. IPVLAN driver is useful when the local switch
imposes constraints on the total number of MAC addresses that it can
manage.
2024-09-18 13:19:42 +02:00
Fernando Fernandez Mancera
a0696e27b8 hsr: add hsr setting to docs generate script
The setting was missing from the script. The patch is adding it and also
regenerates the docs.

Fixes: 5426bdf4a1 ('HSR: add support to HSR/PRP interface')
2024-09-16 17:04:02 +02:00
Beniamino Galvani
abbaa9b629 libnm, nmcli: fix "Since" version for ipv4.link-local=fallback
Fixes: c575293f1b ('device: add ipv4.link-local=fallback (IPv4LL set iff no other IPv4 set)')
2024-09-02 11:52:59 +02:00
Dominique Martinet
c575293f1b device: add ipv4.link-local=fallback (IPv4LL set iff no other IPv4 set)
When a connection with ipv4.method=auto (DHCP) is configured with
ipv4.link-local=enable we were leaving the link-local address forever,
but this is not correct according to RFC3927[1] which says:
  a host SHOULD NOT have both an operable routable address and an IPv4
  Link-Local address configured on the same interface.

This adds a new mode that is more compliant, which only sets an IPv4
link-local address if no other address is set (through either DHCP lease
or ivp4.addresses setting)

Closes #1562

Link: https://github.com/systemd/systemd/issues/13316
Link: https://datatracker.ietf.org/doc/html/rfc3927#section-1.9 [1]
2024-09-02 08:16:18 +00:00
Fernando Fernandez Mancera
79221f79a2 src: drop most slave references from the code
While we cannot remove all the references to "slave" we can remove most
of them.
2024-08-09 15:47:32 +02:00
Fernando Fernandez Mancera
090d617017 src: drop most master references from the code
While we cannot remove all the references to "master" we can remove most
of them.
2024-08-09 15:47:32 +02:00
Beniamino Galvani
a591c0ca95 libnm,nmcli: add a 'wifi.channel-width' setting
At the moment, the access point mode uses 20MHz channels. Introduce a
new 'wifi.channel-width' property that allows the use of a larger
bandwidth, thus increasing performances.
2024-07-10 14:53:32 +02:00
Michael Biebl
22314df2ab typo fix: identifer -> identifier
Detected by lintian:
I: network-manager: typo-in-manual-page identifer identifier [usr/share/man/man5/nm-settings-nmcli.5.gz:3018]
I: network-manager: typo-in-manual-page identifer identifier [usr/share/man/man5/nm-settings.5.gz:3018]
2024-05-23 10:22:33 +00:00
Íñigo Huguet
7ec363a79a ip6: revert to using sysctl ipv6.conf.default for ip6-privacy
Commit 797f3cafee ('device: fall back to saved use_tempaddr value
instead of rereading /proc') changed the behaviour of how to get the
last resort default value for ip6-privacy property.

Previously we read it from /proc/sys/net/ipv6/conf/default, buf after
this commit we started to read /proc/sys/net/ipv6/conf/<iface> instead,
because the user might have set a different value specific for that device.
As NetworkManager changes that value on connection activation, we used
the value read at the time that NetworkManager was started.

Commit 6cb14ae6a6 ('device: introduce ipv6.temp-valid-lifetime and
ipv6.temp-preferred-lifetime properties') introduced 2 new IPv6 privacy
related properties relying on the same mechanism.

However, this new behaviour is problematic because it's not predictable
nor reliable:
- NetworkManager is normally started at boot time. That means that, if a
  user wants to set a new value to /proc/sys/net/ipv6/conf/<iface>,
  NetworkManager is likely alread running, so the change won't take
  effect.
- If NetworkManager is restarted it will read the value again, but this
  value can be the one set by NetworkManager itself in the last
  activation. This means that different values can be used as default in
  the same system boot depending on the restarts of NetworkManager.

Moreover, this weird situation might happen:
- Connection A with ip6-privacy=2 is activated
- NetworkManager is stopped. The value in
  /proc/sys/net/ipv6/conf/<iface>/use_tempaddr remains as 2.
- NetworkManager starts. It reads from /proc/sys/... and saves the value
  '2' as the default.
- Connection B with no ip6-privacy setting is activated. The '2' saved
  as default value is used. The connection didn't specify any value for
  it, and the value '2' was set by another connection for that specific
  connection only, not manually by a user that wanted '2' to be the
  default.

A user shouldn't have to think on when NetworkManager starts or restarts
to known in an easy and predictable way what the default value for
certain property is. It's totally counterintuitive.

Revert back to the old behaviour of reading from
/proc/sys/net/ipv6/conf/default. Although this value is used by the
kernel only for newly created interfaces, and not for already existing
ones, it is reasonable to think on these settings as "systemwide
defaults" that the user has chosen.

Note that setting a different default in NetworkManager.conf still takes
precedence.
2024-05-10 12:01:08 +00:00
Íñigo Huguet
0906bd6e8b doc: remove explanations about certificate schemes from nmcli
The D-Bus and C APIs admit setting the 802.1X certificates as blobs, as
the documentation of the properties explains.  However, this is not
possible from nmcli, where only path to the certificates' files is possible.

This difference in nmcli was explained in the description message that
is shown in nmcli's editor, but this is a documentation that most users
won't ever see, and still the main documentation in nm-settings-nmcli is
missleading.

Add a nmcli specific documentation for the relevant properties and
remove the nmcli's editor descriptions as they are no longer needed.
2024-04-26 07:30:04 +00:00
Íñigo Huguet
7427e9d320 man: fix missing deprecation message
In the gtkdoc comments, the text below tags like `Since: 1.2` is
discarded. In the property `autoconnect-slaves` a line indicating its
deprecation was below one of these tags. As a result, it was missing in
the man page. Fix it.

Fixes: 194455660d ('connection: deprecate NMSettingConnection autoconnect-slaves property')
2024-04-18 13:30:31 +00:00
Alex Henrie
6cb14ae6a6 device: introduce ipv6.temp-valid-lifetime and ipv6.temp-preferred-lifetime properties
When IPv6 privacy extensions are enabled, by default temporary addresses
have a valid lifetime of 1 week and a preferred lifetime of 1 day.
That's far too long for privacy-conscious users, some of whom want a new
address once every few seconds. Add connection options that correspond
to /proc/sys/net/ipv6/conf/*/temp_valid_lft and
/proc/sys/net/ipv6/conf/*/temp_prefered_lft to allow configuring the
address rotation time on a per-connection basis.

The new properties are defined as 32-bit signed integers to match the
sysctl parameters which are also signed, although currently only
positive numbers are valid.
2024-03-20 23:46:32 -06:00
Alex Henrie
797f3cafee device: fall back to saved use_tempaddr value instead of rereading /proc
There may be a per-interface default set by the sysctl
net.ipv6.conf.<iface>.use_tempaddr that is different than
net.ipv6.conf.default.use_tempaddr.
2024-03-20 23:42:22 -06:00
Jan Vaclav
f2d91b4a68 wired: deprecate NMSettingWired mac-address-blacklist property
To embrace inclusive language, deprecate the NMSettingWired
mac-address-blacklist property and introduce mac-address-denylist property.
2024-03-20 15:32:00 +01:00
Tomas Ebenlendr
edc2ba4991 802.1x: add openssl_ciphers setting
Setting for wpa_supplicant openssl_ciphers - openssl sometimes moves
ciphers among SECLEVELs. That is generaly a good thing, but some servers
are too old to support newer ciphers. Thus expert user should be allowed
to define openssl_ciphers per connection, so that they can connect to
old server, while not compromising security of other connections.
2024-03-16 21:30:34 +01:00
Jan Vaclav
fa215c6a69 wireless: deprecate NMSettingWireless mac-address-blacklist property
To embrace inclusive language, deprecate the NMSettingWireless
mac-address-blacklist property and introduce mac-address-denylist property.
2024-03-11 11:42:19 +01:00
Fernando Fernandez Mancera
ac4e63ddda ip: support dhcp-send-release in NMSettingIpConfig
Introduce a new option to NMSettingIpConfig. The new option is ternary
type being the default value set to disabled. When enabled,
NetworkManager will instruct the DHCP client to send RELEASE message
when IP addresses are being removed.
2024-03-06 11:14:16 +01:00
Fernando Fernandez Mancera
bd38a19832 connection: add support to down-on-poweroff
The new option at NMSettingConnection allow the user to specify if the
connection needs to be down when powering off the system. This is useful
for IP address removal prior powering off. In order to accomplish that,
we listen on "Shutdown" systemd DBus signal.

The option is set to FALSE by default, it can be specified globally on
configuration file or per profile.
2024-03-04 18:16:54 +00:00
Beniamino Galvani
e686ab35b3 libnm: add generic.device-handler property
Add a new "generic.device-handler" property that specifies the name of
a dispatcher script to be invoked to add and delete the interface for
this connection.
2024-02-21 11:16:01 +01:00
Beniamino Galvani
aa418275cf libnm,nmcli: add macsec.offload property
Introduce a new property to control the MACsec offload mode.
2024-02-21 10:51:57 +01:00
Íñigo Huguet
8a88386e3a sriov: add eswitch-inline-mode and eswitch-encap-mode properties
Those are related to the eswitch mode and can be configured together.
2024-02-20 16:01:27 +01:00
Íñigo Huguet
c61c87f8a6 sriov: add eswitch-mode property
Add property to allow changing the eswitch mode between legacy SRIOV and
switchdev. Allow also to set "preserve" to prevent NM from modifying the
eswitch mode.
2024-02-20 16:01:25 +01:00
Beniamino Galvani
fcd907e062 libnm,nmcli: add ipvx.dhcp-dscp property
Currently the internal DHCP client sets traffic class "CS6" in the DS
field of the IP header for outgoing packets.

dhclient sets the field according to the definition of TOS (RFC 1349),
which was was deprecated in 1998 by RFC 2474 in favor of DSCP.

Introduce a new property IPvX.dhcp-dscp (currently valid only for
IPv4) to specify a custom DSCP value for DHCP backends that support it
(currently, only the internal one).

Define the default value to CS0, because:

 - section 4.9 of RFC 4594 specifies that DHCP should use the standard
   (CS0 = 0) service class;

 - section 3.2 says that class CS6 is for "transmitting packets
   between network devices (routers) that require control (routing)
   information to be exchanged between nodes", listing "OSPF, BGP,
   ISIS, RIP" as examples of such traffic. Furthermore, it says that:

     User traffic is not allowed to use this service class.  By user
     traffic, we mean packet flows that originate from user-controlled
     end points that are connected to the network.

- we got reports of some Cisco switches dropping DHCP packets because
  of the CS6 marking.
2024-02-06 14:24:39 +01:00
Fernando Fernandez Mancera
194455660d connection: deprecate NMSettingConnection autoconnect-slaves property
To embrace inclusive language, deprecate the NMSettingConnection
autoconnect-slaves property and introduce autoconnect-ports property.
2024-01-31 11:29:06 +01:00
Fernando Fernandez Mancera
e9e456d9ad doc: regenerate docs for "connection.mdns"
As the documentation for "connection.mdns" was modified, we need to
regenerate the docs.
2024-01-29 12:08:32 +01:00
Thomas Haller
955f113f46
libnm/docs: update comment about "apn.gsm" and empty string 2024-01-23 09:43:28 +01:00
Fernando Fernandez Mancera
411e7573a4 connection: deprecate the NMSettingConnection slave-type property
To embrace inclusive language, deprecate the NMSettingConnection
slave-type property and introduce port-type property.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2024-01-23 08:21:07 +01:00
Beniamino Galvani
790e4231f4 core,libnm: change default value for ipv4.dad-timeout from 0 to 200ms
A duplicate address is a serious issue which leads to non-working
setups or problems hard to debug. Enable IPv4 duplicate address
detection (aka ACD, RFC 5227) by default to detect such problems.

While the RFC recommends a timeout of 9 seconds, a comment in n-acd
sources says:

  A 9s timeout for successful link setups is not acceptable today.
  Hence, we will just go forward and ignore the proposed values. On
  both wired and wireless local links round-trip latencies of below
  3ms are common.  We require the caller to set a timeout multiplier,
  where 1 corresponds to a total probe time between 0.5 ms and 1.0
  ms. On modern networks a multiplier of about 100 should be a
  reasonable default. To comply with the RFC select a multiplier of
  9000.

Set a default timeout of 200ms, which is the double of the value
suggested in n-acd sources. 200ms sounds quick enough, and gives at
least ~100ms to other hosts to reply.

See also the Fedora change proposal:

https://fedoraproject.org/wiki/Changes/Enable_IPv4_Address_Conflict_Detection
2024-01-15 17:07:09 +01:00
Fernando Fernandez Mancera
00bc10b8c0 connection: deprecate the NMSettingConnection Master property
To embrace inclusive language, deprecate the NMSettingConnection Master
property and introduce Controller property.
2024-01-11 00:19:14 +01:00
Fernando Fernandez Mancera
0e893593a9 hsr: drop supervision-address from HSR setting
The supervision address is read-only. It is constructed by kernel and
only the last byte can be modified by setting the multicast-spec as
documented indeed.

As 1.46 was not released yet, we still can drop the whole API for this
setting property. We are keeping the NMDeviceHsr property as it is a
nice to have for reading it.

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

Fixes: 5426bdf4a1 ('HSR: add support to HSR/PRP interface')
2023-12-19 13:54:21 +01:00
Fernando Fernandez Mancera
5426bdf4a1 HSR: add support to HSR/PRP interface
This patch add support to HSR/PRP interface. Please notice that PRP
driver is represented as HSR too. They are different drivers but on
kernel they are integrated together.

HSR/PRP is a network protocol standard for Ethernet that provides
seamless failover against failure of any network component. It intends
to be transparent to the application. These protocols are useful for
applications that request high availability and short switchover time
e.g electrical substation or high power inverters.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1791
2023-12-05 08:05:56 +01:00
Thomas Haller
d210923c0f
wifi: add "wifi.cloned-mac-address=stable-ssid"
Add a new "stable-ssid" mode that generates the MAC address based on the
Wi-Fi's SSID.

Note that this gives the same MAC address as setting

    connection.stable-id="${NETWORK_SSID}"
    wifi.cloned-mac-address="stable"

The difference is that changing the stable ID of a profile also affects
"ipv6.addr-gen-mode=stable-privacy" and other settings.
2023-11-16 13:07:54 +01:00
Thomas Haller
901a1b096b
core: support "${NETWORK_SSID}" for connection.stable-id
For Wi-Fi profiles, this will encode the SSID in the stable-id.
For other profiles, this encodes the connection UUID (but the SSID and
the UUID will always result in distinct stable IDs).

Also escape the SSID, so that the generated stable-id is always valid
UTF-8.
2023-11-16 13:07:53 +01:00
Thomas Haller
832065b6e6
libnm/docs: fix generated documentation
Fixes: 82e2eeeb2a ('libnm/docs: clarify default `ipv4.dhcp-client-id` generated by nettools/internal DHCP plugin')
2023-11-14 12:51:22 +01:00
Íñigo Huguet
c794363ce9 dhcp: document the new ipv4.dhcp-client-id special value "none"
Also, improve the explanation about what happens when no default value
is set, and the client-id value is left dependant on the plugin.
2023-10-18 08:01:09 +02:00
Beniamino Galvani
536805231a libnm: better document IPv4 DAD property
Clarify that the value is the *maximum* interval; the actual value is
randomized and can be as low as half the specified one.
2023-10-05 09:05:16 +02:00
Íñigo Huguet
f4fbc59a16 man nm-setting-*: proper format for gtkdoc constants
Gtkdoc comments are used, among other things, to generate the various
nm-setting-* manual pages. When a constant is referenced in a gtkdoc
comment (i.e. `%NM_IP_TUNNEL_MODE_IPIP`) it is expanded to show the C name
and the value (i.e. `NM_IP_TUNNEL_MODE_IPIP (1)`). To generate the
nm-setting-* manual pages, we don't use gtkdoc, but we process this data
with the custom script tools/generate-docs-nm-settings-docs-gir.py.
This script was expanding the constants in the same way than gtkdoc.

Showing the constants in that way in nm-setting-* manual pages makes
little sense, because users are not going to use the C identifiers.
Let's show them with a more appropriate format.

Additionally, the different nm-setting-* pages might require different
formats than the other. For example, for nm-setting-nmcli a format like
`"ipip" (1)` is prefered, but for nm-setting-dbus it's better
`1 (ipip)`. Let's generate different nm-settings-docs-gir-*.xml files for
nmcli, dbus, keyfile and ifcfg-rh, using the right format for each one.
2023-09-21 15:57:35 +02:00
Íñigo Huguet
140abc81ec nm-settings-nmcli: show proper valid values of ip-tunnel properties
Show all valid properties for ip-tunnel.mode, not only 2 examples.

Show constants as values suitable for user input in nmcli. That means
showing, for example, "ipip (1)" instead of "IP_TUNNEL_MODE_IPIP (1)".
2023-09-12 09:31:18 +00:00
Thomas Haller
cbbf5fed49
libnm/docs: better descripe "ipv[46].dns-options" in man nm-settings-nmcli 2023-06-12 10:01:23 +02:00
Thomas Haller
5e3e38f291
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
2023-06-05 10:38:01 +02:00