Commit graph

31143 commits

Author SHA1 Message Date
Thomas Haller d0e58f1aeb
all: merge branch 'th/inet-utils'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1342
2022-08-25 19:06:22 +02:00
Thomas Haller 0e3ab2782a
glib-aux: simplify nm_inet_parse_str() by using nm_inet_parse_bin() 2022-08-25 19:05:57 +02:00
Thomas Haller b02aeaf2f3
glib-aux: fix various nm_ip_addr_*() functions for unaligned addresses
Most of our nm_ip_addr_*() functions take an opaque pointer, that
can be either in_addr_t, struct in6_addr or NMIPAddr.

They also tend to support that their argument pointer is not aligned.
The reason is not very strong, except that usually it's simple to
support and it allows the caller to use those low-level functions for
pointers of unknown alignment (e.g. from a package on the network).

Fix a few cases for that.
2022-08-25 19:05:55 +02:00
Thomas Haller 232df1c08d
glib-aux/tests: test nm_ip_addr_is_site_local() 2022-08-25 19:05:53 +02:00
Thomas Haller 08eff4c46e
glib-aux: rename IP address related helpers from "nm-inet-utils.h"
- name things related to `in_addr_t`, `struct in6_addr`, `NMIPAddr` as
  `nm_ip4_addr_*()`, `nm_ip6_addr_*()`, `nm_ip_addr_*()`, respectively.

- we have a wrapper `nm_inet_ntop()` for `inet_ntop()`. This name
  of our wrapper is chosen to be familiar with the libc underlying
  function. With this, also name functions that are about string
  representations of addresses `nm_inet_*()`, `nm_inet4_*()`,
  `nm_inet6_*()`. For example, `nm_inet_parse_str()`,
  `nm_inet_is_normalized()`.

<<<<

  R() {
     git grep -l "$1" | xargs sed -i "s/\<$1\>/$2/g"
  }

  R NM_CMP_DIRECT_IN4ADDR_SAME_PREFIX          NM_CMP_DIRECT_IP4_ADDR_SAME_PREFIX
  R NM_CMP_DIRECT_IN6ADDR_SAME_PREFIX          NM_CMP_DIRECT_IP6_ADDR_SAME_PREFIX
  R NM_UTILS_INET_ADDRSTRLEN                   NM_INET_ADDRSTRLEN
  R _nm_utils_inet4_ntop                       nm_inet4_ntop
  R _nm_utils_inet6_ntop                       nm_inet6_ntop
  R _nm_utils_ip4_get_default_prefix           nm_ip4_addr_get_default_prefix
  R _nm_utils_ip4_get_default_prefix0          nm_ip4_addr_get_default_prefix0
  R _nm_utils_ip4_netmask_to_prefix            nm_ip4_addr_netmask_to_prefix
  R _nm_utils_ip4_prefix_to_netmask            nm_ip4_addr_netmask_from_prefix
  R nm_utils_inet4_ntop_dup                    nm_inet4_ntop_dup
  R nm_utils_inet6_ntop_dup                    nm_inet6_ntop_dup
  R nm_utils_inet_ntop                         nm_inet_ntop
  R nm_utils_inet_ntop_dup                     nm_inet_ntop_dup
  R nm_utils_ip4_address_clear_host_address    nm_ip4_addr_clear_host_address
  R nm_utils_ip4_address_is_link_local         nm_ip4_addr_is_link_local
  R nm_utils_ip4_address_is_loopback           nm_ip4_addr_is_loopback
  R nm_utils_ip4_address_is_zeronet            nm_ip4_addr_is_zeronet
  R nm_utils_ip4_address_same_prefix           nm_ip4_addr_same_prefix
  R nm_utils_ip4_address_same_prefix_cmp       nm_ip4_addr_same_prefix_cmp
  R nm_utils_ip6_address_clear_host_address    nm_ip6_addr_clear_host_address
  R nm_utils_ip6_address_same_prefix           nm_ip6_addr_same_prefix
  R nm_utils_ip6_address_same_prefix_cmp       nm_ip6_addr_same_prefix_cmp
  R nm_utils_ip6_is_ula                        nm_ip6_addr_is_ula
  R nm_utils_ip_address_same_prefix            nm_ip_addr_same_prefix
  R nm_utils_ip_address_same_prefix_cmp        nm_ip_addr_same_prefix_cmp
  R nm_utils_ip_is_site_local                  nm_ip_addr_is_site_local
  R nm_utils_ipaddr_is_normalized              nm_inet_is_normalized
  R nm_utils_ipaddr_is_valid                   nm_inet_is_valid
  R nm_utils_ipx_address_clear_host_address    nm_ip_addr_clear_host_address
  R nm_utils_parse_inaddr                      nm_inet_parse_str
  R nm_utils_parse_inaddr_bin                  nm_inet_parse_bin
  R nm_utils_parse_inaddr_bin_full             nm_inet_parse_bin_full
  R nm_utils_parse_inaddr_prefix               nm_inet_parse_with_prefix_str
  R nm_utils_parse_inaddr_prefix_bin           nm_inet_parse_with_prefix_bin
  R test_nm_utils_ip6_address_same_prefix      test_nm_ip_addr_same_prefix

  ./contrib/scripts/nm-code-format.sh -F
