Commit graph

29444 commits

Author SHA1 Message Date
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
Wen Liang
81ac02ae75 core: clear sticky update flag when unmanaging a device
Sticky update flag forces a commit at UPDATE level after unmanaging
a device. As a result, all the link local addresses will be removed.
To prevent the commit after unmanaging a device, clear sticky update
flag.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2021-11-18 16:21:34 +01:00
Beniamino Galvani
655896f75b device: set ipv6 privacy in the the ipmanual l3cd
In this way, the ipv6 privacy setting is committed as soon as the
connection goes up.

Fixes-test: @ipv6_ip6-default_privacy
2021-11-18 16:21:34 +01:00
Beniamino Galvani
3a0eb586b8 device: don't reset addrgenmode for assumed devices
If we reset the addrgenmode, IPv6 addresses are lost.
2021-11-18 16:21:33 +01:00
Beniamino Galvani
cd65351d29 device: fix _dev_addrgenmode6_set()
If addrgenmode=0 is already set, the function should still toggle
disable_ipv6 if needed, to stop the generation of temporary addresses.

Also, it should store the last set value into 'previous_mode_val'.

Fixes-test: @ipv6_keep_external_routes
2021-11-18 16:21:33 +01:00
Beniamino Galvani
bd7b5aa707 device: don't disable IPv6 when NM is managing IPv6
If NM set addrgenmode=none, it's because it manages the IPv6 in user
space. In such case it should never disable IPv6.
2021-11-18 16:21:33 +01:00
Beniamino Galvani
a319193333 device: fix optional 802.1X authentication
If the authentication is optional, we are going to re-enter stage2. Set
the "ready" variable so that we can return success immediately and
skip to stage3.
2021-11-18 16:21:33 +01:00
Beniamino Galvani
de5e1eb9e5 device: don't fail immediately on DHCP expiry
If we had a lease and it expired, don't fail immediately. The client
will try to obtain a new lease and it will send a NO_LEASE_TIMEOUT
event once it fails. Only at that time we should fail.
2021-11-18 16:21:33 +01:00
Fernando Fernandez Mancera
e9bd8b3dac device: fix wrong assignment in ip_state_other comparison
Fixes: 0b05c5adb4b0 ('device: fail when a addr family fails and the other is disabled')
2021-11-18 16:21:33 +01:00
Beniamino Galvani
70676b3d0a l3cfg: set ipv6 token
Fixes-test: @ipv6_token
2021-11-18 16:21:33 +01:00
Beniamino Galvani
d2fc0984a1 l3cd: add ipv6 token 2021-11-18 16:21:33 +01:00
Thomas Haller
682d2c842a core: drop redundant "gateway" variable for NMIPConfig
The "gateway" variable was redundant to best_default_route. It was
somewhat convenient to have, because the best_default_route pointer
might change, but the next hop might still be the same. So it was easy
to track whether it changes.

