Browse Source

1

nodeinfo-routing-update
jeka 3 weeks ago
parent
commit
b605219a87
  1. 2
      src/route_lib.c
  2. 15
      src/routing.c

2
src/route_lib.c

@ -686,7 +686,7 @@ struct ROUTE_ENTRY* route_lookup(struct ROUTE_TABLE *table, uint32_t dest_ip) {
if (result) {
table->stats.routes_lookup_hits++;
DEBUG_INFO(DEBUG_CATEGORY_ROUTING, "route_lookup: FOUND %s/%d node_id=%016llx",
DEBUG_TRACE(DEBUG_CATEGORY_ROUTING, "route_lookup: FOUND %s/%d node_id=%016llx",
ip_to_string(result->network).a, result->prefix_length,
result->conn_list ? (unsigned long long)result->conn_list->node_id : 0);
} else {

15
src/routing.c

@ -39,7 +39,7 @@ static uint32_t extract_dst_ip(uint8_t* data, size_t len) {
}
if (version != IPv4_VERSION) {
DEBUG_TRACE(DEBUG_CATEGORY_ROUTING, "Unknown IP version: %d", version);
DEBUG_WARN(DEBUG_CATEGORY_ROUTING, "Unknown IP version: %d", version);
return 0;
}
@ -100,8 +100,8 @@ static void route_pkt(struct UTUN_INSTANCE* instance, struct ll_entry* entry, ui
// Extract destination IP
uint32_t dst_ip = extract_dst_ip(ip_data, ip_len);
if (dst_ip == 0) {
DEBUG_WARN(DEBUG_CATEGORY_ROUTING, "route_pkt: failed to extract dst IP: len=%zu first_byte=0x%02x, dropping",
ip_len, ip_data ? ip_data[0] : 0);
// DEBUG_WARN(DEBUG_CATEGORY_ROUTING, "route_pkt: failed to extract dst IP: len=%zu first_byte=0x%02x, dropping",
// ip_len, ip_data ? ip_data[0] : 0);
queue_entry_free(entry);
queue_dgram_free(entry);
return;
@ -169,16 +169,11 @@ static void route_pkt(struct UTUN_INSTANCE* instance, struct ll_entry* entry, ui
}
}
// TRAFFIC LOGGING
// INFO: Show packet path (src node ID -> dst node ID)
// DEBUG: Show packet dump
// DEBUG_TRACE(DEBUG_CATEGORY_ROUTING, "##########");
if (debug_should_output(DEBUG_LEVEL_DEBUG, DEBUG_CATEGORY_TRAFFIC)) {
char* packet_str = dump_ip_packet_to_buffer(ip_data, ip_len);
DEBUG_DEBUG(DEBUG_CATEGORY_TRAFFIC, "PACKET_DUMP: %s", packet_str);
DEBUG_DEBUG(DEBUG_CATEGORY_TRAFFIC, "DUMP: %s", packet_str);
}
DEBUG_INFO(DEBUG_CATEGORY_TRAFFIC, "NODE %016llx -> NODE %016llx",
(unsigned long long)src_node_id, (unsigned long long)dst_node_id);
else DEBUG_INFO(DEBUG_CATEGORY_TRAFFIC, "NODE %016llx -> NODE %016llx", (unsigned long long)src_node_id, (unsigned long long)dst_node_id);
if (route->conn_list == NULL) {
// Local route - send to TUN (entry has [cmd=0][IP data], TUN skips cmd byte)

Loading…
Cancel
Save