#include "utils.h"
#include "libmeshlink.h"
-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;
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;
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;
}
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;
}