Measure owned endpoint mapping and inbound reachability separately

This commit is contained in:
evgeny committed 2026-10-12 00:01:40 +02:00
1 parent b54307a0df
commit ff69552a61
51 files changed
+2620 -2483

No files matched your search

+10 -5
View File
@@ -955,7 +955,7 @@ static void send_socket_list(struct control_server* server, struct control_clien
uint8_t count = 0;
struct ETCP_SOCKET* sock = instance->etcp_sockets;
while (sock && count < ETCPMON_MAX_CONNECTIONS) {
count++;
if (!sock->probe_only) count++;
sock = sock->next;
}
@@ -980,6 +980,8 @@ static void send_socket_list(struct control_server* server, struct control_clien
struct etcpmon_socket_info* info = (struct etcpmon_socket_info*)(buffer + sizeof(*hdr) + sizeof(*rsp));
sock = instance->etcp_sockets;
for (uint8_t i = 0; i < count && sock; i++) {
while (sock && sock->probe_only) sock = sock->next;
if (!sock) break;
strncpy(info[i].name, sock->name, ETCPMON_MAX_CONN_NAME - 1);
info[i].name[ETCPMON_MAX_CONN_NAME - 1] = '\0';
info[i].is_ipv6 = (sock->interface_addr.ss_family == AF_INET6) ? 1 : 0;
@@ -997,9 +999,11 @@ static void send_socket_list(struct control_server* server, struct control_clien
info[i].port = 0;
}
info[i].config_type = sock->type;
info[i].nat_type = sock->nat_type;
info[i].mapping = sock->address_profile.mapping; info[i].inbound = sock->address_profile.inbound;
info[i].is_tcp = sock->is_tcp; info[i].generation = sock->generation;
info[i].evidence_id = sock->address_profile.evidence_id; info[i].checked_at = sock->address_profile.checked_at;
/* NAT address from socket (set when INIT_RESPONSE received) */
/* Общий внешний адрес подтверждён измерениями владельца. */
info[i].nat_ip[0] = '\0';
info[i].nat_port = 0;
if (sock->nat_addr.ss_family == AF_INET) {
@@ -1011,8 +1015,9 @@ static void send_socket_list(struct control_server* server, struct control_clien
inet_ntop(AF_INET6, &sin6->sin6_addr, info[i].nat_ip, sizeof(info[i].nat_ip));
info[i].nat_port = ntohs(sin6->sin6_port);
}
DEBUG_INFO(DEBUG_CATEGORY_NAT, "socket_list to gui: sock=%s config=%d nat_type=%d nat_ip=%s nat_port=%u",
sock->name, sock->type, sock->nat_type,
DEBUG_DEBUG(DEBUG_CATEGORY_NAT, "socket_list to gui: sock=%s config=%u mapping=%s inbound=%s external=%s:%u",
sock->name, sock->type, address_mapping_name(sock->address_profile.mapping),
address_inbound_name(sock->address_profile.inbound),
info[i].nat_ip[0] ? info[i].nat_ip : "none", info[i].nat_port);
sock = sock->next;