From 77e8278660d726b75739c651dd377876550570ed Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 26 Aug 2019 13:44:37 +0200 Subject: [PATCH] Import Upstream version 1.0.7 --- ChangeLog | 30 ++++++++++++++++++++++++ Makefile.in | 2 +- NEWS | 7 ++++++ README | 4 ++-- TODO | 3 --- configure | 2 +- configure.in | 2 +- doc/sample-config.tar.gz | Bin 1236 -> 1249 bytes doc/tinc.info | 2 +- po/nl.gmo | Bin 32575 -> 32575 bytes po/nl.po | 48 +++++++++++++++++++------------------- po/tinc.pot | 40 ++++++++++++++++---------------- src/bsd/device.c | 4 ++-- src/graph.c | 5 +++- src/mingw/device.c | 49 ++++++++++++++++++++++++++++----------- src/tincd.c | 6 ++--- 16 files changed, 131 insertions(+), 73 deletions(-) delete mode 100644 TODO diff --git a/ChangeLog b/ChangeLog index d954f4e..32801d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +------------------------------------------------------------------------ +r1494 | guus | 2007-01-05 06:44:01 +0100 (vr, 05 jan 2007) | 2 lines + +rename() cannot replace existing files on Windows. + +------------------------------------------------------------------------ +r1493 | guus | 2007-01-05 05:49:02 +0100 (vr, 05 jan 2007) | 4 lines + +Fix generic BSD tun device to write only the actual packet length. +Due to a copy&paste bug, it tried to write a packet with the maximum size. +This was not a problem until the maximum size was increased to support VLANs. + +------------------------------------------------------------------------ +r1492 | guus | 2007-01-04 16:28:36 +0100 (do, 04 jan 2007) | 2 lines + +Tapreader socket should be bound to localhost only. + +------------------------------------------------------------------------ +r1491 | guus | 2007-01-03 19:18:54 +0100 (wo, 03 jan 2007) | 5 lines + +Use a ringbuffer in shared memory to transfer packets from the tapreader thread to the main thread. +It's a wonder it ever worked before. The socket that is created is not of a +datagram type, therefore packet boundaries were not preserved, which becomes +a problem as soon as the TAP-Win32 device receives packets in fast succession. + +------------------------------------------------------------------------ +r1490 | guus | 2006-12-18 18:38:05 +0100 (ma, 18 dec 2006) | 2 lines + +Releasing 1.0.6. + ------------------------------------------------------------------------ r1489 | guus | 2006-12-18 12:41:53 +0100 (ma, 18 dec 2006) | 2 lines diff --git a/Makefile.in b/Makefile.in index 2b6d5eb..842e857 100644 --- a/Makefile.in +++ b/Makefile.in @@ -35,7 +35,7 @@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure ABOUT-NLS AUTHORS COPYING ChangeLog \ - INSTALL NEWS THANKS TODO config.guess config.rpath config.sub \ + INSTALL NEWS THANKS config.guess config.rpath config.sub \ depcomp install-sh missing mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/attribute.m4 \ diff --git a/NEWS b/NEWS index 04bd25f..fc13420 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +Version 1.0.7 Jan 5 2007 + + * Fixed a bug that caused slow network speeds on Windows. + + * Fixed a bug that caused tinc unable to write packets to the tun device on + OpenBSD. + Version 1.0.6 Dec 18 2006 * More flexible detection of the LZO libraries when compiling. diff --git a/README b/README index dead56f..d4eb084 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is the README file for tinc version 1.0.6. Installation +This is the README file for tinc version 1.0.7. Installation instructions may be found in the INSTALL file. tinc is Copyright (C) 1998-2006 by: @@ -55,7 +55,7 @@ should be changed into "Device", and "Device" should be changed into Compatibility ------------- -Version 1.0.6 is compatible with 1.0pre8, 1.0 and later, but not with older +Version 1.0.7 is compatible with 1.0pre8, 1.0 and later, but not with older versions of tinc. diff --git a/TODO b/TODO deleted file mode 100644 index d6a6df4..0000000 --- a/TODO +++ /dev/null @@ -1,3 +0,0 @@ -TODO LIST - -* Think of new things to do. diff --git a/configure b/configure index 5a65fc3..f0cf540 100755 --- a/configure +++ b/configure @@ -2107,7 +2107,7 @@ fi # Define the identity of the package. PACKAGE=tinc - VERSION=1.0.6 + VERSION=1.0.7 cat >>confdefs.h <<_ACEOF diff --git a/configure.in b/configure.in index 7a43320..8444ee3 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ dnl $Id: configure.in 1488 2006-12-16 16:53:58Z guus $ AC_PREREQ(2.61) AC_INIT AC_CONFIG_SRCDIR([src/tincd.c]) -AM_INIT_AUTOMAKE(tinc, 1.0.6) +AM_INIT_AUTOMAKE(tinc, 1.0.7) AC_CONFIG_HEADERS([config.h]) AM_MAINTAINER_MODE diff --git a/doc/sample-config.tar.gz b/doc/sample-config.tar.gz index 1f3ee64c1a2ab076061c7ea1e35fef8dce0f51b6..bc4437239233a87c77ce0f2f246141558a550142 100644 GIT binary patch literal 1249 zcmV<71RnbziwFSLN}fdk1MOICZ`(Ey&S(FMD>9%M5Yv+U))vTzyfp~gWkH+{=%}tHdp&<$$Uz+SlI~#GkGg|{D31EW-U0M?6V7gAnaJ|`O2j^yebUau~anS33WPZ#t<|9Xo9u!rfF_7|TL{70yCkftw0& zynkMR}LPen}T#?`^5@xl4)Z^ z=0Nch?X`K<%?BTf0HJ2mXjKaIGUG<_6eIiP>iX{D_T$Of1z@lkCv{BrMoy-|C7Npm zrM3>Lf;;S>v`3KE4&)dk!7znYZ!t1$?!lQkc_2sFRB~1GqL{N5I=RF=>E)w$Sz&@X zDB((O?-|^RQk1DMM_$L)DYk$f(-Yc1W&~x8!K4BTZYF~A<%<3-l|iap&SZ{#!^nHF zXwNO0kEIehwtKZH_ zEx_0a#HOno;CXI@wE?&gf$7BHZ5f;)s3FGH76B`rgGR(MkL{MVP8PPu5GP%hbbGAZ zXM-Viaifh>HDRgW5YR}Mw2fdu3bzW3#xgh;V_p}IfPa7>)*>TxhWF%Rw1D3LmAG{{ zg44>#8FzvZFyK9*E;=Z5hOJ@q!AGA#YvJN}1v{fo(p!!}Ri}l_;9ksOB9y>U3YmVR zBy(sh5Z}XKwm-e~+mq7I^Jt zhBT1)kmD)d7-VdP#A>9~&K8w$3|3AQ8WZ8N&dAIabF48mwH&Dz@?7She(!>_3R$C4-#6AV!~RH6dRxFx1# zg|gBixBG!vo`K_}Q)qgkYb({L%haAG?f}w=tPvCj<&3+wO`PS5UBaJlDNF$9j(nuqXykhwq L#3(;+04M+eCD(27 literal 1236 zcmV;_1S|U=iwFQjiiSl11MOICZ`(Ey&S(FMD>9%M5X+Km*=>P*$Xf%WT^7XYfPPvj ziMEMIq()Ls{qJ{2+KuD5Gltm)g6WW0FT6Y6k-Ud|WLQ}hyqzgI7L(4=UL-^rgdts{ zK@z#=sMmAXg&aj;(unYHU`$9>Rv^#5W0 z2ZMNR{$o@;f*pskUwNhTfBdGC3fVE!)-l{qg@LgsI2djX)D_q%2g@qR`AlRyK%Jq5 ziI{N%b5*6?9WQyA za(&`-Or2s2s4+dE{ZmFz))-96pQA=3*vt>>EbTi$Qy4(0nW;&#~R9 zO(`c|swc%^ga%v{<|OwqGiMoCrLp6VGy?b{6DXM>cH%L7x?%1 z9}VIL{|_RY=ARYSlwooF_=rc6XDi7AJF!H1RT><`V|HmbYe+=78qGLqnMitAD1`;2#EX5m*jI9t@ zjkMZ>MJ1eq5fh2VM7WIABD2LDYYa^dL+XWm5i3kiJcm;CWa^k>$>xqd5{pt$aORm9 z(jY`2x+yEIh=n5D1GdD}60uMCDWxGG=)xpwnKMZo{=)Zi zuP`Bk?qxnJbk(_j6h%P}$^8nVc2K8-x}kH-DHO8A`;VIQ^U>uA>U*VHdZm#<-YfiC z`Mu(Dp+t{P5eJc!o$hBL>+gV1oz?FSmp-o3XZrg(68*1a!}q^jJ<6T-vF-d9MKAHc z8#efV2-*DoFDsNm=%AJG;v3+`k4>c6)Z;6Z=k>1*`x8&C0Ud^S*T=T{$Huk#?}oj& yssBUBFv6ZpW, 1999-2006. -# Guus Sliepen , 2000-2006. +# Guus Sliepen , 2000-2007. msgid "" msgstr "" "Project-Id-Version: tinc 1.0-svn\n" "Report-Msgid-Bugs-To: tinc-devel@tinc-vpn.org\n" -"POT-Creation-Date: 2006-12-18 13:32+0100\n" -"PO-Revision-Date: 2006-11-11 16:26+0100\n" +"POT-Creation-Date: 2007-01-05 14:14+0100\n" +"PO-Revision-Date: 2007-01-05 14:14+0100\n" "Last-Translator: Guus Sliepen \n" "Language-Team: Dutch\n" "MIME-Version: 1.0\n" @@ -291,9 +291,9 @@ msgstr "Instellen prioriteit uitgaand pakket op %d" #: src/net_socket.c:158 src/tincd.c:435 src/tincd.c:472 src/process.c:198 #: src/process.c:231 src/process.c:428 src/bsd/device.c:93 #: src/bsd/device.c:112 src/cygwin/device.c:140 src/cygwin/device.c:171 -#: src/mingw/device.c:66 src/mingw/device.c:75 src/mingw/device.c:80 -#: src/mingw/device.c:236 src/mingw/device.c:243 src/mingw/device.c:248 -#: src/mingw/device.c:255 src/mingw/device.c:264 src/mingw/device.c:271 +#: src/mingw/device.c:73 src/mingw/device.c:82 src/mingw/device.c:87 +#: src/mingw/device.c:256 src/mingw/device.c:263 src/mingw/device.c:268 +#: src/mingw/device.c:275 src/mingw/device.c:284 src/mingw/device.c:291 #: src/uml_socket/device.c:89 src/uml_socket/device.c:103 #: src/uml_socket/device.c:130 src/uml_socket/device.c:194 #, c-format @@ -982,14 +982,14 @@ msgstr "%s versie %s (gemaakt %s %s, protocol %d)\n" #: src/tincd.c:411 #, c-format msgid "" -"Copyright (C) 1998-2006 Ivo Timmermans, Guus Sliepen and others.\n" +"Copyright (C) 1998-2007 Ivo Timmermans, Guus Sliepen and others.\n" "See the AUTHORS file for a complete list.\n" "\n" "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" "and you are welcome to redistribute it under certain conditions;\n" "see the file COPYING for details.\n" msgstr "" -"Copyright (C) 1998-2006 Ivo Timmermans, Guus Sliepen en anderen.\n" +"Copyright (C) 1998-2007 Ivo Timmermans, Guus Sliepen en anderen.\n" "Zie het bestand AUTHORS voor een volledige lijst.\n" "\n" "tinc wordt gedistribueerd ZONDER ENIGE GARANTIE. Dit is vrije " @@ -1368,22 +1368,22 @@ msgstr "%s is een %s" #: src/linux/device.c:133 src/linux/device.c:144 src/linux/device.c:155 #: src/solaris/device.c:125 src/bsd/device.c:152 src/bsd/device.c:181 -#: src/bsd/device.c:210 src/cygwin/device.c:239 src/mingw/device.c:103 -#: src/mingw/device.c:303 src/raw_socket/device.c:102 +#: src/bsd/device.c:210 src/cygwin/device.c:239 src/mingw/device.c:110 +#: src/mingw/device.c:323 src/raw_socket/device.c:102 #: src/uml_socket/device.c:239 #, c-format msgid "Error while reading from %s %s: %s" msgstr "Fout tijdens lezen van %s %s: %s" #: src/linux/device.c:166 src/solaris/device.c:150 src/bsd/device.c:224 -#: src/cygwin/device.c:248 src/mingw/device.c:312 src/raw_socket/device.c:111 +#: src/cygwin/device.c:248 src/mingw/device.c:333 src/raw_socket/device.c:111 #: src/uml_socket/device.c:249 #, c-format msgid "Read packet of %d bytes from %s" msgstr "Pakket van %d bytes gelezen van %s" #: src/linux/device.c:176 src/solaris/device.c:160 src/bsd/device.c:234 -#: src/cygwin/device.c:260 src/mingw/device.c:325 src/raw_socket/device.c:121 +#: src/cygwin/device.c:260 src/mingw/device.c:346 src/raw_socket/device.c:121 #: src/uml_socket/device.c:267 #, c-format msgid "Writing packet of %d bytes to %s" @@ -1397,21 +1397,21 @@ msgid "Can't write to %s %s: %s" msgstr "Kan niet schrijven naar %s %s: %s" #: src/linux/device.c:215 src/solaris/device.c:178 src/bsd/device.c:296 -#: src/cygwin/device.c:277 src/mingw/device.c:342 src/raw_socket/device.c:139 +#: src/cygwin/device.c:277 src/mingw/device.c:363 src/raw_socket/device.c:139 #: src/uml_socket/device.c:288 #, c-format msgid "Statistics for %s %s:" msgstr "Statistieken voor %s %s:" #: src/linux/device.c:216 src/solaris/device.c:179 src/bsd/device.c:297 -#: src/cygwin/device.c:278 src/mingw/device.c:343 src/raw_socket/device.c:140 +#: src/cygwin/device.c:278 src/mingw/device.c:364 src/raw_socket/device.c:140 #: src/uml_socket/device.c:289 #, c-format msgid " total bytes in: %10d" msgstr " totaal aantal bytes in: %10d" #: src/linux/device.c:217 src/solaris/device.c:180 src/bsd/device.c:298 -#: src/cygwin/device.c:279 src/mingw/device.c:344 src/raw_socket/device.c:141 +#: src/cygwin/device.c:279 src/mingw/device.c:365 src/raw_socket/device.c:141 #: src/uml_socket/device.c:290 #, c-format msgid " total bytes out: %10d" @@ -1475,7 +1475,7 @@ msgid "Unknown address family %x while reading packet from %s %s" msgstr "Onbekende adresfamilie %x tijdens ontvangst pakket van %s %s" #: src/bsd/device.c:240 src/bsd/device.c:277 src/cygwin/device.c:264 -#: src/mingw/device.c:329 +#: src/mingw/device.c:350 #, c-format msgid "Error while writing to %s %s: %s" msgstr "Fout tijdens schrijven naar %s %s: %s" @@ -1485,12 +1485,12 @@ msgstr "Fout tijdens schrijven naar %s %s: %s" msgid "Unknown address family %x while writing packet to %s %s" msgstr "Onbekende adresfamiliy %x tijdens versturen pakket naar %s %s" -#: src/cygwin/device.c:71 src/mingw/device.c:147 +#: src/cygwin/device.c:71 src/mingw/device.c:157 #, c-format msgid "Unable to read registry: %s" msgstr "Kon registry niet lezen: %s" -#: src/cygwin/device.c:123 src/mingw/device.c:198 +#: src/cygwin/device.c:123 src/mingw/device.c:208 msgid "No Windows tap device found!" msgstr "Geen Windows tap apparaat gevonden!" @@ -1499,7 +1499,7 @@ msgstr "Geen Windows tap apparaat gevonden!" msgid "Could not open Windows tap device %s (%s) for writing: %s" msgstr "Kon Windows tap apparaat %s (%s) niet openen om te schrijven: %s" -#: src/cygwin/device.c:158 src/mingw/device.c:223 +#: src/cygwin/device.c:158 src/mingw/device.c:233 #, c-format msgid "Could not get MAC address from Windows tap device %s (%s): %s" msgstr "Kon MAC adres niet achterhalen van Windows tap apparaat %s (%s): %s" @@ -1517,20 +1517,20 @@ msgstr "Taplezer is geforked en draait." msgid "Tap reader failed!" msgstr "Taplezer faalde!" -#: src/cygwin/device.c:214 src/mingw/device.c:282 +#: src/cygwin/device.c:214 src/mingw/device.c:302 msgid "Windows tap device" msgstr "Windows tap apparaat" -#: src/cygwin/device.c:216 src/mingw/device.c:284 +#: src/cygwin/device.c:216 src/mingw/device.c:304 #, c-format msgid "%s (%s) is a %s" msgstr "%s (%s) is een %s" -#: src/mingw/device.c:84 +#: src/mingw/device.c:91 msgid "Tap reader running" msgstr "Taplezer draait" -#: src/mingw/device.c:216 +#: src/mingw/device.c:226 #, c-format msgid "%s (%s) is not a usable Windows tap device: %s" msgstr "%s (%s) is geen bruikbaar Windows tap apparaat: %s" diff --git a/po/tinc.pot b/po/tinc.pot index f9c2d4a..1348e4a 100644 --- a/po/tinc.pot +++ b/po/tinc.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: tinc-devel@tinc-vpn.org\n" -"POT-Creation-Date: 2006-12-18 13:32+0100\n" +"POT-Creation-Date: 2007-01-05 14:14+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -283,9 +283,9 @@ msgstr "" #: src/net_socket.c:158 src/tincd.c:435 src/tincd.c:472 src/process.c:198 #: src/process.c:231 src/process.c:428 src/bsd/device.c:93 #: src/bsd/device.c:112 src/cygwin/device.c:140 src/cygwin/device.c:171 -#: src/mingw/device.c:66 src/mingw/device.c:75 src/mingw/device.c:80 -#: src/mingw/device.c:236 src/mingw/device.c:243 src/mingw/device.c:248 -#: src/mingw/device.c:255 src/mingw/device.c:264 src/mingw/device.c:271 +#: src/mingw/device.c:73 src/mingw/device.c:82 src/mingw/device.c:87 +#: src/mingw/device.c:256 src/mingw/device.c:263 src/mingw/device.c:268 +#: src/mingw/device.c:275 src/mingw/device.c:284 src/mingw/device.c:291 #: src/uml_socket/device.c:89 src/uml_socket/device.c:103 #: src/uml_socket/device.c:130 src/uml_socket/device.c:194 #, c-format @@ -944,7 +944,7 @@ msgstr "" #: src/tincd.c:411 #, c-format msgid "" -"Copyright (C) 1998-2006 Ivo Timmermans, Guus Sliepen and others.\n" +"Copyright (C) 1998-2007 Ivo Timmermans, Guus Sliepen and others.\n" "See the AUTHORS file for a complete list.\n" "\n" "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" @@ -1308,22 +1308,22 @@ msgstr "" #: src/linux/device.c:133 src/linux/device.c:144 src/linux/device.c:155 #: src/solaris/device.c:125 src/bsd/device.c:152 src/bsd/device.c:181 -#: src/bsd/device.c:210 src/cygwin/device.c:239 src/mingw/device.c:103 -#: src/mingw/device.c:303 src/raw_socket/device.c:102 +#: src/bsd/device.c:210 src/cygwin/device.c:239 src/mingw/device.c:110 +#: src/mingw/device.c:323 src/raw_socket/device.c:102 #: src/uml_socket/device.c:239 #, c-format msgid "Error while reading from %s %s: %s" msgstr "" #: src/linux/device.c:166 src/solaris/device.c:150 src/bsd/device.c:224 -#: src/cygwin/device.c:248 src/mingw/device.c:312 src/raw_socket/device.c:111 +#: src/cygwin/device.c:248 src/mingw/device.c:333 src/raw_socket/device.c:111 #: src/uml_socket/device.c:249 #, c-format msgid "Read packet of %d bytes from %s" msgstr "" #: src/linux/device.c:176 src/solaris/device.c:160 src/bsd/device.c:234 -#: src/cygwin/device.c:260 src/mingw/device.c:325 src/raw_socket/device.c:121 +#: src/cygwin/device.c:260 src/mingw/device.c:346 src/raw_socket/device.c:121 #: src/uml_socket/device.c:267 #, c-format msgid "Writing packet of %d bytes to %s" @@ -1337,21 +1337,21 @@ msgid "Can't write to %s %s: %s" msgstr "" #: src/linux/device.c:215 src/solaris/device.c:178 src/bsd/device.c:296 -#: src/cygwin/device.c:277 src/mingw/device.c:342 src/raw_socket/device.c:139 +#: src/cygwin/device.c:277 src/mingw/device.c:363 src/raw_socket/device.c:139 #: src/uml_socket/device.c:288 #, c-format msgid "Statistics for %s %s:" msgstr "" #: src/linux/device.c:216 src/solaris/device.c:179 src/bsd/device.c:297 -#: src/cygwin/device.c:278 src/mingw/device.c:343 src/raw_socket/device.c:140 +#: src/cygwin/device.c:278 src/mingw/device.c:364 src/raw_socket/device.c:140 #: src/uml_socket/device.c:289 #, c-format msgid " total bytes in: %10d" msgstr "" #: src/linux/device.c:217 src/solaris/device.c:180 src/bsd/device.c:298 -#: src/cygwin/device.c:279 src/mingw/device.c:344 src/raw_socket/device.c:141 +#: src/cygwin/device.c:279 src/mingw/device.c:365 src/raw_socket/device.c:141 #: src/uml_socket/device.c:290 #, c-format msgid " total bytes out: %10d" @@ -1415,7 +1415,7 @@ msgid "Unknown address family %x while reading packet from %s %s" msgstr "" #: src/bsd/device.c:240 src/bsd/device.c:277 src/cygwin/device.c:264 -#: src/mingw/device.c:329 +#: src/mingw/device.c:350 #, c-format msgid "Error while writing to %s %s: %s" msgstr "" @@ -1425,12 +1425,12 @@ msgstr "" msgid "Unknown address family %x while writing packet to %s %s" msgstr "" -#: src/cygwin/device.c:71 src/mingw/device.c:147 +#: src/cygwin/device.c:71 src/mingw/device.c:157 #, c-format msgid "Unable to read registry: %s" msgstr "" -#: src/cygwin/device.c:123 src/mingw/device.c:198 +#: src/cygwin/device.c:123 src/mingw/device.c:208 msgid "No Windows tap device found!" msgstr "" @@ -1439,7 +1439,7 @@ msgstr "" msgid "Could not open Windows tap device %s (%s) for writing: %s" msgstr "" -#: src/cygwin/device.c:158 src/mingw/device.c:223 +#: src/cygwin/device.c:158 src/mingw/device.c:233 #, c-format msgid "Could not get MAC address from Windows tap device %s (%s): %s" msgstr "" @@ -1457,20 +1457,20 @@ msgstr "" msgid "Tap reader failed!" msgstr "" -#: src/cygwin/device.c:214 src/mingw/device.c:282 +#: src/cygwin/device.c:214 src/mingw/device.c:302 msgid "Windows tap device" msgstr "" -#: src/cygwin/device.c:216 src/mingw/device.c:284 +#: src/cygwin/device.c:216 src/mingw/device.c:304 #, c-format msgid "%s (%s) is a %s" msgstr "" -#: src/mingw/device.c:84 +#: src/mingw/device.c:91 msgid "Tap reader running" msgstr "" -#: src/mingw/device.c:216 +#: src/mingw/device.c:226 #, c-format msgid "%s (%s) is not a usable Windows tap device: %s" msgstr "" diff --git a/src/bsd/device.c b/src/bsd/device.c index 8649d89..5bd253c 100644 --- a/src/bsd/device.c +++ b/src/bsd/device.c @@ -1,7 +1,7 @@ /* device.c -- Interaction BSD tun/tap device Copyright (C) 2001-2005 Ivo Timmermans, - 2001-2006 Guus Sliepen + 2001-2007 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -245,7 +245,7 @@ bool write_packet(vpn_packet_t *packet) case DEVICE_TYPE_TUNIFHEAD: { u_int32_t type; - struct iovec vector[2] = {{&type, sizeof(type)}, {packet->data + 14, MTU - 14}}; + struct iovec vector[2] = {{&type, sizeof(type)}, {packet->data + 14, packet->len - 14}}; int af; af = (packet->data[12] << 8) + packet->data[13]; diff --git a/src/graph.c b/src/graph.c index 259d715..10b3656 100644 --- a/src/graph.c +++ b/src/graph.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: graph.c 1476 2006-12-12 14:54:39Z guus $ + $Id: graph.c 1494 2007-01-05 05:44:01Z guus $ */ /* We need to generate two trees from the graph: @@ -374,6 +374,9 @@ void dump_graph(void) pclose(file); } else { fclose(file); +#ifdef HAVE_MINGW + unlink(filename); +#endif rename(tmpname, filename); free(tmpname); } diff --git a/src/mingw/device.c b/src/mingw/device.c index 388e9d5..c9fdc27 100644 --- a/src/mingw/device.c +++ b/src/mingw/device.c @@ -1,7 +1,7 @@ /* device.c -- Interaction with Windows tap driver in a MinGW environment Copyright (C) 2002-2005 Ivo Timmermans, - 2002-2006 Guus Sliepen + 2002-2007 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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: device.c 1452 2006-04-26 13:52:58Z guus $ + $Id: device.c 1496 2007-01-05 13:18:36Z guus $ */ #include "system.h" @@ -45,16 +45,23 @@ static int device_total_out = 0; extern char *myport; +static struct packetbuf { + uint8_t data[MTU]; + length_t len; +} *bufs; + +static int nbufs = 64; + DWORD WINAPI tapreader(void *bla) { int sock, err, status; struct addrinfo *ai; struct addrinfo hint = { .ai_family = AF_UNSPEC, - .ai_socktype = SOCK_DGRAM, - .ai_protocol = IPPROTO_UDP, + .ai_socktype = SOCK_STREAM, + .ai_protocol = IPPROTO_TCP, .ai_flags = 0, }; - char buf[MTU]; + unsigned char bufno = 0; long len; OVERLAPPED overlapped; @@ -67,7 +74,7 @@ DWORD WINAPI tapreader(void *bla) { return -1; } - sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); + sock = socket(ai->ai_family, SOCK_STREAM, IPPROTO_TCP); freeaddrinfo(ai); @@ -92,7 +99,7 @@ DWORD WINAPI tapreader(void *bla) { overlapped.OffsetHigh = 0; ResetEvent(overlapped.hEvent); - status = ReadFile(device_handle, buf, sizeof(buf), &len, &overlapped); + status = ReadFile(device_handle, bufs[bufno].data, MTU, &len, &overlapped); if(!status) { if(GetLastError() == ERROR_IO_PENDING) { @@ -106,8 +113,11 @@ DWORD WINAPI tapreader(void *bla) { } } - if(send(sock, buf, len, 0) <= 0) + bufs[bufno].len = len; + if(send(sock, &bufno, 1, 0) <= 0) return -1; + if(++bufno >= nbufs) + bufno = 0; } } @@ -131,8 +141,8 @@ bool setup_device(void) struct addrinfo *ai; struct addrinfo hint = { .ai_family = AF_UNSPEC, - .ai_socktype = SOCK_DGRAM, - .ai_protocol = IPPROTO_UDP, + .ai_socktype = SOCK_STREAM, + .ai_protocol = IPPROTO_TCP, .ai_flags = 0, }; @@ -228,6 +238,16 @@ bool setup_device(void) overwrite_mac = 1; } + /* Set up ringbuffer */ + + get_config_int(lookup_config(config_tree, "RingBufferSize"), &nbufs); + if(nbufs <= 1) + nbufs = 1; + else if(nbufs > 256) + nbufs = 256; + + bufs = xmalloc_and_zero(nbufs * sizeof *bufs); + /* Create a listening socket */ err = getaddrinfo(NULL, myport, &hint, &ai); @@ -237,7 +257,7 @@ bool setup_device(void) return false; } - sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); + sock = socket(ai->ai_family, SOCK_STREAM, IPPROTO_TCP); if(sock < 0) { logger(LOG_ERR, _("System call `%s' failed: %s"), "socket", strerror(errno)); @@ -295,17 +315,18 @@ void close_device(void) bool read_packet(vpn_packet_t *packet) { - int lenin; + unsigned char bufno; cp(); - if((lenin = recv(device_fd, packet->data, MTU, 0)) <= 0) { + if((recv(device_fd, &bufno, 1, 0)) <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); return false; } - packet->len = lenin; + packet->len = bufs[bufno].len; + memcpy(packet->data, bufs[bufno].data, bufs[bufno].len); device_total_in += packet->len; diff --git a/src/tincd.c b/src/tincd.c index b902af4..d0d15c3 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -1,7 +1,7 @@ /* tincd.c -- the main file for tincd Copyright (C) 1998-2005 Ivo Timmermans - 2000-2006 Guus Sliepen + 2000-2007 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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: tincd.c 1474 2006-11-29 17:18:39Z guus $ + $Id: tincd.c 1496 2007-01-05 13:18:36Z guus $ */ #include "system.h" @@ -408,7 +408,7 @@ int main(int argc, char **argv) if(show_version) { printf(_("%s version %s (built %s %s, protocol %d)\n"), PACKAGE, VERSION, __DATE__, __TIME__, PROT_CURRENT); - printf(_("Copyright (C) 1998-2006 Ivo Timmermans, Guus Sliepen and others.\n" + printf(_("Copyright (C) 1998-2007 Ivo Timmermans, Guus Sliepen and others.\n" "See the AUTHORS file for a complete list.\n\n" "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" "and you are welcome to redistribute it under certain conditions;\n"