Commit graph

29481 commits

Author SHA1 Message Date
Thomas Haller
866e3a2b51
contrib/scripts: update "nm-copr-build.sh" script to use new nm-git-bundle 2022-01-06 10:03:57 +01:00
Thomas Haller
34c59c96c5
contrib/scripts: better explain the purpose of nm-git-bundle 2022-01-06 10:01:51 +01:00
Thomas Haller
0acb4b685d
glib-aux: honor NM_OBFUSCATE_PTR=0 setting for printing raw pointer values
We avoid printing pointer values directly, instead we usually call
NM_HASH_OBFUSCATE_PTR(). This hashes the pointers with a random seed
so they are not directly visible.

That obviously makes it harder to debug. Add an environment variable
to disable that.

  $ NM_OBFUSCATE_PTR=0 LIBNM_CLIENT_DEBUG=trace,stdout nmcli

Note that this flag is only honored in debug builds (WITH_MORE_ASSERTS>0).
2022-01-05 22:57:51 +01:00
Thomas Haller
99f82b4b84
contrib: fix "find-backports" script to properly handle "Ignore-Backport" tag
The "Ignore-Backport" tag can be used to mark a commit that should not
be backported. Similar to the "cherry picked from" line, which indicates
that the patch was backported.

Anyway, this didn't work correctly, because we first pre-filter the
commits we search (as a performance optimization) by using `git-log` to
get a subset of the commits we want to investigate.

So if you had a commit with an "Ignore-Backport" tag, but without "cherry
picked from" line, then it wasn't found.

Fix that.
2022-01-05 09:30:16 +01:00
Thomas Haller
a6ff5ee448
contrib/scripts: add Fedora version to podmain container name for "nm-code-format-container.sh"
Older branches, like "nm-1-32" will always be formatted with a
different, older clang-format version. Luckily we also have on "nm-1-32"
branch the "nm-code-format-container.sh" script, so we can still
reformat the sources using the container.

However, as the name of the container was always "nm-code-format",
we would have to re-generate the container when we switch between
branches. As the container really only depends on the Fedora version
(as the clang-format version is tied to the corresponding Fedora
version), let's include the Fedora version in the name of the container.
2022-01-04 21:17:19 +01:00
James Hilliard
edc37b3adf
build: allow configuring default for wifi.backend setting
Distributions may want to change the default wifi.backend, if for
example they are building without wpa_supplicant support.

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1040
2022-01-04 06:41:37 +01:00
Tomohiro Mayama
7377df2f2d
libnm: allow WPA-EAP-SUITE-B-192 network to match existing connections
Signed-off-by: Tomohiro Mayama <parly-gh@iris.mystia.org>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1050
2022-01-03 13:30:56 +01:00
Sam Morris
afb25afa8f
cli: correct active connection details header in nmcli output
[thaller@redhat.com: update translation strings and regenerate
  expected output for nmcli tests]

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1046
2022-01-03 12:24:46 +01:00
Beniamino Galvani
298d0b961f
core: log variant properties in connection diff
Properly print properties containing a GVariant (as those backed by
a gendata hashtable).

For example, before:

 ++ ethtool.ring-rx-mini      = ???

After:

 ++ ethtool.ring-rx-mini      = 0

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1051
2022-01-03 09:51:49 +01:00
Thomas Haller
4010d75922
libnm: refactor some NMSetting to use direct properties for enum/flags
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1033
2021-12-24 11:14:22 +01:00
Beniamino Galvani
25e705c361 libnm: fix warning when setting wrong ethtool ternary value
$ nmcli connection modify dummy1 ethtool.feature-rx a
  (process:3077356): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
  This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
  The overwriting error message was: 'a' is not valid; use 'on', 'off', or 'ignore'
  Error: failed to modify ethtool.feature-rx: 'a' is not valid; use [true, yes, on], [false, no, off] or [unknown].

