mirror of
https://github.com/systemd/systemd.git
synced 2025-05-30 05:05:57 +03:00
Merge pull request #27761 from yuwata/network-vlan-qos-mapping
network: fix vlan qos mapping
This commit is contained in:
commit
fe830b84d4
@ -144,6 +144,7 @@ int config_parse_vlan_qos_maps(
|
|||||||
for (const char *p = rvalue;;) {
|
for (const char *p = rvalue;;) {
|
||||||
_cleanup_free_ struct ifla_vlan_qos_mapping *m = NULL;
|
_cleanup_free_ struct ifla_vlan_qos_mapping *m = NULL;
|
||||||
_cleanup_free_ char *w = NULL;
|
_cleanup_free_ char *w = NULL;
|
||||||
|
unsigned from, to;
|
||||||
|
|
||||||
r = extract_first_word(&p, &w, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &w, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE);
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
@ -155,20 +156,20 @@ int config_parse_vlan_qos_maps(
|
|||||||
if (r == 0)
|
if (r == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
m = new0(struct ifla_vlan_qos_mapping, 1);
|
r = parse_range(w, &from, &to);
|
||||||
if (!m)
|
|
||||||
return log_oom();
|
|
||||||
|
|
||||||
r = parse_range(w, &m->from, &m->to);
|
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s, ignoring: %s", lvalue, w);
|
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s, ignoring: %s", lvalue, w);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->to > m->from || m->to == 0 || m->from == 0) {
|
m = new(struct ifla_vlan_qos_mapping, 1);
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid %s, ignoring: %s", lvalue, w);
|
if (!m)
|
||||||
continue;
|
return log_oom();
|
||||||
}
|
|
||||||
|
*m = (struct ifla_vlan_qos_mapping) {
|
||||||
|
.from = from,
|
||||||
|
.to = to,
|
||||||
|
};
|
||||||
|
|
||||||
r = set_ensure_consume(s, &vlan_qos_maps_hash_ops, TAKE_PTR(m));
|
r = set_ensure_consume(s, &vlan_qos_maps_hash_ops, TAKE_PTR(m));
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
|
@ -3,7 +3,9 @@ MTUBytes=2000
|
|||||||
|
|
||||||
[VLAN]
|
[VLAN]
|
||||||
Id=99
|
Id=99
|
||||||
GVRP=true
|
GVRP=yes
|
||||||
MVRP=true
|
MVRP=yes
|
||||||
LooseBinding=true
|
LooseBinding=yes
|
||||||
ReorderHeader=true
|
ReorderHeader=yes
|
||||||
|
EgressQOSMaps=0-1 1-3 10-3 6-6 7-7
|
||||||
|
IngressQOSMaps=15-13 20-100
|
||||||
|
@ -1285,12 +1285,14 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
|||||||
|
|
||||||
output = check_output('ip -d link show vlan99')
|
output = check_output('ip -d link show vlan99')
|
||||||
print(output)
|
print(output)
|
||||||
self.assertRegex(output, ' mtu 2000 ')
|
self.assertIn(' mtu 2000 ', output)
|
||||||
self.assertRegex(output, 'REORDER_HDR')
|
self.assertIn('REORDER_HDR', output)
|
||||||
self.assertRegex(output, 'LOOSE_BINDING')
|
self.assertIn('LOOSE_BINDING', output)
|
||||||
self.assertRegex(output, 'GVRP')
|
self.assertIn('GVRP', output)
|
||||||
self.assertRegex(output, 'MVRP')
|
self.assertIn('MVRP', output)
|
||||||
self.assertRegex(output, ' id 99 ')
|
self.assertIn(' id 99 ', output)
|
||||||
|
self.assertIn('ingress-qos-map { 4:100 7:13 }', output)
|
||||||
|
self.assertIn('egress-qos-map { 0:1 1:3 6:6 7:7 10:3 }', output)
|
||||||
|
|
||||||
output = check_output('ip -4 address show dev test1')
|
output = check_output('ip -4 address show dev test1')
|
||||||
print(output)
|
print(output)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user