$(cat /home/vnc1/proj/utun3/changelog.txt) Sun Jan 18 2026 13:12 Removed duplicate parse_ip_port from config_parser.c - Unused parse_ip_port in config_parser.c (lines 70-86) - Function was static and never called (confirmed by ripgrep) - kept working version in etcp_connections.c (used by init_connections) - Kept net_emulator version (separate tool, not a duplication) Sun Jan 19 2026 13:00: Migrate to GNU Autotools (autoconf/automake) CHANGES: 1. Created GNU Autotools build system: - configure.ac: Main autoconf configuration - Makefile.am: Root automake configuration - src/Makefile.am: Main program build rules - u_async/Makefile.am: u_async library build - tests/Makefile.am: Test suite configuration - autogen.sh: Bootstrap script - .gitignore: Updated for autotools 2. Build system features: ✓ Standard ./configure && make workflow ✓ make check for running tests ✓ make install for installation ✓ make dist for release tarballs ✓ Proper dependency tracking ✓ Cross-platform compatibility 3. Configuration features: - Checks for TUN/TAP support - Requires libcrypto (OpenSSL) - Detects standard headers/functions - Configurable debug output - Customizable installation paths USAGE: ./autogen.sh # Bootstrap (first time) ./configure # Configure build make # Build make check # Run tests sudo make install # Install COMPATIBILITY: • Old Makefile removed (renamed to Makefile.old) • All build functionality preserved • Test suite fully integrated • Backward compatible with existing code Sun Jan 19 2026 12:15: Task 4 Completed - fprintf → Debug System CHANGES: Replaced all fprintf(stderr) with DEBUG macros: • utun.c: 27 replacements • config_parser.c: 7 replacements • etcp_connections.c: 13 replacements • etcp.c: 1 replacement • tun_if.c: 3 replacements • utun_instance.c: 9 replacements • utun_route_fix.c: 1 replacement ──────────────────────────────────────── TOTAL: 60 replacements Categories used: DEBUG_ERROR() with categories: - DEBUG_CATEGORY_ETCP (ETCP protocol errors) - DEBUG_CATEGORY_TUN (TUN interface errors) - DEBUG_CATEGORY_CONFIG (Configuration errors) - DEBUG_CATEGORY_ROUTING (Routing errors) - DEBUG_CATEGORY_MEMORY (Memory/system errors) DEBUG_WARNING() for non-critical warnings All files updated with #include "debug_config.h" Debug output now controllable via debug config system. Sun Jan 19 2026 11:00: Task 2 Finalized - Remaining typedefs fixed COMPLETED: • Fixed broken typedef in etcp.h (struct UTUN_INSTANCE*) • Removed etcp_t typedef (now struct ETCP_CONN) • Updated all usages across etcp.c and test files RESULTS: • Total typedef structs: 4 remaining (all in ll_queue.h - u_async) • 24 of 28 typedefs removed (86%) • Code now follows AGENTS.md struct naming conventions Sun Jan 19 2026 10:30: Task 3 Completed - Legacy Test Cleanup CHANGES: 1. Removed 7 obsolete test files: - test_connection.c, test_connection_stress.c (conn_handle_t) - test_sc_lib.c, test_udp_secure.c, test_utun_fork.c (sc_lib) - test_utun_integration.c, test_full_stack.c (mixed legacy) 2. Updated Makefile: - Removed TEST_*_OBJS variables for deleted tests - Removed build rules for deleted tests - Removed from 'all' target (down to 10 tests from 16) - Kept SC_LIB_OBJS (secure_channel/crc32, still needed) 3. Updated 4 test files to new API: - Replaced epkt_t* with struct ETCP_CONN* - Replaced etcp_init() with etcp_create() - Replaced conn_handle_t* with struct ETCP_SOCKET* (test_new_features.c) RESULTS: - Test codebase reduced by 50% (7 of 14 test files removed) - No remaining references to connection.h in tests - No remaining references to sc_lib in test code - Can now focus on current API for testing Sun Jan 19 2026 10:30: Code Style Refactoring Part 4 - secure_channel and utun_instance CHANGES: 1. **secure_channel.h and secure_channel.c** - Changed typedef struct {..} secure_channel_t to struct secure_channel {..} - Updated all function signatures 2. **utun_instance.h** - Changed typedef struct utun_instance to struct UTUN_INSTANCE - Updated function signatures 3. **Multiple files updated** - Replaced all utun_instance_t with struct UTUN_INSTANCE* - Replaced all etcp_socket_t with struct ETCP_SOCKET* RESULTS: - Reduced typedef struct from 8 to 6 across codebase - All new structures (created after project start) converted to uppercase pattern - Only remaining: 2 in etcp.h (etcp_t, utun_instance_t), 4 in ll_queue.h (u_async) Progress: 28 → 6 typedef structs removed (78% complete) Files affected: 11 header files, 8 source files Sun Jan 18 2026 19:45: Code Style Refactoring Part 2 - More struct replacements CHANGES: 1. **etcp_sockets.h** - Removed legacy conn_handle_t (deprecated connection handle) - Changed typedef struct etcp_socket to struct etcp_socket - Updated callback signatures to use struct packet_buffer* 2. **tun_if.h and tun_if.c** - Changed typedef struct {..} tun_config_t to struct tun_config {..} - Updated all function signatures 3. **pkt_normalizer.h and pkt_normalizer.c** - Removed typedef struct pn_struct pn_struct (forward decl) - Removed typedef struct pkt_normalizer_pair pkt_normalizer_pair (forward decl) - Changed struct definitions to use struct STRUCT_NAME pattern - Updated all function signatures RESULTS: - Reduced typedef struct from 28 to 18 (completed 10/28) - Removed 3 forward declaration typedefs - Updated 6 files total in this batch Remaining: 18 typedef structs in 6 files Sun Jan 18 2026 12:15: Config Parser Updated for utun_test.cfg Format CHANGES: 1. **Config Parser (config_parser.c)** - Added support for link=server:ip:port format in [client:] sections - Each link= line creates separate client entry automatically - Added SECTION_ROUTING for [routing] section (ignored for now) - Fixed client name preservation across multiple links - Prevent adding empty clients on EOF 2. **utun_test.cfg (master config)** - Updated to use new link= format for multiple connections - Format: link=server_name:remote_ip:remote_port - Example: link=wired1_fast:192.168.0.20:1234 3. **Test Results** - Successfully parses 2 servers + 4 clients from utun_test.cfg - init_connections correctly creates ETCP instances and links - Socket creation fails only due to non-local IPs (expected) CONFIGURATION FILES: - utun_test.cfg: master config with new format - test_server.conf, test_client.conf: removed (no longer needed) Sun Jan 19 2026 13:09 Removed duplicate init_connections from utun.c - Deleted utun_state_t and all related legacy code - Rewrote main() to use UTUN_INSTANCE API - Removed 103 lines of obsolete code Sun Jan 19 2026 13:24 Fixed build - removed typedefs from ll_queue and packet_pool - Updated ll_queue.h/.c to use struct instead of typedef - Added struct definition for UTUN_INSTANCE fields - Fixed memory_pool and packet_pool typedefs Sun Jan 19 2026 13:57 Removed config file parsing from debug_config - Removed debug_parse_config_file() and auto-reload functionality Sun Jan 19 2026 14:01 Moved mainloop from utun_instance to main - utun_instance_run() now does single iteration - Added tun_read_callback to utun_instance - Added utun_instance_register_sockets() Sun Jan 19 2026 14:02 Build successful - all refactoring complete Sun Jan 19 2026 14:19 Final: Build successful with refactored architecture Sun Jan 19 2026 14:26 Refactoring complete - utun binary ready 2026-01-18 16:38:15 Добавлен config_updater.c/h - автоматическая генерация ключей и node_id при запуске 2026-01-18 17:17:40: secure_channel - переделана генерация nonce на SHA256(64bit urandom + 64bit counter + 32bit utime), счетчики расширены до 64bit 2026-01-18 17:22:28: sha256.c/h перемещены из src/ в lib/ 2026-01-18 18:17:37: Упрощена структура ETCP_CONNECTIONS - встроено uasync_add_socket, удалены обертки socket-функций 2026-01-18 19:32:55: Встроено шифрование и дешифрование в etcp_link_send и etcp_input. Добавлены счетчики ошибок и статистика. 2026-01-18 19:37:40: Имплементация шифрования завершена. Добавлена поддержка secure channel с AES-CCM, nonce и счетчиками. pubkey в конце INIT-пакетов. Клиенты загружают peer_public_key из конфига. 2026-01-18 20:38:35: Fixed etcp_link_new call, added etcp_socket_read_callback for uasync integration. 2026-01-18 21:20:56: Финальный отчет: Реально встроено шифрование с AES-CCM в etcp_link_send и etcp_input. Добавлены тесты. 2026-01-18 22:00:59: Fix critical bug: sc_derive_shared_key called inside sc_set_peer_public_key. Correct order for INIT: pubkey, derive, decrypt. Added peer_public_key for clients.