X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Froute.c;h=ee36a9bfe4b17c8289d85053312a7d44ed2692c3;hb=a5a8005b2d89712e124ab7295165a3e229abdad5;hp=9255712e22682d06759ec98efc094036240fe60c;hpb=282b99f3c71705bd6e34d4e4f9e8369ea63c87ed;p=meshlink diff --git a/src/route.c b/src/route.c index 9255712e..ee36a9bf 100644 --- a/src/route.c +++ b/src/route.c @@ -25,9 +25,9 @@ #include "route.h" #include "utils.h" -bool decrement_ttl = false; - static bool checklength(node_t *source, vpn_packet_t *packet, uint16_t length) { + assert(length); + if(packet->len < length) { logger(source->mesh, MESHLINK_WARNING, "Got too short packet from %s", source->name); return false; @@ -37,6 +37,8 @@ static bool checklength(node_t *source, vpn_packet_t *packet, uint16_t length) { } void route(meshlink_handle_t *mesh, node_t *source, vpn_packet_t *packet) { + assert(source); + // TODO: route on name or key meshlink_packethdr_t *hdr = (meshlink_packethdr_t *) packet->data;