X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fnet_packet.c;h=f0c4e9802bd46649a175995b65c1cd2c264ebc7c;hb=ad87362afd13c4f14ce9a4b2cf0586a753b5a422;hp=1ce239d97a9ea951fa21810176dd802296d55414;hpb=b67296418c51784d39a24c3041e2cb199bee06f2;p=meshlink diff --git a/src/net_packet.c b/src/net_packet.c index 1ce239d9..f0c4e980 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -19,10 +19,6 @@ #include "system.h" -#ifdef HAVE_ZLIB -#include -#endif - #include "conf.h" #include "connection.h" #include "crypto.h" @@ -370,7 +366,7 @@ static void send_udppacket(meshlink_handle_t *mesh, node_t *n, vpn_packet_t *ori return; } - return send_sptps_packet(mesh, n, origpkt); + send_sptps_packet(mesh, n, origpkt); } bool send_sptps_data(void *handle, uint8_t type, const void *data, size_t len) { @@ -387,9 +383,9 @@ bool send_sptps_data(void *handle, uint8_t type, const void *data, size_t len) { to ensure we get to learn the reflexive UDP address. */ if(!to->status.validkey) { to->incompression = mesh->self->incompression; - return send_request(mesh, to->nexthop->connection, "%d %s %s %s -1 -1 -1 %d", ANS_KEY, mesh->self->name, to->name, buf, to->incompression); + return send_request(mesh, to->nexthop->connection, NULL, "%d %s %s %s -1 -1 -1 %d", ANS_KEY, mesh->self->name, to->name, buf, to->incompression); } else { - return send_request(mesh, to->nexthop->connection, "%d %s %s %d %s", REQ_KEY, mesh->self->name, to->name, REQ_SPTPS, buf); + return send_request(mesh, to->nexthop->connection, NULL, "%d %s %s %d %s", REQ_KEY, mesh->self->name, to->name, REQ_SPTPS, buf); } } @@ -428,7 +424,7 @@ bool receive_sptps_record(void *handle, uint8_t type, const void *data, uint16_t if(type == SPTPS_HANDSHAKE) { if(!from->status.validkey) { - logger(mesh, MESHLINK_INFO, "SPTPS key exchange with %s succesful", from->name); + logger(mesh, MESHLINK_INFO, "SPTPS key exchange with %s successful", from->name); from->status.validkey = true; from->status.waitingforkey = false; @@ -555,11 +551,13 @@ void handle_incoming_vpn_data(event_loop_t *loop, void *data, int flags) { listen_socket_t *ls = data; vpn_packet_t pkt; char *hostname; - sockaddr_t from = {}; + sockaddr_t from; socklen_t fromlen = sizeof(from); node_t *n; int len; + memset(&from, 0, sizeof(from)); + len = recvfrom(ls->udp.fd, pkt.data, MAXSIZE, 0, &from.sa, &fromlen); if(len <= 0 || len > MAXSIZE) {