nat: publish TCP external IPs with an unknown port
This commit is contained in:
1 parent
5eb3526186
commit
6363c8b7ea
2 files changed
+20
-2
No files matched your search
@@ -1219,6 +1219,14 @@ int topo_node_update_my_addresses(struct UTUN_INSTANCE* instance) {
|
||||
memcpy(a->addr, &sin->sin_addr.s_addr, 4); a->port = ntohs(sin->sin_port);
|
||||
a->type = TOPO_ADDR_INTERFACE; a->socket_id = ts->sock_id; a->protocol = proto;
|
||||
a->next = v4_head; v4_head = a; }
|
||||
if (ts->nat_addr.ss_family == AF_INET && ts->address_profile.source == ADDRESS_SOURCE_ETCP &&
|
||||
ts->address_profile.mapping == ADDRESS_MAP_UNKNOWN) {
|
||||
struct TOPO_ADDR4 *a = memory_pool_alloc(instance->topo_groups->v4_addr_pool);
|
||||
if (!a) goto allocation_failed;
|
||||
memcpy(a->addr, &((const struct sockaddr_in *)&ts->nat_addr)->sin_addr, 4);
|
||||
a->port = 0; a->type = TOPO_ADDR_NAT; a->socket_id = ts->sock_id; a->protocol = proto;
|
||||
a->next = v4_head; v4_head = a;
|
||||
}
|
||||
} else if (addr->ss_family == AF_INET6) {
|
||||
struct sockaddr_in6* sin6 = (struct sockaddr_in6*)addr;
|
||||
{ struct TOPO_SOCKMETA6* sm6 = memory_pool_alloc(instance->topo_groups->v6_sock_meta_pool);
|
||||
@@ -1230,6 +1238,14 @@ int topo_node_update_my_addresses(struct UTUN_INSTANCE* instance) {
|
||||
memcpy(a6->addr, &sin6->sin6_addr, 16); a6->port = ntohs(sin6->sin6_port);
|
||||
a6->type = TOPO_ADDR_INTERFACE; a6->socket_id = ts->sock_id; a6->protocol = proto;
|
||||
a6->next = v6_head; v6_head = a6; }
|
||||
if (ts->nat_addr.ss_family == AF_INET6 && ts->address_profile.source == ADDRESS_SOURCE_ETCP &&
|
||||
ts->address_profile.mapping == ADDRESS_MAP_UNKNOWN) {
|
||||
struct TOPO_ADDR6 *a6 = memory_pool_alloc(instance->topo_groups->v6_addr_pool);
|
||||
if (!a6) goto allocation_failed;
|
||||
memcpy(a6->addr, &((const struct sockaddr_in6 *)&ts->nat_addr)->sin6_addr, 16);
|
||||
a6->port = 0; a6->type = TOPO_ADDR_NAT; a6->socket_id = ts->sock_id; a6->protocol = proto;
|
||||
a6->next = v6_head; v6_head = a6;
|
||||
}
|
||||
}
|
||||
if (is_reality) {
|
||||
struct TOPO_REALITY_SOCK* r = u_calloc(1, sizeof(struct TOPO_REALITY_SOCK));
|
||||
|
||||
Reference in new issue
Block a user