From f85d80c1974bd96543bdd6dd584f841c99d3ca1b Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 8 Oct 2021 20:54:45 +0200 Subject: [PATCH] Account for SPTPS overhead. --- src/protocol_key.c | 8 ++++---- src/route.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/protocol_key.c b/src/protocol_key.c index 768b6371..745845a6 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -346,8 +346,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 +417,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) { diff --git a/src/route.c b/src/route.c index 25256de3..c63c0373 100644 --- a/src/route.c +++ b/src/route.c @@ -61,11 +61,11 @@ void route(meshlink_handle_t *mesh, node_t *source, vpn_packet_t *packet) { // Channel traffic accounting if(source == mesh->self) { - dest->out_data += len; + dest->out_data += len + SPTPS_OVERHEAD; } if(dest == mesh->self) { - source->in_data += len; + source->in_data += len + SPTPS_OVERHEAD; const void *payload = packet->data + sizeof(*hdr); char hex[len * 2 + 1]; -- 2.39.5