Created
March 20, 2025 04:16
-
-
Save keepsimple1/684f1cf337e0a5057fbc4f1c954961ed to your computer and use it in GitHub Desktop.
Shell script to reproduce an issue in mdns-sd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script reproduces the issue at: https://github.com/keepsimple1/mdns-sd/issues/322 | |
# | |
# When the script prints out "Not found", the issue is reproduced. | |
for i in {1..200}; do | |
echo "Iteration $i" | |
# Start your program in the background | |
RUST_LOG=debug cargo run --example register _ip-test._udp instance1 host1 --logfile > output.txt 2>&1 & | |
PROGRAM_PID=$! | |
echo "Started ip-test with PID: $PROGRAM_PID" | |
echo "sleep 20 seconds before creating interface" | |
# Wait for 20 seconds | |
sleep 20 | |
# Create the dummy interface | |
ip link add mydummy type dummy | |
# Assign an IP address (optional) | |
ip addr add 192.168.100.1/24 dev mydummy | |
# Bring the interface up | |
ip link set mydummy up | |
# Verify the interface | |
ip addr show mydummy | |
echo "sleep 35 seconds before deleting interface" | |
sleep 35 | |
# Delete the dummy interface | |
ip link delete mydummy | |
# Confirm deletion | |
ip addr show mydummy | |
MATCHING_LINE=$(grep -E "Announce.*192.168.100.1" output.txt) | |
if [[ -n "$MATCHING_LINE" ]]; then | |
echo "Found: $MATCHING_LINE" | |
else | |
echo "Not found" | |
gdb -p $PROGRAM_PID -batch -ex "thread apply all bt" > stacktrace.txt | |
kill $PROGRAM_PID | |
break | |
fi | |
# Stop the program | |
kill $PROGRAM_PID | |
echo "sleep 2 seconds before next iteration" | |
sleep 2 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment