Commit graph

26940 commits

Author SHA1 Message Date
Thomas Haller
53bd66b540
contrib/release: fix parsing version in "release.sh" script 2020-10-19 20:50:35 +02:00
Thomas Haller
d7f6fb8378
contrib/release: improve help text for "release.sh" script 2020-10-19 20:43:52 +02:00
Thomas Haller
fdeb960087
contrib/release: use "find-backport" scripts from release.sh 2020-10-19 20:35:51 +02:00
Thomas Haller
57cfa5daf9
contrib: add "find-backports" script
This script was previously on the "automation" branch. Add it to
"master".
2020-10-19 20:34:06 +02:00
Beniamino Galvani
317171ed6e initrd: generate infiniband connections
Generate infiniband connections based on the interface name or MAC
address length.

https://bugzilla.redhat.com/show_bug.cgi?id=1883173
2020-10-19 19:03:00 +02:00
Thomas Haller
ba1e1c364c
wifi/iwd: merge branch 'balrog-kun:iwd-hidden-networks-cleanup'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/646
2020-10-19 18:54:04 +02:00
Andrew Zaborowski
c92ad05cee
iwd: Avoid ConnectHiddenNetwork() if network is visible
If the target hidden network is already recorded by IWD with its SSID
during a previous active scan, use the Network.Connect() API instead of
Station.ConnectHiddenNetwork() which would fail in IWD version up to
1.9.  This is a rare corner case scenario though.

Also drop the !nm_wifi_ap_get_supplicant_path(ap) check, I'm not
sure when if ever that condition can be true, more so now that we're
checking nm_wifi_ap_get_fake(ap) before that.
2020-10-19 18:49:30 +02:00
Andrew Zaborowski
a6ece1557c
iwd: Track InterfacesAdded/Removed signals for Networks
Until now we didn't rely on InterfacesAdded and InterfacesRemoved
signals for tracking when IWD finds new Wi-Fi networks or expires
networks not seen in the latest scans.  Instead we'd request the whole
list of networks currently seen by IWD every time the Station.Scanning
property would go from true to false.  However the
Station.GetOrderedNetworks() IWD method that we use has a deficiency
up until 1.9 (I plan to fix it soon) where it won't show the hidden
network discovered in the course of the last ConnectHiddenNetwork() call
if that call was unsuccessful, in other words where the new network has
not been saved as a Known Network.  A new ConnectHiddenNetwork() will
fail with the "NotHidden" error, so we have to use the Network.Connect()
call for such a network but to find it out we need to track the
InterfacesAdded signals.  Doing this may also improve autoconnect speed
in some cases so overall I think it's a good idea.
2020-10-19 18:49:29 +02:00
Andrew Zaborowski
3b6c5d5839
iwd: Don't start new secret request if we sent one already
When IWD asks us for a secret check that we're in NM_DEVICE_STATE_CONFIG
and not for example already in NM_DEVICE_STATE_NEED_AUTH.  I believe that
should only happen if IWD is aborting the previous connection attempt and
connecting to a different network due to a timeout or due to somebody
outside NM calling Connect() on an IWD network object...

Guessing what IWD is doing this way is a bit fragile in the long term
but we have to do that as long as we want to override IWD's internal
autoconnect, which I guess we may be able to stop doing at some point.
2020-10-19 18:47:21 +02:00
Andrew Zaborowski
61e4b5a230
iwd: Don't auto-scan while waiting for secrets
IWD's Station.State property remains at "connect" or "disconnected"
while IWD is waiting for secrets for a new conncetion, so if we want to
scan only when NM might be in auto-connect (which was the goal) we need
to also look at NMDevice's state.  We want to scan whenever wifi is
disconnected and there's no active connection request, which is the same
as saying whever priv->current_ap is unset so for simplicity look at
priv->current_ap.  Also in schedule_periodic_scan() don't check whether
Station.State is "disconnected" because priv->can_scan is equivalent to
Station.State being one of ("disconnected", "connected").
2020-10-19 18:47:21 +02:00
Andrew Zaborowski
4f83960ff5
iwd: Hidden networks cleanup
Hidden networks are supported in the iwd backend since 1.24.0 but some
places in the code have not been updated to reflect this.

In check_connection_available copy the hidden network check and
corresponding comment from the wpa_supplicant backend.  In
act_stage1_prepare drop a straight "hidden networks are unsupported"
comment and a check -- fortunately this check happened to be ineffective
because @mode was more often NULL than NM_SETTING_WIRELESS_MODE_INFRA so
nm_streq0 was not enough.  Update comments elsewhere.

