Commit graph

1059 commits

Author SHA1 Message Date
Thomas Haller
56a503c879
firewall: introduce helper function for add/flush/delete nft table command
(cherry picked from commit e796a67d6c)
2022-09-29 15:15:40 +02:00
Thomas Haller
d7bc25b3bd
firewall: fail from nm_firewall_nft_call() on non-zero exit code
(cherry picked from commit 02feefb1df)
2022-09-29 15:15:40 +02:00
Thomas Haller
6af0233a21
device: allow resetting the devip state via nm_device_devip_set_state()
There is no reason to disallow resetting the state.

(cherry picked from commit 607a9544cb)
2022-09-29 15:15:39 +02:00
Thomas Haller
46e3c23d85
bond: use _nm_setting_bond_opt_value_as_intbool() in _platform_lnk_bond_init_from_setting()
Previously, we used _nm_utils_ascii_str_to_bool(). That can accept any
kind of input (like "true"), so one might think that this is better to
use on user-input. However, NMSettingBond already validates the these
options are integers (either "0" or "1"). So a value like "true"
could never be here.

Use _nm_setting_bond_opt_value_as_intbool() because that asserts that
the option if of the expected type (integer).

(cherry picked from commit b1a72d0f21)
2022-09-29 14:14:42 +02:00
Thomas Haller
bb0fb83694
bond: make _platform_lnk_bond_init_from_setting() more readable via a macro
Use macros to make the code shorter and easier to read.

(cherry picked from commit b7c56c3ae1)
2022-09-29 14:14:42 +02:00
Thomas Haller
8139b27584
firewall: move logging stdin argument to nft call
(cherry picked from commit b74e2cbfaa)
2022-09-29 13:51:58 +02:00
Thomas Haller
07c519c37f
firewall: expose nm_firewall_nft_call() in header file
(cherry picked from commit cfeecbedff)
2022-09-29 13:51:57 +02:00
Thomas Haller
49ae45f838
firewall-utils: move _append() macro to be used by other places
(cherry picked from commit 0a0c197916)
2022-09-29 13:51:57 +02:00
Thomas Haller
558bcd5aae
firewall/trivial: rename nm_firewall_config_apply() to nm_firewall_config_apply_sync()
Sync/blocking methods are ugly. Their name should highlight this.
Also, we may have an async variant, so we will need the "good" name
for apply() and apply_finish().

(cherry picked from commit dc66fb7d04)
2022-09-29 13:51:56 +02:00
Thomas Haller
bbf3d01e82
firewall: more renaming and splitting _fw_nft_set_shared()
Blocking calls are ugly. Rename those to have a "_sync()" suffix.
Also, split from _fw_nft_set_shared() the part that constructs the
stdin for nft.

(cherry picked from commit 7362ad6266)
2022-09-29 13:51:56 +02:00
Thomas Haller
bfb4452f7d
firewall/trivial: rename nm_firewall_config_new() to nm_firewall_config_new_shared()
(cherry picked from commit 7ad3fb1956)
2022-09-29 13:51:55 +02:00
Thomas Haller
6fa0068c1e
firewall/trivial: rename "shared"/"add" argument in firewall utils to "up"
(cherry picked from commit e185f7966d)
2022-09-29 13:51:55 +02:00
Fernando Fernandez Mancera
65d31a11f8 veth: drop iface peer check during create_and_realize()
When fetching the parent device, if the system is slow, NetworkManager
can hit a race condition where the property is still NULL. In that case,
NetworkManager should create the veth link.

Checking that the peer device exists, it is type NM_DEVICE_TYPE_VETH and
it have a parent device is enough to know that we can skip the link
creation.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1399

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

Fixes: 4655b7c308 ('veth: fix veth activation on booting')
(cherry picked from commit 07e0ab48d1)
2022-09-29 10:35:12 +02:00
Fernando Fernandez Mancera
178ff4e42a bond: fix arp_all_target option when arp_interval is disabled
The bond option arp_all_target can be set even if arp_interval is
disabled.

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

