Commit graph

661 commits

Author SHA1 Message Date
Thomas Haller
a5f7f89b04
dhcp: use NM_STR_HAS_PREFIX() instead of strncmp() 2022-01-18 16:22:12 +01:00
Thomas Haller
9a8c23879a
all: don't use strlen() to check whether string is empty/non-empty 2022-01-18 16:22:12 +01:00
Beniamino Galvani
ae28d2251a core: set force-commit flag for generated routes
The force-commit flag is used to force the commit of an address or a
route from DHCP/RA even when it was removed from platform externally
(for example because it expired). Routes generated from the l3cd
should also have the flag set.

Without this, NM properly re-adds the DHCP address after the lease is
lost and obtained again, but fails to add the prefix-route.

Fixes: 2838b1c5e8 ('core: track force-commit flag for l3cd and platform objects')

https://bugzilla.redhat.com/show_bug.cgi?id=2033991
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1049
2022-01-12 15:01:42 +01:00
Lubomir Rintel
3e12c6ff81 ipv4ll: fix assert on external LL address removal
Consider externally removed IPv4LL bad, proceed as if a collision was
detected. Otherwise we trip an assert:

  <trace> [1641816260.3963] l3cfg[b8bf8cd16ec4732e,ifindex=47]: emit signal (platform-change-on-idle, obj-type-flags=0x14)
  **
  nm:ERROR:src/core/nm-l3-ipv4ll.c:888:_ipv4ll_state_change: code should not be reached
  Aborted (core dumped)

  #3  0x00007f41621d020e in g_assertion_message_expr (domain=domain@entry=0x5559cd829140 "nm",
      file=file@entry=0x5559cd823e51 "src/core/nm-l3-ipv4ll.c",
      line=line@entry=888, func=func@entry=0x5559cd824d30 <__func__.38810> "_ipv4ll_state_change",
      expr=expr@entry=0x0) at gtestutils.c:2556
  #4  0x00005559cd719686 in _ipv4ll_state_change (self=0x5559cef886c0,
      is_on_idle_handler=0) at src/core/nm-l3-ipv4ll.c:888
  #8  0x00007f41626a5093 in <emit signal ??? on instance 0x5559ceffaa30 [NML3Cfg]>
      (instance=instance@entry=0x5559ceffaa30, signal_id=<optimized out>,
       detail=detail@entry=0) at gsignal.c:3448
  #9  0x00005559cd511a03 in _nm_l3cfg_emit_signal_notify
      (self=self@entry=0x5559ceffaa30 [NML3Cfg], notify_data=notify_data@entry=0x7ffd1caa8640)
      at src/core/nm-l3cfg.c:576
  #10 0x00005559cd5122dc in _nm_l3cfg_emit_signal_notify_acd_event (self=0x5559ceffaa30 [NML3Cfg],
      acd_data=<optimized out>) at src/core/nm-l3cfg.c:2008
  #11 0x00005559cd512463 in _nm_l3cfg_emit_signal_notify_acd_event_all
      (self=0x5559ceffaa30 [NML3Cfg]) at src/core/nm-l3cfg.c:2041
  #12 0x00005559cd5194ef in _l3_acd_nacd_event (fd=<optimized out>, condition=<optimized out>,
      user_data=<optimized out>) at src/core/nm-l3cfg.c:1536
  #13 0x00007f41621a895d in g_main_dispatch (context=0x5559ceec8bc0) at gmain.c:3193
  #14 0x00007f41621a895d in g_main_context_dispatch (context=context@entry=0x5559ceec8bc0)
      at gmain.c:3873
  #15 0x00007f41621a8d18 in g_main_context_iterate (context=0x5559ceec8bc0, block=block@entry=1,
      dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3946
  #16 0x00007f41621a9042 in g_main_loop_run (loop=0x5559ceea40f0) at gmain.c:4142
  #17 0x00005559cd47c7a4 in main (argc=<optimized out>, argv=<optimized out>)
      at src/core/main.c:511

