summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSana Kazi <sanakazisk19@gmail.com>2024-04-16 15:16:32 +0200
committerSteve Sakoman <steve@sakoman.com>2024-04-21 06:33:35 -0700
commitdc98af7cabb7b5db6bfa82ef78baf9d7fd7827d2 (patch)
tree36cca8a4a67ca24fdcc8792d02ca0bfd92cc9b43
parent19e8261a85d992442ff658b49cc026336fe84a44 (diff)
downloadpoky-dc98af7cabb7b5db6bfa82ef78baf9d7fd7827d2.tar.gz
systemd: Fix vlan qos mapping
Drop unnecessary restriction for QoS mapping. Also adds tests for vlan QoS mapping. Link: https://github.com/systemd/systemd/commit/fe830b84d4002582e7aefb16e5e09fd0195f21c8.patch PR: https://github.com/systemd/systemd/pull/27761 (From OE-Core rev: b5c5e783fe06e3ae3b3e92ffa7f18bee62aca3c0) Signed-off-by: Sana Kazi <sana.kazi@kpit.com> Signed-off-by: Sana Kazi <sana.kazisk19@gmail.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-core/systemd/systemd/fix-vlan-qos-mapping.patch140
-rw-r--r--meta/recipes-core/systemd/systemd_250.5.bb1
2 files changed, 141 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/fix-vlan-qos-mapping.patch b/meta/recipes-core/systemd/systemd/fix-vlan-qos-mapping.patch
new file mode 100644
index 0000000000..c530de7f50
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/fix-vlan-qos-mapping.patch
@@ -0,0 +1,140 @@
1From 4d13d175f8454df63843a880c78badd4f6d720ca Mon Sep 17 00:00:00 2001
2From: Yu Watanabe <watanabe.yu+github@gmail.com>
3Date: Wed, 24 May 2023 11:02:36 +0900
4Subject: [PATCH 1/3] network/vlan: drop unnecessary restriction for QoS
5 mapping
6
7Fixes #27460.
8
9Upstream-Status: Backport [https://github.com/systemd/systemd/commit/fe830b84d4002582e7aefb16e5e09fd0195f21c8.patch]
10Signed-off-by: Sana Kazi <sana.kazi@kpit.com>
11---
12 src/network/netdev/vlan.c | 5 -----
13 1 file changed, 5 deletions(-)
14
15diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
16index a3d961dac3ca4..d61e9486abc47 100644
17--- a/src/network/netdev/vlan.c
18+++ b/src/network/netdev/vlan.c
19@@ -165,11 +165,6 @@ int config_parse_vlan_qos_maps(
20 continue;
21 }
22
23- if (m->to > m->from || m->to == 0 || m->from == 0) {
24- log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid %s, ignoring: %s", lvalue, w);
25- continue;
26- }
27-
28 r = set_ensure_consume(s, &vlan_qos_maps_hash_ops, TAKE_PTR(m));
29 if (r < 0) {
30 log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to store %s, ignoring: %s", lvalue, w);
31
32From 4194478af861f80a73905d1f9e570a09862f91a7 Mon Sep 17 00:00:00 2001
33From: Yu Watanabe <watanabe.yu+github@gmail.com>
34Date: Wed, 24 May 2023 11:06:35 +0900
35Subject: [PATCH 2/3] network/vlan: paranoia about type safety
36
37No functional change, as the struct is defined as the following:
38```
39struct ifla_vlan_qos_mapping {
40 __u32 from;
41 __u32 to;
42};
43```
44---
45 src/network/netdev/vlan.c | 16 +++++++++++-----
46 1 file changed, 11 insertions(+), 5 deletions(-)
47
48diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
49index d61e9486abc47..5eb36ef6801f3 100644
50--- a/src/network/netdev/vlan.c
51+++ b/src/network/netdev/vlan.c
52@@ -144,6 +144,7 @@ int config_parse_vlan_qos_maps(
53 for (const char *p = rvalue;;) {
54 _cleanup_free_ struct ifla_vlan_qos_mapping *m = NULL;
55 _cleanup_free_ char *w = NULL;
56+ unsigned from, to;
57
58 r = extract_first_word(&p, &w, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE);
59 if (r == -ENOMEM)
60@@ -155,16 +156,21 @@ int config_parse_vlan_qos_maps(
61 if (r == 0)
62 return 0;
63
64- m = new0(struct ifla_vlan_qos_mapping, 1);
65- if (!m)
66- return log_oom();
67-
68- r = parse_range(w, &m->from, &m->to);
69+ r = parse_range(w, &from, &to);
70 if (r < 0) {
71 log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s, ignoring: %s", lvalue, w);
72 continue;
73 }
74
75+ m = new(struct ifla_vlan_qos_mapping, 1);
76+ if (!m)
77+ return log_oom();
78+
79+ *m = (struct ifla_vlan_qos_mapping) {
80+ .from = from,
81+ .to = to,
82+ };
83+
84 r = set_ensure_consume(s, &vlan_qos_maps_hash_ops, TAKE_PTR(m));
85 if (r < 0) {
86 log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to store %s, ignoring: %s", lvalue, w);
87
88From 73d24e45f8ac18eaaebf1df2b1f055c14179c6ff Mon Sep 17 00:00:00 2001
89From: Yu Watanabe <watanabe.yu+github@gmail.com>
90Date: Wed, 24 May 2023 11:15:44 +0900
91Subject: [PATCH 3/3] test-network: add tests for vlan QoS mapping
92
93---
94 .../conf/21-vlan.netdev.d/override.conf | 10 ++++++----
95 test/test-network/systemd-networkd-tests.py | 14 ++++++++------
96 2 files changed, 14 insertions(+), 10 deletions(-)
97
98diff --git a/test/test-network/conf/21-vlan.netdev.d/override.conf b/test/test-network/conf/21-vlan.netdev.d/override.conf
99index 3b8d47d9b1db5..c71077d274a69 100644
100--- a/test/test-network/conf/21-vlan.netdev.d/override.conf
101+++ b/test/test-network/conf/21-vlan.netdev.d/override.conf
102@@ -3,7 +3,9 @@ MTUBytes=2000
103
104 [VLAN]
105 Id=99
106-GVRP=true
107-MVRP=true
108-LooseBinding=true
109-ReorderHeader=true
110+GVRP=yes
111+MVRP=yes
112+LooseBinding=yes
113+ReorderHeader=yes
114+EgressQOSMaps=0-1 1-3 10-3 6-6 7-7
115+IngressQOSMaps=15-13 20-100
116diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
117index fe72f37ce4f47..8b01718d55e64 100755
118--- a/test/test-network/systemd-networkd-tests.py
119+++ b/test/test-network/systemd-networkd-tests.py
120@@ -1285,12 +1285,14 @@ def test_vlan(self):
121
122 output = check_output('ip -d link show vlan99')
123 print(output)
124- self.assertRegex(output, ' mtu 2000 ')
125- self.assertRegex(output, 'REORDER_HDR')
126- self.assertRegex(output, 'LOOSE_BINDING')
127- self.assertRegex(output, 'GVRP')
128- self.assertRegex(output, 'MVRP')
129- self.assertRegex(output, ' id 99 ')
130+ self.assertIn(' mtu 2000 ', output)
131+ self.assertIn('REORDER_HDR', output)
132+ self.assertIn('LOOSE_BINDING', output)
133+ self.assertIn('GVRP', output)
134+ self.assertIn('MVRP', output)
135+ self.assertIn(' id 99 ', output)
136+ self.assertIn('ingress-qos-map { 4:100 7:13 }', output)
137+ self.assertIn('egress-qos-map { 0:1 1:3 6:6 7:7 10:3 }', output)
138
139 output = check_output('ip -4 address show dev test1')
140 print(output)
diff --git a/meta/recipes-core/systemd/systemd_250.5.bb b/meta/recipes-core/systemd/systemd_250.5.bb
index 80a797cf2c..4d520c85f3 100644
--- a/meta/recipes-core/systemd/systemd_250.5.bb
+++ b/meta/recipes-core/systemd/systemd_250.5.bb
@@ -33,6 +33,7 @@ SRC_URI += "file://touchscreen.rules \
33 file://0001-network-remove-only-managed-configs-on-reconfigure-o.patch \ 33 file://0001-network-remove-only-managed-configs-on-reconfigure-o.patch \
34 file://0001-nspawn-make-sure-host-root-can-write-to-the-uidmappe.patch \ 34 file://0001-nspawn-make-sure-host-root-can-write-to-the-uidmappe.patch \
35 file://CVE-2023-7008.patch \ 35 file://CVE-2023-7008.patch \
36 file://fix-vlan-qos-mapping.patch \
36 " 37 "
37 38
38# patches needed by musl 39# patches needed by musl