There's still one of two corner cases where the user-experience will not
be perfect for hidden networks due to iwd limitations, I'll try to work
around them in another commit.
2020-10-19 18:47:21 +02:00
Andrew Zaborowski
6c5068ee5a
iwd: Don't use nm_utils_error_set_literal with a non-literal
I first noticed a format string with missing parameters and then that
the compiler wasn't complaining and that's because
nm_utils_error_set_literal doesn't take a format string.
2020-10-19 18:47:20 +02:00
Andrew Zaborowski
6cf475e6db
iwd: Better checks before setting NO_SECRETS reason
When a connection fails and IWD returns net.connman.iwd.Aborted, we know
whether the abort is caused by us cancelling a secrets request so use
tha knowledge to decide whether to use the NM_DEVICE_STATE_REASON_NO_SECRETS
reason code for the state switch to NM_DEVICE_STATE_FAILED.
2020-10-19 18:47:20 +02:00
Andrew Zaborowski
b7d3e99a28
iwd: Drop IWD pre-1.0 and pre-0.8 compatiblity bits 2020-10-19 18:47:20 +02:00
Andrew Zaborowski
0d6911d529
iwd: Use the INCOMPATIBLE reason code for connection unavailable
Use the NM_UTILS_ERROR_CONNECTION_AVAILABLE_INCOMPATIBLE constant in
place of NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY more often in
check_connection_compatible as appropriate.
2020-10-19 18:34:58 +02:00
Thomas Haller
a9ffb5b73e
shared: enforce trailing semicolon after NM_UTILS_FLAGS2STR_DEFINE(),NM_UTILS_ENUM2STR_DEFINE() 2020-10-19 16:43:47 +02:00
Thomas Haller
81aebda558
libnm: add trailing comma after NM_UTILS_FLAGS2STR_DEFINE(nm_bluetooth_capability_to_string) 2020-10-19 16:43:30 +02:00
scootergrisen
2a021f2d26
po: update Danish (da) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/654
2020-10-19 09:11:32 +02:00
Thomas Haller
f0c2e35cfe
l3cfg: merge branch 'th/l3cfg-12'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/651
2020-10-13 13:49:07 +02:00
Thomas Haller
96c2aee186
l3cfg/tests: add unit tests for NML3Cfg 2020-10-13 13:46:07 +02:00
Thomas Haller
b8f9d7b5dd
l3cfg: rework ACD handling in NML3Cfg to support handling conflicts
Heavily rework NML3Cfg's ACD handling.

- the (user facing) API changed, so that we can ask the current ACD
  state of an address with nm_l3cfg_get_acd_addr_info(). So, the
  acd-event signal is only to notify when the state changes, it does
  not carry information that you couldn't fetch anytime.

- add clearer ACD states (NML3AcdAddrState). The current (ACD) state
  of an address is important and becomes part of the information that
  we expose.

- add new ACD state "USED", when ACD fails. This blocks the address from
  being used. Usually the caller would either remove the (used) address
  or force reconfigure it (by setting acd_timeout_msec to zero).

- add new ACD state "CONFLICT". Previously conflicts were not handled.
  Now the API allows to specify the defend policy. A conflicted address
  also gets blocked from being used.

- add new ACD state "EXTERNAL_REMOVED". This happens when we have an
  address we wanted to configure, but then the address is no longer
  on the interface. For example because the user removed it from the
  interface. This also leaves the device indefinitely blocked, and
  is important to stop announcing the address.

- add a new ACD state "READY". This indicates that the address is ready
  to be configured, but not yet actually configured on the device. This
  is the step before "DEFENDING".
2020-10-13 13:46:06 +02:00
Thomas Haller
79664aa106
l3cfg: handle flag "ip4acd_not_ready" for IPv4 addresses
ACD is handled by NML3Cfg and it intercepts the IP addresses when
merging the NML3ConfigData.

Originally, I thought that in such a case, the merged l3cd instance
would simply not contain any addresses that ACD have still pending or
which have a conflict.

However, I think it's better (clearer and possibly useful), to still
merge such addresses, but flag them that they are ignored when syncing
the addresses to platform.
2020-10-13 13:43:21 +02:00
Thomas Haller
e155e4a153
platform: add NMPlatformIP4Address.ip4acd_not_ready flag
It is not yet used, but it will be used to mark instances that
are not supposed to be configured in platform, because ACD is
either still pending of failed.
2020-10-13 13:39:01 +02:00
Thomas Haller
422294974c
platform: fix handlng of NMPlatformIP4Address.use_ip4_broadcast_address to be considered for hash/cmp functions
This is an important field. The hash/cmp function cannot just honor
nm_platform_ip4_broadcast_address_from_addr().
2020-10-13 13:39:01 +02:00
Thomas Haller
8b25e4ecfe
shared: add nm_g_ptr_array_ref() and similar helpers 2020-10-13 13:39:01 +02:00
Thomas Haller
28bbe2a798
shared,platform: take pointer to NMEtherAddr in NM_ETHER_ADDR_FORMAT_VAL() macro
It seems nicer to require a pointer than the plain struct.
2020-10-13 12:56:25 +02:00
Thomas Haller
6807774b7d
clang-format: mark "nm_platform_iter_obj_for_each()"/"nm_l3_config_data_iter_*()" as ForEachMacros 2020-10-13 12:56:25 +02:00
Beniamino Galvani
ae31b4bf4e wifi: set the BridgeIfname supplicant property when needed
When a wifi device is in a bridge, the supplicant must be aware of it,
as a socket must be opened on the bridge to receive packets.

