Add independent STUN NAT probes with RFC 5780 discovery

This commit is contained in:
evgeny committed 2026-10-11 23:35:47 +02:00
1 parent 9cc996b775
commit 2c5deafe56
11 files changed
+1315 -2

No files matched your search

+5
View File
@@ -11,6 +11,7 @@
#include "topo_group.h"
#include "topo_group_invite.h"
#include "nat_detection.h"
#include "transport_layer/stun_nat.h"
#include "etcp_connections.h"
#include "etcp.h"
#include "conn_mgr.h"
@@ -404,6 +405,7 @@ void utun_instance_destroy(struct UTUN_INSTANCE *instance) {
if (instance->ua) uasync_print_resources(instance->ua, "INSTANCE_DESTROY_BEFORE");
instance->running = 0;
stun_nat_destroy(instance);
etcp_padding_stop(&instance->padding);
DEBUG_INFO(DEBUG_CATEGORY_SYS, "[DESTROY] A done — diagnose complete");
@@ -702,6 +704,7 @@ int utun_core_start(struct UTUN_INSTANCE *instance) {
radio_init_instance(instance);
instance->core_started = 1;
if (stun_nat_init(instance) < 0) DEBUG_WARN(DEBUG_CATEGORY_NAT, "STUN diagnostics could not start; core remains operational");
DEBUG_INFO(DEBUG_CATEGORY_SYS, "core started");
return 0;
}
@@ -1076,8 +1079,10 @@ struct UTUN_INSTANCE *utun_instance_reload(struct UTUN_INSTANCE *instance, struc
fw_load_rules(&instance->fw, &new_config->global);
// routing_destroy(instance); // commented per request - BGP self-restarts on conn events
// routing_create(instance); // commented per request
stun_nat_destroy(instance);
if (instance->config) free_config(instance->config);
instance->config = new_config;
if (instance->core_started && stun_nat_init(instance) < 0) DEBUG_WARN(DEBUG_CATEGORY_NAT, "STUN restart failed after config reload");
if (client_result < 0) DEBUG_WARN(DEBUG_CATEGORY_CONFIG, "Reload completed with client errors; previous client handles retained");
else DEBUG_INFO(DEBUG_CATEGORY_CONFIG, "Selective partial reload completed (only changed updated, unchanged untouched, [debug] applied)");
return instance;