X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Flibmeshlink.c;h=fd0857f644d72381955258eb8075d975e889175f;hb=2c9e02be099753999a3eab55bd2fed4ab4470f2b;hp=67d945e04800752940204324c4d6cbd0e864d78f;hpb=28f92f84d5adb5b0b07abab7cb72c4eceb0ca1ec;p=meshlink diff --git a/src/libmeshlink.c b/src/libmeshlink.c index 67d945e0..fd0857f6 100644 --- a/src/libmeshlink.c +++ b/src/libmeshlink.c @@ -534,9 +534,8 @@ bool tinc_stop(); bool route_meshlink(node_t *source,vpn_packet_t *packet) { - printf("data %s\n",packet->data); - printf("data 11%s\n",packet->data+11); - printf("data 32%s\n",packet->data+32); + printf("data %s\n",packet->data+14); + printf("data 46%s\n",packet->data+sizeof(tincpackethdr)); node_t* owner = NULL; tincpackethdr* hdr = (tincpackethdr*)packet->data; @@ -564,22 +563,21 @@ bool tinc_send_packet(node_t *receiver, const char* buf, unsigned int len) { vpn_packet_t packet; tincpackethdr* hdr = malloc(sizeof(tincpackethdr)); - - if (14 + sizeof(hdr) + len > MAXSIZE) { + if (sizeof(tincpackethdr) + len > MAXSIZE) { //log something return false; } + memset(hdr->legacymtu,1,sizeof(hdr->legacymtu)); memcpy(hdr->destination,receiver->name,sizeof(hdr->destination)); memcpy(hdr->source,myself->name,sizeof(hdr->source)); packet.priority = 0; packet.len = sizeof(tincpackethdr) + len; - memset(packet.data,1,14); - memcpy(packet.data+14,hdr,32); - memcpy(packet.data+32+14,buf,len); + memcpy(packet.data,hdr,sizeof(tincpackethdr)); + memcpy(packet.data+sizeof(tincpackethdr),buf,len); myself->in_packets++; myself->in_bytes += packet.len;