2022-08-25 19:05:51 +02:00
Thomas Haller d65feb26e5
glib-aux: move inet related helpers to "nm-inet-utils.h" 2022-08-25 19:05:51 +02:00
Thomas Haller f23e43b18a
glib-aux: add "libnm-glib-aux/nm-inet-utils.h" 2022-08-25 19:05:46 +02:00
Wen Liang a5d8f8321f dns: merge branch "wl/dns"
https://bugzilla.redhat.com/show_bug.cgi?id=2120763

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1344
2022-08-25 12:46:45 -04:00
Wen Liang 6058445aea dns: kill pending dnsmasq process when mode is not 'dnsmasq'
When NM starts, if `main.dns` is not `dnsmasq`, then the pending dnsmasq
process should be killed by NM.

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1344
2022-08-25 12:31:48 -04:00
Wen Liang 9b3a96f821 dnsmasq: silently ignore if pid file is not existed when killing 2022-08-25 10:56:47 -04:00
Thomas Haller 89367de3eb
bond: merge branch 'ff/fix_bond_typo'
https://bugs.launchpad.net/network-manager/+bug/1987001
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1072

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

(cherry picked from commit 2af8645f71)
2022-08-25 15:40:18 +02:00
Fernando Fernandez Mancera f693bc6b71
libnm-utils: fix typo in bond ad_select bandwidth mode
The correct spelling is `bandwidth` instead of `bandwith`.

https://bugs.launchpad.net/network-manager/+bug/1987001

Fixes: 32870d8233 ('libnm-utils: convert string bond opts to int')
(cherry picked from commit 5f3237acab)
2022-08-25 15:40:18 +02:00
Fernando Fernandez Mancera 1b704e2f42
bond: fix missing assignment of lp_interval_has
The variable `lp_interval` was being assigned instead of
`lp_interval_has`. The `lp_interval` bond option was not being set
correctly.

https://bugs.launchpad.net/network-manager/+bug/1987001

Fixes: e064eb9d13 ('bond: use netlink to set bond options')
(cherry picked from commit 7d4307e8df)
2022-08-25 15:40:17 +02:00
Thomas Haller 2af8645f71
bond: merge branch 'ff/fix_bond_typo'
https://bugs.launchpad.net/network-manager/+bug/1987001
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1072

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1347
2022-08-25 15:37:59 +02:00
Fernando Fernandez Mancera 5f3237acab
libnm-utils: fix typo in bond ad_select bandwidth mode
The correct spelling is `bandwidth` instead of `bandwith`.

https://bugs.launchpad.net/network-manager/+bug/1987001

Fixes: 32870d8233 ('libnm-utils: convert string bond opts to int')
2022-08-25 15:34:30 +02:00
Fernando Fernandez Mancera 7d4307e8df
bond: fix missing assignment of lp_interval_has
The variable `lp_interval` was being assigned instead of
`lp_interval_has`. The `lp_interval` bond option was not being set
correctly.

