X-Git-Url: http://git.meshlink.io/?p=meshlink;a=blobdiff_plain;f=src%2Froute.c;h=ee36a9bfe4b17c8289d85053312a7d44ed2692c3;hp=9255712e22682d06759ec98efc094036240fe60c;hb=963c5055505f2fc117cd5efa06eaa02c9b2bf85d;hpb=282b99f3c71705bd6e34d4e4f9e8369ea63c87ed 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;