Skip to content

Commit ef75add

Browse files
author
CKI KWF Bot
committed
Merge: selftests: stable backport for 10.2 phase 1
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1460 JIRA: https://issues.redhat.com/browse/RHEL-115594 * 8f0ae19 selftests: net: exit cleanly on SIGTERM / timeout * 47c8499 selftests: net: lib: fix shift count out of range * 0e94189 selftests: net: increase inter-packet timeout in udpgro.sh * 8b4a1a4 selftests: netfilter: ipvs.sh: Explicity disable rp_filter on interface tunl0 * 5b32321 selftests: rtnetlink.sh: remove esp4_offload after test * d6a367e netfilter: nft_flowtable.sh: re-run with random mtu sizes * fd2004d selftest: net: Fix weird setsockopt() in bind_bhash.c. Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com> --- <small>Created 2025-09-19 08:25 UTC by backporter - [KWF FAQ](https://red.ht/kernel_workflow_doc) - [Slack #team-kernel-workflow](https://redhat-internal.slack.com/archives/C04LRUPMJQ5) - [Source](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/webhook/utils/backporter.py) - [Documentation](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/docs/README.backporter.md) - [Report an issue](https://issues.redhat.com/secure/CreateIssueDetails!init.jspa?pid=12334433&issuetype=1&priority=4&summary=backporter+webhook+issue&components=kernel-workflow+/+backporter)</small> Approved-by: Florian Westphal <fwestpha@redhat.com> Approved-by: Guillaume Nault <gnault@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 0c01c87 + 0ce649b commit ef75add

File tree

7 files changed

+114
-47
lines changed

7 files changed

+114
-47
lines changed

tools/testing/selftests/net/bind_bhash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static void *setup(void *arg)
7575
int *array = (int *)arg;
7676

7777
for (i = 0; i < MAX_CONNECTIONS; i++) {
78-
sock_fd = bind_socket(SO_REUSEADDR | SO_REUSEPORT, setup_addr);
78+
sock_fd = bind_socket(SO_REUSEPORT, setup_addr);
7979
if (sock_fd < 0) {
8080
ret = sock_fd;
8181
pthread_exit(&ret);
@@ -103,7 +103,7 @@ int main(int argc, const char *argv[])
103103

104104
setup_addr = use_v6 ? setup_addr_v6 : setup_addr_v4;
105105

106-
listener_fd = bind_socket(SO_REUSEADDR | SO_REUSEPORT, setup_addr);
106+
listener_fd = bind_socket(SO_REUSEPORT, setup_addr);
107107
if (listen(listener_fd, 100) < 0) {
108108
perror("listen failed");
109109
return -1;

tools/testing/selftests/net/lib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ log_test_result()
263263
local test_name=$1; shift
264264
local opt_str=$1; shift
265265
local result=$1; shift
266-
local retmsg=$1; shift
266+
local retmsg=$1
267267

268268
printf "TEST: %-60s [%s]\n" "$test_name $opt_str" "$result"
269269
if [[ $retmsg ]]; then

tools/testing/selftests/net/lib/py/ksft.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import builtins
44
import functools
55
import inspect
6+
import signal
67
import sys
78
import time
89
import traceback
@@ -26,6 +27,10 @@ class KsftXfailEx(Exception):
2627
pass
2728

2829

30+
class KsftTerminate(KeyboardInterrupt):
31+
pass
32+
33+
2934
def ksft_pr(*objs, **kwargs):
3035
print("#", *objs, **kwargs)
3136

@@ -183,6 +188,17 @@ def get_bool(env, name):
183188
return env
184189

185190

191+
def _ksft_intr(signum, frame):
192+
# ksft runner.sh sends 2 SIGTERMs in a row on a timeout
193+
# if we don't ignore the second one it will stop us from handling cleanup
194+
global term_cnt
195+
term_cnt += 1
196+
if term_cnt == 1:
197+
raise KsftTerminate()
198+
else:
199+
ksft_pr(f"Ignoring SIGTERM (cnt: {term_cnt}), already exiting...")
200+
201+
186202
def ksft_run(cases=None, globs=None, case_pfx=None, args=()):
187203
cases = cases or []
188204

@@ -195,6 +211,10 @@ def ksft_run(cases=None, globs=None, case_pfx=None, args=()):
195211
cases.append(value)
196212
break
197213

214+
global term_cnt
215+
term_cnt = 0
216+
prev_sigterm = signal.signal(signal.SIGTERM, _ksft_intr)
217+
198218
totals = {"pass": 0, "fail": 0, "skip": 0, "xfail": 0}
199219

200220
print("TAP version 13")
@@ -223,7 +243,7 @@ def ksft_run(cases=None, globs=None, case_pfx=None, args=()):
223243
for line in tb.strip().split('\n'):
224244
ksft_pr("Exception|", line)
225245
if stop:
226-
ksft_pr("Stopping tests due to KeyboardInterrupt.")
246+
ksft_pr(f"Stopping tests due to {type(e).__name__}.")
227247
KSFT_RESULT = False
228248
cnt_key = 'fail'
229249

@@ -238,6 +258,8 @@ def ksft_run(cases=None, globs=None, case_pfx=None, args=()):
238258
if stop:
239259
break
240260

261+
signal.signal(signal.SIGTERM, prev_sigterm)
262+
241263
print(
242264
f"# Totals: pass:{totals['pass']} fail:{totals['fail']} xfail:{totals['xfail']} xpass:0 skip:{totals['skip']} error:0"
243265
)

tools/testing/selftests/net/netfilter/ipvs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ test_nat() {
151151
test_tun() {
152152
ip netns exec "${ns0}" ip route add "${vip_v4}" via "${gip_v4}" dev br0
153153

154-
ip netns exec "${ns1}" modprobe -q ipip
154+
modprobe -q ipip
155155
ip netns exec "${ns1}" ip link set tunl0 up
156156
ip netns exec "${ns1}" sysctl -qw net.ipv4.ip_forward=0
157157
ip netns exec "${ns1}" sysctl -qw net.ipv4.conf.all.send_redirects=0
@@ -160,10 +160,10 @@ test_tun() {
160160
ip netns exec "${ns1}" ipvsadm -a -i -t "${vip_v4}:${port}" -r ${rip_v4}:${port}
161161
ip netns exec "${ns1}" ip addr add ${vip_v4}/32 dev lo:1
162162

163-
ip netns exec "${ns2}" modprobe -q ipip
164163
ip netns exec "${ns2}" ip link set tunl0 up
165164
ip netns exec "${ns2}" sysctl -qw net.ipv4.conf.all.arp_ignore=1
166165
ip netns exec "${ns2}" sysctl -qw net.ipv4.conf.all.arp_announce=2
166+
ip netns exec "${ns2}" sysctl -qw net.ipv4.conf.tunl0.rp_filter=0
167167
ip netns exec "${ns2}" ip addr add "${vip_v4}/32" dev lo:1
168168

169169
test_service

0 commit comments

Comments
 (0)