@ -175,7 +175,10 @@ static void print_routing_table(struct UTUN_INSTANCE* inst, const char* name) {
// Check if specific learned route exists
static int check_learned_route ( struct UTUN_INSTANCE * inst , uint32_t network ,
uint8_t prefix_len , uint64_t expected_node_id ) {
if ( ! inst | | ! inst - > rt ) return 0 ;
if ( ! inst | | ! inst - > rt ) {
DEBUG_ERROR ( DEBUG_CATEGORY_ROUTING , " check_learned_route: no instance or rt " ) ;
return 0 ;
}
for ( size_t i = 0 ; i < inst - > rt - > count ; i + + ) {
struct ROUTE_ENTRY * entry = & inst - > rt - > entries [ i ] ;
@ -202,14 +205,14 @@ static int verify_bgp_exchange(void) {
// Check server learned client's routes (192.168.20.0/24, 192.168.21.0/24)
DEBUG_INFO ( DEBUG_CATEGORY_ROUTING , " Checking server learned client's routes... " ) ;
if ( ! check_learned_route ( server_instance , 0xC0A81400 , 24 , 0x2222222222222222ULL ) ) {
if ( ! check_learned_route ( server_instance , htonl ( 0xC0A81400 ) , 24 , 0x2222222222222222ULL ) ) {
DEBUG_ERROR ( DEBUG_CATEGORY_ROUTING , " FAIL: Server missing learned route 192.168.20.0/24 " ) ;
success = 0 ;
} else {
DEBUG_INFO ( DEBUG_CATEGORY_ROUTING , " PASS: Server has learned route 192.168.20.0/24 " ) ;
}
if ( ! check_learned_route ( server_instance , 0xC0A81500 , 24 , 0x2222222222222222ULL ) ) {
if ( ! check_learned_route ( server_instance , htonl ( 0xC0A81500 ) , 24 , 0x2222222222222222ULL ) ) {
DEBUG_ERROR ( DEBUG_CATEGORY_ROUTING , " FAIL: Server missing learned route 192.168.21.0/24 " ) ;
success = 0 ;
} else {
@ -361,14 +364,11 @@ int main() {
monitor_timeout_id = uasync_set_timeout ( ua , 100 , NULL , monitor_connections ) ;
test_timeout_id = uasync_set_timeout ( ua , TEST_TIMEOUT_MS , NULL , test_timeout ) ;
// Main event loop
// Main event loop - use uasync timers only, no artificial timing
DEBUG_INFO ( DEBUG_CATEGORY_ETCP , " Running event loop... " ) ;
int elapsed = 0 ;
int poll_interval = 5 ;
while ( test_phase < 3 & & elapsed < TEST_TIMEOUT_MS ) {
uasync_poll ( ua , poll_interval ) ;
elapsed + = poll_interval ;
while ( test_phase < 3 ) {
uasync_poll ( ua , - 1 ) ; // Wait indefinitely for events/timeouts
}
// Cleanup