Commit graph

28806 commits

Author SHA1 Message Date
Thomas Haller
5f17edea5b
std-aux: work around "-Wunused-but-set-variable" warning with clang in nm_auto()
We use the cleanup attribute heavily. It's useful for deferring
deallocation. For example, we have code like:

  gs_unref_object NMBluezManager *self_keep_alive = g_object_ref(self);

where we don't use the variable otherwise, except for owning (and
freeing) the reference. This already lead to a compiler warning about
unused variable, which we would workaround with

  _nm_unused gs_unref_object NMBluezManager *self_keep_alive = g_object_ref(self);

With clang 13.0.0~rc1-1.fc35, this got worse. Now for example also

    static inline void
    nm_strvarray_set_strv(GArray **array, const char *const *strv)
    {
        gs_unref_array GArray *array_old = NULL;

        array_old = g_steal_pointer(array);

        if (!strv || !strv[0])
            return;

        nm_strvarray_ensure(array);
        for (; strv[0]; strv++)
            nm_strvarray_add(*array, strv[0]);
    }

leads to a warning

    ./src/libnm-glib-aux/nm-shared-utils.h:3078:28: error: variable array_old set but not used [-Werror,-Wunused-but-set-variable]
        gs_unref_array GArray *array_old = NULL;
                               ^

This is really annoying. We don't want to plaster our code with _nm_unused,
because that might hide actual issues. But we also want to keep using this
pattern and need to avoid the warning.

A problem is also that GCC usually does not warn about truly unused
variables with cleanup attribute. Clang was very useful here to flag
such variables. But now clang warns about cases which are no bugs, which
is a problem. So this does loose some useful warnings. On the other hand,
a truly unused variable (with cleanup attribute) is ugly, but not an actual
problem.

Now, with clang 13, automatically mark nm_auto() variables as _nm_unused
as workaround.