Set the BridgeIfname property of the supplicant Interface object
before starting the association. Note that the property was read-only
in the past and recently [1] became read-write. When using a
supplicant version without the patch, writing the property will return
an InvalidArgs error and NetworkManager will print a warning.

[1] https://w1.fi/cgit/hostap/commit/?id=1c58317f56e312576b6872440f125f794e45f991

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/83
2020-10-13 08:59:10 +02:00
Thomas Haller
ef9510e30c
all: remove unneessary cases from nm_utils_strv_equal()/nm_utils_strv_cmp_n() 2020-10-12 22:21:11 +02:00
Thomas Haller
251ba8ea44
shared: automatically cast strv argument for nm_utils_strv_equal()/nm_utils_strv_cmp_n()
It's cumbersome if we always need to cast our arguments for
the strv helper functions. Depending on the situation, we often
have a "char **" or a "const char *const*" argument.

Use NM_CAST_STRV_CC() macros instead. This macro uses C11's _Generic()
and casts types that are presumed to be safe. This tends to be less
typing and more type-safe, because you don't need an explicit C cast
(which would overrule any warning that the compiler might have for you).
2020-10-12 22:20:01 +02:00
Thomas Haller
cbcfc58794
all/trivial: rename _nm_utils_strv_equal()/_nm_utils_strv_cmp_n() to have no leading underscore
The underscore somehow indicated that these would be an internal
function. Which they are in the sense that they are in "shared/nm-glib-aux/".
But they part of our internal helper functions, and in our code base
their use is no discouraged or "private.

Also, next I'll replace the function call with a macro, so, I will
have a need for the underscore name.

Rename.
2020-10-12 22:18:26 +02:00
Benjamin Berg
dc54a946ac
wifi: re-add code for tracking a peers groups
The code to track the property was accidentally removed in commit
21d4a26188 ('core: remove code for unused NM_WIFI_P2P_PEER_GROUPS property')
causing all P2P connections to fail after 5 seconds.

Fixes: 21d4a26188 ('core: remove code for unused NM_WIFI_P2P_PEER_GROUPS property')

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/650
2020-10-12 21:39:48 +02:00
Thomas Haller
3cf8620294
device/wifi: fix leak of NMSupplicantPeerInfo.peer_path in NMSupplicantInterface
Fixes: b83f07916a ('supplicant: large rework of wpa_supplicant handling')
2020-10-12 17:11:58 +02:00
Juliano de Souza Camargo
0fe92f40fc
po: update Portuguese (pt) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/648
2020-10-12 10:02:51 +02:00
Yuri Chornoivan
f660801a7b
po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/647
2020-10-12 09:58:22 +02:00
Beniamino Galvani
f91a8ef332 dns: add edns0 and trust-ad options when using local resolver
EDNS(0) is not enabled by default in glibc because the option has
interoperability issues with some DNS servers. dnsmasq and
systemd-resolved don't have such problems.

Enable the option automatically when using a local resolver so that
the data provided via EDNS(0) (e.g. SSH fingerprints or DNSSEC
information) is available to applications.

While at it, also enable 'trust-ad', as otherwise glibc (from version
2.31) strips the AD bit from responses [1].

systemd-resolved also adds both flags to resolv.conf when using the
stub resolver [2].

[1] https://sourceware.org/git/?p=glibc.git;a=blobdiff;f=NEWS;h=12b239c1fbbe789114e59fed136efcdeecc5c9cd;hp=4e28dc473c844ef230e973fc8861bfbd4bc36b74;hb=446997ff1433d33452b81dfa9e626b8dccf101a4;hpb=4a2ab5843a5cc4a5db1b3b79916a520ea8b115dc
[2] https://github.com/systemd/systemd/blob/v246/src/resolve/resolved-resolv-conf.c#L310

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/233
https://bugzilla.redhat.com/show_bug.cgi?id=1878166
2020-10-09 16:28:41 +02:00
Antonio Cardace
3093a0073b
initrd: merge branch 'ac/cmdline_reader_ipv6_off' into master
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/539
2020-10-09 16:19:22 +02:00
Antonio Cardace
8764d47af6
NEWS: update
Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-10-09 16:16:24 +02:00
Antonio Cardace
fc7c83cbdd
initrd: disable ipv6 when 'off|none' is set in the 'ip' option
This is potentially a breaking change, formerly speciyfing 'none|off'
in the kernel cmdline option 'ip' was understood by the dracut
network-module as doing 'ipv6.method=auto' which is clearly incosistent
with the 'off' naming, thus 'off|none' now means to actually disable
both ipv6 and ipv4 (unless a static ip is provided).

