Commit graph

28734 commits

Author SHA1 Message Date
Thomas Haller
921cfd8ef1
release: bump version to 1.32.8 2021-08-10 19:16:43 +02:00
Thomas Haller
c37f72acd3
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)
2021-08-10 19:15:07 +02:00
Thomas Haller
ef3b773bc3
NEWS: update 2021-08-10 16:20:17 +02:00
Wen Liang
59633dbe11
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)
2021-08-09 17:16:07 +02:00
Ana Cabral
0e7d260852
.gitignore: include files used by eclipse-cdt IDE
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/957
(cherry picked from commit e6583941b1)
2021-08-06 20:19:47 +02:00
Beniamino Galvani
7730547721 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)
2021-08-06 15:37:23 +02:00
Thomas Haller
780f89720d
firewalld: fix build error due to nm_utils_strdup_reset() 2021-08-06 14:43:35 +02:00
Thomas Haller
f915a43eb2
firewalld: merge branch 'th/firewalld-reloaded'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/949

(cherry picked from commit a9279d1e89)
2021-08-06 14:38:36 +02:00
Thomas Haller
d409a3c230
firewalld: listen to Reloaded signal and reconfigure firewall zones
During reload, firewalld drops the current runtime configuration.
NetworkManager should listen to that, and reconfigure the zones
that it cares about.

(cherry picked from commit 0f100abd85)
2021-08-06 14:38:35 +02:00
Thomas Haller
424535093c
firewalld: fix initialized_now argument for NMFirewalldManager's "state-changed" signal
(cherry picked from commit b2ed02dda9)
2021-08-06 14:38:35 +02:00
Thomas Haller
17312aa25c
firewalld: make D-Bus calls against unique name for firewalld service
As we keep track of the current name owner, use its unique name
for the D-Bus requests.

We also track when the name owner changes, so at the point when we make
the D-Bus call, the current name owner was still running. We should talk
to it directly. If at the same time, firewalld restarts, we go through
our usual tracking of the name owner and will retry -- but always
talking to the unique name.

(cherry picked from commit 3d949f98e4)
2021-08-06 14:38:35 +02:00
Thomas Haller
500c66551a
firewalld: track current name_owner in NMFirewalldManager
Not only track whether we have a name-owner, but also which.

(cherry picked from commit 9debc3d028)
2021-08-06 14:38:35 +02:00
Thomas Haller
78cc70feb3
firewalld: prefix firewalld logging messages with "firewalld"
It seems more apt than "firewall: ...".

(cherry picked from commit b55f95abfa)
2021-08-06 14:38:35 +02:00
Thomas Haller
a7a0404cb5
man: update URL for networkmanager.dev home page
(cherry picked from commit 7a39f1f7e7)
2021-08-03 14:58:08 +02:00
Thomas Haller
788c13c94f
release: bump version to 1.32.7 (development) 2021-07-28 18:00:18 +02:00
Thomas Haller
dd3f3cb9e5
release: bump version to 1.32.6 2021-07-28 18:00:18 +02:00
Thomas Haller
7521ede1ad
initrd: fix handling "ip=single-dhcp:..." in reader_parse_ip()
Fixes: bf7530ccc1 ('initrd: honor "ip=single-dhcp" option as alias for "dhcp"')
(cherry picked from commit 22d6be54f3)
2021-07-28 17:56:58 +02:00
Thomas Haller
404272b152
NEWS: update 2021-07-28 17:26:28 +02:00
Beniamino Galvani
2188c00ed4 merge: branch 'bg/rh1934122'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/862

(cherry picked from commit 2d879c1ac5)
2021-07-27 17:51:10 +02:00
Beniamino Galvani
72f6edb01d core: introduce device 'allowed-connections' property
Configuration can have [device*] and [connection*] settings and both
can include a 'match-device=' key, which is a list of device-specs.

Introduce a new 'allowed-connections' key for [device*] sections,
which specifies a list of connection-specs to indicate which
connections can be activated on the device.

With this, it becomes possible to have a device configuration like:

  [device-enp1s0]
  match-device=interface-name:enp1s0
  allowed-connections=except:origin:nm-initrd-generator

so that NM in the real root ignores connections created by the
nm-initrd-generator, and starts activating a persistent
connection. This requires also setting 'keep-configuration=no' to not
generate an assumed connection.

(cherry picked from commit bace14fe1f)
2021-07-27 17:51:10 +02:00
Beniamino Galvani
7ca6e9d687 core: add nm_utils_connection_match_spec_list()
Add function nm_utils_connection_match_spec_list() to check whether a
connection matches a spec list. Also document the supported syntax in
the man page.

(cherry picked from commit 604c611cd0)
2021-07-27 17:51:10 +02:00
Beniamino Galvani
1a0f7e1bd3 initrd: add a 'origin' user tag to connections
Introduce a user tag key to indicate where the connection comes
from. It would also be possible to have this as a standard property
(as 'connection.origin'), but since this information can be considered
'meta-data' I think the user setting is more appropriate.

