Commit graph

32514 commits

Author SHA1 Message Date
Thomas Haller
5fe6b63a62
std-aux: add static-asserts about signedness for NM_CMP_DIRECT() 2023-08-07 09:24:47 +02:00
Thomas Haller
f27bf0b9ea
std-aux: add static-asserts about signedness of NM_MIN()/NM_MAX()/NM_CLAMP()
The macros NM_MIN()/NM_MAX()/NM_CLAMP() use typeof() to accept any
integer type as argument. Internally, they rely on standard C integral
conversions of the <> operators and the ternary operator for evaluating
the comparison and the result(type).

That works mostly great. Except, comparing signed and unsigned values in
C leads to oddities and the caller should explicitly take care of that.

Add static assertions to check that the compared arguments have the same
signedness.
2023-08-07 09:24:47 +02:00
Thomas Haller
3732f08319
std-aux: add _NM_INT_IS_SIGNED() and _NM_INT_SAME_SIGNEDNESS() macros 2023-08-07 09:24:46 +02:00
Thomas Haller
5ff1468717
all: ensure signendess for arguments of NM_{MIN,MAX,CLAMP}() macros matches 2023-08-07 09:24:36 +02:00
Íñigo Huguet
fb851f3294 nmcli: warn if daemon version mismatch
When updating NetworkManager to a new version, normally the service is
not restarted by the installer to avoid interrupting networking.
However, next nmcli invocation will use the updated version, but against
the older version of the daemon that is still running. Although this is
suposed to work, it is advisable that nmcli and daemon's versions are
the same. Emit a warning recommending restarting the daemon.

Add nmcli test to check the new feature. To avoid breaking the existing
tests, test-networkmanager-service now reports the same version than the
running nmcli except if it's instructed to report a different one.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1703
2023-08-03 10:09:06 +02:00
Fernando Fernandez Mancera
1dff015627 wifi: merge branch 'ff/wifi_bandwidth'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1704
2023-08-02 10:26:51 +02:00
Fernando Fernandez Mancera
2115032869 nmcli: show bandwidth on wifi device output
Example output:

```
NAME:                                   AP[3]
SSID:                                   testX
SSID-HEX:                               4D4F5649535441525F504C55535F32453037
BSSID:                                  80:78:71:90:2E:15
MODE:                                   Infra
CHAN:                                   104
FREQ:                                   5520 MHz
RATE:                                   540 Mbit/s
BANDWIDTH:                              40 MHz
SIGNAL:                                 32
BARS:                                   ▂▄__
SECURITY:                               WPA2
WPA-FLAGS:                              (none)
RSN-FLAGS:                              pair_ccmp group_ccmp psk
DEVICE:                                 wlp0s20f3
ACTIVE:                                 yes
IN-USE:                                 *
DBUS-PATH:                              /org/freedesktop/NetworkManager/AccessPoint/3
```
2023-08-02 00:54:32 +02:00
Fernando Fernandez Mancera
fe48a4b35c wifi: parse access point announced bandwidth
Parse the access point announced bandwidth in MHz. This is considering
both HT and VHT. Please notice that for VHT 80+80 MHz we are representing it
as 160 MHz.
2023-08-02 00:54:27 +02:00
Fernando Fernandez Mancera
d3620dd286 version: add version 1.46 macros 2023-08-01 19:25:58 +02:00
Fernando Fernandez Mancera
a44f20c985 man: adjust references of nm-settings to nm-settings-nmcli
nm-settings was renamed to nm-settings-nmcli therefore we should rename
all the references to nm-settings-nmcli.
2023-08-01 14:21:23 +02:00
Frederic Martinsons
ac327cb855 nmcli: avoid freeing NULL GString and correct error message
Fixes #1362

Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
2023-07-31 13:01:20 +02:00
Íñigo Huguet
cea9d4634f gitignore: ignore VSCode project and clangd cache folders 2023-07-28 18:05:32 +02:00
Thomas Haller
ad6064e4e8
man: fix typo in "NetworkManager.conf" manual 2023-07-27 21:37:22 +02:00
Thomas Haller
bba0d553b1
man: clarify relation of "dns.systemd-resolved" setting with "dns" 2023-07-27 21:10:11 +02:00
Beniamino Galvani
401ceb85bc release: bump version to 1.45.0 (development) 2023-07-26 16:54:34 +02:00
Beniamino Galvani
7b3a61c8e8 release: bump version to 1.43.90 (1.44-rc1) 2023-07-26 16:49:37 +02:00
Beniamino Galvani
c13b475cb9 NEWS: update 2023-07-26 15:36:01 +02:00
Fernando Fernandez Mancera
7b33aa15d5 device: delete software device when lose carrier and is controller
Software devices that are controllers like bond/bridge/team when
configured to not ignore carrier are being deleted when deactivating the
device. Software devices that are not controllers, shouldn't be deleted.

