From e6dc4332f3d8c64e884f385c94df009866414500 Mon Sep 17 00:00:00 2001 From: Jan Vaclav Date: Tue, 14 Jan 2025 12:20:18 +0100 Subject: [PATCH 1/2] platform/vlan: fix incorrect type for ingress/egress qos mappings The kernel was updated to add stricter validation to netlink messages, which revealed this bug: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6c21660fe221a15c789dee2bc2fd95516bc5aeaf Fixes: a5ea141956ee ('platform/vlan: add support for ingress/egress-qos-mappings and changing flags') (cherry picked from commit 84bcc0eab97b14ae3c9e96cf9e4fe6e967fa79b3) (cherry picked from commit c8943b758d61d397ef675b73055b1b0e482d831a) (cherry picked from commit 6dad779be184e71fbe870a644d30393e27c43e47) --- src/libnm-platform/nm-linux-platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c index 946c9b6320..6029017bf2 100644 --- a/src/libnm-platform/nm-linux-platform.c +++ b/src/libnm-platform/nm-linux-platform.c @@ -5399,7 +5399,7 @@ _nl_msg_new_link_set_linkinfo_vlan(struct nl_msg *msg, if (!(qos = nla_nest_start(msg, IFLA_VLAN_INGRESS_QOS))) goto nla_put_failure; } - NLA_PUT(msg, i, sizeof(ingress_qos[i]), &ingress_qos[i]); + NLA_PUT(msg, IFLA_VLAN_QOS_MAPPING, sizeof(ingress_qos[i]), &ingress_qos[i]); } } @@ -5416,7 +5416,7 @@ _nl_msg_new_link_set_linkinfo_vlan(struct nl_msg *msg, if (!(qos = nla_nest_start(msg, IFLA_VLAN_EGRESS_QOS))) goto nla_put_failure; } - NLA_PUT(msg, i, sizeof(egress_qos[i]), &egress_qos[i]); + NLA_PUT(msg, IFLA_VLAN_QOS_MAPPING, sizeof(egress_qos[i]), &egress_qos[i]); } } From 5d7173a5eab75625cb18754bd8462e1e8e6b89e3 Mon Sep 17 00:00:00 2001 From: Jan Vaclav Date: Tue, 14 Jan 2025 12:52:46 +0100 Subject: [PATCH 2/2] platform/test: reenable xgress qos tests Fixes: 6e30e37ebe78 ('test: disable vlan_xgress unit test') (cherry picked from commit 4107a6883f59475a64bdcbeb3ebfcbabde44c0b6) (cherry picked from commit 0eb1781b6ced058ddd5dc69103e59c46fcf243ae) (cherry picked from commit 779fd8deae73cb6dff738197a7c5c4102b9d0718) --- src/core/platform/tests/test-link.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/core/platform/tests/test-link.c b/src/core/platform/tests/test-link.c index 1d0bfdbe13..9bbbc69423 100644 --- a/src/core/platform/tests/test-link.c +++ b/src/core/platform/tests/test-link.c @@ -2263,7 +2263,7 @@ test_software_detect_add(const char *testpath, NMLinkType link_type, int test_mo } /*****************************************************************************/ -/* + static void _assert_xgress_qos_mappings_impl(int ifindex, gboolean is_ingress_map, int n_entries, int n, ...) { @@ -2343,8 +2343,7 @@ _assert_vlan_flags(int ifindex, _NMVlanFlags flags) g_assert(plnk); g_assert_cmpint(plnk->flags, ==, flags); } -*/ -/* + static void test_vlan_set_xgress(void) { @@ -2360,7 +2359,6 @@ test_vlan_set_xgress(void) ifindex = nmtstp_assert_wait_for_link(NM_PLATFORM_GET, DEVICE_NAME, NM_LINK_TYPE_VLAN, 100)->ifindex; - g_assert(nm_platform_link_vlan_set_ingress_map(NM_PLATFORM_GET, ifindex, 4, 5)); _assert_ingress_qos_mappings(ifindex, 1, 4, 5); @@ -2391,7 +2389,6 @@ test_vlan_set_xgress(void) g_assert(nm_platform_link_vlan_set_ingress_map(NM_PLATFORM_GET, ifindex, 9, 4)); _assert_ingress_qos_mappings(ifindex, 3, 0, 5, 3, 8, 4, 5); - g_assert(nm_platform_link_vlan_set_egress_map(NM_PLATFORM_GET, ifindex, 7, 3)); _assert_egress_qos_mappings(ifindex, 1, 7, 3); @@ -2693,7 +2690,7 @@ test_vlan_set_xgress(void) nmtstp_link_delete(NULL, -1, ifindex, DEVICE_NAME, TRUE); nmtstp_link_delete(NULL, -1, ifindex_parent, PARENT_NAME, TRUE); } -*/ + /*****************************************************************************/ static void @@ -4107,7 +4104,7 @@ _nmtstp_setup_tests(void) test_software_detect_add("/link/software/detect/wireguard/1", NM_LINK_TYPE_WIREGUARD, 1); test_software_detect_add("/link/software/detect/wireguard/2", NM_LINK_TYPE_WIREGUARD, 2); - // g_test_add_func("/link/software/vlan/set-xgress", test_vlan_set_xgress); + g_test_add_func("/link/software/vlan/set-xgress", test_vlan_set_xgress); g_test_add_func("/link/set-properties", test_link_set_properties);