https://bugs.launchpad.net/network-manager/+bug/1987001

Fixes: e064eb9d13 ('bond: use netlink to set bond options')
2022-08-25 15:34:23 +02:00
Thomas Haller f3b17a8db9
libnm: undeprecate nm_remote_connection_get_secrets()
Various synchronous methods (D-Bus calls) in libnm's NMClient API were
deprecated. The problem is that NMClient contains a cache of D-Bus
objects, and it gets updated by asynchronous events (D-Bus signals).
Those events get only processed when iterating the GMainContext, but
they are ordered.

When we perform a pseudo blocking D-Bus call with
g_dbus_connection_call_sync(), then GDBus creates a temporary
GMainContext, sends the request and iterates the internal context
blocking for the response. That is, this reply is not synchrounized with
the events that update the NMClient cache.

That is a problem for methods like nm_remote_connection_delete(),
because you call blocking delete, but afterwards the object is still in
the NMClient cache. That's why most blocking methods are deprecated.

While such blocking calls are therefore problematic, they can still be
very convenient to call from a simple script, a test tool or the python
REPL. See "examples/python/gi/nm-wg-set" which calls
nm_remote_connection_get_secrets(), and it would be (unnecessarily)
cumbersome to do the correct thing or using async API.

In particular, nm_remote_connection_get_secrets() doesn't retrieve an object
that is in the NMClient cache in the first place. Sure, the result is
out of order with the cache, but it's not obviously related and in most
cases it wouldn't matter to the user. So undeprecate this function again.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1345
(cherry picked from commit b46d0dcb6f)
2022-08-25 15:28:18 +02:00
Thomas Haller b46d0dcb6f
libnm: undeprecate nm_remote_connection_get_secrets()
Various synchronous methods (D-Bus calls) in libnm's NMClient API were
deprecated. The problem is that NMClient contains a cache of D-Bus
objects, and it gets updated by asynchronous events (D-Bus signals).
Those events get only processed when iterating the GMainContext, but
they are ordered.

When we perform a pseudo blocking D-Bus call with
g_dbus_connection_call_sync(), then GDBus creates a temporary
GMainContext, sends the request and iterates the internal context
blocking for the response. That is, this reply is not synchrounized with
the events that update the NMClient cache.

That is a problem for methods like nm_remote_connection_delete(),
because you call blocking delete, but afterwards the object is still in
the NMClient cache. That's why most blocking methods are deprecated.

While such blocking calls are therefore problematic, they can still be
very convenient to call from a simple script, a test tool or the python
REPL. See "examples/python/gi/nm-wg-set" which calls
nm_remote_connection_get_secrets(), and it would be (unnecessarily)
cumbersome to do the correct thing or using async API.

In particular, nm_remote_connection_get_secrets() doesn't retrieve an object
that is in the NMClient cache in the first place. Sure, the result is
out of order with the cache, but it's not obviously related and in most
cases it wouldn't matter to the user. So undeprecate this function again.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1345
2022-08-25 15:27:35 +02:00
Lubomir Rintel b58fc7088b tui/wifi: remove WEP options
WEP has been deprecated and is disabled in some distros (RHEL 9) and
wpa_supplicant upstream. Let's remove the option of using it, but also
keep a chicken bit in form of an environment variable for now.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1340
2022-08-25 14:50:02 +02:00
Lubomir Rintel 350dc1a61b newt-form: remove escape-exits property
As far as I can tell, all forms we have should be dismissable with the
Escape key. We omitted settings "escape-exits" property by accident
before. Let's just remove it.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1339
2022-08-25 14:12:07 +02:00
Lubomir Rintel 032683a824 tui: allow exiting add/edit connection dialog with ESC key
No reason this wouldn't be allowed.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1339
2022-08-25 14:11:53 +02:00
Thomas Haller 7eaec52899
gitlab-ci: fix preserving build artifacts and documentation pages
Without it, the build artifacts were deleted before getting archived.
It means, the tarball and the docs were no longer archived and no
pages on gitlab no longer updated.

