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
@@ -62,9 +62,11 @@ static int addr_type_from_ip(int family, const uint8_t* addr) {
|
||||
}
|
||||
|
||||
/* Итоговая классификация: конфиг + автоопределение + IP (всё локально). */
|
||||
static int addr_type_classify(int kind, int config_type, int global, const struct address_profile *profile) {
|
||||
static int addr_type_classify(int kind, int protocol, int config_type, int global, const struct address_profile *profile) {
|
||||
if (config_type == CFG_SERVER_TYPE_PRIVATE || config_type == CFG_SERVER_TYPE_LOCAL) return ADDR_TYPE_NETIF;
|
||||
if (!profile) return ADDR_TYPE_NAT;
|
||||
if ((protocol & TOPO_PROTO_TCP) && profile->source == ADDRESS_SOURCE_ETCP && profile->mapping == ADDRESS_MAP_UNKNOWN)
|
||||
return ADDR_TYPE_NAT;
|
||||
if (profile->mapping == ADDRESS_MAP_EIM)
|
||||
return profile->inbound == ADDRESS_IN_UNKNOWN ? ADDR_TYPE_NAT_EIM_UNVERIFIED : ADDR_TYPE_NAT_EIM;
|
||||
if (profile->mapping == ADDRESS_MAP_DEPENDENT) return ADDR_TYPE_NAT_STRICT;
|
||||
@@ -114,7 +116,7 @@ static int address_row_put(sqlite3_stmt *statement, struct TOPO_NODE *node, uint
|
||||
uint8_t protocol, uint8_t config, const struct address_profile *profile) {
|
||||
static const struct address_profile unknown = {0};
|
||||
if (!profile) profile = &unknown;
|
||||
int summary = addr_type_classify(kind, config, addr_type_from_ip(family, address) == ADDR_TYPE_DIRECT, profile);
|
||||
int summary = addr_type_classify(kind, protocol, config, addr_type_from_ip(family, address) == ADDR_TYPE_DIRECT, profile);
|
||||
struct TOPO_ADDR_REALITY_OPTS reality;
|
||||
int has_reality = (protocol & TOPO_PROTO_REALITY) && reality_opts_build(node, socket_id, &reality);
|
||||
sqlite3_bind_int64(statement, 1, (sqlite3_int64)node_id);
|
||||
|
||||
Reference in new issue
Block a user