Commit graph

29425 commits

Author SHA1 Message Date
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
Ana Cabral
d534170b21 release: bump version to 1.33.90 (1.34-rc1) 2021-11-18 15:58:22 +01:00
Ana Cabral
c65815bf27 NEWS: update 2021-11-18 15:50:20 +01:00
Ana Cabral
24689d0bf1 Merge branch 'ac/rhel7.9test' into 'main'
spec: Update for backwards compatibility

See merge request NetworkManager/NetworkManager!1024
2021-11-17 10:05:25 +00:00
Ana Cabral
8b697c2e36 spec: Update for backwards compatibility 2021-11-15 09:44:06 +00:00
Lubomir Rintel
3bc14e3e88 merge: branch 'lr/pc'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1012
2021-11-15 09:28:46 +01:00
Thomas Haller
1d13d7a900
libnm: merge branch 'th/libnm-settings-properties'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1002
2021-11-12 16:22:01 +01:00
Thomas Haller
04b4982d3c
libnm: refactor some NMSetting to use direct properties
"direct" properties are the latest preferred way to implement GObject
base properties. That way, the property meta data tracks the
"direct_type" and the offset where to find the data in the struct.

That way, we can automatically

- initialize the default values
- free during finalize
- implement get_property()/set_property()

Also, the other settings operations (compare, to/from D-Bus) are
implemented more efficiently and don't need to go through
g_object_get_property()/GValue API.
2021-11-08 22:23:16 +01:00
Thomas Haller
989a6911ba
libnm: always finalize direct properties in NMSetting base class
Certain properties need to release memory when destroying the NMSetting.
For "direct" properties, we have all the information we need to do that
generically in the NMSetting base class. In practice, this only concerns
string properties.

See _finalize_direct() in "nm-setting.c".

However, if the NMSetting base class takes care of freeing the strings,
then the subclasses must not also unref the variable (to avoid double free).
Previously, subclasses had to opt-in for the base class to indicate that
they are fine with that.

Now, let the base class always handle it. We only need to make sure that
classes that implement direct string properties don't also try to free
the values during destruction.
2021-11-04 20:25:19 +01:00
Thomas Haller
2aa1fdd2bf
libnm: add direct property type "bytes" 2021-11-04 20:25:19 +01:00
Thomas Haller
37967ad717
libnm: add direct property type "enum" 2021-11-04 20:25:19 +01:00
Thomas Haller
1059b60873
libnm: add direct property type "uint64" 2021-11-04 20:25:19 +01:00
Thomas Haller
093f434cd0
libnm: add direct property type "flags"
"flags" are a g_param_spec_flags() and correspond to G_TYPE_FLAGS type.
They are internally stored as guint, and exported on D-Bus as "u" (32 bit
integer).
2021-11-04 20:25:19 +01:00
Thomas Haller
3e6c18e9af
checkpatch: suggest to use _nm_setting_property_define_direct_*() for setting properties
We have multiple ways to define properties (like, GVariant based
nm_setting_option_*() or GObject based properties). For the latter,
they nowadays should all be implemented via _nm_setting_property_define_direct_*()
API.
2021-11-04 20:25:19 +01:00
Thomas Haller
aeb2426e88
libnm: change default value for "dcb.app-fcoe-mode" property
String properties in libnm's NMSetting really should have NULL as a
default value. The only property that didn't, was "dcb.app-fcoe-mode".

Change the default so that it is also NULL.

Changing a default value is an API change, but in this case probably no
issue. For one, DCB is little used. But also, it's not clear who would
care and notice the change. Also, because previously verify() would reject
a NULL value as invalid. That means, there are no existing, valid profiles
that have this value set to NULL.  We just make NULL the default, and
define that it means the same as "fabric".

Note that when we convert integer properties to D-Bus/GVariant, we often
omit the default value. For string properties, they are serialized as
"s" variant type. As such, NULL cannot be expressed as "s" type, so we
represent NULL by omitting the property. That makes especially sense if
the default value is also NULL. Otherwise, it's rather odd. We change
that, and we will now always express non-NULL value on D-Bus and let
NULL be encoded by omitting the property.
2021-11-04 20:25:18 +01:00
Thomas Haller
38d81cfa89
ifcfg: always read/write KEY_DCB_APP_FCOE_MODE key
The settings plugin is not supposed to normalize the profile. It should
read/write what is, and let NMConnection handle what is valid and what
needs normalization.
2021-11-04 20:25:18 +01:00
Thomas Haller
d805b9ae51
libnm/tests: always check expected default value for string properties in test_setting_metadata() 2021-11-04 20:25:18 +01:00
Thomas Haller
572ce7b7a7
glib-aux/trivial: rename GBytes helper API
Give a consistent name.

A bit odd are now the names nm_g_bytes_hash() and nm_g_bytes_equal()
as they go together with nm_pg_bytes_hash()/nm_pg_bytes_equal().
But here the problem is more with the naming of "nm_p*_{equal,hash}()"
functions, which probably should be renamed to "nm_*_ptr_{equal,hash}()".
2021-11-04 20:25:18 +01:00
Thomas Haller
9876623363
glib-aux: add nm_g_bytes_new_from_variant_ay() helper 2021-11-04 20:25:18 +01:00
Thomas Haller
974bf61428
glib-aux: make GBytes parameter const for read-only helper functions 2021-11-04 20:25:18 +01:00