From 66ebeeab0e5ece2443dc4feb46fef6570a5b0256 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Mon, 30 Mar 2026 19:28:34 +0300 Subject: [PATCH] 1 --- src/route_bgp.c | 2 +- src/route_lib.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/route_bgp.c b/src/route_bgp.c index 0930f25e4..e407139af 100644 --- a/src/route_bgp.c +++ b/src/route_bgp.c @@ -551,7 +551,7 @@ int route_bgp_process_nodeinfo(struct ROUTE_BGP* bgp, struct ETCP_CONN* from, memcpy(hop_dest, &sender, 8); existing->node.hop_count = ni->hop_count + 1; - if (ni->hop_count > 0) { + if (ni->hop_count >= 0) { route_bgp_add_path(existing, from, (uint64_t*)hop_dest, existing->node.hop_count); } diff --git a/src/route_lib.c b/src/route_lib.c index ac1ed5f02..e3efb758a 100644 --- a/src/route_lib.c +++ b/src/route_lib.c @@ -207,10 +207,10 @@ bool route_insert(struct ROUTE_TABLE *table, struct NODEINFO_Q *node) { struct ROUTE_ENTRY *e = &table->entries[pos]; e->network = network; e->prefix_length = prefix_length; - e->v_node_info = node; // все префиксы узла ссылаются на один объект + e->v_node_info = node; table->count++; - table->stats.learned_routes++; + if (node && node->node.hop_count == 0) table->stats.local_routes++; else table->stats.learned_routes++; } DEBUG_INFO(DEBUG_CATEGORY_ROUTING, "route_insert: added %zu route(s) for node_info=%p", @@ -227,13 +227,12 @@ void route_delete(struct ROUTE_TABLE *table, struct NODEINFO_Q *node) { size_t removed = 0; while (i < table->count) { if (table->entries[i].v_node_info == node) { - // v_node_info — внешний, не освобождаем if (i < table->count - 1) { memmove(&table->entries[i], &table->entries[i + 1], (table->count - i - 1) * sizeof(struct ROUTE_ENTRY)); } table->count--; - table->stats.learned_routes--; + if (node && node->node.hop_count == 0) table->stats.local_routes--; else table->stats.learned_routes--; removed++; continue; }