Проблема: test_etcp_two_instances.c создает два экземпляра (сервер и клиент),
и оба пытаются привязаться к одному и тому же адресу 127.0.0.1:9001.
Реальная ошибка: bind: Address already in use
Причина: В ETCP архитектуре каждый экземпляр создает серверные сокеты на основе
конфигурации. В тесте оба процесса на одной машине, поэтому возникает конфликт портов.
Что сделано:
1. Добавлен вызов bind() в etcp_socket_add (был пропущен критический вызов)
2. Добавлена отладка для отслеживания жизненного цикла сокетов
3. Создан debug_socket_test.sh для мониторинга портов в реальном времени
4. Удалены лишние вызовы init_connections для устранения дублирования
Результат: Теперь видно, что сервер действительно слушает на 127.0.0.1:9001,
но клиент не может привязаться к тому же порту. Необходимо использовать
разные порты для сервера и клиента в тестовой среде.
- Changed client server port from 0 (unsupported) to 9002 (fixed)
- Added comments explaining importance of fixed ports vs random ports
- ETCP now uses proper port configuration for client-server setup
- test_etcp_two_instances_fixed.c: two UTUN instances in single process
- Creates server and client configs in /tmp
- Uses uasync polling for both instances
- Periodic monitoring via settimeout
- Exits after handshake success/failure
- Debug output in SEND/RECV functions
- Fixed init_connections() to allow 0 connections for server-only mode
- All instances now require [server] section for bind socket
- Added test configs demonstrating server-only and client-with-server patterns
- Created run_two_instance_test.sh for manual handshake testing
- test_etcp_connection_full.c creates two full UTUN instances
- Uses real config parsing and init_connections()
- Instances communicate over 127.0.0.1:9001
- Test validates complete handshake process
- Fixed header includes (ll_queue.h, u_async.h, tinycrypt paths)
- Updated Makefile.am with proper CFLAGS and all dependencies
- Test compiles and runs successfully
- Added connection state tracking (initialized, init_timer, timeout, retry_count)
- Implemented etcp_link_send_init() with proper packet formatting
- Configured retry timeouts (initial 50ms, double every 10, max 5000ms)
- Auto-start connection establishment for client links in etcp_link_new()
- Implemented etcp_connections_send() with connection initiation logic
- Created test_etcp_connection_init.c for testing handshake process
- Добавлен AGENTS.md - руководство для AI агентов разработки
- Рефакторинг etcp: упрощен etcp_connection_create через etcp_conn_reset
- Обновлены etcp_connections: улучшена работа с каналами
- Обновлен routing: оптимизация таблиц маршрутизации
- Обновлен tun_if: улучшена работа с TUN/TAP интерфейсом
- Обновлен utun_instance: улучшено управление экземплярами
- Обновлен test_routing_full: расширено тестирование
- Добавлено больше документации и комментариев
- Добавлен шаблон конфигурации src/utun.conf
- Deleted 11 obsolete debug/isolation test files
- Restored test_pkt_normalizer.c from git repository
- Added test_ecc_encrypt and test_routing to Makefile (2 new functional tests)
- Removed settings.o from PN_OBJS (settings.c deleted)
- Added crc32.o to SC_LIB_OBJS and ETCP_OBJS to fix linker errors
- Removed unused routing_get_stats() function (undefined routing_stats_t type)
- Updated changelog with detailed cleanup summary
Current test count: 16 tests in Makefile (14 original + 2 new)Active test files in tests/: 25 files (was 35)test_ecc_encrypt: PASStest_routing: Compilation OK
- Add CRC32 checksum support using IEEE 802.3 polynomial
- Update sc_encrypt/sc_decrypt API: combine tag and CRC32 into single buffer
- Add SC_CRC32_SIZE, SC_MAX_OVERHEAD constants and SC_ERR_CRC_FAILED error code
- Implement CRC32 calculation before encryption and verification after decryption
- Update connection.c to use new API with error statistics tracking
- Modify test files for compatibility with new API
- All tests pass successfully
- Fix fragmentation algorithm violation: split last fragment into FE+regular blocks
- Add service packet support (headers 0xFC/0xFD) for control messages up to 256 bytes
- Add ETCP reset service packets (0x02/0x03) with 100ms retry and 10 attempt limit
- Add conn_reset() function for coordinated reset across connection components
- Add comprehensive test suite for all new features
- Update Makefile to build new test
- Move reset_test_data() and error count resets outside the main loop
- This prevents sent_count from being reset each iteration
- The test was incorrectly resetting counters for each packet, causing sent_count to always be 1
- Implement queue_wait_threshold() with automatic waiter checking in ll_queue
- Add pkt_normalizer_flush() to force buffer sending
- Enhance test suite with async wait tests, fragmentation verification, and buffer flush tests
- Fix test edge cases by flushing packer buffer between subtests
- Improve test reliability with increased iteration limits and while loop processing
- Add connection module for secure UDP communication with ECC/AES-CCM cryptography
- Implement Extended Transmission Control Protocol (etcp.c/h) for reliable
UDP transmission with packet ordering and loss recovery
- Add window management (congestion control) with dynamic window sizing
based on RTT and bandwidth
- Implement ACK handling, retransmission logic, and gap detection
- Add comprehensive test suite: unit tests, simple test, and stress test
with network emulation (packet loss, reordering, delay)
- Include mock u_async implementation for testing
- Update Makefile with new ETCP build targets
- Move all test files to tests/ directory
- Update Makefile to build tests in tests/ directory
- Add fragment reassembly timeout mechanism (500ms default)
- Add error count API (pkt_normalizer_get_error_count, pkt_normalizer_reset_error_count)
- Enhance error handling with timeout callbacks
- Add comprehensive stress tests and edge case tests
- Update .gitignore for build artifacts