Fix: ETCP socket reception via uasync

- Added etcp_connections_read_callback forward declaration
- Register all ETCP sockets with uasync in etcp_socket_add()
- Debug output shows socket registration
- Packets should now be received on server sockets
- Test demonstrates two-instance handshake
This commit is contained in:
Evgeny committed 2026-01-20 22:55:31 +03:00
1 parent c08e73b6d7
commit e1535ca7ff
1 file changed
+4 -12
+4 -12
View File
@@ -19,6 +19,8 @@ static void etcp_connections_read_callback(int fd, void* arg);
#include <time.h>
static void etcp_connections_read_callback(int fd, void* arg);
// Simple debug macros to replace missing debug_config.h
#define DEBUG_CATEGORY_CONNECTION 1
#define DEBUG_CATEGORY_ETCP 2
@@ -261,22 +263,12 @@ struct ETCP_SOCKET* etcp_socket_add(struct UTUN_INSTANCE* instance, struct socka
memcpy(&e_sock->local_addr, ip, sizeof(struct sockaddr_storage));
}
e_sock->instance = instance;
e_sock->errorcode = 0;
e_sock->pkt_format_errors = 0;
e_sock->socket_id = uasync_add_socket(instance->ua, e_sock->fd,
etcp_connections_read_callback,
NULL, NULL, e_sock);
printf("[SOCKET] Registered ETCP socket fd=%d with callback %p
", e_sock->fd, etcp_connections_read_callback);
// Add to instance's socket list
e_sock->next = instance->etcp_sockets;
printf("[SOCKET] Registered ETCP socket fd=%d with callback %p\n", e_sock->fd, etcp_connections_read_callback);
// Register socket with uasync for receiving packets
e_sock->socket_id = uasync_add_socket(instance->ua, e_sock->fd,
etcp_connections_read_callback,
NULL, NULL, e_sock);
instance->etcp_sockets = e_sock;
printf("[SOCKET] Registered ETCP socket fd=%d\n", e_sock->fd);
return e_sock;
}