Commit graph

27930 commits

Author SHA1 Message Date
Thomas Haller
bd2fe272bb platform: fix parsing RTA_MULTIHOP netlink attribute to use no policy
To parse the RTA_MULTIHOP message, "policy" is not right (which is used
to parse the overall message). Instead, we don't really have a special
policy that we should use.

This was not a severe issue, because the allocated buffer (with
G_N_ELEMENTS(policy) elements) was larger than need be. And apparently,
using the wrong policy also didn't cause us to reject important
messages.

(cherry picked from commit 997d72932d)
(cherry picked from commit 21b1978072)
(cherry picked from commit ef1587bd88)
(cherry picked from commit 6aa3d40199)
2022-06-09 10:08:06 +02:00
Thomas Haller
57342756ed
device: initialize nm_auto variable in _ethtool_features_reset()
The compiler is often adament to warn about maybe-uninitialized.

(cherry picked from commit 3dd854eb1b)
(cherry picked from commit 471e987add)
(cherry picked from commit 4fa6001c60)
2022-04-05 12:23:55 +02:00
Thomas Haller
606703209f
libnm/tests: fix maybe-uninitialized warning in "test-libnmc-setting"
(cherry picked from commit 87bce61bad)
(cherry picked from commit aadf0fb64f)
(cherry picked from commit 688c67a24f)
2022-04-05 12:23:55 +02:00
Thomas Haller
40f51f0ffa
libnm/tests: fix maybe-uninitialized warning in "test-setting"
In function '_nm_auto_g_free',
      inlined from 'test_tc_config_tfilter_matchall_mirred' at src/libnm-core-impl/tests/test-setting.c:2955:24:
  ./src/libnm-glib-aux/nm-macros-internal.h:58:1: error: 'str' may be used uninitialized [-Werror=maybe-uninitialized]
     58 | NM_AUTO_DEFINE_FCN_VOID0(void *, _nm_auto_g_free, g_free);
        | ^
  src/libnm-core-impl/tests/test-setting.c: In function 'test_tc_config_tfilter_matchall_mirred':
  src/libnm-core-impl/tests/test-setting.c:2955:24: note: 'str' was declared here
   2955 |     gs_free char      *str;
        |                        ^
  lto1: all warnings being treated as errors
  lto-wrapper: fatal error: gcc returned 1 exit status

(cherry picked from commit 6f0e22a64a)
(cherry picked from commit 6329f1db5a)
(cherry picked from commit d3fdb854f9)
2022-04-05 12:23:55 +02:00
Thomas Haller
c65a57108e
Revert "supplicant/config: fix setting "saw" for "wifi-sec.key-mgnt=sae""
This "fix" was wrong, because at the beginning of the if-else-block
there is already `key_mgmt_conf = g_string_new(key_mgmt);`.

This reverts commit a6e06171ad.

a6e06171ad ('supplicant/config: fix setting "saw" for "wifi-sec.key-mgnt=sae"')
2022-04-05 09:02:51 +02:00
Thomas Haller
09669f0045
examples/python: avoid Python2 "print" statement
Recent python-black (22.0) dropped support for Python 2 and thus fail
for those files. Make the examples Python3 compatible.

(cherry picked from commit 95e6a0a6e2)
(cherry picked from commit 2e4d1e8dc6)
(cherry picked from commit b78ca328d2)
(cherry picked from commit 25062ff17b)
2022-04-04 21:53:30 +02:00
Thomas Haller
a6e06171ad
supplicant/config: fix setting "saw" for "wifi-sec.key-mgnt=sae"
This is a partial backport of commit 5f146b40f3 ('supplicant/config:
Refactor key_mgmt config generation').

Based-on-patch-by: Jonas Dreßler <verdre@v0yd.nl>

Fixes: d17a0a0905 ('supplicant: allow fast transition for WPA-PSK and WPA-EAP')

(cherry picked from commit 5f146b40f3)
2022-04-01 19:50:10 +02:00
Beniamino Galvani
1350134947 n-dhcp4: discard NAKs from other servers in SELECTING
I got a report of a scenario where multiple servers reply to a REQUEST
in SELECTING, and all servers send NAKs except the one which sent the
offer, which replies with a ACK. In that scenario, n-dhcp4 is not able
to obtain a lease because it restarts from INIT as soon as the first
NAK is received. For comparison, dhclient can get a lease because it
ignores all NAKs in SELECTING.

Arguably, the network is misconfigured there, but it would be great if
n-dhcp4 could still work in such scenario.

According to RFC 2131, ACK and NAK messages from server must contain a
server-id option. The RFC doesn't explicitly say that the client
should check the option, but I think it's a reasonable thing to do, at
least for NAKs.

This patch stores the server-id of the REQUEST in SELECTING, and
compares it with the server-id from NAKs, to discard other servers'
replies.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1144
(cherry picked from commit 118561e284)
(cherry picked from commit 3abfdbab33)
(cherry picked from commit c499412ec4)
(cherry picked from commit bfca239a27)
2022-03-24 15:55:51 +01:00
Beniamino Galvani
5f9921182e 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)
(cherry picked from commit 02adbf5124)
2021-12-01 14:59:52 +01:00
Vojtech Bubela
af3dadf95c 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)
(cherry picked from commit 00723dd5e8)
2021-12-01 14:57:20 +01:00
Thomas Haller
e8d39ebf0f cloud-setup: merge branch 'th/cloud-setup-azure-fix-gateway'
https://bugzilla.redhat.com/show_bug.cgi?id=1912236

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

(cherry picked from commit 840d46b34c)
2021-10-14 14:34:57 -03:00
Thomas Haller
5d112092bc cloud-setup/azure: fix detecting the gateway address
The code never set "iface_get_config->cidr_addr", despite
setting "cidr_prefix" and "has_cidr". As a result, cloud-setup
would think that the subnet is "0.0.0.0/$PLEN", and calculate
the gateway as "0.0.0.1".

As a result it would add a default route to table 30400 via 0.0.0.1,
which is obviously wrong.

How to detect the right gateway? Let's try obtain the subnet also via
the meta data. That seems mostly correct, except that we only access
subnet at index 0. What if there are multiple ones? I don't know.

https://bugzilla.redhat.com/show_bug.cgi?id=1912236
(cherry picked from commit c2629f72b0)
2021-10-14 13:02:00 -03:00
Thomas Haller
783d470b6f cloud-setup/azure: refactor callback for _get_config_ips_prefix_list_cb()
(cherry picked from commit 889498c12c)
2021-10-14 12:59:19 -03:00
Thomas Haller
57c6a4fddc cloud-setup/azure: cleanup constructing URI in _get_config_ips_prefix_list_cb()
(cherry picked from commit c9fc3f5b03)
2021-10-14 07:24:30 -03:00
Thomas Haller
3256239b1f cloud-setup: remove redundant check in Azure's _get_net_ifaces_list_cb()
This condition always true, because there is a check above.

(cherry picked from commit d3f07d5ca2)
2021-10-14 07:23:49 -03:00
Fernando Fernández Mancera
9366a4404f cloud-setup: merge branch 'backport_1_30_mr_974'
NetworkManager/NetworkManager!987
2021-10-05 08:47:23 +00:00
Fernando Fernandez Mancera
9cb01cdefd cloud-setup: follow the clang-format
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2021-10-05 09:35:48 +02:00
Thomas Haller
6fef8c7235 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)
(cherry picked from commit 58e58361bd)
2021-10-05 09:35:48 +02:00
Thomas Haller
b33eac5281 cloud-setup: cleanup configuring addresses/routes/rules in _nmc_mangle_connection()
(cherry picked from commit 0978be5e43)
(cherry picked from commit ce24b4bca5)
2021-10-05 09:35:48 +02:00
Wen Liang
a9e6aa663e aliyun: reuse ipv4 gateway address returned by metadata server
The default ipv4 gateway address of the VPC in Aliyun cloud is not the
first IP address in the CIDR subnet block, we should instead use the
ipv4 gateway address retrieved from the metadata server in
`_nmc_mangle_connection()`.

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

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

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
(cherry picked from commit 778e1f8493)
(cherry picked from commit 59633dbe11)
2021-10-05 09:35:48 +02:00
Thomas Haller
661da869b3 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)
(cherry picked from commit 292233e16e)
2021-10-05 09:35:48 +02:00
Thomas Haller
67a83b54cd 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)
(cherry picked from commit 6302cd416d)
2021-10-05 09:35:48 +02:00
Thomas Haller
48e79fb4b2 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)
(cherry picked from commit 0a2ed62703)
2021-10-05 09:35:48 +02:00
Thomas Haller
c36e42dbd9 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)
(cherry picked from commit cc289e5369)
2021-10-05 09:35:48 +02:00
Thomas Haller
8bad924931 cloud-setup/trivial: rename variables in Azure's _get_config_fetch_done_cb()
The previous name seem not very expressive/fitting. Naming is hard, but
I think these are better names.

(cherry picked from commit 89f3267859)
2021-10-05 09:35:48 +02:00
Thomas Haller
91ddd5f5ba cloud-setup: use _nm_utils_ascii_str_to_int64_bin() in Azure's _get_config_fetch_done_cb()
(cherry picked from commit a2fded3cee)
2021-10-05 09:35:48 +02:00
Thomas Haller
2e4b73c7fe 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)
(cherry picked from commit 8bc8a0f56b)
2021-10-05 09:35:48 +02:00
Thomas Haller
2b96e9314c cloud-setup: preserve IPv4 addresses/routes/rules from profile
nm-cloud-setup automatically detects routes, addresses and rules and configures them
on the device using the emphermal Reapply() API. That is, it does not modify the
existing profile (on disk), but changes the runtime configuration only.

As such, it used to wipe otherwise statically configured IP addresses, routes and
rules. That seems unnecessary. Let's keep the configuration from the (persistent)
configuration.

There is of course the problem that nm-cloud-setup doesn't really
understand the existing IP configuration, and it can only hope that
it can be meaningfully combined with what nm-cloud-setup wants to
configure. This should cover most simple cases, for more complex setups,
the user probably should disable nm-cloud-setup and configure the
network explicitly to their liking.

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/893
(cherry picked from commit 4201ee5119)
(cherry picked from commit 9541b0bea4)
2021-10-05 09:35:48 +02:00
Thomas Haller
ef7a97977a cloud-setup: count numbers of valid IPv4 addresses in get-config result
Will be used next.

(cherry picked from commit 7969ae1a82)
(cherry picked from commit ae504433f1)
2021-10-05 09:35:48 +02:00
Thomas Haller
7fcc89db6e 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)
(cherry picked from commit e74375fc3b)
2021-10-05 09:35:48 +02:00
Thomas Haller
b2ed9e7d5d 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)
(cherry picked from commit c94b1c43d4)
2021-10-05 09:35:48 +02:00
Thomas Haller
2585e34e59 libnm: expose nm_ip_address_dup(), nm_ip_route_dup() API in libnm
This fixes commit 21c8a6b20e ('libnm-core, all: merge IPv4 and IPv6
address/route types'), which introduced this API but didn't export it
in the library. In practice this API is thus only usable since 1.32.0.

(cherry picked from commit 05f2a0b024)
(cherry picked from commit eea912dfb3)
2021-10-05 09:35:48 +02:00
Thomas Haller
b8bb585052 glib-aux: add _nm_utils_ascii_str_to_int64_bin() helper
(cherry picked from commit 70b7ad1a76)
2021-10-05 09:35:48 +02:00
Beniamino Galvani
d01912d2fc 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)
(cherry picked from commit ce8eb446b4)
2021-09-20 10:38:46 +02:00
Beniamino Galvani
183f2a1a59 merge: branch 'bg/rh1961666'
https://bugzilla.redhat.com/show_bug.cgi?id=1961666
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/966
(cherry picked from commit 9330d29a68)
(cherry picked from commit 5dfd80683d)
2021-09-07 16:29:25 +02:00
Beniamino Galvani
3565f155fb initrd: set required-timeout for default IPv4 configuration
If the kernel command-line doesn't contain an explict ip=$method,
currently the generator creates connections with both IPv4 and IPv6
set to 'auto', and both allowed to fail.

Since NM is run in configure-and-quit mode in the initrd, NM can get
an IPv4 address or an IPv6 one (or both) depending on which address
family is quicker to complete. This unpredictable behavior is not
present in the legacy module, which always does IPv4 only by default.

Set a required-timeout of 20 seconds for IPv4, so that NM will
preferably get an IPv4, or will fall back to IPv6.

See also: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/729

(cherry picked from commit 0a18e97345)
(cherry picked from commit 1b9cf8c513)
2021-09-06 10:56:12 +02:00
Beniamino Galvani
65868803e0 device: use the 'required-timeout' property from IP setting
Change the logic in check_ip_state() to delay the connection ACTIVATED
state if an address family is pending and its required-timeout has not
expired.

(cherry picked from commit 35cccc41cb)
(cherry picked from commit 51e5df275c)
2021-09-06 10:56:12 +02:00
Beniamino Galvani
253de76195 all: add a new ipv{4,6}.required-timeout property
Add a new property to specify the minimum time interval in
milliseconds for which dynamic IP configuration should be tried before
the connection succeeds.

