From b0f149092f61c5b16e029b214cd03bcd8176a4c5 Mon Sep 17 00:00:00 2001 From: evgeny Date: Fri, 4 Sep 2026 16:45:33 +0300 Subject: [PATCH] BGP: log node add/remove per group at info level --- src/routing_layer/topo_group.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/routing_layer/topo_group.c b/src/routing_layer/topo_group.c index a06b6046..967aaaaa 100644 --- a/src/routing_layer/topo_group.c +++ b/src/routing_layer/topo_group.c @@ -240,6 +240,8 @@ static void topo_group_conn_add_path(struct TOPO_GROUP* group, struct ETCP_CONN* memset((uint8_t*)nq + sizeof(struct ll_entry), 0, sizeof(*nq) - sizeof(struct ll_entry)); nq->node_id = node_id; queue_data_put_with_index(group->nodes, &nq->ll); + DEBUG_INFO(DEBUG_CATEGORY_BGP, "node added to group: node=%016llx grp=%016llx type=%u ch=%s (direct)", + (unsigned long long)node_id, (unsigned long long)group->group_id, group->group_type, group->channel_id); } uint64_t hop[1] = { node_id }; topo_group_add_path(nq, conn, hop, 1, 0); @@ -617,6 +619,8 @@ void topo_group_remove_conn(struct TOPO_GROUP* group, struct ETCP_CONN* conn) { struct ll_entry* entry = node_entry; if (entry) { queue_remove_data(group->nodes, entry); queue_entry_free(entry); } nodes_removed++; + DEBUG_INFO(DEBUG_CATEGORY_BGP, "node removed from group: node=%016llx grp=%016llx type=%u ch=%s (link_down)", + (unsigned long long)key, (unsigned long long)group->group_id, group->group_type, group->channel_id); etcp_router_conn_close_all_for_node(group->instance, group->group_id, key); uint64_t wd_src = (key == conn->peer_node_id) ? conn->instance->node_id : conn->peer_node_id; topo_group_broadcast_withdraw(group, key, wd_src, NULL); @@ -843,6 +847,9 @@ int topo_group_process_nodeinfo(struct TOPO_GROUP* group, struct ETCP_CONN* from nodeinfo1->connectivity.ping_req_time = 0; queue_data_put_with_index(group->nodes, &nodeinfo1->ll); } + if (is_new_node) + DEBUG_INFO(DEBUG_CATEGORY_BGP, "node added to group: node=%016llx grp=%016llx type=%u ch=%s (bgp)", + (unsigned long long)node_id, (unsigned long long)group->group_id, group->group_type, group->channel_id); nodeinfo1->paths = paths; nodeinfo1->last_ver = new_ver; @@ -936,6 +943,8 @@ int topo_group_process_withdraw(struct TOPO_GROUP* group, struct ETCP_CONN* send topo_nodeq_free_group_fields(group->instance->topo_groups, nq); struct ll_entry* entry = queue_find_data_by_index(group->nodes, &node_id); if (entry) { queue_remove_data(group->nodes, entry); queue_entry_free(entry); } + DEBUG_INFO(DEBUG_CATEGORY_BGP, "node removed from group: node=%016llx grp=%016llx type=%u ch=%s (withdraw)", + (unsigned long long)node_id, (unsigned long long)group->group_id, group->group_type, group->channel_id); topo_group_broadcast_withdraw(group, node_id, wd_source, sender); /* BGP не удаляет member-запись: он работает только со своей RAM-таблицей. Удаление из peers_* — только битая подпись при верификации (member_sync). */