1
This commit is contained in:
1 parent
25b7587c89
commit
66ebeeab0e
2 files changed
+4
-5
No files matched your search
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user