Browse Source

dump

nodeinfo-routing-update
jeka 4 weeks ago
parent
commit
76555f019b
  1. 2
      lib/debug_config.c
  2. 11
      src/etcp_connections.c
  3. 4
      src/pkt_normalizer.c

2
lib/debug_config.c

@ -29,7 +29,7 @@ void log_dump(const char* prefix, const uint8_t* data, size_t len) {
}
// Single-line debug output with packet info
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "%s: len=%zu hex=%s", prefix, len, hex_buf);
DEBUG_INFO(DEBUG_CATEGORY_DUMP, "%s: len=%zu hex=%s", prefix, len, hex_buf);
// Additional debug info for first few bytes
// if (len >= 2) {

11
src/etcp_connections.c

@ -24,15 +24,6 @@ static void etcp_connections_read_callback_socket(socket_t sock, void* arg);
struct ETCP_CONN* etcp_connection_create(struct UTUN_INSTANCE* instance);
static void etcp_link_remove_from_connections(struct ETCP_SOCKET* conn, struct ETCP_LINK* link);
// Unified packet dump function - uses configured format
static void packet_dump(const char* prefix, const uint8_t* data, size_t len, struct ETCP_LINK* link) {
DEBUG_TRACE(DEBUG_CATEGORY_CONNECTION, "");
if (!data || len == 0) return;
// Full multi-line format (legacy)
log_dump(prefix, data, len);
}
static void etcp_link_send_init(struct ETCP_LINK* link, uint8_t reset);
static int etcp_link_send_reset(struct ETCP_LINK* link);
static void etcp_link_init_timer_cbk(void* arg);
@ -1115,7 +1106,7 @@ process_decrypted:
return; // INIT_RESPONSE is handled, no further processing needed
}
// packet_dump("RECV decrypted:", pkt->data, pkt->data_len, link);
// log_dump("RECV decrypted:", pkt->data, pkt->data_len, link);
etcp_conn_input(pkt);
return;

4
src/pkt_normalizer.c

@ -208,6 +208,8 @@ static void pn_send_to_etcp(struct PKTNORM* pn) {
frag->ll.memlen = pn->etcp->instance->data_pool->object_size;
DEBUG_INFO(DEBUG_CATEGORY_NORMALIZER, "pn->etcp: size=%d memlen=%d frag_size=%d", frag->ll.len, frag->ll.memlen, pn->frag_size);
if (debug_should_output(DEBUG_LEVEL_DEBUG, DEBUG_CATEGORY_DUMP)) log_dump("NORM->ETCP", pn->data, frag->ll.len);
queue_data_put(pn->etcp->input_queue, (struct ll_entry*)frag, 0);
// Сбросить структуру (dgram передан во фрагмент, не освобождаем)
pn->data = NULL;
@ -303,6 +305,8 @@ static void pn_unpacker_cb(struct ll_queue* q, void* arg) {
uint8_t* payload = frag->ll.dgram;
uint16_t len = frag->ll.len;
uint16_t ptr = 0;
if (debug_should_output(DEBUG_LEVEL_DEBUG, DEBUG_CATEGORY_DUMP)) log_dump("ETCP->NORM", payload, len);
DEBUG_DEBUG(DEBUG_CATEGORY_NORMALIZER, "unpacking fragment len=%d", len);
while (ptr < len) {

Loading…
Cancel
Save