Fixes: e064eb9d13 ('bond: use netlink to set bond options')
(cherry picked from commit 3871c670ab)
2022-09-27 13:54:11 +02:00
Fernando Fernandez Mancera
d23c6040f8
policy: fix disposal of devices list
When disposing NMPolicy all the devices in the devices hash-table should
be unregistered and removed from the hash-table.

Fixes: 7e3d090acb ('policy: refactor tracking of registered devices')
(cherry picked from commit 5a87683b14)
2022-09-27 08:22:07 +02:00
Thomas Haller
533b30e5a2 ifcfg-rh: rework error handling in parse_infiniband_p_key()
(cherry picked from commit 61d74b0c15)
2022-09-14 10:35:45 -04:00
Wen Liang
fe21880c46 ipoib: skip validating the DEVICE when reading the ifcfg file
For the ipoib connection, it is still considered as valid if the
profile does not set the device name. Also, the ifcfg reader should not
duplicate the checks that `nm_connection_verify()` performs (especially
not wrongly). Therefore, NM should skip validating the DEVICE when
reading the ifcfg file for the ipoib connection.

https://bugzilla.redhat.com/show_bug.cgi?id=2122703
(cherry picked from commit 4c32dd9d25)
2022-09-14 10:35:45 -04:00
Wen Liang
33f2f82a09 infiniband: avoid normalizing the p-key when reading from ifcfg
When writing the p-key setting to the ifcfg file and reading the
setting back, the value has to be consistent. This is not limited to
p-key only, any setting value during the ifcfg write and read also has
to be consistent.