https://bugzilla.redhat.com/show_bug.cgi?id=2028404
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1059
2022-01-12 14:58:29 +01:00
Beniamino Galvani
d68ab6b8f0 nm-sudo: rename to nm-priv-helper
The name "nm-sudo" reminds of the "sudo" tool, and this is a bit
confusing because it's not related. Rename the service to
"nm-priv-helper", which stands for "NM privileged helper".

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/938
2022-01-11 21:46:55 +01:00
Beniamino Galvani
9f3d2a09ea supplicant: enable SAE-H2E
H2E (hash to element) is a newer method for generating the PWE
(password element) for SAE, alternative to the existing
"hunting-and-pecking". It is considered more secure and it is
mandatory for the WPA3 certification; also, SAE in the 6GHz band can
only use H2E (hunting-and-pecking is disallowed).

Enable H2E in addition to hunting-and-pecking.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/753
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1045
2022-01-11 21:39:04 +01:00
Lubomir Rintel
5f0ddaa610 Revert "nm-device: avoid starting ac6 if l3cfg is not there"
This reverts commit bb0a31e6eb.

This was pushed by accident.
2022-01-11 14:57:48 +01:00
Lubomir Rintel
fccb5608f3 nm-device: clean up IP methods if we lose ifindex
If the ovs interface goes away, the ifindex gets zeroed out and l3cfg is
cleaned. We can't follow up with IP configuration. Bad things happen if
we try to:

  #0  0x00007f769734c895 in _g_log_abort (breakpoint=1) at gmessages.c:580
  #1  0x00007f769734db98 in g_logv (log_domain=0x55b2472d8840 "nm",
        log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>,
        args=args@entry=0x7fff4041b9d0) at gmessages.c:1391
  #2  0x00007f769734dd63 in g_log (log_domain=log_domain@entry=0x55b2472d8840 "nm",
        log_level=log_level@entry=G_LOG_LEVEL_CRITICAL,
        format=format@entry=0x7f769739a620 "%s: assertion '%s' failed") at gmessages.c:1432
  #3  0x00007f769734e59d in g_return_if_fail_warning
      (log_domain=log_domain@entry=0x55b2472d8840 "nm",
        pretty_function=pretty_function@entry=0x55b2472d5fe0 <__func__.39677> "nm_lndp_ndisc_new",
        expression=expression@entry=0x55b2472d5fa3 "NM_IS_L3CFG(config->l3cfg)")
        at gmessages.c:2809
  #4  0x000055b2471ce3fa in nm_lndp_ndisc_new (config=config@entry=0x7fff4041bb30)
        at src/core/ndisc/nm-lndp-ndisc.c:680
  #5  0x000055b247123b32 in _dev_ipac6_start (self=self@entry=0x55b248078360 [NMDeviceOvsInterface])
        at src/core/devices/nm-device.c:11287
  #6  0x000055b2471232f8 in _dev_ipac6_start_continue (self=0x55b248078360 [NMDeviceOvsInterface])
        at src/core/devices/nm-device.c:11338
  #7  0x000055b2471232f8 in _dev_ipll6_set_llstate (self=0x55b248078360 [NMDeviceOvsInterface],
        llstate=<optimized out>, lladdr=<optimized out>) at src/core/devices/nm-device.c:10541
  #8  0x000055b2471c9e8b in _emit_changed_on_idle_cb (user_data=user_data@entry=0x55b24807bdd0)
        at src/core/nm-l3-ipv6ll.c:221
  #9  0x00007f769734327b in g_idle_dispatch (source=0x55b248119200,
        callback=0x55b2471c9ce0 <_emit_changed_on_idle_cb>,
        user_data=0x55b24807bdd0) at gmain.c:5579
  #10 0x00007f769734695d in g_main_dispatch (context=0x55b247f56bc0) at gmain.c:3193
  #11 0x00007f769734695d in g_main_context_dispatch (context=context@entry=0x55b247f56bc0)
        at gmain.c:3873
  #12 0x00007f7697346d18 in g_main_context_iterate (context=0x55b247f56bc0,
        block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3946
  #13 0x00007f7697347042 in g_main_loop_run (loop=0x55b247f320f0) at gmain.c:4142
  #14 0x000055b246f26b64 in main (argc=<optimized out>,
        argv=<optimized out>) at src/core/main.c:511

