-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup_generic.sh
More file actions
executable file
·50 lines (42 loc) · 1.49 KB
/
cleanup_generic.sh
File metadata and controls
executable file
·50 lines (42 loc) · 1.49 KB
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
#!/bin/bash
set -e
if ! sysctl net.ipv4.tcp_available_congestion_control | grep -q "ebpf_ccp_gen"; then
echo "ebpf_ccp_gen not registered - nothing to clean up"
exit 0
fi
echo "Attempting to cleanup"
DAEMON_PID=$(pgrep -f "ebpf-ccp-generic" || true)
if [ -n "$DAEMON_PID" ]; then
echo "Stopping running PID: $DAEMON_PID)"
kill -TERM "$DAEMON_PID" 2>/dev/null || true
sudo bpftool struct_ops unregister name ebpf_ccp_gen
for i in {1..10}; do
if ! kill -0 "$DAEMON_PID" 2>/dev/null; then
echo "Shutting down daemon"
break
fi
sleep 0.5
done
if kill -0 "$DAEMON_PID" 2>/dev/null; then
echo "Forcing daemon shutdown"
kill -9 "$DAEMON_PID" 2>/dev/null || true
fi
fi
sleep 10
if sysctl net.ipv4.tcp_available_congestion_control | grep -q "ebpf_ccp_gen"; then
echo "ebpf_ccp_gen is still registered after daemon shutdown"
echo "This can happen if the struct_ops link was not properly detached"
echo ""
echo "To fix this, you may need to:"
echo " 1. Unload any manually pinned BPF objects: rm -f /sys/fs/bpf/ebpf_ccp*"
echo " 2. Check for orphaned BPF programs: bpftool prog show"
echo " 3. Reboot VM if the issue persists"
echo ""
echo "Current TCP CCA status:"
sysctl net.ipv4.tcp_available_congestion_control
exit 1
else
echo "Cleanup successful - ebpf_cubic has been unregistered"
echo "Current available CCAs:"
sysctl net.ipv4.tcp_available_congestion_control
fi