mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 05:18:23 +02:00
Compare commits
No commits in common. "main" and "1.57.2-dev" have entirely different histories.
main
...
1.57.2-dev
133 changed files with 21152 additions and 38059 deletions
|
|
@ -12,9 +12,9 @@ Please read
|
|||
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/CONTRIBUTING.md
|
||||
before opening the merge request. In particular, check that:
|
||||
|
||||
- [ ] The subject for all commits is concise, explanatory, and includes a prefix indicating the area of code changed (e.g., "nmcli: ", "core: ")
|
||||
- [ ] The message for all commits explains the reason for the change
|
||||
- [ ] The source is properly formatted
|
||||
- [ ] Any relevant documentation is up to date
|
||||
- [ ] You have added unit tests if applicable
|
||||
- [ ] The NEWS file is updated when the change deserves to be mentioned, for example for new features, behavior changes, API deprecations, etc.
|
||||
- [ ] the subject for all commits is concise and explicative
|
||||
- [ ] the message for all commits explains the reason for the change
|
||||
- [ ] the source is properly formatted
|
||||
- [ ] any relevant documentation is up to date
|
||||
- [ ] you have added unit tests if applicable
|
||||
- [ ] the NEWS file is updated when the change deserves to be mentioned, for example for new features, behavior changes, API deprecations, etc.
|
||||
|
|
|
|||
17
NEWS
17
NEWS
|
|
@ -12,14 +12,6 @@ USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
|
|||
suffixes when appropriate. This affects, for example, the URL and filename
|
||||
of the release tarball and the version reported by nmcli and the daemon.
|
||||
As an exception, the C API will continue to use the 90+ scheme for RC versions.
|
||||
* Connection profiles with manual IP addressing and with gateways that are not
|
||||
directly reachable will generate a warning on activation and when they are
|
||||
added/modified via nmcli and nmtui. NetworkManager currently adds on-link
|
||||
routes for them automatically, but this will change in the future. To fix the
|
||||
warning, users should add addresses or routes whose subnets cover these
|
||||
gateways. A gateway (either the default gateway or the next-hop of a route) is
|
||||
considered directly reachable if it falls within the subnet of a direct route
|
||||
(a route without a next hop) or of a prefix route from a static address.
|
||||
* Restrict the connectivity check to use the DNS servers defined on the
|
||||
same link. If the link has no DNS servers, the connectivity check will
|
||||
use any servers available in the system.
|
||||
|
|
@ -55,15 +47,6 @@ USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
|
|||
* WIFI connections using wpa-psk respect the setting connection.auth-retry
|
||||
and only prompt for new secrets during the last authentication attempt before
|
||||
failing.
|
||||
* Add support for GENEVE interface.
|
||||
* The DHCPv4 internal client now ignores option 3 (Router) if the lease
|
||||
contains option 121 (Classless Static Route), as recommended by RFC 3442.
|
||||
* Allow persisting the managed state across reboots from nmcli and the D-Bus API.
|
||||
* Allow changing the device's administrative state in the kernel at the same
|
||||
time as a change to the managed state from nmcli and the D-Bus API.
|
||||
* Allow configuring all bond options in nmtui by introducing a
|
||||
"other options" field, which covers options not already covered by a
|
||||
dedicated input field.
|
||||
|
||||
=============================================
|
||||
NetworkManager-1.56
|
||||
|
|
|
|||
|
|
@ -100,7 +100,11 @@ Release: __RELEASE_VERSION__%{?dist}
|
|||
%else
|
||||
%bcond_without iwd
|
||||
%endif
|
||||
%if 0%{?fedora} <= 43 || 0%{?rhel} <= 10
|
||||
%bcond_without polkit_noauth_group
|
||||
%else
|
||||
%bcond_with polkit_noauth_group
|
||||
%endif
|
||||
%ifarch %{ix86}
|
||||
# there is no bpftool in i686
|
||||
%bcond_with clat
|
||||
|
|
@ -174,7 +178,10 @@ Source9: readme-ifcfg-rh-migrated.txt
|
|||
#Patch1: 0001-some.patch
|
||||
|
||||
Requires(post): systemd
|
||||
Requires(post): systemd-udev
|
||||
Requires(post): /usr/sbin/update-alternatives
|
||||
Requires(preun): systemd
|
||||
Requires(preun): /usr/sbin/update-alternatives
|
||||
Requires(postun): systemd
|
||||
|
||||
Requires: dbus >= %{dbus_version}
|
||||
|
|
@ -559,8 +566,6 @@ Group: System Environment/Base
|
|||
BuildArch: noarch
|
||||
Requires: NetworkManager
|
||||
Requires: /usr/bin/nmcli
|
||||
Requires(post): /usr/sbin/update-alternatives
|
||||
Requires(preun): /usr/sbin/update-alternatives
|
||||
Obsoletes: NetworkManager < %{obsoletes_initscripts_updown}
|
||||
|
||||
%description initscripts-updown
|
||||
|
|
@ -839,12 +844,8 @@ fi
|
|||
|
||||
|
||||
%postun
|
||||
# skip triggering if udevd isn't even accessible, e.g. containers or
|
||||
# rpm-ostree-based systems
|
||||
if [ -S /run/udev/control ]; then
|
||||
/usr/bin/udevadm control --reload-rules || :
|
||||
/usr/bin/udevadm trigger --subsystem-match=net || :
|
||||
fi
|
||||
/usr/bin/udevadm control --reload-rules || :
|
||||
/usr/bin/udevadm trigger --subsystem-match=net || :
|
||||
%firewalld_reload
|
||||
|
||||
%systemd_postun %{systemd_units}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ _WITH_LIBTEAM="true"
|
|||
_WITH_DOCS="true"
|
||||
_WITH_SYSTEMD_LOGIND="true"
|
||||
_WITH_NBFT="true"
|
||||
_WITH_CLAT="true"
|
||||
if [ $IS_ALPINE = 1 ]; then
|
||||
_WITH_SYSTEMD_LOGIND="false"
|
||||
fi
|
||||
|
|
@ -64,14 +63,6 @@ if ! pkgconf 'libnvme >= 1.5'; then
|
|||
_WITH_NBFT="false"
|
||||
fi
|
||||
|
||||
if ! pkgconf 'libndp >= 1.9'; then
|
||||
_WITH_CLAT="false"
|
||||
fi
|
||||
|
||||
if ! pkgconf 'libbpf >= 1.3'; then
|
||||
_WITH_CLAT="false"
|
||||
fi
|
||||
|
||||
if [ -z "${NMTST_SEED_RAND+x}" ]; then
|
||||
NMTST_SEED_RAND="$SRANDOM"
|
||||
if [ -z "$NMTST_SEED_RAND" ]; then
|
||||
|
|
@ -204,7 +195,6 @@ meson setup build \
|
|||
-D ifupdown=true \
|
||||
\
|
||||
-D nbft=$_WITH_NBFT \
|
||||
-D clat=$_WITH_CLAT \
|
||||
\
|
||||
#end
|
||||
|
||||
|
|
|
|||
|
|
@ -21,16 +21,8 @@ TimeoutStartSec=600
|
|||
|
||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_DAC_OVERRIDE CAP_NET_RAW CAP_BPF CAP_NET_BIND_SERVICE CAP_SETGID CAP_SETUID CAP_SYS_MODULE CAP_AUDIT_WRITE CAP_KILL CAP_SYS_CHROOT
|
||||
|
||||
PrivateTmp=true
|
||||
|
||||
ProtectClock=true
|
||||
ProtectControlGroups=true
|
||||
ProtectHome=read-only
|
||||
ProtectKernelLogs=true
|
||||
ProtectSystem=true
|
||||
|
||||
RestrictRealtime=true
|
||||
RestrictSUIDSGID=true
|
||||
ProtectHome=read-only
|
||||
|
||||
# We require file descriptors for DHCP etc. When activating many interfaces,
|
||||
# the default limit of 1024 is easily reached.
|
||||
|
|
|
|||
|
|
@ -183,7 +183,6 @@
|
|||
<xi:include href="dbus-org.freedesktop.NetworkManager.Device.Bridge.xml"/>
|
||||
<xi:include href="dbus-org.freedesktop.NetworkManager.Device.Dummy.xml"/>
|
||||
<xi:include href="dbus-org.freedesktop.NetworkManager.Device.Generic.xml"/>
|
||||
<xi:include href="dbus-org.freedesktop.NetworkManager.Device.Geneve.xml"/>
|
||||
<xi:include href="dbus-org.freedesktop.NetworkManager.Device.Hsr.xml"/>
|
||||
<xi:include href="dbus-org.freedesktop.NetworkManager.Device.IPTunnel.xml"/>
|
||||
<xi:include href="dbus-org.freedesktop.NetworkManager.Device.Infiniband.xml"/>
|
||||
|
|
|
|||
|
|
@ -317,7 +317,6 @@ print ("NetworkManager version " + client.get_version())]]></programlisting></in
|
|||
<xi:include href="xml/nm-setting-dummy.xml"/>
|
||||
<xi:include href="xml/nm-setting-ethtool.xml"/>
|
||||
<xi:include href="xml/nm-setting-generic.xml"/>
|
||||
<xi:include href="xml/nm-setting-geneve.xml"/>
|
||||
<xi:include href="xml/nm-setting-gsm.xml"/>
|
||||
<xi:include href="xml/nm-setting-hostname.xml"/>
|
||||
<xi:include href="xml/nm-setting-hsr.xml"/>
|
||||
|
|
@ -378,7 +377,6 @@ print ("NetworkManager version " + client.get_version())]]></programlisting></in
|
|||
<xi:include href="xml/nm-device-dummy.xml"/>
|
||||
<xi:include href="xml/nm-device-ethernet.xml"/>
|
||||
<xi:include href="xml/nm-device-generic.xml"/>
|
||||
<xi:include href="xml/nm-device-geneve.xml"/>
|
||||
<xi:include href="xml/nm-device-hsr.xml"/>
|
||||
<xi:include href="xml/nm-device-infiniband.xml"/>
|
||||
<xi:include href="xml/nm-device-ip-tunnel.xml"/>
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@
|
|||
sodipodi:role="line"
|
||||
x="19.192902"
|
||||
y="360.40768"
|
||||
id="tspan3839">Retrieves, adds, and notifies of changes</tspan><tspan
|
||||
id="tspan3839">Retrieves, adds, and notifes of changes</tspan><tspan
|
||||
sodipodi:role="line"
|
||||
x="19.192902"
|
||||
y="372.90768"
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
|
|
@ -15,7 +15,6 @@ ifaces = [
|
|||
'org.freedesktop.NetworkManager.Device.Bridge',
|
||||
'org.freedesktop.NetworkManager.Device.Dummy',
|
||||
'org.freedesktop.NetworkManager.Device.Generic',
|
||||
'org.freedesktop.NetworkManager.Device.Geneve',
|
||||
'org.freedesktop.NetworkManager.Device.Hsr',
|
||||
'org.freedesktop.NetworkManager.Device.IPTunnel',
|
||||
'org.freedesktop.NetworkManager.Device.Infiniband',
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<node name="/">
|
||||
<!--
|
||||
org.freedesktop.NetworkManager.Device.Geneve:
|
||||
@short_description: GENEVE Device.
|
||||
|
||||
-->
|
||||
<interface name="org.freedesktop.NetworkManager.Device.Geneve">
|
||||
|
||||
<!--
|
||||
Id:
|
||||
@since: 1.58
|
||||
|
||||
The GENEVE Virtual Network Identifier (VNI).
|
||||
-->
|
||||
<property name="Id" type="u" access="read"/>
|
||||
|
||||
<!--
|
||||
Remote:
|
||||
@since: 1.58
|
||||
|
||||
The IP (v4 or v6) address of the remote endpoint to which GENEVE packets
|
||||
are sent.
|
||||
-->
|
||||
<property name="Remote" type="s" access="read"/>
|
||||
|
||||
<!--
|
||||
Tos:
|
||||
@since: 1.58
|
||||
|
||||
The value to use in the IP ToS field for GENEVE packets sent to the remote
|
||||
endpoint.
|
||||
-->
|
||||
<property name="Tos" type="y" access="read"/>
|
||||
|
||||
<!--
|
||||
Ttl:
|
||||
@since: 1.58
|
||||
|
||||
The value to use in the IP TTL field for GENEVE packets sent to the remote
|
||||
endpoint.
|
||||
-->
|
||||
<property name="Ttl" type="i" access="read"/>
|
||||
|
||||
<!--
|
||||
Df:
|
||||
@since: 1.58
|
||||
|
||||
The Don't Fragment (DF) flag setting for GENEVE packets. 0 means unset,
|
||||
1 means set, 2 means inherit from the underlying interface.
|
||||
-->
|
||||
<property name="Df" type="y" access="read"/>
|
||||
|
||||
<!--
|
||||
DstPort:
|
||||
@since: 1.58
|
||||
|
||||
Destination port for outgoing GENEVE packets.
|
||||
-->
|
||||
<property name="DstPort" type="q" access="read"/>
|
||||
|
||||
</interface>
|
||||
</node>
|
||||
|
|
@ -175,9 +175,6 @@
|
|||
property has a similar effect to configuring the device as unmanaged via
|
||||
the keyfile.unmanaged-devices setting in NetworkManager.conf. Changes to
|
||||
this value are not persistent and lost after NetworkManager restart.
|
||||
|
||||
DEPRECATED: 1.58: Use the SetManaged method instead, which supports
|
||||
additional features like persisting the state to disk
|
||||
-->
|
||||
<property name="Managed" type="b" access="readwrite"/>
|
||||
|
||||
|
|
@ -394,20 +391,6 @@
|
|||
-->
|
||||
<method name="Delete"/>
|
||||
|
||||
<!--
|
||||
SetManaged:
|
||||
@managed:(<link linkend="NMDeviceManaged">NMDeviceManaged</link>) Whether the device is managed. Possible values are "no" (0), "yes" (1) and "reset" (2).
|
||||
@flags: (<link linkend="NMDeviceManagedFlags">NMDeviceManagedFlags</link>) flags.
|
||||
@since: 1.58
|
||||
|
||||
Set the managed state of the device. With the flags argument different
|
||||
behaviors can be achieved, like storing the new managed state to disk.
|
||||
-->
|
||||
<method name="SetManaged">
|
||||
<arg name="managed" type="u" direction="in"/>
|
||||
<arg name="flags" type="u" direction="in"/>
|
||||
</method>
|
||||
|
||||
<!--
|
||||
StateChanged:
|
||||
@new_state: (<link linkend="NMDeviceState">NMDeviceState</link>) The new state of the device.
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
<!--
|
||||
GetSecrets:
|
||||
@setting_name: Name of the setting to return secrets for (mandatory).
|
||||
@setting_name: Name of the setting to return secrets for. If empty, all secrets will be returned.
|
||||
@secrets: Nested settings maps containing secrets.
|
||||
|
||||
Get the secrets belonging to this network configuration. Only secrets from
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@
|
|||
script is to automatically pick up changes to the network.</para>
|
||||
|
||||
<para>The dispatcher script will do nothing, unless the systemd service is
|
||||
enabled. To use the dispatcher script you should therefore run
|
||||
enabled. To use the dispatcher script you should therefor run
|
||||
<command>systemctl enable nm-cloud-setup.service</command> once.</para>
|
||||
</refsect2>
|
||||
|
||||
|
|
@ -197,7 +197,7 @@
|
|||
<para>Enable debug logging by setting <literal>NM_CLOUD_SETUP_LOG</literal> environment variable to <literal>TRACE</literal>.</para>
|
||||
<para>In the common case where nm-cloud-setup is running as systemd service, this can be done via <command>systemctl edit nm-cloud-setup.service</command>
|
||||
and add <literal>Environment=NM_CLOUD_SETUP_LOG=TRACE</literal> to the <literal>[Service]</literal> section. Afterwards, the log can
|
||||
be found in syslog via <literal>journalctl</literal>. You may also want to enable debug logging in NetworkManager as described
|
||||
be found in syslog via <literal>journalctl</literal>. You may also want to enable debug logging in NetworkManager as descibed
|
||||
in the DEBUGGING section in <link linkend='NetworkManager'><citerefentry><refentrytitle>NetworkManager</refentrytitle><manvolnum>5</manvolnum></citerefentry></link>
|
||||
manual. When sharing logs, it's best to share complete logs and not preemptively filter for NetworkManager or nm-cloud-setup logs.</para>
|
||||
</refsect1>
|
||||
|
|
|
|||
|
|
@ -1436,31 +1436,15 @@
|
|||
</arg>
|
||||
<arg>
|
||||
<option>managed</option>
|
||||
<group>
|
||||
<arg choice='plain'>--permanent</arg>
|
||||
<arg choice='plain'>--permanent-only</arg>
|
||||
</group>
|
||||
<group choice='req'>
|
||||
<arg choice='plain'>yes</arg>
|
||||
<arg choice='plain'>no</arg>
|
||||
<arg choice='plain'>up</arg>
|
||||
<arg choice='plain'>down</arg>
|
||||
<arg choice='plain'>reset</arg>
|
||||
</group>
|
||||
</arg>
|
||||
</term>
|
||||
|
||||
<listitem>
|
||||
<para>Set device properties.</para>
|
||||
|
||||
<para>The <option>managed</option> property accepts a <option>--permanent</option>
|
||||
option to persist the managed state to disk, and not only in runtime. With
|
||||
<option>--permanent-only</option> only the permanent managed state is set, and not the
|
||||
runtime managed state. The special values <option>up</option> and <option>down</option>
|
||||
can be used to set the administrative state of the device at the same time as the runtime
|
||||
managed state. The <option>reset</option> value clears the explicit managed setting, and
|
||||
with <option>--permanent</option> or <option>--permanent-only</option> it also removes
|
||||
the persisted managed setting.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
|
@ -1868,9 +1852,9 @@
|
|||
connections with an option of restoring the network configuration to a
|
||||
known good state in case of an error.</para>
|
||||
|
||||
<para>If a list of interface names is specified, the checkpoint is
|
||||
taken only on the specified devices. Otherwise a checkpoint is taken for
|
||||
all devices.</para>
|
||||
<para>If the a list of interface names is specified, the checkpoint is
|
||||
taken, the checkpoint is takes only on the specified devices. Otherwise
|
||||
a checkpoint is taken for all devices.</para>
|
||||
|
||||
<para>Currently the timeout defaults to 15 seconds. This may change in
|
||||
a future version.</para>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ project(
|
|||
# NOTE: When incrementing version also add corresponding
|
||||
# NM_VERSION_x_y_z macros in
|
||||
# "src/libnm-core-public/nm-version-macros.h.in"
|
||||
version: '1.57.4-dev',
|
||||
version: '1.57.2-dev',
|
||||
license: 'GPL2+',
|
||||
default_options: [
|
||||
'buildtype=debugoptimized',
|
||||
|
|
@ -296,8 +296,7 @@ config_h.set10('WITH_JANSSON', jansson_dep.found())
|
|||
jansson_msg = 'no'
|
||||
if jansson_dep.found()
|
||||
jansson_libdir = jansson_dep.get_variable(pkgconfig: 'libdir')
|
||||
jansson_sysroot = meson.is_cross_build() ? meson.get_external_property('sys_root', '') : ''
|
||||
res = run_command(find_program('eu-readelf', 'readelf'), '-d', jansson_sysroot + join_paths(jansson_libdir, 'libjansson.so'), check: false)
|
||||
res = run_command(find_program('eu-readelf', 'readelf'), '-d', join_paths(jansson_libdir, 'libjansson.so'), check: false)
|
||||
jansson_soname = ''
|
||||
foreach line: res.stdout().split('\n')
|
||||
if line.strip().contains('SONAME')
|
||||
|
|
@ -518,8 +517,8 @@ config_h.set10('HAVE_SELINUX', enable_selinux)
|
|||
# CLAT support
|
||||
enable_clat = get_option('clat')
|
||||
if enable_clat
|
||||
libbpf = dependency('libbpf', version: '>= 1.3.0', required: false)
|
||||
assert(libbpf.found(), 'You must have libbpf >= 1.3.0 installed to build. Use -Dclat=false to disable use of it')
|
||||
libbpf = dependency('libbpf', version: '>= 0.1.0', required: false)
|
||||
assert(libbpf.found(), 'You must have libbpf installed to build. Use -Dclat=false to disable use of it')
|
||||
libndp_dep = dependency('libndp', version: '>= 1.9', required: false)
|
||||
assert(libndp_dep.found(), 'You must have libndp >= 1.9 installed to build with CLAT support. Use -Dclat=false to disable it')
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ id
|
|||
it
|
||||
ja
|
||||
ka
|
||||
kk
|
||||
kn
|
||||
ko
|
||||
ku
|
||||
|
|
|
|||
|
|
@ -5,14 +5,12 @@ src/core/NetworkManagerUtils.c
|
|||
src/core/devices/adsl/nm-device-adsl.c
|
||||
src/core/devices/bluetooth/nm-bluez-manager.c
|
||||
src/core/devices/bluetooth/nm-device-bt.c
|
||||
src/core/devices/nm-device.c
|
||||
src/core/devices/nm-device-6lowpan.c
|
||||
src/core/devices/nm-device-bond.c
|
||||
src/core/devices/nm-device-bridge.c
|
||||
src/core/devices/nm-device-dummy.c
|
||||
src/core/devices/nm-device-ethernet-utils.c
|
||||
src/core/devices/nm-device-ethernet.c
|
||||
src/core/devices/nm-device-geneve.c
|
||||
src/core/devices/nm-device-infiniband.c
|
||||
src/core/devices/nm-device-ip-tunnel.c
|
||||
src/core/devices/nm-device-loopback.c
|
||||
|
|
@ -48,7 +46,6 @@ src/libnm-client-impl/nm-device-bt.c
|
|||
src/libnm-client-impl/nm-device-dummy.c
|
||||
src/libnm-client-impl/nm-device-ethernet.c
|
||||
src/libnm-client-impl/nm-device-generic.c
|
||||
src/libnm-client-impl/nm-device-geneve.c
|
||||
src/libnm-client-impl/nm-device-hsr.c
|
||||
src/libnm-client-impl/nm-device-infiniband.c
|
||||
src/libnm-client-impl/nm-device-ip-tunnel.c
|
||||
|
|
@ -93,7 +90,6 @@ src/libnm-core-impl/nm-setting-connection.c
|
|||
src/libnm-core-impl/nm-setting-dcb.c
|
||||
src/libnm-core-impl/nm-setting-ethtool.c
|
||||
src/libnm-core-impl/nm-setting-generic.c
|
||||
src/libnm-core-impl/nm-setting-geneve.c
|
||||
src/libnm-core-impl/nm-setting-gsm.c
|
||||
src/libnm-core-impl/nm-setting-hsr.c
|
||||
src/libnm-core-impl/nm-setting-infiniband.c
|
||||
|
|
|
|||
15692
po/sr@latin.po
15692
po/sr@latin.po
File diff suppressed because it is too large
Load diff
|
|
@ -1495,10 +1495,11 @@ nm_utils_ip_route_attribute_to_platform(int addr_family,
|
|||
r4->scope_inv = nm_platform_route_scope_inv(scope);
|
||||
}
|
||||
|
||||
/* For IPv4 routes in kernel, the onlink flag is per-nexthop (rtnh_flags).
|
||||
* Here we set the flag on r_rtm_flags which represents the first nexthop's
|
||||
* flags. For ECMP routes, each nexthop carries its own onlink flag, so
|
||||
* routes with different onlink settings per-nexthop can be merged. */
|
||||
/* Note that for IPv4 routes in kernel, the onlink flag can be set for
|
||||
* each next hop separately (rtnh_flags). Not for NetworkManager. We can
|
||||
* only merge routes as ECMP routes (when setting a weight) if they all
|
||||
* share the same onlink flag. See NM_PLATFORM_IP_ROUTE_CMP_TYPE_ECMP_ID.
|
||||
* That simplifies the code. */
|
||||
GET_ATTR(NM_IP_ROUTE_ATTRIBUTE_ONLINK, onlink, BOOLEAN, boolean, FALSE);
|
||||
r->r_rtm_flags = ((onlink) ? (unsigned) RTNH_F_ONLINK : 0u);
|
||||
|
||||
|
|
|
|||
|
|
@ -52,12 +52,11 @@
|
|||
NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE, NM_SETTING_BOND_OPTION_PRIMARY_RESELECT, \
|
||||
NM_SETTING_BOND_OPTION_RESEND_IGMP, NM_SETTING_BOND_OPTION_USE_CARRIER, \
|
||||
NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY, NM_SETTING_BOND_OPTION_NUM_GRAT_ARP, \
|
||||
NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY
|
||||
NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY, NM_SETTING_BOND_OPTION_ARP_MISSED_MAX
|
||||
|
||||
#define OPTIONS_REAPPLY_FULL \
|
||||
OPTIONS_REAPPLY_SUBSET, NM_SETTING_BOND_OPTION_ACTIVE_SLAVE, \
|
||||
NM_SETTING_BOND_OPTION_ARP_IP_TARGET, NM_SETTING_BOND_OPTION_NS_IP6_TARGET, \
|
||||
NM_SETTING_BOND_OPTION_ARP_MISSED_MAX
|
||||
NM_SETTING_BOND_OPTION_ARP_IP_TARGET, NM_SETTING_BOND_OPTION_NS_IP6_TARGET
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -502,8 +501,6 @@ _platform_lnk_bond_init_from_setting(NMSettingBond *s_bond, NMPlatformLnkBond *p
|
|||
props->lp_interval_has = props->lp_interval != 1;
|
||||
props->tlb_dynamic_lb_has = NM_IN_SET(props->mode, NM_BOND_MODE_TLB, NM_BOND_MODE_ALB);
|
||||
props->lacp_active_has = NM_IN_SET(props->mode, NM_BOND_MODE_8023AD);
|
||||
props->arp_missed_max_has =
|
||||
!NM_IN_SET(props->mode, NM_BOND_MODE_TLB, NM_BOND_MODE_ALB, NM_BOND_MODE_8023AD);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -910,8 +907,6 @@ reapply_connection(NMDevice *device, NMConnection *con_old, NMConnection *con_ne
|
|||
set_bond_arp_ip_targets(device, s_bond);
|
||||
|
||||
set_bond_attrs_or_default(device, s_bond, NM_MAKE_STRV(OPTIONS_REAPPLY_SUBSET));
|
||||
if (!NM_IN_SET(mode, NM_BOND_MODE_TLB, NM_BOND_MODE_ALB, NM_BOND_MODE_8023AD))
|
||||
set_bond_attr_or_default(device, s_bond, NM_SETTING_BOND_OPTION_ARP_MISSED_MAX);
|
||||
|
||||
_balance_slb_setup(self, con_new);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -412,7 +412,6 @@ nm_device_factory_manager_load_factories(NMDeviceFactoryManagerFactoryFunc callb
|
|||
_ADD_INTERNAL(nm_dummy_device_factory_get_type);
|
||||
_ADD_INTERNAL(nm_ethernet_device_factory_get_type);
|
||||
_ADD_INTERNAL(nm_generic_device_factory_get_type);
|
||||
_ADD_INTERNAL(nm_geneve_device_factory_get_type);
|
||||
_ADD_INTERNAL(nm_hsr_device_factory_get_type);
|
||||
_ADD_INTERNAL(nm_infiniband_device_factory_get_type);
|
||||
_ADD_INTERNAL(nm_ip_tunnel_device_factory_get_type);
|
||||
|
|
|
|||
|
|
@ -1,487 +0,0 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
/*
|
||||
* Copyright (C) 2026 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "src/core/nm-default-daemon.h"
|
||||
|
||||
#include "nm-manager.h"
|
||||
#include "nm-device-geneve.h"
|
||||
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
#include "nm-act-request.h"
|
||||
#include "nm-device-private.h"
|
||||
#include "nm-setting-geneve.h"
|
||||
#include "libnm-platform/nm-platform.h"
|
||||
#include "nm-device-factory.h"
|
||||
|
||||
#define _NMLOG_DEVICE_TYPE NMDeviceGeneve
|
||||
#include "nm-device-logging.h"
|
||||
|
||||
NM_GOBJECT_PROPERTIES_DEFINE(NMDeviceGeneve,
|
||||
PROP_ID,
|
||||
PROP_REMOTE,
|
||||
PROP_TOS,
|
||||
PROP_TTL,
|
||||
PROP_DF,
|
||||
PROP_DST_PORT, );
|
||||
|
||||
typedef struct {
|
||||
NMPlatformLnkGeneve props;
|
||||
} NMDeviceGenevePrivate;
|
||||
|
||||
struct _NMDeviceGeneve {
|
||||
NMDevice parent;
|
||||
NMDeviceGenevePrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMDeviceGeneveClass {
|
||||
NMDeviceClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(NMDeviceGeneve, nm_device_geneve, NM_TYPE_DEVICE)
|
||||
|
||||
#define NM_DEVICE_GENEVE_GET_PRIVATE(self) \
|
||||
_NM_GET_PRIVATE(self, NMDeviceGeneve, NM_IS_DEVICE_GENEVE, NMDevice)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static NMDeviceCapabilities
|
||||
get_generic_capabilities(NMDevice *dev)
|
||||
{
|
||||
return NM_DEVICE_CAP_IS_SOFTWARE;
|
||||
}
|
||||
|
||||
static void
|
||||
update_properties(NMDevice *device)
|
||||
{
|
||||
NMDeviceGeneve *self;
|
||||
NMDeviceGenevePrivate *priv;
|
||||
const NMPlatformLink *plink;
|
||||
const NMPlatformLnkGeneve *props;
|
||||
int ifindex;
|
||||
|
||||
g_return_if_fail(NM_IS_DEVICE_GENEVE(device));
|
||||
self = NM_DEVICE_GENEVE(device);
|
||||
priv = NM_DEVICE_GENEVE_GET_PRIVATE(self);
|
||||
|
||||
ifindex = nm_device_get_ifindex(device);
|
||||
g_return_if_fail(ifindex > 0);
|
||||
props = nm_platform_link_get_lnk_geneve(nm_device_get_platform(device), ifindex, &plink);
|
||||
|
||||
if (!props) {
|
||||
_LOGW(LOGD_PLATFORM, "could not get GENEVE properties");
|
||||
return;
|
||||
}
|
||||
|
||||
g_object_freeze_notify((GObject *) device);
|
||||
|
||||
#define CHECK_PROPERTY_CHANGED(field, prop) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
if (priv->props.field != props->field) { \
|
||||
priv->props.field = props->field; \
|
||||
_notify(self, prop); \
|
||||
} \
|
||||
} \
|
||||
G_STMT_END
|
||||
|
||||
#define CHECK_PROPERTY_CHANGED_IN6ADDR(field, prop) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
if (memcmp(&priv->props.field, &props->field, sizeof(props->field)) != 0) { \
|
||||
priv->props.field = props->field; \
|
||||
_notify(self, prop); \
|
||||
} \
|
||||
} \
|
||||
G_STMT_END
|
||||
|
||||
CHECK_PROPERTY_CHANGED(id, PROP_ID);
|
||||
CHECK_PROPERTY_CHANGED(remote, PROP_REMOTE);
|
||||
CHECK_PROPERTY_CHANGED_IN6ADDR(remote6, PROP_REMOTE);
|
||||
CHECK_PROPERTY_CHANGED(tos, PROP_TOS);
|
||||
CHECK_PROPERTY_CHANGED(ttl, PROP_TTL);
|
||||
CHECK_PROPERTY_CHANGED(df, PROP_DF);
|
||||
CHECK_PROPERTY_CHANGED(dst_port, PROP_DST_PORT);
|
||||
|
||||
g_object_thaw_notify((GObject *) device);
|
||||
}
|
||||
|
||||
static void
|
||||
link_changed(NMDevice *device, const NMPlatformLink *pllink)
|
||||
{
|
||||
NM_DEVICE_CLASS(nm_device_geneve_parent_class)->link_changed(device, pllink);
|
||||
update_properties(device);
|
||||
}
|
||||
|
||||
static void
|
||||
unrealize_notify(NMDevice *device)
|
||||
{
|
||||
NMDeviceGeneve *self = NM_DEVICE_GENEVE(device);
|
||||
NMDeviceGenevePrivate *priv = NM_DEVICE_GENEVE_GET_PRIVATE(self);
|
||||
guint i;
|
||||
|
||||
NM_DEVICE_CLASS(nm_device_geneve_parent_class)->unrealize_notify(device);
|
||||
|
||||
memset(&priv->props, 0, sizeof(NMPlatformLnkGeneve));
|
||||
|
||||
for (i = 1; i < _PROPERTY_ENUMS_LAST; i++)
|
||||
g_object_notify_by_pspec(G_OBJECT(self), obj_properties[i]);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
create_and_realize(NMDevice *device,
|
||||
NMConnection *connection,
|
||||
NMDevice *parent,
|
||||
const NMPlatformLink **out_plink,
|
||||
GError **error)
|
||||
{
|
||||
const char *iface = nm_device_get_iface(device);
|
||||
NMPlatformLnkGeneve props = {};
|
||||
NMSettingGeneve *s_geneve;
|
||||
const char *str;
|
||||
int r;
|
||||
|
||||
s_geneve = nm_connection_get_setting_geneve(connection);
|
||||
g_return_val_if_fail(s_geneve, FALSE);
|
||||
|
||||
props.id = nm_setting_geneve_get_id(s_geneve);
|
||||
|
||||
str = nm_setting_geneve_get_remote(s_geneve);
|
||||
if (!nm_inet_parse_bin(AF_INET, str, NULL, &props.remote)
|
||||
&& !nm_inet_parse_bin(AF_INET6, str, NULL, &props.remote6)) {
|
||||
return nm_assert_unreachable_val(FALSE);
|
||||
}
|
||||
props.tos = nm_setting_geneve_get_tos(s_geneve);
|
||||
props.ttl = nm_setting_geneve_get_ttl(s_geneve);
|
||||
props.df = nm_setting_geneve_get_df(s_geneve);
|
||||
props.dst_port = nm_setting_geneve_get_destination_port(s_geneve);
|
||||
|
||||
r = nm_platform_link_geneve_add(nm_device_get_platform(device), iface, &props, out_plink);
|
||||
if (r < 0) {
|
||||
g_set_error(error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_CREATION_FAILED,
|
||||
"Failed to create geneve interface '%s' for '%s': %s",
|
||||
iface,
|
||||
nm_connection_get_id(connection),
|
||||
nm_strerror(r));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
address_matches(const char *candidate, in_addr_t addr4, struct in6_addr *addr6)
|
||||
{
|
||||
NMIPAddr candidate_addr;
|
||||
int addr_family;
|
||||
|
||||
if (!candidate)
|
||||
return addr4 == 0u && IN6_IS_ADDR_UNSPECIFIED(addr6);
|
||||
|
||||
if (!nm_inet_parse_bin(AF_UNSPEC, candidate, &addr_family, &candidate_addr))
|
||||
return FALSE;
|
||||
|
||||
if (!nm_ip_addr_equal(addr_family,
|
||||
&candidate_addr,
|
||||
NM_IS_IPv4(addr_family) ? (gpointer) &addr4 : addr6))
|
||||
return FALSE;
|
||||
|
||||
if (NM_IS_IPv4(addr_family))
|
||||
return IN6_IS_ADDR_UNSPECIFIED(addr6);
|
||||
else
|
||||
return addr4 == 0u;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_connection_compatible(NMDevice *device,
|
||||
NMConnection *connection,
|
||||
gboolean check_properties,
|
||||
GError **error)
|
||||
{
|
||||
NMDeviceGenevePrivate *priv = NM_DEVICE_GENEVE_GET_PRIVATE(device);
|
||||
NMSettingGeneve *s_geneve;
|
||||
|
||||
if (!NM_DEVICE_CLASS(nm_device_geneve_parent_class)
|
||||
->check_connection_compatible(device, connection, check_properties, error))
|
||||
return FALSE;
|
||||
|
||||
if (check_properties && nm_device_is_real(device)) {
|
||||
s_geneve = nm_connection_get_setting_geneve(connection);
|
||||
|
||||
if (priv->props.id != nm_setting_geneve_get_id(s_geneve)) {
|
||||
nm_utils_error_set_literal(error,
|
||||
NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
|
||||
"geneve id mismatches");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!address_matches(nm_setting_geneve_get_remote(s_geneve),
|
||||
priv->props.remote,
|
||||
&priv->props.remote6)) {
|
||||
nm_utils_error_set_literal(error,
|
||||
NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
|
||||
"geneve remote address mismatches");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (priv->props.dst_port != nm_setting_geneve_get_destination_port(s_geneve)) {
|
||||
nm_utils_error_set_literal(error,
|
||||
NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
|
||||
"geneve destination port mismatches");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (priv->props.tos != nm_setting_geneve_get_tos(s_geneve)) {
|
||||
nm_utils_error_set_literal(error,
|
||||
NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
|
||||
"geneve TOS mismatches");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (priv->props.ttl != nm_setting_geneve_get_ttl(s_geneve)) {
|
||||
nm_utils_error_set_literal(error,
|
||||
NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
|
||||
"geneve TTL mismatches");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (priv->props.df != nm_setting_geneve_get_df(s_geneve)) {
|
||||
nm_utils_error_set_literal(error,
|
||||
NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
|
||||
"geneve DF mismatches");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
complete_connection(NMDevice *device,
|
||||
NMConnection *connection,
|
||||
const char *specific_object,
|
||||
NMConnection *const *existing_connections,
|
||||
GError **error)
|
||||
{
|
||||
NMSettingGeneve *s_geneve;
|
||||
|
||||
nm_utils_complete_generic(nm_device_get_platform(device),
|
||||
connection,
|
||||
NM_SETTING_GENEVE_SETTING_NAME,
|
||||
existing_connections,
|
||||
NULL,
|
||||
_("Geneve connection"),
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
s_geneve = nm_connection_get_setting_geneve(connection);
|
||||
if (!s_geneve) {
|
||||
g_set_error_literal(error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INVALID_CONNECTION,
|
||||
"A 'geneve' setting is required.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
update_connection(NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMDeviceGenevePrivate *priv = NM_DEVICE_GENEVE_GET_PRIVATE(device);
|
||||
NMSettingGeneve *s_geneve = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_GENEVE);
|
||||
char sbuf[NM_INET_ADDRSTRLEN];
|
||||
|
||||
if (priv->props.id != nm_setting_geneve_get_id(s_geneve))
|
||||
g_object_set(G_OBJECT(s_geneve), NM_SETTING_GENEVE_ID, priv->props.id, NULL);
|
||||
|
||||
/* Handle remote (IPv4 or IPv6) */
|
||||
if (priv->props.remote) {
|
||||
g_object_set(s_geneve,
|
||||
NM_SETTING_GENEVE_REMOTE,
|
||||
nm_inet4_ntop(priv->props.remote, sbuf),
|
||||
NULL);
|
||||
} else if (memcmp(&priv->props.remote6, &in6addr_any, sizeof(in6addr_any))) {
|
||||
g_object_set(s_geneve,
|
||||
NM_SETTING_GENEVE_REMOTE,
|
||||
nm_inet6_ntop(&priv->props.remote6, sbuf),
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (priv->props.dst_port != nm_setting_geneve_get_destination_port(s_geneve))
|
||||
g_object_set(G_OBJECT(s_geneve),
|
||||
NM_SETTING_GENEVE_DESTINATION_PORT,
|
||||
priv->props.dst_port,
|
||||
NULL);
|
||||
|
||||
if (priv->props.tos != nm_setting_geneve_get_tos(s_geneve))
|
||||
g_object_set(G_OBJECT(s_geneve), NM_SETTING_GENEVE_TOS, priv->props.tos, NULL);
|
||||
|
||||
if (priv->props.ttl != nm_setting_geneve_get_ttl(s_geneve))
|
||||
g_object_set(G_OBJECT(s_geneve), NM_SETTING_GENEVE_TTL, priv->props.ttl, NULL);
|
||||
|
||||
if (priv->props.df != nm_setting_geneve_get_df(s_geneve))
|
||||
g_object_set(G_OBJECT(s_geneve), NM_SETTING_GENEVE_DF, priv->props.df, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMDeviceGenevePrivate *priv = NM_DEVICE_GENEVE_GET_PRIVATE(object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_ID:
|
||||
g_value_set_uint(value, priv->props.id);
|
||||
break;
|
||||
case PROP_REMOTE:
|
||||
if (priv->props.remote)
|
||||
g_value_take_string(value, nm_inet4_ntop_dup(priv->props.remote));
|
||||
else if (!IN6_IS_ADDR_UNSPECIFIED(&priv->props.remote6))
|
||||
g_value_take_string(value, nm_inet6_ntop_dup(&priv->props.remote6));
|
||||
break;
|
||||
case PROP_TOS:
|
||||
g_value_set_uchar(value, priv->props.tos);
|
||||
break;
|
||||
case PROP_TTL:
|
||||
g_value_set_uchar(value, priv->props.ttl);
|
||||
break;
|
||||
case PROP_DF:
|
||||
g_value_set_uint(value, priv->props.df);
|
||||
break;
|
||||
case PROP_DST_PORT:
|
||||
g_value_set_uint(value, priv->props.dst_port);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
nm_device_geneve_init(NMDeviceGeneve *self)
|
||||
{}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_geneve = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT(
|
||||
NM_DBUS_INTERFACE_DEVICE_GENEVE,
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS(
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE("Id", "u", NM_DEVICE_GENEVE_ID),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE("Remote", "s", NM_DEVICE_GENEVE_REMOTE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE("Tos", "y", NM_DEVICE_GENEVE_TOS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE("Ttl", "y", NM_DEVICE_GENEVE_TTL),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE("Df", "u", NM_DEVICE_GENEVE_DF),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE("DstPort",
|
||||
"q",
|
||||
NM_DEVICE_GENEVE_DST_PORT), ), ),
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_geneve_class_init(NMDeviceGeneveClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS(klass);
|
||||
NMDeviceClass *device_class = NM_DEVICE_CLASS(klass);
|
||||
|
||||
object_class->get_property = get_property;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS(&interface_info_device_geneve);
|
||||
|
||||
device_class->connection_type_supported = NM_SETTING_GENEVE_SETTING_NAME;
|
||||
device_class->connection_type_check_compatible = NM_SETTING_GENEVE_SETTING_NAME;
|
||||
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES(NM_LINK_TYPE_GENEVE);
|
||||
|
||||
device_class->link_changed = link_changed;
|
||||
device_class->unrealize_notify = unrealize_notify;
|
||||
device_class->create_and_realize = create_and_realize;
|
||||
device_class->check_connection_compatible = check_connection_compatible;
|
||||
device_class->complete_connection = complete_connection;
|
||||
device_class->get_generic_capabilities = get_generic_capabilities;
|
||||
device_class->update_connection = update_connection;
|
||||
|
||||
obj_properties[PROP_ID] = g_param_spec_uint(NM_DEVICE_GENEVE_ID,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
G_MAXUINT32,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
obj_properties[PROP_REMOTE] = g_param_spec_string(NM_DEVICE_GENEVE_REMOTE,
|
||||
"",
|
||||
"",
|
||||
NULL,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
obj_properties[PROP_TOS] = g_param_spec_uchar(NM_DEVICE_GENEVE_TOS,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
255,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
obj_properties[PROP_TTL] = g_param_spec_uchar(NM_DEVICE_GENEVE_TTL,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
255,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
obj_properties[PROP_DF] = g_param_spec_uint(NM_DEVICE_GENEVE_DF,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
obj_properties[PROP_DST_PORT] = g_param_spec_uint(NM_DEVICE_GENEVE_DST_PORT,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
65535,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_TYPE_GENEVE_DEVICE_FACTORY (nm_geneve_device_factory_get_type())
|
||||
#define NM_GENEVE_DEVICE_FACTORY(obj) \
|
||||
(_NM_G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_GENEVE_DEVICE_FACTORY, NMGeneveDeviceFactory))
|
||||
|
||||
static NMDevice *
|
||||
create_device(NMDeviceFactory *factory,
|
||||
const char *iface,
|
||||
const NMPlatformLink *plink,
|
||||
NMConnection *connection,
|
||||
gboolean *out_ignore)
|
||||
{
|
||||
return g_object_new(NM_TYPE_DEVICE_GENEVE,
|
||||
NM_DEVICE_IFACE,
|
||||
iface,
|
||||
NM_DEVICE_TYPE_DESC,
|
||||
"Geneve",
|
||||
NM_DEVICE_DEVICE_TYPE,
|
||||
NM_DEVICE_TYPE_GENEVE,
|
||||
NM_DEVICE_LINK_TYPE,
|
||||
NM_LINK_TYPE_GENEVE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
||||
GENEVE,
|
||||
Geneve,
|
||||
geneve,
|
||||
NM_DEVICE_FACTORY_DECLARE_LINK_TYPES(NM_LINK_TYPE_GENEVE)
|
||||
NM_DEVICE_FACTORY_DECLARE_SETTING_TYPES(NM_SETTING_GENEVE_SETTING_NAME),
|
||||
factory_class->create_device = create_device;);
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
/*
|
||||
* Copyright (C) 2026 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NETWORKMANAGER_DEVICE_GENEVE_H__
|
||||
#define __NETWORKMANAGER_DEVICE_GENEVE_H__
|
||||
|
||||
#include "nm-device.h"
|
||||
|
||||
#define NM_TYPE_DEVICE_GENEVE (nm_device_geneve_get_type())
|
||||
#define NM_DEVICE_GENEVE(obj) \
|
||||
(_NM_G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_DEVICE_GENEVE, NMDeviceGeneve))
|
||||
#define NM_DEVICE_GENEVE_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_DEVICE_GENEVE, NMDeviceGeneveClass))
|
||||
#define NM_IS_DEVICE_GENEVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_DEVICE_GENEVE))
|
||||
#define NM_IS_DEVICE_GENEVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_DEVICE_GENEVE))
|
||||
#define NM_DEVICE_GENEVE_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_DEVICE_GENEVE, NMDeviceGeneveClass))
|
||||
|
||||
#define NM_DEVICE_GENEVE_ID "id"
|
||||
#define NM_DEVICE_GENEVE_REMOTE "remote"
|
||||
#define NM_DEVICE_GENEVE_TOS "tos"
|
||||
#define NM_DEVICE_GENEVE_TTL "ttl"
|
||||
#define NM_DEVICE_GENEVE_DF "df"
|
||||
#define NM_DEVICE_GENEVE_DST_PORT "dst-port"
|
||||
|
||||
typedef struct _NMDeviceGeneve NMDeviceGeneve;
|
||||
typedef struct _NMDeviceGeneveClass NMDeviceGeneveClass;
|
||||
|
||||
GType nm_device_geneve_get_type(void);
|
||||
|
||||
#endif /* __NETWORKMANAGER_DEVICE_GENEVE_H__ */
|
||||
|
|
@ -468,12 +468,7 @@ static const NMDBusInterfaceInfoExtended interface_info_device_macvlan = {
|
|||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE("NoPromisc",
|
||||
"b",
|
||||
NM_DEVICE_MACVLAN_NO_PROMISC),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE("Tap", "b", NM_DEVICE_MACVLAN_TAP),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE(
|
||||
"Tab",
|
||||
"b",
|
||||
NM_DEVICE_MACVLAN_TAP,
|
||||
.annotations = NM_GDBUS_ANNOTATION_INFO_LIST_DEPRECATED(), ), ), ),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE("Tab", "b", NM_DEVICE_MACVLAN_TAP), ), ),
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ update_properties(NMDevice *device)
|
|||
nm_device_parent_set_ifindex(device, peer_ifindex);
|
||||
|
||||
peer = nm_device_parent_get_device(device);
|
||||
if (peer && NM_IS_DEVICE_VETH(peer) && !nm_device_parent_get_device(peer))
|
||||
if (peer && NM_IS_DEVICE_VETH(peer) && nm_device_parent_get_ifindex(peer) <= 0)
|
||||
update_properties(peer);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -176,14 +176,14 @@ create_and_realize(NMDevice *device,
|
|||
if (str) {
|
||||
if (!nm_inet_parse_bin(AF_INET, str, NULL, &props.local)
|
||||
&& !nm_inet_parse_bin(AF_INET6, str, NULL, &props.local6))
|
||||
return nm_assert_unreachable_val(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
str = nm_setting_vxlan_get_remote(s_vxlan);
|
||||
if (str) {
|
||||
if (!nm_inet_parse_bin(AF_INET, str, NULL, &props.group)
|
||||
&& !nm_inet_parse_bin(AF_INET6, str, NULL, &props.group6))
|
||||
return nm_assert_unreachable_val(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
props.tos = nm_setting_vxlan_get_tos(s_vxlan);
|
||||
|
|
|
|||
|
|
@ -3684,7 +3684,6 @@ nm_device_create_l3_config_data_from_connection(NMDevice *self, NMConnection *co
|
|||
{
|
||||
NML3ConfigData *l3cd;
|
||||
int ifindex;
|
||||
gs_free char *gw_warning = NULL;
|
||||
|
||||
nm_assert(NM_IS_DEVICE(self));
|
||||
nm_assert(!connection || NM_IS_CONNECTION(connection));
|
||||
|
|
@ -3705,10 +3704,6 @@ nm_device_create_l3_config_data_from_connection(NMDevice *self, NMConnection *co
|
|||
nm_l3_config_data_set_ip6_privacy(l3cd, _prop_get_ipv6_ip6_privacy(self, connection));
|
||||
nm_l3_config_data_set_mptcp_flags(l3cd, _prop_get_connection_mptcp_flags(self, connection));
|
||||
|
||||
gw_warning = nm_connection_get_unreachable_gateways_warning(connection, FALSE);
|
||||
if (gw_warning)
|
||||
_LOGW(LOGD_IP, "%s", gw_warning);
|
||||
|
||||
return l3cd;
|
||||
}
|
||||
|
||||
|
|
@ -5967,6 +5962,7 @@ nm_device_get_route_metric_default(NMDeviceType device_type)
|
|||
* in some aspects a VPN. */
|
||||
case NM_DEVICE_TYPE_WIREGUARD:
|
||||
return NM_VPN_ROUTE_METRIC_DEFAULT;
|
||||
|
||||
case NM_DEVICE_TYPE_ETHERNET:
|
||||
case NM_DEVICE_TYPE_VETH:
|
||||
return 100;
|
||||
|
|
@ -6000,8 +5996,6 @@ nm_device_get_route_metric_default(NMDeviceType device_type)
|
|||
return 470;
|
||||
case NM_DEVICE_TYPE_VXLAN:
|
||||
return 500;
|
||||
case NM_DEVICE_TYPE_GENEVE:
|
||||
return 525;
|
||||
case NM_DEVICE_TYPE_DUMMY:
|
||||
return 550;
|
||||
case NM_DEVICE_TYPE_WIFI:
|
||||
|
|
@ -7234,9 +7228,7 @@ nm_device_controller_release_port(NMDevice *self,
|
|||
|
||||
info = find_port_info(self, port);
|
||||
|
||||
if (!info)
|
||||
port_state_str = "(not registered)";
|
||||
else if (info->port_state == PORT_STATE_ATTACHED)
|
||||
if (info->port_state == PORT_STATE_ATTACHED)
|
||||
port_state_str = "(attached)";
|
||||
else if (info->port_state == PORT_STATE_NOT_ATTACHED)
|
||||
port_state_str = "(not attached)";
|
||||
|
|
@ -7249,7 +7241,7 @@ nm_device_controller_release_port(NMDevice *self,
|
|||
"controller: release one port " NM_HASH_OBFUSCATE_PTR_FMT "/%s %s%s",
|
||||
NM_HASH_OBFUSCATE_PTR(port),
|
||||
nm_device_get_iface(port),
|
||||
port_state_str,
|
||||
!info ? "(not registered)" : port_state_str,
|
||||
release_type == RELEASE_PORT_TYPE_CONFIG_FORCE
|
||||
? " (force-configure)"
|
||||
: (release_type == RELEASE_PORT_TYPE_CONFIG ? " (configure)" : "(no-config)"));
|
||||
|
|
@ -13688,21 +13680,13 @@ activate_stage3_ip_config(NMDevice *self)
|
|||
nm_device_get_ip_iface(self));
|
||||
}
|
||||
|
||||
/*
|
||||
* Let's make sure MTU matches what is configured. The reason it's done at this
|
||||
* precise location is twofold:
|
||||
/* We currently will attach ports in the state change NM_DEVICE_STATE_IP_CONFIG above.
|
||||
* Note that kernel changes the MTU of bond ports, so we want to commit the MTU
|
||||
* afterwards!
|
||||
*
|
||||
* (1) Attaching ports above might affect the MTU.
|
||||
*
|
||||
* We currently will attach ports in the state change NM_DEVICE_STATE_IP_CONFIG
|
||||
* above. This might reset the MTU to something different from the bond controller
|
||||
* and it might not be a working configuration. But it's what the user asked for.
|
||||
*
|
||||
* (2) When MTU is under 1280 IPv6 can not work.
|
||||
*
|
||||
* Kernel will not expose sysctls, create or accept addresses that are needed for IPv6
|
||||
* configuration when the MTU is too small (under 1280).
|
||||
*/
|
||||
* This might reset the MTU to something different from the bond controller and
|
||||
* it might not be a working configuration. But it's what the user asked for, so
|
||||
* let's do it! */
|
||||
_commit_mtu(self);
|
||||
|
||||
if (!nm_device_managed_type_is_external(self)
|
||||
|
|
@ -13711,6 +13695,12 @@ activate_stage3_ip_config(NMDevice *self)
|
|||
&& !NM_IN_STRSET(priv->ipv6_method,
|
||||
NM_SETTING_IP6_CONFIG_METHOD_DISABLED,
|
||||
NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) {
|
||||
/* Ensure the MTU makes sense. If it was below 1280 the kernel would not
|
||||
* expose any ipv6 sysctls or allow presence of any addresses on the interface,
|
||||
* including LL, which * would make it impossible to autoconfigure MTU to a
|
||||
* correct value. */
|
||||
_commit_mtu(self);
|
||||
|
||||
/* Any method past this point requires an IPv6LL address. Use NM-controlled
|
||||
* IPv6LL if this is not an assumed connection, since assumed connections
|
||||
* will already have IPv6 set up.
|
||||
|
|
@ -14947,241 +14937,6 @@ impl_device_get_applied_connection(NMDBusObject *obj,
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
NMDeviceManaged managed_state;
|
||||
NMDeviceManagedFlags managed_flags;
|
||||
} SetManagedData;
|
||||
|
||||
static gboolean
|
||||
get_managed_match_by_mac(NMDevice *self, NMDeviceManagedFlags flags, gboolean *out, GError **error)
|
||||
{
|
||||
gboolean is_fake_hwaddr;
|
||||
|
||||
nm_assert(out);
|
||||
|
||||
if ((flags & NM_DEVICE_MANAGED_FLAGS_PERMANENT_BY_MAC)
|
||||
&& (flags & NM_DEVICE_MANAGED_FLAGS_PERMANENT_BY_NAME)) {
|
||||
g_set_error_literal(error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INVALID_ARGUMENT,
|
||||
"cannot match both by 'mac' and by 'interface-name'");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
nm_device_get_permanent_hw_address_full(self, TRUE, &is_fake_hwaddr);
|
||||
|
||||
if ((flags & NM_DEVICE_MANAGED_FLAGS_PERMANENT_BY_MAC) && is_fake_hwaddr) {
|
||||
g_set_error_literal(
|
||||
error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INVALID_ARGUMENT,
|
||||
"cannot match by 'mac': the device doesn't have a permanent MAC address");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (flags & NM_DEVICE_MANAGED_FLAGS_PERMANENT_BY_MAC)
|
||||
*out = TRUE;
|
||||
else if (flags & NM_DEVICE_MANAGED_FLAGS_PERMANENT_BY_NAME)
|
||||
*out = FALSE;
|
||||
else
|
||||
*out = !is_fake_hwaddr;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* set_managed:
|
||||
* @self: the device
|
||||
* @managed: the new managed state to set.
|
||||
* @flags: flags to select different behaviors like storing to disk.
|
||||
* @error: return location for a #GError, or %NULL
|
||||
*
|
||||
* Sets the managed state of the device. It can affect the runtime managed state
|
||||
* if the %NM_DEVICE_MANAGED_FLAGS_RUNTIME is set, and to the value stored on disk
|
||||
* (persistent across reboots) state if the %NM_DEVICE_MANAGED_FLAGS_PERMANENT is set.
|
||||
*
|
||||
* Returns: %TRUE if the managed state was set successfully, %FALSE otherwise.
|
||||
*/
|
||||
static gboolean
|
||||
set_managed(NMDevice *self, NMDeviceManaged managed, NMDeviceManagedFlags flags, GError **error)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
|
||||
|
||||
nm_assert(
|
||||
NM_IN_SET(managed, NM_DEVICE_MANAGED_NO, NM_DEVICE_MANAGED_YES, NM_DEVICE_MANAGED_RESET));
|
||||
nm_assert((flags & ~NM_DEVICE_MANAGED_FLAGS_ALL) == 0);
|
||||
|
||||
if (!NM_FLAGS_ANY(flags, NM_DEVICE_MANAGED_FLAGS_PERMANENT | NM_DEVICE_MANAGED_FLAGS_RUNTIME)) {
|
||||
g_set_error_literal(error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INVALID_ARGUMENT,
|
||||
_("set managed: no permanent or runtime was selected"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (flags & NM_DEVICE_MANAGED_FLAGS_PERMANENT) {
|
||||
NMTernary managed_to_disk, old = NM_TERNARY_DEFAULT;
|
||||
gboolean by_mac;
|
||||
|
||||
managed_to_disk = managed == NM_DEVICE_MANAGED_RESET ? NM_TERNARY_DEFAULT : !!managed;
|
||||
nm_config_get_device_managed(nm_manager_get_config(priv->manager), self, &old, NULL, error);
|
||||
if (!get_managed_match_by_mac(self, flags, &by_mac, error))
|
||||
return FALSE;
|
||||
|
||||
if (!nm_config_set_device_managed(nm_manager_get_config(priv->manager),
|
||||
self,
|
||||
managed_to_disk,
|
||||
by_mac,
|
||||
error))
|
||||
return FALSE;
|
||||
|
||||
/* Update the unmanaged flags after the change on disk */
|
||||
nm_device_set_unmanaged_by_user_conf(self);
|
||||
|
||||
if (managed_to_disk != NM_TERNARY_DEFAULT
|
||||
&& managed_to_disk != !nm_device_get_unmanaged_flags(self, NM_UNMANAGED_USER_CONF)) {
|
||||
/* We failed to make the new state effective on disk. Maybe the new config
|
||||
* collides with other config. Try to revert and return error. Otherwise,
|
||||
* we would set the runtime state correctly, but get an unexpected state
|
||||
* after a reboot. */
|
||||
nm_config_set_device_managed(nm_manager_get_config(priv->manager),
|
||||
self,
|
||||
old,
|
||||
by_mac,
|
||||
NULL);
|
||||
g_set_error(error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_FAILED,
|
||||
_("failed to persist 'managed=%d' on disk, other configurations may be "
|
||||
"overriding it"),
|
||||
managed);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & NM_DEVICE_MANAGED_FLAGS_RUNTIME) {
|
||||
if (managed == NM_DEVICE_MANAGED_RESET) {
|
||||
nm_device_set_unmanaged_by_flags(self,
|
||||
NM_UNMANAGED_USER_EXPLICIT,
|
||||
NM_UNMAN_FLAG_OP_FORGET,
|
||||
NM_DEVICE_STATE_REASON_UNMANAGED_USER_EXPLICIT);
|
||||
} else {
|
||||
g_object_set(self, NM_DEVICE_MANAGED, !!managed, NULL);
|
||||
|
||||
/* If requested, set the administrative state of the device to UP if the
|
||||
* new managed state is YES, and to DOWN if it's NO. */
|
||||
if (flags & NM_DEVICE_MANAGED_FLAGS_SET_ADMIN_STATE) {
|
||||
if (nm_device_get_ifindex(self))
|
||||
nm_platform_link_change_flags(nm_device_get_platform(self),
|
||||
nm_device_get_ifindex(self),
|
||||
IFF_UP,
|
||||
!!managed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
set_managed_cb(NMDevice *self,
|
||||
GDBusMethodInvocation *context,
|
||||
NMAuthSubject *subject,
|
||||
GError *error,
|
||||
gpointer user_data)
|
||||
{
|
||||
SetManagedData *set_managed_data = user_data;
|
||||
NMDeviceManaged managed;
|
||||
NMDeviceManagedFlags flags;
|
||||
GError *local = NULL;
|
||||
|
||||
managed = set_managed_data->managed_state;
|
||||
flags = set_managed_data->managed_flags;
|
||||
nm_g_slice_free(set_managed_data);
|
||||
|
||||
if (!error) {
|
||||
if (!NM_IN_SET(managed,
|
||||
NM_DEVICE_MANAGED_NO,
|
||||
NM_DEVICE_MANAGED_YES,
|
||||
NM_DEVICE_MANAGED_RESET))
|
||||
g_set_error_literal(&error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid managed value");
|
||||
else if ((flags & ~NM_DEVICE_MANAGED_FLAGS_ALL) != 0)
|
||||
g_set_error_literal(&error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid flags");
|
||||
}
|
||||
|
||||
if (error) {
|
||||
nm_audit_log_device_op(NM_AUDIT_OP_DEVICE_MANAGED,
|
||||
self,
|
||||
FALSE,
|
||||
NULL,
|
||||
subject,
|
||||
error->message);
|
||||
g_dbus_method_invocation_return_gerror(context, error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!set_managed(self, managed, flags, &local)) {
|
||||
nm_audit_log_device_op(NM_AUDIT_OP_DEVICE_MANAGED,
|
||||
self,
|
||||
FALSE,
|
||||
NULL,
|
||||
subject,
|
||||
local->message);
|
||||
g_dbus_method_invocation_take_error(context, g_steal_pointer(&local));
|
||||
return;
|
||||
}
|
||||
|
||||
nm_audit_log_device_op(NM_AUDIT_OP_DEVICE_MANAGED, self, TRUE, NULL, subject, NULL);
|
||||
g_dbus_method_invocation_return_value(context, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_device_set_managed(NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMDevice *self = NM_DEVICE(obj);
|
||||
gs_free_error GError *error = NULL;
|
||||
guint32 managed_u;
|
||||
NMDeviceManaged managed;
|
||||
guint32 flags_u;
|
||||
NMDeviceManagedFlags flags;
|
||||
SetManagedData *set_managed_data;
|
||||
|
||||
g_variant_get(parameters, "(uu)", &managed_u, &flags_u);
|
||||
|
||||
managed = managed_u;
|
||||
flags = flags_u;
|
||||
nm_assert(managed == managed_u && flags == flags_u);
|
||||
|
||||
set_managed_data = g_slice_new(SetManagedData);
|
||||
*set_managed_data = (SetManagedData) {
|
||||
.managed_state = managed,
|
||||
.managed_flags = flags,
|
||||
};
|
||||
|
||||
nm_device_auth_request(self,
|
||||
invocation,
|
||||
nm_device_get_applied_connection(self),
|
||||
NM_AUTH_PERMISSION_NETWORK_CONTROL,
|
||||
TRUE,
|
||||
NULL,
|
||||
set_managed_cb,
|
||||
set_managed_data);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
disconnect_cb(NMDevice *self,
|
||||
GDBusMethodInvocation *context,
|
||||
|
|
@ -17980,14 +17735,6 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason,
|
|||
nm_device_cleanup(self, reason, CLEANUP_TYPE_DECONFIGURE);
|
||||
}
|
||||
break;
|
||||
case NM_DEVICE_STATE_DEACTIVATING:
|
||||
/* When deactivating, certain devices are removed/disconnected after the
|
||||
* STATE_CHANGED signal is sent and before the DHCP release packet
|
||||
* can be sent. To ensure the release packet is sent, we cleanup DHCP
|
||||
* before the signal is emitted*/
|
||||
_dev_ipdhcpx_cleanup(self, AF_INET, TRUE, FALSE);
|
||||
_dev_ipdhcpx_cleanup(self, AF_INET6, TRUE, FALSE);
|
||||
break;
|
||||
case NM_DEVICE_STATE_DISCONNECTED:
|
||||
if (old_state > NM_DEVICE_STATE_DISCONNECTED) {
|
||||
/* Ensure devices that previously assumed a connection now have
|
||||
|
|
@ -18037,7 +17784,6 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason,
|
|||
(guint32) state,
|
||||
(guint32) old_state,
|
||||
(guint32) reason);
|
||||
|
||||
g_signal_emit(self,
|
||||
signals[STATE_CHANGED],
|
||||
0,
|
||||
|
|
@ -19821,7 +19567,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
nm_assert(priv->type == NM_DEVICE_TYPE_UNKNOWN);
|
||||
priv->type = g_value_get_uint(value);
|
||||
nm_assert(priv->type > NM_DEVICE_TYPE_UNKNOWN);
|
||||
nm_assert(priv->type <= NM_DEVICE_TYPE_GENEVE);
|
||||
nm_assert(priv->type <= NM_DEVICE_TYPE_IPVLAN);
|
||||
break;
|
||||
case PROP_LINK_TYPE:
|
||||
/* construct-only */
|
||||
|
|
@ -20152,12 +19898,6 @@ static const NMDBusInterfaceInfoExtended interface_info_device = {
|
|||
NM_DEFINE_GDBUS_ARG_INFO("connection", "a{sa{sv}}"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO("version_id", "t"), ), ),
|
||||
.handle = impl_device_get_applied_connection, ),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED(
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT("SetManaged",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS(
|
||||
NM_DEFINE_GDBUS_ARG_INFO("managed", "u"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO("flags", "u"), ), ),
|
||||
.handle = impl_device_set_managed, ),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED(NM_DEFINE_GDBUS_METHOD_INFO_INIT("Disconnect", ),
|
||||
.handle = impl_device_disconnect, ),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED(NM_DEFINE_GDBUS_METHOD_INFO_INIT("Delete", ),
|
||||
|
|
|
|||
|
|
@ -289,10 +289,8 @@ nm_dhcp_manager_init(NMDhcpManager *self)
|
|||
NM_CONFIG_GET_VALUE_STRIP | NM_CONFIG_GET_VALUE_NO_EMPTY);
|
||||
client = client_free;
|
||||
if (client) {
|
||||
client_factory = _client_factory_find_by_name(client);
|
||||
client_factory = _client_factory_available(_client_factory_find_by_name(client));
|
||||
if (!client_factory)
|
||||
_LOGW(AF_UNSPEC, "init: unknown DHCP client '%s', ignoring", client);
|
||||
else if (!(client_factory = _client_factory_available(client_factory)))
|
||||
_LOGW(AF_UNSPEC, "init: DHCP client '%s' not available", client);
|
||||
}
|
||||
if (!client_factory) {
|
||||
|
|
|
|||
|
|
@ -418,6 +418,7 @@ lease_parse_routes(NDhcp4ClientLease *lease,
|
|||
in_addr_t gateway;
|
||||
uint8_t plen;
|
||||
guint32 m;
|
||||
gboolean has_router_from_classless = FALSE;
|
||||
gboolean has_classless = FALSE;
|
||||
guint32 default_route_metric_offset = 0;
|
||||
const guint8 *l_data;
|
||||
|
|
@ -433,7 +434,7 @@ lease_parse_routes(NDhcp4ClientLease *lease,
|
|||
* We will however also parse one of the options into the "l3cd" for configuring routing.
|
||||
* Thereby we prefer 121 over 249 over 33.
|
||||
*
|
||||
* Preferring 121 over 33 is defined by RFC 3442.
|
||||
* Preferring 121 over 33 is defined by RFC 3443.
|
||||
* Preferring 121 over 249 over 33 is made up as it makes sense (the MS docs are not very clear).
|
||||
*/
|
||||
for (i = 0; i < 2; i++) {
|
||||
|
|
@ -460,6 +461,7 @@ lease_parse_routes(NDhcp4ClientLease *lease,
|
|||
/* if there are multiple default routes, we add them with differing
|
||||
* metrics. */
|
||||
m = default_route_metric_offset++;
|
||||
has_router_from_classless = TRUE;
|
||||
} else
|
||||
m = 0;
|
||||
|
||||
|
|
@ -493,7 +495,7 @@ lease_parse_routes(NDhcp4ClientLease *lease,
|
|||
nm_str_buf_append_printf(sbuf, "%s/%d %s", dest_str, (int) plen, gateway_str);
|
||||
|
||||
if (has_classless) {
|
||||
/* RFC 3442: if the DHCP server returns both a Classless Static Routes
|
||||
/* RFC 3443: if the DHCP server returns both a Classless Static Routes
|
||||
* option and a Static Routes option, the DHCP client MUST ignore the
|
||||
* Static Routes option. */
|
||||
continue;
|
||||
|
|
@ -537,10 +539,13 @@ lease_parse_routes(NDhcp4ClientLease *lease,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (has_classless) {
|
||||
/* RFC 3442: if the DHCP server returns both a Classless Static Routes
|
||||
* option and a Router option, the DHCP client MUST ignore the Router
|
||||
* option. */
|
||||
if (has_router_from_classless) {
|
||||
/* If the DHCP server returns both a Classless Static Routes option and a
|
||||
* Router option, the DHCP client MUST ignore the Router option [RFC 3442].
|
||||
*
|
||||
* Be more lenient and ignore the Router option only if Classless Static
|
||||
* Routes contain a default gateway (as other DHCP backends do).
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ _ASSERT_dns_config_ip_data(const NMDnsConfigIPData *ip_data)
|
|||
gboolean has_default = FALSE;
|
||||
gsize i;
|
||||
|
||||
for (i = 0; ip_data->domains.search && ip_data->domains.search[i]; i++) {
|
||||
for (i = 0; ip_data->domains.search && ip_data->domains.search; i++) {
|
||||
const char *d = ip_data->domains.search[i];
|
||||
|
||||
d = nm_utils_parse_dns_domain(d, NULL);
|
||||
|
|
|
|||
|
|
@ -298,6 +298,12 @@ main(int argc, char *argv[])
|
|||
|
||||
_nm_utils_is_manager_process = TRUE;
|
||||
|
||||
/* Known to cause a possible deadlock upon GDBus initialization:
|
||||
* https://bugzilla.gnome.org/show_bug.cgi?id=674885 */
|
||||
g_type_ensure(G_TYPE_SOCKET);
|
||||
g_type_ensure(G_TYPE_DBUS_CONNECTION);
|
||||
g_type_ensure(NM_TYPE_DBUS_MANAGER);
|
||||
|
||||
/* we determine a first-start (contrary to a restart during the same boot)
|
||||
* based on the existence of NM_CONFIG_DEVICE_STATE_DIR directory. */
|
||||
config_cli = nm_config_cmd_line_options_new(
|
||||
|
|
@ -322,12 +328,6 @@ main(int argc, char *argv[])
|
|||
exit(result);
|
||||
}
|
||||
|
||||
/* Known to cause a possible deadlock upon GDBus initialization:
|
||||
* https://bugzilla.gnome.org/show_bug.cgi?id=674885 */
|
||||
g_type_ensure(G_TYPE_SOCKET);
|
||||
g_type_ensure(G_TYPE_DBUS_CONNECTION);
|
||||
g_type_ensure(NM_TYPE_DBUS_MANAGER);
|
||||
|
||||
nm_main_utils_ensure_not_running_pidfile(global_opt.pidfile);
|
||||
|
||||
nm_main_utils_ensure_statedir();
|
||||
|
|
|
|||
|
|
@ -111,7 +111,6 @@ libNetworkManager = static_library(
|
|||
'devices/nm-device-ethernet-utils.c',
|
||||
'devices/nm-device-factory.c',
|
||||
'devices/nm-device-generic.c',
|
||||
'devices/nm-device-geneve.c',
|
||||
'devices/nm-device-hsr.c',
|
||||
'devices/nm-device-infiniband.c',
|
||||
'devices/nm-device-ip-tunnel.c',
|
||||
|
|
|
|||
|
|
@ -39,9 +39,7 @@ typedef struct {
|
|||
bool activation_lifetime_bound_to_profile_visibility : 1;
|
||||
bool settings_connection_is_unsaved : 1;
|
||||
bool settings_connection_is_shadowed_owned : 1;
|
||||
bool permanent_managed_by_mac : 1;
|
||||
NMUnmanFlagOp unmanaged_explicit;
|
||||
NMTernary permanent_managed;
|
||||
NMActivationReason activation_reason;
|
||||
gulong dev_exported_change_id;
|
||||
} DeviceCheckpoint;
|
||||
|
|
@ -499,18 +497,13 @@ nm_checkpoint_rollback(NMCheckpoint *self)
|
|||
g_hash_table_iter_init(&iter, priv->devices);
|
||||
while (g_hash_table_iter_next(&iter, (gpointer *) &device, (gpointer *) &dev_checkpoint)) {
|
||||
guint32 result = NM_ROLLBACK_RESULT_OK;
|
||||
NMTernary perm_managed = NM_TERNARY_DEFAULT;
|
||||
gboolean perm_managed_by_mac = FALSE;
|
||||
gboolean force_perm_managed;
|
||||
|
||||
_LOGD("rollback: restoring device %s (state %d, realized %d, explicitly unmanaged %d, "
|
||||
"permanently managed %d, connection-unsaved %d, connection-shadowed %d, "
|
||||
"connection-shadowed-owned %d)",
|
||||
"connection-unsaved %d, connection-shadowed %d, connection-shadowed-owned %d)",
|
||||
dev_checkpoint->original_dev_name,
|
||||
(int) dev_checkpoint->state,
|
||||
dev_checkpoint->realized,
|
||||
dev_checkpoint->unmanaged_explicit,
|
||||
dev_checkpoint->permanent_managed,
|
||||
dev_checkpoint->settings_connection_is_unsaved,
|
||||
!!dev_checkpoint->settings_connection_shadowed,
|
||||
dev_checkpoint->settings_connection_is_shadowed_owned);
|
||||
|
|
@ -548,43 +541,6 @@ nm_checkpoint_rollback(NMCheckpoint *self)
|
|||
NM_DEVICE_STATE_REASON_NOW_MANAGED);
|
||||
}
|
||||
|
||||
force_perm_managed = !nm_config_get_device_managed(nm_config_get(),
|
||||
device,
|
||||
&perm_managed,
|
||||
&perm_managed_by_mac,
|
||||
NULL);
|
||||
|
||||
if (force_perm_managed || (perm_managed != dev_checkpoint->permanent_managed)
|
||||
|| (dev_checkpoint->permanent_managed != NM_TERNARY_DEFAULT
|
||||
&& perm_managed_by_mac != dev_checkpoint->permanent_managed_by_mac)) {
|
||||
gs_free_error GError *error = NULL;
|
||||
NMUnmanFlagOp set_op;
|
||||
|
||||
_LOGD("rollback: restore permanent managed state");
|
||||
|
||||
if (!nm_config_set_device_managed(nm_config_get(),
|
||||
device,
|
||||
dev_checkpoint->permanent_managed,
|
||||
dev_checkpoint->permanent_managed_by_mac,
|
||||
&error)) {
|
||||
_LOGE("rollback: failed to restore permanent managed state: %s", error->message);
|
||||
result = NM_ROLLBACK_RESULT_ERR_FAILED;
|
||||
/* even if this failed, we try to continue the rollback */
|
||||
}
|
||||
|
||||
if (dev_checkpoint->permanent_managed == NM_TERNARY_TRUE)
|
||||
set_op = NM_UNMAN_FLAG_OP_SET_MANAGED;
|
||||
else if (dev_checkpoint->permanent_managed == NM_TERNARY_FALSE)
|
||||
set_op = NM_UNMAN_FLAG_OP_SET_UNMANAGED;
|
||||
else
|
||||
set_op = NM_UNMAN_FLAG_OP_FORGET;
|
||||
|
||||
nm_device_set_unmanaged_by_flags_queue(device,
|
||||
NM_UNMANAGED_USER_CONF,
|
||||
set_op,
|
||||
NM_DEVICE_STATE_REASON_NOW_MANAGED);
|
||||
}
|
||||
|
||||
if (dev_checkpoint->state == NM_DEVICE_STATE_UNMANAGED) {
|
||||
if (nm_device_get_state(device) != NM_DEVICE_STATE_UNMANAGED
|
||||
|| dev_checkpoint->unmanaged_explicit == NM_UNMAN_FLAG_OP_SET_UNMANAGED) {
|
||||
|
|
@ -747,8 +703,6 @@ device_checkpoint_create(NMCheckpoint *self, NMDevice *device)
|
|||
NMSettingsConnection *settings_connection;
|
||||
const char *path;
|
||||
NMActRequest *act_request;
|
||||
gboolean perm_managed_by_mac;
|
||||
gs_free_error GError *error = NULL;
|
||||
|
||||
nm_assert(NM_IS_DEVICE(device));
|
||||
nm_assert(nm_device_is_real(device));
|
||||
|
|
@ -774,26 +728,12 @@ device_checkpoint_create(NMCheckpoint *self, NMDevice *device)
|
|||
} else
|
||||
dev_checkpoint->unmanaged_explicit = NM_UNMAN_FLAG_OP_FORGET;
|
||||
|
||||
if (nm_config_get_device_managed(nm_config_get(),
|
||||
device,
|
||||
&dev_checkpoint->permanent_managed,
|
||||
&perm_managed_by_mac,
|
||||
NULL)) {
|
||||
dev_checkpoint->permanent_managed_by_mac = perm_managed_by_mac;
|
||||
} else {
|
||||
dev_checkpoint->permanent_managed = NM_TERNARY_DEFAULT;
|
||||
dev_checkpoint->permanent_managed_by_mac = FALSE;
|
||||
_LOGW("error getting permanent managed state for %s: %s",
|
||||
nm_device_get_iface(device),
|
||||
error->message);
|
||||
g_clear_error(&error);
|
||||
}
|
||||
|
||||
act_request = nm_device_get_act_request(device);
|
||||
if (act_request) {
|
||||
NMSettingsStorage *storage;
|
||||
gboolean shadowed_owned = FALSE;
|
||||
const char *shadowed_file;
|
||||
gs_free_error GError *error = NULL;
|
||||
|
||||
settings_connection = nm_act_request_get_settings_connection(act_request);
|
||||
applied_connection = nm_act_request_get_applied_connection(act_request);
|
||||
|
|
@ -824,7 +764,6 @@ device_checkpoint_create(NMCheckpoint *self, NMDevice *device)
|
|||
_LOGW("error reading shadowed connection file for %s: %s",
|
||||
nm_device_get_iface(device),
|
||||
error->message);
|
||||
g_clear_error(&error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2058,15 +2058,12 @@ _match_section_infos_construct(GKeyFile *keyfile, gboolean is_device)
|
|||
{
|
||||
char **groups;
|
||||
gsize i, j, ngroups;
|
||||
char *main_group = NULL;
|
||||
char *connection_tag = NULL;
|
||||
MatchSectionInfo *match_section_infos = NULL;
|
||||
const char *prefix, *prefix_intern;
|
||||
const char *prefix;
|
||||
|
||||
prefix =
|
||||
is_device ? NM_CONFIG_KEYFILE_GROUPPREFIX_DEVICE : NM_CONFIG_KEYFILE_GROUPPREFIX_CONNECTION;
|
||||
prefix_intern =
|
||||
is_device ? NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN NM_CONFIG_KEYFILE_GROUPPREFIX_DEVICE
|
||||
: NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN NM_CONFIG_KEYFILE_GROUPPREFIX_CONNECTION;
|
||||
|
||||
/* get the list of existing [connection.\+]/[device.\+] sections.
|
||||
*
|
||||
|
|
@ -2077,36 +2074,27 @@ _match_section_infos_construct(GKeyFile *keyfile, gboolean is_device)
|
|||
if (!groups)
|
||||
return NULL;
|
||||
|
||||
if (ngroups > 0) {
|
||||
gsize l = strlen(prefix);
|
||||
|
||||
for (i = 0, j = 0; i < ngroups; i++) {
|
||||
if (nm_streq0(groups[i], prefix)) {
|
||||
main_group = groups[i];
|
||||
} else if (nm_streq0(groups[i], prefix_intern)) {
|
||||
/* [.intern.connection] and [.intern.device] should not exist */
|
||||
_nm_log(LOGL_WARN,
|
||||
LOGD_CORE,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
"Invalid [.intern.*] section 'connection' or 'device' found");
|
||||
g_free(groups[i]);
|
||||
continue;
|
||||
} else if (g_str_has_prefix(groups[i], prefix)) {
|
||||
if (g_str_has_prefix(groups[i], prefix)) {
|
||||
if (groups[i][l] == '\0')
|
||||
connection_tag = groups[i];
|
||||
else
|
||||
groups[j++] = groups[i];
|
||||
} else if (g_str_has_prefix(groups[i], prefix_intern)) {
|
||||
/* [.intern.connection-whatever] and [.intern.device-whatever] can exist */
|
||||
groups[j++] = groups[i];
|
||||
} else {
|
||||
} else
|
||||
g_free(groups[i]);
|
||||
}
|
||||
}
|
||||
ngroups = j;
|
||||
}
|
||||
|
||||
if (ngroups == 0 && !main_group) {
|
||||
if (ngroups == 0 && !connection_tag) {
|
||||
g_free(groups);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
match_section_infos = g_new0(MatchSectionInfo, ngroups + 1 + (main_group ? 1 : 0));
|
||||
match_section_infos = g_new0(MatchSectionInfo, ngroups + 1 + (connection_tag ? 1 : 0));
|
||||
match_section_infos->is_device = is_device;
|
||||
for (i = 0; i < ngroups; i++) {
|
||||
/* pass ownership of @group on... */
|
||||
|
|
@ -2115,9 +2103,9 @@ _match_section_infos_construct(GKeyFile *keyfile, gboolean is_device)
|
|||
groups[ngroups - i - 1],
|
||||
is_device);
|
||||
}
|
||||
if (main_group) {
|
||||
/* pass ownership of @main_group on... */
|
||||
_match_section_info_init(&match_section_infos[i], keyfile, main_group, is_device);
|
||||
if (connection_tag) {
|
||||
/* pass ownership of @connection_tag on... */
|
||||
_match_section_info_init(&match_section_infos[i], keyfile, connection_tag, is_device);
|
||||
}
|
||||
g_free(groups);
|
||||
|
||||
|
|
|
|||
|
|
@ -1257,28 +1257,34 @@ read_base_config(GKeyFile *keyfile,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* We want to use GDir instead of GFile here to avoid loading GVFS modules and
|
||||
* initalizing DBUS infra for communicating with GVFS.
|
||||
* https://redhat.atlassian.net/browse/RHEL-140113
|
||||
*/
|
||||
static GPtrArray *
|
||||
_get_config_dir_files(const char *config_dir)
|
||||
{
|
||||
GDir *dir;
|
||||
GFile *dir;
|
||||
GFileEnumerator *direnum;
|
||||
GFileInfo *info;
|
||||
GPtrArray *confs;
|
||||
const char *name;
|
||||
|
||||
g_return_val_if_fail(config_dir, NULL);
|
||||
|
||||
confs = g_ptr_array_new_with_free_func(g_free);
|
||||
if (!*config_dir)
|
||||
return confs;
|
||||
dir = g_dir_open(config_dir, 0, NULL);
|
||||
if (dir) {
|
||||
while ((name = g_dir_read_name(dir))) {
|
||||
|
||||
dir = g_file_new_for_path(config_dir);
|
||||
direnum = g_file_enumerate_children(dir, G_FILE_ATTRIBUTE_STANDARD_NAME, 0, NULL, NULL);
|
||||
if (direnum) {
|
||||
while ((info = g_file_enumerator_next_file(direnum, NULL, NULL))) {
|
||||
name = g_file_info_get_name(info);
|
||||
if (NM_STR_HAS_SUFFIX(name, ".conf"))
|
||||
g_ptr_array_add(confs, g_strdup(name));
|
||||
g_object_unref(info);
|
||||
}
|
||||
g_dir_close(dir);
|
||||
g_object_unref(direnum);
|
||||
}
|
||||
g_object_unref(dir);
|
||||
|
||||
g_ptr_array_sort(confs, nm_strcmp_p);
|
||||
return confs;
|
||||
}
|
||||
|
|
@ -1335,6 +1341,7 @@ read_entire_config(const NMConfigCmdLineOptions *cli,
|
|||
|
||||
/* create a default configuration file. */
|
||||
keyfile = nm_config_create_keyfile();
|
||||
|
||||
system_confs = _get_config_dir_files(system_config_dir);
|
||||
confs = _get_config_dir_files(config_dir);
|
||||
run_confs = _get_config_dir_files(run_config_dir);
|
||||
|
|
@ -2069,210 +2076,6 @@ nm_config_set_connectivity_check_enabled(NMConfig *self, gboolean enabled)
|
|||
g_key_file_unref(keyfile);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
normalize_hwaddr_for_group_name(const char *hwaddr, char *out, GError **error)
|
||||
{
|
||||
guint8 hwaddr_bin[NM_UTILS_HWADDR_LEN_MAX];
|
||||
gsize hwaddr_bin_len;
|
||||
|
||||
if (!_nm_utils_hwaddr_aton(hwaddr, hwaddr_bin, sizeof(hwaddr_bin), &hwaddr_bin_len)) {
|
||||
g_set_error(error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid MAC address: %s",
|
||||
hwaddr);
|
||||
return FALSE;
|
||||
}
|
||||
nm_utils_bin2hexstr_full(hwaddr_bin, hwaddr_bin_len, '-', TRUE, out);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_config_get_device_managed:
|
||||
* @self: the NMConfig instance
|
||||
* @device: the interface
|
||||
* @out: (out): the managed state of the device
|
||||
* @error: return location for a #GError, or %NULL
|
||||
*
|
||||
* Returns: TRUE if there were no errors, FALSE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
nm_config_get_device_managed(NMConfig *self,
|
||||
NMDevice *device,
|
||||
NMTernary *out_managed,
|
||||
gboolean *out_by_mac,
|
||||
GError **error)
|
||||
{
|
||||
NMConfigPrivate *priv;
|
||||
const GKeyFile *keyfile = NULL;
|
||||
gs_free char *group_by_name = NULL;
|
||||
gs_free char *group_by_mac = NULL;
|
||||
const char *ifname = nm_device_get_iface(device);
|
||||
const char *hwaddr = nm_device_get_permanent_hw_address(device);
|
||||
char mac_group_name[NM_UTILS_HWADDR_LEN_MAX * 3 + 1];
|
||||
NMTernary val_by_name, val_by_mac = NM_TERNARY_DEFAULT;
|
||||
|
||||
g_return_val_if_fail(NM_IS_CONFIG(self), FALSE);
|
||||
g_return_val_if_fail(NM_CONFIG_GET_PRIVATE(self)->config_data, FALSE);
|
||||
g_return_val_if_fail(out_managed, FALSE);
|
||||
g_return_val_if_fail(ifname, FALSE);
|
||||
|
||||
priv = NM_CONFIG_GET_PRIVATE(self);
|
||||
keyfile = _nm_config_data_get_keyfile_intern(priv->config_data);
|
||||
|
||||
if (!keyfile) {
|
||||
NM_SET_OUT(out_managed, NM_TERNARY_DEFAULT);
|
||||
NM_SET_OUT(out_by_mac, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
group_by_name =
|
||||
g_strdup_printf(NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN_DEVICE "-manage-%s", ifname);
|
||||
|
||||
val_by_name = (NMTernary) nm_config_keyfile_get_boolean(keyfile,
|
||||
group_by_name,
|
||||
NM_CONFIG_KEYFILE_KEY_DEVICE_MANAGED,
|
||||
NM_TERNARY_DEFAULT);
|
||||
|
||||
/* Devices without a kernel link (i.e. OVS ports) don't have a MAC address */
|
||||
if (hwaddr) {
|
||||
if (!normalize_hwaddr_for_group_name(hwaddr, mac_group_name, error))
|
||||
return FALSE;
|
||||
|
||||
group_by_mac = g_strdup_printf(NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN_DEVICE "-manage-%s",
|
||||
mac_group_name);
|
||||
|
||||
val_by_mac = (NMTernary) nm_config_keyfile_get_boolean(keyfile,
|
||||
group_by_mac,
|
||||
NM_CONFIG_KEYFILE_KEY_DEVICE_MANAGED,
|
||||
NM_TERNARY_DEFAULT);
|
||||
}
|
||||
|
||||
if (val_by_name != NM_TERNARY_DEFAULT && val_by_mac == NM_TERNARY_DEFAULT) {
|
||||
NM_SET_OUT(out_managed, val_by_name);
|
||||
NM_SET_OUT(out_by_mac, FALSE);
|
||||
return TRUE;
|
||||
} else if (val_by_mac != NM_TERNARY_DEFAULT && val_by_name == NM_TERNARY_DEFAULT) {
|
||||
NM_SET_OUT(out_managed, val_by_mac);
|
||||
NM_SET_OUT(out_by_mac, TRUE);
|
||||
return TRUE;
|
||||
} else if (val_by_name == NM_TERNARY_DEFAULT && val_by_mac == NM_TERNARY_DEFAULT) {
|
||||
NM_SET_OUT(out_managed, NM_TERNARY_DEFAULT);
|
||||
NM_SET_OUT(out_by_mac, FALSE);
|
||||
return TRUE;
|
||||
} else if (val_by_name == val_by_mac) {
|
||||
NM_SET_OUT(out_managed, val_by_name);
|
||||
NM_SET_OUT(out_by_mac, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_set_error(error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_FAILED,
|
||||
"Multiple managed states found for device: %s",
|
||||
nm_device_get_iface(device));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_config_set_device_managed:
|
||||
* @self: the NMConfig instance
|
||||
* @device: the NMDevice instance associated with this config change
|
||||
* @managed: the managed state to set
|
||||
* @by_mac: if %TRUE, match by MAC address, otherwise by interface name. This is
|
||||
* only used when @managed = TRUE.
|
||||
* @error: return location for a #GError, or %NULL
|
||||
*
|
||||
* Sets the managed state of the device to the intern keyfile. Here we store the
|
||||
* configuration received via the D-Bus API. Configurations from other config
|
||||
* files are still in place and may have higher precedence.
|
||||
*
|
||||
* Prior to setting the new state, the existing configuration is removed. If
|
||||
* @managed is set to %NM_TERNARY_DEFAULT, we only do the removal of the previous
|
||||
* configuration.
|
||||
*/
|
||||
gboolean
|
||||
nm_config_set_device_managed(NMConfig *self,
|
||||
NMDevice *device,
|
||||
NMTernary managed,
|
||||
gboolean by_mac,
|
||||
GError **error)
|
||||
{
|
||||
NMConfigPrivate *priv;
|
||||
g_autoptr(GKeyFile) keyfile = NULL;
|
||||
char *group;
|
||||
gs_free char *group_by_name = NULL;
|
||||
gs_free char *group_by_mac = NULL;
|
||||
gs_free char *match_value = NULL;
|
||||
gboolean changed = FALSE;
|
||||
const char *ifname = nm_device_get_iface(device);
|
||||
const char *hwaddr = nm_device_get_permanent_hw_address(device);
|
||||
char mac_group_name[NM_UTILS_HWADDR_LEN_MAX * 3 + 1];
|
||||
|
||||
g_return_val_if_fail(NM_IS_CONFIG(self), FALSE);
|
||||
g_return_val_if_fail(NM_CONFIG_GET_PRIVATE(self)->config_data, FALSE);
|
||||
g_return_val_if_fail(ifname, FALSE);
|
||||
|
||||
if (by_mac && !hwaddr) {
|
||||
g_set_error(error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INVALID_ARGUMENT,
|
||||
"the device has no MAC address, but match by MAC was requested");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (hwaddr && !normalize_hwaddr_for_group_name(hwaddr, mac_group_name, error))
|
||||
return FALSE;
|
||||
|
||||
priv = NM_CONFIG_GET_PRIVATE(self);
|
||||
keyfile = nm_config_data_clone_keyfile_intern(priv->config_data);
|
||||
|
||||
/* Remove existing configs. Search them by group name [.intern.device-manage-*]. In
|
||||
* the intern file, 'device-manage' sections are only used for this purpose, so we
|
||||
* won't remove any other device's config. */
|
||||
group_by_name =
|
||||
g_strdup_printf(NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN_DEVICE "-manage-%s", ifname);
|
||||
|
||||
if (g_key_file_remove_group(keyfile, group_by_name, NULL))
|
||||
changed = TRUE;
|
||||
|
||||
/* Devices without a kernel link (i.e. OVS ports) don't have a MAC address */
|
||||
if (hwaddr) {
|
||||
group_by_mac = g_strdup_printf(NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN_DEVICE "-manage-%s",
|
||||
mac_group_name);
|
||||
|
||||
if (g_key_file_remove_group(keyfile, group_by_mac, NULL))
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
/* If the new state is not explicitly TRUE of FALSE, we only remove the configs */
|
||||
if (managed == NM_TERNARY_DEFAULT)
|
||||
goto done;
|
||||
|
||||
/* Set new values */
|
||||
if (by_mac) {
|
||||
group = group_by_mac;
|
||||
match_value = g_strdup_printf("mac:%s", hwaddr);
|
||||
} else {
|
||||
group = group_by_name;
|
||||
match_value = g_strdup_printf("interface-name:=%s", ifname);
|
||||
}
|
||||
|
||||
g_key_file_set_value(keyfile, group, NM_CONFIG_KEYFILE_KEY_MATCH_DEVICE, match_value);
|
||||
g_key_file_set_value(keyfile, group, NM_CONFIG_KEYFILE_KEY_DEVICE_MANAGED, managed ? "1" : "0");
|
||||
changed = TRUE;
|
||||
|
||||
done:
|
||||
if (changed)
|
||||
nm_config_set_values(self, keyfile, TRUE, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* nm_config_set_values:
|
||||
* @self: the NMConfig instance
|
||||
|
|
@ -3286,6 +3089,7 @@ init_sync(GInitable *initable, GCancellable *cancellable, GError **error)
|
|||
g_set_error(error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND, "unspecified error");
|
||||
g_return_val_if_reached(FALSE);
|
||||
}
|
||||
|
||||
s = priv->cli.config_dir ?: "" DEFAULT_CONFIG_DIR;
|
||||
priv->config_dir = g_strdup(s[0] == '/' ? s : "");
|
||||
|
||||
|
|
@ -3293,10 +3097,12 @@ init_sync(GInitable *initable, GCancellable *cancellable, GError **error)
|
|||
if (s[0] != '/' || nm_streq(s, priv->config_dir))
|
||||
s = "";
|
||||
priv->system_config_dir = g_strdup(s);
|
||||
|
||||
if (priv->cli.intern_config_file)
|
||||
priv->intern_config_file = g_strdup(priv->cli.intern_config_file);
|
||||
else
|
||||
priv->intern_config_file = g_strdup(DEFAULT_INTERN_CONFIG_FILE);
|
||||
|
||||
warnings = g_ptr_array_new_with_free_func(g_free);
|
||||
|
||||
keyfile = read_entire_config(&priv->cli,
|
||||
|
|
|
|||
|
|
@ -142,17 +142,6 @@ gboolean nm_config_set_global_dns(NMConfig *self, NMGlobalDnsConfig *global_dns,
|
|||
|
||||
void nm_config_set_connectivity_check_enabled(NMConfig *self, gboolean enabled);
|
||||
|
||||
gboolean nm_config_get_device_managed(NMConfig *self,
|
||||
NMDevice *device,
|
||||
NMTernary *out_managed,
|
||||
gboolean *out_by_mac,
|
||||
GError **error);
|
||||
gboolean nm_config_set_device_managed(NMConfig *self,
|
||||
NMDevice *device,
|
||||
NMTernary managed,
|
||||
gboolean by_mac,
|
||||
GError **error);
|
||||
|
||||
/* internal defines ... */
|
||||
extern guint _nm_config_match_nm_version;
|
||||
extern char *_nm_config_match_env;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ G_DEFINE_ABSTRACT_TYPE(NMIPConfig, nm_ip_config, NM_TYPE_DBUS_OBJECT)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void _handle_platform_change(NMIPConfig *self, guint64 obj_type_flags, gboolean is_init);
|
||||
static void _handle_platform_change(NMIPConfig *self, guint32 obj_type_flags, gboolean is_init);
|
||||
static void _handle_l3cd_changed(NMIPConfig *self, const NML3ConfigData *l3cd);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -77,7 +77,7 @@ static void
|
|||
_notify_platform_handle(NMIPConfig *self, gint64 now_msec)
|
||||
{
|
||||
NMIPConfigPrivate *priv = NM_IP_CONFIG_GET_PRIVATE(self);
|
||||
guint64 obj_type_flags;
|
||||
guint32 obj_type_flags;
|
||||
|
||||
nm_clear_g_source_inst(&priv->notify_platform_timeout_source);
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ _notify_platform_cb(gpointer user_data)
|
|||
}
|
||||
|
||||
static void
|
||||
_notify_platform(NMIPConfig *self, guint64 obj_type_flags)
|
||||
_notify_platform(NMIPConfig *self, guint32 obj_type_flags)
|
||||
{
|
||||
const int addr_family = nm_ip_config_get_addr_family(self);
|
||||
const int IS_IPv4 = NM_IS_IPv4(addr_family);
|
||||
|
|
@ -953,7 +953,7 @@ _handle_l3cd_changed(NMIPConfig *self, const NML3ConfigData *l3cd)
|
|||
}
|
||||
|
||||
static void
|
||||
_handle_platform_change(NMIPConfig *self, guint64 obj_type_flags, gboolean is_init)
|
||||
_handle_platform_change(NMIPConfig *self, guint32 obj_type_flags, gboolean is_init)
|
||||
{
|
||||
const int addr_family = nm_ip_config_get_addr_family(self);
|
||||
const int IS_IPv4 = NM_IS_IPv4(addr_family);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ struct _NMIPConfigPrivate {
|
|||
GSource *notify_platform_timeout_source;
|
||||
gint64 notify_platform_rlimited_until_msec;
|
||||
gulong l3cfg_notify_id;
|
||||
guint64 notify_platform_obj_type_flags;
|
||||
guint32 notify_platform_obj_type_flags;
|
||||
};
|
||||
|
||||
struct _NMIPConfig {
|
||||
|
|
|
|||
|
|
@ -3208,9 +3208,12 @@ _init_from_connection_ip(NML3ConfigData *self, int addr_family, NMConnection *co
|
|||
* the one we create here (because the "onlink" flag is part of the
|
||||
* identifier of a route, see nm_platform_ip4_route_cmp()).
|
||||
*
|
||||
* The onlink flag is tracked per-nexthop (in NMPlatformIP4RtNextHop.rtnh_flags
|
||||
* for extra nexthops, and in r_rtm_flags for the first nexthop). ECMP routes
|
||||
* can be merged regardless of per-nexthop onlink flags. */
|
||||
* Note however that for ECMP routes we currently can only merge routes
|
||||
* that agree in their onlink flag. So a route without gateway cannot
|
||||
* merge with an onlink route that has a gateway. That needs fixing,
|
||||
* by not treating the onlink flag as for the entire route, but allowing
|
||||
* to merge ECMP routes with different onlink flag. And first, we need
|
||||
* to track the onlink flag for the nexthop (NMPlatformIP4RtNextHop). */
|
||||
r.r4.r_rtm_flags &= ~((unsigned) RTNH_F_ONLINK);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -657,7 +657,7 @@ _l3_config_notify_data_to_string(const NML3ConfigNotifyData *notify_data,
|
|||
case NM_L3_CONFIG_NOTIFY_TYPE_PLATFORM_CHANGE_ON_IDLE:
|
||||
nm_strbuf_append(&s,
|
||||
&l,
|
||||
", obj-type-flags=0x%" G_GINT64_MODIFIER "x",
|
||||
", obj-type-flags=0x%x",
|
||||
notify_data->platform_change_on_idle.obj_type_flags);
|
||||
break;
|
||||
case NM_L3_CONFIG_NOTIFY_TYPE_IPV4LL_EVENT:
|
||||
|
|
@ -1604,7 +1604,7 @@ _load_link(NML3Cfg *self, gboolean initial)
|
|||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
_nm_l3cfg_notify_platform_change_on_idle(NML3Cfg *self, guint64 obj_type_flags)
|
||||
_nm_l3cfg_notify_platform_change_on_idle(NML3Cfg *self, guint32 obj_type_flags)
|
||||
{
|
||||
NML3ConfigNotifyData notify_data;
|
||||
|
||||
|
|
@ -4140,55 +4140,6 @@ update_routes:
|
|||
}
|
||||
}
|
||||
|
||||
#if HAVE_CLAT
|
||||
/**
|
||||
* _clat_prefix_is_better:
|
||||
* @best: current best candidate (or %NULL)
|
||||
* @candidate: the new candidate prefix
|
||||
* @nat64_pref: the NAT64 prefix
|
||||
*
|
||||
* Compare two SLAAC candidate prefixes to be used for CLAT,
|
||||
* as recommended by draft-ietf-v6ops-claton Section 7. Apply
|
||||
* rules 6 and 8 of the source address selection algorithm from
|
||||
* RFC 6724, Section 5.
|
||||
*
|
||||
* Returns %TRUE if @candidate is better than @best.
|
||||
*/
|
||||
static gboolean
|
||||
_clat_prefix_is_better(const NMPlatformIP6Address *best,
|
||||
const NMPlatformIP6Address *candidate,
|
||||
const struct in6_addr *nat64_pref)
|
||||
{
|
||||
guint nat64_pref_label;
|
||||
gboolean best_label_match;
|
||||
gboolean cand_label_match;
|
||||
guint best_prefix_len;
|
||||
guint cand_prefix_len;
|
||||
|
||||
if (!best)
|
||||
return TRUE;
|
||||
|
||||
/* Rule 6: prefer the address whose RFC 6724 label matches
|
||||
* the label of the NAT64 prefix. */
|
||||
nat64_pref_label = nm_ip6_addr_rfc6724_label(nat64_pref);
|
||||
best_label_match = nm_ip6_addr_rfc6724_label(&best->address) == nat64_pref_label;
|
||||
cand_label_match = nm_ip6_addr_rfc6724_label(&candidate->address) == nat64_pref_label;
|
||||
|
||||
if (cand_label_match && !best_label_match)
|
||||
return TRUE;
|
||||
else if (best_label_match && !cand_label_match)
|
||||
return FALSE;
|
||||
|
||||
/* Rule 8: longest matching prefix with the NAT64 prefix. */
|
||||
best_prefix_len = nm_ip6_addr_common_prefix_len(&best->address, nat64_pref);
|
||||
cand_prefix_len = nm_ip6_addr_common_prefix_len(&candidate->address, nat64_pref);
|
||||
if (cand_prefix_len != best_prefix_len)
|
||||
return cand_prefix_len > best_prefix_len;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif /* HAVE_CLAT */
|
||||
|
||||
static void
|
||||
_l3cfg_update_clat_config(NML3Cfg *self,
|
||||
NML3ConfigData *l3cd,
|
||||
|
|
@ -4255,19 +4206,9 @@ _l3cfg_update_clat_config(NML3Cfg *self,
|
|||
network_id = nm_l3_config_data_get_network_id(l3cd);
|
||||
|
||||
if (!self->priv.p->clat_address_6_valid && network_id) {
|
||||
const NMPlatformIP6Address *best_prefix = NULL;
|
||||
|
||||
/* Select the best SLAAC prefix for the CLAT address per
|
||||
* draft-ietf-v6ops-claton-14 Section 7 */
|
||||
nm_l3_config_data_iter_ip6_address_for_each (&iter, l3cd, &ip6_entry) {
|
||||
if (ip6_entry->addr_source == NM_IP_CONFIG_SOURCE_NDISC && ip6_entry->plen == 64) {
|
||||
if (_clat_prefix_is_better(best_prefix, ip6_entry, &pref64))
|
||||
best_prefix = ip6_entry;
|
||||
}
|
||||
}
|
||||
|
||||
if (best_prefix) {
|
||||
ip6 = best_prefix->address;
|
||||
ip6 = ip6_entry->address;
|
||||
|
||||
nm_utils_ipv6_addr_set_stable_privacy(NM_UTILS_STABLE_TYPE_CLAT,
|
||||
&ip6,
|
||||
|
|
@ -4279,12 +4220,14 @@ _l3cfg_update_clat_config(NML3Cfg *self,
|
|||
.address = ip6,
|
||||
.peer_address = ip6,
|
||||
.addr_source = NM_IP_CONFIG_SOURCE_CLAT,
|
||||
.plen = best_prefix->plen,
|
||||
.plen = ip6_entry->plen,
|
||||
};
|
||||
|
||||
_LOGT("clat: using IPv6 address %s", nm_inet6_ntop(&ip6, buf));
|
||||
|
||||
self->priv.p->clat_address_6_valid = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ typedef struct {
|
|||
} platform_change;
|
||||
|
||||
struct {
|
||||
guint64 obj_type_flags;
|
||||
guint32 obj_type_flags;
|
||||
} platform_change_on_idle;
|
||||
|
||||
struct {
|
||||
|
|
@ -207,7 +207,7 @@ struct _NML3Cfg {
|
|||
* NML3Cfg instance. We track some per-l3cfg-data that is only
|
||||
* relevant to NMNetns here. */
|
||||
struct {
|
||||
guint64 signal_pending_obj_type_flags;
|
||||
guint32 signal_pending_obj_type_flags;
|
||||
CList signal_pending_lst;
|
||||
CList ecmp_track_ifindex_lst_head;
|
||||
} internal_netns;
|
||||
|
|
@ -223,7 +223,7 @@ NML3Cfg *nm_l3cfg_new(NMNetns *netns, int ifindex);
|
|||
|
||||
gboolean nm_l3cfg_is_ready(NML3Cfg *self);
|
||||
|
||||
void _nm_l3cfg_notify_platform_change_on_idle(NML3Cfg *self, guint64 obj_type_flags);
|
||||
void _nm_l3cfg_notify_platform_change_on_idle(NML3Cfg *self, guint32 obj_type_flags);
|
||||
|
||||
void _nm_l3cfg_notify_platform_change(NML3Cfg *self,
|
||||
NMPlatformSignalChangeType change_type,
|
||||
|
|
|
|||
|
|
@ -8146,27 +8146,6 @@ nm_manager_start(NMManager *self, GError **error)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
compare_device_remove_order(const CList *a, const CList *b, const void *user_data)
|
||||
{
|
||||
NMDevice *dev_a = c_list_entry(a, NMDevice, devices_lst);
|
||||
NMDevice *dev_b = c_list_entry(b, NMDevice, devices_lst);
|
||||
|
||||
gboolean a_has_dhcp =
|
||||
nm_device_get_dhcp_config(dev_a, AF_INET) || nm_device_get_dhcp_config(dev_a, AF_INET6);
|
||||
gboolean b_has_dhcp =
|
||||
nm_device_get_dhcp_config(dev_b, AF_INET) || nm_device_get_dhcp_config(dev_b, AF_INET6);
|
||||
gboolean a_is_software = nm_device_is_software(dev_a);
|
||||
gboolean b_is_software = nm_device_is_software(dev_b);
|
||||
|
||||
/* priority: software AND dhcp first, then dhcp only
|
||||
* then everything else,*/
|
||||
uint a_score = a_has_dhcp ? (a_is_software ? 2 : 1) : 0;
|
||||
uint b_score = b_has_dhcp ? (b_is_software ? 2 : 1) : 0;
|
||||
|
||||
return b_score - a_score;
|
||||
}
|
||||
|
||||
void
|
||||
nm_manager_stop(NMManager *self)
|
||||
{
|
||||
|
|
@ -8188,12 +8167,6 @@ nm_manager_stop(NMManager *self)
|
|||
|
||||
nm_dbus_manager_stop(nm_dbus_object_get_manager(NM_DBUS_OBJECT(self)));
|
||||
|
||||
/* When OVS internal interface or linux bridge holds DHCP, if we delete its
|
||||
* physical interface first, then we cannot send out DHCP release request
|
||||
* anymore. To fix that, we need to remove/deactivate software interfaces that
|
||||
* holds DHCP config first.
|
||||
*/
|
||||
c_list_sort(&priv->devices_lst_head, compare_device_remove_order, NULL);
|
||||
while ((device = c_list_first_entry(&priv->devices_lst_head, NMDevice, devices_lst)))
|
||||
remove_device(self, device, TRUE);
|
||||
|
||||
|
|
|
|||
|
|
@ -207,7 +207,6 @@ _ecmp_track_sort_lst_cmp(const CList *a, const CList *b, const void *user_data)
|
|||
NM_CMP_FIELD(route_a, route_b, ifindex);
|
||||
NM_CMP_FIELD(route_b, route_a, weight);
|
||||
NM_CMP_DIRECT(htonl(route_a->gateway), htonl(route_b->gateway));
|
||||
NM_CMP_DIRECT(route_a->r_rtm_flags & RTNH_F_ONLINK, route_b->r_rtm_flags & RTNH_F_ONLINK);
|
||||
|
||||
return nm_assert_unreachable_val(
|
||||
nm_platform_ip4_route_cmp(route_a, route_b, NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID));
|
||||
|
|
@ -279,7 +278,6 @@ _ecmp_track_init_merged_obj(EcmpTrackEcmpid *track_ecmpid, const NMPObject **out
|
|||
.ifindex = r->ifindex,
|
||||
.gateway = r->gateway,
|
||||
.weight = r->weight,
|
||||
.rtnh_flags = r->r_rtm_flags & RTNH_F_ONLINK,
|
||||
};
|
||||
}
|
||||
i++;
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ ip6_subnet_from_delegation(IP6PrefixDelegation *delegation, NMDevice *device)
|
|||
}
|
||||
|
||||
/* Check for out-of-prefixes condition */
|
||||
num_subnets = (guint64) 1 << (64 - delegation->prefix.plen);
|
||||
num_subnets = 1 << (64 - delegation->prefix.plen);
|
||||
if (nm_g_hash_table_size(delegation->map_subnet_id_to_ifindex) >= num_subnets) {
|
||||
_LOGD(LOGD_IP6,
|
||||
"ipv6-pd: no more prefixes in %s/%u",
|
||||
|
|
|
|||
|
|
@ -1230,7 +1230,7 @@ out:
|
|||
}
|
||||
|
||||
gboolean
|
||||
nmtstp_check_platform_full(NMPlatform *platform, guint64 obj_type_flags, gboolean do_assert)
|
||||
nmtstp_check_platform_full(NMPlatform *platform, guint32 obj_type_flags, gboolean do_assert)
|
||||
{
|
||||
static const NMPObjectType obj_types[] = {
|
||||
NMP_OBJECT_TYPE_IP4_ADDRESS,
|
||||
|
|
@ -1265,7 +1265,7 @@ nmtstp_check_platform_full(NMPlatform *platform, guint64 obj_type_flags, gboolea
|
|||
|
||||
for (i_obj_types = 0; i_obj_types < (int) G_N_ELEMENTS(obj_types); i_obj_types++) {
|
||||
const NMPObjectType obj_type = obj_types[i_obj_types];
|
||||
const guint64 i_obj_type_flags = nmp_object_type_to_flags(obj_type);
|
||||
const guint32 i_obj_type_flags = nmp_object_type_to_flags(obj_type);
|
||||
gs_unref_ptrarray GPtrArray *arr1 = NULL;
|
||||
gs_unref_ptrarray GPtrArray *arr2 = NULL;
|
||||
NMPLookup lookup;
|
||||
|
|
@ -1408,7 +1408,7 @@ nmtstp_check_platform_full(NMPlatform *platform, guint64 obj_type_flags, gboolea
|
|||
}
|
||||
|
||||
void
|
||||
nmtstp_check_platform(NMPlatform *platform, guint64 obj_type_flags)
|
||||
nmtstp_check_platform(NMPlatform *platform, guint32 obj_type_flags)
|
||||
{
|
||||
if (!nmtstp_check_platform_full(platform, obj_type_flags, FALSE)) {
|
||||
/* It's unclear why this failure sometimes happens. It happens
|
||||
|
|
@ -2393,61 +2393,6 @@ nmtstp_link_dummy_add(NMPlatform *platform, int external_command, const char *na
|
|||
return pllink;
|
||||
}
|
||||
|
||||
const NMPlatformLink *
|
||||
nmtstp_link_geneve_add(NMPlatform *platform,
|
||||
int external_command,
|
||||
const char *name,
|
||||
const NMPlatformLnkGeneve *lnk)
|
||||
{
|
||||
const NMPlatformLink *pllink = NULL;
|
||||
int success;
|
||||
|
||||
g_assert(nm_utils_ifname_valid_kernel(name, NULL));
|
||||
g_assert(lnk->remote || !IN6_IS_ADDR_UNSPECIFIED(&lnk->remote6));
|
||||
|
||||
external_command = nmtstp_run_command_check_external(external_command);
|
||||
|
||||
_init_platform(&platform, external_command);
|
||||
|
||||
if (external_command) {
|
||||
char remote[NM_INET_ADDRSTRLEN];
|
||||
char remote6[NM_INET_ADDRSTRLEN];
|
||||
char str_ttl[30];
|
||||
|
||||
if (lnk->remote)
|
||||
nm_inet4_ntop(lnk->remote, remote);
|
||||
else
|
||||
remote[0] = '\0';
|
||||
|
||||
if (memcmp(&lnk->remote6, &in6addr_any, sizeof(in6addr_any)))
|
||||
nm_inet6_ntop(&lnk->remote6, remote6);
|
||||
else
|
||||
remote6[0] = '\0';
|
||||
|
||||
success = !nmtstp_run_command(
|
||||
"ip link add %s type geneve id %u remote %s %s tos %02x dstport %u%s",
|
||||
name,
|
||||
lnk->id,
|
||||
remote[0] ? remote : remote6,
|
||||
lnk->ttl > 0 ? nm_sprintf_buf(str_ttl, "ttl %u", lnk->ttl & 0xff)
|
||||
: lnk->ttl == 0 ? "ttl auto"
|
||||
: "ttl inherit",
|
||||
lnk->tos,
|
||||
lnk->dst_port,
|
||||
lnk->df == 1 ? " df set "
|
||||
: lnk->df == 2 ? " df inherit "
|
||||
: "");
|
||||
|
||||
if (success)
|
||||
pllink = nmtstp_assert_wait_for_link(platform, name, NM_LINK_TYPE_GENEVE, 100);
|
||||
} else
|
||||
success = NMTST_NM_ERR_SUCCESS(nm_platform_link_geneve_add(platform, name, lnk, &pllink));
|
||||
|
||||
_assert_pllink(platform, success, pllink, name, NM_LINK_TYPE_GENEVE);
|
||||
|
||||
return pllink;
|
||||
}
|
||||
|
||||
const NMPlatformLink *
|
||||
nmtstp_link_gre_add(NMPlatform *platform,
|
||||
int external_command,
|
||||
|
|
@ -3079,6 +3024,8 @@ nmtstp_link_vxlan_add(NMPlatform *platform,
|
|||
return pllink;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
const NMPlatformLink *
|
||||
nmtstp_link_get_typed(NMPlatform *platform, int ifindex, const char *name, NMLinkType link_type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -140,9 +140,9 @@ int nmtstp_run_command(const char *format, ...) _nm_printf(1, 2);
|
|||
/*****************************************************************************/
|
||||
|
||||
gboolean
|
||||
nmtstp_check_platform_full(NMPlatform *platform, guint64 obj_type_flags, gboolean do_assert);
|
||||
nmtstp_check_platform_full(NMPlatform *platform, guint32 obj_type_flags, gboolean do_assert);
|
||||
|
||||
void nmtstp_check_platform(NMPlatform *platform, guint64 obj_type_flags);
|
||||
void nmtstp_check_platform(NMPlatform *platform, guint32 obj_type_flags);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -474,10 +474,6 @@ const NMPlatformLink *nmtstp_link_veth_add(NMPlatform *platform,
|
|||
const char *peer);
|
||||
const NMPlatformLink *
|
||||
nmtstp_link_dummy_add(NMPlatform *platform, int external_command, const char *name);
|
||||
const NMPlatformLink *nmtstp_link_geneve_add(NMPlatform *platform,
|
||||
int external_command,
|
||||
const char *name,
|
||||
const NMPlatformLnkGeneve *lnk);
|
||||
const NMPlatformLink *nmtstp_link_gre_add(NMPlatform *platform,
|
||||
int external_command,
|
||||
const char *name,
|
||||
|
|
|
|||
|
|
@ -1388,7 +1388,6 @@ test_software_detect(gconstpointer user_data)
|
|||
const gboolean ext = test_data->external_command;
|
||||
NMPlatformLnkBridge lnk_bridge = {};
|
||||
NMPlatformLnkTun lnk_tun;
|
||||
NMPlatformLnkGeneve lnk_geneve = {};
|
||||
NMPlatformLnkGre lnk_gre = {};
|
||||
NMPlatformLnkVti lnk_vti = {};
|
||||
NMPlatformLnkVti6 lnk_vti6 = {};
|
||||
|
|
@ -1435,31 +1434,6 @@ test_software_detect(gconstpointer user_data)
|
|||
g_error("Failed adding Bridge interface");
|
||||
break;
|
||||
|
||||
case NM_LINK_TYPE_GENEVE:
|
||||
{
|
||||
switch (test_data->test_mode) {
|
||||
case 0:
|
||||
lnk_geneve.id = 42;
|
||||
lnk_geneve.remote = nmtst_inet4_from_string("192.168.1.100");
|
||||
lnk_geneve.ttl = 64;
|
||||
lnk_geneve.tos = 0;
|
||||
lnk_geneve.dst_port = 6081;
|
||||
lnk_geneve.df = 0;
|
||||
break;
|
||||
case 1:
|
||||
lnk_geneve.id = 12345;
|
||||
lnk_geneve.remote6 = nmtst_inet6_from_string("2001:db8::1");
|
||||
lnk_geneve.ttl = 128;
|
||||
lnk_geneve.tos = 16;
|
||||
lnk_geneve.dst_port = 6082;
|
||||
lnk_geneve.df = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
g_assert(nmtstp_link_geneve_add(NULL, ext, DEVICE_NAME, &lnk_geneve));
|
||||
break;
|
||||
}
|
||||
|
||||
case NM_LINK_TYPE_GRE:
|
||||
module_loaded = nmtstp_ensure_module("ip_gre");
|
||||
|
||||
|
|
@ -2234,34 +2208,6 @@ test_software_detect(gconstpointer user_data)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case NM_LINK_TYPE_GENEVE:
|
||||
{
|
||||
const NMPlatformLnkGeneve *plnk = &lnk->lnk_geneve;
|
||||
|
||||
g_assert(plnk == nm_platform_link_get_lnk_geneve(NM_PLATFORM_GET, ifindex, NULL));
|
||||
|
||||
switch (test_data->test_mode) {
|
||||
case 0:
|
||||
g_assert_cmpint(plnk->id, ==, 42);
|
||||
nmtst_assert_ip4_address(plnk->remote, "192.168.1.100");
|
||||
nmtst_assert_ip6_address(&plnk->remote6, "::");
|
||||
g_assert_cmpint(plnk->ttl, ==, 64);
|
||||
g_assert_cmpint(plnk->tos, ==, 0);
|
||||
g_assert_cmpint(plnk->dst_port, ==, 6081);
|
||||
g_assert_cmpint(plnk->df, ==, 0);
|
||||
break;
|
||||
case 1:
|
||||
g_assert_cmpint(plnk->id, ==, 12345);
|
||||
nmtst_assert_ip4_address(plnk->remote, "0.0.0.0");
|
||||
nmtst_assert_ip6_address(&plnk->remote6, "2001:db8::1");
|
||||
g_assert_cmpint(plnk->ttl, ==, 128);
|
||||
g_assert_cmpint(plnk->tos, ==, 16);
|
||||
g_assert_cmpint(plnk->dst_port, ==, 6082);
|
||||
g_assert_cmpint(plnk->df, ==, 1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NM_LINK_TYPE_WIREGUARD:
|
||||
{
|
||||
const NMPlatformLnkWireGuard *plnk = &lnk->lnk_wireguard;
|
||||
|
|
@ -4197,8 +4143,6 @@ _nmtstp_setup_tests(void)
|
|||
g_test_add_func("/link/external", test_external);
|
||||
|
||||
test_software_detect_add("/link/software/detect/bridge", NM_LINK_TYPE_BRIDGE, 0);
|
||||
test_software_detect_add("/link/software/detect/geneve/0", NM_LINK_TYPE_GENEVE, 0);
|
||||
test_software_detect_add("/link/software/detect/geneve/1", NM_LINK_TYPE_GENEVE, 1);
|
||||
test_software_detect_add("/link/software/detect/gre", NM_LINK_TYPE_GRE, 0);
|
||||
test_software_detect_add("/link/software/detect/gretap", NM_LINK_TYPE_GRETAP, 0);
|
||||
test_software_detect_add("/link/software/detect/ip6tnl/0", NM_LINK_TYPE_IP6TNL, 0);
|
||||
|
|
|
|||
|
|
@ -2460,78 +2460,6 @@ done:
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static void
|
||||
test_ip4_rtnh_onlink(void)
|
||||
{
|
||||
/* Extra nexthops that differ only in rtnh_flags ONLINK should
|
||||
* compare as different. */
|
||||
NMPlatformIP4RtNextHop nh_a = {
|
||||
.ifindex = 2,
|
||||
.gateway = nmtst_inet4_from_string("10.10.10.10"),
|
||||
.weight = 1,
|
||||
.rtnh_flags = 0,
|
||||
};
|
||||
|
||||
NMPlatformIP4RtNextHop nh_b = nh_a;
|
||||
nh_b.rtnh_flags = RTNH_F_ONLINK;
|
||||
|
||||
g_assert_cmpint(nm_platform_ip4_rt_nexthop_cmp(&nh_a, &nh_b, TRUE), !=, 0);
|
||||
g_assert_cmpint(nm_platform_ip4_rt_nexthop_cmp(&nh_a, &nh_b, FALSE), !=, 0);
|
||||
|
||||
nh_b.rtnh_flags = 0;
|
||||
g_assert_cmpint(nm_platform_ip4_rt_nexthop_cmp(&nh_a, &nh_b, TRUE), ==, 0);
|
||||
g_assert_cmpint(nm_platform_ip4_rt_nexthop_cmp(&nh_a, &nh_b, FALSE), ==, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
test_ip4_route_onlink_per_nexthop(void)
|
||||
{
|
||||
NMPlatformIP4Route r_a = {};
|
||||
NMPlatformIP4Route r_b;
|
||||
|
||||
/* Two single-hop routes that are identical, except for the onlink flag. */
|
||||
r_a.ifindex = 1;
|
||||
r_a.rt_source = NM_IP_CONFIG_SOURCE_USER;
|
||||
r_a.network = nmtst_inet4_from_string("10.10.10.10");
|
||||
r_a.plen = 24;
|
||||
r_a.gateway = nmtst_inet4_from_string("10.10.10.1");
|
||||
r_a.metric = 100;
|
||||
r_a.n_nexthops = 1;
|
||||
r_a.type_coerced = nm_platform_route_type_coerce(RTN_UNICAST);
|
||||
r_a.scope_inv = nm_platform_route_scope_inv(RT_SCOPE_UNIVERSE);
|
||||
|
||||
r_b = r_a;
|
||||
r_b.r_rtm_flags = RTNH_F_ONLINK;
|
||||
|
||||
/* Onlink flag should result in the same ECMP_ID but different IDs. */
|
||||
g_assert_cmpint(nm_platform_ip4_route_cmp(&r_a, &r_b, NM_PLATFORM_IP_ROUTE_CMP_TYPE_ECMP_ID),
|
||||
==,
|
||||
0);
|
||||
|
||||
g_assert_cmpint(nm_platform_ip4_route_cmp(&r_a, &r_b, NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID), !=, 0);
|
||||
g_assert_cmpint(
|
||||
nm_platform_ip4_route_cmp(&r_a, &r_b, NM_PLATFORM_IP_ROUTE_CMP_TYPE_SEMANTICALLY),
|
||||
!=,
|
||||
0);
|
||||
g_assert_cmpint(nm_platform_ip4_route_cmp(&r_a, &r_b, NM_PLATFORM_IP_ROUTE_CMP_TYPE_FULL),
|
||||
!=,
|
||||
0);
|
||||
|
||||
r_b.r_rtm_flags = 0;
|
||||
g_assert_cmpint(nm_platform_ip4_route_cmp(&r_a, &r_b, NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID), ==, 0);
|
||||
g_assert_cmpint(nm_platform_ip4_route_cmp(&r_a, &r_b, NM_PLATFORM_IP_ROUTE_CMP_TYPE_ECMP_ID),
|
||||
==,
|
||||
0);
|
||||
g_assert_cmpint(
|
||||
nm_platform_ip4_route_cmp(&r_a, &r_b, NM_PLATFORM_IP_ROUTE_CMP_TYPE_SEMANTICALLY),
|
||||
==,
|
||||
0);
|
||||
g_assert_cmpint(nm_platform_ip4_route_cmp(&r_a, &r_b, NM_PLATFORM_IP_ROUTE_CMP_TYPE_FULL),
|
||||
==,
|
||||
0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NMTstpSetupFunc const _nmtstp_setup_platform_func = SETUP;
|
||||
|
|
@ -2552,8 +2480,6 @@ _nmtstp_setup_tests(void)
|
|||
nmtstp_env1_add_test_func_data(testpath, test_func, arg, 2, TRUE)
|
||||
|
||||
add_test_func("/route/ip4", test_ip4_route);
|
||||
add_test_func("/route/ip4_onlink_per_nexthop", test_ip4_route_onlink_per_nexthop);
|
||||
add_test_func("/route/ip4_rtnh_onlink", test_ip4_rtnh_onlink);
|
||||
add_test_func("/route/ip6", test_ip6_route);
|
||||
add_test_func("/route/ip4_metric0", test_ip4_route_metric0);
|
||||
add_test_func_data("/route/ip4_options/1", test_ip4_route_options, GINT_TO_POINTER(1));
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ nm_ip_up(void *data, int arg)
|
|||
g_variant_builder_add(&builder,
|
||||
"{sv}",
|
||||
NM_PPP_IP4_CONFIG_GATEWAY,
|
||||
g_variant_new_uint32(peer_opts.hisaddr));
|
||||
g_variant_new_uint32(peer_opts.ouraddr));
|
||||
}
|
||||
|
||||
g_variant_builder_add(&builder, "{sv}", NM_PPP_IP4_CONFIG_PREFIX, g_variant_new_uint32(32));
|
||||
|
|
|
|||
|
|
@ -1083,39 +1083,6 @@ _con_get_request_start_validated(NMAuthChain *chain,
|
|||
_con_get_request_start_proceed(req, req->con.current_has_modify);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_req_has_existing_secrets(Request *req)
|
||||
{
|
||||
GVariantIter iter;
|
||||
const char *setting_name;
|
||||
GVariant *setting_dict;
|
||||
gboolean has;
|
||||
|
||||
if (!req->con.get.existing_secrets)
|
||||
return FALSE;
|
||||
|
||||
nm_assert(g_variant_is_of_type(req->con.get.existing_secrets, NM_VARIANT_TYPE_CONNECTION));
|
||||
|
||||
g_variant_iter_init(&iter, req->con.get.existing_secrets);
|
||||
while (g_variant_iter_next(&iter, "{&s@a{sv}}", &setting_name, &setting_dict)) {
|
||||
GVariantIter setting_iter;
|
||||
GVariant *val;
|
||||
|
||||
g_variant_iter_init(&setting_iter, setting_dict);
|
||||
while (g_variant_iter_next(&setting_iter, "{&sv}", NULL, &val)) {
|
||||
has = !g_variant_is_container(val) || g_variant_n_children(val) > 0;
|
||||
g_variant_unref(val);
|
||||
if (has) {
|
||||
g_variant_unref(setting_dict);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
g_variant_unref(setting_dict);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_con_get_request_start(Request *req)
|
||||
{
|
||||
|
|
@ -1136,7 +1103,7 @@ _con_get_request_start(Request *req)
|
|||
* unprivileged users.
|
||||
*/
|
||||
if ((req->con.get.flags != NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE)
|
||||
&& (_req_has_existing_secrets(req)
|
||||
&& (req->con.get.existing_secrets
|
||||
|| _nm_connection_aggregate(req->con.connection,
|
||||
NM_CONNECTION_AGGREGATE_ANY_SYSTEM_SECRET_FLAGS,
|
||||
NULL))) {
|
||||
|
|
|
|||
|
|
@ -781,8 +781,7 @@ validate_secret_flags(NMConnection *connection, GVariant *secrets, ForEachSecret
|
|||
static gboolean
|
||||
secret_is_system_owned(NMSettingSecretFlags flags, gpointer user_data)
|
||||
{
|
||||
return !NM_FLAGS_ANY(flags,
|
||||
NM_SETTING_SECRET_FLAG_AGENT_OWNED | NM_SETTING_SECRET_FLAG_NOT_SAVED);
|
||||
return !NM_FLAGS_HAS(flags, NM_SETTING_SECRET_FLAG_AGENT_OWNED);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -311,108 +311,6 @@ test_config_override(void)
|
|||
g_assert_cmpstr(plugins[3], ==, "delta");
|
||||
}
|
||||
|
||||
static void
|
||||
test_config_managed(void)
|
||||
{
|
||||
NMConfig *config;
|
||||
const char *CONFIG_USER = BUILD_DIR "/test-config-managed.conf";
|
||||
const char *CONFIG_INTERN = BUILD_DIR "/test-config-managed-intern.conf";
|
||||
NMDevice *dev;
|
||||
gs_free char *group_by_name = NULL;
|
||||
const char *ifname, *group_by_mac;
|
||||
NMTernary managed;
|
||||
gboolean by_mac;
|
||||
GKeyFile *kf = nm_config_create_keyfile();
|
||||
|
||||
dev = nm_test_device_new("11:11:11:11:11:11");
|
||||
ifname = nm_device_get_iface(dev);
|
||||
group_by_name =
|
||||
g_strdup_printf(NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN_DEVICE "-manage-%s", ifname);
|
||||
group_by_mac = NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN_DEVICE "-manage-11-11-11-11-11-11";
|
||||
|
||||
g_assert(g_file_set_contents(CONFIG_USER, "", 0, NULL));
|
||||
g_assert(g_file_set_contents(CONFIG_INTERN, "", 0, NULL));
|
||||
|
||||
config = setup_config(NULL, CONFIG_USER, CONFIG_INTERN, NULL, "/no/such/dir", "", NULL);
|
||||
|
||||
g_assert(nm_config_get_device_managed(config, dev, &managed, NULL, NULL));
|
||||
g_assert_cmpint(managed, ==, NM_TERNARY_DEFAULT);
|
||||
|
||||
/* Matching by name */
|
||||
NMTST_EXPECT_NM_INFO("config: signal: *");
|
||||
g_assert(nm_config_set_device_managed(config, dev, NM_TERNARY_TRUE, FALSE, NULL));
|
||||
g_assert(nm_config_get_device_managed(config, dev, &managed, &by_mac, NULL));
|
||||
g_assert_cmpint(managed, ==, NM_TERNARY_TRUE);
|
||||
g_assert_false(by_mac);
|
||||
g_key_file_load_from_file(kf, CONFIG_INTERN, G_KEY_FILE_NONE, NULL);
|
||||
g_assert_false(g_key_file_has_key(kf, group_by_mac, "managed", NULL));
|
||||
g_assert_true(g_key_file_has_key(kf, group_by_name, "managed", NULL));
|
||||
g_assert_cmpint(g_key_file_get_integer(kf, group_by_name, "managed", NULL), ==, 1);
|
||||
|
||||
NMTST_EXPECT_NM_INFO("config: signal: *");
|
||||
g_assert(nm_config_set_device_managed(config, dev, NM_TERNARY_FALSE, FALSE, NULL));
|
||||
g_assert(nm_config_get_device_managed(config, dev, &managed, &by_mac, NULL));
|
||||
g_assert_cmpint(managed, ==, NM_TERNARY_FALSE);
|
||||
g_assert_false(by_mac);
|
||||
g_key_file_load_from_file(kf, CONFIG_INTERN, G_KEY_FILE_NONE, NULL);
|
||||
g_assert_false(g_key_file_has_key(kf, group_by_mac, "managed", NULL));
|
||||
g_assert_true(g_key_file_has_key(kf, group_by_name, "managed", NULL));
|
||||
g_assert_cmpint(g_key_file_get_integer(kf, group_by_name, "managed", NULL), ==, 0);
|
||||
|
||||
/* Matching by MAC address */
|
||||
NMTST_EXPECT_NM_INFO("config: signal: *");
|
||||
g_assert(nm_config_set_device_managed(config, dev, NM_TERNARY_TRUE, TRUE, NULL));
|
||||
g_assert(nm_config_get_device_managed(config, dev, &managed, &by_mac, NULL));
|
||||
g_assert_cmpint(managed, ==, NM_TERNARY_TRUE);
|
||||
g_assert_true(by_mac);
|
||||
g_key_file_load_from_file(kf, CONFIG_INTERN, G_KEY_FILE_NONE, NULL);
|
||||
g_assert_false(g_key_file_has_key(kf, group_by_name, "managed", NULL));
|
||||
g_assert_true(g_key_file_has_key(kf, group_by_mac, "managed", NULL));
|
||||
g_assert_cmpint(g_key_file_get_integer(kf, group_by_mac, "managed", NULL), ==, 1);
|
||||
|
||||
NMTST_EXPECT_NM_INFO("config: signal: *");
|
||||
g_assert(nm_config_set_device_managed(config, dev, NM_TERNARY_FALSE, TRUE, NULL));
|
||||
g_assert(nm_config_get_device_managed(config, dev, &managed, &by_mac, NULL));
|
||||
g_assert_cmpint(managed, ==, NM_TERNARY_FALSE);
|
||||
g_assert_true(by_mac);
|
||||
g_key_file_load_from_file(kf, CONFIG_INTERN, G_KEY_FILE_NONE, NULL);
|
||||
g_assert_false(g_key_file_has_key(kf, group_by_name, "managed", NULL));
|
||||
g_assert_true(g_key_file_has_key(kf, group_by_mac, "managed", NULL));
|
||||
g_assert_cmpint(g_key_file_get_integer(kf, group_by_mac, "managed", NULL), ==, 0);
|
||||
|
||||
/* Resetting the managed state */
|
||||
NMTST_EXPECT_NM_INFO("config: signal: *");
|
||||
g_assert(nm_config_set_device_managed(config, dev, NM_TERNARY_DEFAULT, FALSE, NULL));
|
||||
g_assert(nm_config_get_device_managed(config, dev, &managed, NULL, NULL));
|
||||
g_assert_cmpint(managed, ==, NM_TERNARY_DEFAULT);
|
||||
g_key_file_load_from_file(kf, CONFIG_INTERN, G_KEY_FILE_NONE, NULL);
|
||||
g_assert_false(g_key_file_has_key(kf, group_by_name, "managed", NULL));
|
||||
g_assert_false(g_key_file_has_key(kf, group_by_mac, "managed", NULL));
|
||||
|
||||
g_object_unref(config);
|
||||
|
||||
/* Both values set in the intern config file, different values */
|
||||
g_key_file_set_string(kf, group_by_name, "managed", "1");
|
||||
g_key_file_set_string(kf, group_by_mac, "managed", "0");
|
||||
g_assert(g_key_file_save_to_file(kf, CONFIG_INTERN, NULL));
|
||||
config = setup_config(NULL, CONFIG_USER, CONFIG_INTERN, NULL, "/no/such/dir", "", NULL);
|
||||
g_assert(!nm_config_get_device_managed(config, dev, &managed, NULL, NULL));
|
||||
|
||||
g_object_unref(config);
|
||||
|
||||
/* Both values set in the intern config file, same values */
|
||||
g_key_file_set_string(kf, group_by_name, "managed", "1");
|
||||
g_key_file_set_string(kf, group_by_mac, "managed", "1");
|
||||
g_assert(g_key_file_save_to_file(kf, CONFIG_INTERN, NULL));
|
||||
config = setup_config(NULL, CONFIG_USER, CONFIG_INTERN, NULL, "/no/such/dir", "", NULL);
|
||||
g_assert(nm_config_get_device_managed(config, dev, &managed, NULL, NULL));
|
||||
g_assert_cmpint(managed, ==, NM_TERNARY_TRUE);
|
||||
|
||||
g_key_file_unref(kf);
|
||||
g_object_unref(dev);
|
||||
g_object_unref(config);
|
||||
}
|
||||
|
||||
static void
|
||||
test_config_global_dns(void)
|
||||
{
|
||||
|
|
@ -1514,7 +1412,6 @@ main(int argc, char **argv)
|
|||
|
||||
g_test_add_func("/config/set-values", test_config_set_values);
|
||||
g_test_add_func("/config/global-dns", test_config_global_dns);
|
||||
g_test_add_func("/config/managed", test_config_managed);
|
||||
g_test_add_func("/config/connectivity-check", test_config_connectivity_check);
|
||||
|
||||
g_test_add_func("/config/signal", test_config_signal);
|
||||
|
|
|
|||
|
|
@ -2135,20 +2135,16 @@ _dbus_signal_ip_config_cb(NMVpnConnection *self, int addr_family, GVariant *dict
|
|||
IS_IPv4 ? NM_VPN_PLUGIN_IP4_CONFIG_DOMAIN
|
||||
: NM_VPN_PLUGIN_IP6_CONFIG_DOMAIN,
|
||||
"&s",
|
||||
&v_str)) {
|
||||
&v_str))
|
||||
nm_l3_config_data_add_domain(l3cd, addr_family, v_str);
|
||||
nm_l3_config_data_add_search(l3cd, addr_family, v_str);
|
||||
}
|
||||
|
||||
if (g_variant_lookup(dict,
|
||||
IS_IPv4 ? NM_VPN_PLUGIN_IP4_CONFIG_DOMAINS
|
||||
: NM_VPN_PLUGIN_IP6_CONFIG_DOMAINS,
|
||||
"as",
|
||||
&var_iter)) {
|
||||
while (g_variant_iter_next(var_iter, "&s", &v_str)) {
|
||||
while (g_variant_iter_next(var_iter, "&s", &v_str))
|
||||
nm_l3_config_data_add_domain(l3cd, addr_family, v_str);
|
||||
nm_l3_config_data_add_search(l3cd, addr_family, v_str);
|
||||
}
|
||||
g_variant_iter_free(var_iter);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,4 @@
|
|||
#define NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN_GLOBAL_DNS_DOMAIN \
|
||||
NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN NM_CONFIG_KEYFILE_GROUPPREFIX_GLOBAL_DNS_DOMAIN
|
||||
|
||||
#define NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN_DEVICE \
|
||||
NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN NM_CONFIG_KEYFILE_GROUPPREFIX_DEVICE
|
||||
|
||||
#endif /* __NM_CONFIG_BASE_H__ */
|
||||
|
|
|
|||
|
|
@ -2106,29 +2106,8 @@ global:
|
|||
|
||||
libnm_1_58_0 {
|
||||
global:
|
||||
nm_connection_get_setting_geneve;
|
||||
nm_device_geneve_get_df;
|
||||
nm_device_geneve_get_dst_port;
|
||||
nm_device_geneve_get_id;
|
||||
nm_device_geneve_get_remote;
|
||||
nm_device_geneve_get_tos;
|
||||
nm_device_geneve_get_ttl;
|
||||
nm_device_geneve_get_type;
|
||||
nm_device_managed_flags_get_type;
|
||||
nm_device_managed_get_type;
|
||||
nm_device_set_managed_async;
|
||||
nm_device_set_managed_finish;
|
||||
nm_ip_config_get_clat_address;
|
||||
nm_ip_config_get_clat_pref64;
|
||||
nm_setting_geneve_df_get_type;
|
||||
nm_setting_geneve_get_destination_port;
|
||||
nm_setting_geneve_get_df;
|
||||
nm_setting_geneve_get_id;
|
||||
nm_setting_geneve_get_remote;
|
||||
nm_setting_geneve_get_tos;
|
||||
nm_setting_geneve_get_ttl;
|
||||
nm_setting_geneve_get_type;
|
||||
nm_setting_geneve_new;
|
||||
nm_setting_ip4_config_clat_get_type;
|
||||
nm_setting_ip4_config_get_clat;
|
||||
nm_utils_wifi_6ghz_freqs;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ libnm_client_impl_sources = files(
|
|||
'nm-device-bt.c',
|
||||
'nm-device-dummy.c',
|
||||
'nm-device-ethernet.c',
|
||||
'nm-device-geneve.c',
|
||||
'nm-device-generic.c',
|
||||
'nm-device-hsr.c',
|
||||
'nm-device-infiniband.c',
|
||||
|
|
@ -167,13 +166,13 @@ if enable_introspection
|
|||
install: true,
|
||||
)
|
||||
|
||||
gi_typelib_path = run_command('printenv', 'GI_TYPELIB_PATH', check: false).stdout().strip()
|
||||
gi_typelib_path = run_command('printenv', 'GI_TYPELIB_PATH', check: false).stdout()
|
||||
if gi_typelib_path != ''
|
||||
gi_typelib_path = ':' + gi_typelib_path
|
||||
endif
|
||||
gi_typelib_path = meson.current_build_dir() + gi_typelib_path
|
||||
|
||||
ld_library_path = run_command('printenv', 'LD_LIBRARY_PATH', check: false).stdout().strip()
|
||||
ld_library_path = run_command('printenv', 'LD_LIBRARY_PATH', check: false).stdout()
|
||||
if ld_library_path != ''
|
||||
ld_library_path = ':' + ld_library_path
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
#include "nm-device-dummy.h"
|
||||
#include "nm-device-ethernet.h"
|
||||
#include "nm-device-generic.h"
|
||||
#include "nm-device-geneve.h"
|
||||
#include "nm-device-hsr.h"
|
||||
#include "nm-device-infiniband.h"
|
||||
#include "nm-device-ip-tunnel.h"
|
||||
|
|
|
|||
|
|
@ -1,344 +0,0 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
/*
|
||||
* Copyright (C) 2026 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "libnm-client-impl/nm-default-libnm.h"
|
||||
|
||||
#include "nm-device-geneve.h"
|
||||
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-setting-geneve.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-object-private.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_ID,
|
||||
PROP_REMOTE,
|
||||
PROP_TOS,
|
||||
PROP_TTL,
|
||||
PROP_DST_PORT,
|
||||
PROP_DF, );
|
||||
|
||||
typedef struct {
|
||||
char *remote;
|
||||
guint32 id;
|
||||
gint32 ttl;
|
||||
guint16 dst_port;
|
||||
guint8 df;
|
||||
guint8 tos;
|
||||
} NMDeviceGenevePrivate;
|
||||
|
||||
struct _NMDeviceGeneve {
|
||||
NMDevice parent;
|
||||
NMDeviceGenevePrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMDeviceGeneveClass {
|
||||
NMDeviceClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(NMDeviceGeneve, nm_device_geneve, NM_TYPE_DEVICE)
|
||||
|
||||
#define NM_DEVICE_GENEVE_GET_PRIVATE(self) \
|
||||
_NM_GET_PRIVATE(self, NMDeviceGeneve, NM_IS_DEVICE_GENEVE, NMObject, NMDevice)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* nm_device_geneve_get_id:
|
||||
* @device: a #NMDeviceGeneve
|
||||
*
|
||||
* Returns: the device's GENEVE ID.
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
guint
|
||||
nm_device_geneve_get_id(NMDeviceGeneve *device)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_DEVICE_GENEVE(device), 0);
|
||||
|
||||
return NM_DEVICE_GENEVE_GET_PRIVATE(device)->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_geneve_get_remote:
|
||||
* @device: a #NMDeviceGeneve
|
||||
*
|
||||
* Returns: the IP address of the remote tunnel endpoint
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
const char *
|
||||
nm_device_geneve_get_remote(NMDeviceGeneve *device)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_DEVICE_GENEVE(device), NULL);
|
||||
|
||||
return _nml_coerce_property_str_not_empty(NM_DEVICE_GENEVE_GET_PRIVATE(device)->remote);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_geneve_get_dst_port:
|
||||
* @device: a #NMDeviceGeneve
|
||||
*
|
||||
* Returns: the UDP destination port
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
guint
|
||||
nm_device_geneve_get_dst_port(NMDeviceGeneve *device)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_DEVICE_GENEVE(device), 0);
|
||||
|
||||
return NM_DEVICE_GENEVE_GET_PRIVATE(device)->dst_port;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_geneve_get_tos:
|
||||
* @device: a #NMDeviceGeneve
|
||||
*
|
||||
* Returns: the TOS value to use in outgoing packets
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
guint
|
||||
nm_device_geneve_get_tos(NMDeviceGeneve *device)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_DEVICE_GENEVE(device), 0);
|
||||
|
||||
return NM_DEVICE_GENEVE_GET_PRIVATE(device)->tos;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_geneve_get_ttl:
|
||||
* @device: a #NMDeviceGeneve
|
||||
*
|
||||
* Returns: the time-to-live value to use in outgoing packets
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
guint
|
||||
nm_device_geneve_get_ttl(NMDeviceGeneve *device)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_DEVICE_GENEVE(device), 0);
|
||||
|
||||
return NM_DEVICE_GENEVE_GET_PRIVATE(device)->ttl;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_geneve_get_df:
|
||||
* @device: a #NMDeviceGeneve
|
||||
*
|
||||
* Returns: the Don't Fragment (DF) bit to set in outgoing packets
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
guint
|
||||
nm_device_geneve_get_df(NMDeviceGeneve *device)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_DEVICE_GENEVE(device), 0);
|
||||
|
||||
return NM_DEVICE_GENEVE_GET_PRIVATE(device)->df;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
|
||||
{
|
||||
NMSettingGeneve *s_geneve;
|
||||
|
||||
if (!NM_DEVICE_CLASS(nm_device_geneve_parent_class)
|
||||
->connection_compatible(device, connection, error))
|
||||
return FALSE;
|
||||
|
||||
if (!nm_connection_is_type(connection, NM_SETTING_GENEVE_SETTING_NAME)) {
|
||||
g_set_error_literal(error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
|
||||
_("The connection was not a GENEVE connection."));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s_geneve = nm_connection_get_setting_geneve(connection);
|
||||
if (nm_setting_geneve_get_id(s_geneve) != nm_device_geneve_get_id(NM_DEVICE_GENEVE(device))) {
|
||||
g_set_error_literal(
|
||||
error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
|
||||
_("The GENEVE identifiers of the device and the connection didn't match."));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GType
|
||||
get_setting_type(NMDevice *device)
|
||||
{
|
||||
return NM_TYPE_SETTING_GENEVE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMDeviceGeneve *device = NM_DEVICE_GENEVE(object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_ID:
|
||||
g_value_set_uint(value, nm_device_geneve_get_id(device));
|
||||
break;
|
||||
case PROP_REMOTE:
|
||||
g_value_set_string(value, nm_device_geneve_get_remote(device));
|
||||
break;
|
||||
case PROP_TOS:
|
||||
g_value_set_uint(value, nm_device_geneve_get_tos(device));
|
||||
break;
|
||||
case PROP_TTL:
|
||||
g_value_set_int(value, nm_device_geneve_get_ttl(device));
|
||||
break;
|
||||
case PROP_DST_PORT:
|
||||
g_value_set_uint(value, nm_device_geneve_get_dst_port(device));
|
||||
break;
|
||||
case PROP_DF:
|
||||
g_value_set_uint(value, nm_device_geneve_get_df(device));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
nm_device_geneve_init(NMDeviceGeneve *device)
|
||||
{}
|
||||
|
||||
static void
|
||||
finalize(GObject *object)
|
||||
{
|
||||
NMDeviceGenevePrivate *priv = NM_DEVICE_GENEVE_GET_PRIVATE(object);
|
||||
|
||||
g_free(priv->remote);
|
||||
|
||||
G_OBJECT_CLASS(nm_device_geneve_parent_class)->finalize(object);
|
||||
}
|
||||
|
||||
const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_geneve = NML_DBUS_META_IFACE_INIT_PROP(
|
||||
NM_DBUS_INTERFACE_DEVICE_GENEVE,
|
||||
nm_device_geneve_get_type,
|
||||
NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30,
|
||||
NML_DBUS_META_IFACE_DBUS_PROPERTIES(
|
||||
NML_DBUS_META_PROPERTY_INIT_Y("Df", PROP_DF, NMDeviceGeneve, _priv.df),
|
||||
NML_DBUS_META_PROPERTY_INIT_Q("DstPort", PROP_DST_PORT, NMDeviceGeneve, _priv.dst_port),
|
||||
NML_DBUS_META_PROPERTY_INIT_U("Id", PROP_ID, NMDeviceGeneve, _priv.id),
|
||||
NML_DBUS_META_PROPERTY_INIT_S("Remote", PROP_REMOTE, NMDeviceGeneve, _priv.remote),
|
||||
NML_DBUS_META_PROPERTY_INIT_Y("Tos", PROP_TOS, NMDeviceGeneve, _priv.tos),
|
||||
NML_DBUS_META_PROPERTY_INIT_I("Ttl", PROP_TTL, NMDeviceGeneve, _priv.ttl), ), );
|
||||
|
||||
static void
|
||||
nm_device_geneve_class_init(NMDeviceGeneveClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
||||
NMObjectClass *nm_object_class = NM_OBJECT_CLASS(klass);
|
||||
NMDeviceClass *device_class = NM_DEVICE_CLASS(klass);
|
||||
|
||||
object_class->get_property = get_property;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
_NM_OBJECT_CLASS_INIT_PRIV_PTR_DIRECT(nm_object_class, NMDeviceGeneve);
|
||||
|
||||
device_class->connection_compatible = connection_compatible;
|
||||
device_class->get_setting_type = get_setting_type;
|
||||
|
||||
/**
|
||||
* NMDeviceGeneve:id:
|
||||
*
|
||||
* The device's GENEVE ID.
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
obj_properties[PROP_ID] = g_param_spec_uint(NM_DEVICE_GENEVE_ID,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
(1 << 24) - 1,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* NMDeviceGeneve:remote:
|
||||
*
|
||||
* The IP address of the remote tunnel endpoint.
|
||||
*
|
||||
* Since: 1.58
|
||||
*/
|
||||
obj_properties[PROP_REMOTE] = g_param_spec_string(NM_DEVICE_GENEVE_REMOTE,
|
||||
"",
|
||||
"",
|
||||
NULL,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* NMDeviceGeneve:tos:
|
||||
*
|
||||
* The TOS value to use in outgoing packets.
|
||||
*
|
||||
* Since: 1.58
|
||||
*/
|
||||
obj_properties[PROP_TOS] = g_param_spec_uchar(NM_DEVICE_GENEVE_TOS,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
255,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* NMDeviceGeneve:ttl:
|
||||
*
|
||||
* The time-to-live value to use in outgoing packets.
|
||||
*
|
||||
* Since: 1.58
|
||||
*/
|
||||
obj_properties[PROP_TTL] = g_param_spec_int(NM_DEVICE_GENEVE_TTL,
|
||||
"",
|
||||
"",
|
||||
-1,
|
||||
255,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* NMDeviceGeneve:dst-port:
|
||||
*
|
||||
* The UDP destination port used to communicate with the remote GENEVE tunnel
|
||||
* endpoint.
|
||||
*
|
||||
* Since: 1.58
|
||||
*/
|
||||
obj_properties[PROP_DST_PORT] = g_param_spec_uint(NM_DEVICE_GENEVE_DST_PORT,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
65535,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* NMDeviceGeneve:df:
|
||||
*
|
||||
* The Don't Fragment (DF) bit to set in outgoing packets.
|
||||
*
|
||||
* Since: 1.58
|
||||
*/
|
||||
obj_properties[PROP_DF] = g_param_spec_uchar(NM_DEVICE_GENEVE_DF,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
_nml_dbus_meta_class_init_with_properties(object_class, &_nml_dbus_meta_iface_nm_device_geneve);
|
||||
}
|
||||
|
|
@ -302,7 +302,6 @@ coerce_type(NMDeviceType type)
|
|||
case NM_DEVICE_TYPE_TUN:
|
||||
case NM_DEVICE_TYPE_VETH:
|
||||
case NM_DEVICE_TYPE_GENERIC:
|
||||
case NM_DEVICE_TYPE_GENEVE:
|
||||
case NM_DEVICE_TYPE_UNUSED1:
|
||||
case NM_DEVICE_TYPE_UNUSED2:
|
||||
case NM_DEVICE_TYPE_UNKNOWN:
|
||||
|
|
@ -1446,7 +1445,9 @@ nm_device_get_managed(NMDevice *device)
|
|||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.22: Use nm_device_set_managed_async() instead.
|
||||
* Deprecated: 1.22: Use the async command nm_client_dbus_set_property() on
|
||||
* nm_object_get_path(), interface %NM_DBUS_INTERFACE_DEVICE to set the
|
||||
* "Managed" property to a "(b)" boolean value.
|
||||
* This function is deprecated because it calls a synchronous D-Bus method
|
||||
* and modifies the content of the NMClient cache client side. Also, it does
|
||||
* not emit a property changed signal.
|
||||
|
|
@ -1468,72 +1469,6 @@ nm_device_set_managed(NMDevice *device, gboolean managed)
|
|||
managed);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_set_managed_async:
|
||||
* @device: a #NMDevice
|
||||
* @managed: the managed state
|
||||
* @flags: the flags argument. See #NMDeviceManagedFlags.
|
||||
* @cancellable: a #GCancellable, or %NULL
|
||||
* @callback: callback to be called when the set_managed operation completes
|
||||
* @user_data: caller-specific data passed to @callback
|
||||
*
|
||||
* Asynchronously begins setting the managed state of the device. With the flags
|
||||
* argument different behaviors can be achieved, such as persisting the state to
|
||||
* disk or matching the device by MAC address.
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
void
|
||||
nm_device_set_managed_async(NMDevice *device,
|
||||
NMDeviceManaged managed,
|
||||
NMDeviceManagedFlags flags,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail(NM_IS_DEVICE(device));
|
||||
g_return_if_fail(!cancellable || G_IS_CANCELLABLE(cancellable));
|
||||
|
||||
_nm_client_dbus_call(_nm_object_get_client(device),
|
||||
device,
|
||||
nm_device_set_managed_async,
|
||||
cancellable,
|
||||
callback,
|
||||
user_data,
|
||||
_nm_object_get_path(device),
|
||||
NM_DBUS_INTERFACE_DEVICE,
|
||||
"SetManaged",
|
||||
g_variant_new("(uu)", managed, flags),
|
||||
G_VARIANT_TYPE("()"),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
NM_DBUS_DEFAULT_TIMEOUT_MSEC,
|
||||
nm_dbus_connection_call_finish_void_strip_dbus_error_cb);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_set_managed_finish:
|
||||
* @device: a #NMDevice
|
||||
* @result: the result passed to the #GAsyncReadyCallback
|
||||
* @error: location for a #GError, or %NULL
|
||||
*
|
||||
* Gets the result of a call to nm_device_set_managed_async().
|
||||
*
|
||||
* Returns: %TRUE on success, %FALSE on error, in which case @error
|
||||
* will be set.
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
gboolean
|
||||
nm_device_set_managed_finish(NMDevice *device, GAsyncResult *result, GError **error)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_DEVICE(device), FALSE);
|
||||
g_return_val_if_fail(nm_g_task_is_valid(result, device, nm_device_set_managed_async), FALSE);
|
||||
|
||||
return g_task_propagate_boolean(G_TASK(result), error);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* nm_device_get_autoconnect:
|
||||
* @device: a #NMDevice
|
||||
|
|
@ -1857,8 +1792,6 @@ get_type_name(NMDevice *device)
|
|||
return _("MACVLAN");
|
||||
case NM_DEVICE_TYPE_VXLAN:
|
||||
return _("VXLAN");
|
||||
case NM_DEVICE_TYPE_GENEVE:
|
||||
return _("GENEVE");
|
||||
case NM_DEVICE_TYPE_IP_TUNNEL:
|
||||
return _("IPTunnel");
|
||||
case NM_DEVICE_TYPE_TUN:
|
||||
|
|
|
|||
|
|
@ -789,7 +789,6 @@ const NMLDBusMetaIface *const _nml_dbus_meta_ifaces[] = {
|
|||
&_nml_dbus_meta_iface_nm_device_bridge,
|
||||
&_nml_dbus_meta_iface_nm_device_dummy,
|
||||
&_nml_dbus_meta_iface_nm_device_generic,
|
||||
&_nml_dbus_meta_iface_nm_device_geneve,
|
||||
&_nml_dbus_meta_iface_nm_device_hsr,
|
||||
&_nml_dbus_meta_iface_nm_device_iptunnel,
|
||||
&_nml_dbus_meta_iface_nm_device_infiniband,
|
||||
|
|
|
|||
|
|
@ -579,7 +579,7 @@ struct _NMLDBusMetaIface {
|
|||
NML_DBUS_META_IFACE_OBJ_PROPERTIES(), \
|
||||
##__VA_ARGS__)
|
||||
|
||||
extern const NMLDBusMetaIface *const _nml_dbus_meta_ifaces[48];
|
||||
extern const NMLDBusMetaIface *const _nml_dbus_meta_ifaces[47];
|
||||
|
||||
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm;
|
||||
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_accesspoint;
|
||||
|
|
@ -593,7 +593,6 @@ extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_bond;
|
|||
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_bridge;
|
||||
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_dummy;
|
||||
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_generic;
|
||||
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_geneve;
|
||||
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_hsr;
|
||||
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_infiniband;
|
||||
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_iptunnel;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include "nm-setting-dummy.h"
|
||||
#include "nm-setting-ethtool.h"
|
||||
#include "nm-setting-generic.h"
|
||||
#include "nm-setting-geneve.h"
|
||||
#include "nm-setting-gsm.h"
|
||||
#include "nm-setting-hostname.h"
|
||||
#include "nm-setting-hsr.h"
|
||||
|
|
@ -115,7 +114,6 @@
|
|||
#include "nm-device-dummy.h"
|
||||
#include "nm-device-ethernet.h"
|
||||
#include "nm-device-generic.h"
|
||||
#include "nm-device-geneve.h"
|
||||
#include "nm-device-hsr.h"
|
||||
#include "nm-device-infiniband.h"
|
||||
#include "nm-device-ip-tunnel.h"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ libnm_client_headers = files(
|
|||
'nm-device-dummy.h',
|
||||
'nm-device-ethernet.h',
|
||||
'nm-device-generic.h',
|
||||
'nm-device-geneve.h',
|
||||
'nm-device-hsr.h',
|
||||
'nm-device-infiniband.h',
|
||||
'nm-device-ip-tunnel.h',
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMDeviceBt, g_object_unref)
|
|||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMDeviceDummy, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMDeviceEthernet, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMDeviceGeneric, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMDeviceGeneve, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMDeviceHsr, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMDeviceIPTunnel, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMDeviceInfiniband, g_object_unref)
|
||||
|
|
@ -81,7 +80,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMSettingDcb, g_object_unref)
|
|||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMSettingDummy, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMSettingEthtool, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMSettingGeneric, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMSettingGeneve, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMSettingGsm, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMSettingHostname, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(NMSettingHsr, g_object_unref)
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
/*
|
||||
* Copyright (C) 2015 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_DEVICE_GENEVE_H__
|
||||
#define __NM_DEVICE_GENEVE_H__
|
||||
|
||||
#if !defined(__NETWORKMANAGER_H_INSIDE__) && !defined(NETWORKMANAGER_COMPILATION)
|
||||
#error "Only <NetworkManager.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "nm-device.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define NM_TYPE_DEVICE_GENEVE (nm_device_geneve_get_type())
|
||||
#define NM_DEVICE_GENEVE(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_DEVICE_GENEVE, NMDeviceGeneve))
|
||||
#define NM_DEVICE_GENEVE_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_DEVICE_GENEVE, NMDeviceGeneveClass))
|
||||
#define NM_IS_DEVICE_GENEVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_DEVICE_GENEVE))
|
||||
#define NM_IS_DEVICE_GENEVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_DEVICE_GENEVE))
|
||||
#define NM_DEVICE_GENEVE_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_DEVICE_GENEVE, NMDeviceGeneveClass))
|
||||
|
||||
#define NM_DEVICE_GENEVE_ID "id"
|
||||
#define NM_DEVICE_GENEVE_REMOTE "remote"
|
||||
#define NM_DEVICE_GENEVE_TOS "tos"
|
||||
#define NM_DEVICE_GENEVE_TTL "ttl"
|
||||
#define NM_DEVICE_GENEVE_DST_PORT "dst-port"
|
||||
#define NM_DEVICE_GENEVE_DF "df"
|
||||
|
||||
/**
|
||||
* NMDeviceGeneve:
|
||||
*
|
||||
* Since: 1.58
|
||||
*/
|
||||
typedef struct _NMDeviceGeneve NMDeviceGeneve;
|
||||
typedef struct _NMDeviceGeneveClass NMDeviceGeneveClass;
|
||||
|
||||
NM_AVAILABLE_IN_1_58
|
||||
GType nm_device_geneve_get_type(void);
|
||||
|
||||
NM_AVAILABLE_IN_1_58
|
||||
guint nm_device_geneve_get_id(NMDeviceGeneve *device);
|
||||
NM_AVAILABLE_IN_1_58
|
||||
const char *nm_device_geneve_get_remote(NMDeviceGeneve *device);
|
||||
NM_AVAILABLE_IN_1_58
|
||||
guint nm_device_geneve_get_dst_port(NMDeviceGeneve *device);
|
||||
NM_AVAILABLE_IN_1_58
|
||||
guint nm_device_geneve_get_tos(NMDeviceGeneve *device);
|
||||
NM_AVAILABLE_IN_1_58
|
||||
guint nm_device_geneve_get_ttl(NMDeviceGeneve *device);
|
||||
NM_AVAILABLE_IN_1_58
|
||||
guint nm_device_geneve_get_df(NMDeviceGeneve *device);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __NM_DEVICE_GENEVE_H__ */
|
||||
|
|
@ -150,15 +150,6 @@ NM_AVAILABLE_IN_1_2
|
|||
NM_DEPRECATED_IN_1_22
|
||||
_NM_DEPRECATED_SYNC_METHOD
|
||||
void nm_device_set_managed(NMDevice *device, gboolean managed);
|
||||
NM_AVAILABLE_IN_1_58
|
||||
void nm_device_set_managed_async(NMDevice *device,
|
||||
NMDeviceManaged managed,
|
||||
NMDeviceManagedFlags flags,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
NM_AVAILABLE_IN_1_58
|
||||
gboolean nm_device_set_managed_finish(NMDevice *device, GAsyncResult *result, GError **error);
|
||||
|
||||
gboolean nm_device_get_autoconnect(NMDevice *device);
|
||||
|
||||
|
|
|
|||
|
|
@ -1149,196 +1149,3 @@ nm_setting_ovs_other_config_check_val(const char *val, GError **error)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
NMIPAddr dest;
|
||||
guint prefix;
|
||||
} DirectRoute;
|
||||
|
||||
static void
|
||||
_setting_ip_config_collect_unreachable_gateways(NMSettingIPConfig *s_ip, GHashTable **result)
|
||||
{
|
||||
const int addr_family = nm_setting_ip_config_get_addr_family(s_ip);
|
||||
guint num_routes;
|
||||
guint num_addrs;
|
||||
guint n_direct_routes = 0;
|
||||
NMIPAddr gw_bin = NM_IP_ADDR_INIT;
|
||||
guint i;
|
||||
guint j;
|
||||
const char *gateway;
|
||||
gs_free DirectRoute *direct_routes = NULL;
|
||||
|
||||
num_routes = nm_setting_ip_config_get_num_routes(s_ip);
|
||||
num_addrs = nm_setting_ip_config_get_num_addresses(s_ip);
|
||||
|
||||
direct_routes = g_new0(DirectRoute, num_routes + num_addrs);
|
||||
|
||||
/* Collect direct routes (routes without a gateway) from the setting. */
|
||||
for (i = 0; i < num_routes; i++) {
|
||||
NMIPRoute *route = nm_setting_ip_config_get_route(s_ip, i);
|
||||
|
||||
if (nm_ip_route_get_next_hop(route))
|
||||
continue;
|
||||
|
||||
nm_ip_route_get_dest_binary(route, &direct_routes[n_direct_routes].dest);
|
||||
direct_routes[n_direct_routes].prefix = nm_ip_route_get_prefix(route);
|
||||
n_direct_routes++;
|
||||
}
|
||||
|
||||
/* Add prefix routes (device routes) for each static address. */
|
||||
for (i = 0; i < num_addrs; i++) {
|
||||
NMIPAddress *addr = nm_setting_ip_config_get_address(s_ip, i);
|
||||
|
||||
nm_ip_address_get_address_binary(addr, &direct_routes[n_direct_routes].dest);
|
||||
direct_routes[n_direct_routes].prefix = nm_ip_address_get_prefix(addr);
|
||||
n_direct_routes++;
|
||||
}
|
||||
|
||||
/* Check the setting's default gateway. */
|
||||
gateway = nm_setting_ip_config_get_gateway(s_ip);
|
||||
if (gateway && nm_inet_parse_bin(addr_family, gateway, NULL, &gw_bin)) {
|
||||
gboolean reachable = FALSE;
|
||||
|
||||
if (addr_family == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&gw_bin.addr6))
|
||||
reachable = TRUE;
|
||||
|
||||
if (!reachable) {
|
||||
for (j = 0; j < n_direct_routes; j++) {
|
||||
if (nm_ip_addr_same_prefix(addr_family,
|
||||
&gw_bin,
|
||||
&direct_routes[j].dest,
|
||||
direct_routes[j].prefix)) {
|
||||
reachable = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!reachable) {
|
||||
if (!*result)
|
||||
*result = g_hash_table_new(nm_str_hash, g_str_equal);
|
||||
g_hash_table_add(*result, (gpointer) gateway);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check gateways of each route in the setting. */
|
||||
for (i = 0; i < num_routes; i++) {
|
||||
NMIPRoute *route = nm_setting_ip_config_get_route(s_ip, i);
|
||||
NMIPAddr next_hop = NM_IP_ADDR_INIT;
|
||||
gboolean reachable = FALSE;
|
||||
GVariant *attribute;
|
||||
|
||||
if (!nm_ip_route_get_next_hop_binary(route, &next_hop))
|
||||
continue;
|
||||
|
||||
if (addr_family == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&next_hop.addr6))
|
||||
continue;
|
||||
|
||||
attribute = nm_ip_route_get_attribute(route, NM_IP_ROUTE_ATTRIBUTE_ONLINK);
|
||||
if (attribute && g_variant_is_of_type(attribute, G_VARIANT_TYPE("b"))
|
||||
&& g_variant_get_boolean(attribute)) {
|
||||
/* the gateway of a onlink route is reachable */
|
||||
continue;
|
||||
}
|
||||
|
||||
for (j = 0; j < n_direct_routes; j++) {
|
||||
if (nm_ip_addr_same_prefix(addr_family,
|
||||
&next_hop,
|
||||
&direct_routes[j].dest,
|
||||
direct_routes[j].prefix)) {
|
||||
reachable = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!reachable) {
|
||||
if (!*result)
|
||||
*result = g_hash_table_new(nm_str_hash, g_str_equal);
|
||||
g_hash_table_add(*result, (gpointer) nm_ip_route_get_next_hop(route));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_connection_get_unreachable_gateways:
|
||||
* @connection: the #NMConnection
|
||||
*
|
||||
* Checks whether there are gateways (either the default gateway or gateways
|
||||
* of routes) that are not directly reachable in the IPv4 and IPv6 settings
|
||||
* of the connection. A gateway is considered directly reachable if it falls
|
||||
* within the subnet of a direct route (a route without a next hop) or of a
|
||||
* prefix route from a static address.
|
||||
*
|
||||
* Returns: a %NULL-terminated array of gateway strings not directly reachable,
|
||||
* or %NULL if all gateways are reachable. The individual strings are owned
|
||||
* by the setting. Free the returned array with g_free().
|
||||
*/
|
||||
const char **
|
||||
nm_connection_get_unreachable_gateways(NMConnection *connection)
|
||||
{
|
||||
gs_unref_hashtable GHashTable *result = NULL;
|
||||
NMSettingIPConfig *s_ip;
|
||||
guint len;
|
||||
const char **strv;
|
||||
|
||||
if (!connection)
|
||||
return NULL;
|
||||
|
||||
s_ip = nm_connection_get_setting_ip4_config(connection);
|
||||
if (s_ip
|
||||
&& nm_streq0(nm_setting_ip_config_get_method(s_ip), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
|
||||
_setting_ip_config_collect_unreachable_gateways(s_ip, &result);
|
||||
}
|
||||
|
||||
s_ip = nm_connection_get_setting_ip6_config(connection);
|
||||
if (s_ip
|
||||
&& nm_streq0(nm_setting_ip_config_get_method(s_ip), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
|
||||
_setting_ip_config_collect_unreachable_gateways(s_ip, &result);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
strv = (const char **) g_hash_table_get_keys_as_array(result, &len);
|
||||
nm_strv_sort(strv, len);
|
||||
return strv;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_connection_get_unreachable_gateways_warning:
|
||||
* @connection: the #NMConnection
|
||||
* @translate: whether to translate the message (use %TRUE for user-facing
|
||||
* tools like nmcli, %FALSE for daemon logs)
|
||||
*
|
||||
* Checks whether there are unreachable gateways in the connection and returns
|
||||
* a formatted warning message if so.
|
||||
*
|
||||
* Returns: a warning message string, or %NULL if all gateways are reachable.
|
||||
* Free with g_free().
|
||||
*/
|
||||
char *
|
||||
nm_connection_get_unreachable_gateways_warning(NMConnection *connection, gboolean translate)
|
||||
{
|
||||
gs_free const char **gateways = NULL;
|
||||
gs_free char *gw_list = NULL;
|
||||
const char *msg =
|
||||
N_("the following gateways are not directly reachable from any configured address or "
|
||||
"route: %s. NetworkManager currently adds on-link routes for them automatically, "
|
||||
"but this will change in the future. Consider adding addresses or routes whose "
|
||||
"subnets cover these gateways");
|
||||
|
||||
gateways = nm_connection_get_unreachable_gateways(connection);
|
||||
if (!gateways)
|
||||
return NULL;
|
||||
|
||||
gw_list = g_strjoinv(", ", (char **) gateways);
|
||||
|
||||
NM_PRAGMA_WARNING_DISABLE("-Wformat-nonliteral")
|
||||
if (translate)
|
||||
return g_strdup_printf(_(msg), gw_list);
|
||||
return g_strdup_printf(msg, gw_list);
|
||||
NM_PRAGMA_WARNING_REENABLE
|
||||
}
|
||||
|
|
|
|||
|
|
@ -344,12 +344,6 @@ gboolean nm_setting_ovs_other_config_check_val(const char *val, GError **error);
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
const char **nm_connection_get_unreachable_gateways(NMConnection *connection);
|
||||
|
||||
char *nm_connection_get_unreachable_gateways_warning(NMConnection *connection, gboolean translate);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Wi-Fi frequencies range for each band */
|
||||
#define _NM_WIFI_FREQ_MIN_2GHZ 2412
|
||||
#define _NM_WIFI_FREQ_MAX_2GHZ 2484
|
||||
|
|
|
|||
|
|
@ -1378,34 +1378,6 @@
|
|||
gprop-type="gchararray"
|
||||
/>
|
||||
</setting>
|
||||
<setting name="geneve"
|
||||
gtype="NMSettingGeneve"
|
||||
>
|
||||
<property name="destination-port"
|
||||
dbus-type="u"
|
||||
gprop-type="guint"
|
||||
/>
|
||||
<property name="df"
|
||||
dbus-type="i"
|
||||
gprop-type="gint"
|
||||
/>
|
||||
<property name="id"
|
||||
dbus-type="u"
|
||||
gprop-type="guint"
|
||||
/>
|
||||
<property name="remote"
|
||||
dbus-type="s"
|
||||
gprop-type="gchararray"
|
||||
/>
|
||||
<property name="tos"
|
||||
dbus-type="u"
|
||||
gprop-type="guint"
|
||||
/>
|
||||
<property name="ttl"
|
||||
dbus-type="i"
|
||||
gprop-type="gint"
|
||||
/>
|
||||
</setting>
|
||||
<setting name="gsm"
|
||||
gtype="NMSettingGsm"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ libnm_core_settings_sources = files(
|
|||
'nm-setting-dummy.c',
|
||||
'nm-setting-ethtool.c',
|
||||
'nm-setting-generic.c',
|
||||
'nm-setting-geneve.c',
|
||||
'nm-setting-gsm.c',
|
||||
'nm-setting-hostname.c',
|
||||
'nm-setting-hsr.c',
|
||||
|
|
|
|||
|
|
@ -3272,7 +3272,6 @@ nm_connection_is_virtual(NMConnection *connection)
|
|||
NM_SETTING_BOND_SETTING_NAME,
|
||||
NM_SETTING_BRIDGE_SETTING_NAME,
|
||||
NM_SETTING_DUMMY_SETTING_NAME,
|
||||
NM_SETTING_GENEVE_SETTING_NAME,
|
||||
NM_SETTING_HSR_SETTING_NAME,
|
||||
NM_SETTING_IP_TUNNEL_SETTING_NAME,
|
||||
NM_SETTING_IPVLAN_SETTING_NAME,
|
||||
|
|
@ -3527,22 +3526,6 @@ nm_connection_get_setting_generic(NMConnection *connection)
|
|||
return _nm_connection_get_setting_by_metatype(connection, NM_META_SETTING_TYPE_GENERIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_connection_get_setting_geneve:
|
||||
* @connection: the #NMConnection
|
||||
*
|
||||
* A shortcut to return any #NMSettingGeneve the connection might contain.
|
||||
*
|
||||
* Returns: (transfer none): an #NMSettingGeneve if the connection contains one, otherwise NULL
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
NMSettingGeneve *
|
||||
nm_connection_get_setting_geneve(NMConnection *connection)
|
||||
{
|
||||
return _nm_connection_get_setting_by_metatype(connection, NM_META_SETTING_TYPE_GENEVE);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_connection_get_setting_gsm:
|
||||
* @connection: the #NMConnection
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
#include "nm-setting-dummy.h"
|
||||
#include "nm-setting-ethtool.h"
|
||||
#include "nm-setting-generic.h"
|
||||
#include "nm-setting-geneve.h"
|
||||
#include "nm-setting-gsm.h"
|
||||
#include "nm-setting-hostname.h"
|
||||
#include "nm-setting-hsr.h"
|
||||
|
|
@ -325,13 +324,6 @@ const NMMetaSettingInfo nm_meta_setting_infos[] = {
|
|||
.setting_name = NM_SETTING_GENERIC_SETTING_NAME,
|
||||
.get_setting_gtype = nm_setting_generic_get_type,
|
||||
},
|
||||
[NM_META_SETTING_TYPE_GENEVE] =
|
||||
{
|
||||
.meta_type = NM_META_SETTING_TYPE_GENEVE,
|
||||
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
|
||||
.setting_name = NM_SETTING_GENEVE_SETTING_NAME,
|
||||
.get_setting_gtype = nm_setting_geneve_get_type,
|
||||
},
|
||||
[NM_META_SETTING_TYPE_GSM] =
|
||||
{
|
||||
.meta_type = NM_META_SETTING_TYPE_GSM,
|
||||
|
|
@ -663,7 +655,6 @@ const NMMetaSettingType nm_meta_setting_types_by_priority[] = {
|
|||
NM_META_SETTING_TYPE_CDMA,
|
||||
NM_META_SETTING_TYPE_DUMMY,
|
||||
NM_META_SETTING_TYPE_GENERIC,
|
||||
NM_META_SETTING_TYPE_GENEVE,
|
||||
NM_META_SETTING_TYPE_GSM,
|
||||
NM_META_SETTING_TYPE_HSR,
|
||||
NM_META_SETTING_TYPE_INFINIBAND,
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ static NM_UTILS_STRING_TABLE_LOOKUP_STRUCT_DEFINE(
|
|||
{"any", NM_BOND_OPTION_TYPE_BOTH, 0, 1, _option_default_strv_arp_all_targets}},
|
||||
{NM_SETTING_BOND_OPTION_ARP_INTERVAL, {"0", NM_BOND_OPTION_TYPE_INT, 0, G_MAXINT}},
|
||||
{NM_SETTING_BOND_OPTION_ARP_IP_TARGET, {"", NM_BOND_OPTION_TYPE_IP}},
|
||||
{NM_SETTING_BOND_OPTION_ARP_MISSED_MAX, {"2", NM_BOND_OPTION_TYPE_INT, 0, 255}},
|
||||
{NM_SETTING_BOND_OPTION_ARP_MISSED_MAX, {"0", NM_BOND_OPTION_TYPE_INT, 0, 255}},
|
||||
{NM_SETTING_BOND_OPTION_ARP_VALIDATE,
|
||||
{"none", NM_BOND_OPTION_TYPE_BOTH, 0, 6, _option_default_strv_arp_validate}},
|
||||
{NM_SETTING_BOND_OPTION_BALANCE_SLB, {"0", NM_BOND_OPTION_TYPE_INT, 0, 1}},
|
||||
|
|
@ -364,10 +364,6 @@ _bond_get_option_normalized(NMSettingBond *self, const char *option, gboolean ge
|
|||
/* balance-slb implies vlan+srcmac */
|
||||
return "5";
|
||||
}
|
||||
} else if (nm_streq(option, NM_SETTING_BOND_OPTION_ARP_MISSED_MAX)) {
|
||||
value = _bond_get_option(self, NM_SETTING_BOND_OPTION_ARP_MISSED_MAX) ?: "0";
|
||||
if (nm_streq(value, "0"))
|
||||
value = _bond_get_option_default(self, option);
|
||||
} else
|
||||
value = _bond_get_option(self, option);
|
||||
|
||||
|
|
@ -898,16 +894,13 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
|
||||
miimon = _atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_MIIMON));
|
||||
arp_interval = _atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_ARP_INTERVAL));
|
||||
arp_missed_max =
|
||||
_atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_ARP_MISSED_MAX));
|
||||
num_grat_arp = _atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_NUM_GRAT_ARP));
|
||||
num_unsol_na = _atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_NUM_UNSOL_NA));
|
||||
peer_notif_delay =
|
||||
_atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY));
|
||||
|
||||
/* "0" is an invalid value in the kernel, but we used to accept it to indicate "default value".
|
||||
* Keep accepting "0" as a valid value, although we'll apply a different value, actually.
|
||||
* Bond modes that don't accept arp_missed_max must just ignore the "0" value, too. */
|
||||
arp_missed_max = _atoi(_bond_get_option(self, NM_SETTING_BOND_OPTION_ARP_MISSED_MAX) ?: "0");
|
||||
|
||||
/* Option restrictions:
|
||||
*
|
||||
* arp_interval conflicts [ alb, tlb ]
|
||||
|
|
@ -957,9 +950,6 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
g_prefix_error(error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (NM_IN_SET(bond_mode, NM_BOND_MODE_TLB, NM_BOND_MODE_ALB, NM_BOND_MODE_8023AD)) {
|
||||
if (arp_missed_max > 0) {
|
||||
g_set_error(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
|
|
|
|||
|
|
@ -1,354 +0,0 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
/*
|
||||
* Copyright (C) 2026 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "libnm-core-impl/nm-default-libnm-core.h"
|
||||
|
||||
#include "nm-setting-geneve.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "nm-utils.h"
|
||||
#include "nm-setting-private.h"
|
||||
|
||||
/**
|
||||
* SECTION:nm-setting-geneve
|
||||
* @short_description: Describes connection properties for GENEVE interfaces
|
||||
*
|
||||
* The #NMSettingGeneve object is a #NMSetting subclass that describes properties
|
||||
* necessary for connection to GENEVE interfaces.
|
||||
**/
|
||||
|
||||
#define DST_PORT_DEFAULT 6081
|
||||
|
||||
NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_ID,
|
||||
PROP_REMOTE,
|
||||
PROP_DESTINATION_PORT,
|
||||
PROP_TOS,
|
||||
PROP_TTL,
|
||||
PROP_DF, );
|
||||
|
||||
typedef struct {
|
||||
char *remote;
|
||||
guint32 id;
|
||||
guint32 destination_port;
|
||||
guint32 tos;
|
||||
gint32 ttl;
|
||||
int df;
|
||||
} NMSettingGenevePrivate;
|
||||
|
||||
/**
|
||||
* NMSettingGeneve:
|
||||
*
|
||||
* GENEVE Settings
|
||||
*/
|
||||
struct _NMSettingGeneve {
|
||||
NMSetting parent;
|
||||
NMSettingGenevePrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMSettingGeneveClass {
|
||||
NMSettingClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(NMSettingGeneve, nm_setting_geneve, NM_TYPE_SETTING)
|
||||
|
||||
#define NM_SETTING_GENEVE_GET_PRIVATE(o) \
|
||||
_NM_GET_PRIVATE(o, NMSettingGeneve, NM_IS_SETTING_GENEVE, NMSetting)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* nm_setting_geneve_get_id:
|
||||
* @setting: the #NMSettingGeneve
|
||||
*
|
||||
* Returns: the #NMSettingGeneve:id property of the setting
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
guint
|
||||
nm_setting_geneve_get_id(NMSettingGeneve *setting)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_SETTING_GENEVE(setting), 0);
|
||||
|
||||
return NM_SETTING_GENEVE_GET_PRIVATE(setting)->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_geneve_get_remote:
|
||||
* @setting: the #NMSettingGeneve
|
||||
*
|
||||
* Returns: the #NMSettingGeneve:remote property of the setting
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
const char *
|
||||
nm_setting_geneve_get_remote(NMSettingGeneve *setting)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_SETTING_GENEVE(setting), NULL);
|
||||
|
||||
return NM_SETTING_GENEVE_GET_PRIVATE(setting)->remote;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_geneve_get_destination_port:
|
||||
* @setting: the #NMSettingGeneve
|
||||
*
|
||||
* Returns: the #NMSettingGeneve:destination-port property of the setting
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
guint
|
||||
nm_setting_geneve_get_destination_port(NMSettingGeneve *setting)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_SETTING_GENEVE(setting), DST_PORT_DEFAULT);
|
||||
|
||||
return NM_SETTING_GENEVE_GET_PRIVATE(setting)->destination_port;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_geneve_get_tos:
|
||||
* @setting: the #NMSettingGeneve
|
||||
*
|
||||
* Returns: the #NMSettingGeneve:tos property of the setting
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
guint
|
||||
nm_setting_geneve_get_tos(NMSettingGeneve *setting)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_SETTING_GENEVE(setting), 0);
|
||||
|
||||
return NM_SETTING_GENEVE_GET_PRIVATE(setting)->tos;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_geneve_get_ttl:
|
||||
* @setting: the #NMSettingGeneve
|
||||
*
|
||||
* Returns: the #NMSettingGeneve:ttl property of the setting
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
guint
|
||||
nm_setting_geneve_get_ttl(NMSettingGeneve *setting)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_SETTING_GENEVE(setting), 0);
|
||||
|
||||
return NM_SETTING_GENEVE_GET_PRIVATE(setting)->ttl;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_geneve_get_df:
|
||||
* @setting: the #NMSettingGeneve
|
||||
*
|
||||
* Returns: the #NMSettingGeneve:df property of the setting
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
NMSettingGeneveDf
|
||||
nm_setting_geneve_get_df(NMSettingGeneve *setting)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_SETTING_GENEVE(setting), NM_SETTING_GENEVE_DF_UNSET);
|
||||
|
||||
return NM_SETTING_GENEVE_GET_PRIVATE(setting)->df;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
verify(NMSetting *setting, NMConnection *connection, GError **error)
|
||||
{
|
||||
NMSettingGenevePrivate *priv = NM_SETTING_GENEVE_GET_PRIVATE(setting);
|
||||
|
||||
if (priv->id == 0) {
|
||||
g_set_error(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_MISSING_PROPERTY,
|
||||
_("property is required"));
|
||||
g_prefix_error(error, "%s.%s: ", NM_SETTING_GENEVE_SETTING_NAME, NM_SETTING_GENEVE_ID);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!priv->remote) {
|
||||
g_set_error(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_MISSING_PROPERTY,
|
||||
_("property is required"));
|
||||
g_prefix_error(error, "%s.%s: ", NM_SETTING_GENEVE_SETTING_NAME, NM_SETTING_GENEVE_REMOTE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!nm_inet_parse_bin(AF_UNSPEC, priv->remote, NULL, NULL)) {
|
||||
g_set_error(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("'%s' is not a valid IP address"),
|
||||
priv->remote);
|
||||
g_prefix_error(error, "%s.%s: ", NM_SETTING_GENEVE_SETTING_NAME, NM_SETTING_GENEVE_REMOTE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
nm_setting_geneve_init(NMSettingGeneve *self)
|
||||
{}
|
||||
|
||||
/**
|
||||
* nm_setting_geneve_new:
|
||||
*
|
||||
* Creates a new #NMSettingGeneve object with default values.
|
||||
*
|
||||
* Returns: (transfer full): the new empty #NMSettingGeneve object
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
NMSetting *
|
||||
nm_setting_geneve_new(void)
|
||||
{
|
||||
return g_object_new(NM_TYPE_SETTING_GENEVE, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
nm_setting_geneve_class_init(NMSettingGeneveClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
||||
NMSettingClass *setting_class = NM_SETTING_CLASS(klass);
|
||||
GArray *properties_override = _nm_sett_info_property_override_create_array();
|
||||
|
||||
object_class->get_property = _nm_setting_property_get_property_direct;
|
||||
object_class->set_property = _nm_setting_property_set_property_direct;
|
||||
|
||||
setting_class->verify = verify;
|
||||
|
||||
/**
|
||||
* NMSettingGeneve:id:
|
||||
*
|
||||
* Specifies the GENEVE Network Identifier (or GENEVE Segment Identifier) to
|
||||
* use.
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
_nm_setting_property_define_direct_uint32(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_GENEVE_ID,
|
||||
PROP_ID,
|
||||
0,
|
||||
(1 << 24) - 1,
|
||||
0,
|
||||
NM_SETTING_PARAM_INFERRABLE,
|
||||
NMSettingGenevePrivate,
|
||||
id);
|
||||
|
||||
/**
|
||||
* NMSettingGeneve:remote:
|
||||
*
|
||||
* Specifies the unicast destination IP address to use in outgoing packets
|
||||
* when communicating with the remote GENEVE tunnel endpoint.
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
_nm_setting_property_define_direct_string(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_GENEVE_REMOTE,
|
||||
PROP_REMOTE,
|
||||
NM_SETTING_PARAM_REQUIRED,
|
||||
NMSettingGenevePrivate,
|
||||
remote,
|
||||
.direct_set_string_ip_address_addr_family =
|
||||
AF_UNSPEC + 1,
|
||||
.direct_string_allow_empty = TRUE);
|
||||
|
||||
/**
|
||||
* NMSettingGeneve:destination-port:
|
||||
*
|
||||
* Specifies the UDP destination port to communicate to the remote GENEVE
|
||||
* tunnel endpoint.
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
_nm_setting_property_define_direct_uint32(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_GENEVE_DESTINATION_PORT,
|
||||
PROP_DESTINATION_PORT,
|
||||
0,
|
||||
G_MAXUINT16,
|
||||
DST_PORT_DEFAULT,
|
||||
NM_SETTING_PARAM_INFERRABLE,
|
||||
NMSettingGenevePrivate,
|
||||
destination_port);
|
||||
|
||||
/**
|
||||
* NMSettingGeneve:tos:
|
||||
*
|
||||
* Specifies the TOS value to use in outgoing packets.
|
||||
* The special value "inherit" (1) means inherit from outer packet.
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
_nm_setting_property_define_direct_uint32(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_GENEVE_TOS,
|
||||
PROP_TOS,
|
||||
0,
|
||||
255,
|
||||
0,
|
||||
NM_SETTING_PARAM_INFERRABLE,
|
||||
NMSettingGenevePrivate,
|
||||
tos);
|
||||
|
||||
/**
|
||||
* NMSettingGeneve:ttl:
|
||||
*
|
||||
* Specifies the time-to-live value to use in outgoing packets.
|
||||
* The special value "inherit" (-1) means inherit from outer packet, 0 means auto, 1-255 are fixed values.
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
_nm_setting_property_define_direct_int32(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_GENEVE_TTL,
|
||||
PROP_TTL,
|
||||
-1,
|
||||
255,
|
||||
0,
|
||||
NM_SETTING_PARAM_INFERRABLE,
|
||||
NMSettingGenevePrivate,
|
||||
ttl);
|
||||
|
||||
/**
|
||||
* NMSettingGeneve:df:
|
||||
*
|
||||
* Specifies how the Don't Fragment (DF) flag should be handled in the outer IP
|
||||
* header of GENEVE tunnel packets.
|
||||
*
|
||||
* %NM_SETTING_GENEVE_DF_UNSET (0): Don't set the DF flag, packets may be fragmented.
|
||||
* %NM_SETTING_GENEVE_DF_SET (1): Always set the DF flag, packets will not be fragmented.
|
||||
* %NM_SETTING_GENEVE_DF_INHERIT (2): Inherit the DF flag from the inner IP header.
|
||||
*
|
||||
* Since: 1.58
|
||||
**/
|
||||
_nm_setting_property_define_direct_enum(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_GENEVE_DF,
|
||||
PROP_DF,
|
||||
NM_TYPE_SETTING_GENEVE_DF,
|
||||
NM_SETTING_GENEVE_DF_UNSET,
|
||||
NM_SETTING_PARAM_INFERRABLE,
|
||||
NULL,
|
||||
NMSettingGenevePrivate,
|
||||
df);
|
||||
|
||||
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
_nm_setting_class_commit(setting_class,
|
||||
NM_META_SETTING_TYPE_GENEVE,
|
||||
NULL,
|
||||
properties_override,
|
||||
G_STRUCT_OFFSET(NMSettingGeneve, _priv));
|
||||
}
|
||||
|
|
@ -1401,7 +1401,7 @@ _ip_route_attribute_validate(const char *name,
|
|||
NM_CONNECTION_ERROR_FAILED,
|
||||
family == AF_INET ? _("'%s' is not a valid IPv4 address")
|
||||
: _("'%s' is not a valid IPv6 address"),
|
||||
addr);
|
||||
string);
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
|
@ -5079,9 +5079,6 @@ routing_rules_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
|||
gboolean any = FALSE;
|
||||
guint i;
|
||||
|
||||
if (!_nm_connection_serialize_non_secret(flags))
|
||||
return NULL;
|
||||
|
||||
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE(self);
|
||||
|
||||
if (!priv->routing_rules || priv->routing_rules->len == 0)
|
||||
|
|
@ -6960,7 +6957,7 @@ nm_setting_ip_config_class_init(NMSettingIPConfigClass *klass)
|
|||
* activation will fail. The property is currently implemented only for IPv4.
|
||||
*
|
||||
* A zero value means that no duplicate address detection is performed, -1 means
|
||||
* the default value (either the value configured globally in NetworkManager.conf
|
||||
* the default value (either the value configured globally in NetworkManger.conf
|
||||
* or 200ms). A value greater than zero is a timeout in milliseconds. Note that
|
||||
* the time intervals are subject to randomization as per RFC 5227 and so the
|
||||
* actual duration can be between half and the full time specified in this
|
||||
|
|
@ -7006,7 +7003,7 @@ nm_setting_ip_config_class_init(NMSettingIPConfigClass *klass)
|
|||
* 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 IPv6 succeeds earlier than IPv4,
|
||||
* 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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1282,7 +1282,7 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass)
|
|||
* won't get merged. If the route finds no merge partner, it is
|
||||
* configured as single hop route.</para> <para>Note that in
|
||||
* NetworkManager, currently all nexthops of a ECMP route must share
|
||||
* the same "onlink" flag in order to be mergeable.</para>
|
||||
* the same "onlink" flag in order to be mergable.</para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para><literal>"window"</literal> - an unsigned 32 bit integer.</para>
|
||||
|
|
|
|||
|
|
@ -11613,328 +11613,6 @@ test_dhcp_iaid_hexstr(void)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
test_unreachable_gateways(void)
|
||||
{
|
||||
NMConnection *conn;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
gs_free const char **result = NULL;
|
||||
|
||||
/* IPv4 gateway reachable via address prefix route */
|
||||
{
|
||||
conn =
|
||||
nmtst_create_minimal_connection("test-ugw", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new();
|
||||
g_object_set(s_ip4,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_GATEWAY,
|
||||
"192.168.1.1",
|
||||
NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip4, "192.168.1.5", 24);
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip4));
|
||||
|
||||
result = nm_connection_get_unreachable_gateways(conn);
|
||||
g_assert(!result);
|
||||
g_object_unref(conn);
|
||||
}
|
||||
|
||||
/* IPv4 gateway NOT reachable */
|
||||
{
|
||||
conn =
|
||||
nmtst_create_minimal_connection("test-ugw", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new();
|
||||
g_object_set(s_ip4,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_GATEWAY,
|
||||
"10.0.0.1",
|
||||
NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip4, "192.168.1.5", 24);
|
||||
nmtst_setting_ip_config_add_address(s_ip4, "172.16.1.1", 16);
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip4));
|
||||
|
||||
result = nm_connection_get_unreachable_gateways(conn);
|
||||
g_assert(result);
|
||||
g_assert_cmpint(g_strv_length((char **) result), ==, 1);
|
||||
g_assert_cmpstr(result[0], ==, "10.0.0.1");
|
||||
nm_clear_g_free(&result);
|
||||
g_object_unref(conn);
|
||||
}
|
||||
|
||||
/* IPv4 gateway NOT reachable. It's ignored because of method "auto" */
|
||||
{
|
||||
conn =
|
||||
nmtst_create_minimal_connection("test-ugw", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new();
|
||||
g_object_set(s_ip4,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_GATEWAY,
|
||||
"10.0.0.1",
|
||||
NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip4, "192.168.1.5", 24);
|
||||
nmtst_setting_ip_config_add_address(s_ip4, "172.16.1.1", 16);
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip4));
|
||||
|
||||
result = nm_connection_get_unreachable_gateways(conn);
|
||||
g_assert(!result);
|
||||
g_object_unref(conn);
|
||||
}
|
||||
|
||||
/* Route gateway reachable via address prefix route */
|
||||
{
|
||||
conn =
|
||||
nmtst_create_minimal_connection("test-ugw", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new();
|
||||
g_object_set(s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip4, "192.168.1.5", 24);
|
||||
nmtst_setting_ip_config_add_route(s_ip4, "10.0.0.0", 8, "192.168.1.254", 100);
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip4));
|
||||
|
||||
result = nm_connection_get_unreachable_gateways(conn);
|
||||
g_assert(!result);
|
||||
g_object_unref(conn);
|
||||
}
|
||||
|
||||
/* Route gateway NOT reachable, check sorting */
|
||||
{
|
||||
conn =
|
||||
nmtst_create_minimal_connection("test-ugw", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new();
|
||||
g_object_set(s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip4, "192.168.1.5", 24);
|
||||
nmtst_setting_ip_config_add_route(s_ip4, "10.0.0.0", 16, "172.16.0.2", 100);
|
||||
nmtst_setting_ip_config_add_route(s_ip4, "10.1.0.0", 16, "172.16.0.4", 100);
|
||||
nmtst_setting_ip_config_add_route(s_ip4, "10.2.0.0", 16, "172.16.0.3", 100);
|
||||
nmtst_setting_ip_config_add_route(s_ip4, "10.3.0.0", 16, "172.16.0.1", 100);
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip4));
|
||||
|
||||
result = nm_connection_get_unreachable_gateways(conn);
|
||||
g_assert(result);
|
||||
g_assert_cmpint(g_strv_length((char **) result), ==, 4);
|
||||
g_assert_cmpstr(result[0], ==, "172.16.0.1");
|
||||
g_assert_cmpstr(result[1], ==, "172.16.0.2");
|
||||
g_assert_cmpstr(result[2], ==, "172.16.0.3");
|
||||
g_assert_cmpstr(result[3], ==, "172.16.0.4");
|
||||
nm_clear_g_free(&result);
|
||||
g_object_unref(conn);
|
||||
}
|
||||
|
||||
/* Route gateway reachable via a direct route in the setting */
|
||||
{
|
||||
conn =
|
||||
nmtst_create_minimal_connection("test-ugw", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new();
|
||||
g_object_set(s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip4, "192.168.1.5", 24);
|
||||
nmtst_setting_ip_config_add_route(s_ip4, "172.16.0.0", 16, NULL, 100);
|
||||
nmtst_setting_ip_config_add_route(s_ip4, "10.0.0.0", 8, "172.16.0.1", 100);
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip4));
|
||||
|
||||
result = nm_connection_get_unreachable_gateways(conn);
|
||||
g_assert(!result);
|
||||
g_object_unref(conn);
|
||||
}
|
||||
|
||||
/* No gateways */
|
||||
{
|
||||
conn =
|
||||
nmtst_create_minimal_connection("test-ugw", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new();
|
||||
g_object_set(s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip4, "192.168.1.5", 24);
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip4));
|
||||
|
||||
result = nm_connection_get_unreachable_gateways(conn);
|
||||
g_assert(!result);
|
||||
g_object_unref(conn);
|
||||
}
|
||||
|
||||
/* Both default gateway and route gateway unreachable */
|
||||
{
|
||||
conn =
|
||||
nmtst_create_minimal_connection("test-ugw", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new();
|
||||
g_object_set(s_ip4,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_GATEWAY,
|
||||
"10.0.0.1",
|
||||
NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip4, "192.168.1.5", 24);
|
||||
nmtst_setting_ip_config_add_route(s_ip4, "10.0.0.0", 8, "172.16.0.1", 100);
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip4));
|
||||
|
||||
result = nm_connection_get_unreachable_gateways(conn);
|
||||
g_assert(result);
|
||||
g_assert_cmpint(g_strv_length((char **) result), ==, 2);
|
||||
g_assert_cmpstr(result[0], ==, "10.0.0.1");
|
||||
g_assert_cmpstr(result[1], ==, "172.16.0.1");
|
||||
nm_clear_g_free(&result);
|
||||
g_object_unref(conn);
|
||||
}
|
||||
|
||||
/* Test deduplication */
|
||||
{
|
||||
conn =
|
||||
nmtst_create_minimal_connection("test-ugw", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new();
|
||||
g_object_set(s_ip4,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_GATEWAY,
|
||||
"192.168.1.1",
|
||||
NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip4, "192.168.1.5", 24);
|
||||
nmtst_setting_ip_config_add_route(s_ip4, "10.0.0.0", 16, "172.16.0.1", 100);
|
||||
nmtst_setting_ip_config_add_route(s_ip4, "10.1.0.0", 16, "172.16.0.1", 100);
|
||||
nmtst_setting_ip_config_add_route(s_ip4, "10.2.0.0", 16, "172.16.0.1", 100);
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip4));
|
||||
|
||||
result = nm_connection_get_unreachable_gateways(conn);
|
||||
g_assert(result);
|
||||
g_assert_cmpint(g_strv_length((char **) result), ==, 1);
|
||||
g_assert_cmpstr(result[0], ==, "172.16.0.1");
|
||||
nm_clear_g_free(&result);
|
||||
g_object_unref(conn);
|
||||
}
|
||||
|
||||
/* IPv6 gateway reachable via address prefix route */
|
||||
{
|
||||
conn =
|
||||
nmtst_create_minimal_connection("test-ugw", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
|
||||
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new();
|
||||
g_object_set(s_ip6,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_GATEWAY,
|
||||
"fd01::1",
|
||||
NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip6, "fd01::10", 64);
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip6));
|
||||
|
||||
result = nm_connection_get_unreachable_gateways(conn);
|
||||
g_assert(!result);
|
||||
g_object_unref(conn);
|
||||
}
|
||||
|
||||
/* IPv6 gateway NOT reachable */
|
||||
{
|
||||
conn =
|
||||
nmtst_create_minimal_connection("test-ugw", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
|
||||
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new();
|
||||
g_object_set(s_ip6,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_GATEWAY,
|
||||
"fd02::1",
|
||||
NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip6, "fd01::10", 64);
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip6));
|
||||
|
||||
result = nm_connection_get_unreachable_gateways(conn);
|
||||
g_assert(result);
|
||||
g_assert_cmpint(g_strv_length((char **) result), ==, 1);
|
||||
g_assert_cmpstr(result[0], ==, "fd02::1");
|
||||
nm_clear_g_free(&result);
|
||||
g_object_unref(conn);
|
||||
}
|
||||
|
||||
/* Multiple addresses, gateway reachable via second address */
|
||||
{
|
||||
conn =
|
||||
nmtst_create_minimal_connection("test-ugw", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new();
|
||||
g_object_set(s_ip4,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_GATEWAY,
|
||||
"10.0.0.1",
|
||||
NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip4, "192.168.1.5", 24);
|
||||
nmtst_setting_ip_config_add_address(s_ip4, "10.0.0.5", 24);
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip4));
|
||||
|
||||
result = nm_connection_get_unreachable_gateways(conn);
|
||||
g_assert(!result);
|
||||
g_object_unref(conn);
|
||||
}
|
||||
|
||||
/* Unreachable gateways in both IPv4 and IPv6 */
|
||||
{
|
||||
conn =
|
||||
nmtst_create_minimal_connection("test-ugw", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new();
|
||||
g_object_set(s_ip4,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_GATEWAY,
|
||||
"10.0.0.1",
|
||||
NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip4, "192.168.1.5", 24);
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip4));
|
||||
|
||||
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new();
|
||||
g_object_set(s_ip6,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_GATEWAY,
|
||||
"fd02::1",
|
||||
NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip6, "fd01::10", 64);
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip6));
|
||||
|
||||
result = nm_connection_get_unreachable_gateways(conn);
|
||||
g_assert(result);
|
||||
g_assert_cmpint(g_strv_length((char **) result), ==, 2);
|
||||
g_assert_cmpstr(result[0], ==, "10.0.0.1");
|
||||
g_assert_cmpstr(result[1], ==, "fd02::1");
|
||||
nm_clear_g_free(&result);
|
||||
g_object_unref(conn);
|
||||
}
|
||||
|
||||
/* Onlink and IPv6-link-local routes */
|
||||
{
|
||||
NMIPRoute *route;
|
||||
|
||||
conn =
|
||||
nmtst_create_minimal_connection("test-ugw", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
|
||||
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new();
|
||||
g_object_set(s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip4, "192.168.1.5", 24);
|
||||
|
||||
route = nm_ip_route_new(AF_INET, "10.0.0.1", 8, "192.168.20.1", 100, NULL);
|
||||
g_assert(route);
|
||||
nm_ip_route_set_attribute(route, NM_IP_ROUTE_ATTRIBUTE_ONLINK, g_variant_new_boolean(TRUE));
|
||||
g_assert(nm_setting_ip_config_add_route(s_ip4, route));
|
||||
nm_ip_route_unref(route);
|
||||
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip4));
|
||||
|
||||
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new();
|
||||
g_object_set(s_ip6, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, NULL);
|
||||
nmtst_setting_ip_config_add_address(s_ip6, "fd01::10", 64);
|
||||
nm_connection_add_setting(conn, NM_SETTING(s_ip6));
|
||||
|
||||
route = nm_ip_route_new(AF_INET6, "fd02::", 64, "fd03::1111", 100, NULL);
|
||||
g_assert(route);
|
||||
nm_ip_route_set_attribute(route, NM_IP_ROUTE_ATTRIBUTE_ONLINK, g_variant_new_boolean(TRUE));
|
||||
g_assert(nm_setting_ip_config_add_route(s_ip6, route));
|
||||
nm_ip_route_unref(route);
|
||||
|
||||
nmtst_setting_ip_config_add_route(s_ip6, "fd04::", 64, "fe80::1111", 100);
|
||||
|
||||
result = nm_connection_get_unreachable_gateways(conn);
|
||||
g_assert(!result);
|
||||
g_object_unref(conn);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NMTST_DEFINE();
|
||||
|
||||
int
|
||||
|
|
@ -12285,7 +11963,6 @@ main(int argc, char **argv)
|
|||
g_test_add_func("/core/general/test_dns_uri_get_legacy", test_dns_uri_parse_plain);
|
||||
g_test_add_func("/core/general/test_dns_uri_normalize", test_dns_uri_normalize);
|
||||
g_test_add_func("/core/general/test_dhcp_iaid_hexstr", test_dhcp_iaid_hexstr);
|
||||
g_test_add_func("/core/general/test_unreachable_gateways", test_unreachable_gateways);
|
||||
|
||||
return g_test_run();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4082,12 +4082,13 @@ test_roundtrip_conversion(gconstpointer test_data)
|
|||
if (flag == NM_CONNECTION_SERIALIZE_ALL) {
|
||||
s_wg2 = NM_SETTING_WIREGUARD(
|
||||
nm_connection_get_setting(con2, NM_TYPE_SETTING_WIREGUARD));
|
||||
|
||||
if (flag == NM_CONNECTION_SERIALIZE_ALL)
|
||||
_rndt_wg_peers_assert_equal(s_wg2, wg_peers, TRUE, TRUE, FALSE);
|
||||
} else if (flag == NM_CONNECTION_SERIALIZE_WITH_NON_SECRET) {
|
||||
con2 = _connection_new_from_dbus_strict(con_var, FALSE);
|
||||
s_wg2 = NM_SETTING_WIREGUARD(
|
||||
nm_connection_get_setting(con2, NM_TYPE_SETTING_WIREGUARD));
|
||||
else if (flag == NM_CONNECTION_SERIALIZE_WITH_NON_SECRET)
|
||||
_rndt_wg_peers_assert_equal(s_wg2, wg_peers, FALSE, FALSE, TRUE);
|
||||
else
|
||||
g_assert_not_reached();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -5532,7 +5533,7 @@ test_bond_meta(void)
|
|||
_A(_nm_setting_bond_opt_value_as_u16, set, NM_SETTING_BOND_OPTION_AD_ACTOR_SYS_PRIO, 0, EINVAL);
|
||||
_A(_nm_setting_bond_opt_value_as_u16, set, NM_SETTING_BOND_OPTION_AD_USER_PORT_KEY, 0, EINVAL);
|
||||
_A(_nm_setting_bond_opt_value_as_u8, set, NM_SETTING_BOND_OPTION_NUM_GRAT_ARP, 1, 0);
|
||||
_A(_nm_setting_bond_opt_value_as_u8, set, NM_SETTING_BOND_OPTION_ARP_MISSED_MAX, 2, 0);
|
||||
_A(_nm_setting_bond_opt_value_as_u8, set, NM_SETTING_BOND_OPTION_ARP_MISSED_MAX, 0, 0);
|
||||
_A(_nm_setting_bond_opt_value_as_u8, set, NM_SETTING_BOND_OPTION_ALL_SLAVES_ACTIVE, 0, 0);
|
||||
_A(_nm_setting_bond_opt_value_as_intbool, set, NM_SETTING_BOND_OPTION_USE_CARRIER, 1, 0);
|
||||
_A(_nm_setting_bond_opt_value_as_intbool,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include "nm-setting-dcb.h"
|
||||
#include "nm-setting-dummy.h"
|
||||
#include "nm-setting-generic.h"
|
||||
#include "nm-setting-geneve.h"
|
||||
#include "nm-setting-gsm.h"
|
||||
#include "nm-setting-hsr.h"
|
||||
#include "nm-setting-hostname.h"
|
||||
|
|
|
|||
|
|
@ -121,7 +121,6 @@ typedef enum _nm_packed {
|
|||
NM_META_SETTING_TYPE_DUMMY,
|
||||
NM_META_SETTING_TYPE_ETHTOOL,
|
||||
NM_META_SETTING_TYPE_GENERIC,
|
||||
NM_META_SETTING_TYPE_GENEVE,
|
||||
NM_META_SETTING_TYPE_GSM,
|
||||
NM_META_SETTING_TYPE_HOSTNAME,
|
||||
NM_META_SETTING_TYPE_HSR,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ libnm_core_headers = files(
|
|||
'nm-setting-dummy.h',
|
||||
'nm-setting-ethtool.h',
|
||||
'nm-setting-generic.h',
|
||||
'nm-setting-geneve.h',
|
||||
'nm-setting-gsm.h',
|
||||
'nm-setting-hsr.h',
|
||||
'nm-setting-hostname.h',
|
||||
|
|
|
|||
|
|
@ -208,8 +208,6 @@ NMSettingDcb *nm_connection_get_setting_dcb(NMConnection *connection);
|
|||
NM_AVAILABLE_IN_1_8
|
||||
NMSettingDummy *nm_connection_get_setting_dummy(NMConnection *connection);
|
||||
NMSettingGeneric *nm_connection_get_setting_generic(NMConnection *connection);
|
||||
NM_AVAILABLE_IN_1_58
|
||||
NMSettingGeneve *nm_connection_get_setting_geneve(NMConnection *connection);
|
||||
NMSettingGsm *nm_connection_get_setting_gsm(NMConnection *connection);
|
||||
NMSettingInfiniband *nm_connection_get_setting_infiniband(NMConnection *connection);
|
||||
NM_AVAILABLE_IN_1_2
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ typedef struct _NMSettingConnection NMSettingConnection;
|
|||
typedef struct _NMSettingDcb NMSettingDcb;
|
||||
typedef struct _NMSettingDummy NMSettingDummy;
|
||||
typedef struct _NMSettingEthtool NMSettingEthtool;
|
||||
typedef struct _NMSettingGeneve NMSettingGeneve;
|
||||
typedef struct _NMSettingGeneric NMSettingGeneric;
|
||||
typedef struct _NMSettingGsm NMSettingGsm;
|
||||
typedef struct _NMSettingHostname NMSettingHostname;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
#define NM_DBUS_INTERFACE_DEVICE_BRIDGE NM_DBUS_INTERFACE_DEVICE ".Bridge"
|
||||
#define NM_DBUS_INTERFACE_DEVICE_DUMMY NM_DBUS_INTERFACE_DEVICE ".Dummy"
|
||||
#define NM_DBUS_INTERFACE_DEVICE_GENERIC NM_DBUS_INTERFACE_DEVICE ".Generic"
|
||||
#define NM_DBUS_INTERFACE_DEVICE_GENEVE NM_DBUS_INTERFACE_DEVICE ".Geneve"
|
||||
#define NM_DBUS_INTERFACE_DEVICE_GRE NM_DBUS_INTERFACE_DEVICE ".Gre"
|
||||
#define NM_DBUS_INTERFACE_DEVICE_HSR NM_DBUS_INTERFACE_DEVICE ".Hsr"
|
||||
#define NM_DBUS_INTERFACE_DEVICE_INFINIBAND NM_DBUS_INTERFACE_DEVICE ".Infiniband"
|
||||
|
|
@ -251,7 +250,6 @@ typedef enum {
|
|||
* @NM_DEVICE_TYPE_LOOPBACK: a loopback interface. Since: 1.42.
|
||||
* @NM_DEVICE_TYPE_HSR: A HSR/PRP device. Since: 1.46.
|
||||
* @NM_DEVICE_TYPE_IPVLAN: A IPVLAN device. Since: 1.52.
|
||||
* @NM_DEVICE_TYPE_GENEVE: A GENEVE device. Since: 1.58.
|
||||
*
|
||||
* #NMDeviceType values indicate the type of hardware represented by a
|
||||
* device object.
|
||||
|
|
@ -292,7 +290,6 @@ typedef enum {
|
|||
NM_DEVICE_TYPE_LOOPBACK = 32,
|
||||
NM_DEVICE_TYPE_HSR = 33,
|
||||
NM_DEVICE_TYPE_IPVLAN = 34,
|
||||
NM_DEVICE_TYPE_GENEVE = 35,
|
||||
} NMDeviceType;
|
||||
|
||||
/**
|
||||
|
|
@ -1248,54 +1245,6 @@ typedef enum /*< flags >*/ {
|
|||
NM_DEVICE_REAPPLY_FLAGS_PRESERVE_EXTERNAL_IP = 0x1,
|
||||
} NMDeviceReapplyFlags;
|
||||
|
||||
/**
|
||||
* NMDeviceManaged:
|
||||
* @NM_DEVICE_MANAGED_NO: the device is not managed.
|
||||
* @NM_DEVICE_MANAGED_YES: the device is managed.
|
||||
* @NM_DEVICE_MANAGED_RESET: reset the device managed state to the default value.
|
||||
*
|
||||
* Values for the SetManaged() D-Bus call of a device and nm_device_set_managed_async().
|
||||
*
|
||||
* Since: 1.58
|
||||
*/
|
||||
typedef enum {
|
||||
NM_DEVICE_MANAGED_NO = 0,
|
||||
NM_DEVICE_MANAGED_YES = 1,
|
||||
NM_DEVICE_MANAGED_RESET = 2,
|
||||
} NMDeviceManaged;
|
||||
|
||||
/**
|
||||
* NMDeviceManagedFlags:
|
||||
* @NM_DEVICE_MANAGED_FLAGS_NONE: no flag set.
|
||||
* @NM_DEVICE_MANAGED_FLAGS_RUNTIME: to set the device managed state to the runtime value.
|
||||
* @NM_DEVICE_MANAGED_FLAGS_PERMANENT: to set the device managed state to the permanent (on disk) value.
|
||||
* @NM_DEVICE_MANAGED_FLAGS_PERMANENT_BY_NAME: to match the device by name, not by MAC address.
|
||||
* @NM_DEVICE_MANAGED_FLAGS_PERMANENT_BY_MAC: to match the device by MAC address, not by name.
|
||||
* @NM_DEVICE_MANAGED_FLAGS_SET_ADMIN_STATE: to set the administrative state of the
|
||||
* device to up if the managed state is %NM_DEVICE_MANAGED_YES, and down if the managed state
|
||||
* is %NM_DEVICE_MANAGED_NO. If the flag is not set, the administrative state is not changed.
|
||||
* The flag is ignored for %NM_DEVICE_MANAGED_RESET.
|
||||
* @NM_DEVICE_MANAGED_FLAGS_ALL: all flags.
|
||||
*
|
||||
* Flags for the SetManaged() D-Bus call of a device and nm_device_set_managed_async().
|
||||
*
|
||||
* %NM_DEVICE_MANAGED_FLAGS_PERMANENT_BY_NAME and %NM_DEVICE_MANAGED_FLAGS_PERMANENT_BY_MAC
|
||||
* are mutually exclusive, and they only make sense together with %NM_DEVICE_MANAGED_FLAGS_PERMANENT.
|
||||
* If none is set, the matching criteria is selected automatically.
|
||||
*
|
||||
* Since: 1.58
|
||||
*/
|
||||
typedef enum /*< flags >*/ {
|
||||
NM_DEVICE_MANAGED_FLAGS_NONE = 0,
|
||||
NM_DEVICE_MANAGED_FLAGS_RUNTIME = 0x1,
|
||||
NM_DEVICE_MANAGED_FLAGS_PERMANENT = 0x2,
|
||||
NM_DEVICE_MANAGED_FLAGS_PERMANENT_BY_NAME = 0x4,
|
||||
NM_DEVICE_MANAGED_FLAGS_PERMANENT_BY_MAC = 0x8,
|
||||
NM_DEVICE_MANAGED_FLAGS_SET_ADMIN_STATE = 0x10,
|
||||
|
||||
NM_DEVICE_MANAGED_FLAGS_ALL = 0x1F, /* <skip> */
|
||||
} NMDeviceManagedFlags;
|
||||
|
||||
/**
|
||||
* NMTernary:
|
||||
* @NM_TERNARY_DEFAULT: use the globally-configured default value.
|
||||
|
|
|
|||
|
|
@ -1,74 +0,0 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
/*
|
||||
* Copyright (C) 2026 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_SETTING_GENEVE_H__
|
||||
#define __NM_SETTING_GENEVE_H__
|
||||
|
||||
#if !defined(__NETWORKMANAGER_H_INSIDE__) && !defined(NETWORKMANAGER_COMPILATION)
|
||||
#error "Only <NetworkManager.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "nm-setting.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define NM_TYPE_SETTING_GENEVE (nm_setting_geneve_get_type())
|
||||
#define NM_SETTING_GENEVE(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_SETTING_GENEVE, NMSettingGeneve))
|
||||
#define NM_SETTING_GENEVE_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_SETTING_GENEVE, NMSettingGeneveClass))
|
||||
#define NM_IS_SETTING_GENEVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_SETTING_GENEVE))
|
||||
#define NM_IS_SETTING_GENEVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_SETTING_GENEVE))
|
||||
#define NM_SETTING_GENEVE_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_SETTING_GENEVE, NMSettingGeneveClass))
|
||||
|
||||
#define NM_SETTING_GENEVE_SETTING_NAME "geneve"
|
||||
|
||||
#define NM_SETTING_GENEVE_ID "id"
|
||||
#define NM_SETTING_GENEVE_REMOTE "remote"
|
||||
#define NM_SETTING_GENEVE_DESTINATION_PORT "destination-port"
|
||||
#define NM_SETTING_GENEVE_TOS "tos"
|
||||
#define NM_SETTING_GENEVE_TTL "ttl"
|
||||
#define NM_SETTING_GENEVE_DF "df"
|
||||
|
||||
/**
|
||||
* NMSettingGeneveDf:
|
||||
* @NM_SETTING_GENEVE_DF_UNSET: Don't set the DF flag, packets may be fragmented.
|
||||
* @NM_SETTING_GENEVE_DF_SET: Always set the DF flag, packets will not be fragmented.
|
||||
* @NM_SETTING_GENEVE_DF_INHERIT: Inherit the DF flag from the inner IP header.
|
||||
*
|
||||
* #NMSettingGeneveDf values indicate how the Don't Fragment (DF) flag should be handled
|
||||
* in the outer IP header of GENEVE tunnel packets.
|
||||
*
|
||||
* Since: 1.58
|
||||
*/
|
||||
typedef enum {
|
||||
NM_SETTING_GENEVE_DF_UNSET = 0,
|
||||
NM_SETTING_GENEVE_DF_SET = 1,
|
||||
NM_SETTING_GENEVE_DF_INHERIT = 2,
|
||||
} NMSettingGeneveDf;
|
||||
|
||||
typedef struct _NMSettingGeneveClass NMSettingGeneveClass;
|
||||
|
||||
NM_AVAILABLE_IN_1_58
|
||||
GType nm_setting_geneve_get_type(void);
|
||||
NM_AVAILABLE_IN_1_58
|
||||
NMSetting *nm_setting_geneve_new(void);
|
||||
NM_AVAILABLE_IN_1_58
|
||||
guint nm_setting_geneve_get_id(NMSettingGeneve *setting);
|
||||
NM_AVAILABLE_IN_1_58
|
||||
const char *nm_setting_geneve_get_remote(NMSettingGeneve *setting);
|
||||
NM_AVAILABLE_IN_1_58
|
||||
guint nm_setting_geneve_get_destination_port(NMSettingGeneve *setting);
|
||||
NM_AVAILABLE_IN_1_58
|
||||
guint nm_setting_geneve_get_tos(NMSettingGeneve *setting);
|
||||
NM_AVAILABLE_IN_1_58
|
||||
guint nm_setting_geneve_get_ttl(NMSettingGeneve *setting);
|
||||
NM_AVAILABLE_IN_1_58
|
||||
NMSettingGeneveDf nm_setting_geneve_get_df(NMSettingGeneve *setting);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __NM_SETTING_GENEVE_H__ */
|
||||
|
|
@ -167,92 +167,6 @@ nm_ip6_addr_is_ula(const struct in6_addr *address)
|
|||
return (address->s6_addr32[0] & htonl(0xfe000000u)) == htonl(0xfc000000u);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip6_addr_common_prefix_len:
|
||||
* @a: first IPv6 address
|
||||
* @b: second IPv6 address
|
||||
*
|
||||
* Returns: the number of leading bits that @a and @b have in common,
|
||||
* from 0 to 128.
|
||||
*/
|
||||
guint
|
||||
nm_ip6_addr_common_prefix_len(const struct in6_addr *a, const struct in6_addr *b)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
guint8 diff = a->s6_addr[i] ^ b->s6_addr[i];
|
||||
|
||||
if (diff != 0)
|
||||
return i * 8u + __builtin_clz((guint) diff) - 24u;
|
||||
}
|
||||
return 128;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip6_addr_rfc6724_label:
|
||||
* @addr: an IPv6 address
|
||||
*
|
||||
* Returns the label for @addr from the default policy table defined
|
||||
* in RFC 6724, Section 2.1:
|
||||
*
|
||||
* Prefix Precedence Label
|
||||
* ::1/128 50 0
|
||||
* ::/0 40 1
|
||||
* ::ffff:0:0/96 35 4
|
||||
* 2002::/16 30 2
|
||||
* 2001::/32 5 5
|
||||
* fc00::/7 3 13
|
||||
* ::/96 1 3
|
||||
* fec0::/10 1 11
|
||||
* 3ffe::/16 1 12
|
||||
*
|
||||
* Returns: the label value (0-13). It can be used in the Source
|
||||
* Address Selection algorithm to prefer a source whose label
|
||||
* matches with the label of the destination.
|
||||
*/
|
||||
guint
|
||||
nm_ip6_addr_rfc6724_label(const struct in6_addr *addr)
|
||||
{
|
||||
/* Checked from most-specific to least-specific prefix length. */
|
||||
|
||||
/* ::1/128 (loopback) */
|
||||
if (IN6_IS_ADDR_LOOPBACK(addr))
|
||||
return 0;
|
||||
|
||||
/* ::ffff:0:0/96 (IPv4-mapped) */
|
||||
if (IN6_IS_ADDR_V4MAPPED(addr))
|
||||
return 4;
|
||||
|
||||
/* ::/96 (IPv4-compatible, deprecated) */
|
||||
if (addr->s6_addr32[0] == 0 && addr->s6_addr32[1] == 0 && addr->s6_addr32[2] == 0
|
||||
&& !IN6_IS_ADDR_UNSPECIFIED(addr))
|
||||
return 3;
|
||||
|
||||
/* 2001::/32 (Teredo) */
|
||||
if (addr->s6_addr32[0] == htonl(0x20010000u))
|
||||
return 5;
|
||||
|
||||
/* 2002::/16 (6to4) */
|
||||
if ((addr->s6_addr32[0] & htonl(0xFFFF0000u)) == htonl(0x20020000u))
|
||||
return 2;
|
||||
|
||||
/* 3ffe::/16 (deprecated 6bone) */
|
||||
if ((addr->s6_addr32[0] & htonl(0xFFFF0000u)) == htonl(0x3FFE0000u))
|
||||
return 12;
|
||||
|
||||
/* fec0::/10 (deprecated site-local) */
|
||||
if ((addr->s6_addr32[0] & htonl(0xFFC00000u)) == htonl(0xFEC00000u))
|
||||
return 11;
|
||||
|
||||
/* fc00::/7 (ULA) */
|
||||
if (nm_ip6_addr_is_ula(addr))
|
||||
return 13;
|
||||
|
||||
/* ::/0 (default) */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
gconstpointer
|
||||
|
|
|
|||
|
|
@ -280,10 +280,6 @@ nm_ip_addr_same_prefix(int addr_family, gconstpointer addr_a, gconstpointer addr
|
|||
gboolean nm_ip_addr_is_site_local(int addr_family, const void *address);
|
||||
gboolean nm_ip6_addr_is_ula(const struct in6_addr *address);
|
||||
|
||||
guint nm_ip6_addr_common_prefix_len(const struct in6_addr *a, const struct in6_addr *b);
|
||||
|
||||
guint nm_ip6_addr_rfc6724_label(const struct in6_addr *addr);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_IPV4LL_NETWORK ((in_addr_t) htonl(0xA9FE0000lu)) /* 169.254.0.0 */
|
||||
|
|
|
|||
|
|
@ -130,7 +130,6 @@ typedef enum {
|
|||
#define _NM_LINK_TYPE_SW_FIRST NM_LINK_TYPE_BNEP
|
||||
NM_LINK_TYPE_BNEP, /* Bluetooth Ethernet emulation */
|
||||
NM_LINK_TYPE_DUMMY,
|
||||
NM_LINK_TYPE_GENEVE,
|
||||
NM_LINK_TYPE_GRE,
|
||||
NM_LINK_TYPE_GRETAP,
|
||||
NM_LINK_TYPE_IFB,
|
||||
|
|
|
|||
|
|
@ -2380,60 +2380,6 @@ test_inet_utils(void)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
test_ip6_addr_common_prefix_len(void)
|
||||
{
|
||||
struct in6_addr a;
|
||||
struct in6_addr b;
|
||||
|
||||
/* identical addresses -> 128 */
|
||||
a = nmtst_inet6_from_string("2001:db8::1");
|
||||
b = nmtst_inet6_from_string("2001:db8::1");
|
||||
g_assert_cmpuint(nm_ip6_addr_common_prefix_len(&a, &b), ==, 128);
|
||||
|
||||
/* completely different -> 0 */
|
||||
a = nmtst_inet6_from_string("8000::");
|
||||
b = nmtst_inet6_from_string("::");
|
||||
g_assert_cmpuint(nm_ip6_addr_common_prefix_len(&a, &b), ==, 0);
|
||||
|
||||
/* first 64 bits in common, differ at bit 65 */
|
||||
a = nmtst_inet6_from_string("2001:db8:abcd:1234:8000::");
|
||||
b = nmtst_inet6_from_string("2001:db8:abcd:1234::");
|
||||
g_assert_cmpuint(nm_ip6_addr_common_prefix_len(&a, &b), ==, 64);
|
||||
|
||||
/* same /48 prefix */
|
||||
a = nmtst_inet6_from_string("2001:db8:abcd::");
|
||||
b = nmtst_inet6_from_string("2001:db8:abcd:ffff::");
|
||||
g_assert_cmpuint(nm_ip6_addr_common_prefix_len(&a, &b), ==, 48);
|
||||
|
||||
/* differ in 5th bit -> 4 common bits */
|
||||
a = nmtst_inet6_from_string("f800::");
|
||||
b = nmtst_inet6_from_string("f000::");
|
||||
g_assert_cmpuint(nm_ip6_addr_common_prefix_len(&a, &b), ==, 4);
|
||||
|
||||
/* differ in 2nd bit -> 1 common bit */
|
||||
a = nmtst_inet6_from_string("c000::");
|
||||
b = nmtst_inet6_from_string("8000::");
|
||||
g_assert_cmpuint(nm_ip6_addr_common_prefix_len(&a, &b), ==, 1);
|
||||
|
||||
/* both zero -> 128 */
|
||||
a = nmtst_inet6_from_string("::");
|
||||
b = nmtst_inet6_from_string("::");
|
||||
g_assert_cmpuint(nm_ip6_addr_common_prefix_len(&a, &b), ==, 128);
|
||||
|
||||
/* first 120 bits in common, differ at MSB of last byte */
|
||||
a = nmtst_inet6_from_string("2001:db8::80");
|
||||
b = nmtst_inet6_from_string("2001:db8::");
|
||||
g_assert_cmpuint(nm_ip6_addr_common_prefix_len(&a, &b), ==, 120);
|
||||
|
||||
/* first 127 bits in common, differ only in last bit */
|
||||
a = nmtst_inet6_from_string("2001:db8::fe");
|
||||
b = nmtst_inet6_from_string("2001:db8::ff");
|
||||
g_assert_cmpuint(nm_ip6_addr_common_prefix_len(&a, &b), ==, 127);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
_inet_parse(int addr_family, const char *str, gboolean accept_legacy, gpointer out_addr)
|
||||
{
|
||||
|
|
@ -2994,7 +2940,6 @@ main(int argc, char **argv)
|
|||
g_test_add_func("/general/test_path_simplify", test_path_simplify);
|
||||
g_test_add_func("/general/test_hostname_is_valid", test_hostname_is_valid);
|
||||
g_test_add_func("/general/test_inet_utils", test_inet_utils);
|
||||
g_test_add_func("/general/test_ip6_addr_common_prefix_len", test_ip6_addr_common_prefix_len);
|
||||
g_test_add_func("/general/test_inet_parse_ip4_legacy", test_inet_parse_ip4_legacy);
|
||||
g_test_add_func("/general/test_garray", test_garray);
|
||||
g_test_add_func("/general/test_nm_prioq", test_nm_prioq);
|
||||
|
|
|
|||
|
|
@ -862,7 +862,6 @@ static const LinkDesc link_descs[] = {
|
|||
|
||||
[NM_LINK_TYPE_BNEP] = {"bluetooth", NULL, "bluetooth"},
|
||||
[NM_LINK_TYPE_DUMMY] = {"dummy", "dummy", NULL},
|
||||
[NM_LINK_TYPE_GENEVE] = {"geneve", "geneve", "geneve"},
|
||||
[NM_LINK_TYPE_GRE] = {"gre", "gre", NULL},
|
||||
[NM_LINK_TYPE_GRETAP] = {"gretap", "gretap", NULL},
|
||||
[NM_LINK_TYPE_IFB] = {"ifb", "ifb", NULL},
|
||||
|
|
@ -910,7 +909,6 @@ _link_type_from_rtnl_type(const char *name)
|
|||
NM_LINK_TYPE_BOND, /* "bond" */
|
||||
NM_LINK_TYPE_BRIDGE, /* "bridge" */
|
||||
NM_LINK_TYPE_DUMMY, /* "dummy" */
|
||||
NM_LINK_TYPE_GENEVE, /* "geneve" */
|
||||
NM_LINK_TYPE_GRE, /* "gre" */
|
||||
NM_LINK_TYPE_GRETAP, /* "gretap" */
|
||||
NM_LINK_TYPE_HSR, /* "hsr" */
|
||||
|
|
@ -989,7 +987,6 @@ _link_type_from_devtype(const char *name)
|
|||
NM_LINK_TYPE_BNEP, /* "bluetooth" */
|
||||
NM_LINK_TYPE_BOND, /* "bond" */
|
||||
NM_LINK_TYPE_BRIDGE, /* "bridge" */
|
||||
NM_LINK_TYPE_GENEVE, /* "geneve" */
|
||||
NM_LINK_TYPE_HSR, /* "hsr" */
|
||||
NM_LINK_TYPE_PPP, /* "ppp" */
|
||||
NM_LINK_TYPE_VLAN, /* "vlan" */
|
||||
|
|
@ -1766,12 +1763,8 @@ _parse_lnk_bond(const char *kind, struct nlattr *info_data)
|
|||
props->num_grat_arp = nla_get_u8(tb[IFLA_BOND_NUM_PEER_NOTIF]);
|
||||
if (tb[IFLA_BOND_ALL_PORTS_ACTIVE])
|
||||
props->all_ports_active = nla_get_u8(tb[IFLA_BOND_ALL_PORTS_ACTIVE]);
|
||||
if (tb[IFLA_BOND_MISSED_MAX]) {
|
||||
if (tb[IFLA_BOND_MISSED_MAX])
|
||||
props->arp_missed_max = nla_get_u8(tb[IFLA_BOND_MISSED_MAX]);
|
||||
props->arp_missed_max_has = TRUE;
|
||||
} else {
|
||||
props->arp_missed_max_has = FALSE;
|
||||
}
|
||||
if (tb[IFLA_BOND_MIN_LINKS])
|
||||
props->min_links = nla_get_u32(tb[IFLA_BOND_MIN_LINKS]);
|
||||
if (tb[IFLA_BOND_LP_INTERVAL])
|
||||
|
|
@ -1863,57 +1856,6 @@ _parse_lnk_gre(const char *kind, struct nlattr *info_data)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static NMPObject *
|
||||
_parse_lnk_geneve(const char *kind, struct nlattr *info_data)
|
||||
{
|
||||
static const struct nla_policy policy[] = {
|
||||
[IFLA_GENEVE_ID] = {.type = NLA_U32},
|
||||
[IFLA_GENEVE_REMOTE] = {.type = NLA_U32},
|
||||
[IFLA_GENEVE_REMOTE6] = {.type = NLA_UNSPEC, .minlen = sizeof(struct in6_addr)},
|
||||
[IFLA_GENEVE_TTL] = {.type = NLA_U8},
|
||||
[IFLA_GENEVE_TOS] = {.type = NLA_U8},
|
||||
[IFLA_GENEVE_TTL_INHERIT] = {.type = NLA_U8},
|
||||
[IFLA_GENEVE_PORT] = {.type = NLA_U16},
|
||||
[IFLA_GENEVE_DF] = {.type = NLA_U8},
|
||||
};
|
||||
|
||||
struct nlattr *tb[G_N_ELEMENTS(policy)];
|
||||
NMPObject *obj;
|
||||
NMPlatformLnkGeneve *props;
|
||||
|
||||
if (!info_data || !nm_streq0(kind, "geneve"))
|
||||
return NULL;
|
||||
|
||||
if (nla_parse_nested_arr(tb, info_data, policy) < 0)
|
||||
return NULL;
|
||||
|
||||
obj = nmp_object_new(NMP_OBJECT_TYPE_LNK_GENEVE, NULL);
|
||||
props = &obj->lnk_geneve;
|
||||
|
||||
if (tb[IFLA_GENEVE_ID])
|
||||
props->id = nla_get_u32(tb[IFLA_GENEVE_ID]);
|
||||
if (tb[IFLA_GENEVE_REMOTE])
|
||||
props->remote = nla_get_u32(tb[IFLA_GENEVE_REMOTE]);
|
||||
if (tb[IFLA_GENEVE_REMOTE6])
|
||||
props->remote6 = *nla_data_as(struct in6_addr, tb[IFLA_GENEVE_REMOTE6]);
|
||||
|
||||
if (tb[IFLA_GENEVE_TTL_INHERIT] && nla_get_u8(tb[IFLA_GENEVE_TTL_INHERIT]))
|
||||
props->ttl = -1;
|
||||
else if (tb[IFLA_GENEVE_TTL])
|
||||
props->ttl = nla_get_u8(tb[IFLA_GENEVE_TTL]);
|
||||
|
||||
if (tb[IFLA_GENEVE_TOS])
|
||||
props->tos = nla_get_u8(tb[IFLA_GENEVE_TOS]);
|
||||
if (tb[IFLA_GENEVE_PORT])
|
||||
props->dst_port = ntohs(nla_get_u16(tb[IFLA_GENEVE_PORT]));
|
||||
if (tb[IFLA_GENEVE_DF])
|
||||
props->df = nla_get_u8(tb[IFLA_GENEVE_DF]);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static NMPObject *
|
||||
_parse_lnk_hsr(const char *kind, struct nlattr *info_data)
|
||||
{
|
||||
|
|
@ -3752,9 +3694,6 @@ _new_from_nl_link(NMPlatform *platform,
|
|||
case NM_LINK_TYPE_BOND:
|
||||
lnk_data = _parse_lnk_bond(nl_info_kind, nl_info_data);
|
||||
break;
|
||||
case NM_LINK_TYPE_GENEVE:
|
||||
lnk_data = _parse_lnk_geneve(nl_info_kind, nl_info_data);
|
||||
break;
|
||||
case NM_LINK_TYPE_GRE:
|
||||
case NM_LINK_TYPE_GRETAP:
|
||||
lnk_data = _parse_lnk_gre(nl_info_kind, nl_info_data);
|
||||
|
|
@ -4094,7 +4033,6 @@ _new_from_nl_route(const struct nlmsghdr *nlh, gboolean id_only, ParseNlmsgIter
|
|||
int ifindex;
|
||||
NMIPAddr gateway;
|
||||
gboolean is_via;
|
||||
unsigned rtnh_flags;
|
||||
} nh = {
|
||||
.found = FALSE,
|
||||
.has_more = FALSE,
|
||||
|
|
@ -4207,7 +4145,6 @@ _new_from_nl_route(const struct nlmsghdr *nlh, gboolean id_only, ParseNlmsgIter
|
|||
new_nexthop = &v4_nh_extra_nexthops[v4_n_nexthops - 1u];
|
||||
new_nexthop->ifindex = rtnh->rtnh_ifindex;
|
||||
new_nexthop->weight = NM_MAX(((guint) rtnh->rtnh_hops) + 1u, 1u);
|
||||
new_nexthop->rtnh_flags = rtnh->rtnh_flags;
|
||||
if (rtnh->rtnh_len > sizeof(*rtnh)) {
|
||||
struct nlattr *ntb[RTA_MAX + 1];
|
||||
|
||||
|
|
@ -4225,7 +4162,6 @@ _new_from_nl_route(const struct nlmsghdr *nlh, gboolean id_only, ParseNlmsgIter
|
|||
nh.found = TRUE;
|
||||
nh.ifindex = rtnh->rtnh_ifindex;
|
||||
nh.weight = NM_MAX(((guint) rtnh->rtnh_hops) + 1u, 1u);
|
||||
nh.rtnh_flags = rtnh->rtnh_flags;
|
||||
if (rtnh->rtnh_len > sizeof(*rtnh)) {
|
||||
struct nlattr *ntb[RTA_MAX + 1];
|
||||
|
||||
|
|
@ -4473,15 +4409,6 @@ rta_multipath_done:
|
|||
}
|
||||
|
||||
obj->ip_route.r_rtm_flags = rtm->rtm_flags;
|
||||
|
||||
if (IS_IPv4 && v4_n_nexthops > 1u) {
|
||||
/* For multipath routes, rtm_flags at the route level does not contain
|
||||
* RTNH_F_ONLINK. Instead, each nexthop has its own rtnh_flags. Merge the
|
||||
* first nexthop's RTNH_F_ONLINK into r_rtm_flags, since the first nexthop
|
||||
* is embedded in the route struct. */
|
||||
obj->ip_route.r_rtm_flags |= (nh.rtnh_flags & RTNH_F_ONLINK);
|
||||
}
|
||||
|
||||
obj->ip_route.rt_source = nmp_utils_ip_config_source_from_rtprot(rtm->rtm_protocol);
|
||||
|
||||
if (nh.has_more) {
|
||||
|
|
@ -5130,7 +5057,7 @@ _nl_msg_new_link_set_linkinfo(struct nl_msg *msg, NMLinkType link_type, gconstpo
|
|||
&props->ad_actor_system);
|
||||
if (props->ad_select)
|
||||
NLA_PUT_U8(msg, IFLA_BOND_AD_SELECT, props->ad_select);
|
||||
if (props->arp_missed_max_has)
|
||||
if (props->arp_missed_max)
|
||||
NLA_PUT_U8(msg, IFLA_BOND_MISSED_MAX, props->arp_missed_max);
|
||||
|
||||
NLA_PUT_U8(msg, IFLA_BOND_ALL_PORTS_ACTIVE, props->all_ports_active);
|
||||
|
|
@ -5255,35 +5182,6 @@ _nl_msg_new_link_set_linkinfo(struct nl_msg *msg, NMLinkType link_type, gconstpo
|
|||
nla_nest_end(msg, info_peer);
|
||||
break;
|
||||
}
|
||||
case NM_LINK_TYPE_GENEVE:
|
||||
{
|
||||
const NMPlatformLnkGeneve *props = extra_data;
|
||||
|
||||
nm_assert(props);
|
||||
|
||||
if (!(data = nla_nest_start(msg, IFLA_INFO_DATA)))
|
||||
goto nla_put_failure;
|
||||
|
||||
NLA_PUT_U32(msg, IFLA_GENEVE_ID, props->id);
|
||||
|
||||
if (props->remote) {
|
||||
NLA_PUT_U32(msg, IFLA_GENEVE_REMOTE, props->remote);
|
||||
} else if (!IN6_IS_ADDR_UNSPECIFIED(&props->remote6)) {
|
||||
NLA_PUT(msg, IFLA_GENEVE_REMOTE6, sizeof(props->remote6), &props->remote6);
|
||||
}
|
||||
NLA_PUT_U16(msg, IFLA_GENEVE_PORT, htons(props->dst_port));
|
||||
if (props->ttl == -1) {
|
||||
NLA_PUT_U8(msg, IFLA_GENEVE_TTL_INHERIT, 1);
|
||||
} else {
|
||||
/* When you want to specify a TTL value,
|
||||
* don't add TTL_INHERIT to the message */
|
||||
NLA_PUT_U8(msg, IFLA_GENEVE_TTL, props->ttl & 0xff);
|
||||
}
|
||||
NLA_PUT_U8(msg, IFLA_GENEVE_TOS, props->tos);
|
||||
NLA_PUT_U8(msg, IFLA_GENEVE_DF, props->df);
|
||||
break;
|
||||
}
|
||||
|
||||
case NM_LINK_TYPE_GRE:
|
||||
case NM_LINK_TYPE_GRETAP:
|
||||
{
|
||||
|
|
@ -5915,18 +5813,15 @@ _nl_msg_new_route(uint16_t nlmsg_type, uint16_t nlmsg_flags, const NMPObject *ob
|
|||
}
|
||||
NLA_PUT_U32(msg, RTA_GATEWAY, gw);
|
||||
|
||||
if (i == 0u) {
|
||||
rtnh->rtnh_flags =
|
||||
(gw != 0 && NM_FLAGS_HAS(obj->ip_route.r_rtm_flags, (unsigned) RTNH_F_ONLINK))
|
||||
? RTNH_F_ONLINK
|
||||
: 0;
|
||||
} else {
|
||||
const NMPlatformIP4RtNextHop *n2 = &obj->_ip4_route.extra_nexthops[i - 1u];
|
||||
rtnh->rtnh_flags = 0;
|
||||
|
||||
rtnh->rtnh_flags =
|
||||
(gw != 0 && NM_FLAGS_HAS(n2->rtnh_flags, (unsigned) RTNH_F_ONLINK))
|
||||
? RTNH_F_ONLINK
|
||||
: 0;
|
||||
if (obj->ip4_route.n_nexthops > 1
|
||||
&& NM_FLAGS_HAS(obj->ip_route.r_rtm_flags, (unsigned) (RTNH_F_ONLINK)) && gw != 0) {
|
||||
/* Unlike kernel, we only track the onlink flag per NMPlatformIP4Address, and
|
||||
* not per nexthop. That is fine for NetworkManager configuring addresses.
|
||||
* It is not fine for tracking addresses from kernel in platform cache,
|
||||
* because the rtnh_flags of the nexthops need to be part of nmp_object_id_cmp(). */
|
||||
rtnh->rtnh_flags |= RTNH_F_ONLINK;
|
||||
}
|
||||
|
||||
rtnh->rtnh_len = (char *) nlmsg_tail(nlmsg_hdr(msg)) - (char *) rtnh;
|
||||
|
|
|
|||
|
|
@ -1388,12 +1388,6 @@ nm_platform_link_add(NMPlatform *self,
|
|||
case NM_LINK_TYPE_VETH:
|
||||
nm_sprintf_buf(buf, ", veth-peer \"%s\"", (const char *) extra_data);
|
||||
break;
|
||||
case NM_LINK_TYPE_GENEVE:
|
||||
nm_strbuf_append_str(&buf_p, &buf_len, ", ");
|
||||
nm_platform_lnk_geneve_to_string((const NMPlatformLnkGeneve *) extra_data,
|
||||
buf_p,
|
||||
buf_len);
|
||||
break;
|
||||
case NM_LINK_TYPE_GRE:
|
||||
case NM_LINK_TYPE_GRETAP:
|
||||
nm_strbuf_append_str(&buf_p, &buf_len, ", ");
|
||||
|
|
@ -2571,12 +2565,6 @@ nm_platform_link_get_lnk_bridge(NMPlatform *self, int ifindex, const NMPlatformL
|
|||
return _link_get_lnk(self, ifindex, NM_LINK_TYPE_BRIDGE, out_link);
|
||||
}
|
||||
|
||||
const NMPlatformLnkGeneve *
|
||||
nm_platform_link_get_lnk_geneve(NMPlatform *self, int ifindex, const NMPlatformLink **out_link)
|
||||
{
|
||||
return _link_get_lnk(self, ifindex, NM_LINK_TYPE_GENEVE, out_link);
|
||||
}
|
||||
|
||||
const NMPlatformLnkGre *
|
||||
nm_platform_link_get_lnk_gre(NMPlatform *self, int ifindex, const NMPlatformLink **out_link)
|
||||
{
|
||||
|
|
@ -3223,6 +3211,7 @@ gboolean
|
|||
nm_platform_link_veth_get_properties(NMPlatform *self, int ifindex, int *out_peer_ifindex)
|
||||
{
|
||||
const NMPlatformLink *plink;
|
||||
int peer_ifindex;
|
||||
|
||||
plink = nm_platform_link_get(self, ifindex);
|
||||
if (!plink)
|
||||
|
|
@ -3231,10 +3220,23 @@ nm_platform_link_veth_get_properties(NMPlatform *self, int ifindex, int *out_pee
|
|||
if (plink->type != NM_LINK_TYPE_VETH)
|
||||
return FALSE;
|
||||
|
||||
if (plink->parent == 0)
|
||||
if (plink->parent != 0) {
|
||||
NM_SET_OUT(out_peer_ifindex, plink->parent);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Pre-4.1 kernel did not expose the peer_ifindex as IFA_LINK. Lookup via ethtool. */
|
||||
if (out_peer_ifindex) {
|
||||
nm_auto_pop_netns NMPNetns *netns = NULL;
|
||||
|
||||
if (!nm_platform_netns_push(self, &netns))
|
||||
return FALSE;
|
||||
peer_ifindex = nmp_ethtool_ioctl_get_peer_ifindex(plink->ifindex);
|
||||
if (peer_ifindex <= 0)
|
||||
return FALSE;
|
||||
|
||||
NM_SET_OUT(out_peer_ifindex, plink->parent);
|
||||
*out_peer_ifindex = peer_ifindex;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -6373,7 +6375,6 @@ nm_platform_lnk_bond_to_string(const NMPlatformLnkBond *lnk, char *buf, gsize le
|
|||
char sbuf_resend_igmp[30];
|
||||
char sbuf_lp_interval[30];
|
||||
char sbuf_tlb_dynamic_lb[30];
|
||||
char sbuf_arp_missed_max[30];
|
||||
int i;
|
||||
|
||||
if (!nm_utils_to_string_buffer_init_null(lnk, &buf, &len))
|
||||
|
|
@ -6404,7 +6405,7 @@ nm_platform_lnk_bond_to_string(const NMPlatformLnkBond *lnk, char *buf, gsize le
|
|||
" xmit_hash_policy %u"
|
||||
" num_gray_arp %u"
|
||||
" all_ports_active %u"
|
||||
"%s" /* arp_missed_max %u */
|
||||
" arp_missed_max %u"
|
||||
" lacp_rate %u"
|
||||
"%s" /* lacp_active */
|
||||
" ad_select %u"
|
||||
|
|
@ -6456,12 +6457,7 @@ nm_platform_lnk_bond_to_string(const NMPlatformLnkBond *lnk, char *buf, gsize le
|
|||
lnk->xmit_hash_policy,
|
||||
lnk->num_grat_arp,
|
||||
lnk->all_ports_active,
|
||||
lnk->arp_missed_max_has || lnk->arp_missed_max != 0
|
||||
? nm_sprintf_buf(sbuf_arp_missed_max,
|
||||
" arp_missed_max%s %u",
|
||||
!lnk->arp_missed_max_has ? "?" : "",
|
||||
(int) lnk->arp_missed_max)
|
||||
: "",
|
||||
lnk->arp_missed_max,
|
||||
lnk->lacp_rate,
|
||||
lnk->lacp_active_has || lnk->lacp_active != 0
|
||||
? nm_sprintf_buf(sbuf_lacp_active,
|
||||
|
|
@ -6498,52 +6494,6 @@ nm_platform_lnk_bond_to_string(const NMPlatformLnkBond *lnk, char *buf, gsize le
|
|||
return buf;
|
||||
}
|
||||
|
||||
const char *
|
||||
nm_platform_lnk_geneve_to_string(const NMPlatformLnkGeneve *lnk, char *buf, gsize len)
|
||||
{
|
||||
char str_remote[NM_INET_ADDRSTRLEN];
|
||||
char str_remote1[30 + NM_INET_ADDRSTRLEN];
|
||||
char str_remote6[NM_INET_ADDRSTRLEN];
|
||||
char str_remote6_1[30 + NM_INET_ADDRSTRLEN];
|
||||
char str_ttl[30];
|
||||
char str_tos[30];
|
||||
char str_id[30];
|
||||
char str_dstport[30];
|
||||
|
||||
if (!nm_utils_to_string_buffer_init_null(lnk, &buf, &len))
|
||||
return buf;
|
||||
|
||||
g_snprintf(
|
||||
buf,
|
||||
len,
|
||||
"geneve"
|
||||
"%s" /* id */
|
||||
"%s" /* remote */
|
||||
"%s" /* remote6 */
|
||||
"%s" /* dst_port */
|
||||
"%s" /* ttl */
|
||||
"%s" /* tos */
|
||||
"%s" /* df */
|
||||
"",
|
||||
lnk->id ? nm_sprintf_buf(str_id, " id %u", lnk->id) : "",
|
||||
lnk->remote
|
||||
? nm_sprintf_buf(str_remote, " remote %s", nm_inet4_ntop(lnk->remote, str_remote1))
|
||||
: "",
|
||||
!IN6_IS_ADDR_UNSPECIFIED(&lnk->remote6)
|
||||
? nm_sprintf_buf(str_remote6, " remote %s", nm_inet6_ntop(&lnk->remote6, str_remote6_1))
|
||||
: "",
|
||||
lnk->dst_port ? nm_sprintf_buf(str_dstport, " dstport %u", lnk->dst_port) : "",
|
||||
lnk->ttl > 0 ? nm_sprintf_buf(str_ttl, " ttl %u", lnk->ttl & 0xff)
|
||||
: lnk->ttl == 0 ? "ttl auto"
|
||||
: "ttl inherit",
|
||||
lnk->tos ? (lnk->tos == 1 ? " tos inherit" : nm_sprintf_buf(str_tos, " tos 0x%x", lnk->tos))
|
||||
: "",
|
||||
lnk->df == 1 ? " df set "
|
||||
: lnk->df == 2 ? " df inherit "
|
||||
: "");
|
||||
return buf;
|
||||
}
|
||||
|
||||
const char *
|
||||
nm_platform_lnk_gre_to_string(const NMPlatformLnkGre *lnk, char *buf, gsize len)
|
||||
{
|
||||
|
|
@ -7416,16 +7366,13 @@ nm_platform_ip4_route_to_string_full(const NMPlatformIP4Route *route,
|
|||
"%s" /* ifindex */
|
||||
"%s%s" /* gateway */
|
||||
" weight %s" /* weight */
|
||||
"%s" /* onlink */
|
||||
"",
|
||||
NM_PRINT_FMT_QUOTED2(nexthop->gateway != 0 || nexthop->ifindex <= 0,
|
||||
" via ",
|
||||
nm_inet4_ntop(nexthop->gateway, s_gateway),
|
||||
""),
|
||||
_to_string_dev(str_dev, nexthop->ifindex),
|
||||
nm_sprintf_buf(weight_str, "%u", nexthop->weight),
|
||||
NM_FLAGS_HAS(nexthop->rtnh_flags, (unsigned) RTNH_F_ONLINK) ? " onlink"
|
||||
: "");
|
||||
nm_sprintf_buf(weight_str, "%u", nexthop->weight));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8394,8 +8341,7 @@ nm_platform_lnk_bond_hash_update(const NMPlatformLnkBond *obj, NMHashState *h)
|
|||
obj->tlb_dynamic_lb,
|
||||
obj->tlb_dynamic_lb_has,
|
||||
obj->updelay_has,
|
||||
obj->use_carrier,
|
||||
obj->arp_missed_max_has));
|
||||
obj->use_carrier));
|
||||
|
||||
nm_hash_update(h, obj->arp_ip_target, obj->arp_ip_targets_num * sizeof(obj->arp_ip_target[0]));
|
||||
nm_hash_update(h, obj->ns_ip6_target, obj->ns_ip6_targets_num * sizeof(obj->ns_ip6_target[0]));
|
||||
|
|
@ -8473,7 +8419,6 @@ nm_platform_lnk_bond_cmp(const NMPlatformLnkBond *a, const NMPlatformLnkBond *b)
|
|||
NM_CMP_FIELD_BOOL(a, b, tlb_dynamic_lb_has);
|
||||
NM_CMP_FIELD_BOOL(a, b, updelay_has);
|
||||
NM_CMP_FIELD_BOOL(a, b, use_carrier);
|
||||
NM_CMP_FIELD_BOOL(a, b, arp_missed_max_has);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -8546,27 +8491,6 @@ nm_platform_lnk_gre_cmp(const NMPlatformLnkGre *a, const NMPlatformLnkGre *b)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
nm_platform_lnk_geneve_hash_update(const NMPlatformLnkGeneve *obj, NMHashState *h)
|
||||
{
|
||||
nm_hash_update_vals(h, obj->id, obj->remote, obj->dst_port, obj->ttl, obj->tos, obj->df);
|
||||
nm_hash_update_mem(h, &obj->remote6, sizeof(obj->remote6));
|
||||
}
|
||||
|
||||
int
|
||||
nm_platform_lnk_geneve_cmp(const NMPlatformLnkGeneve *a, const NMPlatformLnkGeneve *b)
|
||||
{
|
||||
NM_CMP_SELF(a, b);
|
||||
NM_CMP_FIELD(a, b, id);
|
||||
NM_CMP_FIELD(a, b, remote);
|
||||
NM_CMP_FIELD_MEMCMP(a, b, remote6);
|
||||
NM_CMP_FIELD(a, b, ttl);
|
||||
NM_CMP_FIELD(a, b, tos);
|
||||
NM_CMP_FIELD(a, b, dst_port);
|
||||
NM_CMP_FIELD(a, b, df);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
nm_platform_lnk_hsr_hash_update(const NMPlatformLnkHsr *obj, NMHashState *h)
|
||||
{
|
||||
|
|
@ -9007,11 +8931,7 @@ nm_platform_ip4_rt_nexthop_hash_update(const NMPlatformIP4RtNextHop *obj,
|
|||
nm_assert(obj);
|
||||
|
||||
w = for_id ? NM_MAX(obj->weight, 1u) : obj->weight;
|
||||
nm_hash_update_vals(h,
|
||||
obj->ifindex,
|
||||
obj->gateway,
|
||||
w,
|
||||
for_id ? (obj->rtnh_flags & RTNH_F_ONLINK) : obj->rtnh_flags);
|
||||
nm_hash_update_vals(h, obj->ifindex, obj->gateway, w);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -9048,6 +8968,7 @@ nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj,
|
|||
obj->initrwnd,
|
||||
obj->mtu,
|
||||
obj->rto_min,
|
||||
obj->r_rtm_flags & RTNH_F_ONLINK,
|
||||
NM_HASH_COMBINE_BOOLS(guint16,
|
||||
obj->quickack,
|
||||
obj->lock_window,
|
||||
|
|
@ -9065,8 +8986,7 @@ nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj,
|
|||
obj->via.addr_family == AF_INET6 ? obj->via.addr.addr6
|
||||
: in6addr_any,
|
||||
obj->gateway,
|
||||
_ip4_route_weight_normalize(n_nexthops, obj->weight, FALSE),
|
||||
obj->r_rtm_flags & RTNH_F_ONLINK);
|
||||
_ip4_route_weight_normalize(n_nexthops, obj->weight, FALSE));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -9159,11 +9079,6 @@ nm_platform_ip4_rt_nexthop_cmp(const NMPlatformIP4RtNextHop *a,
|
|||
w_b = for_id ? NM_MAX(b->weight, 1u) : b->weight;
|
||||
NM_CMP_DIRECT(w_a, w_b);
|
||||
|
||||
if (for_id)
|
||||
NM_CMP_DIRECT(a->rtnh_flags & RTNH_F_ONLINK, b->rtnh_flags & RTNH_F_ONLINK);
|
||||
else
|
||||
NM_CMP_FIELD(a, b, rtnh_flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -9204,6 +9119,12 @@ nm_platform_ip4_route_cmp(const NMPlatformIP4Route *a,
|
|||
NM_CMP_FIELD(a, b, mtu);
|
||||
NM_CMP_FIELD(a, b, rto_min);
|
||||
|
||||
/* Note that for NetworkManager, the onlink flag is only part of the entire route.
|
||||
* For kernel, each next hop has it's own onlink flag (rtnh_flags). This means,
|
||||
* we can only merge ECMP routes, if they agree with their onlink flag, and then
|
||||
* all next hops are onlink (or not). */
|
||||
NM_CMP_DIRECT(a->r_rtm_flags & RTNH_F_ONLINK, b->r_rtm_flags & RTNH_F_ONLINK);
|
||||
|
||||
NM_CMP_FIELD_UNSAFE(a, b, quickack);
|
||||
NM_CMP_FIELD_UNSAFE(a, b, lock_window);
|
||||
NM_CMP_FIELD_UNSAFE(a, b, lock_cwnd);
|
||||
|
|
@ -9222,10 +9143,6 @@ nm_platform_ip4_route_cmp(const NMPlatformIP4Route *a,
|
|||
NM_CMP_DIRECT(n_nexthops, nm_platform_ip4_route_get_n_nexthops(b));
|
||||
NM_CMP_DIRECT(_ip4_route_weight_normalize(n_nexthops, a->weight, FALSE),
|
||||
_ip4_route_weight_normalize(n_nexthops, b->weight, FALSE));
|
||||
/* The onlink flag is per-nexthop. For the first nexthop it is in
|
||||
* r_rtm_flags. For extra nexthops, it's compared via
|
||||
* nm_platform_ip4_rt_nexthop_cmp(). */
|
||||
NM_CMP_DIRECT(a->r_rtm_flags & RTNH_F_ONLINK, b->r_rtm_flags & RTNH_F_ONLINK);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ guint _nm_platform_signal_id_get(NMPlatformSignalIdType signal_type);
|
|||
#define __NMPlatformIPRoute_COMMON \
|
||||
__NMPlatformObjWithIfindex_COMMON; \
|
||||
\
|
||||
/* rtm_flags and rtnh_flags
|
||||
/* rtnh_flags
|
||||
*
|
||||
* Routes with rtm_flags RTM_F_CLONED are hidden by platform and
|
||||
* do not exist from the point-of-view of platform users.
|
||||
|
|
@ -295,15 +295,8 @@ guint _nm_platform_signal_id_get(NMPlatformSignalIdType signal_type);
|
|||
*
|
||||
* NOTE: currently we ignore all flags except RTM_F_CLONED
|
||||
* and RTNH_F_ONLINK.
|
||||
*
|
||||
* For IPv4 routes, the RTNH_F_ONLINK flag here applies to the
|
||||
* first nexthop (which is embedded in the route struct). Extra
|
||||
* nexthops (NMPlatformIP4RtNextHop) each have their own
|
||||
* rtnh_flags field.
|
||||
*
|
||||
* For single-hop routes, this field comes directly from
|
||||
* rtm_flags. For multi-hop routes from kernel, the first
|
||||
* nexthop's RTNH_F_ONLINK from rtnh_flags is merged here. */ \
|
||||
* We also may not properly consider the flags as part of the ID
|
||||
* in route-cmp. */ \
|
||||
unsigned r_rtm_flags; \
|
||||
\
|
||||
/* RTA_METRICS.RTAX_ADVMSS (iproute2: advmss) */ \
|
||||
|
|
@ -740,10 +733,10 @@ typedef struct {
|
|||
*/
|
||||
guint16 weight;
|
||||
|
||||
/* Each next hop in kernel has its own rtnh_flags (for example to
|
||||
* set RTNH_F_ONLINK). The flags are part of the identifier of a
|
||||
* route. */
|
||||
unsigned rtnh_flags;
|
||||
/* FIXME: each next hop in kernel also has a rtnh_flags (for example to
|
||||
* set RTNH_F_ONLINK). As the next hop is part of the identifier of an
|
||||
* IPv4 route, so is their flags. We must also track the flag, otherwise
|
||||
* two routes that look different for kernel, get merged by platform cache. */
|
||||
} NMPlatformIP4RtNextHop;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -840,19 +833,8 @@ typedef struct {
|
|||
bool tlb_dynamic_lb_has : 1;
|
||||
bool updelay_has : 1;
|
||||
bool use_carrier : 1;
|
||||
bool arp_missed_max_has : 1;
|
||||
} _nm_alignas(NMPlatformObject) NMPlatformLnkBond;
|
||||
|
||||
typedef struct {
|
||||
struct in6_addr remote6;
|
||||
in_addr_t remote;
|
||||
guint32 id;
|
||||
gint32 ttl;
|
||||
guint16 dst_port;
|
||||
guint8 tos;
|
||||
guint8 df;
|
||||
} _nm_alignas(NMPlatformObject) NMPlatformLnkGeneve;
|
||||
|
||||
typedef struct {
|
||||
int parent_ifindex;
|
||||
in_addr_t local;
|
||||
|
|
@ -1876,15 +1858,6 @@ nm_platform_link_vxlan_add(NMPlatform *self,
|
|||
return nm_platform_link_add(self, NM_LINK_TYPE_VXLAN, name, 0, NULL, 0, 0, props, out_link);
|
||||
}
|
||||
|
||||
static inline int
|
||||
nm_platform_link_geneve_add(NMPlatform *self,
|
||||
const char *name,
|
||||
const NMPlatformLnkGeneve *props,
|
||||
const NMPlatformLink **out_link)
|
||||
{
|
||||
return nm_platform_link_add(self, NM_LINK_TYPE_GENEVE, name, 0, NULL, 0, 0, props, out_link);
|
||||
}
|
||||
|
||||
static inline int
|
||||
nm_platform_link_6lowpan_add(NMPlatform *self,
|
||||
const char *name,
|
||||
|
|
@ -2170,8 +2143,6 @@ const NMPlatformLnkBond *
|
|||
nm_platform_link_get_lnk_bond(NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
|
||||
const NMPlatformLnkBridge *
|
||||
nm_platform_link_get_lnk_bridge(NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
|
||||
const NMPlatformLnkGeneve *
|
||||
nm_platform_link_get_lnk_geneve(NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
|
||||
const NMPlatformLnkGre *
|
||||
nm_platform_link_get_lnk_gre(NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
|
||||
const NMPlatformLnkGre *
|
||||
|
|
@ -2511,7 +2482,6 @@ gboolean nm_platform_tc_sync(NMPlatform *self,
|
|||
const char *nm_platform_link_to_string(const NMPlatformLink *link, char *buf, gsize len);
|
||||
const char *nm_platform_lnk_bond_to_string(const NMPlatformLnkBond *lnk, char *buf, gsize len);
|
||||
const char *nm_platform_lnk_bridge_to_string(const NMPlatformLnkBridge *lnk, char *buf, gsize len);
|
||||
const char *nm_platform_lnk_geneve_to_string(const NMPlatformLnkGeneve *lnk, char *buf, gsize len);
|
||||
const char *nm_platform_lnk_gre_to_string(const NMPlatformLnkGre *lnk, char *buf, gsize len);
|
||||
const char *nm_platform_lnk_hsr_to_string(const NMPlatformLnkHsr *lnk, char *buf, gsize len);
|
||||
const char *
|
||||
|
|
@ -2567,7 +2537,6 @@ nm_platform_mptcp_addr_to_string(const NMPlatformMptcpAddr *mptcp_addr, char *bu
|
|||
int nm_platform_link_cmp(const NMPlatformLink *a, const NMPlatformLink *b);
|
||||
int nm_platform_lnk_bond_cmp(const NMPlatformLnkBond *a, const NMPlatformLnkBond *b);
|
||||
int nm_platform_lnk_bridge_cmp(const NMPlatformLnkBridge *a, const NMPlatformLnkBridge *b);
|
||||
int nm_platform_lnk_geneve_cmp(const NMPlatformLnkGeneve *a, const NMPlatformLnkGeneve *b);
|
||||
int nm_platform_lnk_gre_cmp(const NMPlatformLnkGre *a, const NMPlatformLnkGre *b);
|
||||
int nm_platform_lnk_hsr_cmp(const NMPlatformLnkHsr *a, const NMPlatformLnkHsr *b);
|
||||
int nm_platform_lnk_infiniband_cmp(const NMPlatformLnkInfiniband *a,
|
||||
|
|
@ -2643,7 +2612,6 @@ void nm_platform_routing_rule_hash_update(const NMPlatformRoutingRule *obj,
|
|||
NMHashState *h);
|
||||
void nm_platform_lnk_bond_hash_update(const NMPlatformLnkBond *obj, NMHashState *h);
|
||||
void nm_platform_lnk_bridge_hash_update(const NMPlatformLnkBridge *obj, NMHashState *h);
|
||||
void nm_platform_lnk_geneve_hash_update(const NMPlatformLnkGeneve *obj, NMHashState *h);
|
||||
void nm_platform_lnk_gre_hash_update(const NMPlatformLnkGre *obj, NMHashState *h);
|
||||
void nm_platform_lnk_hsr_hash_update(const NMPlatformLnkHsr *obj, NMHashState *h);
|
||||
void nm_platform_lnk_infiniband_hash_update(const NMPlatformLnkInfiniband *obj, NMHashState *h);
|
||||
|
|
|
|||
|
|
@ -166,7 +166,6 @@ typedef enum _nm_packed {
|
|||
NMP_OBJECT_TYPE_TFILTER,
|
||||
|
||||
NMP_OBJECT_TYPE_LNK_BRIDGE,
|
||||
NMP_OBJECT_TYPE_LNK_GENEVE,
|
||||
NMP_OBJECT_TYPE_LNK_GRE,
|
||||
NMP_OBJECT_TYPE_LNK_GRETAP,
|
||||
NMP_OBJECT_TYPE_LNK_HSR,
|
||||
|
|
@ -195,15 +194,15 @@ typedef enum _nm_packed {
|
|||
NMP_OBJECT_TYPE_MAX = __NMP_OBJECT_TYPE_LAST - 1,
|
||||
} NMPObjectType;
|
||||
|
||||
static inline guint64
|
||||
static inline guint32
|
||||
nmp_object_type_to_flags(NMPObjectType obj_type)
|
||||
{
|
||||
G_STATIC_ASSERT_EXPR(NMP_OBJECT_TYPE_MAX < 64);
|
||||
G_STATIC_ASSERT_EXPR(NMP_OBJECT_TYPE_MAX < 32);
|
||||
|
||||
nm_assert(_NM_INT_NOT_NEGATIVE(obj_type));
|
||||
nm_assert(obj_type < NMP_OBJECT_TYPE_MAX);
|
||||
|
||||
return ((guint64) 1u) << obj_type;
|
||||
return ((guint32) 1u) << obj_type;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -1190,6 +1190,33 @@ nmp_ethtool_ioctl_supports_vlans(int ifindex)
|
|||
return !(features->features[block].active & (1 << bit));
|
||||
}
|
||||
|
||||
int
|
||||
nmp_ethtool_ioctl_get_peer_ifindex(int ifindex)
|
||||
{
|
||||
nm_auto_socket_handle SocketHandle shandle = SOCKET_HANDLE_INIT(ifindex);
|
||||
gsize stats_len;
|
||||
gs_free struct ethtool_stats *stats_free = NULL;
|
||||
struct ethtool_stats *stats;
|
||||
int peer_ifindex_stat;
|
||||
|
||||
g_return_val_if_fail(ifindex > 0, 0);
|
||||
|
||||
peer_ifindex_stat = ethtool_get_stringset_index(&shandle, ETH_SS_STATS, "peer_ifindex");
|
||||
if (peer_ifindex_stat < 0) {
|
||||
nm_log_dbg(LOGD_PLATFORM, "ethtool[%d]: peer_ifindex stat does not exist?", ifindex);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stats_len = sizeof(*stats) + (peer_ifindex_stat + 1) * sizeof(guint64);
|
||||
stats = nm_malloc0_maybe_a(300, stats_len, &stats_free);
|
||||
stats->cmd = ETHTOOL_GSTATS;
|
||||
stats->n_stats = peer_ifindex_stat + 1;
|
||||
if (_ethtool_call_handle(&shandle, stats, stats_len) < 0)
|
||||
return 0;
|
||||
|
||||
return stats->data[peer_ifindex_stat];
|
||||
}
|
||||
|
||||
gboolean
|
||||
nmp_ethtool_ioctl_get_wake_on_lan(int ifindex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ gboolean nmp_ethtool_ioctl_supports_carrier_detect(int ifindex);
|
|||
|
||||
gboolean nmp_ethtool_ioctl_supports_vlans(int ifindex);
|
||||
|
||||
int nmp_ethtool_ioctl_get_peer_ifindex(int ifindex);
|
||||
|
||||
gboolean nmp_ethtool_ioctl_get_wake_on_lan(int ifindex);
|
||||
|
||||
gboolean nmp_ethtool_ioctl_set_wake_on_lan(int ifindex,
|
||||
|
|
|
|||
|
|
@ -3469,18 +3469,6 @@ const NMPClass _nmp_classes[NMP_OBJECT_TYPE_MAX] = {
|
|||
.cmd_plobj_hash_update = (CmdPlobjHashUpdateFunc) nm_platform_lnk_bridge_hash_update,
|
||||
.cmd_plobj_cmp = (CmdPlobjCmpFunc) nm_platform_lnk_bridge_cmp,
|
||||
},
|
||||
[NMP_OBJECT_TYPE_LNK_GENEVE - 1] =
|
||||
{
|
||||
.parent = DEDUP_MULTI_OBJ_CLASS_INIT(),
|
||||
.obj_type = NMP_OBJECT_TYPE_LNK_GENEVE,
|
||||
.sizeof_data = sizeof(NMPObjectLnkGeneve),
|
||||
.sizeof_public = sizeof(NMPlatformLnkGeneve),
|
||||
.obj_type_name = "geneve",
|
||||
.lnk_link_type = NM_LINK_TYPE_GENEVE,
|
||||
.cmd_plobj_to_string = (CmdPlobjToStringFunc) nm_platform_lnk_geneve_to_string,
|
||||
.cmd_plobj_hash_update = (CmdPlobjHashUpdateFunc) nm_platform_lnk_geneve_hash_update,
|
||||
.cmd_plobj_cmp = (CmdPlobjCmpFunc) nm_platform_lnk_geneve_cmp,
|
||||
},
|
||||
[NMP_OBJECT_TYPE_LNK_GRE - 1] =
|
||||
{
|
||||
.parent = DEDUP_MULTI_OBJ_CLASS_INIT(),
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue