Commit graph

33572 commits

Author SHA1 Message Date
Wen Liang
51ea910cc2 device: Support configuring dhcp-send-hostname globally
The user does not want to send machine hostname to the DHCP server
globally by default to avoid ddns record getting created in IPAM.
otherwise, IPAM creates ddns records which might interfere with user's
regular host record. Thus, introduce the ternary property
dhcp_send_hostname_v2 to warrant this behavior.

Notice that we set the GSpec of dhcp-send-hostname-v2 to int, because
defining it as enum would make that it cannot be expanded in a backwards
compatible way if we need to add more values: old clients using libnm
would reject it due to the new value being unknown. Follow the same
strategy than _nm_setting_property_define_direct_enum, defining the
NMSettInfoPropertType as enum, but the glib's GSpec as int.

Resolves: https://issues.redhat.com/browse/RHEL-56565
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2029
https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/-/merge_requests/1765
2024-10-24 17:03:10 -04:00
Íñigo Huguet
2bbedbcf7d merge: branch 'ih/nmcs-oci'
cloud-setup: Add OCI (Oracle Cloud) provider

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2056
2024-10-24 14:16:23 +00:00
Íñigo Huguet
4024e5c612 cloud-setup: Add OCI (Oracle Cloud) provider
Initial support for OCI. It doesn't support VLAN configuration yet as
the requirements are not clear. It doesn't support secondary IP
addresses because the IMDS server doesn't expose them.

Instead of using plain text format, it gets a single response in JSON
format and parses it. The dependency to jansson is now mandatory for
that.
2024-10-24 16:14:48 +02:00
Beniamino Galvani
e4c3d46572 merge: branch 'bg/dns-routes'
Support automatically adding DNS routes

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

https://issues.redhat.com/browse/RHEL-56555
2024-10-23 13:45:29 +00:00
Beniamino Galvani
967fed4982 NEWS: update 2024-10-23 15:38:37 +02:00
Beniamino Galvani
5449b18a94 core: support automatically adding DNS routes
When the "ipvX.routed-dns" property is set to true, add a route for
each DNS server via the current interface. The feature works in the
following way.