Fixes: e118276296 ('gitlab-ci: run unit tests for git subtree subprojects')
(cherry picked from commit cfe44c8832)
2022-08-24 20:57:51 +02:00
Thomas Haller d3a604bbd7
wifi/iwd: merge branch 'balrog-kun/NetworkManager:iwd-fixes'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1338
2022-08-24 20:46:36 +02:00
Andrew Zaborowski e3eac09082
iwd: nm_iwd_manager_get() once and save value
Call nm_iwd_manager_get once on NMDeviceIwd creation and save in
priv->manager to avoid using t very often now that we have 5 new call
sites.  The reasoning is explained in
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1338#note_1519684
2022-08-24 20:44:46 +02:00
Andrew Zaborowski 824f2f26db
iwd: Work around timing when new 802.1x connection activated
Try work around the issue documented by Emil Velikov in
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1264

When we mirror an 802.1x connection to an IWD config file and there's an
AP in range with matching SSID, that connection should become available
for activation.  In IWD terms when an 802.1x network becomes a Known
Network, it can be connected to using the .Connect D-Bus method.

However there's a delay between writing the IWD config file and receiving
the InterfaceAdded event for the Known Network so we don't immediately
find out that the network can now be used.  If an NM client creates a
new connection for an 802.1x AP and tries to activate it quickly enough,
NMDeviceIWD will not allow it to because it won't know the network is
known yet.  To work around this, we save the SSIDs of 802.1x connections
we recently mirrored to IWD config files, for an arbitrary 2 seconds
period, and we treat them as Known Networks in that period since in
theory activations should succeed.

The alternative proposed in the !1264 is to drop NMDeviceIWD checks that
there's a Known Network for the 802.1x connection being activated since
IWD will eventually perform the same checks and IWD is the ultimate
authority on whether the profile is IWD-connectable.
2022-08-24 20:44:46 +02:00
Andrew Zaborowski f6cec3b584
iwd: Let IWD handle retries
When we're set to let IWD control autoconnect, don't retry connections
on NM side, set retry count to 0.
2022-08-24 20:44:45 +02:00
Andrew Zaborowski e384ab74c2
iwd: Be extra careful not to interrupt assumed activation
The IWD backend would originally use .Disconnect() on IWD dbus "Station"
objects to make sure IWD is out of autoconnect or that it isn't
connecting to a network that NM didn't command.  Later the default became
to let IWD run autoconnect so now most of the time the backend just
mirrors IWD's state to NMDevice's state.

Now sometimes when NMDevice still seems to have an active connection but
IWD has gone through one or more state changes (which we may see after a
delay due to D-Bus) and is now connected to or connecting to a different
network, NMDevice would first have to go through .deactivate to mirror
the fact the original connection is no longer active, and it'd use
.Disconnect() which could break the new connection, so check for this
situation.
2022-08-24 20:44:45 +02:00
Thomas Haller cbc2354854
wifi: drop duplicate include in "nm-device-wifi-p2p.c"
Base-on-patch-by: Andrew Zaborowski <andrew.zaborowski@intel.com>
2022-08-24 20:37:27 +02:00
Thomas Haller cfe44c8832
gitlab-ci: fix preserving build artifacts and documentation pages
Without it, the build artifacts were deleted before getting archived.
It means, the tarball and the docs were no longer archived and no
pages on gitlab no longer updated.

