You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

226 lines
18 KiB

=== BGP Route Exchange Test ===
[03:30:18-689.090] [INFO] [8] (test_bgp_route_exchange.c:321) main() Creating server instance...
[CONFIG DEBUG] Opening config file: /tmp/utun_bgp_test_bQPBmS/server.conf
[CONFIG DEBUG] Successfully opened config file
[CONFIG DEBUG] Checking config - priv_key='67b705a92b41bcaae105af2d6a17743faa7b26ccebba8b3b9b0af05e9cd1d5fb' (len=64), pub_key='1c55e4ccae7c4470707759086738b10681bf88b81f198cc2ab54a647d1556e17c65e6b1833e0c771e5a39382c03067c388915a4c732191bc130480f20f8e00b9' (len=128), node_id=1229782938247303441
[CONFIG DEBUG] Validation results - need_priv_key=0, need_pub_key=0, need_node_id=0
[CONFIG DEBUG] Opening config file: /tmp/utun_bgp_test_bQPBmS/server.conf
[CONFIG DEBUG] Successfully opened config file
[03:30:18-689.205] [INFO] [512] (routing.c:272) routing_create() Routing module initialized for instance
[03:30:18-689.211] [INFO] [512] (utun_instance.c:91) utun_instance_create() Routing module created
[03:30:18-689.216] [INFO] [512] (route_lib.c:379) route_table_insert() Route inserted: 0.11.168.192/24 (LOCAL)
[03:30:18-689.220] [INFO] [512] (utun_instance.c:110) utun_instance_create() Added local route: 192.168.11.0/24
[03:30:18-689.223] [INFO] [512] (route_lib.c:379) route_table_insert() Route inserted: 0.10.168.192/24 (LOCAL)
[03:30:18-689.227] [INFO] [512] (utun_instance.c:110) utun_instance_create() Added local route: 192.168.10.0/24
[03:30:18-689.230] [INFO] [4096] (route_bgp.c:382) route_bgp_init() Route change callback registered
[03:30:18-689.234] [INFO] [4096] (route_bgp.c:385) route_bgp_init() BGP module initialized
[03:30:18-689.237] [INFO] [4096] (utun_instance.c:143) utun_instance_create() BGP module initialized
DEBUG: utun_instance_init() calling init_connections() for instance 0x5f1c9066ccd0
[03:30:18-689.260] [INFO] [8] (etcp_connections.c:342) etcp_socket_add() [ETCP] Successfully bound socket to local address, family=2
[03:30:18-689.266] [INFO] [8] (etcp_connections.c:366) etcp_socket_add() [ETCP] Socket 0x5f1c9066e530 registered and active
DEBUG: init_connections() returned: 0
DEBUG: Connections initialized successfully, count=0
[03:30:18-689.273] [INFO] [8] (test_bgp_route_exchange.c:335) main() Server instance ready (node_id=1111111111111111, bgp=0x5f1c9066cc90)
[03:30:18-689.276] [INFO] [8] (test_bgp_route_exchange.c:339) main() Creating client instance...
[CONFIG DEBUG] Opening config file: /tmp/utun_bgp_test_bQPBmS/client.conf
[CONFIG DEBUG] Successfully opened config file
[CONFIG DEBUG] Checking config - priv_key='4813d31d28b7e9829247f488c6be7672f2bdf61b2508333128e386d1759afed2' (len=64), pub_key='c594f33c91f3a2222795c2c110c527bf214ad1009197ce14556cb13df3c461b3c373bed8f205a8dd1fc0c364f90bf471d7c6f5db49564c33e4235d268569ac71' (len=128), node_id=2459565876494606882
[CONFIG DEBUG] Validation results - need_priv_key=0, need_pub_key=0, need_node_id=0
[CONFIG DEBUG] Opening config file: /tmp/utun_bgp_test_bQPBmS/client.conf
[CONFIG DEBUG] Successfully opened config file
[03:30:18-689.344] [INFO] [512] (routing.c:272) routing_create() Routing module initialized for instance
[03:30:18-689.351] [INFO] [512] (utun_instance.c:91) utun_instance_create() Routing module created
[03:30:18-689.354] [INFO] [512] (route_lib.c:379) route_table_insert() Route inserted: 0.21.168.192/24 (LOCAL)
[03:30:18-689.358] [INFO] [512] (utun_instance.c:110) utun_instance_create() Added local route: 192.168.21.0/24
[03:30:18-689.361] [INFO] [512] (route_lib.c:379) route_table_insert() Route inserted: 0.20.168.192/24 (LOCAL)
[03:30:18-689.365] [INFO] [512] (utun_instance.c:110) utun_instance_create() Added local route: 192.168.20.0/24
[03:30:18-689.368] [INFO] [4096] (route_bgp.c:382) route_bgp_init() Route change callback registered
[03:30:18-689.372] [INFO] [4096] (route_bgp.c:385) route_bgp_init() BGP module initialized
[03:30:18-689.378] [INFO] [4096] (utun_instance.c:143) utun_instance_create() BGP module initialized
DEBUG: utun_instance_init() calling init_connections() for instance 0x5f1c906714f0
[03:30:18-689.395] [INFO] [8] (etcp_connections.c:342) etcp_socket_add() [ETCP] Successfully bound socket to local address, family=2
[03:30:18-689.408] [INFO] [8] (etcp_connections.c:366) etcp_socket_add() [ETCP] Socket 0x5f1c906728a0 registered and active
[03:30:18-689.823] [INFO] [8] (etcp_connections.c:90) etcp_link_send_init() [ETCP] INIT sending to 127.0.0.1:39011, link=0x5f1c9068a8f0
[03:30:18-689.830] [INFO] [8] (etcp_connections.c:487) etcp_encrypt_send() Encrypt start
[03:30:18-693.237] [INFO] [8] (etcp_connections.c:489) etcp_encrypt_send() Encrypt end
DEBUG: init_connections() returned: 0
DEBUG: Connections initialized successfully, count=1
[03:30:18-693.628] [INFO] [8] (test_bgp_route_exchange.c:353) main() Client instance ready (node_id=2222222222222222, bgp=0x5f1c9066f060)
[03:30:18-693.636] [INFO] [8] (test_bgp_route_exchange.c:357) main() Waiting for server initialization...
[03:30:18-693.739] [INFO] [8] (etcp_connections.c:671) etcp_connections_read_callback_socket() [ETCP DEBUG] Send INIT RESPONSE
[03:30:18-693.745] [INFO] [8] (etcp_connections.c:487) etcp_encrypt_send() Encrypt start
[03:30:18-693.751] [INFO] [8] (etcp_connections.c:489) etcp_encrypt_send() Encrypt end
[03:30:18-693.763] [INFO] [8] (etcp_loadbalancer.c:156) loadbalancer_link_ready() loadbalancer_link_ready: link=0x5f1c906b9520 now ready, notifying ETCP_CONN
[03:30:18-693.769] [INFO] [4096] (route_bgp.c:452) route_bgp_new_conn() Added connection 0x5f1c906ba2a0 to senders_list
[03:30:18-693.773] [INFO] [4096] (route_bgp.c:338) route_bgp_send_table_to_conn_internal() Sending full routing table (2 routes) to connection
[03:30:18-693.783] [INFO] [8] (etcp_connections.c:687) etcp_connections_read_callback_socket() Decrypt start
[03:30:18-693.789] [INFO] [8] (etcp_connections.c:696) etcp_connections_read_callback_socket() Decrypt end
[03:30:18-693.793] [INFO] [8] (etcp_loadbalancer.c:156) loadbalancer_link_ready() loadbalancer_link_ready: link=0x5f1c9068a8f0 now ready, notifying ETCP_CONN
[03:30:18-693.797] [INFO] [4096] (route_bgp.c:452) route_bgp_new_conn() Added connection 0x5f1c90673040 to senders_list
[03:30:18-693.800] [INFO] [4096] (route_bgp.c:338) route_bgp_send_table_to_conn_internal() Sending full routing table (2 routes) to connection
[03:30:18-695.449] [INFO] [8] (etcp_connections.c:487) etcp_encrypt_send() Encrypt start
[03:30:18-695.476] [INFO] [8] (etcp_connections.c:489) etcp_encrypt_send() Encrypt end
[03:30:18-695.542] [INFO] [8] (etcp_connections.c:687) etcp_connections_read_callback_socket() Decrypt start
[03:30:18-695.581] [INFO] [8] (etcp_connections.c:696) etcp_connections_read_callback_socket() Decrypt end
[03:30:18-695.633] [INFO] [4096] (route_bgp.c:67) route_bgp_receive_cbk() Received BGP packet: subcmd=1, network=000ba8c0/24, node_id=1111111111111111
[03:30:18-695.665] [INFO] [512] (route_lib.c:379) route_table_insert() Route inserted: 0.11.168.192/24 (LEARNED)
[03:30:18-695.677] [INFO] [4096] (route_bgp.c:101) route_bgp_receive_cbk() Added learned route: 000ba8c0/24 via node 1111111111111111 (hops=1)
[03:30:18-695.686] [INFO] [4096] (route_bgp.c:67) route_bgp_receive_cbk() Received BGP packet: subcmd=1, network=000aa8c0/24, node_id=1111111111111111
[03:30:18-695.691] [INFO] [512] (route_lib.c:379) route_table_insert() Route inserted: 0.10.168.192/24 (LEARNED)
[03:30:18-695.695] [INFO] [4096] (route_bgp.c:101) route_bgp_receive_cbk() Added learned route: 000aa8c0/24 via node 1111111111111111 (hops=1)
[03:30:18-695.706] [INFO] [8] (etcp_connections.c:487) etcp_encrypt_send() Encrypt start
[03:30:18-695.725] [INFO] [8] (etcp_connections.c:489) etcp_encrypt_send() Encrypt end
[03:30:18-695.761] [INFO] [8] (etcp_connections.c:687) etcp_connections_read_callback_socket() Decrypt start
[03:30:18-695.767] [INFO] [8] (etcp_connections.c:696) etcp_connections_read_callback_socket() Decrypt end
[03:30:18-695.771] [INFO] [4096] (route_bgp.c:67) route_bgp_receive_cbk() Received BGP packet: subcmd=1, network=0015a8c0/24, node_id=2222222222222222
[03:30:18-695.776] [INFO] [512] (route_lib.c:379) route_table_insert() Route inserted: 0.21.168.192/24 (LEARNED)
[03:30:18-695.779] [INFO] [4096] (route_bgp.c:101) route_bgp_receive_cbk() Added learned route: 0015a8c0/24 via node 2222222222222222 (hops=1)
[03:30:18-695.796] [INFO] [4096] (route_bgp.c:67) route_bgp_receive_cbk() Received BGP packet: subcmd=1, network=0014a8c0/24, node_id=2222222222222222
[03:30:18-695.800] [INFO] [512] (route_lib.c:379) route_table_insert() Route inserted: 0.20.168.192/24 (LEARNED)
[03:30:18-695.803] [INFO] [4096] (route_bgp.c:101) route_bgp_receive_cbk() Added learned route: 0014a8c0/24 via node 2222222222222222 (hops=1)
[03:30:18-697.934] [INFO] [8] (etcp_connections.c:487) etcp_encrypt_send() Encrypt start
[03:30:18-697.961] [INFO] [8] (etcp_connections.c:489) etcp_encrypt_send() Encrypt end
[03:30:18-697.986] [INFO] [8] (etcp_connections.c:687) etcp_connections_read_callback_socket() Decrypt start
[03:30:18-697.992] [INFO] [8] (etcp_connections.c:696) etcp_connections_read_callback_socket() Decrypt end
[03:30:18-746.275] [INFO] [8] (test_bgp_route_exchange.c:363) main() Starting connection monitoring...
[03:30:18-746.336] [INFO] [8] (test_bgp_route_exchange.c:368) main() Running event loop...
[03:30:18-756.415] [INFO] [8] (test_bgp_route_exchange.c:245) monitor_connections() === Connection established! Waiting for BGP exchange... ===
[03:30:18-776.535] [INFO] [512] (test_bgp_route_exchange.c:255) monitor_connections() === Checking BGP route exchange ===
[03:30:18-776.576] [INFO] [512] (test_bgp_route_exchange.c:199) verify_bgp_exchange()
=== Verifying BGP Route Exchange ===
[03:30:18-776.580] [INFO] [512] (test_bgp_route_exchange.c:150) print_routing_table()
=== SERVER Routing Table (4 routes) ===
[03:30:18-776.585] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 1: 0.11.168.192/24 [LOCAL] node_id=0000000000000000 hops=0
[03:30:18-776.589] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 2: 0.10.168.192/24 [LOCAL] node_id=0000000000000000 hops=0
[03:30:18-776.593] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 3: 0.21.168.192/24 [LEARNED] node_id=2222222222222222 hops=1
[03:30:18-776.596] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 4: 0.20.168.192/24 [LEARNED] node_id=2222222222222222 hops=1
[03:30:18-776.599] [INFO] [512] (test_bgp_route_exchange.c:172) print_routing_table() =====================================
[03:30:18-776.603] [INFO] [512] (test_bgp_route_exchange.c:150) print_routing_table()
=== CLIENT Routing Table (4 routes) ===
[03:30:18-776.606] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 1: 0.21.168.192/24 [LOCAL] node_id=0000000000000000 hops=0
[03:30:18-776.616] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 2: 0.20.168.192/24 [LOCAL] node_id=0000000000000000 hops=0
[03:30:18-776.619] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 3: 0.11.168.192/24 [LEARNED] node_id=1111111111111111 hops=1
[03:30:18-776.623] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 4: 0.10.168.192/24 [LEARNED] node_id=1111111111111111 hops=1
[03:30:18-776.626] [INFO] [512] (test_bgp_route_exchange.c:172) print_routing_table() =====================================
[03:30:18-776.629] [INFO] [512] (test_bgp_route_exchange.c:206) verify_bgp_exchange() Checking server learned client's routes...
[03:30:18-776.632] [INFO] [512] (test_bgp_route_exchange.c:212) verify_bgp_exchange() PASS: Server has learned route 192.168.20.0/24
[03:30:18-776.636] [INFO] [512] (test_bgp_route_exchange.c:219) verify_bgp_exchange() PASS: Server has learned route 192.168.21.0/24
[03:30:18-776.639] [INFO] [512] (test_bgp_route_exchange.c:225) verify_bgp_exchange() Checking client learned server's routes (disabled - server->client not implemented)...
[03:30:18-776.642] [INFO] [512] (test_bgp_route_exchange.c:260) monitor_connections() === BGP ROUTE EXCHANGE SUCCESS ===
[03:30:18-776.645] [INFO] [8] (test_bgp_route_exchange.c:375) main()
Cleaning up...
[03:30:18-776.649] [INFO] [512] (test_bgp_route_exchange.c:150) print_routing_table()
=== SERVER (final) Routing Table (4 routes) ===
[03:30:18-776.664] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 1: 0.11.168.192/24 [LOCAL] node_id=0000000000000000 hops=0
[03:30:18-776.667] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 2: 0.10.168.192/24 [LOCAL] node_id=0000000000000000 hops=0
[03:30:18-776.671] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 3: 0.21.168.192/24 [LEARNED] node_id=2222222222222222 hops=1
[03:30:18-776.674] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 4: 0.20.168.192/24 [LEARNED] node_id=2222222222222222 hops=1
[03:30:18-776.677] [INFO] [512] (test_bgp_route_exchange.c:172) print_routing_table() =====================================
[03:30:18-776.680] [INFO] [512] (test_bgp_route_exchange.c:150) print_routing_table()
=== CLIENT (final) Routing Table (4 routes) ===
[03:30:18-776.684] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 1: 0.21.168.192/24 [LOCAL] node_id=0000000000000000 hops=0
[03:30:18-776.687] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 2: 0.20.168.192/24 [LOCAL] node_id=0000000000000000 hops=0
[03:30:18-776.690] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 3: 0.11.168.192/24 [LEARNED] node_id=1111111111111111 hops=1
[03:30:18-776.694] [INFO] [512] (test_bgp_route_exchange.c:167) print_routing_table() Route 4: 0.10.168.192/24 [LEARNED] node_id=1111111111111111 hops=1
[03:30:18-776.697] [INFO] [512] (test_bgp_route_exchange.c:172) print_routing_table() =====================================
🔍 [UTUN_INSTANCE LEAK DIAGNOSIS] Phase: BEFORE_CLEANUP
Instance: 0x5f1c9066ccd0
Node ID: 1229782938247303441
UA instance: 0x5f1c9066c490
Running: 0
📊 STRUCTURE COUNTS:
ETCP Sockets: 1 active
ETCP Connections: 1 active
ETCP Links: 2 total
🔧 RESOURCE STATUS:
Memory Pool: ALLOCATED
TUN Interface: NULL
TUN FD: -1
Connections list: 0x5f1c906ba2a0
ETCP Sockets list: 0x5f1c9066e530
POTENTIAL LEAKS:
❌ Memory Pool not freed
❌ 1 ETCP sockets still allocated
❌ 1 ETCP connections still allocated
❌ 2 ETCP links still allocated
📋 RECOMMENDATIONS:
→ Call memory_pool_destroy() before freeing instance
→ Iterate and call etcp_socket_remove() for each socket
→ Iterate and call etcp_connection_close() for each connection
[03:30:18-776.704] [INFO] [8] (etcp_connections.c:375) etcp_socket_remove() [ETCP] Removing socket 0x5f1c9066e530, socket_id=0x5f1c9066c540
[03:30:18-776.708] [INFO] [8] (etcp_connections.c:379) etcp_socket_remove() [ETCP] Removing socket from uasync, instance=0x5f1c9066ccd0, ua=0x5f1c9066c490
[03:30:18-776.717] [INFO] [8] (etcp_connections.c:382) etcp_socket_remove() [ETCP] Unregistered socket from uasync
[03:30:18-776.732] [INFO] [8] (etcp_connections.c:387) etcp_socket_remove() [ETCP] Closed socket
[03:30:18-776.736] [INFO] [4096] (route_bgp.c:471) route_bgp_remove_conn() Removing connection 0x5f1c906ba2a0 from senders_list
[03:30:18-776.740] [INFO] [4096] (route_bgp.c:200) route_bgp_send_withdraw_for_conn() Sending withdraw for routes via conn 0x5f1c906ba2a0 to all peers
[03:30:18-776.744] [INFO] [4096] (route_bgp.c:484) route_bgp_remove_conn() Connection 0x5f1c906ba2a0 removed from senders_list
[03:30:18-776.748] [INFO] [512] (route_lib.c:425) route_table_delete() Removed 2 routes for connection 0x5f1c906ba2a0
[03:30:18-776.754] [INFO] [512] (routing.c:281) routing_destroy() Destroying routing module
[03:30:18-776.758] [INFO] [4096] (utun_instance.c:198) utun_instance_destroy() Destroying BGP module
[03:30:18-776.761] [INFO] [4096] (route_bgp.c:418) route_bgp_destroy() BGP module destroyed
🔍 [UTUN_INSTANCE LEAK DIAGNOSIS] Phase: BEFORE_CLEANUP
Instance: 0x5f1c906714f0
Node ID: 2459565876494606882
UA instance: 0x5f1c9066c490
Running: 0
📊 STRUCTURE COUNTS:
ETCP Sockets: 1 active
ETCP Connections: 1 active
ETCP Links: 2 total
🔧 RESOURCE STATUS:
Memory Pool: ALLOCATED
TUN Interface: NULL
TUN FD: -1
Connections list: 0x5f1c90673040
ETCP Sockets list: 0x5f1c906728a0
POTENTIAL LEAKS:
❌ Memory Pool not freed
❌ 1 ETCP sockets still allocated
❌ 1 ETCP connections still allocated
❌ 2 ETCP links still allocated
📋 RECOMMENDATIONS:
→ Call memory_pool_destroy() before freeing instance
→ Iterate and call etcp_socket_remove() for each socket
→ Iterate and call etcp_connection_close() for each connection
[03:30:18-776.767] [INFO] [8] (etcp_connections.c:375) etcp_socket_remove() [ETCP] Removing socket 0x5f1c906728a0, socket_id=0x5f1c9066c588
[03:30:18-776.773] [INFO] [8] (etcp_connections.c:379) etcp_socket_remove() [ETCP] Removing socket from uasync, instance=0x5f1c906714f0, ua=0x5f1c9066c490
[03:30:18-776.778] [INFO] [8] (etcp_connections.c:382) etcp_socket_remove() [ETCP] Unregistered socket from uasync
[03:30:18-776.784] [INFO] [8] (etcp_connections.c:387) etcp_socket_remove() [ETCP] Closed socket
[03:30:18-776.788] [INFO] [4096] (route_bgp.c:471) route_bgp_remove_conn() Removing connection 0x5f1c90673040 from senders_list
[03:30:18-776.791] [INFO] [4096] (route_bgp.c:200) route_bgp_send_withdraw_for_conn() Sending withdraw for routes via conn 0x5f1c90673040 to all peers
[03:30:18-776.794] [INFO] [4096] (route_bgp.c:484) route_bgp_remove_conn() Connection 0x5f1c90673040 removed from senders_list
[03:30:18-776.797] [INFO] [512] (route_lib.c:425) route_table_delete() Removed 2 routes for connection 0x5f1c90673040
[03:30:18-776.805] [INFO] [512] (routing.c:281) routing_destroy() Destroying routing module
[03:30:18-776.810] [INFO] [4096] (utun_instance.c:198) utun_instance_destroy() Destroying BGP module
[03:30:18-776.815] [INFO] [4096] (route_bgp.c:418) route_bgp_destroy() BGP module destroyed
🔍 BEFORE_DESTROY: UASYNC Resource Report for 0x5f1c9066c490
Timer Statistics: allocated=12, freed=9, active=3
Socket Statistics: allocated=2, freed=2, active=0
Timer: node=0x5f1c906b9040, expires=1771115418796 ms, cancelled=0
Timer: node=0x5f1c906b9100, expires=1771115418796 ms, cancelled=0
Active timers in heap: 2
Socket array capacity: 16, active: 0
Total active sockets: 0
🔚 BEFORE_DESTROY: End of resource report
=== TEST PASSED ===
BGP route exchange working (client -> server direction)