https://bugzilla.redhat.com/show_bug.cgi?id=2012934
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1044

Fixes-test: @ovs_cloned_mac_set_on_iface
2022-01-11 14:55:38 +01:00
Lubomir Rintel
bb0a31e6eb nm-device: avoid starting ac6 if l3cfg is not there
If the ovs interface goes away, the ifindex gets zeroed out and l3cfg is
cleaned. Avoid starting ac6 in that case -- add checks similar to what
we do for ll6.

Bad things happen otherwise:

  #0  0x00007f769734c895 in _g_log_abort (breakpoint=1) at gmessages.c:580
  #1  0x00007f769734db98 in g_logv (log_domain=0x55b2472d8840 "nm",
        log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>,
        args=args@entry=0x7fff4041b9d0) at gmessages.c:1391
  #2  0x00007f769734dd63 in g_log (log_domain=log_domain@entry=0x55b2472d8840 "nm",
        log_level=log_level@entry=G_LOG_LEVEL_CRITICAL,
        format=format@entry=0x7f769739a620 "%s: assertion '%s' failed") at gmessages.c:1432
  #3  0x00007f769734e59d in g_return_if_fail_warning
      (log_domain=log_domain@entry=0x55b2472d8840 "nm",
        pretty_function=pretty_function@entry=0x55b2472d5fe0 <__func__.39677> "nm_lndp_ndisc_new",
        expression=expression@entry=0x55b2472d5fa3 "NM_IS_L3CFG(config->l3cfg)")
        at gmessages.c:2809
  #4  0x000055b2471ce3fa in nm_lndp_ndisc_new (config=config@entry=0x7fff4041bb30)
        at src/core/ndisc/nm-lndp-ndisc.c:680
  #5  0x000055b247123b32 in _dev_ipac6_start (self=self@entry=0x55b248078360 [NMDeviceOvsInterface])
        at src/core/devices/nm-device.c:11287
  #6  0x000055b2471232f8 in _dev_ipac6_start_continue (self=0x55b248078360 [NMDeviceOvsInterface])
        at src/core/devices/nm-device.c:11338
  #7  0x000055b2471232f8 in _dev_ipll6_set_llstate (self=0x55b248078360 [NMDeviceOvsInterface],
        llstate=<optimized out>, lladdr=<optimized out>) at src/core/devices/nm-device.c:10541
  #8  0x000055b2471c9e8b in _emit_changed_on_idle_cb (user_data=user_data@entry=0x55b24807bdd0)
        at src/core/nm-l3-ipv6ll.c:221
  #9  0x00007f769734327b in g_idle_dispatch (source=0x55b248119200,
        callback=0x55b2471c9ce0 <_emit_changed_on_idle_cb>,
        user_data=0x55b24807bdd0) at gmain.c:5579
  #10 0x00007f769734695d in g_main_dispatch (context=0x55b247f56bc0) at gmain.c:3193
  #11 0x00007f769734695d in g_main_context_dispatch (context=context@entry=0x55b247f56bc0)
        at gmain.c:3873
  #12 0x00007f7697346d18 in g_main_context_iterate (context=0x55b247f56bc0,
        block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3946
  #13 0x00007f7697347042 in g_main_loop_run (loop=0x55b247f320f0) at gmain.c:4142
  #14 0x000055b246f26b64 in main (argc=<optimized out>,
        argv=<optimized out>) at src/core/main.c:511
2022-01-11 14:53:26 +01:00
Thomas Haller
d5f917e702
bluetooth: fix invalid assertion in NMBluezManager:dispose()
We need to first free "priv->bzobjs", which then will unlink all bzobjs
from the lists. The assert needs to go after.

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