Unit test added.

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

Reverts: 440a0b4078 ('initrd: set ipv6.method=auto when the autoconfiguration field is 'none'')
Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-10-09 16:01:12 +02:00
Thomas Haller
96a3d664cb
contrib/checkpatch: complain about patch format with "Reverts:" tag 2020-10-09 15:55:48 +02:00
Thomas Haller
503fa9df7b
device: in NMDeviceVxlan let address_matches ensure the unused address is NULL
We should only either set addr4 or addr6, not both.
Let address_matches() check that the respective other
address is null/unspecified.
2020-10-09 13:23:16 +02:00
Thomas Haller
71f681814b
device: cleanup NMDeviceVxlan to use our NMIPAddr helpers 2020-10-09 13:20:56 +02:00
Thomas Haller
8cab6f151d
device: ensure unique counter for udi placeholder variable
- use a guint64 variable to avoid wrapping the counter

- cache the used ID in NMDevice. This way, the same NMDevice
  instance will get the same UDI path when it realizes
  and unrealizes multiple times.
2020-10-09 10:37:14 +02:00
Beniamino Galvani
bba1ab0f21 dns: merge branch 'bg/dns-vpn'
https://bugzilla.redhat.com/show_bug.cgi?id=1863041
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/631
2020-10-09 10:29:14 +02:00
Beniamino Galvani
af13081bec dns: change default DNS priority of VPNs to -50
Change the default DNS priority of VPNs to -50, to avoid leaking
queries out of full-tunnel VPNs.

This is a change in behavior. In particular:

 - when using dns=default (i.e. no split-dns) before this patch both
   VPN and the local name server were added (in this order) to
   resolv.conf; the result was that depending on resolv.conf options
   and resolver implementation, the name servers were tried in a
   certain manner which does not prevent DNS leaks.
   With this change, only the VPN name server is added to resolv.conf.

 - When using a split-dns plugin (systemd-resolved or dnsmasq), before
   this patch the full-tunnel VPN would get all queries except those
   ending in a local domain, that would instead be directed to the
   local server.
   After this patch, the VPN gets all queries.

To revert to the old behavior, set the DNS priority to 50 in the
connection profile.
2020-10-09 10:29:00 +02:00
Beniamino Galvani
cefd5ee322 dns: add wildcard domain to VPNs with never-default=no and no domains
If a VPN has never-default=no but doesn't get a default route (this
can happen for example when the server pushes routes with
openconnect), and there are no search domains, then the name servers
pushed by the server would be unused. It is preferable in this case to
use the VPN DNS server for all queries.

https://bugzilla.redhat.com/show_bug.cgi?id=1863041
2020-10-09 10:29:00 +02:00
Beniamino Galvani
9eba457426 core: add never-default field to NMIP{4,6}Config 2020-10-09 10:29:00 +02:00
Beniamino Galvani
e05550c34c dns: slightly refactor rebuild_domain_lists()
Centralize wildcard domain assignment in a single place.
2020-10-09 10:29:00 +02:00
Thomas Haller
4eb3b5b9dd
cli: fix showing active state for nmcli con show with fields
With "connection.multi-connect", a profile can be activated multiple
times on a device with `nmcli connection show`. Also, a profile may be
in the process of deactivating on one device, while activating on
another one. So, in general it's possible that `nmcli connection show`
lists the same profile on multiple lines (reflecting their multiple
activation states).

If the user requests no fields that are part of the activation state,
then the active connections are ignored. For example with `nmcli
-f UUID,NAME connection show`. In that case, each profile is listed only
once.

On the other hand, with `nmcli -g UUID,NAME,DEVICE connection show` the
user again requested also to see the activation state, and a profile can
appear multiple times.

To handle that, we need to consider which fields were requested.

There was a bug where the "ACTIVE" field was not treated as part of the
activation state. That results in `nmcli -f UUID,NAME,ACTIVE connection
show` always returning "no". Fix that.

Fixes: a1b25a47b0 ('cli: rework printing of `nmcli connection` for multiple active connections')

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/642
2020-10-09 10:23:23 +02:00
Thomas Haller
4eb8491a38
cli: merge branch 'th/cli-cleanup-set-color'
https://bugzilla.redhat.com/show_bug.cgi?id=1886336

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/641
2020-10-09 09:54:15 +02:00