]> git.meshlink.io Git - meshlink/blobdiff - src/libmeshlink.c
Cosmetic cleanup
[meshlink] / src / libmeshlink.c
index e88b20c46d64dd2c8ea22826869617fbf96a45e4..fd0857f644d72381955258eb8075d975e889175f 100644 (file)
@@ -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,20 +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 (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;
 
-       memcpy(packet.data,hdr,32);
-       memcpy(packet.data+32,buf,len);
+       memcpy(packet.data,hdr,sizeof(tincpackethdr));
+       memcpy(packet.data+sizeof(tincpackethdr),buf,len);
 
         myself->in_packets++;
         myself->in_bytes += packet.len;