Fixes: 4154d9618c ('bluetooth: refactor BlueZ handling and let NMBluezManager cache ObjectManager data')
2022-01-11 10:10:35 +01:00
Ana Cabral
74c08c7084 openvswitch: Add ovs-dpdk n_rxq property
https://bugzilla.redhat.com/show_bug.cgi?id=2001563
2022-01-10 22:48:30 +00:00
Ana Cabral
f0cb75f669 trivial: fix typos 2022-01-10 22:48:30 +00:00
Ana Cabral
d6395f7ee7 core/ovs: fix setting dpdk-devargs JSON to NULL
NMSettingOvsDpdk does not have a verify() implementation that would prevent
the devargs property from being NULL. We must thus anticipate and handle
a NULL value.

Fixes: ae4152120a ('ovs/ovsdb: add support for setting dpdk devargs option')
2022-01-10 22:48:30 +00:00
Thomas Haller
20eb6df215
core: simplify code in nm_dns_manager_set_hostname() 2022-01-10 20:43:18 +01:00
Thomas Haller
bbff0c9853
core: ensure static-hostname is valid UTF-8
We get the hostname via D-Bus (from hostnamed) or read it from file.
In the latter case, it is not ensured that it's valid UTF-8.
Non-UTF-8 "strings" are bad, because we might try to expose them
on D-Bus, log them or other bad things.

Sanitize the string by using backslash escaping. Maybe we should
outright reject such binary nonsense, but it's not done here,
for no strong reasons.
2022-01-10 20:43:17 +01:00
Thomas Haller
a352647434
core: rename related things explicitly to "static-hostname"
We have at least static and transient hostnames. Let's be clear which
one we are talking about.

Note that also NM_SETTINGS_HOSTNAME gets renamed to
NM_SETTINGS_STATIC_HOSTNAME, because it seems clearer.
The only purpose of NM_SETTINGS_STATIC_HOSTNAME is to be the backing
property for the "Hostname" D-Bus property for the NMDBusObject glue.
So, while the new name makes more sense to me, it's now also
inconsistent with it's primary use (the D-Bus property). Still...
2022-01-10 20:43:17 +01:00
James Hilliard
edc37b3adf
build: allow configuring default for wifi.backend setting
Distributions may want to change the default wifi.backend, if for
example they are building without wpa_supplicant support.

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1040
2022-01-04 06:41:37 +01:00
Beniamino Galvani
298d0b961f
core: log variant properties in connection diff
Properly print properties containing a GVariant (as those backed by
a gendata hashtable).

For example, before:

 ++ ethtool.ring-rx-mini      = ???

After:

 ++ ethtool.ring-rx-mini      = 0

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1051
2022-01-03 09:51:49 +01:00
Wen Liang
87674740d8 core: don't reset assume state if the device is unmanaged by parent
When the device gets realized, similar to the situation that the device
 is unmanaged by platform-init, if the device is still unmanaged by
parent and we clear the assume state. Then, when the device becomes
managed, NM is not able to properly assume the device using the UUID.

Therefore, we should not clear the assume state if the device has only
the NM_UNMANAGED_PLATFORM_INIT or the NM_UNMANAGED_PARENT flag set
in the unmanaged flags.