A new routing rule is created ("priority $PRIO not fwmark $MARK lookup
$TABLE") where $PRIO, $MARK and $TABLE are fixed values and are the
same for all interfaces. This rule is evaluated before standard rules
and tries to look up routes in table $TABLE, where NM adds the routes
to DNS servers.

To determine the next-hop to the name server, NM issues a RTM_GETROUTE
netlink request to kernel, specifying to return the route via the
current interface. In order to avoid results from $TABLE, NM also sets
the fwmark as $MARK in the request.
2024-10-23 15:38:36 +02:00
Beniamino Galvani
5122ba48ef l3cfg: add flag 'routed-dns' to NML3ConfigData 2024-10-23 15:38:35 +02:00
Beniamino Galvani
4e37e4c614 device: remove 'const' qualifier from function signature
nm_device_create_l3_config_data_from_connection() returns an unsealed
NML3ConfigData that can still be modified afterwards.
2024-10-23 15:38:34 +02:00
Beniamino Galvani
0e5815ba84 libnm: add new property "ipvX.routed-dns" 2024-10-23 15:38:33 +02:00
Beniamino Galvani
45535cbf9f platform: support specifying the fwmark in ip_route_get()
Add an optional argument to specify the fwmark, which will be used in
the next commits to return results that match a specific rule.
2024-10-23 15:06:59 +02:00
Beniamino Galvani
5c075eb762 device: emit the "l3cd-changed" signal after commit
I think the current semantics of the NMDevice's "l3cd-changed" signal
is not useful, as it reports that the layer-3 configuration changed
before it is committed to platform.

In this way, the only current subscriber (NMPolicy), reacts to the
change too early: it updates the DNS servers in the system when the
interface doesn't have yet addresses and routes ready. Therefore, the
resolver (libc, systemd-resolved, ...) will try to contact the DNS
server using the wrong parameters.

Change the semantics so that the signal is emitted *after* the commit
to platform.
2024-10-23 15:06:59 +02:00
Beniamino Galvani
3eb45c1d40 l3cfg: simplify signals
During a commit of layer-3 configuration, multiple signals are
emitted:

 - if the combined l3cd configuration changes, we first emit a
   L3CD_CHANGED signal, with flag `commited` FALSE;
 - if the previously committed configuration is different from the one
   we want to commit, we emit again the same signal with `commited`
   TRUE;
 - a PRE_COMMIT signal
 - a POST_COMMIT signal

The usefulness of the first and third signals is questionable: there
is no need to signal that the configuration changes if we are not
going to commit it. Also, PRE_COMMIT is redundant as we just emitted
L3CD_CHANGED. Nobody is using those 2 signals.

Simplify this by leaving only PRE_COMMIT and POST_COMMIT, which are
always emitted during a commit and provide information on the l3cd
changes.

This commit doesn't change behavior.
2024-10-23 15:06:58 +02:00
Beniamino Galvani
3e93134c04 checkpatch: silence warning about direct properties for the IP setting
Since NMSettingIPConfig is an abstract type that cannot be
instantiated, the overrides for the direct properties are defined on
the subclasses (NMSettingIP4Config and NMSettingIP6Config).

Silence the warning about using direct properties.
2024-10-23 15:06:58 +02:00
Beniamino Galvani
d6684269fa merge: branch 'bg/dhcpv4-ipv6-only'
Add support for the "IPv6-Only Preferred" DHCPv4 option

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

https://issues.redhat.com/browse/RHEL-58660
2024-10-23 13:04:12 +00:00
Beniamino Galvani
fe1a1b39d4 NEWS: update 2024-10-23 15:01:21 +02:00
Beniamino Galvani
2c373ec9ed dhcp: allow changing MIN_V6ONLY_WAIT via environment variable
When performing integration tests for the IPv6-only DHCP option, we
want to test that the option is honored and that NM restarts DHCP if
the option goes away. However, the minimum wait time according to the
RFC is 5 minutes, which makes the test take long time.

Allow changing the value via the "NM_TEST_IPV6_ONLY_MIN_WAIT"
environment variable.
2024-10-23 15:01:20 +02:00
Beniamino Galvani
03c01eae29 device: configure IPv6-only-preferred mode in the DHCP client
Configure the DHCP client to enable the IPv6-only-preferred mode based
on the content of the profile and on global configuration.
2024-10-23 15:01:20 +02:00
Beniamino Galvani
022b7ac184 dhcp: support the IPv6-Only Preferred option
Add support for handling the IPv6-Only Preferred option. When enabled,
the client adds the option code to the "Parameter Request List" option
of the DHCPDISCOVER and DHCPREQUEST messages. If the server sends the
option back in the DHCPOFFER and DHCPACK, the host stops the DHCP
client for the time interval specified in the option. After the
timeout expires, DHCP is restarted.
2024-10-23 15:01:19 +02:00
Beniamino Galvani
1fa08e7d1b dhcp: add function nm_dhcp_lease_data_parse_u32()
Add a function to parse 32-bit integer values from a DHCP option.
2024-10-23 15:01:19 +02:00
Beniamino Galvani
1db882ca63 dhcp: allow the plugin to be restarted
In the next commit, a mechanism will be added to stop the DHCP plugin
and restart it without destroying the NMDhcpClient object. For this to
work, we must reset some members of the object when stopping or
starting the plugin.
2024-10-23 15:01:18 +02:00
Beniamino Galvani
b6676aa8ef libnm,nmcli: introduce new ipv4.dhcp-ipv6-only-preferred property
Add a new "ipv4.dhcp-ipv6-only-preferred" property to control the
"IPv6-Only Preferred" DHCPv4 option (RFC 8925). The option indicates
that a host supports an IPv6-only mode and is willing to forgo
obtaining an IPv4 address if the network provides IPv6 connectivity.
2024-10-23 15:01:18 +02:00
Beniamino Galvani
d4af66b298 device: store the effective IP method
Store the effective IP method computed by evaluating the profile,
checking kernel support, or querying device's method
get_ip_method_auto().

The value will be used in a next commit to enable or disable features.
2024-10-23 14:56:41 +02:00
Beniamino Galvani
4af6cf592a nmcli: fix handling of connection.down-on-poweroff property
Fix the following error:

  $ nmcli connection modify C connection.down-on-poweroff yes
  **
  nm:ERROR:../src/libnmc-setting/nm-meta-setting-desc.c:1367:_set_fcn_gobject_ternary: assertion failed: (_gobject_property_get_gtype(G_OBJECT(setting), property_info->property_name) == NM_TYPE_TERNARY)
  Bail out! nm:ERROR:../src/libnmc-setting/nm-meta-setting-desc.c:1367:_set_fcn_gobject_ternary: assertion failed: (_gobject_property_get_gtype(G_OBJECT(setting), property_info->property_name) == NM_TYPE_TERNARY)

Fixes: bd38a19832 ('connection: add support to down-on-poweroff')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2055
2024-10-22 10:50:20 +02:00
Gris Ge
3cb9991fc8 merge: branch 'fix_sriov'
sriov: only valid sriov capacity when enabled

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2051
2024-10-22 02:16:20 +00:00
Gris Ge
421ccf8b4c sriov: only valid sriov capacity when enabled
NetworkManager current code will refuse to activate a connection if its
interface has no SRIOV capacity but holding a empty SRIOV settings.

This patch only valid SRIOV capacity when it is enabled(total_vfs > 0).

Resolves: https://issues.redhat.com/browse/RHEL-58397

Signed-off-by: Gris Ge <fge@redhat.com>
2024-10-21 21:14:11 +08:00
Fernando Fernandez Mancera
c691dd7ecf bonding: steer IGMP queries to the active bond balance-slb primary port
Add chains and rules to steer the IGMP reports to the primary member
port. This rules are adapted from the script provided by Eric Garver.

https://gitlab.com/egarver/virtual-networking/-/blob/master/mlag.sh

Fixes: e9268e3924 ('firewall: add mlag firewall utils for multi chassis link aggregation (MLAG) for bonding-slb')
2024-10-18 11:50:04 +02:00
Íñigo Huguet
88b160cbcc merge: branch 'initial-eps-bearer-settings'
-Added additional initial eps bearer settings

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1915
2024-10-17 06:01:41 +00:00
Íñigo Huguet
c0ac672336 NEWS: update with LTE's EPS bearer changes 2024-10-17 07:56:04 +02:00
Josef Ouano
a47d44cffd wwan: added additional initial eps bearer settings
Added the following settings for initial EPS bearer:
- Username
- Password
- Allowed Auth
- APN Type Setting
2024-10-17 07:53:49 +02:00
Íñigo Huguet
00971b599b merge: branch 'feature/configurable-nmcli-history-file'
nmcli: Move history file to `$XDG_CACHE_HOME`

Closes #1615

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2027
2024-10-14 11:38:39 +00:00
Andreas Hartmann
107730a6a4 NEWS: mention relocation of .nmcli-history. 2024-10-14 11:38:04 +00:00
Andreas Hartmann
66e21700ea nmcli: Move .nmcli-history
from its previous location unter the users `$HOME` directory to
`$XDG_CACHE_HOME/nmcli-history`. This makes `nmcli` compliant with the
[XDG Base Directory Specification][1].

[1]: https://specifications.freedesktop.org/basedir-spec/latest/
2024-10-14 11:38:04 +00:00
Íñigo Huguet
a2abc85504 merge: branch 'nmcli-ask-c-u'
make `nmcli --ask c u` behave as intended

Closes #1618

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2042
2024-10-14 11:24:07 +00:00
Amelia Miner
b9d8f6c4da make nmcli --ask c u behave as intended 2024-10-14 11:24:07 +00:00
Íñigo Huguet
92a2f31531 merge: branch 'ih/ipcalc'
contrib/rpm: Add ipcalc dependency to dispatcher-routing-roules

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2052
2024-10-11 13:55:38 +00:00
Íñigo Huguet
5792038572 contrib/rpm: Add ipcalc dependency to dispatcher-routing-roules
The dispatcher script uses it.
2024-10-11 12:14:50 +02:00
Lubomir Rintel
f5a723ae50 test: check validity of systemd service files
This spots errors like what commit a531458456 ('cloud-setup: fix
placement of directives in the systemd unit') fixes.

This is what a failure would look like:

   5/74 check-nm-cloud-setup.service     FAIL     0.05s   exit status 1
  >>> ...  /bin/bash src/tests/check-systemd-service.sh
      build/src/nm-cloud-setup/nm-cloud-setup.service
  ―――――――――――――――――――――― ✀  ―――――――――――――――――――――――
  build/src/nm-cloud-setup/nm-cloud-setup.service:19:
      Unknown key 'StartLimitIntervalSec' in section [Service], ignoring.

https://issues.redhat.com/browse/RHEL-56860
https://issues.redhat.com/browse/RHEL-49694
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/pipelines/1284415
2024-10-10 01:49:33 +02:00
Íñigo Huguet
c7e0668c27 merge: branch 'ff/fix_unit_test'
fedora: install ethtool explicitly

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2049
2024-10-08 07:31:36 +00:00
Fernando Fernandez Mancera
5f54ced2ee fedora: install ethtool explicitly
Some container images do not have ethtool installed by default and it is
needed for a test-core unit test to run.
2024-10-07 14:09:42 +02:00
Lubomir Rintel
f306d6a2ce merge: branch 'lr/editor-load'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2037
2024-10-05 23:08:13 +02:00
Lubomir Rintel
ecf1e8716c libnm/vpn-editor-plugin: add a comment on a design blunder
VPN plugin factory can never fail, it always returns an object, much
like g_object_new(). If the (GUI) editor is unavailable, it might be
okay for some use cases, notably import()/export(). In such case, the
absence of GUI editor is indicated via capability flags.
2024-10-05 23:06:58 +02:00
Lubomir Rintel
a1a9a6509e libnm/vpn-editor-plugin: add a flag to indicate lack of GUI editor 2024-10-05 23:06:58 +02:00
Lubomir Rintel
c09edb8293 libnm/vpn-editor-plugin: formatting fixes
Fix up a slightly unpleasant comment and docstring formatting.
2024-10-05 23:06:58 +02:00
Lubomir Rintel
1f091945da contrib/nm-vpn-plugin-utils: split editor plugin lookup and load
nm-connection-editor (and presumably the Control Center) expects the
nm_vpn_editor_plugin_factory() to fail if the editor plugin (the thing
that goes into the *-gnome subpackage in Fedora) is not installed.

However, factory() never fails, because the plugin is checked for
existence only when get_editor() is called.
2024-10-05 23:06:58 +02:00
Lubomir Rintel
6747b1c0b8 libnm/vpn-service-plugin: flush D-Bus connection before signalling quit
The plugins tend to exit right away after receiving the "quit" signal,
which may come before the ConnectInteractive() response went out.
This may make NM miss the response, and the error details it contains.

Let's make sure we flush the pending traffic out.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2045
2024-10-05 23:03:13 +02:00
Beniamino Galvani
bb6881f88c format: run nm-code-format
Reformat with:

  clang-format version 19.1.0 (Fedora 19.1.0-1.fc41)

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2046
2024-10-04 11:07:35 +02:00
Fernando Fernandez Mancera
09e822edba release: bump version to 1.51.2 (development) 2024-09-28 22:04:20 +02:00
Beniamino Galvani
a8329587c8 device: fix bug when deactivating port connections asynchronously
When the attach_port()/detach_port() methods do not return immediately
(currently, only for OVS ports), the following situation can arise:

 - nm_device_controller_attach_port() starts the attachment by sending
   the command to ovsdb. Note that here we don't set
   `PortInfo->port_is_attached` to TRUE yet; that happens only after
   the asynchronous command returns;

 - the activation of the port gets interrupted because the connection
   is deleted;

 - the port device enters the deactivating state, triggering function
   port_state_changed()

 - the function calls nm_device_controller_release_port() which checks
   whether the port is already attached; since
   `PortInfo->port_is_attached` is not set yet, it assumes the port
   doesn't need to be detached;

 - in the meantime, the ovsdb operation succeeds. As a consequence,
   the kernel link is created even if the connection no longer exists.

Fix this by turning `port_is_attached` into a tri-state variable that
also tracks when the port is attaching. When it is, we need to perform
an explicit detach during deactivation.

Fixes: 9fcbc6b37d ('device: make attach_port() asynchronous')

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

Resolves: https://issues.redhat.com/browse/RHEL-58026
2024-09-26 15:02:59 +02:00
Íñigo Huguet
0567cfe367 triage: fix typo atention -> attention 2024-09-26 11:04:51 +02:00
Íñigo Huguet
bd177f6d45 merge: branch 'ih/ensure-ci-external-contributor'
triage: ensure that CI is run for MRs from community

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2041
2024-09-26 08:40:21 +00:00