But it's also redundant information. By relying on best_default_route
alone we have all the information we need.
2021-11-18 16:21:32 +01:00
Thomas Haller
7faeda8351 platform: accept %NULL route as parameter to nm_platform_ip_route_get_gateway()
It's sometimes convenient to accept %NULL and have a "maybe type" like
behavior to propagate the %NULL input of the getter.
2021-11-18 16:21:32 +01:00
Beniamino Galvani
bcf31a9b29 device: fix assertion failure on master carrier change
Fix the following assertion failure:

 "nm_assert(NM_DEVICE_GET_PRIVATE(self)->act_request.obj);"

  0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
  1  __GI_abort () at abort.c:79
  2  g_assertion_message () at gtestutils.c:2533
  3  g_assertion_message_expr () at gtestutils.c:2556
  4  activation_source_invoke_or_schedule (self=0x55b543884610 [NMDeviceBridge], func=0x55b542e8c940 <activate_stage3_ip_config>, do_sync=0) at src/core/devices/nm-device.c:8854
  5  nm_device_set_carrier (self=0x55b543884610 [NMDeviceBridge], carrier=1) at src/core/devices/nm-device.c:6217
  6  device_link_changed (user_data=user_data@entry=0x55b543884610) at src/core/devices/nm-device.c:6479
  7  g_idle_dispatch (source=0x55b5438577d0, callback=0x55b542e95980 <device_link_changed>, user_data=0x55b543884610) at gmain.c:5579
  8  g_main_dispatch (context=0x55b543719bc0) at gmain.c:3193
  9  g_main_context_dispatch (context=context@entry=0x55b543719bc0) at gmain.c:3873
  10 g_main_context_iterate (context=0x55b543719bc0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3946
2021-11-18 16:21:32 +01:00
Beniamino Galvani
cc3ec40513 device: fail when a addr family fails and the other is disabled
Fixes-test: @ipv4_method_shared_with_already_running_dnsmasq
2021-11-18 16:21:32 +01:00
Beniamino Galvani
8f8e912e3b core: also export 0.0.0.0 as gateway in IP configuration
The IP configuration exported over D-Bus for a device has a "gateway"
property. If the device has a default route without a gateway, before
the L3 rework the gateway used to be exported as "0.0.0.0". That seems
useful to indicate that the device has a default route, but without
a next hop. Restore that behavior.

Fixes-test: @preserve_route_to_generic_device
2021-11-18 16:21:32 +01:00
Beniamino Galvani
c4238620d3 glib-aux: accept NULL addresses in nm_ip_addr_equal()
nm_ether_addr_equal() already accepts NULL addresses and makes a
distinction between NULL and a zero address.

Introduce a similar behavior for nm_ip_addr_equal(), as it's useful in
some cases.
2021-11-18 16:21:32 +01:00
Beniamino Galvani
9380d3c715 device: fix waiting for IPv6 autoconf addresses
When NM is restarted and the previous connection gets assumed,
addresses are already configured; in such case we don't need to wait.
2021-11-18 16:21:32 +01:00
Beniamino Galvani
a2d96a5c2e vlan: preserve external IP changes on parent MAC update
When the parent MAC is updated, a VLAN device also updates its MAC and
then performs a new commit to restore IP configuration. This should
not remove addresses added externally. Change the commit type to
UPDATE.

Fixes-test: @static_route_persists_mac_change
2021-11-18 16:21:32 +01:00
Beniamino Galvani
96850933bb core: ignore external routes when generating connections 2021-11-18 16:21:32 +01:00
Beniamino Galvani
d8d6ecf37a l3cfg: remove event down source on finalize 2021-11-18 16:21:32 +01:00
Beniamino Galvani
8fb8e334b8 device: wait that IPv6 autoconf addresses become non-tentative
Fixes-test: @ipv6_preserve_cached_routes
2021-11-18 16:21:32 +01:00
Beniamino Galvani
98da62642b device: enable IPv6 in ip6_managed_setup()
IPv6 must be enabled when the device enters the DISCONNECTED state.
2021-11-18 16:21:31 +01:00
Beniamino Galvani
b86388bef3 core: avoid stale entries in the DNS manager
When a virtual interface is removed externally, the device is
unrealized and the ifindex is cleared; this also detaches the existing
l3cfg from the device. At this point the l3cd entry for the device
lingers forever in the DNS manager.

Emit a last L3CD_CHANGED so that the old entry gets removed.

Fixes-test: @disconnect_from_pppoe
2021-11-18 16:21:31 +01:00
Beniamino Galvani
443c380f29 core: update hostname when addresses on platform change 2021-11-18 16:21:31 +01:00
Beniamino Galvani
c7ecaeb103 device: prefer non-LL and non-deprecated IPv6 address for hostname 2021-11-18 16:21:31 +01:00
Beniamino Galvani
a1de041184 device: reschedule a assume check after platform changes 2021-11-18 16:21:31 +01:00
Beniamino Galvani
36a97ad9ec device: set up IPv6 before start manual method 2021-11-18 16:21:31 +01:00
Beniamino Galvani
e5d28be022 wwan: don't start generic IP configuration methods for NMDeviceModem 2021-11-18 16:21:31 +01:00
Beniamino Galvani
92e1b6650c wwan: fix signal definition 2021-11-18 16:21:31 +01:00
Beniamino Galvani
63ae9cd035 wwan: schedule stage2 when ppp-mgr gets an ifindex 2021-11-18 16:21:31 +01:00
Beniamino Galvani
8d40d03a2c dhcp: honor the send_hostname property 2021-11-18 16:21:31 +01:00
Beniamino Galvani
32443ef3b5 dns: fix assertion failure
nm_l3_config_data_get_searches() and nm_l3_config_data_get_domains()
require an 'out_len' argument.
2021-11-18 16:21:30 +01:00
Beniamino Galvani
e9c17fcc9b l3cfg: default to 'main' route table sync mode
If no l3cd specifies a route table sync mode, use 'main' as default.

Fixes-test: @ipv6_route_set_route_with_tables_reapply
2021-11-18 16:21:30 +01:00
Beniamino Galvani
23d61367b3 core: set the route table for the ipv6 link-local method
Previously the prefix route fe80::/64 was always added to the main
table.

Fixes-test: @ipv6_route_set_route_with_tables
2021-11-18 16:21:30 +01:00
Beniamino Galvani
e732cb9a70 device: clear shared4 l3cd on disconnect
Fixes-test: @vlan_connection_down_with_autoconnect
Fixes-test: @vlan_disconnect_device_with_autoconnect
2021-11-18 16:21:30 +01:00
Thomas Haller
58287cbcc0 core: rework IP configuration in NetworkManager using layer 3 configuration
Completely rework IP configuration in the daemon. Use NML3Cfg as layer 3
manager for the IP configuration of an interface. Use NML3ConfigData as
pieces of configuration that the various components collect and
configure. NMDevice is managing most of the IP configuration at a higher
level, that is, it starts DHCP and other IP methods. Rework the state
handling there.

This is a huge rework of how NetworkManager daemon handles IP
configuration. Some fallout is to be expected.

It appears the patch deletes many lines of code. That is not accurate, because
you also have to count the files `src/core/nm-l3*`, which were unused previously.

Co-authored-by: Beniamino Galvani <bgalvani@redhat.com>
2021-11-18 16:21:29 +01:00
Ana Cabral
403acb1f80 release: bump version to 1.35.0 (development) 2021-11-18 16:04:42 +01:00