Added extensive debug logging using DEBUG_* macros to both ETCP and loadbalancer modules: ETCP Module Debug Output: - Connection creation/destruction with detailed state tracking - Packet transmission/reception with ID, size, and timestamp details - ACK processing with individual ACK entry tracking - Retransmission request processing with gap detection - RTT calculation and jitter analysis with history tracking - Payload processing with duplicate detection - Measurement sections (MEAS_TS, MEAS_RESP) handling - Timer operations (retransmission, ACK scheduling) - Memory management (allocation/free operations) - Gap detection and contiguous packet delivery - Bandwidth updates and link state changes Loadbalancer Module Debug Output: - Link selection algorithm with timing calculations - Bandwidth-based load balancing decisions - Connection initialization and timeout handling - Link activity tracking and scheduling - Bandwidth measurement processing Debug Levels Available: - TRACE: Function entry/exit, packet-level details - DEBUG: Operational flow, state changes - INFO: Important events, connections, errors - WARN: Warning conditions - ERROR: Error conditions Usage examples: - ./src/utun -d 'etcp:trace' # Maximum ETCP detail - ./src/utun -d 'etcp:debug,loadbalancer:debug' # Both modules - ./src/utun -d 'all:debug' # Everything debug level This comprehensive debug output will help trace all ETCP protocol operations, packet flows, timing calculations, load balancing decisions, and state changes for thorough debugging and development of the new modules.
70 lines
2.5 KiB
Bash
Executable File
70 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Test script to demonstrate ETCP debug output
|
|
|
|
echo "=== Testing ETCP Debug Output ==="
|
|
echo "This script demonstrates the comprehensive debug output added to ETCP and loadbalancer modules"
|
|
echo ""
|
|
|
|
echo "1. Testing with ETCP debug output enabled:"
|
|
echo " Command: ./src/utun -d 'etcp:debug' --help"
|
|
echo ""
|
|
|
|
# Create a minimal config for testing
|
|
cat > test_debug.conf << EOF
|
|
[instance]
|
|
node_id = 0x1122334455667788
|
|
priv_key = 67b705a92b41bcaae105af2d6a17743faa7b26ccebba8b3b9b0af05e9cd1d5fb
|
|
pub_key = 1c55e4ccae7c4470707759086738b10681bf88b81f198cc2ab54a647d1556e17c65e6b1833e0c771e5a39382c03067c388915a4c732191bc130480f20f8e00b9
|
|
|
|
[tun]
|
|
ip = 10.0.0.1
|
|
port = 1234
|
|
|
|
[peer]
|
|
node_id = 0x8877665544332211
|
|
ip = 127.0.0.1
|
|
port = 1235
|
|
pub_key = 1c55e4ccae7c4470707759086738b10681bf88b81f198cc2ab54a647d1556e17c65e6b1833e0c771e5a39382c03067c388915a4c732191bc130480f20f8e00b9
|
|
EOF
|
|
|
|
echo "2. Configuration file created for testing"
|
|
echo ""
|
|
|
|
echo "3. Available debug levels:"
|
|
echo " - etcp:trace - Most detailed output (function entry/exit, packet details)"
|
|
echo " - etcp:debug - Detailed operational info (packet processing, state changes)"
|
|
echo " - etcp:info - Important events (connections, errors)"
|
|
echo " - etcp:warn - Warnings only"
|
|
echo " - etcp:error - Errors only"
|
|
echo ""
|
|
|
|
echo "4. Example debug configurations:"
|
|
echo " -d 'etcp:trace' # Maximum ETCP detail"
|
|
echo " -d 'etcp:debug,loadbalancer:debug' # ETCP + loadbalancer detail"
|
|
echo " -d 'etcp:info,timing:debug' # ETCP info + timing detail"
|
|
echo " -d 'all:debug' # Everything at debug level"
|
|
echo ""
|
|
|
|
echo "5. Key debug areas covered:"
|
|
echo " ✓ Connection creation/destruction"
|
|
echo " ✓ Packet transmission and reception"
|
|
echo " ✓ ACK processing and retransmission"
|
|
echo " ✓ RTT calculation and jitter analysis"
|
|
echo " ✓ Load balancer link selection"
|
|
echo " ✓ Bandwidth measurement and updates"
|
|
echo " ✓ Gap detection and packet delivery"
|
|
echo " ✓ Timer operations (retransmission, ACK)"
|
|
echo " ✓ Memory management (allocation/free)"
|
|
echo ""
|
|
|
|
echo "6. To see debug output in action, run:"
|
|
echo " ./src/utun -c test_debug.conf -d 'etcp:trace,loadbalancer:trace' -f"
|
|
echo ""
|
|
|
|
echo "=== Debug Output Summary ==="
|
|
echo "The ETCP and loadbalancer modules now have comprehensive debug output using the DEBUG_* macros."
|
|
echo "This will help you trace every operation, packet flow, timing calculation, and state change."
|
|
echo ""
|
|
|
|
# Clean up
|
|
rm -f test_debug.conf |