(cherry picked from commit 1c85bc5ead)
2022-01-05 08:28:54 +01:00
Thomas Haller
99c0d5593d
gitlab: merge branch 'th/fix-gitlab-for-1-32' 2022-01-05 08:09:58 +01:00
Thomas Haller
49b779b9b7
gitlab-ci: regenerate ci-templates's containers 2022-01-05 07:58:11 +01:00
Thomas Haller
126beb8a58
gitlab-ci: replace rawhide with f35 for gitlab-ci
This is a stale branch. We don't want to test it against rawhide,
because that is a moving target and keeps changing. Instead use Fedora
35.
2022-01-05 07:58:11 +01:00
Thomas Haller
85d1802809
gitlab-ci: drop fedora 28/29 from gitlab-ci
These containers are ancient. Also, when we update ci-templates
they will no longer build (because then a different container hub
will be used, which doesn't contain those images). Drop them.

(cherry picked from commit 82b72a7379)
2022-01-05 07:58:11 +01:00
Thomas Haller
1da22aaefa
gitlab-ci: update used ci-templates version
It seems there is a problem building f35/f36 containers. Update
the ci-templates version.

(cherry picked from commit dc8c9d4bd2)
2022-01-05 07:58:11 +01:00
Thomas Haller
79ed81bb0a
contrib,gitlab-ci: fix "contrib/fedora/REQUIRED_PACKAGES" to install "vala"
Fixes: 53562b1915 ('contrib: remove "vala-tools" from "contrib/fedora/REQUIRED_PACKAGES"')
(cherry picked from commit 414d2c1d4b)
2022-01-05 07:58:11 +01:00
Thomas Haller
2d4a64ce23
contrib: remove "vala-tools" from "contrib/fedora/REQUIRED_PACKAGES"
Since Fedora 25, vala-tools was merged with "vala" package. And on
rawhide (f36) it's gone completely and leads to a failure of the script.

Drop it.

(cherry picked from commit 53562b1915)
2022-01-04 21:41:01 +01:00
Thomas Haller
97e0d773e1
format: reformat code with clang-format-12.0.1-1.fc34
The formatting produced by clang-format depends on the version of the
tool. The version that we use is the one of the current Fedora release.

Fedora 34 recently updated clang (and clang-tools-extra) from version
12.0.0 to 12.0.1. This brings some changes.

Update the formatting.

(cherry picked from commit 10e0c4261e)
2022-01-04 21:24:30 +01:00
Vojtech Bubela
00723dd5e8 libnm: fix crash in _nm_ip_route_validate_all for invalid route
backtrace from coredump, NetworkManager-1.30.6-1.fc34

  #0  verify
      (setting=0x55d081fe8690, connection=<optimized out>, error=0x7ffe0fa06870)
      at libnm-core/nm-setting-ip-config.c:5249
  #1  0x000055d081ab98d4 in verify
      (setting=0x55d081fe8690, connection=0x55d0820a2b80, error=0x7ffe0fa06870)
      at libnm-core/nm-setting-ip4-config.c:119
  #2  0x000055d081aa3d54 in _nm_connection_verify
      (connection=0x55d0820a2b80, error=0x7ffe0fa068c0)
      at libnm-core/nm-connection.c:1441
  #3  0x000055d081aa78ec in nm_connection_normalize
      (connection=0x55d0820a2b80, parameters=0x0, modified=0x0, error=0x7ffe0fa06de8)
      at libnm-core/nm-connection.c:1688
  #4  0x000055d081aa81f4 in _nm_connection_replace_settings
      (connection=0x55d0820a2b80, new_settings=<optimized out>, parse_flags=_NM_SETTING_PARSE_FLAGS_LAST, error=0x7ffe0fa06de8) at libnm-core/nm-connection.c:432
  #5  0x000055d081aa83a6 in _nm_simple_connection_new_from_dbus
      (dict=0x55d082089950, error=0x7ffe0fa06de8, parse_flags=_NM_SETTING_PARSE_FLAGS_LAST) at libnm-core/nm-simple-connection.c:77
  #6  0x000055d081bbf942 in settings_connection_update
      (self=0x55d081fdd9f0, is_update2=1, context=0x7fc06c021dd0, new_settings=0x55d082089950, flags=NM_SETTINGS_UPDATE2_FLAG_TO_DISK)
      at src/core/settings/nm-settings-connection.c:1637
  #7  0x000055d081bbfb09 in impl_settings_connection_update2
      (obj=0x55d081fdd9f0, interface_info=<optimized out>, method_info=<optimized out>, connection=<optimized out>, sender=<optimized out>, invocation=0x7fc06c021dd0, parameters=0x55d0820f5e60) at src/core/settings/nm-settings-connection.c:1796
  #8  0x00007fc08a9db482 in call_in_idle_cb.lto_priv () at /lib64/libgio-2.0.so.0

Fixes: bb6c2d7371 ('libnm: ensure stable behavior in _nm_ip_route_attribute_validate_all()')
(cherry picked from commit 0ed099374d)
2021-11-04 11:23:07 +01:00
Beniamino Galvani
02adbf5124 initrd: handle ip=dhcp,dhcp6 specially
With "ip=dhcp,dhcp6" the legacy dracut module does first DHCPv4 and
then IPv6 autoconf (even if DHCPv4 succeeded) [1]. In this way, there
is the guarantee that an address family is always configured if the
network supports it.

Currently "ip=dhcp,dhcp6" is treated a bit differently by NM, which
generates a connection with only ipv4.required-timeout=20s. Therefore
it's possible that NM in initrd quits (or signals startup-complete)
without an IPv6 even if the network is configured for IPv6.

Make NM's behavior similar to the legacy module by also setting an
ipv6.required-timeout for "ip=dhcp,dhcp6".

Note that if the command line contains "rd.neednet=1" without an "ip="
argument, we still generate a default connection with IPv4 preferred
over IPv6 (i.e. only ipv4.required-timeout set). That's similar to
what the legacy module does [2]. See [3] for a description of
different scenarios for "rd.neednet=1".

[1] https://github.com/dracutdevs/dracut/blob/055/modules.d/35network-legacy/ifup.sh#L459-L484
[2] https://github.com/dracutdevs/dracut/blob/055/modules.d/35network-legacy/ifup.sh#L529-L537
[3] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/729

https://bugzilla.redhat.com/show_bug.cgi?id=1961666
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/994
(cherry picked from commit 28770eb394)
2021-11-02 16:46:53 +01:00
Beniamino Galvani
77a2a53e8a core: better handle sd-resolved errors when resolving hostnames
If NM tries to resolve a link-local address, systemd-resolved returns
error "org.freedesktop.resolve1.NoNameServers" because those addresses
can only be resolved via other protocols like LLMNR or mDNS.

Previously NM would fall back to spawning the helper, which would ask
again to systemd-resolved via /etc/resolv.conf. In this way, a
synthetic result (or one obtained not from DNS) would be returned.

We must avoid non-DNS results. When systemd-resolved returns an error
that is not a D-Bus one (as MethodNotFound) but is a
"org.fd.resolve1.*" [1], we can assume that systemd-resolved is
running properly and we shall never fall back to spawning the helper.

[1] https://www.freedesktop.org/wiki/Software/systemd/resolved/#commonerrors

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/833
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1006
(cherry picked from commit d8186b1253)
2021-10-29 16:48:58 +02:00
Fernando Fernandez Mancera
af00e39dd2 libnm: add NMIPAddress and NMIPRoute dups backported symbols from 1.30.8
The nm_ip_address_dup() and nm_ip_route_dup() symbols were exposed in
libnm 1.32 and then backported to 1.30.8.

Export it also with version @libnm_1_30_8; this allows a program build
against libnm 1.30.8 to keep working with later versions of the library.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
(cherry picked from commit ec8df200f6)
2021-10-05 17:45:17 +02:00
Yu Watanabe
f32a59793a
libsystemd-network: disable event sources before unref them
This also (is supposed to) fix a assertion failure when in ipv4acd
when receiving an ARP packet in an unexpected state.

See-also: https://github.com/systemd/systemd/issues/20825
See-also: https://github.com/systemd/systemd/pull/20826
eb2f750242

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/807
(cherry picked from commit 7fba0f7cb2)
2021-09-24 17:07:51 +02:00
Thomas Haller
7cda7e32cf
docs: update URL for latest online documentation
(cherry picked from commit 4521e2aa89)
2021-09-24 15:06:01 +02:00
Beniamino Galvani
18e731dc74 libnm: add required-timeout backported symbol from 1.30.8
The nm_setting_ip_config_get_required_timeout() symbol was introduced
in libnm 1.32.4 and then backported to 1.30.8.

Export it also with version @libnm_1_30_8; this allows a program built
against libnm 1.30.8 to keep working with later versions of the
library.

(cherry picked from commit 57c1982867)
2021-09-23 09:19:09 +02:00
Beniamino Galvani
d6e90895e3 release: bump version to 1.32.13 (development) 2021-09-22 11:31:47 +02:00
Beniamino Galvani
d90c03b1b8 release: bump version to 1.32.12 2021-09-22 11:31:47 +02:00
Beniamino Galvani
08f5fdedb3 NEWS: update 2021-09-22 09:52:47 +02:00
Beniamino Galvani
ce8eb446b4 platform: preserve IPv6 multicast route added by kernel
Kernels < 5.11 add a route like:

  unicast ff00::/8 dev $IFACE proto boot scope global metric 256 pref medium

to allow sending and receiving IPv6 multicast traffic. Ensure it's not
removed it when we do a route sync in mode ALL.

In kernel 5.11 there were commits:

  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ceed9038b2783d14e0422bdc6fd04f70580efb4c
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a826b04303a40d52439aa141035fca5654ccaccd

After those the route looks like

  multicast ff00::/8 dev $IFACE proto kernel metric 256 pref medium

As NM ignores routes with rtm_type multicast, the code in this commit
is not needed on newer kernels.

https://bugzilla.redhat.com/show_bug.cgi?id=2004212
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/984
(cherry picked from commit 8003ca68f7)
2021-09-20 10:31:59 +02:00
Thomas Haller
df7d1f94b7
cloud-setup: merge branch 'th/cloud-setup-fix-containers'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/740
https://bugzilla.redhat.com/show_bug.cgi?id=1977984#c27

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

(cherry picked from commit e947053c23)
2021-09-16 17:37:37 +02:00
Thomas Haller
58e58361bd
cloud-setup: use suppress_prefixlength rule to honor non-default-routes in the main table
Background
==========

Imagine you run a container on your machine. Then the routing table
might look like:

    default via 10.0.10.1 dev eth0 proto dhcp metric 100
    10.0.10.0/28 dev eth0 proto kernel scope link src 10.0.10.5 metric 100
    [...]
    10.42.0.0/24 via 10.42.0.0 dev flannel.1 onlink
    10.42.1.2 dev cali02ad7e68ce1 scope link
    10.42.1.3 dev cali8fcecf5aaff scope link
    10.42.2.0/24 via 10.42.2.0 dev flannel.1 onlink
    10.42.3.0/24 via 10.42.3.0 dev flannel.1 onlink

That is, there are another interfaces with subnets and specific routes.

If nm-cloud-setup now configures rules:

    0:  from all lookup local
    30400:  from 10.0.10.5 lookup 30400
    32766:  from all lookup main
    32767:  from all lookup default

and

    default via 10.0.10.1 dev eth0 table 30400 proto static metric 10
    10.0.10.1 dev eth0 table 30400 proto static scope link metric 10

then these other subnets will also be reached via the default route.

This container example is just one case where this is a problem. In
general, if you have specific routes on another interface, then the
default route in the 30400+ table will interfere badly.

The idea of nm-cloud-setup is to automatically configure the network for
secondary IP addresses. When the user has special requirements, then
they should disable nm-cloud-setup and configure whatever they want.
But the container use case is popular and important. It is not something
where the user actively configures the network. This case needs to work better,
out of the box. In general, nm-cloud-setup should work better with the
existing network configuration.

Change
======

Add new routing tables 30200+ with the individual subnets of the
interface:

    10.0.10.0/24 dev eth0 table 30200 proto static metric 10
    [...]
    default via 10.0.10.1 dev eth0 table 30400 proto static metric 10
    10.0.10.1 dev eth0 table 30400 proto static scope link metric 10

Also add more important routing rules with priority 30200+, which select
these tables based on the source address:

    30200:  from 10.0.10.5 lookup 30200

These will do source based routing for the subnets on these
interfaces.

Then, add a rule with priority 30350

    30350:  lookup main suppress_prefixlength 0

which processes the routes from the main table, but ignores the default
routes. 30350 was chosen, because it's in between the rules 30200+ and
30400+, leaving a range for the user to configure their own rules.

Then, as before, the rules 30400+ again look at the corresponding 30400+
table, to find a default route.

Finally, process the main table again, this time honoring the default
route. That is for packets that have a different source address.

This change means that the source based routing is used for the
subnets that are configured on the interface and for the default route.
Whereas, if there are any more specific routes in the main table, they will
be preferred over the default route.

Apparently Amazon Linux solves this differently, by not configuring a
routing table for addresses on interface "eth0". That might be an
alternative, but it's not clear to me what is special about eth0 to
warrant this treatment. It also would imply that we somehow recognize
this primary interface. In practise that would be doable by selecting
the interface with "iface_idx" zero.

Instead choose this approach. This is remotely similar to what WireGuard does
for configuring the default route ([1]), however WireGuard uses fwmark to match
the packets instead of the source address.

[1] https://www.wireguard.com/netns/#improved-rule-based-routing

(cherry picked from commit fe80b2d1ec)
2021-09-16 17:37:37 +02:00
Thomas Haller
ce24b4bca5
cloud-setup: cleanup configuring addresses/routes/rules in _nmc_mangle_connection()
(cherry picked from commit 0978be5e43)
2021-09-16 17:37:37 +02:00
Thomas Haller
292233e16e
cloud-setup: limit number of supported interfaces to avoid overlapping table numbers
The table number is chosen as 30400 + iface_idx. That is, the range is
limited and we shouldn't handle more than 100 devices. Add a check for
that and error out.

(cherry picked from commit b68d694b78)
2021-09-16 17:37:36 +02:00
Thomas Haller
6302cd416d
cloud-setup: process iface-datas in sorted order
The routes/rules that are configured are independent of the
order in which we process the devices. That is, because they
use the "iface_idx" for cases where there is ambiguity.

Still, it feels nicer to always process them in a defined order.

(cherry picked from commit a95ea0eb29)
2021-09-16 17:37:36 +02:00
Thomas Haller
0a2ed62703
cloud-setup: track sorted list of NMCSProviderGetConfigIfaceData
Sorted by iface_idx. The iface_idx is probably something useful and
stable, provided by the provider. E.g. it's the order in which
interfaces are exposed on the meta data.

(cherry picked from commit 1c5cb9d3c2)
2021-09-16 17:37:36 +02:00
Thomas Haller
cc289e5369
cloud-setup: add "hwaddr" to NMCSProviderGetConfigIfaceData struct
get-config() gives a NMCSProviderGetConfigResult structure, and the
main part of data is the GHashTable of MAC addresses and
NMCSProviderGetConfigIfaceData instances.

Let NMCSProviderGetConfigIfaceData also have a reference to the MAC
address. This way, I'll be able to create a (sorted) list of interface
datas, that also contain the MAC address.

(cherry picked from commit ec56fe60fb)
2021-09-16 17:37:36 +02:00
Thomas Haller
8bc8a0f56b
cloud-setup: skip configuring policy routing if there is only one interface/address
nm-cloud-setup automatically configures the network. That may conflict
with what the user wants. In case the user configures some specific
setup, they are encouraged to disable nm-cloud-setup (and its
automatism).

Still, what we do by default matters, and should play as well with
user's expectations. Configuring policy routing and a higher priority
table (30400+) that hijacks the traffic can cause problems.

If the system only has one IPv4 address and one interface, then there
is no point in configuring policy routing at all. Detect that, and skip
the change in that case.

Note that of course we need to handle the case where previously multiple
IP addresses were configured and an update gives only one address. In
that case we need to clear the previously configured rules/routes. The
patch achieves this.

(cherry picked from commit 5f047968d7)
2021-09-16 17:37:36 +02:00
Thomas Haller
ae504433f1
cloud-setup: count numbers of valid IPv4 addresses in get-config result
Will be used next.

(cherry picked from commit 7969ae1a82)
2021-09-16 17:37:35 +02:00
Thomas Haller
e74375fc3b
cloud-setup: cache number of valid interfaces in get-config result
Now that we return a struct from get_config(), we can have system-wide
properties returned.

Let it count and cache the number of valid iface_datas.

Currently that is not yet used, but it will be.

(cherry picked from commit a3cd66d3fa)
2021-09-16 17:37:35 +02:00
Thomas Haller
c94b1c43d4
cloud-setup: return structure for get_config() result instead of generic hash table
Returning a struct seems easier to understand, because then the result
is typed.

Also, we might return additional results, which are system wide and not
per-interface.

(cherry picked from commit 323e182768)
2021-09-16 17:37:35 +02:00
Philip Withnall
df4c0aa89f
nm-active-connection: Emit device-metered-changed if device changes
The new device might have a different metered status from the old one.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: 04d5804dd5 ('nm-manager: add 'metered' property')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/982
(cherry picked from commit 0ad77d05b9)
2021-09-15 20:32:17 +02:00
gaoxingwang
b225d9d6bb
libnm: fix leak and return "failures" from nm_client_load_connections()
Due to this, `nmcli connection load` would also not print a warning
about failure to load obviously bogus files:

  $ nmcli connection load /bogus

Note that load is also used to unload files, so if the file name is a
possibly valid name for a non-existing file, there is no failure. For
example, we get no warning for

  $ nmcli connection load /etc/NetworkManager/system-connections/bogus

Even if currently no such file is loaded, then the operation would still
silently succeed, instead of succeeding the first time only. That is because
load should be idempotent.

[thaller@redhat.com: rewrote commit message]

Fixes: 4af6219226 ('libnm: implement nm_client_load_connections_async() by using GDBusConnection directly')

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/979
(cherry picked from commit 2a36f8c2f1)
2021-09-15 20:31:41 +02:00
Thomas Haller
0d8c2aeb43
style: fix indentation
b2155be6ac ('std-aux: add "libnm-std-aux/nm-linux-compat.h" header to avoid build errors')
2021-09-08 16:46:21 +02:00
Thomas Haller
b2155be6ac
std-aux: add "libnm-std-aux/nm-linux-compat.h" header to avoid build errors
We have a copy of a few linux user space headers in `src/linux-headers`.
The idea is that we want to use recent kernel API, and not depend on the
kernel UAPI headers installed on the build system (and not need to
workaround that).

However, we may not be able to simply compile them, because they too
have dependencies. For example,

  ../src/linux-headers/ethtool.h:1389:2: error: implicit declaration of function '__KERNEL_DIV_ROUND_UP' [-Werror=implicit-function-declaration]
    __u32 queue_mask[__KERNEL_DIV_ROUND_UP(MAX_NUM_QUEUE, 32)];
    ^

As workaround, don't include headers from "linux-headers" directly,
but only include the new "libnm-std-aux/nm-linux-compat.h" adapter
header, which tries to solve these incompatibilities.

Fixes: 34d48d2596 ('platform: clear all BASE types when setting advertised modes for ethernet autoneg')
(cherry picked from commit 2a07043489)
2021-09-08 15:39:48 +02:00
Thomas Haller
9ae82c9a84
platform: fix build using our copy of header "linux-headers/ethtool.h"
Fixes: 34d48d2596 ('platform: clear all BASE types when setting advertised modes for ethernet autoneg')
(cherry picked from commit 426491a500)
2021-09-08 13:38:51 +02:00
Thomas Haller
3b7af0398d
ethtool: merge branch 'th/ethtool-autoneg-fixes'
https://bugzilla.redhat.com/show_bug.cgi?id=1897004#c10

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

(cherry picked from commit 52d18db0e3)
2021-09-07 08:44:29 +02:00
Thomas Haller
ef76937e67
core: always reset ethtool autoneg/speed to fix reactivation
The check whether the current setting are already as expected are wrong.

The reason is that nm_platform_ethtool_set_link_settings() also sets
the announced ethernet modes, but nm_platform_ethtool_get_link_settings()
does not give them.

That means, we cannot check whether the current link configuration is
the same, because the getter doesn't give that information.
Consequently, we must not skip the setting on the assumption that
there is nothing to change.

This bug has bad effects. If the device is currently activated with ethtool
option set, then re-activating the profile will result in wrongly
skipping the update.

(cherry picked from commit 78b3711522)
2021-09-07 08:44:12 +02:00
Thomas Haller
e2fe64a3d8
platform: also set advertised modes when disabling ethernet autoneg
Disabling autoneg is not supported for Gigabit ethernet. But it seems that
ixgbe also doesn't honor

  ethtool -s enp5s0f0 speed 100 duplex full autoneg off

As a workaround, when we disable autoneg then always set the advertised
modes too. I think (hope) that should not have a bad effect otherwise,
but seems most sensible for ixgbe.

(cherry picked from commit bd92df3e56)
2021-09-07 08:44:12 +02:00
Thomas Haller
6b7957f311
core: during reset of ethtool autoneg enable all modes
(cherry picked from commit d5f062cecd)
2021-09-07 08:44:11 +02:00
Thomas Haller
a6ef74a662
core: cleanup logging of set-link for speed/autoneg
There is no point in logging the current speed/duplex. OK, with
the "*", we could at least see whether the printed values are
to be set, or are currently configured on the interface.

But mixing these two outputs is confusing and meaningless.
Either log what we are about to do, or what the current configuration
is. Not a mix of both.

(cherry picked from commit ea2b965ac2)
2021-09-07 08:44:11 +02:00
Thomas Haller
10ae24098c
platform: add debug logging for setting link autoneg/speed
(cherry picked from commit 5c789c030a)
2021-09-07 08:44:11 +02:00
Thomas Haller
16e491f06a
platform: clear all BASE types when setting advertised modes for ethernet autoneg
Get the list of supported flags from ethtool utility ([1]).

When we enable auto-negotiation, the user may select only one mode to
be advertised. But then we need to clear all other modes, the previous
define BASET_ALL_MODES did not cover them all.

[1] https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/tree/ethtool.c?id=7cca9692b9b0c4e2c7eb7868a7791f97202014b0#n397

(cherry picked from commit 34d48d2596)
2021-09-07 08:44:10 +02:00
Thomas Haller
5b0396efc0
platform: don't set lp_advertising in set_link_settings_new()
I don't understand why this was done. I don't think it's necessary nor
correct.

(cherry picked from commit 595099f27a)
2021-09-07 08:44:10 +02:00
Thomas Haller
475d759ae3
platform: simplify accessing ethtool_link_settings.link_mode_masks in set_link_settings_new()
(cherry picked from commit 94e23ebba5)
2021-09-07 08:44:10 +02:00
Thomas Haller
25bfa2f8a5
platform/build: fix linking "test-nm-platform" test
libnm-platform.la depends on libnm-udev-aux and libnm-base.
Only by accident this was working, because we happened to use
no symbol in the test that required any of these dependencies.

A small change to the test can (and will soon) change that. Fix the
build to link the right library.

(cherry picked from commit f992b2bc25)
2021-09-07 08:44:10 +02:00
Thomas Haller
f7d8d4f548
linux-headers: update nl802154.h kernel header
Taken from "include/net/nl802154.h", Linux 5.14,
7d2a07b769330c34b4deabeed939325c77a7ec2f, Aug 30, 2021.

(cherry picked from commit c3d0249859)
2021-09-07 08:44:08 +02:00
Thomas Haller
0a0fc204e1
linux-headers: add ethtool.h kernel header
Taken from Linux 5.14, 7d2a07b769330c34b4deabeed939325c77a7ec2f,
Aug 30, 2021.

(cherry picked from commit aadcd0935e)
2021-09-07 08:43:38 +02:00
Thomas Haller
ae97ab7d29
code-format: exclude "src/linux-headers" from "nm-code-format.sh" script
(cherry picked from commit 023c8ad88b)
2021-09-07 08:43:37 +02:00
Thomas Haller
2824f99673
initrd: fix crash parsing plain '=' without key
./src/nm-initrd-generator/nm-initrd-generator  -s -- =

Fixes: ecc074b2f8 ('initrd: add command line parser')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/776
(cherry picked from commit 01fd4b7d2c)
2021-08-30 09:18:35 +02:00