static bool checklength(node_t *source, vpn_packet_t *packet, uint16_t length) {
if(packet->len < length) {
logger(source->mesh, MESHLINK_WARNING, "Got too short packet from %s", source->name);
static bool checklength(node_t *source, vpn_packet_t *packet, uint16_t length) {
if(packet->len < length) {
logger(source->mesh, MESHLINK_WARNING, "Got too short packet from %s", source->name);
void route(meshlink_handle_t *mesh, node_t *source, vpn_packet_t *packet) {
// TODO: route on name or key
void route(meshlink_handle_t *mesh, node_t *source, vpn_packet_t *packet) {
// TODO: route on name or key
logger(mesh, MESHLINK_DEBUG, "Routing packet from \"%s\" to \"%s\"\n", hdr->source, hdr->destination);
//Check Length
logger(mesh, MESHLINK_DEBUG, "Routing packet from \"%s\" to \"%s\"\n", hdr->source, hdr->destination);
//Check Length
- logger(mesh, MESHLINK_WARNING, "Can't lookup the owner of a packet in the route() function. This should never happen!\n");
+ logger(mesh, MESHLINK_WARNING, "Can't lookup the destination of a packet in the route() function. This should never happen!\n");
logger(mesh, MESHLINK_WARNING, "Destination was: %s\n", hdr->destination);
return;
}
logger(mesh, MESHLINK_WARNING, "Destination was: %s\n", hdr->destination);
return;
}
- logger(mesh, MESHLINK_WARNING, "The owner of a packet in the route() function is unreachable. Dropping packet.\n");
+ logger(mesh, MESHLINK_WARNING, "The destination of a packet in the route() function is unreachable. Dropping packet.\n");
logger(mesh, MESHLINK_ERROR, "Routing loop for packet from %s!", source->name);
return;
}
logger(mesh, MESHLINK_ERROR, "Routing loop for packet from %s!", source->name);
return;
}