Otherwise, if a VLAN link is deleted because the ethernet carrier-change
then NetworkManager won't be able to reactivate the VLAN once the
ethernet gets carrier because the link is not present.

This is restoring the previous behaviour and it's know to be relied on
by users.

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

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

Fixes: efa63aef3a ('device: delete software device when software devices lose carrier')
2023-07-26 09:30:39 +02:00
Fernando Fernandez Mancera
9f01cff04f settings: merge branch 'bg/ifcfg-migrate-option'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1700
2023-07-25 15:40:02 +02:00
Beniamino Galvani
b2ada6d4fa settings: implement ifcfg-rh migration option
Implement the migration of ifcfg-rh profiles when the
"main.migrate-ifcfg-rh" option is enabled.
2023-07-25 15:39:06 +02:00
Beniamino Galvani
5e75f0c197 settings: move warning about ifcfg-rh
Move the warning about the presence of ifcfg-rh profiles from the
plugin to NMSettings. In this way, it will be easier to implement the
migration option in the next commit.
2023-07-25 15:39:06 +02:00
Beniamino Galvani
52cca91dd2 build,core: add a "main.migrate-ifcfg-rh" configuration option
The option enables automatic migration of ifcfg-rh connection profiles
to keyfile. The default value can be configured at build time.
2023-07-25 15:39:06 +02:00
Fernando Fernandez Mancera
aaaf727b97 nmtui: merge branch 'jv/nmtui-inclusive'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1698
2023-07-25 14:23:53 +02:00
Jan Vaclav
bf4d0eba6e nmtui: replace occurrences of master/slave with controller/port in internal code
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1335
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1698
2023-07-25 14:22:25 +02:00
Fernando Fernandez Mancera
4f84ed9c10 nmcli: merge branch 'jv/nmcli-inclusive'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1697
2023-07-25 14:19:35 +02:00
Jan Vaclav
16f3e64307 nmcli: replace occurrences of master/slave with controller/port in internal code
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1334
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1697
2023-07-25 14:18:22 +02:00
Wen Liang
e8a2306afb assume: change IPv6 method from "ignore" and "disabled" into "auto"
IPv6 method "disabled" and "ignore" are not supported for loopback
device, when generating the assume connection, the generated connection
will fail verification. Therefore, change the IPv6 method into "auto",
as a result, for loopback external connection, NM will not toggle the
`disable_ipv6` sysctl setting when `systemd-sysctl` sets it into 1.

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1694
2023-07-24 22:09:43 -04:00
Jan Vaclav
c779c22fcb initrd: unset dhcp options for static profiles
Makes it so that DHCP properties (`dhcp-timeout`, `dhcp-hostname`) are unset when they are deemed unnecessary.
Unit tests have also been updated to account for this change.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1276
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1695
2023-07-24 11:17:27 +02:00
NorwayFun
13d4d4c35c Update file ka.po
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1687
2023-07-19 14:34:50 +02:00
Fernando Fernandez Mancera
fb362e0583 manager: allow controller activation if device is deactivating
When activating a port connection it will require the controller
connection is active or a valid controller device candidate is available
for activation.

One of the conditions we consider for a controller device to be a valid
candidate for the connection is that it is not active, therefore we
should also consider as valid a device that is currently deactivating.
Otherwise, we could fail during the port activation just because the
deactivation of the controller device candidate didn't finish yet.

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1693
2023-07-19 12:09:09 +02:00
Fernando Fernandez Mancera
d441f846b2 glib-aux: merge branch 'th/fix-ifname-valid-kernel'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1692
2023-07-19 11:55:08 +02:00
Thomas Haller
ab69d430a7 glib-aux: fix rejecting '\v' and NBSP in nm_utils_ifname_valid_kernel()
Kernel's dev_valid_name() calls isspace(), which also rejects '\v'
and '\240'.

As this tightens the check, the change can break code that partly worked
before. It surely didn't work to the point, where an interface with such
name could be created in kernel.

  # ip link add name $'foo\240bar' type dummy
  RTNETLINK answers: Invalid argument
2023-07-19 11:50:04 +02:00
Thomas Haller
cffca6f995 glib-aux: add NM_ASCII_SPACES_KERNEL helper 2023-07-19 11:50:04 +02:00
Fernando Fernandez Mancera
5e67644f96 nmcli: merge branch 'ihuguet_ask_offline'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1688
2023-07-17 13:13:17 +02:00
Íñigo Huguet
d414265ab1 nmcli: fix endless loop with --offline --ask
If --offline and --ask were used at the same time, and endless loop
showing the readline's prompt but without waiting for user's input
happened.