The previous commit 3c4450aa4d ('core: don't reset assume state too
early') did something similar for NM_UNMANAGED_PLATFORM_INIT flag only.
2021-12-20 10:28:40 -05:00
Beniamino Galvani
02de04287f device: fix update of the ip-iface property
Before the l3cfg rework, the ip-iface property was exported only for
interfaces with an ifindex, and only in some device states.

Restore the old behavior since it is part of the API. For example,
firewalld uses the property to tell which interfaces have a ifindex.

Fixes: 58287cbcc0 ('core: rework IP configuration in NetworkManager using layer 3 configuration')

https://bugzilla.redhat.com/show_bug.cgi?id=2026024
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1042
2021-12-09 15:37:44 +01:00
Lubomir Rintel
af1903fe3f nm-device: prefer manually configured addresses to automatic
This bumps L3_CONFIG_DATA_TYPE_MANUALIP to be the most important address
source; which is what had been the case before NetworkManager/next and
is presumably what the user expects.

It also comes into play for iBFT-booted machines, where iBFT contains a
permanent address (no lifetime data), while DHCP might lease out the
same one. In that case, expiry of the latter could potentially disrupt
connectivity to a vital storage volume.

Fixes: 14962cb414 ('merge: branch 'next''):

https://bugzilla.redhat.com/show_bug.cgi?id=2013921
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1011
2021-12-01 15:04:16 +01:00
Beniamino Galvani
7f8c8078a1 dhcp: accept IPv4-address options longer than expected
Some DHCP servers send duplicate options, and we concatenate them
according to RFC 3396 section 7. Therefore, it's possible that a
option carrying a IPv4 address has a length > 4.

See also commit 1cbf9d22a5 ('n-dhcp4: accept options that are longer
than requested') which did something similar in the nettools client.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/848
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1034
2021-11-29 10:44:17 +01:00
Beniamino Galvani
9a76b07f74 l3cfg: fix assertion failure
Fix the following assertion failure:

  src/core/nm-l3cfg.c:2636:_l3_acd_data_state_change: assertion failed: (!acd_data->nacd_probe)

When AcdData enters state NM_L3_ACD_ADDR_STATE_READY, the duplicate
address detection procedure completed successfully but the address is
not configured yet on the interface. In the READY state we don't clear
the probe because the same probe can be reused also for defending the
address. Change the assertion.

https://bugzilla.redhat.com/show_bug.cgi?id=2026288
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1035
2021-11-29 10:38:15 +01:00
Thomas Haller
615221a99c format: reformat source tree with clang-format 13.0
We use clang-format for automatic formatting of our source files.
Since clang-format is actively maintained software, the actual
formatting depends on the used version of clang-format. That is
unfortunate and painful, but really unavoidable unless clang-format
would be strictly bug-compatible.

So the version that we must use is from the current Fedora release, which
is also tested by our gitlab-ci. Previously, we were using Fedora 34 with
clang-tools-extra-12.0.1-1.fc34.x86_64.

As Fedora 35 comes along, we need to update our formatting as Fedora 35
comes with version "13.0.0~rc1-1.fc35".
An alternative would be to freeze on version 12, but that has different
problems (like, it's cumbersome to rebuild clang 12 on Fedora 35 and it
would be cumbersome for our developers which are on Fedora 35 to use a
clang that they cannot easily install).

The (differently painful) solution is to reformat from time to time, as we
switch to a new Fedora (and thus clang) version.
Usually we would expect that such a reformatting brings minor changes.
But this time, the changes are huge. That is mentioned in the release
notes [1] as

  Makes PointerAligment: Right working with AlignConsecutiveDeclarations. (Fixes https://llvm.org/PR27353)

[1] https://releases.llvm.org/13.0.0/tools/clang/docs/ReleaseNotes.html#clang-format
2021-11-29 09:31:09 +00:00
Fernando Fernandez Mancera
e44cdc7981 ovsdb: deactivate removed device if does not have a master
When using OVS link aggregation ports, NetworkManager ovsdb is removing
the ports when cleaning it up. If that happens, it should deactivate the
device even if it does not have controller or the state is not
assume/external.

An interface that is port of the OVS bonding can be activated before the
ovsdb clean up, if it is not deactivated then NetworkManager will finish
with a wrong configuration. The 'ovsdb_device_removed()' is already
checking that the device is "ovs-interface" with subtype "system".
2021-11-28 20:34:38 +01:00
Fernando Fernandez Mancera
4549995052 bridge: allow ageing_time option to be zero
If the user wants to disable MAC ageing on the bridge, they need to set
ageing_time to zero.

https://bugzilla.redhat.com/show_bug.cgi?id=1871950
2021-11-26 10:20:01 +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
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
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