X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet.c;h=2c08dcf2460e8e175e4867f3e6a37d1098645a1e;hp=33416b3265a301ea57172d38b890df67e44461f8;hb=7db1b999c82611d6c68a5d79b4754db19669d5c6;hpb=a5e2ae6b2b2e1629cf05bb2a57df75f13c0f120a diff --git a/src/net.c b/src/net.c index 33416b32..2c08dcf2 100644 --- a/src/net.c +++ b/src/net.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net.c,v 1.35.4.107 2001/05/25 10:08:11 guus Exp $ + $Id: net.c,v 1.35.4.110 2001/05/28 08:56:57 guus Exp $ */ #include "config.h" @@ -26,8 +26,10 @@ #include #include #include -#include -#include +#ifdef HAVE_LINUX + #include + #include +#endif #include #include #include @@ -184,6 +186,17 @@ cp cp } +void receive_tcppacket(connection_t *cl, char *buffer, int len) +{ + vpn_packet_t outpkt; +cp + outpkt.len = len; + memcpy(outpkt.data, buffer, len); + + receive_packet(cl, &outpkt); +cp +} + void accept_packet(vpn_packet_t *packet) { cp @@ -203,7 +216,7 @@ cp if(write(tap_fd, packet->data - 2, packet->len + 2) < 0) syslog(LOG_ERR, _("Can't write to ethertap device: %m")); else - total_tap_out += packet->len + 2; + total_tap_out += packet->len; } cp } @@ -372,6 +385,7 @@ cp option = 1; setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option)); setsockopt(nfd, SOL_SOCKET, SO_KEEPALIVE, &option, sizeof(option)); +#ifdef HAVE_LINUX setsockopt(nfd, SOL_TCP, TCP_NODELAY, &option, sizeof(option)); option = IPTOS_LOWDELAY; @@ -386,6 +400,7 @@ cp return -1; } } +#endif memset(&a, 0, sizeof(a)); a.sin_family = AF_INET; @@ -500,11 +515,12 @@ cp option = 1; setsockopt(cl->meta_socket, SOL_SOCKET, SO_KEEPALIVE, &option, sizeof(option)); +#ifdef HAVE_LINUX setsockopt(cl->meta_socket, SOL_TCP, TCP_NODELAY, &option, sizeof(option)); option = IPTOS_LOWDELAY; setsockopt(cl->meta_socket, SOL_IP, IP_TOS, &option, sizeof(option)); - +#endif /* Connect */ a.sin_family = AF_INET; @@ -1290,7 +1306,7 @@ cp vp.len = lenin - 2; } - total_tap_in += lenin; + total_tap_in += vp.len; if(lenin < 32) {