Commit Graph

33177 Commits

Author SHA1 Message Date
Beniamino Galvani
4cd4ab518e wifi: fix enumeration of 6 GHz channels from wiphy
Command NL80211_CMD_GET_WIPHY without any flag only returns channels
in the 2 GHz and 5 GHz bands, for backwards compatibility with old
userspace tools. To get the full list we need to pass attribute
NL80211_ATTR_SPLIT_WIPHY_DUMP (added in Linux 3.9 released in 2013),
and allow the handler to be called multiple times.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1500
2024-04-02 16:12:57 +02:00
Beniamino Galvani
8ca7433a14 wifi: fix the ranges of 5 GHz and 6 GHz bands
The 6 GHz band starts from frequency 5950, anything below is 5 GHz.
2024-04-02 16:09:28 +02:00
Fernando Fernandez Mancera
9ac1d6e22b libnm-lldp: use ETH_P_ALL instead of NM_ETHERTYPE_LLDP for the socket
When creating the socket for listening to LLDP frames we are setting
NM_ETHERTYPE_LLDP (0x88cc) as protocol. In most of the cases, that is
correct but when the interface is attached as a port to a OVS bridge,
kernel is not matching the protocol correctly. The reason might be that
some metadata is added to the packet, but we are not completely sure
about it.

Instead, we should use ETH_P_ALL to match all the protocols. Later, we
have a eBPF filter to drop the packet by multicast MAC address or
protocol. This is how lldpd is doing it for example.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1903
2024-04-02 15:59:43 +02:00
Gris Ge
28565cdd32 merge: branch 'fix_f40_build'
fix gcc warnings

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1908
2024-04-02 13:34:12 +00:00
Gris Ge
98cabe557f fix gcc warnings
In Fedora 40+, we have complaining failure:

```
src/libnm-glib-aux/nm-uuid.c: In function 'nm_uuid_generate_from_strings_strv':
src/libnm-glib-aux/nm-uuid.c:490:12: error: '_1' may be used
uninitialized [-Werror=maybe-uninitialized]
  490 |     return nm_uuid_generate_from_string_str(s, slen, uuid_type,
  type_args);
      |            ^
src/libnm-glib-aux/nm-uuid.c:392:1: note: by argument 1 of type 'const
char *' to 'nm_uuid_generate_from_string_str' declared here
  392 | nm_uuid_generate_from_string_str(const char   *s,
      | ^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: gcc returned 1 exit status
```

Fixed by set the `s` initial variable to NULL;

Signed-off-by: Gris Ge <fge@redhat.com>
2024-04-02 21:03:51 +08:00
Íñigo Huguet
1556bf3855 merge: branch 'ih/meson-qt-auto'
meson: autodetect Qt dependencies

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1906
2024-04-02 12:59:12 +00:00
Íñigo Huguet
f57513097f meson: autodetect Qt dependencies
Configuring the build directory with meson often fails if you don't have
the right Qt dependencies. As they are used only to build some examples,
it is better to autodetect them and, if present, then build the
examples but skip them otherwise.

Still accept forcing qt=true or qt=false as before.

