libnm-core: fix validation of ovs-dpdk interface name

An ovs-dpdk interface doesn't have a kernel link and doesn't have the
15-character limit on the name.

Fixes: 3efe070dfc ('libnm: validate "connection.interface-name" at one place only')

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2044
(cherry picked from commit fda05b0af0)
(cherry picked from commit f6e4e53775)
(cherry picked from commit c7035db5b4)
(cherry picked from commit 73f10372f9)
(cherry picked from commit fb2dc25787)
This commit is contained in:
Beniamino Galvani 2024-09-24 16:25:03 +02:00
parent 81de160c8f
commit 27731c3cf9
2 changed files with 3 additions and 3 deletions

View file

@ -1276,13 +1276,13 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
if (connection)
goto after_interface_name;
iface_type = NMU_IFACE_ANY;
} else if (NM_IN_STRSET(ovs_iface_type, "patch")) {
} else if (NM_IN_STRSET(ovs_iface_type, "patch", "dpdk")) {
/* this interface type is internal to OVS. */
iface_type = NMU_IFACE_OVS;
} else {
/* This interface type also requires a netdev. We need to validate
* for both OVS and KERNEL. */
nm_assert(NM_IN_STRSET(ovs_iface_type, "internal", "system", "dpdk"));
nm_assert(NM_IN_STRSET(ovs_iface_type, "internal", "system"));
iface_type = NMU_IFACE_OVS_AND_KERNEL;
}
} else

View file

@ -10674,7 +10674,7 @@ test_connection_ovs_ifname(gconstpointer test_data)
/* good if bridge, port, or patch interface */
g_object_set(s_con, NM_SETTING_CONNECTION_INTERFACE_NAME, "ovs123123123123130123123", NULL);
if (!ovs_iface_type || nm_streq(ovs_iface_type, "patch"))
if (!ovs_iface_type || NM_IN_STRSET(ovs_iface_type, "patch", "dpdk"))
nmtst_assert_connection_verifies(con);
else {
nmtst_assert_connection_unnormalizable(con,