test(nat): isolate active measurements from incoming transport evidence
This commit is contained in:
1 parent
094a8bb499
commit
49385ab91c
2 files changed
+5
-7
No files matched your search
@@ -262,14 +262,12 @@ int main(void) {
|
||||
struct SC_MYKEYS swap = first; first = second; second = swap;
|
||||
}
|
||||
struct UTUN_INSTANCE *owner = nat_fixture_node(&fixture, "127.0.0.2", NULL,
|
||||
"[server:second]\naddr=127.0.0.5:0\ntype=public\n"
|
||||
"[server:tcp]\naddr=127.0.0.2:0\ntype=public\ntransport=tcp\n");
|
||||
"[server:second]\naddr=127.0.0.5:0\ntype=public\n");
|
||||
struct UTUN_INSTANCE *observer = nat_fixture_node(&fixture, "127.0.0.3", NULL, NULL);
|
||||
struct UTUN_INSTANCE *same_ip = nat_fixture_node(&fixture, "127.0.0.3", &first, NULL);
|
||||
struct UTUN_INSTANCE *helper = nat_fixture_node(&fixture, "127.0.0.4", &second, NULL);
|
||||
struct ETCP_SOCKET *socket = test_etcp_bound_socket(owner, "udp");
|
||||
struct ETCP_SOCKET *second_socket = test_etcp_bound_socket(owner, "second");
|
||||
struct ETCP_SOCKET *tcp = test_etcp_bound_socket(owner, "tcp");
|
||||
struct ETCP_SOCKET *observer_socket = test_etcp_bound_socket(observer, "udp");
|
||||
assert(socket->sock_id != observer_socket->sock_id);
|
||||
|
||||
@@ -299,9 +297,6 @@ int main(void) {
|
||||
assert(status.round != second_status.round);
|
||||
check_snapshot(owner, socket);
|
||||
check_snapshot(owner, second_socket);
|
||||
assert(tcp->address_profile.inbound == ADDRESS_IN_UNKNOWN);
|
||||
struct nat_check_status tcp_status;
|
||||
assert(!nat_detection_get_status(owner->nat_det, tcp, &tcp_status) && !tcp_status.rounds && !tcp_status.helper);
|
||||
|
||||
/* Профиль B не заимствует профиль A, даже когда транспорт переиспользуется в обе стороны. */
|
||||
assert(!route_ping_addr_equal(&socket->local_addr, &observer_socket->local_addr, 1));
|
||||
|
||||
@@ -384,9 +384,12 @@ static void run_endpoint_retry(void) {
|
||||
nat_detection_set_automatic(observer->nat_det, 0); nat_detection_set_automatic(helper->nat_det, 0);
|
||||
struct ETCP_SOCKET *bad = test_etcp_bound_socket(observer, "udp");
|
||||
assert(!uasync_remove_socket_t(fixture.ua, bad->fd)); bad->socket_id = NULL;
|
||||
/* Управляющие TCP-пиры не должны параллельно открывать входящий UDP и обходить проверяемый retry. */
|
||||
struct ETCP_SOCKET *socket = test_etcp_bound_socket(owner, "udp");
|
||||
socket->type = CFG_SERVER_TYPE_PRIVATE; assert(topo_node_update_my_addresses(owner) >= 0);
|
||||
nat_fixture_connect(&fixture, observer, "tcp", helper); nat_fixture_connect(&fixture, owner, "tcp", observer);
|
||||
nat_detection_set_automatic(owner->nat_det, 0);
|
||||
struct ETCP_SOCKET *socket = test_etcp_bound_socket(owner, "udp");
|
||||
socket->type = CFG_SERVER_TYPE_PUBLIC; /* До публикации измерения NCD видит запрет входящего транспорта. */
|
||||
struct nat_check_status status = {0}; uint64_t end = get_time_tb() + 400000;
|
||||
nat_detection_get_status(owner->nat_det, socket, &status); uint32_t rounds = status.rounds;
|
||||
assert(!nat_detection_request_check_socket(owner->nat_det, socket, observer->node_id));
|
||||
|
||||
Reference in new issue
Block a user