This was because when using --offline, all arguments are parsed and
resolved before running the g_main_loop. In nmc_readline_helper it was
checked that the main loop is running, so if g_main_loop_quit is called
we can stop waiting for user's input.

Fix this bug by continue polling for user input if the main loop is
running or if we are in offline mode.  Cancelling the user input is
still possible both in normal and offline mode with Ctrl+C or Ctrl+D.

Added a test case to verify that this still works after future changes.
2023-07-17 12:58:07 +02:00
Íñigo Huguet
5490604084 nmcli: move offline flag from NmCli to NmcConfig struct
This flag is a setting that changes the behaviour of nmcli, it's not
only the current state of the program, so it makes more sense to put it
in NmcConfig than in NmCli.

Furthermore, it's needed to fix a bug in next commit, too.
2023-07-17 12:56:03 +02:00
Thomas Haller
514e944da3
contrib: add "cloud-init", "firewalld", "nftables" to makerepo.sh script 2023-07-14 09:40:26 +02:00
Beniamino Galvani
a81de2fc8b release: bump version to 1.43.11 (development) 2023-07-12 16:56:31 +02:00
Beniamino Galvani
2d261ec768 merge: branch 'fix_ovs'
device: do not set MAC address on iface with index <=0

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1691
2023-07-12 14:43:25 +00:00
Gris Ge
215bc15255 device: do not set MAC address on iface with index <=0
The `nm_device_hw_addr_reset()` should only set MAC address on NIC
with valid(>0) interface index.

The failure was found by `ovs_mtu` test of NMCI, failed to reproduce
the original problem (`ovs_mtu` test of NMCI) with 100 times retry.
And no trace log found for original test failure, hence cannot tell why
`nm_device_hw_addr_reset()` been invoked with iface index 0.

Signed-off-by: Gris Ge <fge@redhat.com>
2023-07-12 22:16:04 +08:00
Thomas Haller
efa63aef3a device: delete software device when software devices lose carrier
We delete devices when the connection goes down and NetworkManager
created the device earlier.

Software devices like bond/bridge/team default to ignoring carrier.
However, when configuring them to not ignore carrier
([device].ignore-carrier), they were not deleted when deactivating the
devices.

This adjusts commit d0c2a24b71 ('device: do not remove software devices
on initial disconnected (rh #1035814)'). Note that back then there was
no check whether the device has an activation queued, so it behaved
differently then.

When the software device enters the UNAVAILABLE state from UNMANAGED,
during cleanup we shouldn't delete the link.

Co-Authored-By: Beniamino Galvani <bgalvani@redhat.com>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1686
2023-07-12 15:30:05 +02:00
Jan Vaclav
9a5c7c7228 build: make modprobe path configurable
Extracts the hardcoded modprobe path used in `src/libnm-platform/nm-platform-utils.c` to the configurable MODPROBE_PATH macro
Merge request: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1689
Closes: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1257
2023-07-11 17:06:19 +02:00
Fernando Fernandez Mancera
5b8fdd25ab utils: extend connection matching function for UUID in controller
When matching two connections one might be using UUID and the other one
could be using interface-name for the controller property. When
recovering from a fresh start NM does not have any context and when
generating a connection we are using UUID as the controller.

It is always hard to guess what is the right candidate to pick but at
least something NM can do is checking if the UUID matches a connection
with the same controller interface-name. If there are no other
conflicts, then we can assume that is a good canditate to activate.

This is a follow up to `dc254f90e2b306700a0b81f7194e9b0438c62f4c`.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1684
2023-07-11 17:01:41 +02:00
Gris Ge
5565aebf30 merge: branch 'br_fix_po'
po: fix wrong translation in simplified Chinese

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1590
2023-07-03 09:32:22 +00:00
chengyechun
11219b483a po: fix wrong translation in simplified Chinese 2023-07-03 09:16:44 +00:00
Thomas Haller
ccb16013e0
gitlab-ci: fix detection and handling of Ubuntu 18.04
Fixes: d563b4e009 ('gitlab-ci: fix setup of debian:9 container')
2023-06-30 18:51:13 +02:00
Thomas Haller
6985c011c7
nm-in-container: add NetworkManager.service override 2023-06-30 15:44:05 +02:00
Thomas Haller
ad4e068bfd
cloud-setup/man: add DEBUGGING section to man nm-cloud-setup 2023-06-29 17:41:13 +02:00
Beniamino Galvani
646e041523 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
2023-06-29 15:12:51 +02:00
Thomas Haller
c961ec1f99
keyfile: merge branch 'th/keyfile-rename'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1661
2023-06-29 14:10:12 +02:00