X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fnet_packet.c;h=bb81081d25fafc3089beb320da9d44da2e6b4947;hb=38c25d62c2bc76908bd95fb21c8f5e39ad269884;hp=ffda5a1253702c3ae2733fbc084e65239f20380d;hpb=8d393b30a922110ec77d5b243347416b50cd2160;p=meshlink diff --git a/src/net_packet.c b/src/net_packet.c index ffda5a12..bb81081d 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -29,19 +29,14 @@ #include #include -#ifdef HAVE_LZO_LZO1X_H -#include -#endif -#ifdef HAVE_LZO1X_H -#include -#endif +#include LZO1X_H #include "avl_tree.h" #include "conf.h" #include "connection.h" #include "device.h" #include "ethernet.h" -#include "event.h" +#include "tevent.h" #include "graph.h" #include "list.h" #include "logger.h" @@ -101,11 +96,11 @@ void send_mtu_probe(node_t *n) send_udppacket(n, &packet); } - n->mtuevent = xmalloc(sizeof(*n->mtuevent)); + n->mtuevent = new_tevent(); n->mtuevent->handler = (event_handler_t)send_mtu_probe; n->mtuevent->data = n; n->mtuevent->time = now + 1; - event_add(n->mtuevent); + tevent_add(n->mtuevent); } void mtu_probe_h(node_t *n, vpn_packet_t *packet) { @@ -489,7 +484,7 @@ void flush_queue(node_t *n) } } -void handle_incoming_vpn_data(int sock) +void handle_incoming_vpn_data(int sock, short events, void *data) { vpn_packet_t pkt; char *hostname; @@ -520,3 +515,11 @@ void handle_incoming_vpn_data(int sock) receive_udppacket(n, &pkt); } + +void handle_device_data(int sock, short events, void *data) +{ + vpn_packet_t packet; + + if(read_packet(&packet)) + route(myself, &packet); +}