mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-28 00:30:36 +01:00
platform: fix routing rule test failure
Since kernel 5.18 there is a stricter validation [1][2] on the tos field of routing rules, that must not include ECN bits. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f55fbb6afb8d701e3185e31e73f5ea9503a66744 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a410a0cf98854a698a519bfbeb604145da384c0e Fixes the following failure: >>> src/core/platform/tests/test-route-linux >>> ... # NetworkManager-MESSAGE: <warn> [1656321515.6604] platform-linux: do-add-rule: failure 22 (Invalid argument - Invalid dsfield (tos): ECN bits must be 0) >>> failing... errno=-22, rule=[routing-rule,0x13d6e80,1,+alive,+visible; [6] 0: from all tos 0xff fwmark 0x4/0 suppress_prefixlen -459579276 action-214 protocol 255] >>> existing rule: * [routing-rule,0x13d71e0,2,+alive,+visible; [6] 0: from all sport 65534 lookup 10009 suppress_prefixlen 0 none] >>> existing rule: [routing-rule,0x13d7280,2,+alive,+visible; [4] 0: from all fwmark 0/0x9a7e9992 ipproto 255 suppress_prefixlen 0 realms 0x00000008 none protocol 71] >>> existing rule: [routing-rule,0x13d7320,2,+alive,+visible; [6] 598928157: from all suppress_prefixlen 0 none] >>> existing rule: [routing-rule,0x13d73c0,2,+alive,+visible; [4] 0: from 192.192.5.200/8 lookup 254 suppress_prefixlen 0 none protocol 9] >>> existing rule: [routing-rule,0x13d7460,2,+alive,+visible; [4] 0: from all ipproto 3 suppress_prefixlen 0 realms 0xffffffff none protocol 5] >>> existing rule: [routing-rule,0x13d7500,2,+alive,+visible; [4] 0: from all fwmark 0x1/0 lookup 254 suppress_prefixlen 0 action-124 protocol 4] >>> existing rule: [routing-rule,0x13d75a0,2,+alive,+visible; [4] 0: from all suppress_prefixlen 0 action-109] 0: from all fwmark 0/0x9a7e9992 ipproto ipproto-255 realms 8 none proto 71 0: from 192.192.5.200/8 lookup main suppress_prefixlength 0 none proto ra 0: from all ipproto ggp realms 65535/65535 none proto 5 0: from all fwmark 0x1/0 lookup main suppress_prefixlength 0 124 proto static 0: from all 109 0: from all sport 65534 lookup 10009 suppress_prefixlength 0 none 598928157: from all none Bail out! nm:ERROR:../src/core/platform/tests/test-route.c:1787:test_rule: assertion failed (r == 0): (-22 == 0) Fixes:5ae2431b0f('platform/tests: add tests for handling policy routing rules') (cherry picked from commitbf9a2babb4) (cherry picked from commit09b0014a01) (cherry picked from commite1266b3b12)
This commit is contained in:
parent
bd951c5398
commit
8da69be278
1 changed files with 5 additions and 0 deletions
|
|
@ -1398,12 +1398,17 @@ again_table:
|
|||
rr->protocol = _rr_rand_choose_u8(nmtst_get_rand_uint32());
|
||||
|
||||
#define IPTOS_TOS_MASK 0x1E
|
||||
#define INET_DSCP_MASK 0xFC
|
||||
|
||||
again_tos:
|
||||
rr->tos = _rr_rand_choose_u8(nmtst_get_rand_uint32());
|
||||
|
||||
if (rr->addr_family == AF_INET && rr->tos & ~IPTOS_TOS_MASK)
|
||||
goto again_tos;
|
||||
|
||||
if (rr->tos & ~INET_DSCP_MASK)
|
||||
goto again_tos;
|
||||
|
||||
if (_rule_check_kernel_support(platform, FRA_IP_PROTO))
|
||||
rr->ip_proto = _rr_rand_choose_u8(nmtst_get_rand_uint32());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue