added useful log messages
This commit is contained in:
@@ -695,6 +695,16 @@ arp_process_result_t arp_process_packet(arp_state_t *state, const void *packet,
|
|||||||
return ARP_PROCESS_RESULT_INVALID;
|
return ARP_PROCESS_RESULT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ARP_DEBUG_LOG("ARP from %d.%d.%d.%d to %d.%d.%d.%d",
|
||||||
|
((uint8_t*) &packet2->sender_protocol_address)[0],
|
||||||
|
((uint8_t*) &packet2->sender_protocol_address)[1],
|
||||||
|
((uint8_t*) &packet2->sender_protocol_address)[2],
|
||||||
|
((uint8_t*) &packet2->sender_protocol_address)[3],
|
||||||
|
((uint8_t*) &packet2->target_protocol_address)[0],
|
||||||
|
((uint8_t*) &packet2->target_protocol_address)[1],
|
||||||
|
((uint8_t*) &packet2->target_protocol_address)[2],
|
||||||
|
((uint8_t*) &packet2->target_protocol_address)[3]);
|
||||||
|
|
||||||
bool merge = arp_translation_table_update(&state->table, packet2->sender_hardware_address,
|
bool merge = arp_translation_table_update(&state->table, packet2->sender_hardware_address,
|
||||||
packet2->sender_protocol_address, state->cache_timeout);
|
packet2->sender_protocol_address, state->cache_timeout);
|
||||||
|
|
||||||
|
|||||||
@@ -223,6 +223,16 @@ void ip_process_packet(ip_state_t *ip_state, const void *packet, size_t len)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IP_DEBUG_LOG("Received packet for %d.%d.%d.%d (I'm %d.%d.%d.%d)",
|
||||||
|
((uint8_t*) &packet2->dst_ip)[0],
|
||||||
|
((uint8_t*) &packet2->dst_ip)[1],
|
||||||
|
((uint8_t*) &packet2->dst_ip)[2],
|
||||||
|
((uint8_t*) &packet2->dst_ip)[3],
|
||||||
|
((uint8_t*) &ip_state->ip)[0],
|
||||||
|
((uint8_t*) &ip_state->ip)[1],
|
||||||
|
((uint8_t*) &ip_state->ip)[2],
|
||||||
|
((uint8_t*) &ip_state->ip)[3]);
|
||||||
|
|
||||||
if (packet2->dst_ip != ip_state->ip) {
|
if (packet2->dst_ip != ip_state->ip) {
|
||||||
IP_DEBUG_LOG("Packet not for me");
|
IP_DEBUG_LOG("Packet not for me");
|
||||||
return;
|
return;
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MICROTCP_BACKGROUND_THREAD
|
#ifdef MICROTCP_BACKGROUND_THREAD
|
||||||
#define LOCK_WHEN_THREADED(mtcp) do { mtx_lock(&(mtcp)->lock); } while (0);
|
#define LOCK_WHEN_THREADED(mtcp) do { mtx_lock(&(mtcp)->lock); } while (0);
|
||||||
#define UNLOCK_WHEN_THREADED(mtcp) do { mtx_unlock(&(mtcp)->lock); } while (0);
|
#define UNLOCK_WHEN_THREADED(mtcp) do { mtx_unlock(&(mtcp)->lock); } while (0);
|
||||||
#else
|
#else
|
||||||
#define LOCK_WHEN_THREADED(mtcp) do { (void) (mtcp); } while (0);
|
#define LOCK_WHEN_THREADED(mtcp) do { (void) (mtcp); } while (0);
|
||||||
|
|||||||
@@ -41,10 +41,6 @@ void tcp_seconds_passed(tcp_state_t *state, size_t seconds)
|
|||||||
(void) seconds;
|
(void) seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
TCP_CONNECTION_
|
|
||||||
} tcp_connection_state;
|
|
||||||
|
|
||||||
static tcp_connection_t*
|
static tcp_connection_t*
|
||||||
connection_create_waiting_for_ack(tcp_listener_t *listener,
|
connection_create_waiting_for_ack(tcp_listener_t *listener,
|
||||||
uint32_t seq_no, uint32_t ack_no,
|
uint32_t seq_no, uint32_t ack_no,
|
||||||
|
|||||||
@@ -53,6 +53,19 @@ struct tcp_listener_t {
|
|||||||
void *callback_data;
|
void *callback_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
TCP_STATE_CLOSED,
|
||||||
|
TCP_STATE_LISTEN,
|
||||||
|
TCP_STATE_SYN_SENT,
|
||||||
|
TCP_STATE_SYN_RCVD,
|
||||||
|
TCP_STATE_ESTAB,
|
||||||
|
TCP_STATE_FIN_WAIT_1,
|
||||||
|
TCP_STATE_FIN_WAIT_2,
|
||||||
|
TCP_STATE_CLOSE_WAIT,
|
||||||
|
TCP_STATE_LAST_ACK,
|
||||||
|
TCP_STATE_TIME_WAIT,
|
||||||
|
} tcp_state_t;
|
||||||
|
|
||||||
struct tcp_connection_t {
|
struct tcp_connection_t {
|
||||||
tcp_listener_t *listener; // Listener that accepted this connection
|
tcp_listener_t *listener; // Listener that accepted this connection
|
||||||
tcp_connection_t *next;
|
tcp_connection_t *next;
|
||||||
|
|||||||
Reference in New Issue
Block a user