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
'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
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>
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>
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
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.
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.
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.
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
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.
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
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
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>
"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.
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.
"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).
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.
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.