This was probably added in commit cb5606cf1c ('ifcfg-rh:
add support for Infiniband partitions') as this is also what
ifup-ib does ([1]). For NetworkManager profiles however, the
p-key is also valid without the high bit set, so the ifcfg-rh
reader must honor that.

[1] 0c9fb6ca7b/rdma.ifup-ib (L75)

(cherry picked from commit a4fe16a426)
2022-09-14 10:35:45 -04:00
Lubomir Rintel
dc2d2da9db
device: don't ignore external slave removals
We've been outright ignoring master-slave checks if the link ended up
without a master since commit 2e22880894 ('device: don't remove the
device from master if its link has no master').

This was done to deal with OpenVSwitch port-interface relationship,
where the interface's platform link lacked an actual master in platform
(what matters there is the OVSDB entry), but the fix was too wide.

Let's limit the special case to devices whose were not enslaved to
masters that lack a platform link, which pretty much happens for
OpenVSwitch only.

Morale: Write better commit messages of future you is going to be upset
Fixes: 2e22880894 ('device: don't remove the device from master if its link has no master')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1358
(cherry picked from commit a1de6810df)
2022-09-13 12:38:19 +02:00
Fernando Fernandez Mancera
1ba916915d bond: fix primary bond option when the link is not present
Bond option netlink support requires primary property to be a ifindex
instead of the interface name. This is a workaround for supporting
specifying a primary that does not exist yet.

```
nmcli con add type bond ifname mybond0 bond.options "mode=active-backup,primary=veth1"
Connection 'bond-mybond0' (38100ef9-11e2-4003-aff9-cb2d152ce34f) successfully added.
nmcli con add type ethernet ifname veth1 master mybond0

cat /sys/class/net/mybond0/bonding/primary
veth1
```

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1362

Fixes: e064eb9d13 ('bond: use netlink to set bond options')
(cherry picked from commit 4fd90fb6cc)
2022-09-13 11:08:01 +02:00
Thomas Haller
6e5dabe63c
core/config: use NM_STR_HAS_PREFIX() instead of g_str_has_prefix()
With C literals as prefix, this macro is more efficient as it
just expands to a strncmp(). Also, it accepts NULL string.

(cherry picked from commit f1c1d93bc5)
2022-09-09 16:27:00 +02:00
Thomas Haller
2e88c0f879
core/config: fix duplicate entires in NetworkManager --print-config output
_nm_config_data_log_sort() is used for sorting the groups in the
keyfile during nm_config_data_log(). The idea is to present the keyfile
in a defined, but useful order.

However, it is not a total order. That is, it will return c=0 (equal) for
certain groups, if the pre-existing order in the GKeyFile should be
honored. For example, we want to sort all [device*] sections close to
each other, but we want to preserve their relative order. In that case,
the function would return 0 although the group names differed.

Also, _nm_config_data_log_sort() does not expect to receive duplicate names.
It would return c!=0 for comparing "device" and "device".

This means, _nm_config_data_log_sort() is fine for sorting the input as
we have it. However, it cannot be used to binary search the groups. This
caused that some sections might be duplicated in the `NetworkManager
--print-config` output. Otherwise, it had no bad effects.

Fixes(no-backport): 78d34d7c2e ('config: fix printing default values for missing sections')

(cherry picked from commit f6345180b1)
2022-09-09 16:27:00 +02:00
Beniamino Galvani
bdaba47a68 device: don't emit recheck-assume if there is a queued activation request
The @dracut_NM_vlan_over_team_no_boot sometimes fails, among other
things, because it fails to assume an indicated connection after a
restart.

That seems to happen because after the decision to activate the
indicated connection, the device does not move from DISCONNECTED state
quickly enough. Another assumption recheck runs in between and decides
to generate a connection, because the assume state was already reset
in between.

First start, creates and activates b3a61b68-f744-4a4c-a513-61399c154a67
on vlan0017:

  NetworkManager (version 1.41.1-30921.55767cf5.el9) is starting...
      (asserts:10000, boot:caf7301a-19cd-498b-b5ba-5d36ee939ffe)
  ...
  settings: update[b3a61b68-f744-4a4c-a513-61399c154a67]: adding connection "vlan0017"
      (45113870df0a4cfb/keyfile)

Second start:

  NetworkManager (version 1.41.1-30921.55767cf5.el9) is starting...
      (after a restart, asserts:10000, boot:caf7301a-19cd-498b-b5ba-5d36ee939ffe)

Assumption attempt successfully picks the right connection and thus
proceeds to reset the assume state:

  manager: (vlan0017): assume: will attempt to assume matching connection 'vlan0017'
      (b3a61b68-f744-4a4c-a513-61399c154a67) (indicated)
  device[c7c5101cf0b73f5f] (vlan0017): assume-state: set guess-assume=0, connection=(null)

Everything great so far, activation of the right connection is enqueued
and the device moves away from unavailable state. However, the
activation can't proceed immediately:

  device (vlan0017): state change: unmanaged -> unavailable
      (reason 'connection-assumed', sys-iface-state: 'assume')
  device (vlan0017): state change: unavailable -> disconnected
      (reason 'connection-assumed', sys-iface-state: 'assume')
  active-connection[0x55ba1162f1c0]: set device "vlan0017" [0x55ba1163c4f0]
  device[c7c5101cf0b73f5f] (vlan0017): queue activation request waiting for carrier

Now another assumption attempt is done. The original assume state is
gone, so a connection is generated:

  platform-linux: UDEV event: action 'add' subsys 'net' device 'vlan0017' (6); seqnum=1959
  device[c7c5101cf0b73f5f] (vlan0017): queued link change for ifindex 6
  manager: (vlan0017): assume: generated connection 'vlan0017' (57627119-8c20-4f9e-bf4d-4fc427b4a6a9)
  keyfile: commit: 57627119-8c20-4f9e-bf4d-4fc427b4a6a9 (vlan0017) added as
      "/run/NetworkManager/system-connections/vlan0017-57627119-8c20-4f9e-bf4d-4fc427b4a6a9.nmconnection"
      (nm-generated,volatile,external)

I think this shouldn't have happened. We've picked the correct
connection already and it's enqueued for activation!

Change the check in nm_device_emit_recheck_assume() to also consider
any queued activation.

Fixes-test: @dracut_NM_vlan_over_team_no_boot

Co-authored-by: Lubomir Rintel <lkundrak@v3.sk>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1351
(cherry picked from commit 9eb8cbca76)
2022-09-05 09:20:52 +02:00
Beniamino Galvani
5a49a2f6b2
device: restart DHCP when the MAC changes
If the MAC changes there is the possibility that the DHCP client will
not be able to renew the address because it uses the old MAC as
CHADDR. Depending on the implementation, the DHCP server might use
CHADDR (so, the old address) as the destination MAC for DHCP replies,
and those packets will be lost.

To avoid this problem, restart the DHCP client when the MAC changes.

https://bugzilla.redhat.com/show_bug.cgi?id=2110000
(cherry picked from commit 905adabdba)
2022-08-25 23:24:47 +02:00
Beniamino Galvani
2f8e4e2b06
core: log when dynamic IP configuration is restarted and why
(cherry picked from commit 6cd69fde33)
2022-08-25 23:24:46 +02:00
Lubomir Rintel
9d7e5a3b79
device: wait for carrier on unavailable device even when it gets a connection assumed
The test in question leaves the device with a master set, which caused a
connection to get assumed and therefore the previous fix didn't kick in.

Fixes-test: @restart_L2_only_lacp
Fixes: 5b7f8f3f70 ('device: wait for carrier even if it wasn't us who brought the device IFF_UP')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1348
(cherry picked from commit c183f10f65)
2022-08-25 23:16:13 +02:00
Thomas Haller
56d0d35516
mptcp: rework "connection.mptcp-flags" for enabling MPTCP
1) The "enabled-on-global-iface" flag was odd. Instead, have only
and "enabled" flag and skip (by default) endpoints on interface
that have no default route. With the new flag "also-without-default-route",
this can be overruled. So previous "enabled-on-global-default" now is
the same as "enabled", and "enabled" from before behaves now like
"enabled,also-without-default-route".

2) What was also odd, as that the fallback default value for the flags
depends on "/proc/sys/net/mptcp/enabled". There was not one fixed
fallback default, instead the used fallback value was either
"enabled-on-global-iface,subflow" or "disabled".
Usually that is not a problem (e.g. the default value for
"ipv6.ip6-privacy" also depends on use_tempaddr sysctl). In this case
it is a problem, because the mptcp-flags (for better or worse) encode
different things at the same time.
Consider that the mptcp-flags can also have their default configured in
"NetworkManager.conf", a user who wants to switch the address flags
could previously do:

  [connection.mptcp]
  connection.mptcp-flags=0x32   # enabled-on-global-iface,signal,subflow

but then the global toggle "/proc/sys/net/mptcp/enabled" was no longer
honored. That means, MPTCP handling was always on, even if the sysctl was
disabled. Now, "enabled" means that it's only enabled if the sysctl
is enabled too. Now the user could write to "NetworkManager.conf"

  [connection.mptcp]
  connection.mptcp-flags=0x32   # enabled,signal,subflow

and MPTCP handling would still be disabled unless the sysctl
is enabled.

There is now also a new flag "also-without-sysctl", so if you want
to really enable MPTCP handling regardless of the sysctl, you can.
The point of that might be, that we still can configure endpoints,
even if kernel won't do anything with them. Then you could just flip
the sysctl, and it would start working (as NetworkManager configured
the endpoints already).

Fixes: eb083eece5 ('all: add NMMptcpFlags and connection.mptcp-flags property')
(cherry picked from commit c00873e08f)
2022-08-25 23:12:53 +02:00
Fernando Fernandez Mancera
1b704e2f42
bond: fix missing assignment of lp_interval_has
The variable `lp_interval` was being assigned instead of
`lp_interval_has`. The `lp_interval` bond option was not being set
correctly.

https://bugs.launchpad.net/network-manager/+bug/1987001

Fixes: e064eb9d13 ('bond: use netlink to set bond options')
(cherry picked from commit 7d4307e8df)
2022-08-25 15:40:17 +02:00
Thomas Haller
3117198f15
Revert "wifi: support "802-1x.phase1-auth-flags=tls-allow-unsafe-renegotiation" flag"
There is still no agreement, about how to name this option, or whether
it should exist at all. Revert the addition of the flag.

As the new release is coming up, drop the new API.

https://bugzilla.redhat.com/show_bug.cgi?id=2072070#c64
https://bugzilla.redhat.com/show_bug.cgi?id=2077973#c24
http://lists.infradead.org/pipermail/hostap/2022-July/040665.html

This reverts commit a5a4aea2e6.
2022-08-11 19:36:26 +02:00
Fernando Fernandez Mancera
003eb75eb6 bond: fix parsing of arp_ip_target to platform
nm_setting_bond_get_option_normalized() is returning the arp_ip_target
IPs separated by comma instead of a blank space.

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

Fixes: e064eb9d13 ('bond: use netlink to set bond options')
2022-08-11 12:41:59 +02:00
Thomas Haller
1f5a05150a
mptcp: fix nmp_global_tracker_sync_mptcp_addrs()
- drop unused "keep_deleted" parameter. It just doesn't make sense.
  Even less sense than for rules/routes, where this was taken from.

- fix nmp_global_tracker_sync_mptcp_addrs() to delete addresses
  with conflicting flags. We did not correctly delete existing
  addresses, that were to be reconfigured with different flags.

Fixes: 5374c403d2 ('platfrom: handle MPTCP addresses with NMPGlobalTracker')
2022-08-10 11:35:28 +02:00
Thomas Haller
9f0f8e0fbe
config: support hex and octal numbers in nm_config_data_get_connection_default_int64()
This affects parsing global connection defaults from
"NetworkManager.conf".

Let's use a zero base for strtoll(), which honors the prefixes
"0x" and "0" to use hex and octal numbers, respectively. Otherwise
it uses decimal (base 10).

This causes very little ambiguity, but it makes certain numbers
just work.

Also, we have flags properties, where it makes much more sense
to write them in hex, like `connection.mptcp-flags=0x52`.
2022-08-10 10:05:16 +02:00
Thomas Haller
6fb11dbe77
device: allow reapplying changes to "connection.autoconnect-priorty"
Of course, this setting has no effect while being activated. But it
should not prevent reapply.
2022-08-09 14:11:55 +02:00
Thomas Haller
f64dff6939
all: drop various NMMptcpFlags
The default behavior might be sufficient. Drop those flags for now,
and figure out a good solution when we have an actual use-case.
2022-08-09 08:02:56 +02:00
Thomas Haller
eb083eece5
all: add NMMptcpFlags and connection.mptcp-flags property 2022-08-09 08:02:54 +02:00
Thomas Haller
5374c403d2
platfrom: handle MPTCP addresses with NMPGlobalTracker
When we configure MPTCP addresses, we usually do so per interface
(ifindex). That is, because each interface (via NMDevice and NML3Cfg)
decides how to configure MPTCP, and then we always add MTCP addresses
for this certain ifindex.

With that, we could have a purely interface-specific view and not a
global sync method. However, there are two problems:

The minor problem is that we don't cache the endpoints (because we don't
get notifications). We can only get a dump of all endpoints. It seems
odd to have a mptcp-addr-sync method that is per-ifindex, when it needs
to dump all addresses.

The much more important reason is that the number of endpoints that we
can configure in kernel is very limited. So we need to make a choice
which endpoints to configure, and for that we need to holistic view that
NMPGlobalTracker has.
2022-08-09 08:02:52 +02:00
Thomas Haller
ce635c4339
platform: add dump/update function for MPTCP addresses
Since the generic netlink API does (currently) not support notifications
about changes of the MPTCP addresses, we won't get notifications when
they change, and it seems wrong to put such things in the NMPlatform
cache.

We can just get the list of endpoints by polling, so add a function
nm_platform_mptcp_addrs_dump() for that.

Also, add nm_platform_mptcp_addr_update() which can add/remove/update
MPTCP addresses.
2022-08-09 08:02:50 +02:00
Thomas Haller
f4b128c63b
device: fix reapply for lldp/mdns/llmnr/dns-over-tls settings
When only one of those connection.{lldp,mdns,llmnr,dns-over-tls}
settings changes, we still need to do a full restart of the IP
configuration to reapply the changes.

Fixes: 58287cbcc0 ('core: rework IP configuration in NetworkManager using layer 3 configuration')
2022-08-09 08:02:37 +02:00
Lubomir Rintel
5cf96c4db2
bridge: fix reapply of vlan_filtering and default_pvid
Fixes: 8e8fed433f ('bridge: add reapply support')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1327
2022-08-06 21:08:51 +02:00
Thomas Haller
67a5cf7675
core: block to get good random bytes for "/var/lib/NetworkManager/secret_key"
_host_id_read() is the only place where we really care to have good
random numbers, because that is the secret key that we persist to disk.

Previously, we tried only nm_random_get_bytes_full(), which is a best
effort to get strong random numbers. If it fails to generate those,
it would simply remember the generated key in memory and proceed, but not
persist it to disk.

nm_random_get_bytes_full() does not block waiting for good numbers.

Change that. Now, first call nm_random_get_crypto_bytes(), which would
block and try hard to get good random numbers. Only if that fails,
fallback to nm_random_get_bytes_full() as before. The difference is of
course only in early boot, when we might not yet have entropy. In that
case, I think it's better for NetworkManager to block.
2022-08-05 19:29:35 +02:00
Thomas Haller
d20343c9d0
glib-aux: rework random number utils
Heavily inspired by systemd ([1]).

We now also have nm_random_get_bytes{,_full}() and
nm_random_get_crypto_bytes(), like systemd's random_bytes()
and crypto_random_bytes(), respectively.

Differences:

- instead of systemd's random_bytes(), our nm_random_get_bytes_full()
  also estimates whether the output is of high quality. The caller
  may find that interesting. Due to that, we will first try to call
  getrandom(GRND_NONBLOCK) before getrandom(GRND_INSECURE). That is
  reversed from systemd's random_bytes(), because we want to find
  out whether we can get good random numbers. In most cases, kernel
  should have entropy already, and it makes no difference.

Otherwise, heavily rework the code. It should be easy to understand
and correct.

There is also a major bugfix here. Previously, if getrandom() failed
with ENOSYS and we fell back to /dev/urandom, we would assume that we
have high quality random numbers. That assumption is not warranted.
Now instead poll on /dev/random to find out.

[1] a268e7f402/src/basic/random-util.c (L81)
2022-08-05 19:29:34 +02:00
Fernando Fernandez Mancera
e064eb9d13 bond: use netlink to set bond options
Use the netlink platform implementation for setting the bond link
options.
2022-08-04 11:18:36 +02:00
Fernando Fernandez Mancera
f900f7bc2c platform: add netlink support for bond link
sysfs is deprecated and kernel people will not add new bond options to
sysfs. Netlink is a stable API and therefore is the right method to
communicate with kernel in order to set the link options.
2022-08-04 11:18:36 +02:00
Lubomir Rintel
5b7f8f3f70 device: wait for carrier even if it wasn't us who brought the device IFF_UP
The devices generally need to be IFF_UP and wait a little before the
carrier detection is reliable. Some devices, actually need to wait
more than a little -- r8169 needs up to 5 seconds.

For this reason, we delay startup complete while the carrier is down
after we bring the device up. We do this so that we don't reject
activations due to carrier down until we're sure it's really down.
This works well as long as it's us who brought the device up.

If we're restarting the daemon, the device is going to be already up
when we start up the daemon for the second time. There's, however, a
slim chance that the device was brought down and up very shortly before
the restart and therefore the carrier reporting is still not reliable.
As a matter of fact, we bring the devices down and back up on some
occassions, such as when enslaving to a team device.

Therefore, the following events in quick succession cause trouble:

  # nmcli con up team-slave-eth0
  [20099.205355] Generic FE-GE Realtek PHY r8169-0-300:00: attached PHY driver (mii_bus:phy_addr=r8169-0-300:00, irq=MAC)
  [20099.365641] nm-team: Port device eth0 added
  [20099.370728] r8169 0000:03:00.0 eth0: Link is Down
  [20099.436631] nm-team: Port device eth0 removed
  [20099.463422] Generic FE-GE Realtek PHY r8169-0-300:00: attached PHY driver (mii_bus:phy_addr=r8169-0-300:00, irq=MAC)
  [20099.628505] r8169 0000:03:00.0 eth0: Link is Down
  [20099.669425] Generic FE-GE Realtek PHY r8169-0-300:00: attached PHY driver (mii_bus:phy_addr=r8169-0-300:00, irq=MAC)
  [20099.833457] r8169 0000:03:00.0 eth0: Link is Down
  [20099.838471] nm-team: Port device eth0 added

The device has been brought down, enslaved and brought up.
"Link is Down" indicates carrier not being detected.

  Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
  # systemctl restart NetworkManager

Now NM sees the device being up, but carrier down.

  # nmcli con up testeth0
  Error: Connection activation failed: No suitable device found for this connection (...).

Activation failed, because eth0 carrier still appears down.

  # [20102.943464] r8169 0000:03:00.0 eth0: Link is Up - 1Gbps/Full - flow control rx/tx

Now it's up, but the party is already over. Shiet.

Let's wait whenever the device reaches unavailable state, whether we
bring it up at that point or not.

Fixes-test: @restart_L2_only_lacp

https://bugzilla.redhat.com/show_bug.cgi?id=2092361
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1316
2022-08-02 15:06:35 +02:00
Dylan Van Assche
0f3eb6fabb
nm-device-bt: allow Bluetooth NAP type for complete-connection
Bluetooth NAP is besides Bluetooth PAN and DUN also supported by
NetworkManager. Add NAP to the supported Bluetooth types of
nm-device-bt.c

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1320
2022-08-01 09:37:42 +02:00
Lubomir Rintel
2b4b4193be bridge: fix reapply of non-bridge properties
Return was ommited in a branch that delegates settings check to a parent
class, resulting in a bridge property check applied incorrectly.

Fixes: 8e8fed433f ('bridge: add reapply support')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1318
2022-07-29 12:45:00 +02:00
Thomas Haller
5806db7f4e
glib-aux: replace nm_ip4_addr_is_localhost() by nm_utils_ip4_address_is_loopback()
This was duplicated.
2022-07-28 13:08:31 +02:00
Beniamino Galvani
0cd3ffa7e9 build: fix compilation
Fixes: dbf29c5450 ('platform: fix build with musl libc')
2022-07-27 19:51:56 +02:00
Beniamino Galvani
dbf29c5450 platform: fix build with musl libc
Don't mix <net/ethernet.h> and <linux/if_ether.h>.

Fixes the following build error with musl libc:

  In file included from /usr/include/net/ethernet.h:10,
                   from ../src/libnm-platform/nm-linux-platform.c:17:
  /usr/include/netinet/if_ether.h:115:8: error: redefinition of 'struct ethhdr'
    115 | struct ethhdr {
        |        ^~~~~~
  In file included from ../src/linux-headers/ethtool.h:19,
                   from ../src/libnm-std-aux/nm-linux-compat.h:22,
                   from ../src/libnm-platform/nm-linux-platform.c:10:
  /usr/include/linux/if_ether.h:169:8: note: originally defined here
    169 | struct ethhdr {
        |        ^~~~~~

Fixes: dc98ab807c ('platform: include "linux-headers" via "libnm-std-aux/nm-linux-compat.h"')
2022-07-27 18:46:01 +02:00
Thomas Haller
d3c9bb4666
platform: rename file "nmp-route-manager.[hc]" to "nmp-global-tracker.[hc]" 2022-07-26 12:45:55 +02:00