Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test failures on newer kernels #921

Merged
merged 4 commits into from
Oct 24, 2023
Merged

Conversation

tklauser
Copy link
Contributor

@tklauser tklauser commented Oct 24, 2023

Commit 1:

Enable extended error message reporting in tests

This causes the NETLINK_EXT_ACK socket option to be set and extended
error messages to be reported in errors. This should help debug test
failures.

Also use errors.Is to check for errors because using extended error
reporting, the errors no longer match exactly.

Commit 2:

nl: avoid trailing NULL byte in error messages

Use unix.ByteSliceToString to convert the NULL-terminated
NLMSGERR_ATTR_MSG error message.

Commit 3:

Use valid Tos value in TestRouteFilterAllTables and TestRouteExtraFields

TestRouteFilterAllTables and TestRouteExtraFields started failing a
while ago after GitHub actions images bumped the kernel version from
5.15.x to 6.2.x [1].

This is because newer kernels containing commit [2] started rejecting
Tos values with the ECN bits set to non-zero, this leads to the
following error being reported when adding routes:

    invalid argument: Invalid dsfield (tos): ECN bits must be 0

Fix this by using a valid Tos value in TestRouteFilterAllTables and
TestRouteExtraFields.

[1] https://github.com/vishvananda/netlink/pull/773#issuecomment-1754436653
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f55fbb6afb8d

Commit 4:

Use inbound policy in TestXfrmPolicyWithOptional

Since kernel commit
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3d776e31c841b
optional tunnel/BEET mode templates in outbound policies are rejected.

Use an inbound policy instead to fix the test failure on newer kernels.

This causes the NETLINK_EXT_ACK socket option to be set and extended
error messages to be reported in errors. This should help debug test
failures.

Also use errors.Is to check for errors because using extended error
reporting, the errors no longer match exactly.
Use unix.ByteSliceToString to convert the NULL-terminated
NLMSGERR_ATTR_MSG error message.
TestRouteFilterAllTables and TestRouteExtraFields started failing a
while ago after GitHub actions images bumped the kernel version from
5.15.x to 6.2.x [1].

This is because newer kernels containing commit [2] started rejecting
Tos values with the ECN bits set to non-zero, this leads to the
following error being reported when adding routes:

    invalid argument: Invalid dsfield (tos): ECN bits must be 0

Fix this by using a valid Tos value in TestRouteFilterAllTables and
TestRouteExtraFields.

[1] vishvananda#773 (comment)
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f55fbb6afb8d
@tklauser tklauser changed the title Fix TestRouteFilterAllTables and TestRouteExtraFields failures Fix test failures on newer kernels Oct 24, 2023
Since kernel commit
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3d776e31c841b
optional tunnel/BEET mode templates in outbound policies are rejected.

Use an inbound policy instead to fix the test failure on newer kernels.
@tklauser
Copy link
Contributor Author

@vishvananda @aboch PTAL. This should fix the CI failures currently seen on the main branch after GitHub actions runner images updated kernel versions, also see #773 (comment)

@aboch
Copy link
Collaborator

aboch commented Oct 24, 2023

Thanks @tklauser for your fixes!

Usually we want a commit per PR, but in this case the commits are clearly fixing/improving independent things. Since all changes pertain to UT fix, I will not ask for four independent PRs.

LGTM

@aboch aboch merged commit d18d70b into vishvananda:main Oct 24, 2023
2 checks passed
@tklauser tklauser deleted the fix-main-ci branch October 24, 2023 17:47
@tklauser
Copy link
Contributor Author

Usually we want a commit per PR, but in this case the commits are clearly fixing/improving independent things. Since all changes pertain to UT fix, I will not ask for four independent PRs.

Thanks, I wasn't aware of that rule. I'll keep it in mind for future changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants