]> git.meshlink.io Git - meshlink/blobdiff - src/route.c
Move definition of sockaddr_t to its own header, remove length_t.
[meshlink] / src / route.c
index cffb7d25ab491cf6c31590e6570a826de75afc1c..450baf9049159e944174f86b1c0623d6fd0c19ea 100644 (file)
 #include "utils.h"
 #include "libmeshlink.h"
 
-rmode_t routing_mode = RMODE_ROUTER;
-fmode_t forwarding_mode = FMODE_INTERNAL;
-bmode_t broadcast_mode = BMODE_MST;
 bool decrement_ttl = false;
-bool directonly = false;
-bool priorityinheritance = false;
-int macexpire = 600;
-mac_t mymac = {{0xFE, 0xFD, 0, 0, 0, 0}};
-bool pcap = false;
 
 static bool ratelimit(int frequency) {
        static time_t lasttime = 0;
@@ -51,7 +43,7 @@ static bool ratelimit(int frequency) {
        return false;
 }
 
-static bool checklength(node_t *source, vpn_packet_t *packet, length_t length) {
+static bool checklength(node_t *source, vpn_packet_t *packet, uint16_t length) {
        if(packet->len < length) {
                logger(DEBUG_TRAFFIC, LOG_WARNING, "Got too short packet from %s (%s)", source->name, source->hostname);
                return false;
@@ -81,8 +73,8 @@ void route(node_t *source,vpn_packet_t *packet) {
 
     if (owner == myself ) {
     //TODO: implement sending received data from meshlink library to the application
-    logger(DEBUG_TRAFFIC, LOG_WARNING, "I received a packet for me with payload: %s \n", packet->data + 46);
-    (recv_callback)(packet->data + 46);
+    logger(DEBUG_TRAFFIC, LOG_WARNING, "I received a packet for me with payload: %s \n", packet->data + sizeof *hdr);
+    (recv_callback)(packet->data + sizeof *hdr);
     return;
     }
 
@@ -98,11 +90,6 @@ void route(node_t *source,vpn_packet_t *packet) {
        return;
     }
 
-    if (directonly && owner!=via) {
-    logger(DEBUG_TRAFFIC, LOG_WARNING, "Direct Only is requested. Dropping packet because direct connection not available \n");
-    return;
-    }
-
     send_packet(owner,packet);
     return;
 }