This property is useful for example if both IPv4 and IPv6 are enabled
and are allowed to fail. Normally the connection succeeds as soon as
one of the two address families completes; by setting a required
timeout for e.g. IPv4, one can ensure that even if IP6 succeeds
earlier than IPv4, NetworkManager waits some time for IPv4 before the
connection becomes active.

(cherry picked from commit cb5960cef7)
(cherry picked from commit 08ce20481c)
2021-09-06 10:56:12 +02:00
Beniamino Galvani
671dc82f94 initrd: rename NMI_WAIT_DEVICE_TIMEOUT_MS to _MSEC
(cherry picked from commit fa42ba9df2)
(cherry picked from commit f2d9f4bf66)
2021-08-20 10:48:19 +02:00
Thomas Haller
660932163f glib-aux: fix thread-safe initialization in _nm_g_source_sentinel_get_init()
Fixes: ce7c28c514 ('glib-aux: add nm_g_source_sentinel_get() util')
(cherry picked from commit 2140bbf7f5)
(cherry picked from commit c37f72acd3)
2021-08-20 10:48:19 +02:00
Thomas Haller
bd7cbd5770 glib-aux/tests: avoid coverity warning in test_nm_g_source_sentinel()
Coverity wrongly think there is a use after free in the test:

    Error: USE_AFTER_FREE (CWE-416): [#def559] [important]
    NetworkManager-1.31.90/src/libnm-glib-aux/tests/test-shared-general.c:1305: alias: Assigning: "s1" = "_s". Now both point to the same storage.
    NetworkManager-1.31.90/src/libnm-glib-aux/tests/test-shared-general.c:1324: freed_arg: "g_source_unref" frees "s1".
    NetworkManager-1.31.90/src/libnm-glib-aux/tests/test-shared-general.c:1330: deref_after_free: Dereferencing freed pointer "s1".
    # 1328|               s2 = nm_g_source_sentinel_get(0);
    # 1329|               g_assert(s2 == s1);
    # 1330|->             g_assert_cmpint(g_atomic_int_get(&s1->ref_count), >=, 1);
    # 1331|           }
    # 1332|       }

Rework the code in the hope to avoid the false warning.

(cherry picked from commit 7825609f1f)
(cherry picked from commit c47c823c9d)
2021-08-20 10:23:03 +02:00
Thomas Haller
3a58255247 glib-aux: add nm_g_source_sentinel_get() util
This helper is useful to get a dummy GSource instance that can be
refed, unrefed and destroyed. It can act as a replacement for
a timeout source with infinite timeout.

(cherry picked from commit ce7c28c514)
2021-08-20 10:23:03 +02:00
Thomas Haller
f8645d6a86 initrd: cleanup parsing DNS in reader_parse_ip()
(cherry picked from commit e258410c87)
2021-08-20 10:23:03 +02:00
Beniamino Galvani
ce02f56356 libnm: add NM_VERSION_1_30_8 2021-08-20 09:44:18 +02:00
Beniamino Galvani
9121b961eb device: store the original MTU before force-setting it
In case the MTU is force-set (e.g. for bridges), priv->mtu_initial and
priv->ip6_mtu_initial must be initialized before changing the MTU,
otherwise the wrong value will be restored on deactivation.

Fixes: e23798a5e5 ('bridge: force (hack)-set of the MTU when explicitly set in the profile')

https://bugzilla.redhat.com/show_bug.cgi?id=1973536
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/955
(cherry picked from commit 3f42e2005a)
(cherry picked from commit 7730547721)
2021-08-06 15:41:57 +02:00
Beniamino Galvani
ca122d1a14 release: bump version to 1.30.7 (development) 2021-07-16 22:08:23 +02:00
Beniamino Galvani
427f58466b release: bump version to 1.30.6 2021-07-16 22:08:23 +02:00
Beniamino Galvani
edec742209 NEWS: update 2021-07-16 18:42:52 +02:00
Thomas Haller
9eb912ead1 libnm: fix memleak setting "ipv[46].dhcp-iaid" property
Fixes: 56a1a5426a ('all: add ipvX.dhcp-iaid properties')
(cherry picked from commit 47cdcb3ce2)
(cherry picked from commit 7aa2214014)
2021-07-16 18:40:00 +02:00
Thomas Haller
cd619a5c92 glib-aux: fix releasing thead-local GRand instance from nm_utils_random_bytes()
Fixes: b01a453ca2 ('core: add nm_utils_random_bytes() and use getrandom()')
(cherry picked from commit c127e1becc)
(cherry picked from commit 3de83dd25c)
2021-07-16 18:40:00 +02:00