]> git.meshlink.io Git - meshlink/commitdiff
Started the implementation of route_meshlink that at the moment routes packets based...
authorSaverio Proto <zioproto@gmail.com>
Thu, 10 Apr 2014 13:59:42 +0000 (15:59 +0200)
committerSaverio Proto <zioproto@gmail.com>
Thu, 10 Apr 2014 13:59:42 +0000 (15:59 +0200)
src/libmeshlink.c
src/route.c

index ca03b791f6d4c1b9069b12c530e8faa06abdb01d..bd6a3d28f931ad9bb92ec8ef972f45ffec9f9e9b 100644 (file)
@@ -548,6 +548,33 @@ end:
 
 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);
+       node_t* owner = NULL;
+
+       tincpackethdr* hdr = (tincpackethdr*)packet->data;
+       owner = lookup_node(hdr->destination);
+
+       if (owner == NULL) {
+       //Lookup failed
+       printf("NULL\n");
+       return false;
+       }
+       printf("lookupnode %s\n",owner->name);
+
+       if(!owner->status.reachable) {
+       //Do some here
+       return false;
+       }
+
+       //TODO: I skipped here a lot of checks !
+
+       send_packet(owner,packet);
+
+}
 // can be called from any thread
 bool tinc_send_packet(node_t *receiver, const char* buf, unsigned int len) {
 
@@ -570,7 +597,7 @@ bool tinc_send_packet(node_t *receiver, const char* buf, unsigned int len) {
 
         myself->in_packets++;
         myself->in_bytes += packet.len;
-        route(myself, &packet);
+        route_meshlink(myself, &packet);
 
 return true;
 }
index 83b9029327aa2bb3918d2e60a2d0a643a81cb16c..00ba4c05b19a7a33f5ed978270ed3b24f99b8a7a 100644 (file)
@@ -946,12 +946,6 @@ static bool do_decrement_ttl(node_t *source, vpn_packet_t *packet) {
 }
 
 void route(node_t *source, vpn_packet_t *packet) {
-
-       if (/*libmeshlink*/ 1) {
-       printf("%s\n",packet->data);
-       return;
-       }
-
        if(pcap)
                send_pcap(packet);