Commit graph

32437 commits

Author SHA1 Message Date
Beniamino Galvani 3ea19523ee device: generic: make type-description const
The type is initialized from nm_platform_link_get_type_name(), which
returns a static string; there is no need to duplicate the string.
2023-06-12 11:17:09 +02:00
Beniamino Galvani fd6f48ec35 device: generic: make type-description property read-only
The property is not written anywhere, make it read-only.
2023-06-12 11:17:09 +02:00
Thomas Haller 7e6a6dd275
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
2023-06-12 10:39:15 +02:00
Thomas Haller c70a5470be
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')
2023-06-12 10:38:00 +02:00
Thomas Haller dab114f038
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')
2023-06-12 10:37:53 +02: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
Wen Liang f04a9eb098 cloud-setup: add pre-up event to prevent reaching network-online.target
network-online.target should not be reached before nm-cloud-setup
completes configuring the network, which may make user service get
started before the network is fully configured.

Setting nm-cloud-setup.service as "Before=network-online.target" would
maybe have already achieved that. However, also use a pre-up dispatcher
script, so that the device activation in NetworkManager is also waiting
for nm-cloud-setup to complete.

https://bugzilla.redhat.com/show_bug.cgi?id=2151040
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1653
2023-06-09 09:18:20 -04:00
Thomas Haller 6050da93bd
device: only remember "forwarding" sysctl the first time in _dev_ipac6_start()
Fixes: 4c48301594 ('device: don't reset "net.ipv6.conf.$IFACE.forwarding"')
2023-06-08 15:04:50 +02:00
Beniamino Galvani 029e651551 merge: branch 'cathay4t:fix_reapply'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1649
2023-06-08 11:50:59 +02:00
Gris Ge 0486efd358 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>
2023-06-08 14:33:28 +08:00
Petr Menšík 6335e9de6a
dns/dnsmasq: do not use --dnssec-proxy by default
dnsmasq since 2.80 properly forwards all incoming queries with DO bit
set. That ensures even if the dnsmasq does not do validation, it will
always serve all DNSSEC records if the upstream server provides them.
Regardless local validation is enabled or disabled, it will always offer
all data required for validation to its clients.
But does not set AD bit on local responses unless it did the actual
validation itself.

In case users trust their connection to validating DNS server, they
would have to declare it by adding dnssec-proxy option to dnsmasq conf.d
directory. Because there is no negated no-dnssec-proxy, it cannot be
turned off. I think there is no good reason to be on for all cases and
it would be possible to enable it if still wanted. Move the decision to
the user.

That makes it conform with RFC 4035, paragraph 3.2.3.

Signed-off-by: Petr Menšík <pemensik@redhat.com>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1639
2023-06-07 21:46:04 +02:00
Thomas Haller c7ee3a2445
device: merge branch 'th/device-carrier-sources'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1652
2023-06-07 21:33:49 +02:00
Thomas Haller 1ef58332b2
device: use GSource for tracking carrier-wait timeout 2023-06-07 21:32:50 +02:00
Thomas Haller 6a54041ae1
device: clear defer timeout in nm_device_set_carrier()
It's not obvious, why we couldn't have a pending dever action
at that point. Maybe we cannot, but just to be explicit about it,
handle that we potentially might.

For example, we tend to schedule the timeout priv->carrier_defer_source
only from within nm_device_set_carrier() if `priv->carrier` is FALSE.
At the same time, nm_device_set_carrier() does nothing `if
(priv->carrier == carrier)`. So probably there is no problem.

However, we also set priv->carrier directly in
nm_device_set_carrier_from_platform() without clearing the timer. It's
hard to imagine whether there can be a case where we might have two
timeouts pending.
2023-06-07 21:32:49 +02:00
Thomas Haller adc3263920
device: use GSource for tracking carrier-defer timeout
Also no longer log the g_source_get_id(). It's not useful, because
per device there must be only one timeout pending at any time.
2023-06-07 21:32:49 +02:00
Thomas Haller 7009789e85
doc: update Documentation reference in NetworkManager-wait-online.service 2023-06-07 16:48:30 +02:00
Thomas Haller 987488a7ac
CONTRIBUTING: don't use signed-off-by in NetworkManager 2023-06-07 14:25:05 +02:00
Thomas Haller 60f6154134
MAINTAINERS: how to merge merge requests 2023-06-07 14:25:05 +02:00
Thomas Haller 07bc415283
Revert "ppp: fix plugin name for "rp-pppoe.so" with ppp 2.5"
"nm-ppp-manager.c" gets compiled as "libnm-ppp-plugin.so", which does
not link with the ppp code. It thus cannot use
nm_pppd_compat_get_pppoe_plugin_name().

A different solution will be needed. Revert for now.

This reverts commit fe2aade565.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1312
2023-06-07 14:24:17 +02:00
Thomas Haller fe2aade565
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 what rp-pppoe provides.

If a user actually wants to use the plugin from rp-pppoe project, then
this is going to break. But it seams, we usually intend to use the
plugin from the ppp project.

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

Fixes: afe80171b2 ('ppp: move ppp code to "nm-pppd-compat.c"')
2023-06-07 09:26:26 +02:00
Thomas Haller 4d6036ac66
tools/tests: merge branch 'fmartinsons:fm/correct-type-error'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1650
2023-06-07 08:38:38 +02:00
Frederic Martinsons ae408fe4ab tools/tests: correct variant parsing
Seen in NM 1.42.6 where there is now a ipv4.dns-data key which
have as signature:
dbus.Array([dbus.String('a.b.c.d')], signature=dbus.Signature('s'), variant_level=1)

This lead to the following exception:
Cannot convert array element to type 's': Must be string, not Variant

Moreover, the exception TypeError has no message field so it raised
another expcetion which gave me trouble to find what's going on.

Hence the addition of a log file from the previous commit

Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
2023-06-07 05:48:09 +00:00
Frederic Martinsons 2f7a571759 tools/tests: add ability to log to a file
That has been proven useful for debugging the tool during tests

Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
2023-06-07 05:48:09 +00:00
Thomas Haller e432b26112
nm-in-container: improve documentation 2023-06-06 15:01:56 +02:00
Thomas Haller 9ede7e04b1
contrib: extend usage for "contrib/scripts/nm-setup-git.sh" script 2023-06-06 15:00:23 +02:00
Thomas Haller e75deb8c94
contrib/copr: update URL in "nm-copr-build.sh" to new nm-git-bundle 2023-06-06 14:53:37 +02:00
Thomas Haller 849817a1eb
docs: extend MAINTAINERS.md 2023-06-06 13:39:52 +02:00
Thomas Haller fbbe81634f
gitlab-ci: add .gitlab-ci/README.md 2023-06-06 12:35:09 +02:00
Thomas Haller a8b2997fa5
contrib/copr: improve readme in copr scripts (2) 2023-06-06 12:21:30 +02:00
Thomas Haller fd6fcf335c
contrib/copr: improve readme in copr scripts 2023-06-06 12:20:29 +02:00
Thomas Haller e267c1d3ff
core: merge branch 'th/rh2156684-ignore-carrier'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1608
2023-06-06 09:15:04 +02:00
Thomas Haller 645a1bb0ef
core: unblock autoconnect when master profile changes
When a port cannot activate because the controller is not ready, it gets
blocked from autoconnect (see commit 725fed01cf ('policy: block
connection from autoconnect in case of failed dependency')).

Later, when the master activates we call activate_slave_connections()
(see commit 32efb87d4d ('core: unblock failed connections when the
master is available')), which unblocks those port profiles so they can
autoconnect.

However, imagine you add a port profile with autoconnect enabled. The
profile tries to autoconnect, finds no master and gets blocked. Then,
add the controller profile with autoconnect disabled. The controller is
not autoactivating, not calling activate_slave_connections() and the
profiles stay down.

Fix that by unblocking autoconnect of the ports when the controller
profile changes.
2023-06-06 09:13:44 +02:00
Thomas Haller 481cf3594b
core: log when we unblock port profiles for controller change 2023-06-06 09:13:44 +02:00
Thomas Haller f373e1f860
core: factor out unblocking autoconnect for port profiles from activate_slave_connections() 2023-06-06 09:13:40 +02:00
Thomas Haller 7f9db1a290
man: minor rewording in "NetworkManager.conf" manual
Just a comma actually.
2023-06-05 20:59:39 +02:00
Thomas Haller 01ab5ce4a8
ifcfg: merge branch 'th/fix-ifcfg-infiniband-p-key'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1646
2023-06-05 10:49:55 +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
Thomas Haller 0d0704eaa0
ifcfg-rh/tests: add test for infiniband profile with PKEY_ID in ifcfg format
https://bugzilla.redhat.com/show_bug.cgi?id=2209164
2023-06-05 09:06:51 +02:00
Fernando Fernandez Mancera 35eb9c30aa bridge: remove dead code from commit_option()
commit_option() was used in the past to set both bridge and bridge port
options using sysfs. Currently it is only used for bridge port options.

This patch removes the dead code for bridge options and unify it on
commit_port_options(). This is simplifying the work needed to support
bridge port option through netlink.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1643
2023-06-01 12:00:19 +02:00
Thomas Haller 3707a3df80
gitlab-ci: print the used clang-format version in "check-tree" test
This is the authorative version that we shall use for formatting our code.
Print the version in the test.
2023-06-01 09:24:21 +02:00
Thomas Haller ebf3f70735
CONTRIBUTING: improve clang-format section 2023-06-01 08:45:08 +02:00
Aleksandr Melman 2923eeecb9
po: update Russian (ru) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1647
2023-06-01 08:31:13 +02:00
Thomas Haller 70084f2485
gitlab-ci: update ci-templates to fix installation of debian:9 containers
Debian 9 (stretch) is end of life, and the repositories are archived. We
need to patch the containers so that `apt-get update` continues to work.
A new ci-templates version brings that.

Note that at the moment, there is still another issue for debian:9
containers. Unclear whether that can be fixed. In any case, bumping to
latest ci-templates is not wrong, and works around the first issue on
debian:9, making it possible to at least look at the second issue.

https://gitlab.freedesktop.org/freedesktop/ci-templates/-/merge_requests/175
2023-05-31 22:14:23 +02:00
Thomas Haller 5fa8d13d8d
release: bump version to 1.43.9 (development) 2023-05-31 16:51:13 +02:00
Thomas Haller cba7c0ded5
man: fix XSL for documentation after <description> element change
<description> is now an XML element, no longer an attribute. Fix the
style sheets.

Fixes: 89abede3df ('docs: rework generating property infos to use <description> element')
2023-05-31 11:27:09 +02:00
Sabri Ünal 61c6d24bfe
po: update Turkish (tr) translation
Update some strings and correct some of them

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1641
2023-05-30 10:26:22 +02:00
Thomas Haller d67d63bf14
nm-in-container: improve README.md 2023-05-30 10:20:29 +02:00
Thomas Haller b9f84d623d
merge branch 'th/infiniband-devname'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1640
2023-05-30 09:19:56 +02:00
Thomas Haller b25ddc2055
libnm: use nm_net_devname_infiniband() for virtual interface-name of infiniband
In nm_setting_infiniband_get_virtual_interface_name(), no longer try to
detect whether the cached value is still up to date.  Instead, as we now
have a fix sized buffer for the name, just always generate the name on
every call. It's simpler.
2023-05-30 08:52:34 +02:00
Thomas Haller 8062137cd0
libnm-base: assert for valid interface name in nm_net_devname_infiniband() 2023-05-30 08:52:33 +02:00