1
This commit is contained in:
1 parent
66ebeeab0e
commit
9ba09cae96
2 files changed
+5
-1
No files matched your search
+3
-1
@@ -167,7 +167,8 @@ bool route_insert(struct ROUTE_TABLE *table, struct NODEINFO_Q *node) {
|
||||
// === Проверка пересечений ===
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
uint32_t network;
|
||||
memcpy(&network, subnets[i].addr, 4); // addr уже в network byte order (big-endian)
|
||||
memcpy(&network, subnets[i].addr, 4);
|
||||
network = ntohl(network);
|
||||
uint8_t prefix = subnets[i].prefix_length;
|
||||
|
||||
if (check_route_overlap_in_table(network, prefix,
|
||||
@@ -195,6 +196,7 @@ bool route_insert(struct ROUTE_TABLE *table, struct NODEINFO_Q *node) {
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
uint32_t network;
|
||||
memcpy(&network, subnets[i].addr, 4);
|
||||
network = ntohl(network);
|
||||
uint8_t prefix_length = subnets[i].prefix_length;
|
||||
|
||||
int pos = binary_search_insert_pos(table->entries, table->count, network, prefix_length);
|
||||
|
||||
@@ -110,4 +110,6 @@ void route_table_print(const struct ROUTE_TABLE *table);
|
||||
*/
|
||||
int parse_subnet(const char *subnet_str, uint32_t *network, uint8_t *prefix_length);
|
||||
|
||||
bool route_add_local_subnet(struct ROUTE_TABLE *table, uint32_t network, uint8_t prefix_length);
|
||||
|
||||
#endif // ROUTE_LIB_H
|
||||
Reference in new issue
Block a user