]> git.meshlink.io Git - meshlink/blobdiff - src/net_packet.c
Correctly remove all duplicates when having many hostnames in an invitation URL.
[meshlink] / src / net_packet.c
index 0510b54be8def584f8b9f33d78329b4d852baaa7..2d3d7c7711c78f0769131c37ef6976e2bbc107ba 100644 (file)
@@ -185,7 +185,14 @@ static void mtu_probe_h(meshlink_handle_t *mesh, node_t *n, vpn_packet_t *packet
                   is possible using the address and socket that the reply
                   packet used. */
 
-               n->status.udp_confirmed = true;
+               if(!n->status.udp_confirmed) {
+                       char *address, *port;
+                       sockaddr2str(&n->address, &address, &port);
+                       send_request(mesh, n->nexthop->connection, NULL, "%d %s %s . -1 -1 -1 0 %s %s", ANS_KEY, n->name, n->name, address, port);
+                       free(address);
+                       free(port);
+                       n->status.udp_confirmed = true;
+               }
 
                /* If we haven't established the PMTU yet, restart the discovery process. */
 
@@ -249,7 +256,9 @@ static void receive_udppacket(meshlink_handle_t *mesh, node_t *n, vpn_packet_t *
                return;
        }
 
-       sptps_receive_data(&n->sptps, inpkt->data, inpkt->len);
+       if(!sptps_receive_data(&n->sptps, inpkt->data, inpkt->len)) {
+               logger(mesh, MESHLINK_ERROR, "Could not process SPTPS data from %s: %s", n->name, strerror(errno));
+       }
 }
 
 static void send_sptps_packet(meshlink_handle_t *mesh, node_t *n, vpn_packet_t *origpkt) {
@@ -550,7 +559,7 @@ void handle_incoming_vpn_data(event_loop_t *loop, void *data, int flags) {
 
                if(n) {
                        update_node_udp(mesh, n, &from);
-               } else if(mesh->log_level >= MESHLINK_WARNING) {
+               } else if(mesh->log_level <= MESHLINK_WARNING) {
                        hostname = sockaddr2hostname(&from);
                        logger(mesh, MESHLINK_WARNING, "Received UDP packet from unknown source %s", hostname);
                        free(hostname);