Fixes: e118276296 ('gitlab-ci: run unit tests for git subtree subprojects')
2022-08-24 15:54:42 +02:00
Thomas Haller f7e484c8ed
tests: fix "test-client.py" ignoring missing "NM" module
Fixes: 8959083784 ('tests: skip test in "test-client.py" if the pexepect dependency is not available')
2022-08-24 14:01:07 +02:00
Thomas Haller 90b267afa7
contrib: add "--fast" flag to nm-core-format.sh to only check changed files
It's not the default, because a caller might not be aware that this flag
exists, and when calling the script without arguments, it should do
correct (albeit slow) thing.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1341
2022-08-24 12:06:34 +02:00
Ana Cabral 38f00bf6c9 NEWS: update
(cherry picked from commit dc01d353aa)
2022-08-24 11:04:46 +02:00
Ana Cabral dc01d353aa NEWS: update 2022-08-24 10:58:23 +02:00
Thomas Haller 86879692c6
libnm: reword documentation for "ipv4.gateway" and "ipv6.gateway"
(cherry picked from commit 0e26203e02)
2022-08-23 16:39:04 +02:00
Thomas Haller 8959083784
tests: skip test in "test-client.py" if the pexepect dependency is not available 2022-08-23 15:42:43 +02:00
Thomas Haller f27b11dd3f
contrib: install Polish translation in "nm-in-container.sh"
It's needed for the unit tests to test translations too.
2022-08-23 15:42:42 +02:00
Thomas Haller 0e26203e02
libnm: reword documentation for "ipv4.gateway" and "ipv6.gateway" 2022-08-23 14:55:41 +02:00
Ana Cabral 711f69fb73 release: bump version to 1.41.0 (development) 2022-08-15 18:18:45 -03:00
Ana Cabral b2a6b9fcc7 release: bump version to 1.39.90 (1.40-rc1) 2022-08-15 18:13:18 -03:00
Ana Cabral 28282eb1d5 NEWS: update 2022-08-15 17:38:13 -03:00
Ana Cabral 14dabb7b1f po: make update-po
$ make -C po update-po
2022-08-11 19:54:42 +00:00
Thomas Haller ad1bf3c544
systemd: merge branch systemd into main
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1333
2022-08-11 21:51:58 +02:00
Thomas Haller 082e6c96a1
bulid: merge branch 'th/autotools-fix-detect-compiler-warning'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1334
2022-08-11 19:51:11 +02:00
Thomas Haller 4ed6c647b9
build/autotools: fix detecting compiler warning for "-Wno-gnu-variable-sized-type-not-at-end" 2022-08-11 19:50:09 +02:00
Thomas Haller 119d30145e
m4: add NM_COMPILER_WARNING_FLAG() macro
We used

  COMPILER_FLAG(LIBSYSTEMD_NM_CFLAGS, "-Wno-gnu-variable-sized-type-not-at-end")

to detect whether the flag is supported. However, that does not work with GCC since
version 4.4 due to https://gcc.gnu.org/wiki/FAQ#wnowarning.

Note that we already had NM_COMPILER_WARNING(), but that again does
something rather different.
2022-08-11 19:49:41 +02:00
Thomas Haller 3117198f15
Revert "wifi: support "802-1x.phase1-auth-flags=tls-allow-unsafe-renegotiation" flag"
There is still no agreement, about how to name this option, or whether
it should exist at all. Revert the addition of the flag.

As the new release is coming up, drop the new API.

https://bugzilla.redhat.com/show_bug.cgi?id=2072070#c64
https://bugzilla.redhat.com/show_bug.cgi?id=2077973#c24
http://lists.infradead.org/pipermail/hostap/2022-July/040665.html

This reverts commit a5a4aea2e6.
2022-08-11 19:36:26 +02:00
Thomas Haller c99503abc4
NEWS: update 2022-08-11 15:36:03 +02:00
Thomas Haller 4b0f4f4a9d
n-dhcp4: re-import git-subtree for 'src/n-dhcp4'
git subtree pull --prefix src/n-dhcp4 git@github.com:nettools/n-dhcp4.git master --squash
2022-08-11 14:47:04 +02:00
Thomas Haller 3d474037ad Squashed 'src/n-dhcp4/' changes from 7db7dc4bab53..f8fc48dc014d
f8fc48dc014d n-dhcp4-client: check broadcast_mac field in n_dhcp4_client_config_set_broadcast_mac()

git-subtree-dir: src/n-dhcp4
git-subtree-split: f8fc48dc014d016f91c200a81b1208410b1cd667
2022-08-11 14:47:04 +02:00
Thomas Haller cbf7b3546b
platform: fix "maybe-uninitialized" warning in nmp_global_tracker_sync()
Fixes: 3a8864a585 ('platform: delete conflicting route/rule during nmp_global_tracker_sync()')
2022-08-11 13:48:39 +02:00