Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
1
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
5fd79ed
Documentation
LICENSES
arch
block
certs
crypto
drivers
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
accounting
arch
bootconfig
bpf
build
cgroup
debugging
edid
firewire
firmware
gpio
hv
iio
include
io_uring
kvm/kvm_stat
laptop
leds
lib
memory-model
objtool
pci
pcmcia
perf
power
rcu
scripts
spi
testing
fault-injection
ktest
kunit
nvdimm
radix-tree
scatterlist
selftests
arm64
bpf
benchs
bpf_testmod
gnu
map_tests
prog_tests
.gitignore
align.c
atomic_bounds.c
atomics.c
attach_probe.c
autoload.c
bind_perm.c
bloom_filter_map.c
bpf_cookie.c
bpf_iter.c
bpf_iter_setsockopt.c
bpf_obj_id.c
bpf_tcp_ca.c
bpf_verif_scale.c
btf.c
btf_dedup_split.c
btf_dump.c
btf_endian.c
btf_map_in_map.c
btf_module.c
btf_skc_cls_ingress.c
btf_split.c
btf_tag.c
btf_write.c
cg_storage_multi.c
cgroup_attach_autodetach.c
cgroup_attach_multi.c
cgroup_attach_override.c
cgroup_link.c
cgroup_skb_sk_lookup.c
cgroup_v1v2.c
check_mtu.c
cls_redirect.c
connect_force_port.c
core_autosize.c
core_extern.c
core_read_macros.c
core_reloc.c
core_retro.c
cpu_mask.c
d_path.c
dummy_st_ops.c
enable_stats.c
endian.c
fentry_fexit.c
fentry_test.c
fexit_bpf2bpf.c
fexit_sleep.c
fexit_stress.c
fexit_test.c
flow_dissector.c
flow_dissector_load_bytes.c
flow_dissector_reattach.c
for_each.c
get_branch_snapshot.c
get_func_ip_test.c
get_stack_raw_tp.c
get_stackid_cannot_attach.c
global_data.c
global_data_init.c
global_func_args.c
hash_large_key.c
hashmap.c
kfree_skb.c
kfunc_call.c
ksyms.c
ksyms_btf.c
ksyms_module.c
l4lb_all.c
link_pinning.c
linked_funcs.c
linked_maps.c
linked_vars.c
load_bytes_relative.c
lookup_and_delete.c
map_init.c
map_lock.c
map_ptr.c
metadata.c
migrate_reuseport.c
mmap.c
modify_return.c
module_attach.c
netcnt.c
netns_cookie.c
ns_current_pid_tgid.c
obj_name.c
pe_preserve_elems.c
perf_branches.c
perf_buffer.c
perf_event_stackmap.c
perf_link.c
pinning.c
pkt_access.c
pkt_md_access.c
probe_read_user_str.c
probe_user.c
prog_run_xattr.c
queue_stack_map.c
raw_tp_test_run.c
raw_tp_writable_reject_nbd_invalid.c
raw_tp_writable_test_run.c
rdonly_maps.c
recursion.c
reference_tracking.c
resolve_btfids.c
ringbuf.c
ringbuf_multi.c
section_names.c
select_reuseport.c
send_signal.c
send_signal_sched_switch.c
signal_pending.c
sk_assign.c
sk_lookup.c
sk_storage_tracing.c
skb_ctx.c
skb_helpers.c
skc_to_unix_sock.c
skeleton.c
snprintf.c
snprintf_btf.c
sock_fields.c
socket_cookie.c
sockmap_basic.c
sockmap_ktls.c
sockmap_listen.c
sockopt.c
sockopt_inherit.c
sockopt_multi.c
sockopt_qos_to_cc.c
sockopt_sk.c
spinlock.c
stack_var_off.c
stacktrace_build_id.c
stacktrace_build_id_nmi.c
stacktrace_map.c
stacktrace_map_raw_tp.c
static_linked.c
subprogs.c
syscall.c
tailcalls.c
task_fd_query_rawtp.c
task_fd_query_tp.c
task_local_storage.c
task_pt_regs.c
tc_bpf.c
tc_redirect.c
tcp_estats.c
tcp_hdr_options.c
tcp_rtt.c
tcpbpf_user.c
test_bpffs.c
test_bprm_opts.c
test_global_funcs.c
test_ima.c
test_local_storage.c
test_lsm.c
test_overhead.c
test_profiler.c
test_skb_pkt_end.c
timer.c
timer_mim.c
tp_attach_query.c
trace_ext.c
trace_printk.c
trace_vprintk.c
trampoline_count.c
udp_limit.c
varlen.c
verif_stats.c
vmlinux.c
xdp.c
xdp_adjust_tail.c
xdp_attach.c
xdp_bonding.c
xdp_bpf2bpf.c
xdp_context_test_run.c
xdp_cpumap_attach.c
xdp_devmap_attach.c
xdp_info.c
xdp_link.c
xdp_noinline.c
xdp_perf.c
xdpwall.c
progs
verifier
.gitignore
Makefile
Makefile.docs
README.rst
bench.c
bench.h
bpf_legacy.h
bpf_rand.h
bpf_rlimit.h
bpf_sockopt_helpers.h
bpf_tcp_helpers.h
bpf_util.h
btf_helpers.c
btf_helpers.h
cgroup_helpers.c
cgroup_helpers.h
config
flow_dissector_load.c
flow_dissector_load.h
get_cgroup_id_user.c
ima_setup.sh
netcnt_common.h
network_helpers.c
network_helpers.h
settings
test_bpftool.py
test_bpftool.sh
test_bpftool_build.sh
test_bpftool_metadata.sh
test_bpftool_synctypes.py
test_btf.h
test_cgroup_storage.c
test_cpp.cpp
test_dev_cgroup.c
test_doc_build.sh
test_flow_dissector.c
test_flow_dissector.sh
test_ftrace.sh
test_iptunnel_common.h
test_kmod.sh
test_lirc_mode2.sh
test_lirc_mode2_user.c
test_lpm_map.c
test_lru_map.c
test_lwt_ip_encap.sh
test_lwt_seg6local.sh
test_maps.c
test_maps.h
test_offload.py
test_progs.c
test_progs.h
test_select_reuseport_common.h
test_skb_cgroup_id.sh
test_skb_cgroup_id_user.c
test_sock.c
test_sock_addr.c
test_sock_addr.sh
test_sockmap.c
test_sysctl.c
test_tag.c
test_tc_edt.sh
test_tc_tunnel.sh
test_tcp_check_syncookie.sh
test_tcp_check_syncookie_user.c
test_tcp_hdr_options.h
test_tcpbpf.h
test_tcpnotify.h
test_tcpnotify_user.c
test_tunnel.sh
test_verifier.c
test_verifier_log.c
test_xdp_meta.sh
test_xdp_redirect.sh
test_xdp_redirect_multi.sh
test_xdp_veth.sh
test_xdp_vlan.sh
test_xdp_vlan_mode_generic.sh
test_xdp_vlan_mode_native.sh
test_xdping.sh
test_xsk.sh
testing_helpers.c
testing_helpers.h
trace_helpers.c
trace_helpers.h
urandom_read.c
vmtest.sh
with_addr.sh
with_tunnels.sh
xdp_redirect_multi.c
xdping.c
xdping.h
xdpxceiver.c
xdpxceiver.h
xsk_prereqs.sh
breakpoints
capabilities
cgroup
clone3
core
cpu-hotplug
cpufreq
damon
dma
dmabuf-heaps
drivers
efivarfs
exec
filesystems
firmware
fpu
ftrace
futex
gpio
ia64
intel_pstate
ipc
ir
kcmp
kexec
kmod
kselftest
kvm
landlock
lib
livepatch
lkdtm
locking
media_tests
membarrier
memfd
memory-hotplug
mincore
mount
mount_setattr
move_mount_set_group
mqueue
nci
net
netfilter
nsfs
ntb
openat2
perf_events
pid_namespace
pidfd
powerpc
prctl
proc
pstore
ptp
ptrace
rcutorture
resctrl
rlimits
rseq
rtc
safesetid
sched
seccomp
sgx
sigaltstack
size
sparc64
splice
static_keys
sync
syscall_user_dispatch
sysctl
tc-testing
timens
timers
tmpfs
tpm2
uevent
user
vDSO
vm
watchdog
wireguard
x86
zram
.gitignore
Makefile
gen_kselftest_tar.sh
kselftest.h
kselftest_deps.sh
kselftest_harness.h
kselftest_install.sh
kselftest_module.h
lib.mk
run_kselftest.sh
vsock
thermal/tmon
time
tracing
usb
virtio
vm
wmi
Makefile
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
tools
/
testing
/
selftests
/
bpf
/
prog_tests
/
migrate_reuseport.c
Copy path
Blame
Blame
Latest commit
History
History
559 lines (470 loc) · 13.7 KB
Breadcrumbs
linux
/
tools
/
testing
/
selftests
/
bpf
/
prog_tests
/
migrate_reuseport.c
Top
File metadata and controls
Code
Blame
559 lines (470 loc) · 13.7 KB
Raw
// SPDX-License-Identifier: GPL-2.0 /* * Check if we can migrate child sockets. * * 1. call listen() for 4 server sockets. * 2. call connect() for 25 client sockets. * 3. call listen() for 1 server socket. (migration target) * 4. update a map to migrate all child sockets * to the last server socket (migrate_map[cookie] = 4) * 5. call shutdown() for first 4 server sockets * and migrate the requests in the accept queue * to the last server socket. * 6. call listen() for the second server socket. * 7. call shutdown() for the last server * and migrate the requests in the accept queue * to the second server socket. * 8. call listen() for the last server. * 9. call shutdown() for the second server * and migrate the requests in the accept queue * to the last server socket. * 10. call accept() for the last server socket. * * Author: Kuniyuki Iwashima <kuniyu@amazon.co.jp> */ #include <bpf/bpf.h> #include <bpf/libbpf.h> #include "test_progs.h" #include "test_migrate_reuseport.skel.h" #include "network_helpers.h" #ifndef TCP_FASTOPEN_CONNECT #define TCP_FASTOPEN_CONNECT 30 #endif #define IFINDEX_LO 1 #define NR_SERVERS 5 #define NR_CLIENTS (NR_SERVERS * 5) #define MIGRATED_TO (NR_SERVERS - 1) /* fastopenq->max_qlen and sk->sk_max_ack_backlog */ #define QLEN (NR_CLIENTS * 5) #define MSG "Hello World\0" #define MSGLEN 12 static struct migrate_reuseport_test_case { const char *name; __s64 servers[NR_SERVERS]; __s64 clients[NR_CLIENTS]; struct sockaddr_storage addr; socklen_t addrlen; int family; int state; bool drop_ack; bool expire_synack_timer; bool fastopen; struct bpf_link *link; } test_cases[] = { { .name = "IPv4 TCP_ESTABLISHED inet_csk_listen_stop", .family = AF_INET, .state = BPF_TCP_ESTABLISHED, .drop_ack = false, .expire_synack_timer = false, .fastopen = false, }, { .name = "IPv4 TCP_SYN_RECV inet_csk_listen_stop", .family = AF_INET, .state = BPF_TCP_SYN_RECV, .drop_ack = true, .expire_synack_timer = false, .fastopen = true, }, { .name = "IPv4 TCP_NEW_SYN_RECV reqsk_timer_handler", .family = AF_INET, .state = BPF_TCP_NEW_SYN_RECV, .drop_ack = true, .expire_synack_timer = true, .fastopen = false, }, { .name = "IPv4 TCP_NEW_SYN_RECV inet_csk_complete_hashdance", .family = AF_INET, .state = BPF_TCP_NEW_SYN_RECV, .drop_ack = true, .expire_synack_timer = false, .fastopen = false, }, { .name = "IPv6 TCP_ESTABLISHED inet_csk_listen_stop", .family = AF_INET6, .state = BPF_TCP_ESTABLISHED, .drop_ack = false, .expire_synack_timer = false, .fastopen = false, }, { .name = "IPv6 TCP_SYN_RECV inet_csk_listen_stop", .family = AF_INET6, .state = BPF_TCP_SYN_RECV, .drop_ack = true, .expire_synack_timer = false, .fastopen = true, }, { .name = "IPv6 TCP_NEW_SYN_RECV reqsk_timer_handler", .family = AF_INET6, .state = BPF_TCP_NEW_SYN_RECV, .drop_ack = true, .expire_synack_timer = true, .fastopen = false, }, { .name = "IPv6 TCP_NEW_SYN_RECV inet_csk_complete_hashdance", .family = AF_INET6, .state = BPF_TCP_NEW_SYN_RECV, .drop_ack = true, .expire_synack_timer = false, .fastopen = false, } }; static void init_fds(__s64 fds[], int len) { int i; for (i = 0; i < len; i++) fds[i] = -1; } static void close_fds(__s64 fds[], int len) { int i; for (i = 0; i < len; i++) { if (fds[i] != -1) { close(fds[i]); fds[i] = -1; } } } static int setup_fastopen(char *buf, int size, int *saved_len, bool restore) { int err = 0, fd, len; fd = open("/proc/sys/net/ipv4/tcp_fastopen", O_RDWR); if (!ASSERT_NEQ(fd, -1, "open")) return -1; if (restore) { len = write(fd, buf, *saved_len); if (!ASSERT_EQ(len, *saved_len, "write - restore")) err = -1; } else { *saved_len = read(fd, buf, size); if (!ASSERT_GE(*saved_len, 1, "read")) { err = -1; goto close; } err = lseek(fd, 0, SEEK_SET); if (!ASSERT_OK(err, "lseek")) goto close; /* (TFO_CLIENT_ENABLE | TFO_SERVER_ENABLE | * TFO_CLIENT_NO_COOKIE | TFO_SERVER_COOKIE_NOT_REQD) */ len = write(fd, "519", 3); if (!ASSERT_EQ(len, 3, "write - setup")) err = -1; } close: close(fd); return err; } static int drop_ack(struct migrate_reuseport_test_case *test_case, struct test_migrate_reuseport *skel) { if (test_case->family == AF_INET) skel->bss->server_port = ((struct sockaddr_in *) &test_case->addr)->sin_port; else skel->bss->server_port = ((struct sockaddr_in6 *) &test_case->addr)->sin6_port; test_case->link = bpf_program__attach_xdp(skel->progs.drop_ack, IFINDEX_LO); if (!ASSERT_OK_PTR(test_case->link, "bpf_program__attach_xdp")) return -1; return 0; } static int pass_ack(struct migrate_reuseport_test_case *test_case) { int err; err = bpf_link__destroy(test_case->link); if (!ASSERT_OK(err, "bpf_link__destroy")) return -1; test_case->link = NULL; return 0; } static int start_servers(struct migrate_reuseport_test_case *test_case, struct test_migrate_reuseport *skel) { int i, err, prog_fd, reuseport = 1, qlen = QLEN; prog_fd = bpf_program__fd(skel->progs.migrate_reuseport); make_sockaddr(test_case->family, test_case->family == AF_INET ? "127.0.0.1" : "::1", 0, &test_case->addr, &test_case->addrlen); for (i = 0; i < NR_SERVERS; i++) { test_case->servers[i] = socket(test_case->family, SOCK_STREAM, IPPROTO_TCP); if (!ASSERT_NEQ(test_case->servers[i], -1, "socket")) return -1; err = setsockopt(test_case->servers[i], SOL_SOCKET, SO_REUSEPORT, &reuseport, sizeof(reuseport)); if (!ASSERT_OK(err, "setsockopt - SO_REUSEPORT")) return -1; err = bind(test_case->servers[i], (struct sockaddr *)&test_case->addr, test_case->addrlen); if (!ASSERT_OK(err, "bind")) return -1; if (i == 0) { err = setsockopt(test_case->servers[i], SOL_SOCKET, SO_ATTACH_REUSEPORT_EBPF, &prog_fd, sizeof(prog_fd)); if (!ASSERT_OK(err, "setsockopt - SO_ATTACH_REUSEPORT_EBPF")) return -1; err = getsockname(test_case->servers[i], (struct sockaddr *)&test_case->addr, &test_case->addrlen); if (!ASSERT_OK(err, "getsockname")) return -1; } if (test_case->fastopen) { err = setsockopt(test_case->servers[i], SOL_TCP, TCP_FASTOPEN, &qlen, sizeof(qlen)); if (!ASSERT_OK(err, "setsockopt - TCP_FASTOPEN")) return -1; } /* All requests will be tied to the first four listeners */ if (i != MIGRATED_TO) { err = listen(test_case->servers[i], qlen); if (!ASSERT_OK(err, "listen")) return -1; } } return 0; } static int start_clients(struct migrate_reuseport_test_case *test_case) { char buf[MSGLEN] = MSG; int i, err; for (i = 0; i < NR_CLIENTS; i++) { test_case->clients[i] = socket(test_case->family, SOCK_STREAM, IPPROTO_TCP); if (!ASSERT_NEQ(test_case->clients[i], -1, "socket")) return -1; /* The attached XDP program drops only the final ACK, so * clients will transition to TCP_ESTABLISHED immediately. */ err = settimeo(test_case->clients[i], 100); if (!ASSERT_OK(err, "settimeo")) return -1; if (test_case->fastopen) { int fastopen = 1; err = setsockopt(test_case->clients[i], IPPROTO_TCP, TCP_FASTOPEN_CONNECT, &fastopen, sizeof(fastopen)); if (!ASSERT_OK(err, "setsockopt - TCP_FASTOPEN_CONNECT")) return -1; } err = connect(test_case->clients[i], (struct sockaddr *)&test_case->addr, test_case->addrlen); if (!ASSERT_OK(err, "connect")) return -1; err = write(test_case->clients[i], buf, MSGLEN); if (!ASSERT_EQ(err, MSGLEN, "write")) return -1; } return 0; } static int update_maps(struct migrate_reuseport_test_case *test_case, struct test_migrate_reuseport *skel) { int i, err, migrated_to = MIGRATED_TO; int reuseport_map_fd, migrate_map_fd; __u64 value; reuseport_map_fd = bpf_map__fd(skel->maps.reuseport_map); migrate_map_fd = bpf_map__fd(skel->maps.migrate_map); for (i = 0; i < NR_SERVERS; i++) { value = (__u64)test_case->servers[i]; err = bpf_map_update_elem(reuseport_map_fd, &i, &value, BPF_NOEXIST); if (!ASSERT_OK(err, "bpf_map_update_elem - reuseport_map")) return -1; err = bpf_map_lookup_elem(reuseport_map_fd, &i, &value); if (!ASSERT_OK(err, "bpf_map_lookup_elem - reuseport_map")) return -1; err = bpf_map_update_elem(migrate_map_fd, &value, &migrated_to, BPF_NOEXIST); if (!ASSERT_OK(err, "bpf_map_update_elem - migrate_map")) return -1; } return 0; } static int migrate_dance(struct migrate_reuseport_test_case *test_case) { int i, err; /* Migrate TCP_ESTABLISHED and TCP_SYN_RECV requests * to the last listener based on eBPF. */ for (i = 0; i < MIGRATED_TO; i++) { err = shutdown(test_case->servers[i], SHUT_RDWR); if (!ASSERT_OK(err, "shutdown")) return -1; } /* No dance for TCP_NEW_SYN_RECV to migrate based on eBPF */ if (test_case->state == BPF_TCP_NEW_SYN_RECV) return 0; /* Note that we use the second listener instead of the * first one here. * * The fist listener is bind()ed with port 0 and, * SOCK_BINDPORT_LOCK is not set to sk_userlocks, so * calling listen() again will bind() the first listener * on a new ephemeral port and detach it from the existing * reuseport group. (See: __inet_bind(), tcp_set_state()) * * OTOH, the second one is bind()ed with a specific port, * and SOCK_BINDPORT_LOCK is set. Thus, re-listen() will * resurrect the listener on the existing reuseport group. */ err = listen(test_case->servers[1], QLEN); if (!ASSERT_OK(err, "listen")) return -1; /* Migrate from the last listener to the second one. * * All listeners were detached out of the reuseport_map, * so migration will be done by kernel random pick from here. */ err = shutdown(test_case->servers[MIGRATED_TO], SHUT_RDWR); if (!ASSERT_OK(err, "shutdown")) return -1; /* Back to the existing reuseport group */ err = listen(test_case->servers[MIGRATED_TO], QLEN); if (!ASSERT_OK(err, "listen")) return -1; /* Migrate back to the last one from the second one */ err = shutdown(test_case->servers[1], SHUT_RDWR); if (!ASSERT_OK(err, "shutdown")) return -1; return 0; } static void count_requests(struct migrate_reuseport_test_case *test_case, struct test_migrate_reuseport *skel) { struct sockaddr_storage addr; socklen_t len = sizeof(addr); int err, cnt = 0, client; char buf[MSGLEN]; err = settimeo(test_case->servers[MIGRATED_TO], 4000); if (!ASSERT_OK(err, "settimeo")) goto out; for (; cnt < NR_CLIENTS; cnt++) { client = accept(test_case->servers[MIGRATED_TO], (struct sockaddr *)&addr, &len); if (!ASSERT_NEQ(client, -1, "accept")) goto out; memset(buf, 0, MSGLEN); read(client, &buf, MSGLEN); close(client); if (!ASSERT_STREQ(buf, MSG, "read")) goto out; } out: ASSERT_EQ(cnt, NR_CLIENTS, "count in userspace"); switch (test_case->state) { case BPF_TCP_ESTABLISHED: cnt = skel->bss->migrated_at_close; break; case BPF_TCP_SYN_RECV: cnt = skel->bss->migrated_at_close_fastopen; break; case BPF_TCP_NEW_SYN_RECV: if (test_case->expire_synack_timer) cnt = skel->bss->migrated_at_send_synack; else cnt = skel->bss->migrated_at_recv_ack; break; default: cnt = 0; } ASSERT_EQ(cnt, NR_CLIENTS, "count in BPF prog"); } static void run_test(struct migrate_reuseport_test_case *test_case, struct test_migrate_reuseport *skel) { int err, saved_len; char buf[16]; skel->bss->migrated_at_close = 0; skel->bss->migrated_at_close_fastopen = 0; skel->bss->migrated_at_send_synack = 0; skel->bss->migrated_at_recv_ack = 0; init_fds(test_case->servers, NR_SERVERS); init_fds(test_case->clients, NR_CLIENTS); if (test_case->fastopen) { memset(buf, 0, sizeof(buf)); err = setup_fastopen(buf, sizeof(buf), &saved_len, false); if (!ASSERT_OK(err, "setup_fastopen - setup")) return; } err = start_servers(test_case, skel); if (!ASSERT_OK(err, "start_servers")) goto close_servers; if (test_case->drop_ack) { /* Drop the final ACK of the 3-way handshake and stick the * in-flight requests on TCP_SYN_RECV or TCP_NEW_SYN_RECV. */ err = drop_ack(test_case, skel); if (!ASSERT_OK(err, "drop_ack")) goto close_servers; } /* Tie requests to the first four listners */ err = start_clients(test_case); if (!ASSERT_OK(err, "start_clients")) goto close_clients; err = listen(test_case->servers[MIGRATED_TO], QLEN); if (!ASSERT_OK(err, "listen")) goto close_clients; err = update_maps(test_case, skel); if (!ASSERT_OK(err, "fill_maps")) goto close_clients; /* Migrate the requests in the accept queue only. * TCP_NEW_SYN_RECV requests are not migrated at this point. */ err = migrate_dance(test_case); if (!ASSERT_OK(err, "migrate_dance")) goto close_clients; if (test_case->expire_synack_timer) { /* Wait for SYN+ACK timers to expire so that * reqsk_timer_handler() migrates TCP_NEW_SYN_RECV requests. */ sleep(1); } if (test_case->link) { /* Resume 3WHS and migrate TCP_NEW_SYN_RECV requests */ err = pass_ack(test_case); if (!ASSERT_OK(err, "pass_ack")) goto close_clients; } count_requests(test_case, skel); close_clients: close_fds(test_case->clients, NR_CLIENTS); if (test_case->link) { err = pass_ack(test_case); ASSERT_OK(err, "pass_ack - clean up"); } close_servers: close_fds(test_case->servers, NR_SERVERS); if (test_case->fastopen) { err = setup_fastopen(buf, sizeof(buf), &saved_len, true); ASSERT_OK(err, "setup_fastopen - restore"); } } void serial_test_migrate_reuseport(void) { struct test_migrate_reuseport *skel; int i; skel = test_migrate_reuseport__open_and_load(); if (!ASSERT_OK_PTR(skel, "open_and_load")) return; for (i = 0; i < ARRAY_SIZE(test_cases); i++) { test__start_subtest(test_cases[i].name); run_test(&test_cases[i], skel); } test_migrate_reuseport__destroy(skel); }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
You can’t perform that action at this time.