(cherry picked from commit 86f22ce8ba)
2021-07-27 17:51:10 +02:00
Beniamino Galvani
165daca280 core: add 'keep-configuration' device configuration option
Add a new 'keep-configuration' device option, set to 'yes' by
default. When set to 'no', on startup NetworkManager ignores that the
interface is pre-configured and doesn't try to keep its
configuration. Instead, it activates one of the persistent
connections.

(cherry picked from commit df2fe15714)
2021-07-27 17:51:10 +02:00
Beniamino Galvani
a2f9e11942 manager: exit early in get_existing_connection()
Later the function will become more complex. Add a check to exit early
if the device can't assume connections.

(cherry picked from commit b1644fa826)
2021-07-27 17:51:09 +02:00
Beniamino Galvani
bd114483b2 core: add comments about assuming connections
(cherry picked from commit bb37e30867)
2021-07-27 17:51:09 +02:00
Beniamino Galvani
9b704bf4bf merge: branch 'bg/dhcp-filename-rh1979387'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/929

(cherry picked from commit eaacfd249c)
2021-07-27 09:44:28 +02:00
Beniamino Galvani
69cd16e458 core: persist the bootfile from DHCP
The bootfile location is needed by the anaconda dracut module; write
it to the device state file.

(cherry picked from commit 9a09c02012)
2021-07-27 09:44:28 +02:00
Beniamino Galvani
b77a5bb7b0 dhcp: nettools: parse the filename and the bootfile-name option
(cherry picked from commit 3c79944e15)
2021-07-27 09:44:28 +02:00
Beniamino Galvani
50e65f8ce4 n-dhcp4: add an accessor for the file name in the lease
The name of the boot file can be either in option 67 or in a field of
the DHCP header. Add an accessor for the one from the DHCP header.

(cherry picked from commit 6a1349c5fb)
2021-07-27 09:44:28 +02:00
Beniamino Galvani
a4acfef3aa n-dhcp4: fix n_dhcp4_client_lease_get_server_identifier()
N_DHCP4_E_MALFORMED is an internal error code, replace it with
N_DHCP4_E_INTERNAL. Also, remove extra spaces.

(cherry picked from commit be6997d127)
2021-07-27 09:44:28 +02:00
Beniamino Galvani
667f2a5d76 dhcp: add internal option for the boot file name
Add an internal option that specifies the boot file name from the DHCP
header. The option name 'filename' is the same as exposed by dhclient.

(cherry picked from commit 0994a444e5)
2021-07-27 09:44:28 +02:00
Beniamino Galvani
5f85f1631b dhcp: escape control characters in DHCP options
Control characters (DEL (=127) or those below 32) could cause undesired
effects when a client displays or parses DHCP options. Escape them.

(cherry picked from commit 0c10e4f8b6)
2021-07-27 09:44:28 +02:00
Beniamino Galvani
8481470557 initrd: support infiniband pkeys
Introduce a new "ib.pkey=<parent>.<pkey>" command line argument to
create a Infiniband partition.

The new connection has IPv4 and IPv6 enabled by default. Unlike for
VLANs, the generator doesn't create a connection for the parent
Infiniband interface.

See also: https://github.com/dracutdevs/dracut/pull/1538

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/884
(cherry picked from commit 9060c14ccf)
2021-07-27 09:08:11 +02:00
Thomas Haller
c880b9eab9
initrd: honor "ip=single-dhcp" option as alias for "dhcp"
This mode was added to network-legacy in [1]. NetworkManager anyway always
does DHCP in parallel, so this is basically an alias for "dhcp".
Note that network-legacy's "single-dhcp" will stop waiting for DHCP
once the first device gets an address. NetworkManager currently cannot
do that. While it runs DHCP in parallel, all devices need to settle
and there is no concept where completing one device makes the overall
"startup complete" process finish early. That could however be added.

Anyway, while not being exactly the same, it's still more useful to do
something similar instead of not working at all.

See-also: https://github.com/dracutdevs/dracut/pull/853
See-also: https://github.com/dracutdevs/dracut/pull/961
See-also: https://github.com/dracutdevs/dracut/pull/1048

[1] 4026cd3b01

(cherry picked from commit bf7530ccc1)
2021-07-23 11:09:01 +02:00
Thomas Haller
d2075ac770
core: merge branch 'th/external-routes-no-sync'
https://bugzilla.redhat.com/show_bug.cgi?id=1979192

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

(cherry picked from commit 4ad4db6cf1)
2021-07-21 10:09:10 +02:00
Thomas Haller
6ee7be690e
platform: don't add routes that are tracked as external routes
Due to something that really should be fixed, NetworkManager merges the routes
that it wants to configure, with the routes that are configured externally.
This includes a subtract and merge dance, which is wrong.

