Expose transport topology in BGP route exchange failures
This commit is contained in:
1 parent
5403647aee
commit
ac264c254c
1 file changed
+28
-1
@@ -256,9 +256,35 @@ static void fail(const char* msg) {
|
||||
test_phase = 2;
|
||||
}
|
||||
|
||||
/* Снимок фактической топологии без packet-level лога: показывает, что именно пережило разрыв пары. */
|
||||
static void log_transport_snapshot(const char* stage) {
|
||||
struct UTUN_INSTANCE* nodes[] = {inst_a, inst_b, inst_c};
|
||||
for (unsigned i = 0; i < 3; i++) {
|
||||
struct UTUN_INSTANCE* inst = nodes[i];
|
||||
if (!inst) continue;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "BGP fixture stage=%s node=%c now_tb=%llu route_A=%d route_C=%d",
|
||||
stage, 'A' + i, (unsigned long long)get_time_tb(),
|
||||
check_learned_route(inst, ntohl(inet_addr("192.168.10.0")), 24, g_node_id_a),
|
||||
check_learned_route(inst, ntohl(inet_addr("192.168.30.0")), 24, g_node_id_c));
|
||||
for (struct ll_entry* e = inst->connections ? inst->connections->head : NULL; e; e = e->next) {
|
||||
struct ETCP_CONN* conn = ((struct conn_queue_entry*)e->data)->conn;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "BGP fixture conn node=%c peer=%016llx initialized=%u up=%u closing=%u",
|
||||
'A' + i, (unsigned long long)conn->peer_node_id, conn->initialized, conn->links_up, conn->close_requested);
|
||||
for (struct ETCP_LINK* l = conn->links; l; l = l->next)
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "BGP fixture link=%p id=%u tcp=%u server=%u port=%u init=%u up=%u "
|
||||
"recv=%u remote=%u last_rx_tb=%llu deadline_tb=%llu timer=%u hook=%u loss_ab=%u loss_bc=%u",
|
||||
(void*)l, l->local_link_id, l->is_tcp, l->is_server, ss_get_port(&l->remote_addr), l->initialized,
|
||||
l->link_status, l->recv_keepalive, l->remote_keepalive, (unsigned long long)l->last_recv_local_time,
|
||||
(unsigned long long)l->rx_deadline_tb, l->rx_timeout_timer != NULL, l->send_hook != NULL,
|
||||
l->send_hook_ctx == &loss_ab, l->send_hook_ctx == &loss_bc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define PHASE(name) do { \
|
||||
if (test_phase != 0) break; \
|
||||
DEBUG_INFO(DEBUG_CATEGORY_BGP, "=== PHASE: %s ===", name); \
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "=== PHASE: %s ===", name); \
|
||||
log_transport_snapshot(name); \
|
||||
} while(0)
|
||||
|
||||
#define ASSERT(cond, msg) do { if (!(cond)) { fail(msg); return -1; } } while(0)
|
||||
@@ -269,6 +295,7 @@ static int wait_for(const char* desc, int (*cond)(void), int timeout_tb) {
|
||||
while (!cond() && (get_time_tb() - start) < (uint64_t)timeout_tb && test_phase == 0)
|
||||
test_clock_poll(ua, POLL_INTERVAL_MS);
|
||||
if (!cond() && test_phase == 0) {
|
||||
log_transport_snapshot(desc);
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_BGP, "timeout waiting for: %s", desc);
|
||||
test_phase = 2;
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user