]> git.meshlink.io Git - meshlink/blobdiff - src/protocol_key.c
Don't send UDP probes to tiny nodes.
[meshlink] / src / protocol_key.c
index 768b6371e4a03338cc98f93b06595d4fe3726da9..be81ec4a813b3b212cd42a651fcfa28d8d7ef77c 100644 (file)
@@ -26,6 +26,7 @@
 #include "netutl.h"
 #include "node.h"
 #include "prf.h"
+#include "pmtu.h"
 #include "protocol.h"
 #include "sptps.h"
 #include "utils.h"
@@ -346,8 +347,8 @@ bool req_key_h(meshlink_handle_t *mesh, connection_t *c, const char *request) {
                }
 
                size_t len = strlen(request);
-               from->in_forward += len;
-               to->out_forward += len;
+               from->in_forward += len + SPTPS_OVERHEAD;
+               to->out_forward += len + SPTPS_OVERHEAD;
 
                send_request(mesh, to->nexthop->connection, NULL, "%s", request);
        }
@@ -417,8 +418,8 @@ bool ans_key_h(meshlink_handle_t *mesh, connection_t *c, const char *request) {
 
                /* TODO: find a good way to avoid the use of strlen() */
                size_t len = strlen(request);
-               from->in_forward += len;
-               to->out_forward += len;
+               from->in_forward += len + SPTPS_OVERHEAD;
+               to->out_forward += len + SPTPS_OVERHEAD;
 
                /* Append the known UDP address of the from node, if we have a confirmed one */
                if(!*address && from->status.udp_confirmed && from->address.sa.sa_family != AF_UNSPEC) {
@@ -496,7 +497,7 @@ bool ans_key_h(meshlink_handle_t *mesh, connection_t *c, const char *request) {
                        update_node_udp(mesh, from, &sa);
                }
 
-               send_mtu_probe(mesh, from);
+               keepalive(mesh, from, true);
        }
 
        return true;