Fixes: e5b46aa38a ('cli: use nmc_string_to_ternary() to parse ternary in _set_fcn_ethtool()')
2021-12-23 09:15:39 +01:00
Beniamino Galvani
e6bd98cc07 core: merge branch 'dracut_rhel9_test'
core: don't reset assume state if the device is unmanaged by parent

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1048
2021-12-21 08:48:40 +00:00
Wen Liang
87674740d8 core: don't reset assume state if the device is unmanaged by parent
When the device gets realized, similar to the situation that the device
 is unmanaged by platform-init, if the device is still unmanaged by
parent and we clear the assume state. Then, when the device becomes
managed, NM is not able to properly assume the device using the UUID.

Therefore, we should not clear the assume state if the device has only
the NM_UNMANAGED_PLATFORM_INIT or the NM_UNMANAGED_PARENT flag set
in the unmanaged flags.

The previous commit 3c4450aa4d ('core: don't reset assume state too
early') did something similar for NM_UNMANAGED_PLATFORM_INIT flag only.
2021-12-20 10:28:40 -05:00
Beniamino Galvani
440e5a9941 release: bump version to 1.35.3 (development) 2021-12-15 18:48:54 +01:00
xiangnian
31a12ee344 example: Match more AP security
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1043
2021-12-10 16:49:51 +01:00
Beniamino Galvani
02de04287f device: fix update of the ip-iface property
Before the l3cfg rework, the ip-iface property was exported only for
interfaces with an ifindex, and only in some device states.

Restore the old behavior since it is part of the API. For example,
firewalld uses the property to tell which interfaces have a ifindex.

Fixes: 58287cbcc0 ('core: rework IP configuration in NetworkManager using layer 3 configuration')

https://bugzilla.redhat.com/show_bug.cgi?id=2026024
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1042
2021-12-09 15:37:44 +01:00
Beniamino Galvani
e9ca5583e5 platform: add bpf filter to ignore routes from routing daemons
Routing daemons can add a large amount of routes to the
system. Currently NM receives netlink notifications for all those
routes and exposes them on D-Bus. With many routes, the daemon becomes
increasingly slow and uses a lot of memory.

The rtm_protocol field of the route indicates the source of the
route. From /usr/include/linux/rtnetlink.h, the allowed values are:

  #define RTPROT_UNSPEC          0
  #define RTPROT_REDIRECT        1        /* Route installed by ICMP redirects;
                                             not used by current IPv4 */
  #define RTPROT_KERNEL          2        /* Route installed by kernel */
  #define RTPROT_BOOT            3        /* Route installed during boot */
  #define RTPROT_STATIC          4        /* Route installed by administrator */

  /* Values of protocol >= RTPROT_STATIC are not interpreted by kernel;
     they are just passed from user and back as is.
     It will be used by hypothetical multiple routing daemons.
     Note that protocol values should be standardized in order to
     avoid conflicts.
   */

  #define RTPROT_GATED           8        /* Apparently, GateD */
  #define RTPROT_RA              9        /* RDISC/ND router advertisements */
  #define RTPROT_MRT            10        /* Merit MRT */
  #define RTPROT_ZEBRA          11        /* Zebra */
  #define RTPROT_BIRD           12        /* BIRD */
  #define RTPROT_DNROUTED       13        /* DECnet routing daemon */
  #define RTPROT_XORP           14        /* XORP */
  #define RTPROT_NTK            15        /* Netsukuku */
  #define RTPROT_DHCP           16        /* DHCP client */
  #define RTPROT_MROUTED        17        /* Multicast daemon */
  #define RTPROT_KEEPALIVED     18        /* Keepalived daemon */
  #define RTPROT_BABEL          42        /* Babel daemon */
  #define RTPROT_OPENR          99        /* Open Routing (Open/R) Routes */
  #define RTPROT_BGP           186        /* BGP Routes */
  #define RTPROT_ISIS          187        /* ISIS Routes */
  #define RTPROT_OSPF          188        /* OSPF Routes */
  #define RTPROT_RIP           189        /* RIP Routes */
  #define RTPROT_EIGRP         192        /* EIGRP Routes */

Since NM uses only values <= RTPROT_STATIC, plus RTPROT_RA and
RTPROT_DHCP, add a BPF filter to the netlink socket to discard
notifications for other route types.

https://bugzilla.redhat.com/show_bug.cgi?id=1861527
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1038
2021-12-09 13:19:45 +01:00
Lubomir Rintel
42307a6a67 release: bump version to 1.35.2 (development) 2021-12-01 16:46:47 +01:00
Lubomir Rintel
79885656d3 initrd: don't add a connection if there's a connection dir with rd.neednet
Only create a default connection with rd.neednet if we're starting with
a totally blank slate. Otherwise it could be that the user already
included configuration in the initrd and merely wants us to activate it.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/999
2021-12-01 15:13:16 +01:00
Lubomir Rintel
af1903fe3f nm-device: prefer manually configured addresses to automatic
This bumps L3_CONFIG_DATA_TYPE_MANUALIP to be the most important address
source; which is what had been the case before NetworkManager/next and
is presumably what the user expects.

It also comes into play for iBFT-booted machines, where iBFT contains a
permanent address (no lifetime data), while DHCP might lease out the
same one. In that case, expiry of the latter could potentially disrupt
connectivity to a vital storage volume.

Fixes: 14962cb414 ('merge: branch 'next''):

https://bugzilla.redhat.com/show_bug.cgi?id=2013921
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1011
2021-12-01 15:04:16 +01:00
Fernando Fernández Mancera
249ab3a5cd merge: branch 'ff/nmcli_editor_wol'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1036
2021-12-01 11:51:18 +00:00
Fernando Fernandez Mancera
624372239e nmcli: fix "remove" command to really remove the property
When using the "remove" command on nmcli edit mode it will reset the
value to the default when no property value is specified. If the
property value is specified it will remove that specific property.

Example:

```
nmcli> set ethernet.wake-on-lan phy
nmcli> print ethernet.wake-on-lan
802-3-ethernet.wake-on-lan: phy, default
nmcli> remove ethernet.wake-on-lan default
nmcli> print ethernet.wake-on-lan
802-3-ethernet.wake-on-lan: phy
nmcli> remove ethernet.wake-on-lan
nmcli> print ethernet.wake-on-lan
802-3-ethernet.wake-on-lan: default
```
2021-12-01 12:08:04 +01:00
Fernando Fernandez Mancera
ec14d7df7c nmcli: introduce "add" command to edit mode
This patch introduces "add" command to nmcli edit mode. When using "add"
it will append the value to the ones already set. This is doing the same
thing than the "set" command does right now.

Example:

```
nmcli> add ipv4.addresses 192.168.1.1/24
```
2021-12-01 12:08:04 +01:00
Nacho Barrientos
906dbb280d systemd: byte order to host before using the lifetime
I've seen this in `NetworkManager-1.34.0-0.3.el8.x86_64` (latest in CentOS
Stream 8 at the time of writing this message) which does not use the latest
Systemd but probably the code base is the same (see
51f93e00a2).

Before the patch:

```
libsystemd: eth0: DHCPv6 client: T1 expires in 34y 3w 6d 45min 31s
libsystemd: eth0: DHCPv6 client: T2 expires in 54y 5month 3w 3d 23h 20min 35s
```

After the patch:

```
libsystemd: eth0: DHCPv6 client: T1 expires in 3d 7h 58min 3s
libsystemd: eth0: DHCPv6 client: T2 expires in 5d 2h 26min 50s
```

same box (x86_64 system) and same DHCPv6 server.

This regression has likely been introduced by 8a8955507af363c31297bbc5df79852db4ad39d6.

See-also: https://github.com/systemd/systemd/pull/21558

https://bugzilla.redhat.com/show_bug.cgi?id=2027267
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/863
2021-11-30 11:42:40 +01:00
流浪猫
7f517e09d0 po: update and fix Simplified Chinese translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1021
2021-11-30 10:55:49 +01:00
Beniamino Galvani
7f8c8078a1 dhcp: accept IPv4-address options longer than expected
Some DHCP servers send duplicate options, and we concatenate them
according to RFC 3396 section 7. Therefore, it's possible that a
option carrying a IPv4 address has a length > 4.

See also commit 1cbf9d22a5 ('n-dhcp4: accept options that are longer
than requested') which did something similar in the nettools client.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/848
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1034
2021-11-29 10:44:17 +01:00
Beniamino Galvani
9a76b07f74 l3cfg: fix assertion failure
Fix the following assertion failure:

  src/core/nm-l3cfg.c:2636:_l3_acd_data_state_change: assertion failed: (!acd_data->nacd_probe)

When AcdData enters state NM_L3_ACD_ADDR_STATE_READY, the duplicate
address detection procedure completed successfully but the address is
not configured yet on the interface. In the READY state we don't clear
the probe because the same probe can be reused also for defending the
address. Change the assertion.

https://bugzilla.redhat.com/show_bug.cgi?id=2026288
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1035
2021-11-29 10:38:15 +01:00
Beniamino Galvani
6a68008e44 merge: branch 'th/clang-format-13'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1020
2021-11-29 10:32:36 +01:00
Thomas Haller
081510ed94 gitlab-ci: use Fedora 35 as default build target 2021-11-29 09:31:09 +00:00
Thomas Haller
615221a99c format: reformat source tree with clang-format 13.0
We use clang-format for automatic formatting of our source files.
Since clang-format is actively maintained software, the actual
formatting depends on the used version of clang-format. That is
unfortunate and painful, but really unavoidable unless clang-format
would be strictly bug-compatible.

So the version that we must use is from the current Fedora release, which
is also tested by our gitlab-ci. Previously, we were using Fedora 34 with
clang-tools-extra-12.0.1-1.fc34.x86_64.

As Fedora 35 comes along, we need to update our formatting as Fedora 35
comes with version "13.0.0~rc1-1.fc35".
An alternative would be to freeze on version 12, but that has different
problems (like, it's cumbersome to rebuild clang 12 on Fedora 35 and it
would be cumbersome for our developers which are on Fedora 35 to use a
clang that they cannot easily install).

The (differently painful) solution is to reformat from time to time, as we
switch to a new Fedora (and thus clang) version.
Usually we would expect that such a reformatting brings minor changes.
But this time, the changes are huge. That is mentioned in the release
notes [1] as

  Makes PointerAligment: Right working with AlignConsecutiveDeclarations. (Fixes https://llvm.org/PR27353)

[1] https://releases.llvm.org/13.0.0/tools/clang/docs/ReleaseNotes.html#clang-format
2021-11-29 09:31:09 +00:00
Fernando Fernandez Mancera
e44cdc7981 ovsdb: deactivate removed device if does not have a master
When using OVS link aggregation ports, NetworkManager ovsdb is removing
the ports when cleaning it up. If that happens, it should deactivate the
device even if it does not have controller or the state is not
assume/external.

An interface that is port of the OVS bonding can be activated before the
ovsdb clean up, if it is not deactivated then NetworkManager will finish
with a wrong configuration. The 'ovsdb_device_removed()' is already
checking that the device is "ovs-interface" with subtype "system".
2021-11-28 20:34:38 +01:00
Fernando Fernandez Mancera
4549995052 bridge: allow ageing_time option to be zero
If the user wants to disable MAC ageing on the bridge, they need to set
ageing_time to zero.

https://bugzilla.redhat.com/show_bug.cgi?id=1871950
2021-11-26 10:20:01 +01:00
Thomas Haller
5e0764cf8e
nm-sudo: reorder sections in nm-sudo.service unit file
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/938#note_1163013
2021-11-19 11:42:10 +01:00
Thomas Haller
867bef5fe7
man: clarify "configure-and-quit" option in NetworkManager.conf 2021-11-19 11:39:50 +01:00
Thomas Haller
a2b26e26d9
NEWS: update 2021-11-19 11:16:01 +01:00
Thomas Haller
2cd1a22a78
NEWS: drop unstable warning for 1.34 2021-11-19 11:12:50 +01:00
Thomas Haller
b0ac01a06e
NEWS: fix trailing whitespace and use full stop for news entries 2021-11-19 11:12:03 +01:00
Ana Cabral
77d7b8287c release: bump version to 1.35.1 (development) 2021-11-18 18:01:49 +01:00
Beniamino Galvani
4495aa7a4d device: remove an unused variable
Fixes: 58287cbcc0 ('core: rework IP configuration in NetworkManager using layer 3 configuration')
2021-11-18 16:55:20 +01:00
Beniamino Galvani
4f52907beb NEWS: update 2021-11-18 16:51:19 +01:00
Beniamino Galvani
14962cb414 merge: branch 'next'
This is a refactor of IP configuration done by NM to make it more
independent from NMDevice.

See these files for more information:
src/core/README.l3cfg.md
src/core/README.next.ip-config.md

https://bugzilla.redhat.com/show_bug.cgi?id=1868254
2021-11-18 16:28:08 +01:00
Beniamino Galvani
2838b1c5e8 core: track force-commit flag for l3cd and platform objects
Problem: if l3cfg commits an address and routes from DHCP, when the
address expires those objects are removed automatically. NM tracks the
objects as missing as if the user removed them. This is to prevent
l3cfg to committing them again. If the lease if renewed, l3cfg should
be allowed to commit those objects again.

Introduce a l3cd flag to indicate that it should be force-committed
once, and propagate this flag to platform objects. In this way, l3cfg
can avoid committing again objects that are removed externally, but it
can commit them when the l3cd changes.

Fixes-test: @bridge_down_to_l2_only
2021-11-18 16:21:35 +01:00
Beniamino Galvani
7f03b0c9ef l3cfg: consider a externally-removed address as ACD-ready
If an address is removed externally, it should be considered ready
from ACD point of view. In this way it can be commit again (for
example, if the DHCP lease is renewed).
2021-11-18 16:21:35 +01:00
Beniamino Galvani
c5f26a546b l3cfg: fix handling of removed addresses
If the address appears after being removed, start defending it instead
of throwing an assertion.
2021-11-18 16:21:34 +01:00
Ana Cabral
fcfa598fc2 device: fix route metric penalty assignment
When a route has the connectivity check enabled and does not have
full connectivity, it should have its route metric penalized,
this way this route will not be preferred over others.

Fixes-test: @per_device_connectivity_check
2021-11-18 16:21:34 +01:00
Wen Liang
8995d44a0b core: compare the DNS configurations before updating DNS
DNS manager always sets `priv->config_changed = TRUE` and overwrites
the "resolv.conf" file. To fix it, compare the new configuration with
the old configuration, if there is no change, skipping the update.

Fixes-test: @ipv4_ignore_resolveconf_with_ignore_auto_dns
Fixes-test: @ipv4_ignore_resolveconf_with_ignore_auto_dns_var1

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1023
2021-11-18 16:21:34 +01:00
Fernando Fernandez Mancera
b85a9cd9df device: set ip_state to PENDING when cleaning up from reapply
When doing a reapply the ip_state must be set as PENDING, if not the
ipdhcp_state won't be extended to ip_state.

In addition, if one of the IP configuration is ready and the other may
fail, then we should consider it ready. The other ip state does not
matter at all, it can be none too.

Fixes-test: @nmcli_device_reapply_routes
2021-11-18 16:21:34 +01:00
Beniamino Galvani
6ac95047ca dhcp: remove old timeout code
There is already the 'no_lease_timeout'.
2021-11-18 16:21:34 +01:00
Beniamino Galvani
bce13b0b2f dhcp: schedule a timeout when starting the client
'no_lease_timeout' is the timeout to get the initial lease and to
renew it once it was lost. It should be scheduled when the client is
started.

Fixes-test: @dhcp4_outages_in_various_situation
2021-11-18 16:21:34 +01:00
Fernando Fernandez Mancera
6b4123db1c l3cfg: do not add dependent routes for non-default routes
When the route is not a default route 0.0.0.0/0, NetworkManager should
not add dependent routes.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2021-11-18 16:21:34 +01:00