invite: убрать BOTH-протокол — адрес либо UDP либо TCP

This commit is contained in:
Evgeny committed 2026-08-13 21:24:55 +03:00
1 parent 37ef08a015
commit bcea4bc335
4 files changed
+6 -7

No files matched your search

-1
View File
@@ -17,7 +17,6 @@
#define INVITE_PROTO_UDP 0x01
#define INVITE_PROTO_TCP 0x02
#define INVITE_PROTO_BOTH 0x03
#ifdef __cplusplus
extern "C" {
+3 -3
View File
@@ -79,11 +79,11 @@ static void connect_create_links_v4(struct ETCP_CONNECT* ctx, struct TOPO_GROUP_
memcpy(&sin.sin_addr.s_addr, a->addr, 4); sin.sin_port = htons(a->port);
struct sockaddr_storage sa; memcpy(&sa, &sin, sizeof(sin));
int addr_links = 0;
if (!(a->protocol & TOPO_PROTO_TCP)) {
if (a->protocol & TOPO_PROTO_UDP) {
struct ETCP_SOCKET* s = ctx->instance->etcp_sockets;
while (s) { if (s->local_addr.ss_family == AF_INET && etcp_link_new(ctx->conn, s, &sa, 0)) { link_count++; addr_links++; } s = s->next; }
}
if ((a->protocol & TOPO_PROTO_TCP)) {
if (a->protocol & TOPO_PROTO_TCP) {
struct ETCP_SOCKET* s = ctx->instance->etcp_sockets;
while (s) { if (s->is_tcp && s->local_addr.ss_family == AF_INET) {
struct ETCP_LINK *tlink = etcp_link_new(ctx->conn, s, &sa, 0);
@@ -111,7 +111,7 @@ static void connect_create_links_v6(struct ETCP_CONNECT* ctx, struct TOPO_GROUP_
memcpy(&sin6.sin6_addr, a->addr, 16); sin6.sin6_port = htons(a->port);
int is_ll = (a->addr[0] == 0xfe && (a->addr[1] & 0xc0) == 0x80);
int addr_links = 0;
if (!(a->protocol & TOPO_PROTO_TCP)) {
if (a->protocol & TOPO_PROTO_UDP) {
struct ETCP_SOCKET* s = ctx->instance->etcp_sockets;
while (s) { if (s->local_addr.ss_family == AF_INET6) {
if (is_ll) sin6.sin6_scope_id = s->netif_index;
-1
View File
@@ -10,7 +10,6 @@
#define INVITE_PROTO_UDP 0x01
#define INVITE_PROTO_TCP 0x02
#define INVITE_PROTO_BOTH 0x03
struct InviteAddr {
int family; // 4=IPv4, 6=IPv6
+3 -2
View File
@@ -234,13 +234,14 @@ QList<NodeAddr> UtunNode::getInviteAddresses(DbManager* db) {
}
}
/* 4) Merge: dedup by (addr,port), write result with merged proto */
/* 4) Dedup by (addr,port); emit one entry per proto (UDP и TCP раздельно, без BOTH) */
for (auto it = addrProto.begin(); it != addrProto.end(); ++it) {
QByteArray addr = it.key().first;
quint16 port = it.key().second;
uint8_t proto = it.value();
int family = (addr.size() == 16) ? 6 : 4;
append_from_addr_proto(addr, port, family, 0, proto);
if (proto & INVITE_PROTO_UDP) append_from_addr_proto(addr, port, family, 0, INVITE_PROTO_UDP);
if (proto & INVITE_PROTO_TCP) append_from_addr_proto(addr, port, family, 0, INVITE_PROTO_TCP);
}
}