Note that there is a option type called "feature" whose purpose is to
support exactly this: features with enable/disable/auto possible values:
https://mesonbuild.com/Build-options.html#features.  However, they don't
accept true/false values so scripts using qt=true/false would start
failing. Since meson 0.60 the "deprecated" argument can be used for
options (https://mesonbuild.com/Build-options.html#deprecated-options),
but that's a too new version of meson.

Also, this fixes some Gitlab-CI failures that happen when generating the
tarball with make distcheck or meson dist. This is because it tries to
check that the tarball content can be configured and built, but it uses
the default configurations so it was using qt=yes. Now it will use
qt=auto, avoiding the failure.

Fixes: 61f0531509 ('gitlab-ci: test re-buildability of distribution tarballs')
2024-04-02 12:58:26 +00:00
Beniamino Galvani
d534f984f7 device: ignore error setting mac if it's a global special value
If the distro sets a global special value for the cloned MAC address
(for example, "stable-ssid") and the driver doesn't support changing
the MAC, all activations will fail on the interface unless users know
that they need to change the cloned MAC. Be more tolerant to errors in
case the MAC is global and special.

https://bugzilla.redhat.com/show_bug.cgi?id=2270062
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1898
2024-03-29 09:48:23 +01:00
Beniamino Galvani
f58b281ef4 ndisc: accept unknown ip6-privacy value
The value can be unknown for different reasons:

 - we don't have a value saved in NMDevice's "ip6_saved_properties"
   because NM was restarted or because the device didn't have an
   ifindex when it became managed.

 - the value read from /proc is outside the allowed range (kernel
   allows "echo 42 > /proc/sys/net/ipv6/conf/enp1s0/use_tempaddr")

Note that the second case was already possible before commit
797f3cafee ('device: fall back to saved use_tempaddr value instead
of rereading /proc').

If we can't determine the previous value, pass "unknown" to ndisc; it
will generate a l3cd with "unknown" ip6-privacy, which means to not
set the value when committing the configuration.

Fixes: 797f3cafee ('device: fall back to saved use_tempaddr value instead of rereading /proc')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1907
2024-03-28 19:21:43 +01:00
Íñigo Huguet
b4e3095522 merge: branch 'main'
Update Turkish translation

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1884
2024-03-26 16:09:25 +00:00
emintufan
e179fae31e Update Turkish translation 2024-03-26 15:19:25 +00:00
Beniamino Galvani
de130df3e2 manager: fix race condition while enumerating devices at startup
While enumerating devices at startup, we take a snapshot of existing
links from platform and we start creating device instances for
them. It's possible that in the meantime, while processing netlink
events in platform_link_added(), a link gets renamed. If that happens,
then we have two different views of the same ifindex: the cached link
from `links` and the link in platform.

This can cause issues: in platform_link_added() we create the device
with the cached name; then in NMDevice's constructor(), we look up
from platform the ifindex for the given name. Because of the rename,
this lookup can match a newly created, different link.

The end result is that the ifindex from the initial snapshot doesn't
get a NMDevice and is not handled by NetworkManager.

Fix this problem by fetching the latest version of the link from
platform to make sure we have a consistent view of the state.

https://issues.redhat.com/browse/RHEL-25808
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1897
2024-03-26 10:26:02 +01:00
Gris Ge
666dd2840a release: bump version to 1.47.3 (development) 2024-03-22 16:28:21 +08:00
Íñigo Huguet
46245b23ce merge: branch 'ipv6-temp-lifetime'
device: introduce ipv6.temp-valid-lifetime and ipv6.temp-preferred-lifetime properties

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1846
2024-03-21 07:09:35 +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
Íñigo Huguet
ea43ae9643 merge: branch 'meson-fix-set10'
build: use only booleans in a set10 method

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1893
2024-03-20 17:27:58 +00:00
Yegor Yefremov
76fd8f6775 build: use only booleans in a set10 method
Fixes the following deprecation warning:

meson.build:585: DEPRECATION: configuration_data.set10
with number. the `set10` method should only be used with booleans
2024-03-20 17:27:16 +00:00
Fernando Fernandez Mancera
065e67286d merge: branch 'jv/deprecate-wired-blacklist'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1890
2024-03-20 15:44:45 +01:00
Jan Vaclav
0e283a8917 all: use the new NMSettingWired mac-address-denylist property 2024-03-20 15:32:01 +01: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
Jan Vaclav
da8b304c38 libnm/wired: replace mac_address_blacklist type GArray with NMValueStrv
This replaces the underlying type of mac_address_blacklist, which is currently GArray,
with a more re-usable NMValueStrv, which allows us to implement it as a direct property.
2024-03-20 15:31:35 +01:00
Jan Vaclav
a9c4c1d84e libnm/wired: fix mac comparison in _remove_mac_blacklist_item_by_value
The comparison checking for MAC address equality had previously been flipped around.

Fixes: b084ad7f2b ('libnm-core: canonicalize hardware addresses in settings')
2024-03-20 15:31:35 +01:00
Jan Vaclav
a810de57b6 libnm-core: drop _NM_DEPRECATED_INCLUSIVE_LANGUAGE_1_48 macro 2024-03-20 15:31:35 +01:00
Beniamino Galvani
6af2fb351c core, libnm: expose the reason for unmanaged devices
A common source for doubts and questions from users is about why
devices are unmanaged. Unfortunately NM doesn't expose that
information properly via D-Bus and so it's not available in nmcli.

The device D-Bus object has two properties that are strictly related:
"state" and "state-reason". The latter represents the reason for the
current state. Introduce new reasons to indicate the possible causes
for the unmanaged state. Note that a device can be unmanaged because
of multiple reasons at the same time, we only return one.

Before:

  $ nmcli -f GENERAL.DEVICE,GENERAL.TYPE,GENERAL.STATE,GENERAL.reason device show

  GENERAL.DEVICE:                         enp7s0
  GENERAL.TYPE:                           ethernet
  GENERAL.STATE:                          10 (unmanaged)
  GENERAL.REASON:                         0 (No reason given)

  GENERAL.DEVICE:                         tun0
  GENERAL.TYPE:                           tun
  GENERAL.STATE:                          10 (unmanaged)
  GENERAL.REASON:                         0 (No reason given)

  GENERAL.DEVICE:                         hwsim0
  GENERAL.TYPE:                           unknown
  GENERAL.STATE:                          10 (unmanaged)
  GENERAL.REASON:                         0 (No reason given)

After:

  $ nmcli -f GENERAL.DEVICE,GENERAL.TYPE,GENERAL.STATE,GENERAL.reason device show

  GENERAL.DEVICE:                         enp7s0
  GENERAL.TYPE:                           ethernet
  GENERAL.STATE:                          10 (unmanaged)
  GENERAL.REASON:                         76 (The device is unmanaged by user decision via settings plugin ("unmanaged-devices" for keyfile or "NM_CONTROLLED=no" for ifcfg-rh))

  GENERAL.DEVICE:                         tun0
  GENERAL.TYPE:                           tun
  GENERAL.STATE:                          10 (unmanaged)
  GENERAL.REASON:                         75 (The device is unmanaged by explicit user decision (e.g. 'nmcli device set $DEV managed no')

  GENERAL.DEVICE:                         hwsim0
  GENERAL.TYPE:                           unknown
  GENERAL.STATE:                          10 (unmanaged)
  GENERAL.REASON:                         69 (The device is unmanaged because the device type is unmanaged by default)

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1887
2024-03-20 15:25:09 +01:00
Beniamino Galvani
7d5b4d0b62 gitlab: add checklist item about updating NEWS file to the MR template
From now on, every commit should also update the NEWS file when
necessary. Update the merge request template in Gitlab to add an item
for that to the checklist.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1896
2024-03-20 15:12:13 +01:00
Beniamino Galvani
e5c2c5f1c2 nm-dispatcher: fix crash when parsing output dictionary
'stdout' is NULL when the script didn't write anything or failed.

Fixes the following crash detected by NMCI in test
'dispatcher_device_handler_dummy'.

  nm-dispatcher[936339]: g_strsplit: assertion 'string != NULL' failed

  build_result_options (nm-dispatcher)
  complete_request (nm-dispatcher)
  complete_script (nm-dispatcher)
  script_watch_cb (nm-dispatcher)
  g_child_watch_dispatch (libglib-2.0.so.0)
  g_main_dispatch (libglib-2.0.so.0)
  g_main_context_iterate (libglib-2.0.so.0)
  g_main_context_iteration (libglib-2.0.so.0)
  main (nm-dispatcher)
  __libc_start_main (libc.so.6)
  _start (nm-dispatcher)

Fixes: d72f26b875 ('dispatcher: read device-handler's stdout into a dictionary')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1889
2024-03-20 09:31:44 +01:00
Jan Vaclav
b699de9d4a libnm-core/wireless: fix memory leak in add_mac_denylist_item()
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1894

Fixes: fa215c6a69 ('wireless: deprecate NMSettingWireless mac-address-blacklist property')
2024-03-18 12:33:52 +01:00
Beniamino Galvani
6f1ed55dfc NEWS: update 2024-03-18 09:22:34 +01:00
Beniamino Galvani
209ab10fd9 merge: branch 'pr/1828'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1457
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1828
2024-03-18 09:09:32 +01:00
Tomas Ebenlendr
d49e9a44c3 nmtui: 802.1x: add expert TLS settings
Allow user to edit openssl_strings and phase1_auth_flags using nmtui.
Hide these settings behind "Show expert TLS options" checkbox when
edited network uses default values for these options.
2024-03-16 21:30:36 +01:00
Tomas Ebenlendr
d9e5c4e63a nmtui: 802.1x: make anonymous identity optional
Anonymous identity may be left blank. Identity (username) field is then used.
2024-03-16 21:30:36 +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
Wen Liang
15901a7489 device: use subnet when the applied connection has IPv6 method shared
We should use the IPv6 subnet when we have an applied connection
stored on the downlink device, and the IPv6 method should be "shared"
for that applied connection. It does not make sense to register l3cd
and set router config for ndisc instance when the downlink device is
already deactivated.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1880
Resolves: https://issues.redhat.com/browse/RHEL-17350

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-03-15 10:02:13 -04:00
Gris Ge
8c4f8ecd08 merge: branch 'fix_ovs_same_name'
ovs: Do not allow OVS bridge and port to be parent

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1878
2024-03-15 08:39:42 +00:00
Gris Ge
7096f52a59 ovs: Do not allow OVS bridge and port to be parent
When creating VLAN over OVS internal interface which holding the same
name as its controller OVS bridge, NetworkManager will fail with error:

    Error: Connection activation failed: br0.101 failed to create
    resources: cannot retrieve ifindex of interface br0 (Open vSwitch
    Bridge)

Expanded the `find_device_by_iface()` with additional argument
`child: NmConnection *` which will validate whether candidate is
suitable to be parent device.

In `nm_device_check_parent_connection_compatible()`, we only not allow OVS
bridge and OVS port being parent.

Resolves: https://issues.redhat.com/browse/RHEL-26753

Signed-off-by: Gris Ge <fge@redhat.com>
2024-03-15 16:12:37 +08:00
Fernando Fernandez Mancera
b40e2eb721 gitlab-ci: drop unsupported systems from the pipeline
Drop Fedora 30-37, Ubuntu 18.04 LTS and Debian 9 from the pipeline.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1892
2024-03-14 14:50:04 +01:00
Fernando Fernandez Mancera
170e128215 core: deprecate master in NMActiveConnection internal API
PROP_INT_MASTER_READY and PROP_INT_MASTER are internal API only, that
means we can replace it right away. In addition, replace the functions
related to the properties.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1885
2024-03-13 18:24:47 +01:00
Fernando Fernandez Mancera
1f05526ed7 core: drop NMDevice master and introduce controller
The master property for NMDevice is internal only therefore we can
replace it directly with controller. In addition, I have adapted related
functions to use controller instead of master.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1881
2024-03-13 18:00:40 +01:00
Till Maas
e1a1f0de89 merge: branch 'meson-fix-double-header'
build: remove a header defined twice

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1891
2024-03-13 16:53:35 +00:00
Yegor Yefremov
ecfd564161 build: remove a header defined twice
Fixes the following warning:

src/libnm-client-impl/meson.build:139: WARNING: Keyword argument "header" defined multiple times.
WARNING: This will be an error in future Meson releases.
2024-03-13 15:56:10 +01:00
Gris Ge
f805114a91 merge: branch 'dns_checkpoint'
Allow rollback on internal global DNS

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1875
2024-03-13 13:16:48 +00:00
Gris Ge
86d67da28d checkpoint: Allow rollback on internal global DNS
With `NM_CHECKPOINT_CREATE_FLAG_TRACK_INTERNAL_GLOBAL_DNS` flag set on
checkpoint creation, the checkpoint rollback will restore the
global DNS in internal configure file
`/var/lib/NetworkManager/NetworkManager-intern.conf`.

If user has set global DNS in /etc folder, this flag will not take any
effect.

Resolves: https://issues.redhat.com/browse/RHEL-23446

Signed-off-by: Gris Ge <fge@redhat.com>
2024-03-13 20:52:37 +08:00
Beniamino Galvani
b185d21c95 l3cfg: fix handling of ipv6 hop limit
Fixes: 5c48c5d5d6 ('l3cfg: set IPv6 sysctls during NML3Cfg commit')

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1883
2024-03-12 09:58:28 +01:00
Wen Liang
db5b92fa03 libnm: use nm_setting_connection_get_controller() where possible
To enforce conscious language support, use
`nm_setting_connection_get_controller()` where possible and replace
`nm_setting_connection_get_master()`.

https://issues.redhat.com/browse/RHEL-28623

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1882
2024-03-12 09:54:31 +01:00
Fernando Fernandez Mancera
3cb9065305 Revert "build: workaround -Wno-calloc-transposed-args warning in systemd code"
Upstream systemd code was re-imported and therefore the issue is now
solved. Enable the warning again.

This reverts commit b1016e3be8.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1886
2024-03-12 09:47:06 +01:00
Fernando Fernandez Mancera
534e199484 merge: branch 'jv/deprecate-mac-blacklist'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1741
2024-03-11 11:43:18 +01:00
Jan Vaclav
f9397a5740 test/client: set 802-11-wireless.mac-address-denylist 2024-03-11 11:42:19 +01:00
Jan Vaclav
5672757ac4 test/networkmanager-service: simulate behavior of aliased/deprecated properties
Previously, the mock server did not behave as expected when given an aliased property
and the test results were not matching that of actual NM daemon behavior.
2024-03-11 11:42:19 +01:00
Jan Vaclav
fda0f8435d all: use the new NMSettingWireless mac-address-denylist property 2024-03-11 11:42:19 +01:00