Anyway. If we are in nm_platform_ip_route_sync(), then we never want to
actively configure a route, that we only have in the list because it is
(or was) present on the interface.

Otherwise we have a problem. Note that we make a plan which
routes/addresses to add/remove before starting. So, if we start with an
IPv4 address configured in kernel, then there is also a corresponding
local route. We would track that local route as external.
During sync, we first remove the IP address, and kernel automatically
also removes the local route. However, as we already made the plan to
keep that route, NetworkManager would wrongly configure it again.

This should fix that bug. It is anyway wrong to even try to explicitly
configure a route, that is purely in the list as being external.

https://bugzilla.redhat.com/show_bug.cgi?id=1979192#c11
(cherry picked from commit 13d749942f)
2021-07-21 10:09:09 +02:00
Thomas Haller
d009ee54ec
platform: mark routes in NMPlatform cache as "external"
(cherry picked from commit 1f1c7b82fd)
2021-07-21 10:09:09 +02:00
Thomas Haller
ed30b717ae
core: preserve "is_external" route flag during _nm_ip_config_add_obj()
(cherry picked from commit a6649ef87b)
2021-07-21 10:09:09 +02:00
Thomas Haller
643f9a3997
platform: add is-external flag to NMPlatformIPRoute
We will need to track whether a route is externally added or not.
We maybe could use rt_source for that, but instead add a boolean flag.

(cherry picked from commit dc0ac73780)
2021-07-21 10:09:09 +02:00
Thomas Haller
a09d26ccfd
release: bump version to 1.32.5 (development) 2021-07-20 17:02:22 +02:00
Thomas Haller
9c3fc0aca8
release: bump version to 1.32.4 2021-07-20 17:02:22 +02:00
Thomas Haller
03f4ebb889
cloud-setup: add nmcs_utils_uri_complete_interned() for constructing URI for _ec2_base()
(cherry picked from commit c6fefce8a4)
2021-07-20 16:12:34 +02:00
Thomas Haller
8b6b7a4a76
cloud-setup: fix constructing URL from NM_CLOUD_SETUP_EC2_HOST in _ec2_base()
(cherry picked from commit 78adf4796e)
2021-07-20 16:12:33 +02:00
Thomas Haller
d37a8b9db3
cloud-setup: drop unnecessary check in_detect_get_meta_data_done_cb()
(cherry picked from commit 791bb88646)
2021-07-20 16:12:31 +02:00
Thomas Haller
34c90f2d1a
NEWS: update 2021-07-20 15:58:00 +02:00
Thomas Haller
2f8b722c2b
libnm: mark symbols in libnm_1_32_4 linker symbol version as global
I think this has no effect in practice. But do it for consistency.
2021-07-20 15:57:59 +02:00
Wen Liang
243cf5a873
cloud-setup: configure secondary ip in Aliyun cloud
This is a tool for automatically configuring networking in Aliyun
cloud environment.

This add a provider implementation for Aliyun that when detected fetches
the private ip addressess and the subnet prefix of IPv4 CIDR block.

Once this information is fetched from the metadata server, it instructs
NetworkManager to add private ip addressess and subnet prefix for each
interface detected.

It is inspired by SuSE's cloud-netconfig ([1], [2]) and Aliyun Instance Metadata [3].

[1] https://www.suse.com/c/multi-nic-cloud-netconfig-ec2-azure/
[2] https://github.com/SUSE-Enceladus/cloud-netconfig
[3] https://www.alibabacloud.com/help/doc-detail/49122.htm

It is also intended to work without configuration. The main point is
that you boot an image with NetworkManager and nm-cloud-setup enabled,
and it just works.

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

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
(cherry picked from commit f3404435a9)
2021-07-19 17:49:53 +02:00
Thomas Haller
b2ef9f01fc
all: merge branch 'th/ascii-control-chars'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/932

(cherry picked from commit 299117f619)
2021-07-19 09:14:44 +02:00
Thomas Haller
4e64d4af1e
libnm: use nm_ascii_is_regular() in _keyfile_key_encode()
No change in behavior.

(cherry picked from commit cf9e7ee5aa)
2021-07-19 09:14:44 +02:00
Thomas Haller
e03587f9b0
libnm: use nm_ascii_is_ctrl_or_del() in nm_utils_fixup_product_string() to preserve UTF-8
On architectures where "char" is signed, the check "ch < ' '" is also
TRUE for characters greater than 127 (that is, UTF-8 characters).

Let's preserve valid UTF-8 characters and don't clear them.

Also note that already before we filtered out invalid UTF-8 sequences,
so if we encounter here a character > 127, it is part of a valid UTF-8
sequence.

(cherry picked from commit fb3e6cb0dc)
2021-07-19 09:14:43 +02:00