Search for lzo/lzo1x.h, lzo2/lzo1x.h and lzo1x.h.
[oweals/tinc.git] / src / net_packet.c
index 31e18b470fd552f1c53f3dd51586f0feb82c15a9..105cafbb21e3d2b90368fa739de5a1aafff95d8e 100644 (file)
@@ -29,7 +29,7 @@
 #include <openssl/hmac.h>
 
 #include <zlib.h>
-#include <lzo1x.h>
+#include LZO1X_H
 
 #include "avl_tree.h"
 #include "conf.h"
@@ -96,7 +96,7 @@ void send_mtu_probe(node_t *n)
                send_udppacket(n, &packet);
        }
 
-       n->mtuevent = xmalloc(sizeof(*n->mtuevent));
+       n->mtuevent = new_event();
        n->mtuevent->handler = (event_handler_t)send_mtu_probe;
        n->mtuevent->data = n;
        n->mtuevent->time = now + 1;
@@ -285,10 +285,11 @@ void receive_tcppacket(connection_t *c, char *buffer, int len)
        receive_packet(c->node, &outpkt);
 }
 
-static void send_udppacket(node_t *n, vpn_packet_t *inpkt)
+static void send_udppacket(node_t *n, vpn_packet_t *origpkt)
 {
        vpn_packet_t pkt1, pkt2;
        vpn_packet_t *pkt[] = { &pkt1, &pkt2, &pkt1, &pkt2 };
+       vpn_packet_t *inpkt = origpkt;
        int nextpkt = 0;
        vpn_packet_t *outpkt;
        int origlen;
@@ -404,7 +405,7 @@ static void send_udppacket(node_t *n, vpn_packet_t *inpkt)
        }
 
 end:
-       inpkt->len = origlen;
+       origpkt->len = origlen;
 }
 
 /*
@@ -457,11 +458,8 @@ void broadcast_packet(const node_t *from, vpn_packet_t *packet)
        ifdebug(TRAFFIC) logger(LOG_INFO, _("Broadcasting packet of %d bytes from %s (%s)"),
                           packet->len, from->name, from->hostname);
 
-       if(from != myself) {
-               if(overwrite_mac)
-                        memcpy(packet->data, mymac.x, ETH_ALEN);
-               write_packet(packet);
-       }
+       if(from != myself)
+               send_packet(myself, packet);
 
        for(node = connection_tree->head; node; node = node->next) {
                c = node->data;