Changes that should have been in commit 46fa12e666
.
This commit is contained in:
parent
46fa12e666
commit
5104001bae
1 changed files with 10 additions and 8 deletions
|
@ -1036,7 +1036,7 @@ void handle_incoming_vpn_data(void *data, int flags) {
|
||||||
node_t *from, *to;
|
node_t *from, *to;
|
||||||
bool direct = false;
|
bool direct = false;
|
||||||
|
|
||||||
int len = recvfrom(ls->udp.fd, &pkt.dstid, MAXSIZE, 0, &addr.sa, &addrlen);
|
int len = recvfrom(ls->udp.fd, &pkt.seqno, MAXSIZE, 0, &addr.sa, &addrlen);
|
||||||
|
|
||||||
if(len <= 0 || len > MAXSIZE) {
|
if(len <= 0 || len > MAXSIZE) {
|
||||||
if(!sockwouldblock(sockerrno))
|
if(!sockwouldblock(sockerrno))
|
||||||
|
@ -1054,9 +1054,9 @@ void handle_incoming_vpn_data(void *data, int flags) {
|
||||||
|
|
||||||
if(!n) {
|
if(!n) {
|
||||||
// It might be from a 1.1 node, which might have a source ID in the packet.
|
// It might be from a 1.1 node, which might have a source ID in the packet.
|
||||||
from = lookup_node_id(&pkt.srcid);
|
from = lookup_node_id(&spkt->srcid);
|
||||||
if(from && !memcmp(&pkt.dstid, &nullid, sizeof nullid) && from->status.sptps) {
|
if(from && !memcmp(&spkt->dstid, &nullid, sizeof nullid) && from->status.sptps) {
|
||||||
if(sptps_verify_datagram(&n->sptps, pkt.data, pkt.len))
|
if(sptps_verify_datagram(&n->sptps, spkt->data, spkt->len - sizeof(spkt->srcid) - sizeof(spkt->dstid)))
|
||||||
n = from;
|
n = from;
|
||||||
else
|
else
|
||||||
goto skip_harder;
|
goto skip_harder;
|
||||||
|
@ -1077,20 +1077,22 @@ skip_harder:
|
||||||
}
|
}
|
||||||
|
|
||||||
if(n->status.sptps) {
|
if(n->status.sptps) {
|
||||||
if(memcmp(&pkt.dstid, &nullid, sizeof nullid)) {
|
if(memcmp(&spkt->dstid, &nullid, sizeof nullid)) {
|
||||||
direct = true;
|
direct = true;
|
||||||
from = n;
|
from = n;
|
||||||
to = myself;
|
to = myself;
|
||||||
} else {
|
} else {
|
||||||
from = lookup_node_id(&pkt.srcid);
|
from = lookup_node_id(&spkt->srcid);
|
||||||
to = lookup_node_id(&pkt.dstid);
|
to = lookup_node_id(&spkt->dstid);
|
||||||
}
|
}
|
||||||
if(!from || !to) {
|
if(!from || !to) {
|
||||||
logger(DEBUG_PROTOCOL, LOG_WARNING, "Received UDP packet from %s (%s) with unknown source and/or destination ID", n->name, n->hostname);
|
logger(DEBUG_PROTOCOL, LOG_WARNING, "Received UDP packet from %s (%s) with unknown source and/or destination ID", n->name, n->hostname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spkt->len -= sizeof spkt->dstid + sizeof spkt->srcid;
|
||||||
if(to != myself) {
|
if(to != myself) {
|
||||||
send_sptps_data_priv(to, n, 0, pkt.data, pkt.len);
|
send_sptps_data_priv(to, n, 0, spkt->data, spkt->len);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue