diff --git a/AGENTS.md b/AGENTS.md index 5271307..1b659c8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -215,7 +215,7 @@ Crypto: Fixed CCM nonce size to 13 bytes, all crypto tests passing - Для отладки не printf а DEBUG_* - перед сборкой всегда make clean - прежде чем вносить правки хорошо разберись как должно работать, просмотри все нужные функции полностью, нужно целостное понимание. -- всегда думай можно ли написать проще. Проверяй дубликаты и что уже есть, продумай логику до тех пор пока не будет полного понимания +- при написании кода мысленно анализируй логику работы, думай как сделать проще и удобнее. Проверяй дубликаты и что уже есть, продумай логику до тех пор пока не будет полного понимания Действия при поиске бага: 1. создать комит или бэкап всего что меняешь diff --git a/lib/debug_config.h b/lib/debug_config.h index b342cc3..5f728d2 100644 --- a/lib/debug_config.h +++ b/lib/debug_config.h @@ -41,7 +41,7 @@ typedef uint64_t debug_category_t; #define DEBUG_CATEGORY_TUN ((debug_category_t)1 << 8) // TUN interface #define DEBUG_CATEGORY_ROUTING ((debug_category_t)1 << 9) // routing table #define DEBUG_CATEGORY_TIMERS ((debug_category_t)1 << 10) // timer management -#define DEBUG_CATEGORY_ALL ((debug_category_t)(~((uint64_t)0))) +#define DEBUG_CATEGORY_ALL ((debug_category_t)0xFFFFFFFFFFFFFFFFULL) /* Debug configuration structure */ typedef struct { diff --git a/src/utun_instance.c b/src/utun_instance.c index 3c79480..ac97227 100644 --- a/src/utun_instance.c +++ b/src/utun_instance.c @@ -100,12 +100,18 @@ struct UTUN_INSTANCE* utun_instance_create(struct UASYNC* ua, const char *config } #ifdef __linux__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-truncation" snprintf(tun_ip_str, sizeof(tun_ip_str), "%s/32", ip_buffer); +#pragma GCC diagnostic pop #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) // BSD systems: use config IP as-is, peer IP will be 192.0.2.1 snprintf(tun_ip_str, sizeof(tun_ip_str), "%s", ip_buffer); #else +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-truncation" snprintf(tun_ip_str, sizeof(tun_ip_str), "%s/32", ip_buffer); // Default to /32 +#pragma GCC diagnostic pop #endif if (tun_set_ip(instance->tun.ifname, tun_ip_str) < 0) { diff --git a/tests/test_debug_categories b/tests/test_debug_categories index 52f5edc..74203a4 100755 Binary files a/tests/test_debug_categories and b/tests/test_debug_categories differ diff --git a/tests/test_debug_categories.c b/tests/test_debug_categories.c index d0b6fea..1105bd8 100644 --- a/tests/test_debug_categories.c +++ b/tests/test_debug_categories.c @@ -22,7 +22,7 @@ int main(int argc, char *argv[]) { debug_set_categories(DEBUG_CATEGORY_ALL); // Анализ аргументов командной строки - int debug_categories = 0; + debug_category_t debug_categories = 0; // Если есть специфические категории, сначала отключаем все int has_specific_categories = 0; diff --git a/tests/test_etcp_100_packets b/tests/test_etcp_100_packets index c129f73..96eaa9f 100755 Binary files a/tests/test_etcp_100_packets and b/tests/test_etcp_100_packets differ diff --git a/tests/test_etcp_simple_traffic b/tests/test_etcp_simple_traffic index bd53998..2f5b546 100755 Binary files a/tests/test_etcp_simple_traffic and b/tests/test_etcp_simple_traffic differ diff --git a/tests/test_etcp_two_instances b/tests/test_etcp_two_instances index 6ff94d7..ecd7945 100755 Binary files a/tests/test_etcp_two_instances and b/tests/test_etcp_two_instances differ diff --git a/tests/test_pkt_normalizer_etcp b/tests/test_pkt_normalizer_etcp index f24605c..ff8a856 100755 Binary files a/tests/test_pkt_normalizer_etcp and b/tests/test_pkt_normalizer_etcp differ