Compare commits

..

No commits in common. "master" and "debian/1.0.4-2" have entirely different histories.

223 changed files with 39710 additions and 36581 deletions

625
ABOUT-NLS Normal file
View file

@ -0,0 +1,625 @@
Notes on the Free Translation Project
*************************************
Free software is going international! The Free Translation Project
is a way to get maintainers of free software, translators, and users all
together, so that will gradually become able to speak many languages.
A few packages already provide translations for their messages.
If you found this `ABOUT-NLS' file inside a distribution, you may
assume that the distributed package does use GNU `gettext' internally,
itself available at your nearest GNU archive site. But you do _not_
need to install GNU `gettext' prior to configuring, installing or using
this package with messages translated.
Installers will find here some useful hints. These notes also
explain how users should proceed for getting the programs to use the
available translations. They tell how people wanting to contribute and
work at translations should contact the appropriate team.
When reporting bugs in the `intl/' directory or bugs which may be
related to internationalization, you should tell about the version of
`gettext' which is used. The information can be found in the
`intl/VERSION' file, in internationalized packages.
Quick configuration advice
==========================
If you want to exploit the full power of internationalization, you
should configure it using
./configure --with-included-gettext
to force usage of internationalizing routines provided within this
package, despite the existence of internationalizing capabilities in the
operating system where this package is being installed. So far, only
the `gettext' implementation in the GNU C library version 2 provides as
many features (such as locale alias, message inheritance, automatic
charset conversion or plural form handling) as the implementation here.
It is also not possible to offer this additional functionality on top
of a `catgets' implementation. Future versions of GNU `gettext' will
very likely convey even more functionality. So it might be a good idea
to change to GNU `gettext' as soon as possible.
So you need _not_ provide this option if you are using GNU libc 2 or
you have installed a recent copy of the GNU gettext package with the
included `libintl'.
INSTALL Matters
===============
Some packages are "localizable" when properly installed; the
programs they contain can be made to speak your own native language.
Most such packages use GNU `gettext'. Other packages have their own
ways to internationalization, predating GNU `gettext'.
By default, this package will be installed to allow translation of
messages. It will automatically detect whether the system already
provides the GNU `gettext' functions. If not, the GNU `gettext' own
library will be used. This library is wholly contained within this
package, usually in the `intl/' subdirectory, so prior installation of
the GNU `gettext' package is _not_ required. Installers may use
special options at configuration time for changing the default
behaviour. The commands:
./configure --with-included-gettext
./configure --disable-nls
will respectively bypass any pre-existing `gettext' to use the
internationalizing routines provided within this package, or else,
_totally_ disable translation of messages.
When you already have GNU `gettext' installed on your system and run
configure without an option for your new package, `configure' will
probably detect the previously built and installed `libintl.a' file and
will decide to use this. This might be not what is desirable. You
should use the more recent version of the GNU `gettext' library. I.e.
if the file `intl/VERSION' shows that the library which comes with this
package is more recent, you should use
./configure --with-included-gettext
to prevent auto-detection.
The configuration process will not test for the `catgets' function
and therefore it will not be used. The reason is that even an
emulation of `gettext' on top of `catgets' could not provide all the
extensions of the GNU `gettext' library.
Internationalized packages have usually many `po/LL.po' files, where
LL gives an ISO 639 two-letter code identifying the language. Unless
translations have been forbidden at `configure' time by using the
`--disable-nls' switch, all available translations are installed
together with the package. However, the environment variable `LINGUAS'
may be set, prior to configuration, to limit the installed set.
`LINGUAS' should then contain a space separated list of two-letter
codes, stating which languages are allowed.
Using This Package
==================
As a user, if your language has been installed for this package, you
only have to set the `LANG' environment variable to the appropriate
`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code,
and `CC' is an ISO 3166 two-letter country code. For example, let's
suppose that you speak German and live in Germany. At the shell
prompt, merely execute `setenv LANG de_DE' (in `csh'),
`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash').
This can be done from your `.login' or `.profile' file, once and for
all.
You might think that the country code specification is redundant.
But in fact, some languages have dialects in different countries. For
example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The
country code serves to distinguish the dialects.
The locale naming convention of `LL_CC', with `LL' denoting the
language and `CC' denoting the country, is the one use on systems based
on GNU libc. On other systems, some variations of this scheme are
used, such as `LL' or `LL_CC.ENCODING'. You can get the list of
locales supported by your system for your country by running the command
`locale -a | grep '^LL''.
Not all programs have translations for all languages. By default, an
English message is shown in place of a nonexistent translation. If you
understand other languages, you can set up a priority list of languages.
This is done through a different environment variable, called
`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG'
for the purpose of message handling, but you still need to have `LANG'
set to the primary language; this is required by other parts of the
system libraries. For example, some Swedish users who would rather
read translations in German than English for when Swedish is not
available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'.
In the `LANGUAGE' environment variable, but not in the `LANG'
environment variable, `LL_CC' combinations can be abbreviated as `LL'
to denote the language's main dialect. For example, `de' is equivalent
to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
(Portuguese as spoken in Portugal) in this context.
Translating Teams
=================
For the Free Translation Project to be a success, we need interested
people who like their own language and write it well, and who are also
able to synergize with other translators speaking the same language.
Each translation team has its own mailing list. The up-to-date list of
teams can be found at the Free Translation Project's homepage,
`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams"
area.
If you'd like to volunteer to _work_ at translating messages, you
should become a member of the translating team for your own language.
The subscribing address is _not_ the same as the list itself, it has
`-request' appended. For example, speakers of Swedish can send a
message to `sv-request@li.org', having this message body:
subscribe
Keep in mind that team members are expected to participate
_actively_ in translations, or at solving translational difficulties,
rather than merely lurking around. If your team does not exist yet and
you want to start one, or if you are unsure about what to do or how to
get started, please write to `translation@iro.umontreal.ca' to reach the
coordinator for all translator teams.
The English team is special. It works at improving and uniformizing
the terminology in use. Proven linguistic skill are praised more than
programming skill, here.
Available Packages
==================
Languages are not equally supported in all packages. The following
matrix shows the current state of internationalization, as of May 2003.
The matrix shows, in regard of each package, for which languages PO
files have been submitted to translation coordination, with a
translation percentage of at least 50%.
Ready PO files am az be bg ca cs da de el en en_GB eo es
+-------------------------------------------+
a2ps | [] [] [] [] |
aegis | () |
anubis | |
ap-utils | |
bash | [] [] [] |
batchelor | |
bfd | [] [] |
binutils | [] [] |
bison | [] [] [] |
bluez-pin | [] [] |
clisp | |
clisp | [] [] [] |
coreutils | [] [] [] [] |
cpio | [] [] [] |
darkstat | () [] |
diffutils | [] [] [] [] [] [] [] |
e2fsprogs | [] [] |
enscript | [] [] [] [] |
error | [] [] [] [] [] |
fetchmail | [] () [] [] [] [] |
fileutils | [] [] [] |
findutils | [] [] [] [] [] [] |
flex | [] [] [] [] |
gas | [] |
gawk | [] [] [] [] |
gcal | [] |
gcc | [] [] |
gettext | [] [] [] [] [] |
gettext-runtime | [] [] [] [] [] |
gettext-tools | [] [] |
gimp-print | [] [] [] [] [] |
gliv | |
glunarclock | [] [] [] |
gnucash | () [] |
gnucash-glossary | [] () [] |
gnupg | [] () [] [] [] [] |
gpe-calendar | [] |
gpe-conf | [] |
gpe-contacts | [] |
gpe-edit | |
gpe-login | [] |
gpe-ownerinfo | [] |
gpe-sketchbook | [] |
gpe-timesheet | |
gpe-today | [] |
gpe-todo | [] |
gphoto2 | [] [] [] [] |
gprof | [] [] |
gpsdrive | () () () |
grep | [] [] [] [] [] |
gretl | [] |
hello | [] [] [] [] [] [] |
id-utils | [] [] |
indent | [] [] [] [] |
jpilot | [] [] [] [] |
jwhois | [] |
kbd | [] [] [] [] [] |
ld | [] [] |
libc | [] [] [] [] [] [] |
libgpewidget | [] |
libiconv | [] [] [] [] [] |
lifelines | [] () |
lilypond | [] |
lingoteach | |
lingoteach_lessons | () () |
lynx | [] [] [] [] |
m4 | [] [] [] [] |
mailutils | [] [] |
make | [] [] [] |
man-db | [] () [] [] () |
mysecretdiary | [] [] [] |
nano | [] () [] [] [] |
nano_1_0 | [] () [] [] [] |
opcodes | [] [] |
parted | [] [] [] [] [] |
ptx | [] [] [] [] [] |
python | |
radius | |
recode | [] [] [] [] [] [] |
screem | |
sed | [] [] [] [] [] |
sh-utils | [] [] [] |
sharutils | [] [] [] [] [] [] |
sketch | [] () [] |
soundtracker | [] [] [] |
sp | [] |
tar | [] [] [] [] |
texinfo | [] [] [] [] |
textutils | [] [] [] [] |
tin | () () |
util-linux | [] [] [] [] [] |
vorbis-tools | [] [] [] |
wastesedge | () |
wdiff | [] [] [] [] |
wget | [] [] [] [] [] [] [] |
xchat | [] [] [] |
xpad | |
+-------------------------------------------+
am az be bg ca cs da de el en en_GB eo es
0 1 4 2 31 17 54 60 14 1 4 12 56
et fa fi fr ga gl he hr hu id it ja ko
+----------------------------------------+
a2ps | [] [] [] () () |
aegis | |
anubis | [] |
ap-utils | [] |
bash | [] [] |
batchelor | [] |
bfd | [] [] |
binutils | [] [] |
bison | [] [] [] [] |
bluez-pin | [] [] [] [] |
clisp | |
clisp | [] |
coreutils | [] [] [] [] |
cpio | [] [] [] [] |
darkstat | () [] [] [] |
diffutils | [] [] [] [] [] [] [] |
e2fsprogs | |
enscript | [] [] |
error | [] [] [] [] |
fetchmail | [] |
fileutils | [] [] [] [] [] |
findutils | [] [] [] [] [] [] [] [] [] [] [] |
flex | [] [] |
gas | [] |
gawk | [] [] |
gcal | [] |
gcc | [] |
gettext | [] [] [] |
gettext-runtime | [] [] [] [] |
gettext-tools | [] |
gimp-print | [] [] |
gliv | () |
glunarclock | [] [] [] [] |
gnucash | [] |
gnucash-glossary | [] |
gnupg | [] [] [] [] [] [] [] |
gpe-calendar | [] |
gpe-conf | |
gpe-contacts | [] |
gpe-edit | [] [] |
gpe-login | [] |
gpe-ownerinfo | [] [] [] |
gpe-sketchbook | [] |
gpe-timesheet | [] [] [] |
gpe-today | [] [] |
gpe-todo | [] [] |
gphoto2 | [] [] [] |
gprof | [] [] |
gpsdrive | () [] () () |
grep | [] [] [] [] [] [] [] [] [] [] [] |
gretl | [] |
hello | [] [] [] [] [] [] [] [] [] [] [] [] [] |
id-utils | [] [] [] |
indent | [] [] [] [] [] [] [] [] |
jpilot | [] () |
jwhois | [] [] [] [] |
kbd | [] |
ld | [] |
libc | [] [] [] [] [] [] |
libgpewidget | [] [] [] |
libiconv | [] [] [] [] [] [] [] [] |
lifelines | () |
lilypond | [] |
lingoteach | [] [] |
lingoteach_lessons | |
lynx | [] [] [] [] |
m4 | [] [] [] [] |
mailutils | |
make | [] [] [] [] [] [] |
man-db | [] () () |
mysecretdiary | [] [] |
nano | [] [] [] [] |
nano_1_0 | [] [] [] [] |
opcodes | [] [] |
parted | [] [] [] |
ptx | [] [] [] [] [] [] [] |
python | |
radius | |
recode | [] [] [] [] [] [] |
screem | |
sed | [] [] [] [] [] [] [] [] |
sh-utils | [] [] [] [] [] [] |
sharutils | [] [] [] [] [] |
sketch | [] |
soundtracker | [] [] [] |
sp | [] () |
tar | [] [] [] [] [] [] [] [] [] |
texinfo | [] [] [] [] |
textutils | [] [] [] [] [] |
tin | [] () |
util-linux | [] [] [] [] () [] |
vorbis-tools | [] |
wastesedge | () |
wdiff | [] [] [] [] [] |
wget | [] [] [] [] [] [] [] [] |
xchat | [] [] [] |
xpad | |
+----------------------------------------+
et fa fi fr ga gl he hr hu id it ja ko
20 1 15 73 14 24 8 10 30 31 19 31 9
lg lt lv ms nb nl nn no pl pt pt_BR ro
+----------------------------------------+
a2ps | [] [] () () () [] [] |
aegis | () |
anubis | [] [] |
ap-utils | () |
bash | [] |
batchelor | |
bfd | |
binutils | |
bison | [] [] [] [] |
bluez-pin | [] |
clisp | |
clisp | [] |
coreutils | [] |
cpio | [] [] [] |
darkstat | [] [] [] [] |
diffutils | [] [] [] |
e2fsprogs | |
enscript | [] [] |
error | [] [] |
fetchmail | () () |
fileutils | [] |
findutils | [] [] [] [] |
flex | [] |
gas | |
gawk | [] |
gcal | |
gcc | |
gettext | [] |
gettext-runtime | [] |
gettext-tools | |
gimp-print | [] |
gliv | [] |
glunarclock | [] |
gnucash | |
gnucash-glossary | [] [] |
gnupg | |
gpe-calendar | [] [] |
gpe-conf | [] [] |
gpe-contacts | [] |
gpe-edit | [] [] |
gpe-login | [] [] |
gpe-ownerinfo | [] [] |
gpe-sketchbook | [] [] |
gpe-timesheet | [] [] |
gpe-today | [] [] |
gpe-todo | [] [] |
gphoto2 | |
gprof | [] |
gpsdrive | () () () |
grep | [] [] [] [] |
gretl | |
hello | [] [] [] [] [] [] [] [] [] |
id-utils | [] [] [] |
indent | [] [] [] |
jpilot | () () |
jwhois | [] [] [] |
kbd | |
ld | |
libc | [] [] [] [] |
libgpewidget | [] [] |
libiconv | [] [] |
lifelines | |
lilypond | [] |
lingoteach | |
lingoteach_lessons | |
lynx | [] [] |
m4 | [] [] [] [] |
mailutils | |
make | [] [] |
man-db | [] |
mysecretdiary | [] |
nano | [] [] [] [] |
nano_1_0 | [] [] [] [] |
opcodes | [] [] [] |
parted | [] [] [] |
ptx | [] [] [] [] [] [] [] |
python | |
radius | |
recode | [] [] [] |
screem | |
sed | [] [] |
sh-utils | [] |
sharutils | [] |
sketch | [] |
soundtracker | |
sp | |
tar | [] [] [] [] [] [] |
texinfo | [] |
textutils | [] |
tin | |
util-linux | [] [] |
vorbis-tools | [] [] |
wastesedge | |
wdiff | [] [] [] [] |
wget | [] [] [] |
xchat | [] [] |
xpad | [] |
+----------------------------------------+
lg lt lv ms nb nl nn no pl pt pt_BR ro
0 0 2 11 7 26 3 4 18 15 34 34
ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW
+-------------------------------------------+
a2ps | [] [] [] [] [] | 16
aegis | () | 0
anubis | [] [] | 5
ap-utils | () | 1
bash | [] | 7
batchelor | | 1
bfd | [] [] [] | 7
binutils | [] [] [] | 7
bison | [] [] | 13
bluez-pin | | 7
clisp | | 0
clisp | | 5
coreutils | [] [] [] [] [] | 14
cpio | [] [] [] | 13
darkstat | [] () () | 9
diffutils | [] [] [] [] | 21
e2fsprogs | [] | 3
enscript | [] [] [] | 11
error | [] [] [] | 14
fetchmail | [] | 7
fileutils | [] [] [] [] [] [] | 15
findutils | [] [] [] [] [] [] | 27
flex | [] [] [] | 10
gas | [] | 3
gawk | [] [] | 9
gcal | [] [] | 4
gcc | [] | 4
gettext | [] [] [] [] [] [] | 15
gettext-runtime | [] [] [] [] [] [] | 16
gettext-tools | [] [] | 5
gimp-print | [] [] | 10
gliv | | 1
glunarclock | [] [] [] | 11
gnucash | [] [] | 4
gnucash-glossary | [] [] [] | 8
gnupg | [] [] [] [] | 16
gpe-calendar | [] | 5
gpe-conf | | 3
gpe-contacts | [] | 4
gpe-edit | [] | 5
gpe-login | [] | 5
gpe-ownerinfo | [] | 7
gpe-sketchbook | [] | 5
gpe-timesheet | [] | 6
gpe-today | [] | 6
gpe-todo | [] | 6
gphoto2 | [] [] | 9
gprof | [] [] | 7
gpsdrive | [] [] | 3
grep | [] [] [] [] | 24
gretl | | 2
hello | [] [] [] [] [] | 33
id-utils | [] [] [] | 11
indent | [] [] [] [] | 19
jpilot | [] [] [] [] [] | 10
jwhois | () () [] [] | 10
kbd | [] [] | 8
ld | [] [] | 5
libc | [] [] [] [] | 20
libgpewidget | | 6
libiconv | [] [] [] [] [] [] | 21
lifelines | [] | 2
lilypond | [] | 4
lingoteach | | 2
lingoteach_lessons | () | 0
lynx | [] [] [] [] | 14
m4 | [] [] [] | 15
mailutils | | 2
make | [] [] [] [] | 15
man-db | [] | 6
mysecretdiary | [] [] | 8
nano | [] [] [] | 15
nano_1_0 | [] [] [] | 15
opcodes | [] [] | 9
parted | [] [] | 13
ptx | [] [] [] | 22
python | | 0
radius | | 0
recode | [] [] [] [] | 19
screem | [] | 1
sed | [] [] [] [] [] | 20
sh-utils | [] [] [] | 13
sharutils | [] [] [] [] | 16
sketch | [] | 5
soundtracker | [] | 7
sp | [] | 3
tar | [] [] [] [] [] | 24
texinfo | [] [] [] [] | 13
textutils | [] [] [] [] [] | 15
tin | | 1
util-linux | [] [] | 14
vorbis-tools | [] | 7
wastesedge | | 0
wdiff | [] [] [] [] | 17
wget | [] [] [] [] [] [] [] | 25
xchat | [] [] [] | 11
xpad | | 1
+-------------------------------------------+
50 teams ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW
97 domains 32 19 16 0 56 0 48 10 1 1 12 23 913
Some counters in the preceding matrix are higher than the number of
visible blocks let us expect. This is because a few extra PO files are
used for implementing regional variants of languages, or language
dialects.
For a PO file in the matrix above to be effective, the package to
which it applies should also have been internationalized and
distributed as such by its maintainer. There might be an observable
lag between the mere existence a PO file and its wide availability in a
distribution.
If May 2003 seems to be old, you may fetch a more recent copy of
this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date
matrix with full percentage details can be found at
`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
Using `gettext' in new packages
===============================
If you are writing a freely available program and want to
internationalize it you are welcome to use GNU `gettext' in your
package. Of course you have to respect the GNU Library General Public
License which covers the use of the GNU `gettext' library. This means
in particular that even non-free programs can use `libintl' as a shared
library, whereas only free software can use `libintl' as a static
library or use modified versions of `libintl'.
Once the sources are changed appropriately and the setup can handle
the use of `gettext' the only thing missing are the translations. The
Free Translation Project is also available for packages which are not
developed inside the GNU project. Therefore the information given above
applies also for every other Free Software Project. Contact
`translation@iro.umontreal.ca' to make the `.pot' files available to
the translation teams.

18
AUTHORS
View file

@ -1,25 +1,11 @@
Main tinc authors: Main tinc authors:
- Guus Sliepen <guus@tinc-vpn.org> Guus Sliepen <guus@tinc-vpn.org>
- Ivo Timmermans (inactive) Ivo Timmermans <ivo@tinc-vpn.org>
Significant contributions from:
- Michael Tokarev <mjt@tls.msk.ru>
- Florian Forster <octo@verplant.org>
- Grzegorz Dymarek <gregd72002@googlemail.com>
- Max Rijevski <maksuf@gmail.com>
- Scott Lamb <slamb@slamb.org>
- Julien Muchembled <jm@jmuchemb.eu>
- Timothy Redaelli <timothy@redaelli.eu>
- Brandon Black <blblack@gmail.com>
- Loïc Grenié <loic.grenie@gmail.com>
These files are from other sources: These files are from other sources:
* lib/pidfile.h and lib/pidfile.c are by Martin Schulze, taken from * lib/pidfile.h and lib/pidfile.c are by Martin Schulze, taken from
the syslog 1.3 sources. the syslog 1.3 sources.
* src/bsd/tunemu.c and tunemu.h are by Friedrich Schöller
<friedrich.schoeller@gmail.com>
Also some of the macro files in the directory m4, and their Also some of the macro files in the directory m4, and their
accompanying files in lib, were taken from GNU fileutils. accompanying files in lib, were taken from GNU fileutils.

83
COPYING
View file

@ -1,17 +1,8 @@
Copyright (C) 1998-2019 Ivo Timmermans, Guus Sliepen and others.
See the AUTHORS file for a complete list.
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 the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 2, June 1991 Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
@ -24,7 +15,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to the GNU Library General Public License instead.) You can apply it to
your programs, too. your programs, too.
When we speak of free software, we are referring to freedom, not When we speak of free software, we are referring to freedom, not
@ -64,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and The precise terms and conditions for copying, distribution and
modification follow. modification follow.
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@ -119,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on does not normally print such an announcement, your work based on
the Program is not required to print an announcement.) the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program, identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in and can be reasonably considered independent and separate works in
@ -177,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not distribution of the source code, even though third parties are not
compelled to copy the source along with the object code. compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program 4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is otherwise to copy, modify, sublicense or distribute the Program is
@ -234,7 +225,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License. be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in 8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License original copyright holder who places the Program under this License
@ -287,3 +278,63 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View file

@ -7,13 +7,8 @@ of the GPL are met.
The following applies to the LZO library: The following applies to the LZO library:
Hereby I grant a special exception to the tinc VPN project Hereby I grant a special exception to the tinc VPN project
(http://tinc.nl.linux.org/) to link the LZO library with the OpenSSL library (http://tinc.nl.linux.org/) to link the LZO library with the OpenSSL library
(http://www.openssl.org). (http://www.openssl.org).
Markus F.X.J. Oberhumer
When tinc is compiled with the --enable-tunemu option, the resulting binary
falls under the GPL version 3 or later.
Markus F.X.J. Oberhumer

8122
ChangeLog

File diff suppressed because it is too large Load diff

386
INSTALL
View file

@ -1,368 +1,236 @@
Installation Instructions Installation Instructions
************************* *************************
Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
Foundation, Inc. Software Foundation, Inc.
Copying and distribution of this file, with or without modification, This file is free documentation; the Free Software Foundation gives
are permitted in any medium without royalty provided the copyright unlimited permission to copy, distribute and modify it.
notice and this notice are preserved. This file is offered as-is,
without warranty of any kind.
Basic Installation Basic Installation
================== ==================
Briefly, the shell command './configure && make && make install' These are generic installation instructions.
should configure, build, and install this package. The following
more-detailed instructions are generic; see the 'README' file for
instructions specific to this package. Some packages provide this
'INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
The 'configure' shell script attempts to guess correct values for The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses various system-dependent variables used during compilation. It uses
those values to create a 'Makefile' in each directory of the package. those values to create a `Makefile' in each directory of the package.
It may also create one or more '.h' files containing system-dependent It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script 'config.status' that definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a you can run in the future to recreate the current configuration, and a
file 'config.log' containing compiler output (useful mainly for file `config.log' containing compiler output (useful mainly for
debugging 'configure'). debugging `configure').
It can also use an optional file (typically called 'config.cache' and It can also use an optional file (typically called `config.cache'
enabled with '--cache-file=config.cache' or simply '-C') that saves the and enabled with `--cache-file=config.cache' or simply `-C') that saves
results of its tests to speed up reconfiguring. Caching is disabled by the results of its tests to speed up reconfiguring. (Caching is
default to prevent problems with accidental use of stale cache files. disabled by default to prevent problems with accidental use of stale
cache files.)
If you need to do unusual things to compile the package, please try If you need to do unusual things to compile the package, please try
to figure out how 'configure' could check whether to do them, and mail to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the 'README' so they can diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at be considered for the next release. If you are using the cache, and at
some point 'config.cache' contains results you don't want to keep, you some point `config.cache' contains results you don't want to keep, you
may remove or edit it. may remove or edit it.
The file 'configure.ac' (or 'configure.in') is used to create The file `configure.ac' (or `configure.in') is used to create
'configure' by a program called 'autoconf'. You need 'configure.ac' if `configure' by a program called `autoconf'. You only need
you want to change it or regenerate 'configure' using a newer version of `configure.ac' if you want to change it or regenerate `configure' using
'autoconf'. a newer version of `autoconf'.
The simplest way to compile this package is: The simplest way to compile this package is:
1. 'cd' to the directory containing the package's source code and type 1. `cd' to the directory containing the package's source code and type
'./configure' to configure the package for your system. `./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running 'configure' might take a while. While running, it prints Running `configure' takes awhile. While running, it prints some
some messages telling which features it is checking for. messages telling which features it is checking for.
2. Type 'make' to compile the package. 2. Type `make' to compile the package.
3. Optionally, type 'make check' to run any self-tests that come with 3. Optionally, type `make check' to run any self-tests that come with
the package, generally using the just-built uninstalled binaries. the package.
4. Type 'make install' to install the programs and any data files and 4. Type `make install' to install the programs and any data files and
documentation. When installing into a prefix owned by root, it is documentation.
recommended that the package be configured and built as a regular
user, and only the 'make install' phase executed with root
privileges.
5. Optionally, type 'make installcheck' to repeat any self-tests, but 5. You can remove the program binaries and object files from the
this time using the binaries in their final installed location. source code directory by typing `make clean'. To also remove the
This target does not install anything. Running this target as a files that `configure' created (so you can compile the package for
regular user, particularly if the prior 'make install' required a different kind of computer), type `make distclean'. There is
root privileges, verifies that the installation completed also a `make maintainer-clean' target, but that is intended mainly
correctly.
6. You can remove the program binaries and object files from the
source code directory by typing 'make clean'. To also remove the
files that 'configure' created (so you can compile the package for
a different kind of computer), type 'make distclean'. There is
also a 'make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came all sorts of other programs in order to regenerate files that came
with the distribution. with the distribution.
7. Often, you can also type 'make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
8. Some packages, particularly those that use Automake, provide 'make
distcheck', which can by used by developers to test that all other
targets like 'make install' and 'make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options Compilers and Options
===================== =====================
Some systems require unusual options for compilation or linking that Some systems require unusual options for compilation or linking that the
the 'configure' script does not know about. Run './configure --help' `configure' script does not know about. Run `./configure --help' for
for details on some of the pertinent environment variables. details on some of the pertinent environment variables.
You can give 'configure' initial values for configuration parameters You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here is by setting variables in the command line or in the environment. Here
an example: is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
*Note Defining Variables::, for more details. *Note Defining Variables::, for more details.
Compiling For Multiple Architectures Compiling For Multiple Architectures
==================================== ====================================
You can compile the package for more than one kind of computer at the You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU 'make'. 'cd' to the own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run directory where you want the object files and executables to go and run
the 'configure' script. 'configure' automatically checks for the source the `configure' script. `configure' automatically checks for the
code in the directory that 'configure' is in and in '..'. This is known source code in the directory that `configure' is in and in `..'.
as a "VPATH" build.
With a non-GNU 'make', it is safer to compile the package for one If you have to use a `make' that does not support the `VPATH'
architecture at a time in the source code directory. After you have variable, you have to compile the package for one architecture at a
installed the package for one architecture, use 'make distclean' before time in the source code directory. After you have installed the
reconfiguring for another architecture. package for one architecture, use `make distclean' before reconfiguring
for another architecture.
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
"universal" binaries--by specifying multiple '-arch' options to the
compiler but only a single '-arch' option to the preprocessor. Like
this:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CPP="gcc -E" CXXCPP="g++ -E"
This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
using the 'lipo' tool if you have problems.
Installation Names Installation Names
================== ==================
By default, 'make install' installs the package's commands under By default, `make install' will install the package's files in
'/usr/local/bin', include files under '/usr/local/include', etc. You `/usr/local/bin', `/usr/local/man', etc. You can specify an
can specify an installation prefix other than '/usr/local' by giving installation prefix other than `/usr/local' by giving `configure' the
'configure' the option '--prefix=PREFIX', where PREFIX must be an option `--prefix=PREFIX'.
absolute file name.
You can specify separate installation prefixes for You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you architecture-specific files and architecture-independent files. If you
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses give `configure' the option `--exec-prefix=PREFIX', the package will
PREFIX as the prefix for installing programs and libraries. use PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix. Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give In addition, if you use an unusual directory layout you can give
options like '--bindir=DIR' to specify different values for particular options like `--bindir=DIR' to specify different values for particular
kinds of files. Run 'configure --help' for a list of the directories kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them. In general, the default you can set and what kinds of files go in them.
for these options is expressed in terms of '${prefix}', so that
specifying just '--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the If the package supports it, you can cause programs to be installed
correct locations to 'configure'; however, many packages provide one or with an extra prefix or suffix on their names by giving `configure' the
both of the following shortcuts of passing variable assignments to the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
'make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, 'make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
'${prefix}'. Any directories that were specified during 'configure',
but not in terms of '${prefix}', must each be overridden at install time
for the entire installation to be relocated. The approach of makefile
variable overrides for each directory variable is required by the GNU
Coding Standards, and ideally causes no recompilation. However, some
platforms have known limitations with the semantics of shared libraries
that end up requiring recompilation when using this method, particularly
noticeable in packages that use GNU Libtool.
The second method involves providing the 'DESTDIR' variable. For
example, 'make install DESTDIR=/alternate/directory' will prepend
'/alternate/directory' before all installation names. The approach of
'DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of '${prefix}'
at 'configure' time.
Optional Features Optional Features
================= =================
If the package supports it, you can cause programs to be installed Some packages pay attention to `--enable-FEATURE' options to
with an extra prefix or suffix on their names by giving 'configure' the `configure', where FEATURE indicates an optional part of the package.
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
Some packages pay attention to '--enable-FEATURE' options to `README' should mention any `--enable-' and `--with-' options that the
'configure', where FEATURE indicates an optional part of the package.
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
is something like 'gnu-as' or 'x' (for the X Window System). The
'README' should mention any '--enable-' and '--with-' options that the
package recognizes. package recognizes.
For packages that use the X Window System, 'configure' can usually For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't, find the X include and library files automatically, but if it doesn't,
you can use the 'configure' options '--x-includes=DIR' and you can use the `configure' options `--x-includes=DIR' and
'--x-libraries=DIR' to specify their locations. `--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
execution of 'make' will be. For these packages, running './configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with 'make V=1'; while running './configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with 'make V=0'.
Particular systems
==================
On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC
is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
HP-UX 'make' updates targets which have the same time stamps as their
prerequisites, which makes it generally unusable when shipped generated
files such as 'configure' are involved. Use GNU 'make' instead.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its '<wchar.h>' header file. The option '-nodtk' can be used as a
workaround. If GNU CC is not installed, it is therefore recommended to
try
./configure CC="cc"
and if that doesn't work, try
./configure CC="cc -nodtk"
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
in your 'PATH', put it _after_ '/usr/bin'.
On Haiku, software installed for all users goes in '/boot/common',
not '/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type Specifying the System Type
========================== ==========================
There may be some features 'configure' cannot figure out There may be some features `configure' cannot figure out automatically,
automatically, but needs to determine by the type of machine the package but needs to determine by the type of machine the package will run on.
will run on. Usually, assuming the package is built to be run on the Usually, assuming the package is built to be run on the _same_
_same_ architectures, 'configure' can figure that out, but if it prints architectures, `configure' can figure that out, but if it prints a
a message saying it cannot guess the machine type, give it the message saying it cannot guess the machine type, give it the
'--build=TYPE' option. TYPE can either be a short name for the system `--build=TYPE' option. TYPE can either be a short name for the system
type, such as 'sun4', or a canonical name which has the form: type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms: where SYSTEM can have one of these forms:
OS OS KERNEL-OS
KERNEL-OS
See the file 'config.sub' for the possible values of each field. If See the file `config.sub' for the possible values of each field. If
'config.sub' isn't included in this package, then this package doesn't `config.sub' isn't included in this package, then this package doesn't
need to know the machine type. need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should If you are _building_ compiler tools for cross-compiling, you should
use the option '--target=TYPE' to select the type of system they will use the `--target=TYPE' option to select the type of system they will
produce code for. produce code for.
If you want to _use_ a cross compiler, that generates code for a If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will "host" platform (i.e., that on which the generated programs will
eventually be run) with '--host=TYPE'. eventually be run) with `--host=TYPE'.
Sharing Defaults Sharing Defaults
================ ================
If you want to set default values for 'configure' scripts to share, If you want to set default values for `configure' scripts to share, you
you can create a site shell script called 'config.site' that gives can create a site shell script called `config.site' that gives default
default values for variables like 'CC', 'cache_file', and 'prefix'. values for variables like `CC', `cache_file', and `prefix'.
'configure' looks for 'PREFIX/share/config.site' if it exists, then `configure' looks for `PREFIX/share/config.site' if it exists, then
'PREFIX/etc/config.site' if it exists. Or, you can set the `PREFIX/etc/config.site' if it exists. Or, you can set the
'CONFIG_SITE' environment variable to the location of the site script. `CONFIG_SITE' environment variable to the location of the site script.
A warning: not all 'configure' scripts look for a site script. A warning: not all `configure' scripts look for a site script.
Defining Variables Defining Variables
================== ==================
Variables not defined in a site shell script can be set in the Variables not defined in a site shell script can be set in the
environment passed to 'configure'. However, some packages may run environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set variables may be lost. In order to avoid this problem, you should set
them in the 'configure' command line, using 'VAR=value'. For example: them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc ./configure CC=/usr/local2/bin/gcc
causes the specified 'gcc' to be used as the C compiler (unless it is causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script). overridden in the site shell script). Here is a another example:
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an /bin/bash ./configure CONFIG_SHELL=/bin/bash
Autoconf limitation. Until the limitation is lifted, you can use this
workaround:
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
configuration-related scripts to be executed by `/bin/bash'.
'configure' Invocation `configure' Invocation
====================== ======================
'configure' recognizes the following options to control how it `configure' recognizes the following options to control how it operates.
operates.
'--help' `--help'
'-h' `-h'
Print a summary of all of the options to 'configure', and exit. Print a summary of the options to `configure', and exit.
'--help=short' `--version'
'--help=recursive' `-V'
Print a summary of the options unique to this package's Print the version of Autoconf used to generate the `configure'
'configure', and exit. The 'short' variant lists options used only
in the top level, while the 'recursive' variant lists options also
present in any nested packages.
'--version'
'-V'
Print the version of Autoconf used to generate the 'configure'
script, and exit. script, and exit.
'--cache-file=FILE' `--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE, Enable the cache: use and save the results of the tests in FILE,
traditionally 'config.cache'. FILE defaults to '/dev/null' to traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching. disable caching.
'--config-cache' `--config-cache'
'-C' `-C'
Alias for '--cache-file=config.cache'. Alias for `--cache-file=config.cache'.
'--quiet' `--quiet'
'--silent' `--silent'
'-q' `-q'
Do not print messages saying which checks are being made. To Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to '/dev/null' (any error suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown). messages will still be shown).
'--srcdir=DIR' `--srcdir=DIR'
Look for the package's source code in directory DIR. Usually Look for the package's source code in directory DIR. Usually
'configure' can determine that directory automatically. `configure' can determine that directory automatically.
'--prefix=DIR' `configure' also accepts some other, not widely useful, options. Run
Use DIR as the installation prefix. *note Installation Names:: for `configure --help' for more details.
more details, including other options available for fine-tuning the
installation locations.
'--no-create'
'-n'
Run the configure checks, but stop before creating any output
files.
'configure' also accepts some other, not widely useful, options. Run
'configure --help' for more details.

View file

@ -2,14 +2,29 @@
AUTOMAKE_OPTIONS = gnu AUTOMAKE_OPTIONS = gnu
SUBDIRS = src doc systemd SUBDIRS = m4 lib src doc po
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = COPYING.README README.android EXTRA_DIST = config.rpath mkinstalldirs have.h system.h COPYING.README depcomp
ChangeLog: ChangeLog:
git log > ChangeLog svn log > ChangeLog
astyle: svn-clean: maintainer-clean
astyle --options=.astylerc -nQ src/*.[ch] src/*/*.[ch] svn status --no-ignore | sed -n 's/^[?I] \+//p' | tr '\012' '\0' | xargs -r0 rm -rf
deb:
dpkg-buildpackage -rfakeroot
rpm: dist
cp $(distdir).tar.gz /usr/src/redhat/SOURCES/
cp redhat/tinc.spec /usr/src/redhat/SOURCES/
cd /usr/src/redhat/SOURCES/ && rpm -bb tinc.spec
release:
rm -f ChangeLog
$(MAKE) ChangeLog
echo "Please edit the NEWS file now..."
/usr/bin/editor NEWS
$(MAKE) dist

View file

@ -1,8 +1,8 @@
# Makefile.in generated by automake 1.16.2 from Makefile.am. # Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2020 Free Software Foundation, Inc. # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
@ -13,67 +13,15 @@
# PARTICULAR PURPOSE. # PARTICULAR PURPOSE.
@SET_MAKE@ @SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@ pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644 install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c
@ -87,131 +35,56 @@ PRE_UNINSTALL = :
POST_UNINSTALL = : POST_UNINSTALL = :
build_triplet = @build@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
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 \
depcomp install-sh missing mkinstalldirs
subdir = . subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/attribute.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
$(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/attribute.m4 $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
$(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/lzo.m4 $(top_srcdir)/m4/malloc.m4 \
$(top_srcdir)/m4/ax_require_defined.m4 $(top_srcdir)/m4/lzo.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/zlib.m4 \ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
$(top_srcdir)/configure.ac $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/tuntap.m4 \
$(top_srcdir)/m4/zlib.m4 $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno configure.lineno configure.status.lineno
mkinstalldirs = $(install_sh) -d mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES = SOURCES =
DIST_SOURCES = DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \ html-recursive info-recursive install-data-recursive \
install-data-recursive install-dvi-recursive \ install-exec-recursive install-info-recursive \
install-exec-recursive install-html-recursive \ install-recursive installcheck-recursive installdirs-recursive \
install-info-recursive install-pdf-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \
install-ps-recursive install-recursive installcheck-recursive \ uninstall-recursive
installdirs-recursive pdf-recursive ps-recursive \
tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
am__recursive_targets = \
$(RECURSIVE_TARGETS) \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir distdir-am dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \
config.h.in
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags ETAGS = etags
CTAGS = ctags CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS) DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in AUTHORS \
COPYING ChangeLog INSTALL NEWS README THANKS compile \
config.guess config.sub depcomp install-sh missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION) distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir) top_distdir = $(distdir)
am__remove_distdir = \ am__remove_distdir = \
if test -d "$(distdir)"; then \ { test ! -d $(distdir) \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \ && rm -fr $(distdir); }; }
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__post_remove_distdir = $(am__remove_distdir)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best GZIP_ENV = --best
DIST_TARGETS = dist-gzip
distuninstallcheck_listfiles = find . -type f -print distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@ ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@ AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AUTOCONF = @AUTOCONF@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@ AUTOMAKE = @AUTOMAKE@
@ -229,36 +102,52 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@ ECHO_T = @ECHO_T@
EGREP = @EGREP@ EGREP = @EGREP@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
GREP = @GREP@ GMSGFMT = @GMSGFMT@
INSTALL = @INSTALL@ HAVE_TUNTAP = @HAVE_TUNTAP@
INCLUDES = @INCLUDES@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INTLLIBS = @INTLLIBS@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
LIBS = @LIBS@ LIBS = @LIBS@
LINUX_IF_TUN_H = @LINUX_IF_TUN_H@
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MSGMERGE = @MSGMERGE@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
POSUB = @POSUB@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@ SHELL = @SHELL@
STRIP = @STRIP@ STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@ VERSION = @VERSION@
abs_builddir = @abs_builddir@ XGETTEXT = @XGETTEXT@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@ ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@ am__include = @am__include@
am__leading_dot = @am__leading_dot@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@ am__quote = @am__quote@
@ -270,119 +159,105 @@ build_alias = @build_alias@
build_cpu = @build_cpu@ build_cpu = @build_cpu@
build_os = @build_os@ build_os = @build_os@
build_vendor = @build_vendor@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@ datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
host = @host@ host = @host@
host_alias = @host_alias@ host_alias = @host_alias@
host_cpu = @host_cpu@ host_cpu = @host_cpu@
host_os = @host_os@ host_os = @host_os@
host_vendor = @host_vendor@ host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@ includedir = @includedir@
infodir = @infodir@ infodir = @infodir@
install_sh = @install_sh@ install_sh = @install_sh@
libdir = @libdir@ libdir = @libdir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@ localstatedir = @localstatedir@
mandir = @mandir@ mandir = @mandir@
mkdir_p = @mkdir_p@ mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@ oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@ sysconfdir = @sysconfdir@
systemd_path = @systemd_path@
target_alias = @target_alias@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = gnu AUTOMAKE_OPTIONS = gnu
SUBDIRS = src doc systemd SUBDIRS = m4 lib src doc po
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = COPYING.README README.android EXTRA_DIST = config.rpath mkinstalldirs have.h system.h COPYING.README depcomp
all: config.h all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive $(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES: .SUFFIXES:
am--refresh: Makefile am--refresh:
@: @:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \ @for dep in $?; do \
case '$(am__configure_deps)' in \ case '$(am__configure_deps)' in \
*$$dep*) \ *$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ cd $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \ && exit 0; \
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
$(am__cd) $(top_srcdir) && \ cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile $(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \
*config.status*) \ *config.status*) \
echo ' $(SHELL) ./config.status'; \ echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \ $(SHELL) ./config.status;; \
*) \ *) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac; esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck $(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps) $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF) cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
config.h: stamp-h1 config.h: stamp-h1
@test -f $@ || rm -f stamp-h1 @if test ! -f $@; then \
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1 @rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps) $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER)) cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1 rm -f stamp-h1
touch $@ touch $@
distclean-hdr: distclean-hdr:
-rm -f config.h stamp-h1 -rm -f config.h stamp-h1
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd # This directory's subdirectories are mostly independent; you can cd
# into them and run 'make' without going through this Makefile. # into them and run `make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles, # To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in 'config.status', edit 'config.status' # (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run 'make'); # (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the 'make' command line. # (2) otherwise, pass the desired values on the `make' command line.
$(am__recursive_targets): $(RECURSIVE_TARGETS):
@fail=; \ @failcom='exit 1'; \
if $(am__make_keepgoing); then \ for f in x $$MAKEFLAGS; do \
failcom='fail=yes'; \ case $$f in \
else \ *=* | --[!k]*);; \
failcom='exit 1'; \ *k*) failcom='fail=yes';; \
fi; \ esac; \
done; \
dot_seen=no; \ dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \ target=`echo $@ | sed s/-recursive//`; \
case "$@" in \ list='$(SUBDIRS)'; for subdir in $$list; do \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \ echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \ if test "$$subdir" = "."; then \
dot_seen=yes; \ dot_seen=yes; \
@ -390,20 +265,66 @@ $(am__recursive_targets):
else \ else \
local_target="$$target"; \ local_target="$$target"; \
fi; \ fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \ || eval $$failcom; \
done; \ done; \
if test "$$dot_seen" = "no"; then \ if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail" fi; test -z "$$fail"
ID: $(am__tagged_files) mostlyclean-recursive clean-recursive distclean-recursive \
$(am__define_uniq_tagged_files); mkid -fID $$unique maintainer-clean-recursive:
tags: tags-recursive @failcom='exit 1'; \
TAGS: tags for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
set x; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \ here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \ include_option=--etags-include; \
@ -415,175 +336,117 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
list='$(SUBDIRS)'; for subdir in $$list; do \ list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \ if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \ test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \ fi; \
done; \ done; \
$(am__define_uniq_tagged_files); \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
shift; \ unique=`for i in $$list; do \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \ test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi fi
ctags: ctags-recursive ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
CTAGS: ctags $(TAGS_FILES) $(LISP)
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) tags=; \
$(am__define_uniq_tagged_files); \ here=`pwd`; \
test -z "$(CTAGS_ARGS)$$unique" \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique $$tags $$unique
GTAGS: GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \ here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \ && cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here" && gtags -i $(GTAGS_ARGS) $$here
cscope: cscope.files
test ! -s cscope.files \
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
clean-cscope:
-rm -f cscope.files
cscope.files: clean-cscope cscopelist
cscopelist: cscopelist-recursive
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags: distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(BUILT_SOURCES) distdir: $(DISTFILES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@case `sed 15q $(srcdir)/NEWS` in \
*"$(VERSION)"*) : ;; \
*) \
echo "NEWS not updated; not releasing" 1>&2; \
exit 1;; \
esac
$(am__remove_distdir) $(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)" mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ $(mkdir_p) $(distdir)/m4 $(distdir)/po
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
dist_files=`for file in $$list; do echo $$file; done | \ list='$(DISTFILES)'; for file in $$list; do \
sed -e "s|^$$srcdirstrip/||;t" \ case $$file in \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
case $$dist_files in \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
*/*) $(MKDIR_P) `echo "$$dist_files" | \ esac; \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
if test -d "$(distdir)/$$file"; then \ dir="/$$dir"; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ $(mkdir_p) "$(distdir)$$dir"; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \ else \
test -f "$(distdir)/$$file" \ dir=''; \
|| cp -p $$d/$$file "$(distdir)/$$file" \ fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \ || exit 1; \
fi; \ fi; \
done done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \ if test "$$subdir" = .; then :; else \
$(am__make_dryrun) \ test -d "$(distdir)/$$subdir" \
|| test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \
|| exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
$(am__relativize); \ (cd $$subdir && \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \ $(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \ top_distdir="$$top_distdir" \
distdir="$$new_distdir" \ distdir="$$distdir/$$subdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \ distdir) \
|| exit 1; \ || exit 1; \
fi; \ fi; \
done done
-test -n "$(am__skip_mode_fix)" \ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)" || chmod -R a+r $(distdir)
dist-gzip: distdir dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__post_remove_distdir) $(am__remove_distdir)
dist-bzip2: distdir dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__post_remove_distdir) $(am__remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)
dist-zstd: distdir
tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst
$(am__post_remove_distdir)
dist-tarZ: distdir dist-tarZ: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir) $(am__remove_distdir)
dist-shar: distdir dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
"deprecated." >&2 $(am__remove_distdir)
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir dist-zip: distdir
-rm -f $(distdir).zip -rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir) zip -rq $(distdir).zip $(distdir)
$(am__post_remove_distdir) $(am__remove_distdir)
dist dist-all: dist dist-all: distdir
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__post_remove_distdir) $(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then # This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another # it guarantees that the distribution is self-contained by making another
@ -591,35 +454,25 @@ dist dist-all:
distcheck: dist distcheck: dist
case '$(DIST_ARCHIVES)' in \ case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \ *.tar.gz*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \ *.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \ *.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \ *.shar.gz*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \ *.zip*) \
unzip $(distdir).zip ;;\ unzip $(distdir).zip ;;\
*.tar.zst*) \
zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
esac esac
chmod -R a-w $(distdir) chmod -R a-w $(distdir); chmod a+w $(distdir)
chmod u+w $(distdir) mkdir $(distdir)/_build
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst mkdir $(distdir)/_inst
chmod a-w $(distdir) chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \ && cd $(distdir)/_build \
&& $(am__cd) $(distdir)/_build/sub \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
&& ../../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=../.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) check \
@ -639,24 +492,14 @@ distcheck: dist
&& rm -rf "$$dc_destdir" \ && rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \ && $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \ && rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
&& cd "$$am__cwd" \ $(am__remove_distdir)
|| exit 1
$(am__post_remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \ @(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck: distuninstallcheck:
@test -n '$(distuninstallcheck_dir)' || { \ @cd $(distuninstallcheck_dir) \
echo 'ERROR: trying to run $@ with an empty' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \ || { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \ if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \ echo " (check DESTDIR support)"; \
@ -687,22 +530,16 @@ install-am: all-am
installcheck: installcheck-recursive installcheck: installcheck-recursive
install-strip: install-strip:
if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \
install; \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic: mostlyclean-generic:
clean-generic: clean-generic:
distclean-generic: distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic: maintainer-clean-generic:
@echo "This command is intended for maintainers to use" @echo "This command is intended for maintainers to use"
@ -722,38 +559,18 @@ dvi-am:
html: html-recursive html: html-recursive
html-am:
info: info-recursive info: info-recursive
info-am: info-am:
install-data-am: install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am: install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive install-info: install-info-recursive
install-info-am:
install-man: install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am: installcheck-am:
maintainer-clean: maintainer-clean-recursive maintainer-clean: maintainer-clean-recursive
@ -774,35 +591,46 @@ ps: ps-recursive
ps-am: ps-am:
uninstall-am: uninstall-am: uninstall-info-am
.MAKE: $(am__recursive_targets) all install-am install-strip uninstall-info: uninstall-info-recursive
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
am--refresh check check-am clean clean-cscope clean-generic \ check-am clean clean-generic clean-recursive ctags \
cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ dist-tarZ dist-zip distcheck distclean distclean-generic \
dist-zstd distcheck distclean distclean-generic distclean-hdr \ distclean-hdr distclean-recursive distclean-tags \
distclean-tags distcleancheck distdir distuninstallcheck dvi \ distcleancheck distdir distuninstallcheck dvi dvi-am html \
dvi-am html html-am info info-am install install-am \ html-am info info-am install install-am install-data \
install-data install-data-am install-dvi install-dvi-am \ install-data-am install-exec install-exec-am install-info \
install-exec install-exec-am install-html install-html-am \ install-info-am install-man install-strip installcheck \
install-info install-info-am install-man install-pdf \ installcheck-am installdirs installdirs-am maintainer-clean \
install-pdf-am install-ps install-ps-am install-strip \ maintainer-clean-generic maintainer-clean-recursive \
installcheck installcheck-am installdirs installdirs-am \ mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
maintainer-clean maintainer-clean-generic mostlyclean \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-info-am
uninstall-am
.PRECIOUS: Makefile
ChangeLog: ChangeLog:
git log > ChangeLog svn log > ChangeLog
astyle: svn-clean: maintainer-clean
astyle --options=.astylerc -nQ src/*.[ch] src/*/*.[ch] svn status --no-ignore | sed -n 's/^[?I] \+//p' | tr '\012' '\0' | xargs -r0 rm -rf
deb:
dpkg-buildpackage -rfakeroot
rpm: dist
cp $(distdir).tar.gz /usr/src/redhat/SOURCES/
cp redhat/tinc.spec /usr/src/redhat/SOURCES/
cd /usr/src/redhat/SOURCES/ && rpm -bb tinc.spec
release:
rm -f ChangeLog
$(MAKE) ChangeLog
echo "Please edit the NEWS file now..."
/usr/bin/editor NEWS
$(MAKE) dist
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: .NOEXPORT:

414
NEWS
View file

@ -1,417 +1,3 @@
Version 1.0.36 August 26 2019
* Fix compiling tinc with certain versions of the OpenSSL library.
* Fix parsing some IPv6 addresses with :: in them.
* Fix GraphDumpFile output to handle node names starting with a digit.
* Fix a potential segmentation fault when fragmenting packets.
Thanks to Rosen Penev, Quentin Rameau and Werner Schreiber for their
contributions to this version of tinc.
Version 1.0.35 October 5 2018
* Prevent oracle attacks (CVE-2018-16737, CVE-2018-16738).
* Prevent a MITM from forcing a NULL cipher for UDP (CVE-2018-16758).
* Minor fixes in the documentation.
Thanks to Amine Amri and Rafael Sadowski for their contributions to this
version of tinc.
Version 1.0.34 June 12 2018
* Fix a potential segmentation fault when connecting to an IPv6 peer via a
proxy.
* Minor improvements to the build system.
* Make the systemd service file identical to the one from the 1.1 branch.
* Fix a potential problem causing IPv4 sockets to not work on macOS.
Thanks to Maximilian Stein and Wang Liu Shuai for their contributions to this
version of tinc.
Version 1.0.33 November 4 2017
* Allow compilation from a build directory.
* Source code cleanups.
* Fix some options specified on the command line not surviving a HUP signal.
* Handle tun/tap device returning EPERM or EBUSY.
* Disable PMTUDiscovery when TCPOnly is used.
* Support the --runstatedir option of the autoconf 2.70.
Thanks to Rafael Sadowski and Pierre-Olivier Mercier for their contributions to
this version of tinc.
Version 1.0.32 September 2 2017
* Fix segmentation fault when using Cipher = none.
* Fix Proxy = exec.
* Support PriorityInheritance for IPv6 packets.
* Fixes for Solaris tun/tap support.
* Bind outgoing TCP sockets when ListenAddress is used.
Thanks to Vittorio Gambaletta for his contribution to this version of tinc.
Version 1.0.31 January 15 2017
* Remove ExecStop in tinc@.service.
Thanks to Élie Bouttier for his contribution to this version of tinc.
Version 1.0.30 October 30 2016
* Fix troubles connecting to some HTTP proxies.
* Add mitigations for the Sweet32 attack when using a 64-bit block cipher.
* Use AES256 and SHA256 as the default encryption and digest algorithms.
Version 1.0.29 October 9 2016
* Fix UDP communication with peers with link-local IPv6 addresses.
* Ensure compatibility with OpenSSL 1.1.0.
* Ensure autoreconf can be run without requiring autoconf-archive.
* Log warnings about dropped packets only at debug level 5.
Version 1.0.28 April 10 2016
* Fix compilation on BSD platforms.
* Add systemd service files.
Version 1.0.27 April 10 2016
* When using Proxy, let the proxy resolve hostnames if tinc can't.
* Fixes and improvements of the DecrementTTL option.
* Fixed the $NAME variable in subnet-up/down scripts for the local Subnets.
* Fixed potentially wrong checksum generation when clamping the MSS.
* Properly choose between the system's or our own copy of getopt.
* Fixed compiling tinc for Cygwin with MinGW installed.
* Added support for OS X utun interfaces.
* Documentation updates and minor fixes.
Thanks to Vittorio Gambaletta, LunarShaddow, Florian Weik and Nathan Stratton
Treadway for their contributions to this version of tinc.
Version 1.0.26 July 5 2015
* Tinc now forces glibc to reload /etc/resolv.conf for every hostname lookup.
* Fixed --logfile without a filename on Windows.
* Ensure tinc can be compiled when using musl libc.
Thanks to Jo-Philipp Wich for his contribution to this version of tinc.
Version 1.0.25 December 22 2014
* Documentation updates.
* Support linking against -lresolv on Mac OS X.
* Fix scripts on Windows when using the ScriptsInterpreter option.
* Allow a minimum reconnect timeout to be specified.
* Support PriorityInheritance on IPv6 sockets.
Thanks to David Pflug, Baptiste Jonglez, Alexis Hildebrandt, Borg, Jochen Voss,
Tomislav Čohar and VittGam for their contributions to this version of tinc.
Version 1.0.24 May 11 2014
* Various compiler hardening flags are enabled by default.
* Updated support for Solaris, allowing switch mode on Solaris 11.
* Configuration will now also be read from a conf.d directory.
* Various updates to the documentation.
* Tinc now forces glibc to reload /etc/resolv.conf after it receives SIGALRM.
* Fixed a potential routing loop when IndirectData or TCPOnly is used and
broadcast packets are being sent.
* Improved security with constant time memcmp and stricter use of OpenSSL's
RNG functions.
* Fixed all issues found by Coverity.
Thanks to Florent Clairambault, Vilbrekin, luckyhacky, Armin Fisslthaler, Loïc
Dachary and Steffan Karger for their contributions to this version of tinc.
Version 1.0.23 October 19 2013
* Start authentication immediately on outgoing connections (useful for sslh).
* Fixed segfault when Name = $HOST but $HOST is not set.
* Updated the build system and the documentation.
* Clean up child processes left over from Proxy = exec.
Version 1.0.22 August 13 2013
* Fixed the combination of Mode = router and DeviceType = tap.
* The $NAME variable is now set in subnet-up/down scripts.
* Tinc now gives an error when unknown options are given on the command line.
* Tinc now correctly handles a space between a short command line option and
an optional argument.
Thanks to Etienne Dechamps for his contribution to this version of tinc.
Version 1.0.21 April 22 2013
* Drop packets forwarded via TCP if they are too big (CVE-2013-1428).
Thanks to Martin Schobert for auditing tinc and reporting this vulnerability.
Version 1.0.20 March 03 2013
* Use /dev/tap0 by default on FreeBSD and NetBSD when using switch mode.
* Minor improvements and clarifications in the documentation.
* Allow tinc to be cross-compiled with Android's NDK.
* The discovered PMTU is now also applied to VLAN tagged traffic.
* The LocalDiscovery option now makes use of all addresses tinc is bound to.
* Fixed support for tunemu on iOS devices.
* The PriorityInheritance option now also works with switch mode.
* Fixed tinc crashing when using a SOCKS5 proxy.
Thanks to Mesar Hameed, Vilbrekin and Martin Schürrer for their contributions
to this version of tinc.
Version 1.0.19 June 25 2012
* Allow :: notation in IPv6 Subnets.
* Add support for systemd style socket activation.
* Allow environment variables to be used for the Name option.
* Add basic support for SOCKS proxies, HTTP proxies, and proxying through an
external command.
Thanks to Anthony G. Basile and Michael Tokarev for their contributions to
this version of tinc.
Version 1.0.18 March 25 2012
* Fixed IPv6 in switch mode by turning off DecrementTTL by default.
* Allow a port number to be specified in BindToAddress, which also allows tinc
to listen on multiple ports.
* Add support for multicast communication with UML/QEMU/KVM.
Version 1.0.17 March 10 2012
* The DeviceType option can now be used to select dummy, raw socket, UML and
VDE devices without needing to recompile tinc.
* Allow multiple BindToAddress statements.
* Decrement TTL value of IPv4 and IPv6 packets.
* Add LocalDiscovery option allowing tinc to detect peers that are behind the
same NAT.
* Accept Subnets passed with the -o option when StrictSubnets = yes.
* Disabling old RSA keys when generating new ones now also works properly on
Windows.
Thanks to Nick Hibma for his contribution to this version of tinc.
Version 1.0.16 July 23 2011
* Fixed a performance issue with TCP communication under Windows.
* Fixed code that, during network outages, would cause tinc to exit when it
thought two nodes with identical Names were on the VPN.
Version 1.0.15 June 24 2011
* Improved logging to file.
* Reduced amount of process wakeups on platforms which support pselect().
* Fixed ProcessPriority option under Windows.
Version 1.0.14 May 8 2011
* Fixed reading configuration files that do not end with a newline. Again.
* Allow arbitrary configuration options being specified on the command line.
* Allow all options in both tinc.conf and the local host config file.
* Configurable replay window, UDP send and receive buffers for performance tuning.
* Try harder to get UDP communication back after falling back to TCP.
* Initial support for attaching tinc to a VDE switch.
* DragonFly BSD support.
* Allow linking with OpenSSL 1.0.0.
Thanks to Brandon Black, Julien Muchembled, Michael Tokarev, Rumko and Timothy
Redaelli for their contributions to this version of tinc.
Version 1.0.13 Apr 11 2010
* Allow building tinc without LZO and/or Zlib.
* Clamp MSS of TCP packets in both directions.
* Experimental StrictSubnets, Forwarding and DirectOnly options,
giving more control over information and packets received from/sent to other
nodes.
* Ensure tinc never sends symbolic names for ports over the wire.
Version 1.0.12 Feb 3 2010
* Really allow fast roaming of hosts to other nodes in a switched VPN.
* Fixes missing or incorrect environment variables when calling host-up/down
and subnet-up/down scripts in some cases.
* Allow port to be specified in Address statements.
* Clamp MSS of TCP packets to the discovered path MTU.
* Let two nodes behind NAT learn each others current UDP address and port via
a third node, potentially allowing direct communications in a similar way to
STUN.
Version 1.0.11 Nov 1 2009
* Fixed potential crash when the HUP signal is sent.
* Fixes handling of weighted Subnets in switch and hub modes, preventing
unnecessary broadcasts.
* Works around a MinGW bug that caused packets to Windows nodes to always be
sent via TCP.
* Improvements to the PMTU discovery code, especially on Windows.
* Use UDP again in certain cases where 1.0.10 was too conservative and fell
back to TCP unnecessarily.
* Allow fast roaming of hosts to other nodes in a switched VPN.
Version 1.0.10 Oct 18 2009
* Fixed potential crashes during shutdown and (in rare conditions) when other
nodes disconnected from the VPN.
* Improved NAT handling: tinc now copes with mangled port numbers, and will
automatically fall back to TCP if direct UDP connection between nodes is not
possible. The TCPOnly option should not have to be used anymore.
* Allow configuration files with CRLF line endings to be read on UNIX.
* Disable old RSA keys when generating new ones, and raise the default size of
new RSA keys to 2048 bits.
* Many fixes in the path MTU discovery code, especially when Compression is
being used.
* Tinc can now drop privileges and/or chroot itself.
* The TunnelServer code now just ignores information from clients instead of
disconnecting them.
* Improved performance on Windows by using the new ProcessPriority option and
by making the handling of packets received from the TAP-Win32 adapter more
efficient.
* Code cleanups: tinc now follows the C99 standard, copyright headers have
been updated to include patch authors, checkpoint tracing and localisation
features have been removed.
* Support for (jailbroken) iPhone and iPod Touch has been added.
Thanks to Florian Forster, Grzegorz Dymarek and especially Michael Tokarev for
their contributions to this version of tinc.
Version 1.0.9 Dec 26 2008
* Fixed tinc as a service under Windows 2003.
* Fixed reading configuration files that do not end with a newline.
* Fixed crashes in situations where hostnames could not be resolved or hosts
would disconnect at the same time as session keys were exchanged.
* Improved default settings of tun and tap devices on BSD platforms.
* Make IPv6 sockets bind only to IPv6 on Linux.
* Enable path MTU discovery by default.
* Fixed a memory leak that occurred when connections were closed.
Thanks to Max Rijevski for his contributions to this version of tinc.
Version 1.0.8 May 16 2007
* Fixed some memory and resource leaks.
* Made network sockets non-blocking under Windows.
Thanks to Scott Lamb and "dnk" for their contributions to this version of tinc.
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.
* Fixed a bug where broadcasts in switch and hub modes sometimes would not
work anymore when part of the VPN had become disconnected from the rest.
version 1.0.5 Nov 14 2006
* Lots of small fixes.
* Broadcast packets no longer grow in size with each hop. This should
fix switch mode (again).
* Generic host-up and host-down scripts.
* Optionally dump graph in graphviz format to a file or a script.
* Support LZO 2.0 and later.
Thanks to Scott Lamb for his contributions to this version of tinc.
version 1.0.4 May 4 2005 version 1.0.4 May 4 2005
* Fix switch and hub modes. * Fix switch and hub modes.

73
README
View file

@ -1,9 +1,9 @@
This is the README file for tinc version 1.0.36. Installation This is the README file for tinc version 1.0.4. Installation
instructions may be found in the INSTALL file. instructions may be found in the INSTALL file.
tinc is Copyright (C) 1998-2019 by: tinc is Copyright (C) 1998-2005 by:
Ivo Timmermans, Ivo Timmermans <ivo@tinc-vpn.org>,
Guus Sliepen <guus@tinc-vpn.org>, Guus Sliepen <guus@tinc-vpn.org>,
and others. and others.
@ -36,53 +36,49 @@ writeup describing various security issues in several VPN daemons. He showed
that tinc lacks perfect forward security, the connection authentication could that tinc lacks perfect forward security, the connection authentication could
be done more properly, that the sequence number we use as an IV is not the best be done more properly, that the sequence number we use as an IV is not the best
practice and that the default length of the HMAC for packets is too short in practice and that the default length of the HMAC for packets is too short in
his opinion. We do not know of a way to exploit these weaknesses, but these his opinion. We do not know of a way to exploit these weaknesses, but we will
issues are being addressed in the tinc 1.1 branch. address these issues in tinc 2.0.
The Sweet32 attack affects versions of tinc prior to 1.0.30.
On September 6th, 2018, Michael Yonly contacted us and provided
proof-of-concept code that allowed a remote attacker to create an
authenticated, one-way connection with a node, and also that there was a
possibility for a man-in-the-middle to force UDP packets from a node to be sent
in plaintext. The first issue was trivial to exploit on tinc versions prior to
1.0.30, but the changes in 1.0.30 to mitigate the Sweet32 attack made this
weakness much harder to exploit. These issues have been fixed in tinc 1.0.35.
The new protocol in the tinc 1.1 branch is not susceptible to these issues.
Cryptography is a hard thing to get right. We cannot make any Cryptography is a hard thing to get right. We cannot make any
guarantees. Time, review and feedback are the only things that can guarantees. Time, review and feedback are the only things that can
prove the security of any cryptographic product. If you wish to review prove the security of any cryptographic product. If you wish to review
tinc or give us feedback, you are strongly encouraged to do so. tinc or give us feedback, you are stronly encouraged to do so.
Changes to configuration file format since 1.0pre5
--------------------------------------------------
Some configuration variables have different names now. Most notably "TapDevice"
should be changed into "Device", and "Device" should be changed into
"BindToDevice".
Compatibility Compatibility
------------- -------------
Version 1.0.35 is compatible with 1.0pre8, 1.0 and later, but not with older Version 1.0.4 is compatible with 1.0pre8, 1.0 and later, but not with older
versions of tinc. Note that since version 1.0.30, tinc requires all nodes in versions of tinc.
the VPN to be compiled with a version of LibreSSL or OpenSSL that supports the
AES256 and SHA256 algorithms.
Requirements Requirements
------------ ------------
The OpenSSL library is used for all cryptographic functions. You can find it at Since 1.0pre3, we use OpenSSL for all cryptographic functions. So you
https://www.openssl.org/. You will need version 1.0.1 or later with support for need to install this library first; grab it from
AES256 and SHA256 enabled. If this library is not installed on your system, the http://www.openssl.org/. You will need version 0.9.7 or later. If
configure script will fail. The manual in doc/tinc.texi contains more detailed this library is not installed on you system, configure will fail. The
information on how to install this library. Alternatively, you may also use the manual in doc/tinc.texi contains more detailed information on how to
LibreSSL library. install this library.
The zlib library is used for optional compression. You can Since 1.0pre6, the zlib library is used for optional compression. You need this
find it at https://zlib.net/. Because of a possible exploit in library whether or not you plan to enable the compression. You can find it at
earlier versions we recommend that you download version 1.1.4 or later. http://www.gzip.org/zlib/. Because of a possible exploit in earlier versions we
recommand that you download version 1.1.4 or later.
The LZO library is also used for optional compression. You can Since 1.0, the lzo library is also used for optional compression. You need this
find it at https://www.oberhumer.com/opensource/lzo/. library whether or not you plan to enable compression. You can find it at
http://www.oberhumer.com/opensource/lzo/.
In order to compile tinc, you will need a C99 compliant compiler. In order to compile tinc, you will need a GNU C compiler environment.
Features Features
@ -112,14 +108,15 @@ Linux, FreeBSD and Windows.
The algorithms used for encryption and generating message authentication codes The algorithms used for encryption and generating message authentication codes
can now be changed in the configuration files. All cipher and digest algorithms can now be changed in the configuration files. All cipher and digest algorithms
supported by OpenSSL can be used. Useful ciphers are "blowfish" (default), supported by OpenSSL can be used. Useful ciphers are "blowfish" (default),
"bf-ofb", "des", "des3", et cetera. Useful digests are "sha1" (default), "md5", "bf-ofb", "des", "des3", etcetera. Useful digests are "sha1" (default), "md5",
et cetera. etcetera.
Support for routing IPv6 packets has been added. Just add Subnet lines with Support for routing IPv6 packets has been added. Just add Subnet lines with
IPv6 addresses (without using :: abbreviations) and use ifconfig or ip (from IPv6 addresses (without using :: abbreviations) and use ifconfig or ip (from
the iproute package) to give the virtual network interface corresponding IPv6 the iproute package) to give the virtual network interface corresponding IPv6
addresses. tinc does not provide autoconfiguration for IPv6 hosts. Consider addresses. tinc does not provide autoconfiguration for IPv6 hosts, if you need
using radvd or zebra if you need it. it use radvd or zebra. Tunneling IPv6 packets only works on Linux, FreeBSD,
Windows and possibly OpenBSD.
It is also possible to make tunnels to other tinc daemons over IPv6 networks, It is also possible to make tunnels to other tinc daemons over IPv6 networks,
if the operating system supports IPv6. tinc will automatically use both IPv6 if the operating system supports IPv6. tinc will automatically use both IPv6
@ -127,7 +124,7 @@ and IPv4 when available, but this can be changed by adding the option
"AddressFamily = ipv4" or "AddressFamily = ipv6" to the tinc.conf file. "AddressFamily = ipv4" or "AddressFamily = ipv6" to the tinc.conf file.
Normally, when started tinc will detach and run in the background. In a native Normally, when started tinc will detach and run in the background. In a native
Windows environment this means tinc will install itself as a service, which will Windows environment this means tinc will intall itself as a service, which will
restart after reboots. To prevent tinc from detaching or running as a service, restart after reboots. To prevent tinc from detaching or running as a service,
use the -D option. use the -D option.

View file

@ -1,25 +0,0 @@
Quick how-to cross compile tinc for android (done from $HOME/android/):
- Download android NDK and setup local ARM toolchain:
wget http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86.tar.bz2
tar xfj android-ndk-r9d-linux-x86.tar.bz2
./android-ndk-r9d/build/tools/make-standalone-toolchain.sh --platform=android-5 --install-dir=/tmp/my-android-toolchain
- Download and cross-compile openSSL for ARM:
wget http://www.openssl.org/source/openssl-1.0.1h.tar.gz
tar xfz openssl-1.0.1h.tar.gz
cd openssl-1.0.1h
./Configure dist
make CC=/tmp/my-android-toolchain/bin/arm-linux-androideabi-gcc AR="/tmp/my-android-toolchain/bin/arm-linux-androideabi-ar r" RANLIB=/tmp/my-android-toolchain/bin/arm-linux-androideabi-ranlib
cd -
- Clone and cross-compile tinc:
git clone git://tinc-vpn.org/tinc
cd tinc
autoreconf -fsi
CC=/tmp/my-android-toolchain/bin/arm-linux-androideabi-gcc ./configure --host=arm-linux --disable-lzo --with-openssl-lib=$HOME/android/openssl-1.0.1g --with-openssl-include=$HOME/android/openssl-1.0.1g/include/ --disable-hardening
make -j5
- Strip tincd binary to make it smaller
/tmp/my-android-toolchain/bin/arm-linux-androideabi-strip src/tincd

102
THANKS
View file

@ -1,126 +1,32 @@
We would like to thank the following people for their contributions to tinc: We would like to thank the following people for their contributions to tinc:
* Alexander Reil and Gemeinde Berg * Alexander Reil and Gemeinde Berg
* Alexander Ried
* Alexis Hildebrandt
* Allesandro Gatti * Allesandro Gatti
* Andreas van Cranenburgh
* Andrew Hahn
* Anthony G. Basile
* Armijn Hemel * Armijn Hemel
* Armin Fisslthaler
* Aron Cowan
* Ashish Bajaj
* Baptiste Jonglez
* Borg
* Brandon Black
* Cheng LI
* Cris van Pelt * Cris van Pelt
* Darius Jahandarie
* Dato Simó
* David Pflug
* Delf Eldkraft
* Dennis Joachimsthaler
* dnk
* Егор Палкин
* Élie Bouttier
* Enrique Zanardi * Enrique Zanardi
* Erik Tews
* Etienne Dechamps
* Florent Clairambault
* Florian Forster
* Florian Klink
* Florian Weik
* Flynn Marquardt * Flynn Marquardt
* Franz Pletz
* Gary Kessler and Claudia Gonzalez
* Grzegorz Dymarek
* Gusariev Oleksandr
* Hans Bayle * Hans Bayle
* Harvest
* Ivo van Dong * Ivo van Dong
* Ivo Smits
* James Cook
* James MacLean * James MacLean
* Jamie Briggs * Jamie Briggs
* Jan Štembera
* Jason Harper * Jason Harper
* Jason Livesay
* Jasper Krijgsman
* Jelle de Jong
* Jeroen Domburg
* Jeroen Ubbink * Jeroen Ubbink
* Jerome Etienne * Jerome Etienne
* Jo-Philipp Wich * Lubomír Bulej
* Jochen Voss
* Julien Muchembled
* Lavrans Laading
* Loïc Dachary
* Loïc Grenié
* Lubomír Bulej
* luckyhacky
* LunarShaddow
* Mads Kiilerich * Mads Kiilerich
* Marc A. Lehmann * Marc A. Lehmann
* Mark Glines * Mark Glines
* Mark Petryk
* Markus Goetz
* Martin Kihlgren * Martin Kihlgren
* Martin Schobert
* Martin Schürrer
* Martin Weinelt
* Matias Carrasco * Matias Carrasco
* Max Rijevski
* Menno Smits
* Mesar Hameed
* Michael Taylor
* Michael Tokarev
* Michael Yonli
* Miles Nordin
* Nathan Stratton Treadway
* Murat Donmez
* Nick Hibma
* Nick Patavalis * Nick Patavalis
* Paul Littlefield * Paul Littlefield
* Philipp Babel
* Pierre Emeriaud
* Pierre-Olivier Mercier
* Rafael Wolf
* Rafael Sadowski
* Rafał Leśniak
* Rhosyn Celyn
* Robert van der Meulen * Robert van der Meulen
* Robert Waniek
* Rumko
* Ryan Miller
* Sam Bryan
* Samuel Thibault
* Saverio Proto
* Scott Lamb
* Steffan Karger
* Stig Fagrell
* Sven-Haegar Koch
* Teemu Kiviniemi * Teemu Kiviniemi
* Thomas Tsiakalakis
* Timothy Redaelli
* Tomasz Fortuna
* Tomislav Čohar
* Tommy Arnkværn
* Tonnerre Lombard
* Ulrich Seifert
* Vil Brekin
* Vincent Laurent
* Vittorio Gambaletta
* Wendy Willard
* Wessel Dankers * Wessel Dankers
* William A. Kennington III
* William McArthur
* Wouter van Heyst * Wouter van Heyst
* xentec
* 戴 鸣
And everyone we forgot (if we did, please let us know). Thank you! And everyone we forgot. Thank you guys!
--- Ivo Timmermans
Ivo Timmermans, Guus Sliepen
Guus Sliepen.

3
TODO Normal file
View file

@ -0,0 +1,3 @@
TODO LIST
* Think of new things to do.

1049
aclocal.m4 vendored

File diff suppressed because it is too large Load diff

348
compile
View file

@ -1,348 +0,0 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# 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
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN* | MSYS*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/* | msys/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

1631
config.guess vendored

File diff suppressed because it is too large Load diff

View file

@ -1,29 +1,36 @@
/* config.h.in. Generated from configure.ac by autoheader. */ /* config.h.in. Generated from configure.in by autoheader. */
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Support for jumbograms (packets up to 9000 bytes) */ /* Support for jumbograms (packets up to 9000 bytes) */
#undef ENABLE_JUMBOGRAMS #undef ENABLE_JUMBOGRAMS
/* Support for tunemu */ /* Define to 1 if translation of program messages to the user's native
#undef ENABLE_TUNEMU language is requested. */
#undef ENABLE_NLS
/* Support for UML */ /* Checkpoint tracing */
#undef ENABLE_UML #undef ENABLE_TRACING
/* Support for VDE */ /* Define to 1 if you have `alloca', as a function or macro. */
#undef ENABLE_VDE #undef HAVE_ALLOCA
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the <arpa/inet.h> header file. */ /* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H #undef HAVE_ARPA_INET_H
/* Define to 1 if you have the <arpa/nameser.h> header file. */
#undef HAVE_ARPA_NAMESER_H
/* Define to 1 if you have the `asprintf' function. */ /* Define to 1 if you have the `asprintf' function. */
#undef HAVE_ASPRINTF #undef HAVE_ASPRINTF
/* Define to 1 if you have the `BN_GENCB_new' function. */
#undef HAVE_BN_GENCB_NEW
/* Unknown BSD variant */ /* Unknown BSD variant */
#undef HAVE_BSD #undef HAVE_BSD
@ -36,45 +43,15 @@
/* Darwin (MacOS/X) */ /* Darwin (MacOS/X) */
#undef HAVE_DARWIN #undef HAVE_DARWIN
/* Define to 1 if you have the declaration of `EVP_aes_256_cfb', and to 0 if /* Define if the GNU dcgettext() function is already present or preinstalled.
you don't. */ */
#undef HAVE_DECL_EVP_AES_256_CFB #undef HAVE_DCGETTEXT
/* Define to 1 if you have the declaration of `freeaddrinfo', and to 0 if you /* Needed for xmalloc.c */
don't. */ #undef HAVE_DONE_WORKING_MALLOC_CHECK
#undef HAVE_DECL_FREEADDRINFO
/* Define to 1 if you have the declaration of `gai_strerror', and to 0 if you /* Needed for xmalloc.c */
don't. */ #undef HAVE_DONE_WORKING_REALLOC_CHECK
#undef HAVE_DECL_GAI_STRERROR
/* Define to 1 if you have the declaration of `getaddrinfo', and to 0 if you
don't. */
#undef HAVE_DECL_GETADDRINFO
/* Define to 1 if you have the declaration of `getnameinfo', and to 0 if you
don't. */
#undef HAVE_DECL_GETNAMEINFO
/* Define to 1 if you have the declaration of `OpenSSL_add_all_algorithms',
and to 0 if you don't. */
#undef HAVE_DECL_OPENSSL_ADD_ALL_ALGORITHMS
/* Define to 1 if you have the declaration of `res_init', and to 0 if you
don't. */
#undef HAVE_DECL_RES_INIT
/* Define to 1 if you have the `devname' function. */
#undef HAVE_DEVNAME
/* Define to 1 if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
/* DragonFly */
#undef HAVE_DRAGONFLY
/* Define to 1 if you have the `EVP_CIPHER_CTX_new' function. */
#undef HAVE_EVP_CIPHER_CTX_NEW
/* Define to 1 if you have the `EVP_EncryptInit_ex' function. */ /* Define to 1 if you have the `EVP_EncryptInit_ex' function. */
#undef HAVE_EVP_ENCRYPTINIT_EX #undef HAVE_EVP_ENCRYPTINIT_EX
@ -82,60 +59,60 @@
/* Define to 1 if you have the `fchmod' function. */ /* Define to 1 if you have the `fchmod' function. */
#undef HAVE_FCHMOD #undef HAVE_FCHMOD
/* Define to 1 if you have the `fdevname' function. */
#undef HAVE_FDEVNAME
/* Define to 1 if you have the `flock' function. */ /* Define to 1 if you have the `flock' function. */
#undef HAVE_FLOCK #undef HAVE_FLOCK
/* Define to 1 if you have the `fork' function. */ /* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK #undef HAVE_FORK
/* Define to 1 if you have the `freeaddrinfo' function. */
#undef HAVE_FREEADDRINFO
/* FreeBSD */ /* FreeBSD */
#undef HAVE_FREEBSD #undef HAVE_FREEBSD
/* Define to 1 if you have the <getopt.h> header file. */ /* Define to 1 if you have the `ftime' function. */
#undef HAVE_GETOPT_H #undef HAVE_FTIME
/* getopt_long() */ /* Define to 1 if you have the `gai_strerror' function. */
#undef HAVE_GETOPT_LONG #undef HAVE_GAI_STRERROR
/* Define to 1 if you have the `getaddrinfo' function. */
#undef HAVE_GETADDRINFO
/* Define to 1 if you have the `getnameinfo' function. */
#undef HAVE_GETNAMEINFO
/* Define if the GNU gettext() function is already present or preinstalled. */
#undef HAVE_GETTEXT
/* Define to 1 if you have the `gettimeofday' function. */ /* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY #undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the `get_current_dir_name' function. */
#undef HAVE_GET_CURRENT_DIR_NAME
/* Define if you have the iconv() function. */
#undef HAVE_ICONV
/* Define to 1 if you have the `inet_aton' function. */
#undef HAVE_INET_ATON
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H
/* Define to 1 if you have the `nsl' library (-lnsl). */ /* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL #undef HAVE_LIBNSL
/* Define to 1 if you have the `resolv' library (-lresolv). */
#undef HAVE_LIBRESOLV
/* Define to 1 if you have the `socket' library (-lsocket). */ /* Define to 1 if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET #undef HAVE_LIBSOCKET
/* Define to 1 if you have the <libvdeplug_dyn.h> header file. */
#undef HAVE_LIBVDEPLUG_DYN_H
/* Linux */ /* Linux */
#undef HAVE_LINUX #undef HAVE_LINUX
/* Define to 1 if you have the <linux/if_tun.h> header file. */
#undef HAVE_LINUX_IF_TUN_H
/* enable lzo compression support */
#undef HAVE_LZO
/* Define to 1 if you have the <lzo1x.h> header file. */ /* Define to 1 if you have the <lzo1x.h> header file. */
#undef HAVE_LZO1X_H #undef HAVE_LZO1X_H
/* Define to 1 if you have the <lzo2/lzo1x.h> header file. */
#undef HAVE_LZO2_LZO1X_H
/* Define to 1 if you have the <lzo/lzo1x.h> header file. */
#undef HAVE_LZO_LZO1X_H
/* Define to 1 if you have the <memory.h> header file. */ /* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H #undef HAVE_MEMORY_H
@ -178,9 +155,6 @@
/* Define to 1 if you have the <netinet/tcp.h> header file. */ /* Define to 1 if you have the <netinet/tcp.h> header file. */
#undef HAVE_NETINET_TCP_H #undef HAVE_NETINET_TCP_H
/* Define to 1 if you have the <netpacket/packet.h> header file. */
#undef HAVE_NETPACKET_PACKET_H
/* Define to 1 if you have the <net/ethernet.h> header file. */ /* Define to 1 if you have the <net/ethernet.h> header file. */
#undef HAVE_NET_ETHERNET_H #undef HAVE_NET_ETHERNET_H
@ -199,21 +173,9 @@
/* Define to 1 if you have the <net/if_types.h> header file. */ /* Define to 1 if you have the <net/if_types.h> header file. */
#undef HAVE_NET_IF_TYPES_H #undef HAVE_NET_IF_TYPES_H
/* Define to 1 if you have the <net/if_utun.h> header file. */
#undef HAVE_NET_IF_UTUN_H
/* Define to 1 if you have the <net/tap/if_tap.h> header file. */
#undef HAVE_NET_TAP_IF_TAP_H
/* Define to 1 if you have the <net/tun/if_tun.h> header file. */
#undef HAVE_NET_TUN_IF_TUN_H
/* OpenBSD */ /* OpenBSD */
#undef HAVE_OPENBSD #undef HAVE_OPENBSD
/* Define to 1 if you have the <openssl/engine.h> header file. */
#undef HAVE_OPENSSL_ENGINE_H
/* Define to 1 if you have the <openssl/err.h> header file. */ /* Define to 1 if you have the <openssl/err.h> header file. */
#undef HAVE_OPENSSL_ERR_H #undef HAVE_OPENSSL_ERR_H
@ -232,20 +194,17 @@
/* Define to 1 if you have the <openssl/sha.h> header file. */ /* Define to 1 if you have the <openssl/sha.h> header file. */
#undef HAVE_OPENSSL_SHA_H #undef HAVE_OPENSSL_SHA_H
/* Define to 1 if you have the `pselect' function. */
#undef HAVE_PSELECT
/* Define to 1 if you have the `putenv' function. */ /* Define to 1 if you have the `putenv' function. */
#undef HAVE_PUTENV #undef HAVE_PUTENV
/* Define to 1 if you have the `RAND_bytes' function. */ /* Define to 1 if you have the `random' function. */
#undef HAVE_RAND_BYTES #undef HAVE_RANDOM
/* Define to 1 if you have the <resolv.h> header file. */ /* Define to 1 if you have the `RAND_pseudo_bytes' function. */
#undef HAVE_RESOLV_H #undef HAVE_RAND_PSEUDO_BYTES
/* Define to 1 if you have the `RSA_set0_key' function. */ /* Define to 1 if you have the `select' function. */
#undef HAVE_RSA_SET0_KEY #undef HAVE_SELECT
/* Define to 1 if the system has the type `socklen_t'. */ /* Define to 1 if the system has the type `socklen_t'. */
#undef HAVE_SOCKLEN_T #undef HAVE_SOCKLEN_T
@ -253,12 +212,21 @@
/* Solaris/SunOS */ /* Solaris/SunOS */
#undef HAVE_SOLARIS #undef HAVE_SOLARIS
/* Define to 1 if you have the <stdbool.h> header file. */
#undef HAVE_STDBOOL_H
/* Define to 1 if you have the <stdint.h> header file. */ /* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H #undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */ /* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H #undef HAVE_STDLIB_H
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the <strings.h> header file. */ /* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H #undef HAVE_STRINGS_H
@ -268,6 +236,9 @@
/* Define to 1 if you have the `strsignal' function. */ /* Define to 1 if you have the `strsignal' function. */
#undef HAVE_STRSIGNAL #undef HAVE_STRSIGNAL
/* Define to 1 if you have the `strtol' function. */
#undef HAVE_STRTOL
/* Define to 1 if the system has the type `struct addrinfo'. */ /* Define to 1 if the system has the type `struct addrinfo'. */
#undef HAVE_STRUCT_ADDRINFO #undef HAVE_STRUCT_ADDRINFO
@ -325,9 +296,6 @@
/* Define to 1 if you have the <sys/param.h> header file. */ /* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H #undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define to 1 if you have the <sys/socket.h> header file. */ /* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H #undef HAVE_SYS_SOCKET_H
@ -346,26 +314,26 @@
/* Define to 1 if you have the <sys/wait.h> header file. */ /* Define to 1 if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H #undef HAVE_SYS_WAIT_H
/* Universal tun/tap driver present */
#undef HAVE_TUNTAP
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H
/* Define to 1 if you have the `unsetenv' function. */ /* Define to 1 if you have the `unsetenv' function. */
#undef HAVE_UNSETENV #undef HAVE_UNSETENV
/* Define to 1 if you have the `usleep' function. */
#undef HAVE_USLEEP
/* Define to 1 if you have the `vsyslog' function. */ /* Define to 1 if you have the `vsyslog' function. */
#undef HAVE_VSYSLOG #undef HAVE_VSYSLOG
/* have zlib compression support */ /* Define to 1 if you have the `writev' function. */
#undef HAVE_ZLIB #undef HAVE_WRITEV
/* Define to 1 if you have the <zlib.h> header file. */ /* Define to 1 if you have the <zlib.h> header file. */
#undef HAVE_ZLIB_H #undef HAVE_ZLIB_H
/* Location of lzo1x.h */ /* Location of if_tun.h */
#undef LZO1X_H #undef LINUX_IF_TUN_H
/* Name of package */ /* Name of package */
#undef PACKAGE #undef PACKAGE
@ -382,55 +350,34 @@
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME #undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #undef PACKAGE_VERSION
/* Define as the return type of signal handlers (`int' or `void'). */ /* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE #undef RETSIGTYPE
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define to 1 if you have the ANSI C header files. */ /* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS #undef STDC_HEADERS
/* Enable extensions on AIX 3, Interix. */ /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#ifndef _ALL_SOURCE #undef TIME_WITH_SYS_TIME
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
/* Version number of package */ /* Version number of package */
#undef VERSION #undef VERSION
/* Compile with support for Windows 2000 */ /* Enable GNU extenstions */
#undef WITH_WINDOWS2000 #undef _GNU_SOURCE
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Enable BSD extensions */ /* Enable BSD extensions */
#undef __USE_BSD #undef __USE_BSD
@ -438,5 +385,21 @@
/* Defined if the __malloc__ attribute is not supported. */ /* Defined if the __malloc__ attribute is not supported. */
#undef __malloc__ #undef __malloc__
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Replacement malloc() */
#undef malloc
/* Define to `int' if <sys/types.h> does not define. */ /* Define to `int' if <sys/types.h> does not define. */
#undef pid_t #undef pid_t
/* Replacement realloc() */
#undef realloc
/* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t
/* Define to empty if the keyword `volatile' does not work. Warning: valid
code using `volatile' can become incorrect without. Disable with care. */
#undef volatile

548
config.rpath Executable file
View file

@ -0,0 +1,548 @@
#! /bin/sh
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
# Copyright 1996-2003 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
#
# The first argument passed to this file is the canonical host specification,
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
# should be set by the caller.
#
# The set of defined variables is at the end of this script.
# Known limitations:
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
# than 256 bytes, otherwise the compiler driver will dump core. The only
# known workaround is to choose shorter directory names for the build
# directory and/or the installation directory.
# All known linkers require a `.a' archive for static linking (except M$VC,
# which needs '.lib').
libext=a
shrext=.so
host="$1"
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
wl=
if test "$GCC" = yes; then
wl='-Wl,'
else
case "$host_os" in
aix*)
wl='-Wl,'
;;
mingw* | pw32* | os2*)
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
;;
irix5* | irix6* | nonstopux*)
wl='-Wl,'
;;
newsos6)
;;
linux*)
case $CC in
icc|ecc)
wl='-Wl,'
;;
ccc)
wl='-Wl,'
;;
esac
;;
osf3* | osf4* | osf5*)
wl='-Wl,'
;;
sco3.2v5*)
;;
solaris*)
wl='-Wl,'
;;
sunos4*)
wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
wl='-Wl,'
;;
sysv4*MP*)
;;
uts4*)
;;
esac
fi
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$GCC" != yes; then
with_gnu_ld=no
fi
;;
openbsd*)
with_gnu_ld=no
;;
esac
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
case "$host_os" in
aix3* | aix4* | aix5*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
# that the semantics of dynamic libraries on AmigaOS, at least up
# to version 4, is to share data among multiple programs linked
# with the same dynamic library. Since this doesn't match the
# behavior of shared libraries on other platforms, we can use
# them.
ld_shlibs=no
;;
beos*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
netbsd*)
;;
solaris* | sysv5*)
if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
sunos4*)
hardcode_direct=yes
;;
*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = yes; then
# Unlike libtool, we use -rpath here, not --rpath, since the documented
# option of GNU ld is called -rpath, not --rpath.
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
fi
else
case "$host_os" in
aix3*)
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$GCC" = yes; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix4* | aix5*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
else
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
break
fi
done
esac
fi
hardcode_direct=yes
hardcode_libdir_separator=':'
if test "$GCC" = yes; then
case $host_os in aix4.[012]|aix4.[012].*)
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
hardcode_direct=yes
else
# We have old collect2
hardcode_direct=unsupported
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
esac
fi
# Begin _LT_AC_SYS_LIBPATH_AIX.
echo 'int main () { return 0; }' > conftest.c
${CC} ${LDFLAGS} conftest.c -o conftest
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
if test -z "$aix_libpath"; then
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
fi
if test -z "$aix_libpath"; then
aix_libpath="/usr/lib:/lib"
fi
rm -f conftest.c conftest
# End _LT_AC_SYS_LIBPATH_AIX.
if test "$aix_use_runtimelinking" = yes; then
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
else
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
fi
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# see comment about different semantics on the GNU ld section
ld_shlibs=no
;;
bsdi4*)
;;
cygwin* | mingw* | pw32*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec=' '
libext=lib
;;
darwin* | rhapsody*)
if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then
hardcode_direct=no
fi
;;
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
freebsd1*)
ld_shlibs=no
;;
freebsd2.2*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
freebsd2*)
hardcode_direct=yes
hardcode_minus_L=yes
;;
freebsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
hpux9*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
hpux10* | hpux11*)
if test "$with_gnu_ld" = no; then
case "$host_cpu" in
hppa*64*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=no
;;
ia64*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=no
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
esac
fi
;;
irix5* | irix6* | nonstopux*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
netbsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
newsos6)
hardcode_direct=yes
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
openbsd*)
hardcode_direct=yes
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
else
case "$host_os" in
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
hardcode_libdir_flag_spec='-R$libdir'
;;
*)
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
esac
fi
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
osf3*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*)
if test "$GCC" = yes; then
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
else
# Both cc and cxx compiler support -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
hardcode_libdir_separator=:
;;
sco3.2v5*)
;;
solaris*)
hardcode_libdir_flag_spec='-R$libdir'
;;
sunos4*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
;;
sysv4)
case $host_vendor in
sni)
hardcode_direct=yes # is this really true???
;;
siemens)
hardcode_direct=no
;;
motorola)
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
;;
esac
;;
sysv4.3*)
;;
sysv4*MP*)
if test -d /usr/nec; then
ld_shlibs=yes
fi
;;
sysv4.2uw2*)
hardcode_direct=yes
hardcode_minus_L=no
;;
sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*)
;;
sysv5*)
hardcode_libdir_flag_spec=
;;
uts4*)
hardcode_libdir_flag_spec='-L$libdir'
;;
*)
ld_shlibs=no
;;
esac
fi
# Check dynamic linker characteristics
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
libname_spec='lib$name'
case "$host_os" in
aix3*)
;;
aix4* | aix5*)
;;
amigaos*)
;;
beos*)
;;
bsdi4*)
;;
cygwin* | mingw* | pw32*)
shrext=.dll
;;
darwin* | rhapsody*)
shrext=.dylib
;;
dgux*)
;;
freebsd1*)
;;
freebsd*)
;;
gnu*)
;;
hpux9* | hpux10* | hpux11*)
case "$host_cpu" in
ia64*)
shrext=.so
;;
hppa*64*)
shrext=.sl
;;
*)
shrext=.sl
;;
esac
;;
irix5* | irix6* | nonstopux*)
case "$host_os" in
irix5* | nonstopux*)
libsuff= shlibsuff=
;;
*)
case $LD in
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
*) libsuff= shlibsuff= ;;
esac
;;
esac
;;
linux*oldld* | linux*aout* | linux*coff*)
;;
linux*)
;;
netbsd*)
;;
newsos6)
;;
nto-qnx)
;;
openbsd*)
;;
os2*)
libname_spec='$name'
shrext=.dll
;;
osf3* | osf4* | osf5*)
;;
sco3.2v5*)
;;
solaris*)
;;
sunos4*)
;;
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
;;
sysv4*MP*)
;;
uts4*)
;;
esac
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
# How to pass a linker flag through the compiler.
wl="$escaped_wl"
# Static library suffix (normally "a").
libext="$libext"
# Shared library suffix (normally "so").
shlibext="$shlibext"
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator="$hardcode_libdir_separator"
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct="$hardcode_direct"
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L="$hardcode_minus_L"
EOF

686
config.sub vendored

File diff suppressed because it is too large Load diff

16045
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -1,247 +0,0 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT([tinc], [1.0.36])
AC_CONFIG_SRCDIR([src/tincd.c])
AM_INIT_AUTOMAKE([1.11 check-news std-options subdir-objects nostdinc silent-rules -Wall])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_SILENT_RULES([yes])
# Enable GNU extensions.
# Define this here, not in acconfig's @TOP@ section, since definitions
# in the latter don't make it into the configure-time tests.
AC_GNU_SOURCE
AC_DEFINE([__USE_BSD], 1, [Enable BSD extensions])
dnl Checks for programs.
AC_PROG_CC_C99
AC_PROG_CPP
AC_PROG_INSTALL
AM_PROG_CC_C_O
dnl Check and set OS
AC_CANONICAL_HOST
case $host_os in
*linux*)
linux=true
AC_DEFINE(HAVE_LINUX, 1, [Linux])
;;
*freebsd*)
bsd=true
AC_DEFINE(HAVE_FREEBSD, 1, [FreeBSD])
;;
*darwin*)
bsd=true
AC_DEFINE(HAVE_DARWIN, 1, [Darwin (MacOS/X)])
;;
*solaris*)
solaris=true
AC_DEFINE(HAVE_SOLARIS, 1, [Solaris/SunOS])
;;
*openbsd*)
bsd=true
AC_DEFINE(HAVE_OPENBSD, 1, [OpenBSD])
;;
*netbsd*)
bsd=true
AC_DEFINE(HAVE_NETBSD, 1, [NetBSD])
;;
*dragonfly*)
bsd=true
AC_DEFINE(HAVE_DRAGONFLY, 1, [DragonFly])
;;
*bsd*)
bsd=true
AC_MSG_WARN("Unknown BSD variant, tinc might not compile or work!")
AC_DEFINE(HAVE_BSD, 1, [Unknown BSD variant])
;;
*cygwin*)
cygwin=true
AC_DEFINE(HAVE_CYGWIN, 1, [Cygwin])
;;
*mingw*)
mingw=true
AC_DEFINE(HAVE_MINGW, 1, [MinGW])
LIBS="$LIBS -lws2_32 -lgdi32 -lcrypt32"
;;
*)
AC_MSG_ERROR("Unknown operating system.")
;;
esac
AC_ARG_ENABLE(uml,
AS_HELP_STRING([--enable-uml], [enable support for User Mode Linux]),
[ AS_IF([test "x$enable_uml" = "xyes"],
[ AC_DEFINE(ENABLE_UML, 1, [Support for UML])
uml=true
],
[uml=false])
],
[uml=false]
)
AC_ARG_ENABLE(vde,
AS_HELP_STRING([--enable-vde], [enable support for Virtual Distributed Ethernet]),
[ AS_IF([test "x$enable_vde" = "xyes"],
[ AC_CHECK_HEADERS(libvdeplug_dyn.h, [], [AC_MSG_ERROR([VDE plug header files not found.]); break])
AC_DEFINE(ENABLE_VDE, 1, [Support for VDE])
vde=true
],
[vde=false])
],
[vde=false]
)
AC_ARG_ENABLE(tunemu,
AS_HELP_STRING([--enable-tunemu], [enable support for the tunemu driver]),
[ AS_IF([test "x$enable_tunemu" = "xyes"],
[ AC_DEFINE(ENABLE_TUNEMU, 1, [Support for tunemu])
tunemu=true
],
[tunemu=false])
],
[tunemu=false]
)
AC_ARG_WITH(windows2000,
AS_HELP_STRING([--with-windows2000], [compile with support for Windows 2000. This disables support for tunneling over existing IPv6 networks.]),
[ AS_IF([test "x$with_windows2000" = "xyes"],
[AC_DEFINE(WITH_WINDOWS2000, 1, [Compile with support for Windows 2000])])
]
)
AC_ARG_WITH(systemd,
AS_HELP_STRING([--with-systemd@<:@=DIR@:>@], [install systemd service files @<:@to DIR if specified@:>@]),
[ systemd=true; systemd_path="$with_systemd" ],
[ systemd=false ]
)
AS_IF([test "x$with_systemd" = "xyes"], [systemd_path="\${libdir}/systemd/system"],
[AS_IF([test "x$with_systemd" = "xno"], [systemd=false])])
AC_SUBST(systemd_path, $systemd_path)
AM_CONDITIONAL(LINUX, test "$linux" = true)
AM_CONDITIONAL(BSD, test "$bsd" = true)
AM_CONDITIONAL(SOLARIS, test "$solaris" = true)
AM_CONDITIONAL(MINGW, test "$mingw" = true)
AM_CONDITIONAL(CYGWIN, test "$cygwin" = true)
AM_CONDITIONAL(UML, test "$uml" = true)
AM_CONDITIONAL(VDE, test "$vde" = true)
AM_CONDITIONAL(TUNEMU, test "$tunemu" = true)
AM_CONDITIONAL(WITH_SYSTEMD, test "$systemd" = true)
AC_CACHE_SAVE
if test -d /sw/include ; then
CPPFLAGS="$CPPFLAGS -I/sw/include"
fi
if test -d /sw/lib ; then
LIBS="$LIBS -L/sw/lib"
fi
dnl Compiler hardening flags
dnl No -fstack-protector-all because it doesn't work on all platforms or architectures.
AX_CFLAGS_WARN_ALL(CFLAGS)
AC_ARG_ENABLE([hardening], AS_HELP_STRING([--disable-hardening], [disable compiler and linker hardening flags]))
AS_IF([test "x$enable_hardening" != "xno"],
[AX_CHECK_COMPILE_FLAG([-DFORTIFY_SOURCE=2], [CPPFLAGS="$CPPFLAGS -DFORTIFY_SOURCE=2"])
AX_CHECK_COMPILE_FLAG([-fwrapv], [CPPFLAGS="$CPPFLAGS -fwrapv"],
AX_CHECK_COMPILE_FLAG([-fno-strict-overflow], [CPPFLAGS="$CPPFLAGS -fno-strict-overflow"]))
case $host_os in
*mingw*)
AX_CHECK_LINK_FLAG([-Wl,--dynamicbase], [LDFLAGS="$LDFLAGS -Wl,--dynamicbase"])
AX_CHECK_LINK_FLAG([-Wl,--nxcompat], [LDFLAGS="$LDFLAGS -Wl,--nxcompat"])
;;
*)
AX_CHECK_COMPILE_FLAG([-fPIE], [CPPFLAGS="$CPPFLAGS -fPIE"])
AX_CHECK_LINK_FLAG([-pie], [LDFLAGS="$LDFLAGS -pie"])
;;
esac
AX_CHECK_LINK_FLAG([-Wl,-z,relro], [LDFLAGS="$LDFLAGS -Wl,-z,relro"])
AX_CHECK_LINK_FLAG([-Wl,-z,now], [LDFLAGS="$LDFLAGS -Wl,-z,now"])
]
);
dnl Checks for libraries.
dnl Checks for header files.
dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies.
AC_CHECK_HEADERS([syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param.h sys/resource.h sys/socket.h sys/time.h sys/uio.h sys/wait.h netdb.h arpa/inet.h arpa/nameser.h dirent.h getopt.h])
AC_CHECK_HEADERS([net/if.h net/if_types.h linux/if_tun.h net/if_tun.h net/if_utun.h net/tun/if_tun.h net/if_tap.h net/tap/if_tap.h net/ethernet.h net/if_arp.h netinet/in_systm.h netinet/in.h netinet/in6.h netpacket/packet.h],
[], [], [#include "$srcdir/src/have.h"]
)
AC_CHECK_HEADERS([netinet/if_ether.h netinet/ip.h netinet/ip6.h resolv.h],
[], [], [#include "$srcdir/src/have.h"]
)
AC_CHECK_HEADERS([netinet/tcp.h netinet/ip_icmp.h netinet/icmp6.h],
[], [], [#include "$srcdir/src/have.h"]
)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_PID_T
tinc_ATTRIBUTE(__malloc__)
AC_CHECK_TYPES([socklen_t, struct ether_header, struct arphdr, struct ether_arp, struct in_addr, struct addrinfo, struct ip, struct icmp, struct in6_addr, struct sockaddr_in6, struct ip6_hdr, struct icmp6_hdr, struct nd_neighbor_solicit, struct nd_opt_hdr], , ,
[#include "$srcdir/src/have.h"]
)
dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([asprintf daemon fchmod flock fork gettimeofday mlockall pselect putenv strsignal system unsetenv usleep vsyslog devname fdevname],
[], [], [#include "$srcdir/src/have.h"]
)
AC_CHECK_FUNC(getopt_long, [getopt=true; AC_DEFINE(HAVE_GETOPT_LONG, 1, [getopt_long()])], [getopt=false])
AM_CONDITIONAL(GETOPT, test "$getopt" = true)
dnl Support for SunOS
AC_CHECK_FUNC(socket, [], [
AC_CHECK_LIB(socket, connect)
])
AC_CHECK_FUNC(gethostbyname, [], [
AC_CHECK_LIB(nsl, gethostbyname)
])
AC_CHECK_DECLS([freeaddrinfo, gai_strerror, getaddrinfo, getnameinfo],
[], [], [#include "$srcdir/src/have.h"]
)
AC_CHECK_DECLS([res_init], [AC_CHECK_LIB(resolv, res_init)], [], [
#include <netinet/in.h>
#include <resolv.h>
])
AC_CACHE_SAVE
dnl These are defined in files in m4/
tinc_ZLIB
tinc_LZO
tinc_OPENSSL
dnl Check if support for jumbograms is requested
AC_ARG_ENABLE(jumbograms,
AS_HELP_STRING([--enable-jumbograms], [enable support for jumbograms (packets up to 9000 bytes)]),
[ AS_IF([test "x$enable_jumbograms" = "xyes"],
[ AC_DEFINE(ENABLE_JUMBOGRAMS, 1, [Support for jumbograms (packets up to 9000 bytes)]) ])
]
)
dnl Ensure runstatedir is set if we are using a version of autoconf that does not support it
if test "x$runstatedir" = "x"; then
AC_SUBST([runstatedir], ['${localstatedir}/run'])
fi
AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile systemd/Makefile])
AC_OUTPUT

179
configure.in Normal file
View file

@ -0,0 +1,179 @@
dnl Process this file with autoconf to produce a configure script.
dnl $Id: configure.in 1415 2004-11-10 23:20:59Z guus $
AC_PREREQ(2.59)
AC_INIT
AC_CONFIG_SRCDIR([src/tincd.c])
AM_INIT_AUTOMAKE(tinc, 1.0.4)
AC_CONFIG_HEADERS([config.h])
AM_MAINTAINER_MODE
dnl Include the macros from the m4/ directory
AM_ACLOCAL_INCLUDE(m4)
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.12.1)
# Enable GNU extensions.
# Define this here, not in acconfig's @TOP@ section, since definitions
# in the latter don't make it into the configure-time tests.
AC_DEFINE([_GNU_SOURCE], 1, [Enable GNU extenstions])
AC_DEFINE([__USE_BSD], 1, [Enable BSD extensions])
ALL_LINGUAS="nl"
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_ISC_POSIX
dnl Check and set OS
#AC_CANONICAL_HOST
case $host_os in
*linux*)
AC_DEFINE(HAVE_LINUX, 1, [Linux])
[ rm -f src/device.c; ln -sf linux/device.c src/device.c ]
;;
*freebsd*)
AC_DEFINE(HAVE_FREEBSD, 1, [FreeBSD])
[ rm -f src/device.c; ln -sf bsd/device.c src/device.c ]
;;
*darwin*)
AC_DEFINE(HAVE_DARWIN, 1, [Darwin (MacOS/X)])
[ rm -f src/device.c; ln -sf bsd/device.c src/device.c ]
;;
*solaris*)
AC_DEFINE(HAVE_SOLARIS, 1, [Solaris/SunOS])
[ rm -f src/device.c; ln -sf solaris/device.c src/device.c ]
;;
*openbsd*)
AC_DEFINE(HAVE_OPENBSD, 1, [OpenBSD])
[ rm -f src/device.c; ln -sf bsd/device.c src/device.c ]
;;
*netbsd*)
AC_DEFINE(HAVE_NETBSD, 1, [NetBSD])
[ rm -f src/device.c; ln -sf bsd/device.c src/device.c ]
;;
*bsd*)
AC_MSG_WARN("Unknown BSD variant, tinc might not compile or work!")
AC_DEFINE(HAVE_BSD, 1, [Unknown BSD variant])
[ rm -f src/device.c; ln -sf bsd/device.c src/device.c ]
;;
*cygwin*)
AC_DEFINE(HAVE_CYGWIN, 1, [Cygwin])
[ rm -f src/device.c; ln -sf cygwin/device.c src/device.c ]
;;
*mingw*)
AC_DEFINE(HAVE_MINGW, 1, [MinGW])
[ rm -f src/device.c; cp -f src/mingw/device.c src/device.c ]
LIBS="$LIBS -lws2_32"
;;
*)
AC_MSG_ERROR("Unknown operating system.")
;;
esac
AC_CACHE_SAVE
if test -d /sw/include ; then
CPPFLAGS="$CPPFLAGS -I/sw/include"
fi
if test -d /sw/lib ; then
LIBS="$LIBS -L/sw/lib"
fi
dnl Checks for libraries.
dnl Checks for header files.
dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdbool.h syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param.h sys/socket.h sys/time.h sys/uio.h sys/wait.h netdb.h arpa/inet.h])
AC_CHECK_HEADERS([net/if.h net/if_types.h net/if_tun.h net/if_tap.h net/ethernet.h net/if_arp.h netinet/in_systm.h netinet/in.h netinet/in6.h],
[], [], [#include "have.h"]
)
AC_CHECK_HEADERS([netinet/if_ether.h netinet/ip.h netinet/ip6.h],
[], [], [#include "have.h"]
)
AC_CHECK_HEADERS([netinet/tcp.h netinet/ip_icmp.h netinet/icmp6.h],
[], [], [#include "have.h"]
)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_VOLATILE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
tinc_ATTRIBUTE(__malloc__)
AC_CHECK_TYPES([socklen_t, struct ether_header, struct arphdr, struct ether_arp, struct in_addr, struct addrinfo, struct ip, struct icmp, struct in6_addr, struct sockaddr_in6, struct ip6_hdr, struct icmp6_hdr, struct nd_neighbor_solicit, struct nd_opt_hdr], , ,
[#include "have.h"]
)
dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_FUNC_ALLOCA
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([asprintf daemon fchmod flock ftime fork get_current_dir_name gettimeofday mlockall putenv random select strdup strerror strsignal strtol system unsetenv vsyslog writev],
[], [], [#include "have.h"]
)
jm_FUNC_MALLOC
jm_FUNC_REALLOC
dnl Support for SunOS
AC_CHECK_FUNC(socket, [], [
AC_CHECK_LIB(socket, connect)
])
AC_CHECK_FUNC(gethostbyname, [], [
AC_CHECK_LIB(nsl, gethostbyname)
])
AC_CHECK_FUNCS([freeaddrinfo gai_strerror getaddrinfo getnameinfo inet_aton],
[], [], [#include "have.h"]
)
AC_CACHE_SAVE
dnl These are defined in files in m4/
case $host_os in
*linux*)
tinc_TUNTAP
;;
esac
tinc_OPENSSL
tinc_ZLIB
tinc_LZO
dnl Check if support for jumbograms is requested
AC_ARG_ENABLE(jumbograms,
AS_HELP_STRING([--enable-jumbograms], [enable support for jumbograms (packets up to 9000 bytes)]),
[ AC_DEFINE(ENABLE_JUMBOGRAMS, 1, [Support for jumbograms (packets up to 9000 bytes)]) ]
)
dnl Check if checkpoint tracing has to be enabled
AC_ARG_ENABLE(tracing,
AS_HELP_STRING([--enable-tracing], [enable checkpoint tracing (debugging only)]),
[ AC_DEFINE(ENABLE_TRACING, 1, [Checkpoint tracing]) ]
)
AC_SUBST(INCLUDES)
AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile lib/Makefile po/Makefile.in m4/Makefile])
AC_OUTPUT

14
debian/NEWS vendored
View file

@ -1,14 +0,0 @@
tinc (1.0.27-1) unstable; urgency=medium
This package now provides native systemd service files, allowing multiple
instances of tinc to be managed. Existing networks listed in
/etc/tinc/nets.boot will be converted to service instances once during this
upgrade. Afterwards, you can enable and disable networks using:
systemctl enable tinc@<netname>
systemctl disable tinc@<netname>
If you do not have systemd installed, the SysV init script will continue to
work as usual. For more information, see README.Debian.
-- Guus Sliepen <guus@debian.org> Sun, 10 Apr 2016 01:33:55 +0200

76
debian/README.Debian vendored
View file

@ -1,80 +1,10 @@
tinc for Debian tinc for Debian
--------------- ----------------------
The manual for tinc is also available as info pages, type `info tinc' The manual for tinc is also available as info pages, type `info tinc'
to read it. to read it.
There are several ways in which tinc may be automatically started at boot:
Systemd
-------
Since 1.0.27-1, the tinc package comes with native systemd service files.
To enable and start a net, call:
systemctl enable tinc@<netname>
systemctl start tinc@<netname>
This will cause a tincd to be started which uses the configuration from
/etc/tinc/<netname>, and also makes sure that it will be started next time your
system boots.
Apart from controlling individual instances, you can also start/stop/reload all
enabled instances simultaneously by omitting @<netname>, for example:
systemctl reload tinc
Note that when you have systemd installed on your system, the file
/etc/tinc/nets.boot will not be used anymore to automatically start tinc
daemons. If the variable EXTRA is defined in /etc/default/tinc, it will be
passed on to tinc. The variable LIMITS is however not used.
The service files that come with this package start tinc unconditionally.
However, tinc does support socket activation. If you wish to write a socket
unit for tinc, use the ListenStream option to specify on which port(s) and
address(es) tinc should listen.
SysVinit
--------
The system startup script for tinc, /etc/init.d/tinc, uses the file The system startup script for tinc, /etc/init.d/tinc, uses the file
/etc/tinc/nets.boot to find out which networks have to be started. Use one /etc/tinc/nets.boot to find out which networks have to be started.
netname per line. Lines starting with a # are ignored.
/etc/network/interfaces -- Ivo Timmermans <ivo@debian.org>, Wed, 31 May 2000, 19:56:05 +0200
-----------------------
You can create a stanza in /etc/network/interfaces, and add a line with
"tinc-net <netname>". This will cause a tincd to be started which uses the
configuration from /etc/tinc/<netname>. You can use an inet static (with
address and netmask options) or inet dhcp stanza, in which case the ifup will
configure the VPN interface and you do not need to have a tinc-up script.
The following options are also recognized and map directly to the corresponding
command line options for tincd:
tinc-config <directory>
tinc-debug <level>
tinc-mlock yes
tinc-logfile <filename>
tinc-pidfile <filename>
tinc-chroot yes
tinc-user <username>
An example stanza:
iface vpn inet static
address 192.168.2.42
netmask 255.255.0.0
tinc-net myvpn
tinc-debug 1
tinc-mlock yes
tinc-user nobody
tinc-pidfile /tmp/tinc.pid
This will start a tinc daemon that reads its configuration from
/etc/tinc/myvpn, logs at debug level 1, locks itself in RAM, runs as user
nobody, and creates a network interface called "vpn". Ifup then sets the
address and netmask on that interface.
-- Guus Sliepen <guus@debian.org>, Sun, 10 April 2016, 01:38:08 +0200

341
debian/changelog vendored
View file

@ -1,344 +1,3 @@
tinc (1.0.36-2) unstable; urgency=medium
* Disable support for libvdeplug. Closes: #973233
-- Guus Sliepen <guus@debian.org> Sun, 22 Nov 2020 10:40:27 +0100
tinc (1.0.36-1) unstable; urgency=medium
* New upstream version 1.0.36
* Add Vcs tags to debian/control.
* Bump Standards-Version.
-- Guus Sliepen <guus@debian.org> Mon, 26 Aug 2019 14:17:21 +0200
tinc (1.0.35-2) unstable; urgency=medium
* Bump Standards-Version and Build-Depend on debhelper-compat (= 12).
* Remove calls to dh_installinit and dh_systemd_start from debian/rules,
compat level 12 does the right thing by default.
* Ensure we clean up doc/tinc.info.
-- Guus Sliepen <guus@debian.org> Mon, 28 Jan 2019 21:54:45 +0100
tinc (1.0.35-1) unstable; urgency=medium
* New upstream release.
- Includes fixes for CVE-2018-16737, CVE-2018-16738, CVE-2018-16758.
-- Guus Sliepen <guus@debian.org> Mon, 08 Oct 2018 16:09:06 +0200
tinc (1.0.34-1) unstable; urgency=medium
[ Guus Sliepen ]
* New upstream release.
- Fixes a potential segmentation fault when connecting to an IPv6
peer via a proxy. Closes: #887401
* Add support for the $EXTRA variable in /etc/default/tinc when using
systemd. Closes: #887116
[ Benda Xu ]
* Prevent possible incorrect IPv6 checksums due to function inlining.
Closes: #891400
-- Guus Sliepen <guus@debian.org> Tue, 12 Jun 2018 23:00:49 +0200
tinc (1.0.33-1) unstable; urgency=medium
* New upstream release.
* Test for /etc/default/tinc before trying to source it. Closes: #777262
* Use --runstatedir=/run.
-- Guus Sliepen <guus@debian.org> Sat, 04 Nov 2017 16:22:06 +0100
tinc (1.0.32-1) unstable; urgency=medium
* New upstream release.
* Add a note to new nets.boot files that it is not used with systemd.
Closes: #841052
* In the post-down script, read the pid file only once. Closes: #832784
* Explicitly use /bin/sleep from coreutils. Closes: #772379
* Bump Standards-Version.
-- Guus Sliepen <guus@debian.org> Tue, 05 Sep 2017 20:23:36 +0200
tinc (1.0.31-1) unstable; urgency=medium
* New upstream release.
* Bump Standards-Version.
* Bump debian/compat.
* Add missing Depends: lsb-base.
-- Guus Sliepen <guus@debian.org> Sun, 15 Jan 2017 16:20:40 +0100
tinc (1.0.29-2) unstable; urgency=medium
* Rebuild with libssl-dev from unstable.
-- Guus Sliepen <guus@debian.org> Thu, 27 Oct 2016 13:09:46 +0200
tinc (1.0.29-1) unstable; urgency=medium
* New upstream release.
* Bump debian/compat.
-- Guus Sliepen <guus@debian.org> Mon, 10 Oct 2016 22:30:25 +0200
tinc (1.0.28-1) unstable; urgency=medium
* New upstream release.
- Fixes FTBFS on kfreebsd.
* Systemd service files are now provided by upstream.
-- Guus Sliepen <guus@debian.org> Sun, 10 Apr 2016 15:44:28 +0200
tinc (1.0.27-2) unstable; urgency=medium
* Fix tinc@.service.
-- Guus Sliepen <guus@debian.org> Sun, 10 Apr 2016 12:45:33 +0200
tinc (1.0.27-1) unstable; urgency=medium
* New upstream release.
* Bump Standards-Version.
* Add native systemd unit files.
* Automatically convert networks listed in nets.boot to systemd service
instances on upgrade.
-- Guus Sliepen <guus@debian.org> Sun, 10 Apr 2016 01:39:16 +0200
tinc (1.0.26-1) unstable; urgency=medium
* New upstream release.
* Use the contents, not the presence, of the pidfile to check that tincd is
shut down properly. Closes: #774682
* Bump Standards-Version.
-- Guus Sliepen <guus@debian.org> Sun, 05 Jul 2015 17:23:08 +0200
tinc (1.0.24-2) unstable; urgency=medium
* Improve the init script: stopping tinc now waits for the process to
terminate. If that doesn't happen in 5 seconds, it will send the TERM
signal again (which helps if tinc is waiting for a script to finish
executing). It now also detects whether the process mentioned in the PID
file is actually running, and if not it will exit early and without
warnings. Closes: #748107
-- Guus Sliepen <guus@debian.org> Wed, 14 May 2014 21:44:16 +0200
tinc (1.0.24-1) unstable; urgency=medium
[ Guus Sliepen ]
* New upstream release
* Add a debian/watch file.
* Bump Standards-Version.
[ Gian Piero Carrubba ]
* Allow resource limits to be set in /etc/default/tinc.
Closes: #690685, #704702
-- Guus Sliepen <guus@debian.org> Sun, 11 May 2014 21:17:13 +0200
tinc (1.0.23-2) unstable; urgency=low
* Use if-statements instead of && in shell scripts. Closes: #731279
The && operator does not clear the error status, and if the next statement
in a shell script does not change the error status it would cause the
script to prematurely exit. Thanks to Peter Reinholdtsen for spotting it.
* Use absolute path to tincd in the if-post-down script.
-- Guus Sliepen <guus@debian.org> Thu, 05 Dec 2013 09:41:13 +0000
tinc (1.0.23-1) unstable; urgency=low
* New upstream release.
-- Guus Sliepen <guus@debian.org> Sat, 19 Oct 2013 21:06:05 +0200
tinc (1.0.22-1) unstable; urgency=low
* New upstream release.
- Handles whitespace between command line flags and optional arguments.
Closes: #710267
* Bump Standards-Version.
* Source /lib/lsb/init-functions in the init.d script.
* Don't use texi2html anymore, use automake's install-html target which uses
makeinfo.
-- Guus Sliepen <guus@debian.org> Wed, 14 Aug 2013 15:34:29 +0200
tinc (1.0.21-1) unstable; urgency=low
* New upstream release.
- Includes fix for CVE-2013-1428.
-- Guus Sliepen <guus@debian.org> Sun, 05 May 2013 10:42:33 +0200
tinc (1.0.19-3) unstable; urgency=high
* Drop packets forwarded via TCP if they are too big (CVE-2013-1428).
-- Guus Sliepen <guus@debian.org> Fri, 12 Apr 2013 22:52:10 +0200
tinc (1.0.19-2) unstable; urgency=low
* Fix behaviour of tinc-pidfile. Closes: #679130
* Enable parallel building in debian/rules.
-- Guus Sliepen <guus@debian.org> Tue, 26 Jun 2012 18:28:34 +0200
tinc (1.0.19-1) unstable; urgency=low
* New upstream release.
* Bump debian/compat so tinc gets built with hardening flags.
* Allow tinc-pidfile in /etc/network/interfaces.
-- Guus Sliepen <guus@debian.org> Mon, 25 Jun 2012 20:29:22 +0200
tinc (1.0.18-1) unstable; urgency=low
* New upstream release.
-- Guus Sliepen <guus@debian.org> Sun, 25 Mar 2012 18:52:15 +0200
tinc (1.0.17-1) unstable; urgency=low
* New upstream release.
* Enable support for UML and VDE.
-- Guus Sliepen <guus@debian.org> Sat, 10 Mar 2012 14:50:00 +0100
tinc (1.0.16-1) unstable; urgency=low
* New upstream release.
* Mention alarm option in /etc/init.d/tinc's usage information.
Closes: #631761
-- Guus Sliepen <guus@debian.org> Sat, 23 Jul 2011 14:37:56 +0200
tinc (1.0.15-1) unstable; urgency=low
* New upstream release.
* Send SIGALRM to running tinc daemons whenever an interface is brought up
with the ifupdown framework. Based on a patch from Joachim Breitner.
Closes: #629880
* Allow tinc daemons to be started using ifupdown.
-- Guus Sliepen <guus@debian.org> Fri, 24 Jun 2011 18:21:51 +0200
tinc (1.0.14-1) unstable; urgency=low
* New upstream release.
* Bump Standards-Version.
-- Guus Sliepen <guus@debian.org> Mon, 09 May 2011 00:25:37 +0200
tinc (1.0.13-1) unstable; urgency=low
* New upstream release.
-- Guus Sliepen <guus@debian.org> Tue, 13 Apr 2010 12:06:36 +0200
tinc (1.0.12-2) unstable; urgency=low
* Remove debconf questions. Closes: #572116
Apparently debconf may not be used to ask a question at install time and
use the answer at upgrade time. Instead of kludging around this
restriction, no questions are asked anymore, and tinc will now always be
restarted when upgrading.
* Wait up to 5 seconds for tinc daemon to stop before restarting it.
-- Guus Sliepen <guus@debian.org> Tue, 02 Mar 2010 14:01:36 +0100
tinc (1.0.12-1) unstable; urgency=low
* New upstream release.
* Bump Standards-Version.
* Migrate from CDBS to debhelper.
* Convert source package to 3.0 (quilt) format.
* Remove useless tinc.modules.
* Use init.d script from Michael Tokarev, allowing per-network arguments to
tincd.
* Remove update-rc.d calls from postinst and postrm.
* Let the init.d script depend on $remote_fs.
-- Guus Sliepen <guus@debian.org> Thu, 04 Feb 2010 00:56:45 +0100
tinc (1.0.11-1) unstable; urgency=low
* New upstream release.
* Cope with texi2html arbitrarily changing its output directory.
Closes: #552927
* Do not stop tinc when configuring a new version, just restart after
the upgrade.
-- Guus Sliepen <guus@debian.org> Sun, 01 Nov 2009 20:37:16 +0100
tinc (1.0.10-1) unstable; urgency=low
* New upstream release.
* Include Russian debconf translation. Closes: #548759
-- Guus Sliepen <guus@debian.org> Sun, 18 Oct 2009 16:31:49 +0200
tinc (1.0.9-1) unstable; urgency=low
* New upstream release.
- Binds IPv6 sockets only to IPv6. Closes: #440150
* Update copyright file. Closes: #482566
-- Guus Sliepen <guus@debian.org> Fri, 26 Dec 2008 13:25:05 +0100
tinc (1.0.8-2) unstable; urgency=low
* Include Portugese debconf translation. Closes: #434191
-- Guus Sliepen <guus@debian.org> Tue, 14 Aug 2007 13:50:27 +0200
tinc (1.0.8-1) unstable; urgency=low
* New upstream release. Closes: #173987
* Include german debconf translation. Closes: #412351
* Build-Depend on texinfo. Closes: #424209
-- Guus Sliepen <guus@debian.org> Wed, 16 May 2007 17:59:16 +0200
tinc (1.0.7-1) unstable; urgency=low
* New upstream release.
-- Guus Sliepen <guus@debian.org> Fri, 5 Jan 2007 15:55:42 +0100
tinc (1.0.6-1) unstable; urgency=low
* New upstream release.
-- Guus Sliepen <guus@debian.org> Mon, 18 Dec 2006 15:41:03 +0100
tinc (1.0.5-1) unstable; urgency=low
* New upstream release. Closes: #391610
* Add an LSB section to the init script.
-- Guus Sliepen <guus@debian.org> Tue, 14 Nov 2006 16:32:20 +0100
tinc (1.0.4-4) unstable; urgency=low
* Include swedish debconf translation. Closes: #332963
* Remove nets.boot on purge. Closes: #333303
-- Guus Sliepen <guus@debian.org> Mon, 17 Oct 2005 12:34:32 +0200
tinc (1.0.4-3) unstable; urgency=low
* Depend on debconf | debconf-2.0.
* Include vietnamese debconf translation. Closes: #322305
* Include japanese debconf translation. Closes: #319591
-- Guus Sliepen <guus@debian.org> Thu, 29 Sep 2005 11:15:34 +0200
tinc (1.0.4-2) unstable; urgency=low tinc (1.0.4-2) unstable; urgency=low
* Compensate for change in texinfo's output directory. Closes: #318562 * Compensate for change in texinfo's output directory. Closes: #318562

1
debian/compat vendored Normal file
View file

@ -0,0 +1 @@
4

9
debian/config vendored Normal file
View file

@ -0,0 +1,9 @@
#!/bin/sh -e
# Source debconf library.
. /usr/share/debconf/confmodule
db_title tinc configuration
db_input medium tinc/restart_on_upgrade || true
db_go

17
debian/control vendored
View file

@ -2,19 +2,18 @@ Source: tinc
Section: net Section: net
Priority: optional Priority: optional
Maintainer: Guus Sliepen <guus@debian.org> Maintainer: Guus Sliepen <guus@debian.org>
Standards-Version: 4.4.0 Standards-Version: 3.6.2
Build-Depends: libssl-dev, debhelper-compat (= 12), gettext, texinfo, zlib1g-dev, liblzo2-dev Build-Depends: libssl-dev, debhelper (>= 4.1.16), gettext, texi2html, zlib1g-dev, cdbs, liblzo-dev
Homepage: http://www.tinc-vpn.org/
Vcs-Browser: https://salsa.debian.org/guus/tinc
Vcs-Git: https://salsa.debian.org/guus/tinc.git
Rules-Requires-Root: no
Package: tinc Package: tinc
Architecture: any Architecture: any
Pre-Depends: ${misc:Pre-Depends} Depends: debconf, ${shlibs:Depends}
Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base (>= 3.0-6)
Description: Virtual Private Network daemon Description: Virtual Private Network daemon
tinc is a daemon with which you can create a virtual private network tinc is a daemon with which you can create a virtual private network
(VPN). One daemon can handle multiple connections, so you can (VPN). One daemon can handle multiple connections, so you can
create an entire (moderately sized) VPN with only one daemon per create an entire (moderately sized) VPN with only one daemon per
participating computer. participating computer.
.
You need to have two kernel modules installed, on a Debian system
they should already be there. If they are not, the manual will
explain you how to do that.

12
debian/copyright vendored
View file

@ -7,16 +7,12 @@ Upstream Authors:
Guus Sliepen <guus@tinc-vpn.org> Guus Sliepen <guus@tinc-vpn.org>
Ivo Timmermans <ivo@tinc-vpn.org> Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 1998-2005 Ivo Timmermans Copyright: GPL version 2. On Debian GNU/Linux systems, the complete
1998-2008 Guus Sliepen <guus@tinc-vpn.org> text of the GNU General Public License can be found in
/usr/share/common-licenses/GPL.
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
On Debian GNU/Linux systems, the complete text of the GNU General Public The following is the text from /usr/share/doc/tinc/COPYING.README:
License version 2 can be found in /usr/share/common-licenses/GPL-2.
The following applies to tinc: The following applies to tinc:

View file

@ -3,8 +3,8 @@ Title: tinc Manual
Author: Ivo Timmermans, Guus Sliepen Author: Ivo Timmermans, Guus Sliepen
Abstract: This manual describes how to set up a Virtual Private Abstract: This manual describes how to set up a Virtual Private
Network with tinc. Network with tinc.
Section: System/Security Section: net
Format: HTML Format: HTML
Files: /usr/share/doc/tinc/tinc.html/* Files: /usr/share/doc/tinc/tinc*.html
Index: /usr/share/doc/tinc/tinc.html/index.html Index: /usr/share/doc/tinc/tinc_toc.html

78
debian/init.d vendored Normal file
View file

@ -0,0 +1,78 @@
#! /bin/sh
#
# System startup script for tinc
# $Id: init.d,v 1.14.2.4 2000/12/05 09:03:41 zarq Exp $
#
# Based on Lubomir Bulej's Redhat init script.
#
# Create a file $NETSFILE (/etc/tinc/nets.boot), and put all the names of
# the networks in there. These names must be valid directory names under
# $TCONF (/etc/tinc). Lines starting with a # will be ignored in this
# file.
#
DAEMON="/usr/sbin/tincd"
NAME="tinc"
DESC="tinc daemons"
TCONF="/etc/tinc"
NETSFILE="$TCONF/nets.boot"
NETS=""
test -f $DAEMON || exit 0
[ -r /etc/default/tinc ] && . /etc/default/tinc
find_nets () {
if [ ! -f $NETSFILE ] ; then
echo "Please create $NETSFILE."
exit 0
fi
NETS="`egrep '^[ ]*[a-zA-Z0-9_-]+[ ]*$' $NETSFILE`"
}
case "$1" in
start)
find_nets
echo -n "Starting $DESC:"
for n in $NETS ; do
echo -n " $n"
$DAEMON -n $n $EXTRA
done
echo "."
;;
stop)
find_nets
echo -n "Stopping $DESC:"
for n in $NETS ; do
echo -n " $n"
$DAEMON -n $n $EXTRA -k
done
echo "."
;;
reload|force-reload)
find_nets
echo -n "Reloading $DESC configuration:"
for n in $NETS ; do
echo -n " $n"
$DAEMON -n $n $EXTRA -kHUP
done
echo "."
;;
restart)
find_nets
echo -n "Restarting $DESC:"
for n in $NETS ; do
echo -n " $n"
$DAEMON -n $n $EXTRA -k
sleep 1
$DAEMON -n $n $EXTRA
done
echo "."
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload}"
exit 1
;;
esac
exit 0

View file

@ -1,65 +0,0 @@
Package: tinc
Version: 1.0.33-1
Severity: important
Dear Guus,
I have been using tinc since 2009 and it is great!
When PMTUDiscovery=yes and Mode=switch, and if ipv6 is used inside
tinc, the ICMPv6 "Packet Too Big" packets have incorrect checksums.
It can be reproduced by `ping6 <host in tinc> -s 1800` and `tcpdump -i
<tinc interface>`. Consequently, the host ignores the tinc-generated
ICMPv6 packets, PMTUDiscovery does not work and the connections freeze
when data flows are big.
I find the bug is gone if the function "inet_checksum" in route.c is
not inlined, either by compiling tinc with "-O2
-fno-inline-functions", or apply a patch such as,
diff --git a/src/route.c b/src/route.c
index ff82c06e..cd55383a 100644
--- a/src/route.c
+++ b/src/route.c
@@ -60,7 +60,7 @@ static const size_t opt_size = sizeof(struct nd_opt_hdr);
/* RFC 1071 */
-static uint16_t inet_checksum(void *data, int len, uint16_t prevsum) {
+__attribute__ ((noinline)) static uint16_t inet_checksum(void *data, int len, uint16_t prevsum) {
uint16_t *p = data;
uint32_t checksum = prevsum ^ 0xFFFF;
I have tested with gcc-7.3.0 and gcc-5.4.0. They behaved the same. I
am not good at assembly to find out what really happened, but it is
for sure that inet_checksum does not work as expected if compiled
inline.
Thanks!
Yours,
Benda
-- System Information:
Debian Release: buster/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.9.0-5-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8), LANGUAGE=en_US:en (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
Versions of packages tinc depends on:
ii libc6 2.26-2
ii liblzo2-2 2.08-1.2+b2
ii libssl1.1 1.1.0g-2
ii lsb-base 9.20170808
ii zlib1g 1:1.2.8.dfsg-5
tinc recommends no packages.
tinc suggests no packages.

View file

@ -1,2 +0,0 @@
fix-incorrect-icmpv6-checksum
support-etc-defaults-tinc

View file

@ -1,12 +0,0 @@
--- a/systemd/tinc@.service.in
+++ b/systemd/tinc@.service.in
@@ -9,7 +9,8 @@
[Service]
Type=simple
WorkingDirectory=@sysconfdir@/tinc/%i
-ExecStart=@sbindir@/tincd -n %i -D
+EnvironmentFile=/etc/default/tinc
+ExecStart=@sbindir@/tincd -n %i -D $EXTRA
ExecReload=@sbindir@/tincd -n %i -kHUP
KillMode=mixed
Restart=on-failure

1
debian/po/POTFILES.in vendored Normal file
View file

@ -0,0 +1 @@
[type: gettext/rfc822deb] tinc.templates

63
debian/po/cs.po vendored Normal file
View file

@ -0,0 +1,63 @@
#
# Translators, if you are not familiar with the PO format, gettext
# documentation is worth reading, especially sections dedicated to
# this format, e.g. by running:
# info -n '(gettext)PO Files'
# info -n '(gettext)Header Entry'
#
# Some information specific to po-debconf are available at
# /usr/share/doc/po-debconf/README-trans
# or http://www.debian.org/intl/l10n/po-debconf/README-trans
#
# Developers do not need to manually edit POT or PO files.
#
msgid ""
msgstr ""
"Project-Id-Version: tinc 1.0.4-1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2004-11-11 20:06+0000\n"
"PO-Revision-Date: 2005-06-10 22:44+0200\n"
"Last-Translator: Martin Sin <martin.sin@seznam.cz>\n"
"Language-Team: Czech <debian-l10n-czech@lists.debian.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-2\n"
"Content-Transfer-Encoding: 8bit\n"
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid "Restart tinc on each upgrade?"
msgstr "Restartovat tinc pøi ka¾dé aktualizaci?"
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid ""
"You may choose if you want me to restart the tinc daemon every time you "
"install a new version of this package."
msgstr ""
"Mù¾ete zvolit, zda restartovat tinc daemona poka¾dé, kdy¾ je instalována "
"nová verze tohoto balíèku."
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid ""
"Sometimes you don't want to do this, for example if you are doing the "
"upgrade over a tunnel that is created with tinc. Stopping the daemon would "
"probably leave you with a dead connection, and tinc may not be started again."
msgstr ""
"Nìkdy tuto mo¾nost nepotøebujete, napøíklad pokud provádíte aktualizaci "
"pøes tunel, který je vytvoøen pomocí tinc. Zastavení tohoto daemona "
"vám pravdìpodobnì zanechá \"mrtvé pøipojení\" a navíc se tinc nemusí znovu "
"spustit."
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid ""
"If you refuse, you have to restart tinc yourself if you upgraded, by typing "
"`invoke-rc.d tinc restart' whenever it suits you."
msgstr ""
"Pokud zamítnete, musíte po aktualizaci restartovat tinc ruènì, zadáním "
"pøíkazu `invoke-rc.d tinc restart' kdykoliv se vám to hodí."

62
debian/po/fr.po vendored Normal file
View file

@ -0,0 +1,62 @@
#
# Translators, if you are not familiar with the PO format, gettext
# documentation is worth reading, especially sections dedicated to
# this format, e.g. by running:
# info -n '(gettext)PO Files'
# info -n '(gettext)Header Entry'
# Some information specific to po-debconf are available at
# /usr/share/doc/po-debconf/README-trans
# or http://www.debian.org/intl/l10n/po-debconf/README-trans#
# Developers do not need to manually edit POT or PO files.
#
msgid ""
msgstr ""
"Project-Id-Version: tinc_1.0.3-4\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2004-11-11 20:06+0000\n"
"PO-Revision-Date: 2005-02-18 12:42+0100\n"
"Last-Translator: Michel Grentzinger <mic.grentz@online.fr>\n"
"Language-Team: French <debian-l10n-french@lists.debian.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-15\n"
"Content-Transfer-Encoding: 8bit\n"
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid "Restart tinc on each upgrade?"
msgstr "Faut-il redémarrer tinc à chaque mise à jour ?"
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid ""
"You may choose if you want me to restart the tinc daemon every time you "
"install a new version of this package."
msgstr ""
"Vous pouvez choisir de redémarrer le démon tinc à chaque fois que vous "
"installez une nouvelle version de ce paquet."
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid ""
"Sometimes you don't want to do this, for example if you are doing the "
"upgrade over a tunnel that is created with tinc. Stopping the daemon would "
"probably leave you with a dead connection, and tinc may not be started again."
msgstr ""
"Dans certains cas, vous devrez éviter de le faire, par exemple si vous "
"mettez à jour à travers un tunnel créé avec tinc. Arrêter le démon "
"laisserait sans doute une connexion inactive et tinc ne pourrait pas être "
"redémarré."
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid ""
"If you refuse, you have to restart tinc yourself if you upgraded, by typing "
"`invoke-rc.d tinc restart' whenever it suits you."
msgstr ""
"Si vous refusez cette option, vous devrez redémarrer tinc vous-même en cas "
"de mise à jour, avec la commande : « invoke-rc.d tinc restart », au moment "
"où cela vous conviendra."

63
debian/po/nl.po vendored Normal file
View file

@ -0,0 +1,63 @@
#
# Translators, if you are not familiar with the PO format, gettext
# documentation is worth reading, especially sections dedicated to
# this format, e.g. by running:
# info -n '(gettext)PO Files'
# info -n '(gettext)Header Entry'
#
# Some information specific to po-debconf are available at
# /usr/share/doc/po-debconf/README-trans
# or http://www.debian.org/intl/l10n/po-debconf/README-trans
#
# Developers do not need to manually edit POT or PO files.
#
msgid ""
msgstr ""
"Project-Id-Version: tinc_1.0.4-1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2004-11-11 20:06+0000\n"
"PO-Revision-Date: 2005-05-04 21:40+0200\n"
"Last-Translator: Guus Sliepen <guus@debian.org>\n"
"Language-Team: Dutch <nl@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid "Restart tinc on each upgrade?"
msgstr "Start tinc opnieuw na iedere upgrade?"
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid ""
"You may choose if you want me to restart the tinc daemon every time you "
"install a new version of this package."
msgstr ""
"Je kunt kiezen of ik de tinc daemon opnieuw moet starten iedere keer als je "
"een nieuwe versie van het pakket installeert."
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid ""
"Sometimes you don't want to do this, for example if you are doing the "
"upgrade over a tunnel that is created with tinc. Stopping the daemon would "
"probably leave you with a dead connection, and tinc may not be started again."
msgstr ""
"Soms wil je dit niet doen, bij voorbeeld als je de upgrade uitvoert over een "
"tunnel die met tinc is gemaakt. Het stoppen van tinc resulteert dan "
"waarschijnlijk is een dode verbinding, en tinc wordt dan misschien niet "
"opnieuw gestart."
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid ""
"If you refuse, you have to restart tinc yourself if you upgraded, by typing "
"`invoke-rc.d tinc restart' whenever it suits you."
msgstr ""
"Als je weigert, moet je zelf tinc opnieuw starten na een upgrade, door"
"`invoke-rc.d tinc restart' in te tiepen wanneer het goed uitkomt."

56
debian/po/templates.pot vendored Normal file
View file

@ -0,0 +1,56 @@
#
# Translators, if you are not familiar with the PO format, gettext
# documentation is worth reading, especially sections dedicated to
# this format, e.g. by running:
# info -n '(gettext)PO Files'
# info -n '(gettext)Header Entry'
#
# Some information specific to po-debconf are available at
# /usr/share/doc/po-debconf/README-trans
# or http://www.debian.org/intl/l10n/po-debconf/README-trans
#
# Developers do not need to manually edit POT or PO files.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2004-11-11 20:06+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid "Restart tinc on each upgrade?"
msgstr ""
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid ""
"You may choose if you want me to restart the tinc daemon every time you "
"install a new version of this package."
msgstr ""
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid ""
"Sometimes you don't want to do this, for example if you are doing the "
"upgrade over a tunnel that is created with tinc. Stopping the daemon would "
"probably leave you with a dead connection, and tinc may not be started again."
msgstr ""
#. Type: boolean
#. Description
#: ../tinc.templates:4
msgid ""
"If you refuse, you have to restart tinc yourself if you upgraded, by typing "
"`invoke-rc.d tinc restart' whenever it suits you."
msgstr ""

75
debian/postinst vendored
View file

@ -1,25 +1,77 @@
#! /bin/sh #! /bin/sh
# postinst script for tinc
#
# $Id: postinst,v 1.6 2000/05/21 23:01:28 zarq Exp $
#
# see: dh_installdeb(1)
NETSFILE="/etc/tinc/nets.boot" TCONF="/etc/tinc"
NETSFILE="$TCONF/nets.boot"
RET="false"
set -e set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see /usr/doc/packaging-manual/
#
# quoting from the policy:
# Any necessary prompting should almost always be confined to the
# post-installation script, and should be protected with a conditional
# so that unnecessary prompting doesn't happen if a package's
# installation fails and the `postinst' is called with `abort-upgrade',
# `abort-remove' or `abort-deconfigure'.
# Automatically added by dh_installinit, edited for use with debconf
if [ -x "/etc/init.d/tinc" ]; then
update-rc.d tinc defaults >/dev/null
if [ "$1" = "configure" ] ; then
if dpkg --compare-versions "$2" lt "1.0pre5-4" ; then
RET="true"
else
if [ -e /usr/share/debconf/confmodule ] ; then
. /usr/share/debconf/confmodule
db_get tinc/restart_on_upgrade
db_stop
else
RET="true"
fi
fi
fi
fi
# End automatically added section
case "$1" in case "$1" in
configure) configure)
if [ ! -e /dev/.devfsd ] ; then if [ ! -e /dev/.devfs ] ; then if [ ! -e /dev/.devfsd -a ! -e /dev/.devfs ] ; then
if [ ! -e /dev/net/tun ] ; then if [ ! -e /dev/tun ] ; then if [ -e /dev/MAKEDEV ]; then if [ ! -e /dev/net/tun -a ! -e /dev/tun ] ; then
echo "Creating tun device..." echo "Creating tun device..."
cd /dev && ./MAKEDEV net/tun 2>/dev/null || ./MAKEDEV tun 2>/dev/null || echo "Failed to create tun device." cd /dev && ./MAKEDEV net/tun 2>/dev/null || ./MAKEDEV tun 2>/dev/null || echo "Failed to create tun device."
fi; fi; fi fi
fi; fi fi
if [ ! -e $NETSFILE ] ; then if [ ! -e $NETSFILE ] ; then
echo "## This file contains all names of the networks to be started on system startup when using sysvinit." > $NETSFILE echo "## This file contains all names of the networks to be started on system startup." > $NETSFILE
echo "## If you are using systemd, use systemctl enable tinc@netname to enable individual networks." >> $NETSFILE
fi fi
;;
if [ "$RET" = "true" ] ; then
invoke-rc.d tinc start
else
echo "I have not stopped or restarted the tinc daemon. You should do this"
echo "yourself whenever you're ready; type \`\`invoke-rc.d tinc restart''."
fi
;;
abort-upgrade|abort-remove|abort-deconfigure) abort-upgrade|abort-remove|abort-deconfigure)
;; ;;
*) *)
@ -28,4 +80,11 @@ case "$1" in
;; ;;
esac esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER# #DEBHELPER#
exit 0

6
debian/postrm vendored
View file

@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
set -e set -e
# Automatically added by package maintainer
if [ "$1" = purge ]; then if [ "$1" = purge ]; then
rm -f /etc/tinc/nets.boot update-rc.d tinc remove >/dev/null 2>/dev/null
fi fi
# End automatically added section
#DEBHELPER# #DEBHELPER#

28
debian/preinst vendored
View file

@ -1,28 +0,0 @@
#!/bin/sh
NETSFILE="/etc/tinc/nets.boot"
SYSTEM="/lib/systemd/system"
WANTS="/etc/systemd/system/multi-user.target.wants"
set -e
case "$1" in
upgrade)
if dpkg --compare-versions "$2" '<<' "1.0.27-1"; then
if [ -f "$NETSFILE" ]; then
echo -n "Creating systemd service instances from nets.boot:"
mkdir -p "$WANTS"
egrep '^[ ]*[a-zA-Z0-9_-]+' $NETSFILE | while read net args; do
echo -n " $net"
ln -s "$SYSTEM/tinc@.service" "$WANTS/tinc@$net.service" 2>/dev/null || true
done
echo "."
fi
fi
;;
*)
;;
esac
#DEBHELPER#

18
debian/prerm vendored Normal file
View file

@ -0,0 +1,18 @@
#!/bin/sh
# Automatically added by dh_installinit, edited for use with debconf
if [ -x "/etc/init.d/tinc" ]; then
if [ -e /usr/share/debconf/confmodule ] ; then
. /usr/share/debconf/confmodule
db_get tinc/restart_on_upgrade
if [ "$RET" = "true" ] ; then
invoke-rc.d tinc stop
fi
db_stop
else
invoke-rc.d tinc stop
fi
fi
# End automatically added section
#DEBHELPER#

25
debian/rules vendored
View file

@ -1,16 +1,19 @@
#!/usr/bin/make -f #!/usr/bin/make -f
%: include /usr/share/cdbs/1/rules/debhelper.mk
dh $@ #include /usr/share/cdbs/1/rules/simple-patchsys.mk
include /usr/share/cdbs/1/class/autotools.mk
override_dh_clean: DEB_CONFIGURE_EXTRA_FLAGS = --enable-tracing
dh_clean
rm -f doc/tinc.info
override_dh_auto_configure: # A bit of a kludge, we have our own init.d handling in postinst, but
dh_auto_configure -- --enable-uml --with-systemd=/lib/systemd/system --runstatedir=/run # cdbs calls dh_installinit anyway.
DEB_DH_INSTALLINIT_ARGS = -n
override_dh_auto_install: clean::
dh_auto_install -- install-html rm -f src/device.c
# Remove info dir file build/tinc::
rm -f debian/tinc/usr/share/info/dir cd doc && $(MAKE) texi2html
binary-post-install/tinc::
mv -v doc/tinc/*.html debian/$(cdbs_curpkg)/usr/share/doc/$(cdbs_curpkg)/
cd debian/$(cdbs_curpkg)/usr/share/doc/$(cdbs_curpkg)/ && tar xzf ../../../../../../doc/sample-config.tar.gz && mv sample-config examples && rm -rf examples/CVS examples/hosts/CVS

View file

@ -1 +0,0 @@
3.0 (quilt)

5
debian/tinc.default vendored
View file

@ -1,7 +1,2 @@
# Extra options to be passed to tincd. # Extra options to be passed to tincd.
# EXTRA="-d" # EXTRA="-d"
# Limits to be configured for the tincd process. Please read your shell
# (pointed by /bin/sh) documentation for ulimit. You probably want to raise the
# max locked memory value if using both --mlock and --user flags.
# LIMITS="-l 1024"

View file

@ -1,41 +0,0 @@
#!/bin/sh
set -e
if [ "$METHOD" = loopback -o -z "$IF_TINC_NET" ]; then
exit 0
fi
# Determine location of the PID file
EXTRA=""
if [ -n "$IF_TINC_PIDFILE" ]; then
EXTRA="--pidfile=$IF_TINC_PIDFILE"
else
IF_TINC_PIDFILE=/var/run/tinc.$IF_TINC_NET.pid
fi
# Stop the tinc daemon
read pid rest < $IF_TINC_PIDFILE 2>/dev/null
/usr/sbin/tincd -n "$IF_TINC_NET" -k $EXTRA
# Wait for it to shut down properly
/bin/sleep 0.1
i=0;
while [ -f $IF_TINC_PIDFILE ] ; do
if [ ! -e "/proc/$pid" ] ; then
exit 0
fi
if [ $i = '30' ] ; then
echo 'Failed to stop tinc daemon!'
exit 1
fi
/bin/sleep 0.1
i=$(($i+1))
done
exit 0

70
debian/tinc.if-pre-up vendored
View file

@ -1,70 +0,0 @@
#!/bin/sh
set -e
if [ "$METHOD" = loopback -o -z "$IF_TINC_NET" ]; then
exit 0
fi
# Read options from /etc/default
[ -r /etc/default/tinc ] && . /etc/default/tinc
# Set process limits
setlimits() {
while [ $# -gt 0 ]; do
parm=$1 ; shift
if [ -n "$1" -a "${1#-}" = "$1" ]; then
value=$1 ; shift
ulimit $parm $value
else
ulimit $parm
fi
done
}
test -n "$LIMITS" && setlimits $LIMITS
# Read options from /etc/network/interfaces
[ -n "$IF_TINC_CONFIG" ] && EXTRA="$EXTRA -c $IF_TINC_CONFIG"
[ -n "$IF_TINC_DEBUG" ] && EXTRA="$EXTRA -d$IF_TINC_DEBUG"
[ -n "$IF_TINC_MLOCK" ] && EXTRA="$EXTRA --mlock"
[ -n "$IF_TINC_LOGFILE" ] && EXTRA="$EXTRA --logfile=$IF_TINC_LOGFILE"
[ -n "$IF_TINC_PIDFILE" ] && EXTRA="$EXTRA --pidfile=$IF_TINC_PIDFILE" || IF_TINC_PIDFILE=/var/run/tinc.$IF_TINC_NET.pid
[ -n "$IF_TINC_CHROOT" ] && EXTRA="$EXTRA --chroot"
[ -n "$IF_TINC_USER" ] && EXTRA="$EXTRA --user=$IF_TINC_USER"
# Start tinc daemon
/usr/sbin/tincd -n "$IF_TINC_NET" -o "Interface=$IFACE" $EXTRA
# Wait for it to come up properly
/bin/sleep 0.1
i=0;
while [ ! -f $IF_TINC_PIDFILE ] ; do
if [ $i = '30' ] ; then
echo 'Failed to start tinc daemon!'
exit 1
fi
/bin/sleep 0.1
i=$(($i+1))
done
while read pid rest < $IF_TINC_PIDFILE ; do
if [ -e "/proc/$pid" ] ; then
exit 0
fi
if [ $i = '30' ] ; then
echo 'Failed to start tinc daemon!'
exit 1
fi
/bin/sleep 0.1
i=$(($i+1))
done
exit 0

9
debian/tinc.if-up vendored
View file

@ -1,9 +0,0 @@
#!/bin/sh
set -e
if [ "$METHOD" = loopback -o -n "$IF_TINC_NET" ]; then
exit 0
fi
invoke-rc.d tinc alarm || exit 0

140
debian/tinc.init vendored
View file

@ -1,140 +0,0 @@
#! /bin/sh
#
### BEGIN INIT INFO
# Provides: tinc
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Should-Start: $syslog $named
# Should-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start tinc daemons
# Description: Create a file $NETSFILE (/etc/tinc/nets.boot),
# and put all the names of the networks in there.
# These names must be valid directory names under
# $TCONF (/etc/tinc). Lines starting with a # will be
# ignored in this file.
### END INIT INFO
#
# Based on Lubomir Bulej's Redhat init script.
. /lib/lsb/init-functions
DAEMON="/usr/sbin/tincd"
NAME="tinc"
DESC="tinc daemons"
TCONF="/etc/tinc"
NETSFILE="$TCONF/nets.boot"
NETS=""
test -f $DAEMON || exit 0
[ -r /etc/default/tinc ] && . /etc/default/tinc
# foreach_net "what-to-say" action [arguments...]
foreach_net() {
if [ ! -f $NETSFILE ] ; then
echo "Please create $NETSFILE."
exit 0
fi
echo -n "$1"
shift
egrep '^[ ]*[a-zA-Z0-9_-]+' $NETSFILE | while read net args; do
echo -n " $net"
"$@" $net $args
done
echo "."
}
signal_running() {
for i in /var/run/tinc.*pid; do
if [ -f "$i" ]; then
head -1 $i | while read pid; do
kill -$1 $pid
done
fi
done
}
setlimits() {
while [ $# -gt 0 ]; do
parm=$1 ; shift
if [ -n "$1" -a "${1#-}" = "$1" ]; then
value=$1 ; shift
ulimit $parm $value
else
ulimit $parm
fi
done
}
test -n "$LIMITS" && setlimits $LIMITS
start() {
$DAEMON $EXTRA -n "$@"
}
stop() {
[ -f /var/run/tinc.$1.pid ] || return
read pid rest </var/run/tinc.$1.pid || return
kill -0 "$pid" 2>/dev/null || return
$DAEMON -n $1 -k || return
i=0;
/bin/sleep 0.5
# Wait for the pidfile to disappear
while [ -f /var/run/tinc.$1.pid ]; do
# And check that there is an actual process running
kill -0 "$pid" 2>/dev/null || return
if [ $i = '10' ] ; then
# It's still alive, kill it again and give up
$DAEMON -n $1 -k && /bin/sleep 0.5
break
else
echo -n "."
i=$(($i+1))
fi
/bin/sleep 0.5
done
}
reload() {
$DAEMON -n $1 -kHUP
}
alarm() {
$DAEMON -n $1 -kALRM
}
restart() {
stop "$@"
start "$@"
}
case "$1" in
start)
foreach_net "Starting $DESC:" start
;;
stop)
foreach_net "Stopping $DESC:" stop
;;
reload|force-reload)
foreach_net "Reloading $DESC configuration:" reload
;;
restart)
foreach_net "Restarting $DESC:" restart
;;
alarm)
signal_running ALRM
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload|alarm}"
exit 1
;;
esac
exit 0

12
debian/tinc.modules vendored Normal file
View file

@ -0,0 +1,12 @@
alias char-major-36 netlink_dev
alias char-major-10-200 tun
alias tap0 ethertap
alias tap1 ethertap
alias tap2 ethertap
alias tap3 ethertap
options tap0 -o tap0 -x unit=0
options tap1 -o tap1 -x unit=1
options tap2 -o tap2 -x unit=2
options tap3 -o tap3 -x unit=3

14
debian/tinc.templates vendored Normal file
View file

@ -0,0 +1,14 @@
Template: tinc/restart_on_upgrade
Type: boolean
Default: true
_Description: Restart tinc on each upgrade?
You may choose if you want me to restart the tinc daemon every time you
install a new version of this package.
.
Sometimes you don't want to do this, for example if you are doing the
upgrade over a tunnel that is created with tinc. Stopping the daemon
would probably leave you with a dead connection, and tinc may not be
started again.
.
If you refuse, you have to restart tinc yourself if you upgraded, by
typing `invoke-rc.d tinc restart' whenever it suits you.

View file

@ -1,70 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQINBEVZzTABEADawFv/ibQ48uA1eRhL07vdM36Pcq2HDyuyNA+vYEalNH4jLmha
nGPvDALWwX0DXIWDAG8zeTj8s8zliLIjuPS4WRI2YdKIvWeG9fEvpKSXVWa42ica
dpzn/H2aBd4Ax6rQaiTXKOvxANAp2Veb+73ssPV5AL00uGTpzhh98xQzfFQCZ9ZL
YSVPqbMed5oCt/4jM9FBO2CuBtkfiO0dVVYtW7FAVjcIlE2NaZol/KGvz7wsS+yA
dE42W0l5MdQueLmTF4AIUSSTyPFGMQoyqh+MPif73Y589IGcW6GdfKYWnVDo6Trh
HOhcEky+uTYKb6NL0vrJgUiYVMzAOXFDdJni1eQGO6EfZRNYtTga3alWq/jVelK7
BID5JyNbkrTAqdPnhJGivVyk8gGX3+Hng8rkXTfWhp6yAYau1QfBm0F2tIQmpL1C
+7DoLvFErboQf685jXJBjzyvsJxB2ZLH1OOw6mNL0hy2LFkIyGza/bktY2em4apo
KWV5AM5LpyW6THH1oDS7706xFNkf4IFhKE0hKPzBiRnMDjRtMI131lkc5+P8Lqf5
jLTCFUgbEhU6Dz2YjhHAumVm0NWJETUpFDtVvMrqk+mp5xldUOWRNlYQC5aQOyda
eHOlNzB/BFbPhKMWI/zWlEH6f0t6WjHb4iwpWO47511aVNHF59aPzbAHxwARAQAB
tC9UaW5jIERldmVsb3BtZW50IFRlYW0gPHRpbmMtZGV2ZWxAdGluYy12cG4ub3Jn
PokCNgQTAQIAIAUCRVnNMAIbAwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEEpg
hLnA1x9KxOAQAMPhO2WTXv9AaGQBQhyyoGseKoSfcRjtI9YEfE0OInQQ2E+SPYF/
dkfeLGAUqa4foTYQlMqfw70vBhTdVCb7HLTGn6/ICFUtDwakUQCgUQGlUVQiondA
8W6jj+QWrh5BQhHuXy2nCVaKnksu0/xQPsJotghxuYqaot3iJ4qVw9iT/Yeo9irH
Ffftqu0OVCdQ5zQuFNI9YCv/C83L59ecH7bOzYz2efTyobvxrhmgQtgOQwCWOE09
Kr3veM9KLG33YoXlqv8QN/3CwtsJvSwfhj+R2JowZC7RqHe/yznRzmRMsgbrolxi
uiJLonGxcNNkD7WhXi7/zL4A/JaC27XrFf1MPLv8aiTwnOIfrXd5jawpauUOZOXK
UjIZHlIqviB0r5s7A+AFeHW38Tp9VzNuQ7aEl5bHbSXV+s7DTAwGb279z0AVaJ3h
5hWFxupw7UoGdzROwCBYzeX3sioAL6QvkXua8X6zOH45VEiSwrRX3Hlx/MLo7Z4g
PWgFLf6WviHQXCG834To1XIwUk9RgNsL7OzGjtaCuRymADImKMNwierq2zTfoRFQ
v9onIadIMF1fsc70hiBG9yAi36MEuk4VxG8Jc3PQQfSFm4RWazv1k3E0AAIob2Ek
DLVjvLO62Navo/OQ6D7yyiX0qes5S7/k3F1h8+87eRn3yxZE2kbxPg8KuQENBEVZ
zYYBCACoYgExmMKEtABL3pir/IXI4exR/45hkP6txFIrkVQb8DGJ9H39kiDr4gtj
F+pvcgMpec35S3m4fJ7WhDNvbDB4ZvONc1NMKs9cqDXfB+TLWPm4W+SkcKUrs+nK
i8l7ieggTALJcvRoLTX2EFmUFrD6y870W3rK2SfC/0VJX8Ou5cPbwCeueExjo5x0
3gNfu0jWUS0cyA9y+1rVVekrLuJY/+SI4jv3gdzrYbxD0f6dpbpC37QHoJdd0KGF
acPtT2azjY+HxW10EA3Aw9oZWFXnb1nFg2RbDpkaGLmLbaXweltLyw154UmCXxym
PXPqi9bSfEkj0GiYrapk4mW114u9ABEBAAGJA0QEGAECAA8FAkVZzYcCGwIFCQHh
M4ABKQkQSmCEucDXH0rAXSAEGQECAAYFAkVZzYcACgkQ017duBDeLmmu3wf/TFZM
tLKxiyQPtGSTE3eULPdWCEMDZXdSPTY0QHM7Zvh+qn1ei+iFpD0549MYnBEAwDIV
4o62Nrcg8IPu0CEkZIAn2JiFFGYvMGk91awZGV1GS3umd7Dt349E1oKDPZVzRn+j
QIKarXxxabRmx2s/dZZgSs/eguWTboBFmvls9tVfe8x/xPvcHFmqHVUoGKEJy6Tm
no+s4yNjpc5wAaRml+GYf1tK9WMFuZn79qKxkYv4WI96dXR0FL59YbFRkkaI+1/b
G31MvWTqVjY1nJGslByFPUUB8Ca1djtp1gx6NXnOYr3V5MEDfdbjjPu79No+/y6M
tIua5yNtSRlk2nKhIqo3D/sGQ/uHijiMRAtoLhiyqYMc9W9vx/KOoCUHoMJqE39a
Eputvgwwo0rwgSmNfB1dzneFojBdJ47WBSHC8NKtkpJj6mzvvlaI9jmEpK54x3nl
OmBj3X/xaepoRGAtrmgTBP4A9hSjrTMGu/tUQjlX+Xcr6n3g7GSVe5FpUyIMPXEU
+JZDTiEUyn1OdzfNGmnWP+KJX5pQVq4czf5XK6otLZJELDVw/Hbjnjmdz5WOKgEH
jSof3WPeMBgPAcd/cMAZeiGtWM1UpJBHqEXTkthmrpmtRftJKDbooNM9d5OwKiT+
I3vNBv/plMSr8NDjhTWC+ihrN6RBj1vaqpDgGpucPhoO2hwNqWuI4q5WUKtCyw6J
An7ErNaH4c0nVaZq6kJ8Vxdt+LpKYmOsJ8y9xtl6StcrkKNn+6ZfCfee7DEo2bvb
scfpqJqqOqb5KOagTpYs8mo6yQ3leRvFtoeBOQHVQzct23EwOMxbDyeunT50a1eH
MZTEWuIiuCUudM81QXU46oIcaAtj8tpG0Tmnku9g27EjwxUt+8kVmhlPHMb2TdoF
k5d0ce+JuxIG5+i+t8sUCorMc8zfp4g1bxZeMOcPnfyO3bSW11EVcN7ZxHlFC+XE
YOByP50CM3P8lItPlQ+WpY9kYWjiwu9kVPaGQ16G47nspngJInU5dhka3KJGtIZe
q7kBDQRFWc3GAQgAz/JUs24niKsd0ZtOjUWd4R4y0gjS0kC/vvLL2gbXYkA9tcjG
5iEvVWJY34QsudX0v1ULsVnJ89X/gsk8hAhAia1TQm+0Qq+MSxEaQkMSaOO8N70U
XzgH1dielvpea20WO4MyWQuRIJ0K2nsGmEPnt6ZP7fK8HVHFNggP/mQ6LMu1reAF
gvb8cEtjb9B5QaCUEoLjsbsuo+vLW7AWy4GfIRNESHw2Qt08AUaGrihpu6zi7N2b
QkHHJtqa63GzYJ+kYzAVvrFJXdwL/TRXLBzv+6yyvYSIHi8uB6/o6CZN6hpjfpME
ph+oYPqXeNOyMd1E9Kg8ymcPrNyQKfE3WnCRXQARAQABiQIlBBgBAgAPBQJFWc3H
AhsMBQkB4TOAAAoJEEpghLnA1x9KXYMP/3D9JYti6C8DWuX2hWv+2SUbLcMa5u1e
ETewIo5S3mqGWSaxX4YLPVRkZ1lOLmFysOLimf0thYm7IsatLcWmBdYUpK92ilvr
Sk2sKlhrOoBXEX/79Kz+Aj5PjeyiQxgQ7Ba/afwhU6aTqs2Dp1T0YNu2eBvV+1QH
lZnW2Wh96zzwc0dJUuY9eBk5Fgpu08Wce7o6jxFPtVyAaQa0zcNAmw2TSY7wbunJ
WTl9OgATAyqVCuhWW7AnPcSqkH8lQigSc00wfqJKOD2Us0FqN6UKDCZTyQkdP6hx
G+3aUkkvGSOxy7u9bVWmrikuJMoiIY/CH/m+GcJJATVibI7t5MhhtBGySKc3PAwc
58sVe9AnbDvs84efrNP59j2KG2KKqcqjTGAmKyJnG3N50xJGakDIsqfneIRNWpEE
pOOPaOqR4qnPAS9OSt9A3hqBpWPjQcScd6AuO+J2PE5y23pTnb9PtLBQb5e4VFiv
N54u8j4bU2CO0SC2isZ3CR68dPHthWsxt4XbjhgktjbpQRQ8L2EDBQ8oE13GOrOw
P8x4Q0eC5uzkXNyRqzKOsxlZEuc+75aDDd3M2GDw08FG7GI1p/L+NgenwT+9TmFX
2hOKVrjgyx+fPut1t5DJJubDWXGOK33qvrL7HTCEv1zz7LNbbPwwNHK4lfMAWuJW
D9wc3Y9Se/P/
=5MAs
-----END PGP PUBLIC KEY BLOCK-----

2
debian/watch vendored
View file

@ -1,2 +0,0 @@
version=3
opts=pgpsigurlmangle=s/$/.sig/ http://www.tinc-vpn.org/packages/tinc-(1\.0\.\d+)\.tar\.gz

632
depcomp
View file

@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# depcomp - compile a program generating dependencies as side-effects # depcomp - compile a program generating dependencies as side-effects
scriptversion=2018-03-07.03; # UTC scriptversion=2005-02-09.22
# Copyright (C) 1999-2020 Free Software Foundation, Inc. # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -16,7 +16,9 @@ scriptversion=2018-03-07.03; # UTC
# GNU General Public License for more details. # GNU General Public License for more details.
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
@ -27,9 +29,9 @@ scriptversion=2018-03-07.03; # UTC
case $1 in case $1 in
'') '')
echo "$0: No command. Try '$0 --help' for more information." 1>&2 echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1; exit 1;
;; ;;
-h | --h*) -h | --h*)
cat <<\EOF cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS] Usage: depcomp [--help] [--version] PROGRAM [ARGS]
@ -39,11 +41,11 @@ as side-effects.
Environment variables: Environment variables:
depmode Dependency tracking mode. depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'. source Source file read by `PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies. DEPDIR directory where to store dependencies.
depfile Dependency file to output. depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies. tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no). libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>. Report bugs to <bug-automake@gnu.org>.
@ -56,66 +58,6 @@ EOF
;; ;;
esac esac
# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}
# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}
# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}
# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}
# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2 echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1 exit 1
@ -128,9 +70,6 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
# Avoid interferences from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We # Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below, # parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case # to make depend.m4 easier to write. Note that we *cannot* use a case
@ -142,32 +81,9 @@ if test "$depmode" = hp; then
fi fi
if test "$depmode" = dashXmstdout; then if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument. # This is just like dashmstdout with a different argument.
dashmflag=-xM dashmflag=-xM
depmode=dashmstdout depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi fi
case "$depmode" in case "$depmode" in
@ -175,22 +91,10 @@ gcc3)
## gcc 3 implements dependency tracking that does exactly what ## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm. ## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$? stat=$?
if test $stat -ne 0; then if test $stat -eq 0; then :
else
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
exit $stat exit $stat
fi fi
@ -198,17 +102,13 @@ gcc3)
;; ;;
gcc) gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's ## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method: ## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end ## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly. ## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.) ## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say). Also, it might not be ## -MM, not -M (despite what the docs say).
## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse ## - Using -M directly means running the compiler twice (even worse
## than renaming). ## than renaming).
if test -z "$gccflag"; then if test -z "$gccflag"; then
@ -216,31 +116,31 @@ gcc)
fi fi
"$@" -Wp,"$gccflag$tmpdepfile" "$@" -Wp,"$gccflag$tmpdepfile"
stat=$? stat=$?
if test $stat -ne 0; then if test $stat -eq 0; then :
else
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
exit $stat exit $stat
fi fi
rm -f "$depfile" rm -f "$depfile"
echo "$object : \\" > "$depfile" echo "$object : \\" > "$depfile"
# The second -e expression handles DOS-style file names with drive alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
# letters. ## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \ sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem. ## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file ## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is ## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding ## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do ## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly. ## this for us directly.
## Some versions of gcc put a space before the ':'. On the theory tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as ## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH ## well.
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation ## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround. ## correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;
@ -258,7 +158,8 @@ sgi)
"$@" -MDupdate "$tmpdepfile" "$@" -MDupdate "$tmpdepfile"
fi fi
stat=$? stat=$?
if test $stat -ne 0; then if test $stat -eq 0; then :
else
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
exit $stat exit $stat
fi fi
@ -266,156 +167,99 @@ sgi)
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile" echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be # Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle # clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in # lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the # the IRIX cc adds comments like `#:fec' to the end of the
# dependency line. # dependency line.
tr ' ' "$nl" < "$tmpdepfile" \ tr ' ' '
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ ' < "$tmpdepfile" \
| tr "$nl" ' ' >> "$depfile" | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
echo >> "$depfile" tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file. # The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \ tr ' ' '
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ ' < "$tmpdepfile" \
>> "$depfile" | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else else
make_dummy_depfile # The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi fi
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix) aix)
# The C for AIX Compiler uses -M and outputs the dependencies # The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the # in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the # current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information. # start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases. # Version 6 uses the directory in both cases.
set_dir_from "$object" stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
set_base_from "$object" tmpdepfile="$stripped.u"
if test "$libtool" = yes; then if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M "$@" -Wc,-M
else else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M "$@" -M
fi fi
stat=$? stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" if test -f "$tmpdepfile"; then :
exit $stat else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" if test $stat -eq 0; then :
do else
test -f "$tmpdepfile" && break
done
aix_post_process_depfile
;;
tcc)
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# FIXME: That version still under development at the moment of writing.
# Make that this statement remains true also for stable, released
# versions.
# It will wrap lines (doesn't matter whether long or short) with a
# trailing '\', as in:
#
# foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
exit $stat exit $stat
fi fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. if test -f "$tmpdepfile"; then
# We have to change lines of the first kind to '$object: \'. outname="$stripped.o"
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # Each line is of the form `foo.o: dependent.h'.
# And for each line of the second kind, we have to emit a 'dep.h:' # Do two passes, one to just change these to
# dummy dependency, to avoid the deleted-header problem. # `$object: dependent.h' and one to simply `dependent.h:'.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;
## The order of this option in the case statement is important, since the icc)
## shell code in configure will try each of these formats in the order # Intel's C compiler understands `-MD -MF file'. However on
## listed in this file. A plain '-MD' option would be understood by many # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
## compilers, so we must ensure this comes after the gcc and icc options. # ICC 7.0 will fill foo.d with something like
pgcc) # foo.o: sub/foo.c
# Portland's C compiler understands '-MD'. # foo.o: sub/foo.h
# Will always output deps to 'file.d' where file is the root name of the # which is wrong. We want:
# source file under compilation, even if file resides in a subdirectory. # sub/foo.o: sub/foo.c
# The object file name does not affect the name of the '.d' file. # sub/foo.o: sub/foo.h
# pgcc 10.2 will output # sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h # foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\' : # and will wrap long lines using \ :
# foo.o: sub/foo.c ... \ # foo.o: sub/foo.c ... \
# sub/foo.h ... \ # sub/foo.h ... \
# ... # ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d
# For projects that build the same source file twice into different object "$@" -MD -MF "$tmpdepfile"
# files, the pgcc approach of using the *source* file root name can cause stat=$?
# problems in parallel builds. Use a locking strategy to avoid stomping on if test $stat -eq 0; then :
# the same $tmpdepfile. else
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi
if test $stat -ne 0; then
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
exit $stat exit $stat
fi fi
@ -427,141 +271,68 @@ pgcc)
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation # Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround. # correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
| sed -e 's/$/ :/' >> "$depfile" sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64) tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side # The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too. # dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected. # Subdirectories are respected.
set_dir_from "$object" dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
set_base_from "$object" test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then if test "$libtool" = yes; then
# Libtool generates 2 separate objects for the 2 libraries. These # With Tru64 cc, shared objects can also be used to make a
# two compilations output dependencies in $dir.libs/$base.o.d and # static library. This mecanism is used in libtool 1.4 series to
# in $dir$base.o.d. We have to check for both files, because # handle both shared and static libraries in a single compilation.
# one of the two compilations can be disabled. We should prefer # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is #
# automatically cleaned when .libs/ is deleted, while ignoring # With libtool 1.5 this exception was removed, and libtool now
# the former would cause a distcleancheck panic. # generates 2 separate objects for the 2 libraries. These two
tmpdepfile1=$dir$base.o.d # libtool 1.5 # compilations output dependencies in in $dir.libs/$base.o.d and
tmpdepfile2=$dir.libs/$base.o.d # Likewise. # in $dir$base.o.d. We have to check for both files, because
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 # one of the two compilations can be disabled. We should prefer
"$@" -Wc,-MD # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
else # automatically cleaned when .libs/ is deleted, while ignoring
tmpdepfile1=$dir$base.d # the former would cause a distcleancheck panic.
tmpdepfile2=$dir$base.d tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile3=$dir$base.d tmpdepfile2=$dir$base.o.d # libtool 1.5
"$@" -MD tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
fi tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$? stat=$?
if test $stat -ne 0; then if test $stat -eq 0; then :
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" else
exit $stat rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
fi exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do do
test -f "$tmpdepfile" && break test -f "$tmpdepfile" && break
done done
# Same post-processing that is required for AIX mode. if test -f "$tmpdepfile"; then
aix_post_process_depfile sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
;; # That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
msvc7) else
if test "$libtool" = yes; then echo "#dummy" > "$depfile"
showIncludes=-Wc,-showIncludes fi
else rm -f "$tmpdepfile"
showIncludes=-showIncludes ;;
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect) #nosideeffect)
# This comment above is used by automake to tell side-effect # This comment above is used by automake to tell side-effect
@ -574,13 +345,13 @@ dashmstdout)
# Remove the call to Libtool. # Remove the call to Libtool.
if test "$libtool" = yes; then if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do while test $1 != '--mode=compile'; do
shift shift
done done
shift shift
fi fi
# Remove '-o $object'. # Remove `-o $object'.
IFS=" " IFS=" "
for arg for arg
do do
@ -600,18 +371,18 @@ dashmstdout)
done done
test -z "$dashmflag" && dashmflag=-M test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':' # Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames: # in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag | "$@" $dashmflag |
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile" rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile" cat < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this sed invocation tr ' ' '
# correctly. Breaking it into two sed invocations is a workaround. ' < "$tmpdepfile" | \
tr ' ' "$nl" < "$tmpdepfile" \ ## Some versions of the HPUX 10.20 sed can't process this invocation
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ ## correctly. Breaking it into two sed invocations is a workaround.
| sed -e 's/$/ :/' >> "$depfile" sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;
@ -625,51 +396,41 @@ makedepend)
"$@" || exit $? "$@" || exit $?
# Remove any Libtool call # Remove any Libtool call
if test "$libtool" = yes; then if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do while test $1 != '--mode=compile'; do
shift shift
done done
shift shift
fi fi
# X makedepend # X makedepend
shift shift
cleared=no eat=no cleared=no
for arg for arg in "$@"; do
do
case $cleared in case $cleared in
no) no)
set ""; shift set ""; shift
cleared=yes ;; cleared=yes ;;
esac esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in case "$arg" in
-D*|-I*) -D*|-I*)
set fnord "$@" "$arg"; shift ;; set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove # Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file. # the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object) -*|$object)
;; ;;
*) *)
set fnord "$@" "$arg"; shift ;; set fnord "$@" "$arg"; shift ;;
esac esac
done done
obj_suffix=`echo "$object" | sed 's/^.*\././'` obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile" touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile" rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object. cat < "$tmpdepfile" > "$depfile"
# No need to regex-escape $object, excess matching of '.' is harmless. sed '1,2d' "$tmpdepfile" | tr ' ' '
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" ' | \
# Some versions of the HPUX 10.20 sed can't process the last invocation ## Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround. ## correctly. Breaking it into two sed invocations is a workaround.
sed '1,2d' "$tmpdepfile" \ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
| tr ' ' "$nl" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak rm -f "$tmpdepfile" "$tmpdepfile".bak
;; ;;
@ -680,13 +441,13 @@ cpp)
# Remove the call to Libtool. # Remove the call to Libtool.
if test "$libtool" = yes; then if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do while test $1 != '--mode=compile'; do
shift shift
done done
shift shift
fi fi
# Remove '-o $object'. # Remove `-o $object'.
IFS=" " IFS=" "
for arg for arg
do do
@ -705,10 +466,9 @@ cpp)
esac esac
done done
"$@" -E \ "$@" -E |
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ sed '$ s: \\$::' > "$tmpdepfile"
| sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile" rm -f "$depfile"
echo "$object : \\" > "$depfile" echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile" cat < "$tmpdepfile" >> "$depfile"
@ -718,56 +478,35 @@ cpp)
msvisualcpp) msvisualcpp)
# Important note: in order to support this mode, a compiler *must* # Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout. # always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $? "$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" " IFS=" "
for arg for arg
do do
case "$arg" in case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@" set fnord "$@"
shift shift
shift shift
;; ;;
*) *)
set fnord "$@" "$arg" set fnord "$@" "$arg"
shift shift
shift shift
;; ;;
esac esac
done done
"$@" -E 2>/dev/null | "$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile" rm -f "$depfile"
echo "$object : \\" > "$depfile" echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile" echo " " >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none) none)
exec "$@" exec "$@"
;; ;;
@ -783,9 +522,8 @@ exit 0
# Local Variables: # Local Variables:
# mode: shell-script # mode: shell-script
# sh-indentation: 2 # sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp) # eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0" # time-stamp-end: "$"
# time-stamp-end: "; # UTC"
# End: # End:

View file

@ -1,35 +1,43 @@
## Process this file with automake to get Makefile.in ## Process this file with automake to get Makefile.in
info_TEXINFOS = tinc.texi info_TEXINFOS = tinc.texi
tinc_TEXINFOS = tincinclude.texi
man_MANS = tincd.8 tinc.conf.5 man_MANS = tincd.8 tinc.conf.5
EXTRA_DIST = tincinclude.texi.in tincd.8.in tinc.conf.5.in sample-config EXTRA_DIST = tincinclude.texi.in tincd.8.in tinc.conf.5.in sample-config.tar.gz
CLEANFILES = *.html tincd.8 tinc.conf.5 tincinclude.texi CLEANFILES = *.html tinc.info tincd.8 tinc.conf.5 tincinclude.texi
# Use `ginstall' in the definition of man_MANS to avoid
# confusion with the `install' target. The install rule transforms `ginstall'
# to install before applying any user-specified name transformations.
transform = s/ginstall/install/; @program_transform_name@
# For additional rules usually of interest only to the maintainer,
# see GNUmakefile and Makefile.maint.
sample-config.tar.gz: sample-config
GZIP=$(GZIP_ENV) $(AMTAR) chozf sample-config.tar.gz --exclude .svn sample-config
texi2html: tinc.texi texi2html: tinc.texi
$(AM_V_GEN)texi2html -split=chapter $< texi2html -split=chapter tinc.texi
tincd.8.html: tincd.8 %.html: $(man_MANS)
$(AM_V_GEN)w3mman2html $< > $@ w3mman2html $< > $@
tinc.conf.5.html: tinc.conf.5
$(AM_V_GEN)w3mman2html $< > $@
substitute = sed \ substitute = sed \
-e s,'@PACKAGE\@',"$(PACKAGE)",g \ -e s,'@PACKAGE\@',"$(PACKAGE)",g \
-e s,'@VERSION\@',"$(VERSION)",g \ -e s,'@VERSION\@',"$(VERSION)",g \
-e s,'@sysconfdir\@',"$(sysconfdir)",g \ -e s,'@sysconfdir\@',"$(sysconfdir)",g \
-e s,'@runstatedir\@',"$(runstatedir)",g \
-e s,'@localstatedir\@',"$(localstatedir)",g -e s,'@localstatedir\@',"$(localstatedir)",g
tincd.8: $(srcdir)/tincd.8.in tincd.8: tincd.8.in
$(AM_V_GEN)$(substitute) $(srcdir)/tincd.8.in > $@ $(substitute) tincd.8.in > tincd.8
tinc.conf.5: $(srcdir)/tinc.conf.5.in tinc.conf.5: tinc.conf.5.in
$(AM_V_GEN)$(substitute) $(srcdir)/tinc.conf.5.in > $@ $(substitute) tinc.conf.5.in > tinc.conf.5
tincinclude.texi: $(srcdir)/tincinclude.texi.in tincinclude.texi: tincinclude.texi.in
$(AM_V_GEN)$(substitute) $(srcdir)/tincinclude.texi.in > $@ $(substitute) tincinclude.texi.in > tincinclude.texi
tinc.texi: tincinclude.texi

File diff suppressed because it is too large Load diff

BIN
doc/sample-config.tar.gz Normal file

Binary file not shown.

View file

@ -1,15 +0,0 @@
# Sample host configuration file
# The real IP address of this tinc host. Can be used by other tinc hosts.
Address = 123.234.35.67
# Portnumber for incoming connections. Default is 655.
Port = 655
# Subnet on the virtual private network that is local for this host.
Subnet = 192.168.1.0/24
# The public key generated by `tincd -n example -K' is stored here
-----BEGIN RSA PUBLIC KEY-----
...
-----END RSA PUBLIC KEY-----

View file

@ -1,16 +0,0 @@
# Sample host configuration file
# This file was generated by host beta.
# The real IP address of this tinc host. Can be used by other tinc hosts.
Address = 123.45.67.189
# Portnumber for incoming connections. Default is 655.
Port = 6500
# Subnet on the virtual private network that is local for this host.
Subnet = 192.168.2.0/24
# The public key generated by `tincd -n example -K' is stored here
-----BEGIN RSA PUBLIC KEY-----
...
-----END RSA PUBLIC KEY-----

View file

@ -1 +0,0 @@
# Generate this file with `tincd -n example -K`

View file

@ -1,4 +0,0 @@
#!/bin/sh
# This file closes down the tap device.
ifconfig $INTERFACE down

View file

@ -1,11 +0,0 @@
#!/bin/sh
# This file sets up the tap device.
# It gives you the freedom to do anything you want with it.
# Use the correct name for the tap device:
# The environment variable $INTERFACE is set to the right name
# on most platforms, but if it doesn't work try to set it manually.
# Give it the right ip and netmask. Remember, the subnet of the
# tap device must be larger than that of the individual Subnets
# as defined in the host configuration file!
ifconfig $INTERFACE 192.168.1.1 netmask 255.255.0.0

View file

@ -1,22 +0,0 @@
# Sample tinc configuration file
# This is a comment.
# Spaces and tabs are eliminated.
# The = sign isn't strictly necessary any longer, though you may want
# to leave it in as it improves readability :)
# Variable names are treated case insensitive.
# The name of this tinc host. Required.
Name = alpha
# The internet host to connect with.
# Comment these out to make yourself a listen-only connection
# You must use the name of another tinc host.
# May be used multiple times for redundance.
ConnectTo = beta
# The tap device tinc will use.
# /dev/tap0 for ethertap, FreeBSD or OpenBSD
# /dev/tun0 for Solaris
# /dev/net/tun for Linux tun/tap
Device = /dev/net/tun

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
.Dd 2016-10-29 .Dd 2002-04-09
.Dt TINC.CONF 5 .Dt TINC.CONF 5
.\" Manual page created by: .\" Manual page created by:
.\" Ivo Timmermans .\" Ivo Timmermans <ivo@tinc-vpn.org>
.\" Guus Sliepen <guus@tinc-vpn.org> .\" Guus Sliepen <guus@tinc-vpn.org>
.Sh NAME .Sh NAME
.Nm tinc.conf .Nm tinc.conf
@ -54,7 +54,7 @@ But it is highly recommended that you use this feature of
because it will be so much clearer whom your daemon talks to. because it will be so much clearer whom your daemon talks to.
Hence, we will assume that you use it. Hence, we will assume that you use it.
.Sh NAMES .Sh NAMES
Each tinc daemon must have a name that is unique in the network which it will be part of. Each tinc daemon should have a name that is unique in the network which it will be part of.
The name will be used by other tinc daemons for identification. The name will be used by other tinc daemons for identification.
The name has to be declared in the The name has to be declared in the
.Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc.conf .Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc.conf
@ -97,12 +97,6 @@ Note: it is not required that you put in the
sign, but doing so improves readability. sign, but doing so improves readability.
If you leave it out, remember to replace it with at least one space character. If you leave it out, remember to replace it with at least one space character.
.Pp .Pp
The server configuration is complemented with host specific configuration (see the next section).
Although all configuration options for the local host listed in this document can also be put in
.Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc.conf ,
it is recommended to put host specific configuration options in the host configuration file,
as this makes it easy to exchange with other nodes.
.Pp
Here are all valid variables, listed in alphabetical order. Here are all valid variables, listed in alphabetical order.
The default value is given between parentheses. The default value is given between parentheses.
.Bl -tag -width indent .Bl -tag -width indent
@ -112,24 +106,11 @@ If
.Qq any .Qq any
is selected, then depending on the operating system both IPv4 and IPv6 or just is selected, then depending on the operating system both IPv4 and IPv6 or just
IPv6 listening sockets will be created. IPv6 listening sockets will be created.
.It Va BindToAddress Li = Ar address Oo Ar port Oc Bq experimental .It Va BindToAddress Li = Ar address Bq experimental
If your computer has more than one IPv4 or IPv6 address, If your computer has more than one IPv4 or IPv6 address,
.Nm tinc .Nm tinc
will by default listen on all of them for incoming connections. will by default listen on all of them for incoming connections.
Multiple It is possible to bind only to a single address with this variable.
.Va BindToAddress
variables may be specified,
in which case listening sockets for each specified address are made.
.Pp
If no
.Ar port
is specified, the socket will be bound to the port specified by the
.Va Port
option, or to port 655 if neither is given.
To only bind to a specific port but not to a specific address, use
.Li *
for the
.Ar address .
.Pp .Pp
This option may not work on all platforms. This option may not work on all platforms.
.It Va BindToInterface Li = Ar interface Bq experimental .It Va BindToInterface Li = Ar interface Bq experimental
@ -139,24 +120,13 @@ will by default listen on all of them for incoming connections.
It is possible to bind only to a single interface with this variable. It is possible to bind only to a single interface with this variable.
.Pp .Pp
This option may not work on all platforms. This option may not work on all platforms.
Also, on some platforms it will not actually bind to an interface, .It Va BlockingTCP Li = yes | no Po no Pc Bq experimental
but rather to the address that the interface has at the moment a socket is created. This options selects whether TCP connections, when established, should use blocking writes.
.It Va Broadcast Li = no | mst | direct Po mst Pc Bq experimental When turned off, tinc will never block when a TCP connection becomes congested, but will have to terminate that connection instead.
This option selects the way broadcast packets are sent to other daemons. If turned on, tinc will not terminate connections but will block, thereby unable to process data to/from other connections.
NOTE: all nodes in a VPN must use the same Turn this option on if you also use
.Va Broadcast .Va TCPOnly
mode, otherwise routing loops can form. and tinc terminates connections frequently.
.Bl -tag -width indent
.It no
Broadcast packets are never sent to other nodes.
.It mst
Broadcast packets are sent and forwarded via the VPN's Minimum Spanning Tree.
This ensures broadcast packets reach all nodes.
.It direct
Broadcast packets are sent directly to all nodes that can be reached directly.
Broadcast packets received from other nodes are never forwarded.
If the IndirectData option is also set, broadcast packets will only be sent to nodes which we have a meta connection to.
.El
.It Va ConnectTo Li = Ar name .It Va ConnectTo Li = Ar name
Specifies which other tinc daemon to connect to on startup. Specifies which other tinc daemon to connect to on startup.
Multiple Multiple
@ -173,15 +143,6 @@ If you don't specify a host with
.Nm tinc .Nm tinc
won't try to connect to other daemons at all, won't try to connect to other daemons at all,
and will instead just listen for incoming connections. and will instead just listen for incoming connections.
.It Va DecrementTTL Li = yes | no Po no Pc Bq experimental
When enabled,
.Nm tinc
will decrement the Time To Live field in IPv4 packets, or the Hop Limit field in IPv6 packets,
before forwarding a received packet to the virtual network device or to another node,
and will drop packets that have a TTL value of zero,
in which case it will send an ICMP Time Exceeded packet back.
.Pp
Do not use this option if you use switch mode and want to use IPv6.
.It Va Device Li = Ar device Po Pa /dev/tap0 , Pa /dev/net/tun No or other depending on platform Pc .It Va Device Li = Ar device Po Pa /dev/tap0 , Pa /dev/net/tun No or other depending on platform Pc
The virtual network device to use. The virtual network device to use.
.Nm tinc .Nm tinc
@ -193,104 +154,6 @@ instead of
.Va Device . .Va Device .
The info pages of the tinc package contain more information The info pages of the tinc package contain more information
about configuring the virtual network device. about configuring the virtual network device.
.It Va DeviceType Li = Ar type Pq platform dependent
The type of the virtual network device.
Tinc will normally automatically select the right type of tun/tap interface, and this option should not be used.
However, this option can be used to select one of the special interface types, if support for them is compiled in.
.Bl -tag -width indent
.It dummy
Use a dummy interface.
No packets are ever read or written to a virtual network device.
Useful for testing, or when setting up a node that only forwards packets for other nodes.
.It raw_socket
Open a raw socket, and bind it to a pre-existing
.Va Interface
(eth0 by default).
All packets are read from this interface.
Packets received for the local node are written to the raw socket.
However, at least on Linux, the operating system does not process IP packets destined for the local host.
.It multicast
Open a multicast UDP socket and bind it to the address and port (separated by spaces) and optionally a TTL value specified using
.Va Device .
Packets are read from and written to this multicast socket.
This can be used to connect to UML, QEMU or KVM instances listening on the same multicast address.
Do NOT connect multiple
.Nm tinc
daemons to the same multicast address, this will very likely cause routing loops.
Also note that this can cause decrypted VPN packets to be sent out on a real network if misconfigured.
.It uml Pq not compiled in by default
Create a UNIX socket with the filename specified by
.Va Device ,
or
.Pa @runstatedir@/ Ns Ar NETNAME Ns Pa .umlsocket
if not specified.
.Nm tinc
will wait for a User Mode Linux instance to connect to this socket.
.It vde Pq not compiled in by default
Uses the libvdeplug library to connect to a Virtual Distributed Ethernet switch,
using the UNIX socket specified by
.Va Device ,
or
.Pa @runstatedir@/vde.ctl
if not specified.
.El
Also, in case tinc does not seem to correctly interpret packets received from the virtual network device,
it can be used to change the way packets are interpreted:
.Bl -tag -width indent
.It tun Pq BSD and Linux
Set type to tun.
Depending on the platform, this can either be with or without an address family header (see below).
.It tunnohead Pq BSD
Set type to tun without an address family header.
Tinc will expect packets read from the virtual network device to start with an IP header.
On some platforms IPv6 packets cannot be read from or written to the device in this mode.
.It tunifhead Pq BSD
Set type to tun with an address family header.
Tinc will expect packets read from the virtual network device
to start with a four byte header containing the address family,
followed by an IP header.
This mode should support both IPv4 and IPv6 packets.
.It utun Pq OS X
Set type to utun.
This is only supported on OS X version 10.6.8 and higher, but doesn't require the tuntaposx module.
This mode should support both IPv4 and IPv6 packets.
.It tap Pq BSD and Linux
Set type to tap.
Tinc will expect packets read from the virtual network device
to start with an Ethernet header.
.El
.It Va DirectOnly Li = yes | no Po no Pc Bq experimental
When this option is enabled, packets that cannot be sent directly to the destination node,
but which would have to be forwarded by an intermediate node, are dropped instead.
When combined with the IndirectData option,
packets for nodes for which we do not have a meta connection with are also dropped.
.It Va Forwarding Li = off | internal | kernel Po internal Pc Bq experimental
This option selects the way indirect packets are forwarded.
.Bl -tag -width indent
.It off
Incoming packets that are not meant for the local node,
but which should be forwarded to another node, are dropped.
.It internal
Incoming packets that are meant for another node are forwarded by tinc internally.
.Pp
This is the default mode, and unless you really know you need another forwarding mode, don't change it.
.It kernel
Incoming packets are always sent to the TUN/TAP device, even if the packets are not for the local node.
This is less efficient, but allows the kernel to apply its routing and firewall rules on them,
and can also help debugging.
.El
.It Va GraphDumpFile Li = Ar filename Bq experimental
If this option is present,
.Nm tinc
will dump the current network graph to the file
.Ar filename
every minute, unless there were no changes to the graph.
The file is in a format that can be read by graphviz tools.
If
.Ar filename
starts with a pipe symbol |,
then the rest of the filename is interpreted as a shell command
that is executed, the graph is then sent to stdin.
.It Va Hostnames Li = yes | no Pq no .It Va Hostnames Li = yes | no Pq no
This option selects whether IP addresses (both real and on the VPN) should This option selects whether IP addresses (both real and on the VPN) should
be resolved. Since DNS lookups are blocking, it might affect tinc's be resolved. Since DNS lookups are blocking, it might affect tinc's
@ -298,9 +161,7 @@ efficiency, even stopping the daemon for a few seconds every time it does
a lookup if your DNS server is not responding. a lookup if your DNS server is not responding.
.Pp .Pp
This does not affect resolving hostnames to IP addresses from the This does not affect resolving hostnames to IP addresses from the
host configuration files, but whether hostnames should be resolved while logging. host configuration files.
.It Va IffOneQueue Li = yes | no Po no Pc Bq experimental
(Linux only) Set IFF_ONE_QUEUE flag on TUN/TAP devices.
.It Va Interface Li = Ar interface .It Va Interface Li = Ar interface
Defines the name of the interface corresponding to the virtual network device. Defines the name of the interface corresponding to the virtual network device.
Depending on the operating system and the type of device this may or may not actually set the name of the interface. Depending on the operating system and the type of device this may or may not actually set the name of the interface.
@ -312,16 +173,6 @@ this variable is almost always already correctly set.
This option controls the period the encryption keys used to encrypt the data are valid. This option controls the period the encryption keys used to encrypt the data are valid.
It is common practice to change keys at regular intervals to make it even harder for crackers, It is common practice to change keys at regular intervals to make it even harder for crackers,
even though it is thought to be nearly impossible to crack a single key. even though it is thought to be nearly impossible to crack a single key.
.It Va LocalDiscovery Li = yes | no Po no Pc Bq experimental
When enabled,
.Nm tinc
will try to detect peers that are on the same local network.
This will allow direct communication using LAN addresses, even if both peers are behind a NAT
and they only ConnectTo a third node outside the NAT,
which normally would prevent the peers from learning each other's LAN address.
.Pp
Currently, local discovery is implemented by sending broadcast packets to the LAN during path MTU discovery.
This feature may not work in all possible situations.
.It Va MACExpire Li = Ar seconds Pq 600 .It Va MACExpire Li = Ar seconds Pq 600
This option controls the amount of time MAC addresses are kept before they are removed. This option controls the amount of time MAC addresses are kept before they are removed.
This only has effect when This only has effect when
@ -355,25 +206,11 @@ while no routing table is managed.
.It Va Name Li = Ar name Bq required .It Va Name Li = Ar name Bq required
This is the name which identifies this tinc daemon. This is the name which identifies this tinc daemon.
It must be unique for the virtual private network this daemon will connect to. It must be unique for the virtual private network this daemon will connect to.
The Name may only consist of alphanumeric and underscore characters. .It Va PingTimeout Li = Ar seconds Pq 60
If
.Va Name
starts with a
.Li $ ,
then the contents of the environment variable that follows will be used.
In that case, invalid characters will be converted to underscores.
If
.Va Name
is
.Li $HOST ,
but no such environment variable exist, the hostname will be read using the gethostname() system call.
.It Va PingInterval Li = Ar seconds Pq 60
The number of seconds of inactivity that The number of seconds of inactivity that
.Nm tinc .Nm tinc
will wait before sending a probe to the other end. will wait before sending a probe to the other end.
.It Va PingTimeout Li = Ar seconds Pq 5 If that other end doesn't answer within that same amount of time,
The number of seconds to wait for a response to pings or to allow meta
connections to block. If the other end doesn't respond within this time,
the connection is terminated, the connection is terminated,
and the others will be notified of this. and the others will be notified of this.
.It Va PriorityInheritance Li = yes | no Po no Pc Bq experimental .It Va PriorityInheritance Li = yes | no Po no Pc Bq experimental
@ -384,68 +221,16 @@ The private RSA key of this tinc daemon.
It will allow this tinc daemon to authenticate itself to other daemons. It will allow this tinc daemon to authenticate itself to other daemons.
.It Va PrivateKeyFile Li = Ar filename Po Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /rsa_key.priv Pc .It Va PrivateKeyFile Li = Ar filename Po Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /rsa_key.priv Pc
The file in which the private RSA key of this tinc daemon resides. The file in which the private RSA key of this tinc daemon resides.
.It Va ProcessPriority Li = low | normal | high Note that there must be exactly one of
When this option is used the priority of the tincd process will be adjusted. .Va PrivateKey
Increasing the priority may help to reduce latency and packet loss on the VPN. or
.It Va Proxy Li = socks4 | socks5 | http | exec Ar ... Bq experimental .Va PrivateKeyFile
Use a proxy when making outgoing connections. specified in the configuration file.
The following proxy types are currently supported:
.Bl -tag -width indent
.It socks4 Ar address Ar port Op Ar username
Connects to the proxy using the SOCKS version 4 protocol.
Optionally, a
.Ar username
can be supplied which will be passed on to the proxy server.
Only IPv4 connections can be proxied using SOCKS 4.
.It socks5 Ar address Ar port Op Ar username Ar password
Connect to the proxy using the SOCKS version 5 protocol.
If a
.Ar username
and
.Ar password
are given, basic username/password authentication will be used,
otherwise no authentication will be used.
.It http Ar address Ar port
Connects to the proxy and sends a HTTP CONNECT request.
.It exec Ar command
Executes the given
.Ar command
which should set up the outgoing connection.
The environment variables
.Ev NAME ,
.Ev NODE ,
.Ev REMOTEADDRES
and
.Ev REMOTEPORT
are available.
.El
.It Va ReplayWindow Li = Ar bytes Pq 16
This is the size of the replay tracking window for each remote node, in bytes.
The window is a bitfield which tracks 1 packet per bit, so for example
the default setting of 16 will track up to 128 packets in the window. In high
bandwidth scenarios, setting this to a higher value can reduce packet loss from
the interaction of replay tracking with underlying real packet loss and/or
reordering. Setting this to zero will disable replay tracking completely and
pass all traffic, but leaves tinc vulnerable to replay-based attacks on your
traffic.
.It Va StrictSubnets Li = yes | no Po no Pc Bq experimental
When this option is enabled tinc will only use Subnet statements which are
present in the host config files in the local
.Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/
directory. Subnets learned via connections to other nodes and which are not
present in the local host config files are ignored.
.It Va TunnelServer Li = yes | no Po no Pc Bq experimental .It Va TunnelServer Li = yes | no Po no Pc Bq experimental
When this option is enabled tinc will no longer forward information between other tinc daemons, When this option is enabled tinc will no longer forward information between other tinc daemons,
and will only allow connections with nodes for which host config files are present in the local and will only allow nodes and subnets on the VPN which are present in the
.Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/ .Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/
directory. directory.
Setting this options also implicitly sets StrictSubnets.
.It Va UDPRcvBuf Li = Ar bytes Pq OS default
Sets the socket receive buffer size for the UDP socket, in bytes.
If unset, the default buffer size will be used by the operating system.
.It Va UDPSndBuf Li = Ar bytes Pq OS default
Sets the socket send buffer size for the UDP socket, in bytes.
If unset, the default buffer size will be used by the operating system.
.El .El
.Sh HOST CONFIGURATION FILES .Sh HOST CONFIGURATION FILES
The host configuration files contain all information needed The host configuration files contain all information needed
@ -460,54 +245,49 @@ and now his tinc daemon will be able to connect to your tinc daemon.
Since host configuration files only contain public keys, Since host configuration files only contain public keys,
no secrets are revealed by sending out this information. no secrets are revealed by sending out this information.
.Bl -tag -width indent .Bl -tag -width indent
.It Va Address Li = Ar address Oo Ar port Oc Bq recommended .It Va Address Li = Ar address Bq recommended
The IP address or hostname of this tinc daemon on the real network. The IP address or hostname of this tinc daemon on the real network.
This will only be used when trying to make an outgoing connection to this tinc daemon. This wil only be used when trying to make an outgoing connection to this tinc daemon.
Optionally, a port can be specified to use for this address.
Multiple Multiple
.Va Address .Va Address
variables can be specified, in which case each address will be tried until a working variables can be specified, in which case each address will be tried until a working
connection has been established. connection has been established.
.It Va Cipher Li = Ar cipher Pq aes-256-cbc .It Va Cipher Li = Ar cipher Pq blowfish
The symmetric cipher algorithm used to encrypt UDP packets. The symmetric cipher algorithm used to encrypt UDP packets.
Any cipher supported by LibreSSL or OpenSSL is recognised. Any cipher supported by OpenSSL is recognised.
Furthermore, specifying Furthermore, specifying
.Qq none .Qq none
will turn off packet encryption. will turn off packet encryption.
It is best to use only those ciphers which support CBC mode. It is best to use only those ciphers which support CBC mode.
.It Va ClampMSS Li = yes | no Pq yes
This option specifies whether tinc should clamp the maximum segment size (MSS)
of TCP packets to the path MTU. This helps in situations where ICMP
Fragmentation Needed or Packet too Big messages are dropped by firewalls.
.It Va Compression Li = Ar level Pq 0 .It Va Compression Li = Ar level Pq 0
This option sets the level of compression used for UDP packets. This option sets the level of compression used for UDP packets.
Possible values are 0 (off), 1 (fast zlib) and any integer up to 9 (best zlib), Possible values are 0 (off), 1 (fast zlib) and any integer up to 9 (best zlib),
10 (fast lzo) and 11 (best lzo). 10 (fast lzo) and 11 (best lzo).
.It Va Digest Li = Ar digest Pq sha256 .It Va Digest Li = Ar digest Pq sha1
The digest algorithm used to authenticate UDP packets. The digest algorithm used to authenticate UDP packets.
Any digest supported by LibreSSL or OpenSSL is recognised. Any digest supported by OpenSSL is recognised.
Furthermore, specifying Furthermore, specifying
.Qq none .Qq none
will turn off packet authentication. will turn off packet authentication.
.It Va IndirectData Li = yes | no Pq no .It Va IndirectData Li = yes | no Pq no
When set to yes, only nodes which already have a meta connection to you This option specifies whether other tinc daemons besides the one you specified with
will try to establish direct communication with you. .Va ConnectTo
It is best to leave this option out or set it to no. can make a direct connection to you.
This is especially useful if you are behind a firewall
and it is impossible to make a connection from the outside to your tinc daemon.
Otherwise, it is best to leave this option out or set it to no.
.It Va MACLength Li = Ar length Pq 4 .It Va MACLength Li = Ar length Pq 4
The length of the message authentication code used to authenticate UDP packets. The length of the message authentication code used to authenticate UDP packets.
Can be anything from Can be anything from
.Qq 0 .Qq 0
up to the length of the digest produced by the digest algorithm. up to the length of the digest produced by the digest algorithm.
.It Va PMTU Li = Ar mtu Po 1514 Pc .It Va PMTU Li = Ar mtu Po 1514 Pc Bq experimental
This option controls the initial path MTU to this node. This option controls the initial path MTU to this node.
.It Va PMTUDiscovery Li = yes | no Po yes Pc .It Va PMTUDiscovery Li = yes | no Po no Pc Bq experimental
When this option is enabled, tinc will try to discover the path MTU to this node. When this option is enabled, tinc will try to discover the path MTU to this node.
After the path MTU has been discovered, it will be enforced on the VPN. After the path MTU has been discovered, it will be enforced on the VPN.
.It Va Port Li = Ar port Pq 655 .It Va Port Li = Ar port Pq 655
The port number on which this tinc daemon is listening for incoming connections, The port number on which this tinc daemon is listening for incoming connections.
which is used if no port number is specified in an
.Va Address
statement.
.It Va PublicKey Li = Ar key Bq obsolete .It Va PublicKey Li = Ar key Bq obsolete
The public RSA key of this tinc daemon. The public RSA key of this tinc daemon.
It will be used to cryptographically verify it's identity and to set up a secure connection. It will be used to cryptographically verify it's identity and to set up a secure connection.
@ -521,7 +301,7 @@ the above two options then are not necessary.
Either the PEM format is used, or exactly one of the above two options must be specified Either the PEM format is used, or exactly one of the above two options must be specified
in each host configuration file, in each host configuration file,
if you want to be able to establish a connection with that host. if you want to be able to establish a connection with that host.
.It Va Subnet Li = Ar address Ns Op Li / Ns Ar prefixlength Ns Op Li # Ns Ar weight .It Va Subnet Li = Ar address Ns Op Li / Ns Ar prefixlength
The subnet which this tinc daemon will serve. The subnet which this tinc daemon will serve.
.Nm tinc .Nm tinc
tries to look up which other daemon it should send a packet to by searching the appropriate subnet. tries to look up which other daemon it should send a packet to by searching the appropriate subnet.
@ -534,41 +314,25 @@ variables can be specified.
Subnets can either be single MAC, IPv4 or IPv6 addresses, Subnets can either be single MAC, IPv4 or IPv6 addresses,
in which case a subnet consisting of only that single address is assumed, in which case a subnet consisting of only that single address is assumed,
or they can be a IPv4 or IPv6 network address with a prefixlength. or they can be a IPv4 or IPv6 network address with a prefixlength.
Shorthand notations are not supported.
For example, IPv4 subnets must be in a form like 192.168.1.0/24, For example, IPv4 subnets must be in a form like 192.168.1.0/24,
where 192.168.1.0 is the network address and 24 is the number of bits set in the netmask. where 192.168.1.0 is the network address and 24 is the number of bits set in the netmask.
Note that subnets like 192.168.1.1/24 are invalid! Note that subnets like 192.168.1.1/24 are invalid!
Read a networking HOWTO/FAQ/guide if you don't understand this. Read a networking HOWTO/FAQ/guide if you don't understand this.
IPv6 subnets are notated like fec0:0:0:1::/64. IPv6 subnets are notated like fec0:0:0:1:0:0:0:0/64.
MAC addresses are notated like 0:1a:2b:3c:4d:5e. MAC addresses are notated like 0:1a:2b:3c:4d:5e.
.Pp .It Va TCPOnly Li = yes | no Pq no
A Subnet can be given a weight to indicate its priority over identical Subnets
owned by different nodes. The default weight is 10. Lower values indicate
higher priority. Packets will be sent to the node with the highest priority,
unless that node is not reachable, in which case the node with the next highest
priority will be tried, and so on.
.It Va TCPOnly Li = yes | no Pq no Bq obsolete
If this variable is set to yes, If this variable is set to yes,
then the packets are tunnelled over the TCP connection instead of a UDP connection. then the packets are tunnelled over the TCP connection instead of a UDP connection.
This is especially useful for those who want to run a tinc daemon This is especially useful for those who want to run a tinc daemon
from behind a masquerading firewall, from behind a masquerading firewall,
or if UDP packet routing is disabled somehow. or if UDP packet routing is disabled somehow.
Setting this options also implicitly sets IndirectData. Setting this options also implicitly sets IndirectData.
.Pp
Since version 1.0.10, tinc will automatically detect whether communication via
UDP is possible or not.
.El .El
.Sh SCRIPTS .Sh SCRIPTS
Apart from reading the server and host configuration files, Apart from reading the server and host configuration files,
tinc can also run scripts at certain moments. tinc can also run scripts at certain moments.
Below is a list of filenames of scripts and a description of when they are run. Under Windows (not Cygwin), the scripts should have the extension
A script is only run if it exists and if it is executable.
.Pp
Scripts are run synchronously;
this means that tinc will temporarily stop processing packets until the called script finishes executing.
This guarantees that scripts will execute in the exact same order as the events that trigger them.
If you need to run commands asynchronously, you have to ensure yourself that they are being run in the background.
.Pp
Under Windows (not Cygwin), the scripts must have the extension
.Pa .bat . .Pa .bat .
.Bl -tag -width indent .Bl -tag -width indent
.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-up .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-up
@ -576,7 +340,6 @@ This is the most important script.
If it is present it will be executed right after the tinc daemon has been started and has connected to the virtual network device. If it is present it will be executed right after the tinc daemon has been started and has connected to the virtual network device.
It should be used to set up the corresponding network interface, It should be used to set up the corresponding network interface,
but can also be used to start other things. but can also be used to start other things.
.Pp
Under Windows you can use the Network Connections control panel instead of creating this script. Under Windows you can use the Network Connections control panel instead of creating this script.
.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-down .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-down
This script is started right before the tinc daemon quits. This script is started right before the tinc daemon quits.
@ -588,10 +351,6 @@ becomes reachable.
This script is started when the tinc daemon with name This script is started when the tinc daemon with name
.Ar HOST .Ar HOST
becomes unreachable. becomes unreachable.
.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /host-up
This script is started when any host becomes reachable.
.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /host-down
This script is started when any host becomes unreachable.
.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /subnet-up .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /subnet-up
This script is started when a Subnet becomes reachable. This script is started when a Subnet becomes reachable.
The Subnet and the node it belongs to are passed in environment variables. The Subnet and the node it belongs to are passed in environment variables.
@ -628,12 +387,7 @@ When a host becomes (un)reachable, this is set to its real address.
When a host becomes (un)reachable, this is set to the port number it uses for communication with other tinc daemons. When a host becomes (un)reachable, this is set to the port number it uses for communication with other tinc daemons.
.It Ev SUBNET .It Ev SUBNET
When a subnet becomes (un)reachable, this is set to the subnet. When a subnet becomes (un)reachable, this is set to the subnet.
.It Ev WEIGHT
When a subnet becomes (un)reachable, this is set to the subnet weight.
.El .El
.Pp
Do not forget that under UNIX operating systems, you have to make the scripts executable, using the command
.Nm chmod Li a+x Pa script .
.Sh FILES .Sh FILES
The most important files are: The most important files are:
.Bl -tag -width indent .Bl -tag -width indent
@ -642,8 +396,6 @@ The top directory for configuration files.
.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc.conf .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc.conf
The default name of the server configuration file for net The default name of the server configuration file for net
.Ar NETNAME . .Ar NETNAME .
.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /conf.d/
Optional directory from which any *.conf file will be loaded
.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/ .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/
Host configuration files are kept in this directory. Host configuration files are kept in this directory.
.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-up .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-up
@ -657,8 +409,8 @@ its connection to the virtual network device.
.El .El
.Sh SEE ALSO .Sh SEE ALSO
.Xr tincd 8 , .Xr tincd 8 ,
.Pa https://www.tinc-vpn.org/ , .Pa http://www.tinc-vpn.org/ ,
.Pa http://www.tldp.org/LDP/nag2/ . .Pa http://www.linuxdoc.org/LDP/nag2/ .
.Pp .Pp
The full documentation for The full documentation for
.Nm tinc .Nm tinc

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,27 +1,24 @@
.Dd 2014-05-11 .Dd 2002-03-25
.Dt TINCD 8 .Dt TINCD 8
.\" Manual page created by: .\" Manual page created by:
.\" Ivo Timmermans .\" Ivo Timmermans <ivo@tinc-vpn.org>
.\" Guus Sliepen <guus@tinc-vpn.org> .\" Guus Sliepen <guus@tinc-vpn.org>
.Sh NAME .Sh NAME
.Nm tincd .Nm tincd
.Nd tinc VPN daemon .Nd tinc VPN daemon
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl cdDkKnoLRU .Op Fl cdDkKnL
.Op Fl -config Ns = Ns Ar DIR .Op Fl -config Ns = Ns Ar DIR
.Op Fl -no-detach .Op Fl -no-detach
.Op Fl -debug Ns Op = Ns Ar LEVEL .Op Fl -debug Ns Op = Ns Ar LEVEL
.Op Fl -kill Ns Op = Ns Ar SIGNAL .Op Fl -kill Ns Op = Ns Ar SIGNAL
.Op Fl -net Ns = Ns Ar NETNAME .Op Fl -net Ns = Ns Ar NETNAME
.Op Fl -generate-keys Ns Op = Ns Ar BITS .Op Fl -generate-keys Ns Op = Ns Ar BITS
.Op Fl -option Ns = Ns Ar [HOST.]KEY=VALUE
.Op Fl -mlock .Op Fl -mlock
.Op Fl -logfile Ns Op = Ns Ar FILE .Op Fl -logfile Ns Op = Ns Ar FILE
.Op Fl -pidfile Ns = Ns Ar FILE .Op Fl -pidfile Ns = Ns Ar FILE
.Op Fl -bypass-security .Op Fl -bypass-security
.Op Fl -chroot
.Op Fl -user Ns = Ns Ar USER
.Op Fl -help .Op Fl -help
.Op Fl -version .Op Fl -version
.Sh DESCRIPTION .Sh DESCRIPTION
@ -65,37 +62,13 @@ the service will always be stopped and removed.
.It Fl n, -net Ns = Ns Ar NETNAME .It Fl n, -net Ns = Ns Ar NETNAME
Connect to net Connect to net
.Ar NETNAME . .Ar NETNAME .
This will let tinc read all configuration files from
.Pa @sysconfdir@/tinc/ Ar NETNAME .
Specifying
.Li .
for
.Ar NETNAME
is the same as not specifying any
.Ar NETNAME .
.It Fl K, -generate-keys Ns Op = Ns Ar BITS .It Fl K, -generate-keys Ns Op = Ns Ar BITS
Generate public/private RSA keypair and exit. Generate public/private RSA keypair and exit.
If If
.Ar BITS .Ar BITS
is omitted, the default length will be 2048 bits. is omitted, the default length will be 1024 bits.
When saving keys to existing files, tinc will not delete the old keys, When saving keys to existing files, tinc will not delete the old keys,
you have to remove them manually. you have to remove them manually.
.It Fl o, -option Ns = Ns Ar [HOST.]KEY=VALUE
Without specifying a
.Ar HOST ,
this will set server configuration variable
.Ar KEY
to
.Ar VALUE .
If specified as
.Ar HOST.KEY=VALUE ,
this will set the host configuration variable
.Ar KEY
of the host named
.Ar HOST
to
.Ar VALUE .
This option can be used more than once to specify multiple configuration variables.
.It Fl L, -mlock .It Fl L, -mlock
Lock tinc into main memory. Lock tinc into main memory.
This will prevent sensitive data like shared private keys to be written to the system swap files/partitions. This will prevent sensitive data like shared private keys to be written to the system swap files/partitions.
@ -109,19 +82,11 @@ is omitted, the default is
Write PID to Write PID to
.Ar FILE .Ar FILE
instead of instead of
.Pa @runstatedir@/tinc. Ns Ar NETNAME Ns Pa .pid. .Pa @localstatedir@/run/tinc. Ns Ar NETNAME Ns Pa .pid.
Under Windows this option will be ignored. Under Windows this option will be ignored.
.It Fl -bypass-security .It Fl -bypass-security
Disables encryption and authentication of the meta protocol. Disables encryption and authentication of the meta protocol.
Only useful for debugging. Only useful for debugging.
.It Fl R, -chroot
With this option tinc chroots into the directory where network
config is located (@sysconfdir@/tinc/NETNAME if -n option is used,
or to the directory specified with -c option) after initialization.
.It Fl U, -user Ns = Ns Ar USER
setuid to the specified
.Ar USER
after initialization.
.It Fl -help .It Fl -help
Display short list of options. Display short list of options.
.It Fl -version .It Fl -version
@ -147,10 +112,6 @@ Connections to hosts whose host config file are removed are closed.
New outgoing connections specified in New outgoing connections specified in
.Pa tinc.conf .Pa tinc.conf
will be made. will be made.
If the
.Fl -logfile
option is used, this will also close and reopen the log file,
useful when log rotation is used.
.It INT .It INT
Temporarily increases debug level to 5. Temporarily increases debug level to 5.
Send this signal again to revert to the original level. Send this signal again to revert to the original level.
@ -190,7 +151,7 @@ This will log all network traffic over the virtual private network.
Directory containing the configuration files tinc uses. Directory containing the configuration files tinc uses.
For more information, see For more information, see
.Xr tinc.conf 5 . .Xr tinc.conf 5 .
.It Pa @runstatedir@/tinc. Ns Ar NETNAME Ns Pa .pid .It Pa @localstatedir@/run/tinc. Ns Ar NETNAME Ns Pa .pid
The PID of the currently running The PID of the currently running
.Nm .Nm
is stored in this file. is stored in this file.
@ -207,7 +168,7 @@ If you find any bugs, report them to tinc@tinc-vpn.org.
A lot, especially security auditing. A lot, especially security auditing.
.Sh SEE ALSO .Sh SEE ALSO
.Xr tinc.conf 5 , .Xr tinc.conf 5 ,
.Pa https://www.tinc-vpn.org/ , .Pa http://www.tinc-vpn.org/ ,
.Pa http://www.cabal.org/ . .Pa http://www.cabal.org/ .
.Pp .Pp
The full documentation for tinc is maintained as a Texinfo manual. The full documentation for tinc is maintained as a Texinfo manual.
@ -220,7 +181,7 @@ tinc comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions; This is free software, and you are welcome to redistribute it under certain conditions;
see the file COPYING for details. see the file COPYING for details.
.Sh AUTHORS .Sh AUTHORS
.An "Ivo Timmermans" .An "Ivo Timmermans" Aq ivo@tinc-vpn.org
.An "Guus Sliepen" Aq guus@tinc-vpn.org .An "Guus Sliepen" Aq guus@tinc-vpn.org
.Pp .Pp
And thanks to many others for their contributions to tinc! And thanks to many others for their contributions to tinc!

View file

@ -1,5 +0,0 @@
@set VERSION 1.0.36
@set PACKAGE tinc
@set sysconfdir /etc
@set localstatedir /var
@set runstatedir /run

View file

@ -2,4 +2,3 @@
@set PACKAGE @PACKAGE@ @set PACKAGE @PACKAGE@
@set sysconfdir @sysconfdir@ @set sysconfdir @sysconfdir@
@set localstatedir @localstatedir@ @set localstatedir @localstatedir@
@set runstatedir @runstatedir@

View file

@ -1,10 +1,7 @@
#ifndef TINC_HAVE_H
#define TINC_HAVE_H
/* /*
have.h -- include headers which are known to exist have.h -- include headers which are known to exist
Copyright (C) 1998-2005 Ivo Timmermans Copyright (C) 1998-2005 Ivo Timmermans <ivo@tinc-vpn.org>
2003-2015 Guus Sliepen <guus@tinc-vpn.org> 2003-2005 Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -16,40 +13,23 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License
with this program; if not, write to the Free Software Foundation, Inc., along with this program; if not, write to the Free Software
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifdef HAVE_MINGW #ifndef __TINC_HAVE_H__
#ifdef WITH_WINDOWS2000 #define __TINC_HAVE_H__
#define WINVER Windows2000
#else
#define WINVER WindowsXP
#endif
#endif
#include <stdio.h> #include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <signal.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h>
#ifdef HAVE_MINGW
#include <w32api.h>
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#endif
#ifdef HAVE_STDBOOL_H #ifdef HAVE_STDBOOL_H
#include <stdbool.h> #include <stdbool.h>
@ -59,8 +39,8 @@
#include <termios.h> #include <termios.h>
#endif #endif
#ifdef HAVE_ALLOCA_H #ifdef HAVE_INTTYPES_H
#include <alloca.h> #include <inttypes.h>
#endif #endif
/* Include system specific headers */ /* Include system specific headers */
@ -73,10 +53,6 @@
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
@ -101,18 +77,10 @@
#include <sys/param.h> #include <sys/param.h>
#endif #endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#ifdef HAVE_SYS_UIO_H #ifdef HAVE_SYS_UIO_H
#include <sys/uio.h> #include <sys/uio.h>
#endif #endif
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
/* SunOS really wants sys/socket.h BEFORE net/if.h, /* SunOS really wants sys/socket.h BEFORE net/if.h,
and FreeBSD wants these lines below the rest. */ and FreeBSD wants these lines below the rest. */
@ -136,18 +104,10 @@
#include <net/if_tun.h> #include <net/if_tun.h>
#endif #endif
#ifdef HAVE_NET_TUN_IF_TUN_H
#include <net/tun/if_tun.h>
#endif
#ifdef HAVE_NET_IF_TAP_H #ifdef HAVE_NET_IF_TAP_H
#include <net/if_tap.h> #include <net/if_tap.h>
#endif #endif
#ifdef HAVE_NET_TAP_IF_TAP_H
#include <net/tap/if_tap.h>
#endif
#ifdef HAVE_NETINET_IN_SYSTM_H #ifdef HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h> #include <netinet/in_systm.h>
#endif #endif
@ -196,19 +156,9 @@
#include <netinet/if_ether.h> #include <netinet/if_ether.h>
#endif #endif
#ifdef HAVE_ARPA_NAMESER_H #ifdef HAVE_MINGW
#include <arpa/nameser.h> #include <windows.h>
#ifdef STATUS #include <winsock2.h>
#undef STATUS
#endif
#endif #endif
#ifdef HAVE_RESOLV_H #endif /* __TINC_SYSTEM_H__ */
#include <resolv.h>
#endif
#ifdef HAVE_LINUX_IF_TUN_H
#include <linux/if_tun.h>
#endif
#endif

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# install - install a program, script, or datafile # install - install a program, script, or datafile
scriptversion=2018-03-11.20; # UTC scriptversion=2005-02-02.21
# This originates from X11R5 (mit/util/scripts/install.sh), which was # This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the # later released in X11R6 (xc/config/util/install.sh) with the
@ -35,57 +35,42 @@ scriptversion=2018-03-11.20; # UTC
# FSF changes to this file are in the public domain. # FSF changes to this file are in the public domain.
# #
# Calling this script install-sh is preferred over install.sh, to prevent # Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it # `make' implicit rules from creating a file called install from it
# when there is no Makefile. # when there is no Makefile.
# #
# This script is compatible with the BSD install script, but was written # This script is compatible with the BSD install script, but was written
# from scratch. # from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
tab=' ' # set DOITPROG to echo to test this script
nl='
'
IFS=" $tab$nl"
# Set DOITPROG to "echo" to test this script. # Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
doit=${DOITPROG-} # put in absolute paths if you don't have them in your path; or use env. vars.
doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path; mvprog="${MVPROG-mv}"
# or use environment vars. cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
chgrpprog=${CHGRPPROG-chgrp} chmodcmd="$chmodprog 0755"
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd= chowncmd=
mvcmd=$mvprog chgrpcmd=
rmcmd="$rmprog -f"
stripcmd= stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src= src=
dst= dst=
dir_arg= dir_arg=
dst_arg= dstarg=
no_target_directory=
copy_on_change=false usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES... or: $0 [OPTION]... -d DIRECTORIES...
@ -95,168 +80,108 @@ In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES. In the 4th, create DIRECTORIES.
Options: Options:
--help display this help and exit. -c (ignored)
--version display version info and exit. -d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-c (ignored) -m MODE $chmodprog installed files to MODE.
-C install only if different (preserve the last data modification time) -o USER $chownprog installed files to USER.
-d create directories instead of installing files. -s $stripprog installed files.
-g GROUP $chgrpprog installed files to GROUP. -t DIRECTORY install into DIRECTORY.
-m MODE $chmodprog installed files to MODE. -T report an error if DSTFILE is a directory.
-o USER $chownprog installed files to USER. --help display this help and exit.
-s $stripprog installed files. --version display version info and exit.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands: Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
RMPROG STRIPPROG
" "
while test $# -ne 0; do while test -n "$1"; do
case $1 in case $1 in
-c) ;; -c) shift
continue;;
-C) copy_on_change=true;; -d) dir_arg=true
shift
-d) dir_arg=true;; continue;;
-g) chgrpcmd="$chgrpprog $2" -g) chgrpcmd="$chgrpprog $2"
shift;; shift
shift
continue;;
--help) echo "$usage"; exit $?;; --help) echo "$usage"; exit $?;;
-m) mode=$2 -m) chmodcmd="$chmodprog $2"
case $mode in shift
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) shift
echo "$0: invalid mode: $mode" >&2 continue;;
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2" -o) chowncmd="$chownprog $2"
shift;; shift
shift
continue;;
-s) stripcmd=$stripprog;; -s) stripcmd=$stripprog
shift
continue;;
-t) -t) dstarg=$2
is_target_a_directory=always shift
dst_arg=$2 shift
# Protect names problematic for 'test' and other utilities. continue;;
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;; -T) no_target_directory=true
shift
continue;;
--version) echo "$0 $scriptversion"; exit $?;; --version) echo "$0 $scriptversion"; exit $?;;
--) shift *) # When -d is used, all remaining arguments are directories to create.
break;; # When -t is used, the destination is already specified.
test -n "$dir_arg$dstarg" && break
-*) echo "$0: invalid option: $1" >&2 # Otherwise, the last argument is the destination. Remove it from $@.
exit 1;; for arg
do
*) break;; if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
break;;
esac esac
shift
done done
# We allow the use of options -d and -T together, by making -d if test -z "$1"; then
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2 echo "$0: no input file specified." >&2
exit 1 exit 1
fi fi
# It's OK to call 'install-sh -d' without argument. # It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories. # This can happen when creating conditional directories.
exit 0 exit 0
fi fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src for src
do do
# Protect names problematic for 'test' and other utilities. # Protect names starting with `-'.
case $src in case $src in
-* | [=\(\)!]) src=./$src;; -*) src=./$src ;;
esac esac
if test -n "$dir_arg"; then if test -n "$dir_arg"; then
dst=$src dst=$src
dstdir=$dst src=
test -d "$dstdir"
dstdir_status=$?
else
if test -d "$dst"; then
mkdircmd=:
chmodcmd=
else
mkdircmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad # might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'. # if $src (and thus $dsttmp) contains '*'.
@ -265,204 +190,82 @@ do
exit 1 exit 1
fi fi
if test -z "$dst_arg"; then if test -z "$dstarg"; then
echo "$0: no destination specified." >&2 echo "$0: no destination specified." >&2
exit 1 exit 1
fi fi
dst=$dst_arg
# If destination is a directory, append the input filename. dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then if test -d "$dst"; then
if test "$is_target_a_directory" = never; then if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2 echo "$0: $dstarg: Is a directory" >&2
exit 1 exit 1
fi fi
dstdir=$dst dst=$dst/`basename "$src"`
dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi fi
fi fi
case $dstdir in # This sed command emulates the dirname command.
*/) dstdirslash=$dstdir;; dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
*) dstdirslash=$dstdir/;;
esac
obsolete_mkdir_used=false # Make sure that the destination directory exists.
if test $dstdir_status != 0; then # Skip lots of stat calls in the usual case.
case $posix_mkdir in if test ! -d "$dstdir"; then
'') defaultIFS='
# Create intermediate dirs using mode 755 as modified by the umask. '
# This is like FreeBSD 'install' as of 1997-10-28. IFS="${IFS-$defaultIFS}"
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7]) oIFS=$IFS
mkdir_umask=`expr $umask + 22 \ # Some sh's can't handle IFS=/ for some reason.
- $umask % 100 % 40 + $umask % 20 \ IFS='%'
- $umask % 10 % 4 + $umask % 2 set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
`;; shift
*) mkdir_umask=$umask,go-w;; IFS=$oIFS
esac
# With -d, create the new directory with the user-specified mode. pathcomp=
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false while test $# -ne 0 ; do
case $umask in pathcomp=$pathcomp$1
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
# Note that $RANDOM variable is not portable (e.g. dash); Use it
# here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p' feature.
if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
test_tmpdir="$tmpdir/a"
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift shift
set +f if test ! -d "$pathcomp"; then
IFS=$oIFS $mkdirprog "$pathcomp"
# mkdir can fail with a `File exist' error in case several
prefixes= # install-sh are creating the directory concurrently. This
# is OK.
for d test -d "$pathcomp" || exit
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi fi
fi pathcomp=$pathcomp/
done
fi fi
if test -n "$dir_arg"; then if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } && $doit $mkdircmd "$dst" \
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
else else
dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory. # Make a couple of temp file names in the proper directory.
dsttmp=${dstdirslash}_inst.$$_ dsttmp=$dstdir/_inst.$$_
rmtmp=${dstdirslash}_rm.$$_ rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit. # Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap '(exit $?); exit' 1 2 13 15
# Copy the file name to the temp name. # Copy the file name to the temp name.
(umask $cp_umask && $doit $cpprog "$src" "$dsttmp" &&
{ test -z "$stripcmd" || {
# Create $dsttmp read-write so that cp doesn't create it read-only,
# which would cause strip to fail.
if test -z "$doit"; then
: >"$dsttmp" # No need to fork-exec 'touch'.
else
$doit touch "$dsttmp"
fi
}
} &&
$doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits. # and set any options; do chmod last to preserve setuid bits.
# #
@ -470,60 +273,51 @@ do
# ignore errors from any of these, just make sure not to ignore # ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command. # errors from the above "$doit $cpprog $src $dsttmp" command.
# #
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file. # Now rename the file to the real destination.
if $copy_on_change && { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && || {
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && # The rename failed, perhaps because mv can't rename something else
set -f && # to itself, or perhaps because mv is so ancient that it does not
set X $old && old=:$2:$4:$5:$6 && # support -f.
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else # Now remove or move aside any old file at destination location.
# to itself, or perhaps because mv is so ancient that it does not # We try this two ways since rm can't unlink itself on some
# support -f. # systems and the destination file might be busy for other
{ # reasons. In this case, the final cleanup might fail but the new
# Now remove or move aside any old file at destination location. # file should still install successfully.
# We try this two ways since rm can't unlink itself on some {
# systems and the destination file might be busy for other if test -f "$dstdir/$dstfile"; then
# reasons. In this case, the final cleanup might fail but the new $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
# file should still install successfully. || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
{ || {
test ! -f "$dst" || echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
$doit $rmcmd -f "$dst" 2>/dev/null || (exit 1); exit 1
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && }
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } else
} || :
{ echo "$0: cannot unlink or rename $dst" >&2 fi
(exit 1); exit 1 } &&
}
} &&
# Now rename the file to the real destination. # Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst" $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
} }
fi || exit 1 }
fi || { (exit 1); exit 1; }
trap '' 0
fi
done done
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit 0
}
# Local variables: # Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp) # eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0" # time-stamp-end: "$"
# time-stamp-end: "; # UTC"
# End: # End:

15
lib/Makefile.am Normal file
View file

@ -0,0 +1,15 @@
## Process this file with automake to produce Makefile.in
# $Id: Makefile.am 1374 2004-03-21 14:21:22Z guus $
noinst_LIBRARIES = libvpn.a
INCLUDES = @INCLUDES@ -I. -I$(top_builddir)
libvpn_a_SOURCES = xmalloc.c pidfile.c utils.c getopt.c getopt1.c list.c avl_tree.c dropin.c fake-getaddrinfo.c fake-getnameinfo.c
libvpn_a_LIBADD = @LIBOBJS@ @ALLOCA@
libvpn_a_DEPENDENCIES = $(libvpn_a_LIBADD)
noinst_HEADERS = xalloc.h pidfile.h utils.h getopt.h list.h avl_tree.h dropin.h fake-getaddrinfo.h fake-getnameinfo.h fake-gai-errnos.h gettext.h ipv6.h ipv4.h ethernet.h
EXTRA_DIST =

433
lib/Makefile.in Normal file
View file

@ -0,0 +1,433 @@
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# $Id: Makefile.am 1374 2004-03-21 14:21:22Z guus $
SOURCES = $(libvpn_a_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = lib
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in alloca.c malloc.c memcmp.c realloc.c
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
$(top_srcdir)/m4/attribute.m4 $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
$(top_srcdir)/m4/lzo.m4 $(top_srcdir)/m4/malloc.m4 \
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
$(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/tuntap.m4 \
$(top_srcdir)/m4/zlib.m4 $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
AR = ar
ARFLAGS = cru
libvpn_a_AR = $(AR) $(ARFLAGS)
am_libvpn_a_OBJECTS = xmalloc.$(OBJEXT) pidfile.$(OBJEXT) \
utils.$(OBJEXT) getopt.$(OBJEXT) getopt1.$(OBJEXT) \
list.$(OBJEXT) avl_tree.$(OBJEXT) dropin.$(OBJEXT) \
fake-getaddrinfo.$(OBJEXT) fake-getnameinfo.$(OBJEXT)
libvpn_a_OBJECTS = $(am_libvpn_a_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libvpn_a_SOURCES)
DIST_SOURCES = $(libvpn_a_SOURCES)
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GMSGFMT = @GMSGFMT@
HAVE_TUNTAP = @HAVE_TUNTAP@
INCLUDES = @INCLUDES@ -I. -I$(top_builddir)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INTLLIBS = @INTLLIBS@
LDFLAGS = @LDFLAGS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LINUX_IF_TUN_H = @LINUX_IF_TUN_H@
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MSGMERGE = @MSGMERGE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POSUB = @POSUB@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
XGETTEXT = @XGETTEXT@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
noinst_LIBRARIES = libvpn.a
libvpn_a_SOURCES = xmalloc.c pidfile.c utils.c getopt.c getopt1.c list.c avl_tree.c dropin.c fake-getaddrinfo.c fake-getnameinfo.c
libvpn_a_LIBADD = @LIBOBJS@ @ALLOCA@
libvpn_a_DEPENDENCIES = $(libvpn_a_LIBADD)
noinst_HEADERS = xalloc.h pidfile.h utils.h getopt.h list.h avl_tree.h dropin.h fake-getaddrinfo.h fake-getnameinfo.h fake-gai-errnos.h gettext.h ipv6.h ipv4.h ethernet.h
EXTRA_DIST =
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu lib/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libvpn.a: $(libvpn_a_OBJECTS) $(libvpn_a_DEPENDENCIES)
-rm -f libvpn.a
$(libvpn_a_AR) libvpn.a $(libvpn_a_OBJECTS) $(libvpn_a_LIBADD)
$(RANLIB) libvpn.a
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/alloca.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/malloc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/memcmp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/realloc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl_tree.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dropin.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fake-getaddrinfo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fake-getnameinfo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pidfile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LIBRARIES) $(HEADERS)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf $(DEPDIR) ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf $(DEPDIR) ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

494
lib/alloca.c Normal file
View file

@ -0,0 +1,494 @@
/* alloca.c -- allocate automatically reclaimed memory
(Mostly) portable public-domain implementation -- D A Gwyn
This implementation of the PWB library alloca function,
which is used to allocate space off the run-time stack so
that it is automatically reclaimed upon procedure exit,
was inspired by discussions with J. Q. Johnson of Cornell.
J.Otto Tennant <jot@cray.com> contributed the Cray support.
There are some preprocessor constants that can
be defined when compiling for your specific system, for
improved efficiency; however, the defaults should be okay.
The general concept of this implementation is to keep
track of all alloca-allocated blocks, and reclaim any
that are found to be deeper in the stack than the current
invocation. This heuristic does not reclaim storage as
soon as it becomes invalid, but it will do so eventually.
As a special case, alloca(0) reclaims storage without
allocating any. It is a good idea to use alloca(0) in
your main control loop, etc. to force garbage collection. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef emacs
# include "blockinput.h"
#endif
/* If compiling with GCC 2, this file's not needed. */
#if !defined (__GNUC__) || __GNUC__ < 2
/* If someone has defined alloca as a macro,
there must be some other way alloca is supposed to work. */
# ifndef alloca
# ifdef emacs
# ifdef static
/* actually, only want this if static is defined as ""
-- this is for usg, in which emacs must undefine static
in order to make unexec workable
*/
# ifndef STACK_DIRECTION
you
lose
-- must know STACK_DIRECTION at compile-time
# endif /* STACK_DIRECTION undefined */
# endif /* static */
# endif /* emacs */
/* If your stack is a linked list of frames, you have to
provide an "address metric" ADDRESS_FUNCTION macro. */
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
long i00afunc ();
# define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
# else
# define ADDRESS_FUNCTION(arg) &(arg)
# endif
# if __STDC__
typedef void *pointer;
# else
typedef char *pointer;
# endif
# ifndef NULL
# define NULL 0
# endif
/* Different portions of Emacs need to call different versions of
malloc. The Emacs executable needs alloca to call xmalloc, because
ordinary malloc isn't protected from input signals. On the other
hand, the utilities in lib-src need alloca to call malloc; some of
them are very simple, and don't have an xmalloc routine.
Non-Emacs programs expect this to call xmalloc.
Callers below should use malloc. */
# ifndef emacs
# define malloc xmalloc
# endif
extern pointer malloc ();
/* Define STACK_DIRECTION if you know the direction of stack
growth for your system; otherwise it will be automatically
deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
# ifndef STACK_DIRECTION
# define STACK_DIRECTION 0 /* Direction unknown. */
# endif
# if STACK_DIRECTION != 0
# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
# else /* STACK_DIRECTION == 0; need run-time code. */
static int stack_dir; /* 1 or -1 once known. */
# define STACK_DIR stack_dir
static void
find_stack_direction ()
{
static char *addr = NULL; /* Address of first `dummy', once known. */
auto char dummy; /* To get stack address. */
if (addr == NULL)
{ /* Initial entry. */
addr = ADDRESS_FUNCTION (dummy);
find_stack_direction (); /* Recurse once. */
}
else
{
/* Second entry. */
if (ADDRESS_FUNCTION (dummy) > addr)
stack_dir = 1; /* Stack grew upward. */
else
stack_dir = -1; /* Stack grew downward. */
}
}
# endif /* STACK_DIRECTION == 0 */
/* An "alloca header" is used to:
(a) chain together all alloca'ed blocks;
(b) keep track of stack depth.
It is very important that sizeof(header) agree with malloc
alignment chunk size. The following default should work okay. */
# ifndef ALIGN_SIZE
# define ALIGN_SIZE sizeof(double)
# endif
typedef union hdr
{
char align[ALIGN_SIZE]; /* To force sizeof(header). */
struct
{
union hdr *next; /* For chaining headers. */
char *deep; /* For stack depth measure. */
} h;
} header;
static header *last_alloca_header = NULL; /* -> last alloca header. */
/* Return a pointer to at least SIZE bytes of storage,
which will be automatically reclaimed upon exit from
the procedure that called alloca. Originally, this space
was supposed to be taken from the current stack frame of the
caller, but that method cannot be made to work for some
implementations of C, for example under Gould's UTX/32. */
pointer
alloca (size)
unsigned size;
{
auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe);
# if STACK_DIRECTION == 0
if (STACK_DIR == 0) /* Unknown growth direction. */
find_stack_direction ();
# endif
/* Reclaim garbage, defined as all alloca'd storage that
was allocated from deeper in the stack than currently. */
{
register header *hp; /* Traverses linked list. */
# ifdef emacs
BLOCK_INPUT;
# endif
for (hp = last_alloca_header; hp != NULL;)
if ((STACK_DIR > 0 && hp->h.deep > depth)
|| (STACK_DIR < 0 && hp->h.deep < depth))
{
register header *np = hp->h.next;
free ((pointer) hp); /* Collect garbage. */
hp = np; /* -> next header. */
}
else
break; /* Rest are not deeper. */
last_alloca_header = hp; /* -> last valid storage. */
# ifdef emacs
UNBLOCK_INPUT;
# endif
}
if (size == 0)
return NULL; /* No allocation required. */
/* Allocate combined header + user data storage. */
{
register pointer new = malloc (sizeof (header) + size);
/* Address of header. */
((header *) new)->h.next = last_alloca_header;
((header *) new)->h.deep = depth;
last_alloca_header = (header *) new;
/* User storage begins just after header. */
return (pointer) ((char *) new + sizeof (header));
}
}
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
# ifdef DEBUG_I00AFUNC
# include <stdio.h>
# endif
# ifndef CRAY_STACK
# define CRAY_STACK
# ifndef CRAY2
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
struct stack_control_header
{
long shgrow:32; /* Number of times stack has grown. */
long shaseg:32; /* Size of increments to stack. */
long shhwm:32; /* High water mark of stack. */
long shsize:32; /* Current size of stack (all segments). */
};
/* The stack segment linkage control information occurs at
the high-address end of a stack segment. (The stack
grows from low addresses to high addresses.) The initial
part of the stack segment linkage control information is
0200 (octal) words. This provides for register storage
for the routine which overflows the stack. */
struct stack_segment_linkage
{
long ss[0200]; /* 0200 overflow words. */
long sssize:32; /* Number of words in this segment. */
long ssbase:32; /* Offset to stack base. */
long:32;
long sspseg:32; /* Offset to linkage control of previous
segment of stack. */
long:32;
long sstcpt:32; /* Pointer to task common address block. */
long sscsnm; /* Private control structure number for
microtasking. */
long ssusr1; /* Reserved for user. */
long ssusr2; /* Reserved for user. */
long sstpid; /* Process ID for pid based multi-tasking. */
long ssgvup; /* Pointer to multitasking thread giveup. */
long sscray[7]; /* Reserved for Cray Research. */
long ssa0;
long ssa1;
long ssa2;
long ssa3;
long ssa4;
long ssa5;
long ssa6;
long ssa7;
long sss0;
long sss1;
long sss2;
long sss3;
long sss4;
long sss5;
long sss6;
long sss7;
};
# else /* CRAY2 */
/* The following structure defines the vector of words
returned by the STKSTAT library routine. */
struct stk_stat
{
long now; /* Current total stack size. */
long maxc; /* Amount of contiguous space which would
be required to satisfy the maximum
stack demand to date. */
long high_water; /* Stack high-water mark. */
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
long hits; /* Number of internal buffer hits. */
long extends; /* Number of block extensions. */
long stko_mallocs; /* Block allocations by $STKOFEN. */
long underflows; /* Number of stack underflow calls ($STKRETN). */
long stko_free; /* Number of deallocations by $STKRETN. */
long stkm_free; /* Number of deallocations by $STKMRET. */
long segments; /* Current number of stack segments. */
long maxs; /* Maximum number of stack segments so far. */
long pad_size; /* Stack pad size. */
long current_address; /* Current stack segment address. */
long current_size; /* Current stack segment size. This
number is actually corrupted by STKSTAT to
include the fifteen word trailer area. */
long initial_address; /* Address of initial segment. */
long initial_size; /* Size of initial segment. */
};
/* The following structure describes the data structure which trails
any stack segment. I think that the description in 'asdef' is
out of date. I only describe the parts that I am sure about. */
struct stk_trailer
{
long this_address; /* Address of this block. */
long this_size; /* Size of this block (does not include
this trailer). */
long unknown2;
long unknown3;
long link; /* Address of trailer block of previous
segment. */
long unknown5;
long unknown6;
long unknown7;
long unknown8;
long unknown9;
long unknown10;
long unknown11;
long unknown12;
long unknown13;
long unknown14;
};
# endif /* CRAY2 */
# endif /* not CRAY_STACK */
# ifdef CRAY2
/* Determine a "stack measure" for an arbitrary ADDRESS.
I doubt that "lint" will like this much. */
static long
i00afunc (long *address)
{
struct stk_stat status;
struct stk_trailer *trailer;
long *block, size;
long result = 0;
/* We want to iterate through all of the segments. The first
step is to get the stack status structure. We could do this
more quickly and more directly, perhaps, by referencing the
$LM00 common block, but I know that this works. */
STKSTAT (&status);
/* Set up the iteration. */
trailer = (struct stk_trailer *) (status.current_address
+ status.current_size
- 15);
/* There must be at least one stack segment. Therefore it is
a fatal error if "trailer" is null. */
if (trailer == 0)
abort ();
/* Discard segments that do not contain our argument address. */
while (trailer != 0)
{
block = (long *) trailer->this_address;
size = trailer->this_size;
if (block == 0 || size == 0)
abort ();
trailer = (struct stk_trailer *) trailer->link;
if ((block <= address) && (address < (block + size)))
break;
}
/* Set the result to the offset in this segment and add the sizes
of all predecessor segments. */
result = address - block;
if (trailer == 0)
{
return result;
}
do
{
if (trailer->this_size <= 0)
abort ();
result += trailer->this_size;
trailer = (struct stk_trailer *) trailer->link;
}
while (trailer != 0);
/* We are done. Note that if you present a bogus address (one
not in any segment), you will get a different number back, formed
from subtracting the address of the first block. This is probably
not what you want. */
return (result);
}
# else /* not CRAY2 */
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
Determine the number of the cell within the stack,
given the address of the cell. The purpose of this
routine is to linearize, in some sense, stack addresses
for alloca. */
static long
i00afunc (long address)
{
long stkl = 0;
long size, pseg, this_segment, stack;
long result = 0;
struct stack_segment_linkage *ssptr;
/* Register B67 contains the address of the end of the
current stack segment. If you (as a subprogram) store
your registers on the stack and find that you are past
the contents of B67, you have overflowed the segment.
B67 also points to the stack segment linkage control
area, which is what we are really interested in. */
stkl = CRAY_STACKSEG_END ();
ssptr = (struct stack_segment_linkage *) stkl;
/* If one subtracts 'size' from the end of the segment,
one has the address of the first word of the segment.
If this is not the first segment, 'pseg' will be
nonzero. */
pseg = ssptr->sspseg;
size = ssptr->sssize;
this_segment = stkl - size;
/* It is possible that calling this routine itself caused
a stack overflow. Discard stack segments which do not
contain the target address. */
while (!(this_segment <= address && address <= stkl))
{
# ifdef DEBUG_I00AFUNC
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
# endif
if (pseg == 0)
break;
stkl = stkl - pseg;
ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
this_segment = stkl - size;
}
result = address - this_segment;
/* If you subtract pseg from the current end of the stack,
you get the address of the previous stack segment's end.
This seems a little convoluted to me, but I'll bet you save
a cycle somewhere. */
while (pseg != 0)
{
# ifdef DEBUG_I00AFUNC
fprintf (stderr, "%011o %011o\n", pseg, size);
# endif
stkl = stkl - pseg;
ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
result += size;
}
return (result);
}
# endif /* not CRAY2 */
# endif /* CRAY */
# endif /* no alloca */
#endif /* not GCC version 2 */

View file

@ -1,8 +1,8 @@
/* /*
avl_tree.c -- avl_ tree and linked list convenience avl_tree.c -- avl_ tree and linked list convenience
Copyright (C) 1998 Michael H. Buselli Copyright (C) 1998 Michael H. Buselli
2000-2005 Ivo Timmermans, 2000-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2015 Guus Sliepen <guus@tinc-vpn.org> 2000-2005 Guus Sliepen <guus@tinc-vpn.org>
2000-2005 Wessel Dankers <wsl@tinc-vpn.org> 2000-2005 Wessel Dankers <wsl@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@ -15,9 +15,9 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License
with this program; if not, write to the Free Software Foundation, Inc., along with this program; if not, write to the Free Software
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Original AVL tree library by Michael H. Buselli <cosine@cosine.org>. Original AVL tree library by Michael H. Buselli <cosine@cosine.org>.
@ -26,8 +26,10 @@
the code. Mail me if you found a bug. the code. Mail me if you found a bug.
Cleaned up and incorporated some of the ideas from the red-black tree Cleaned up and incorporated some of the ideas from the red-black tree
library for inclusion into tinc (https://www.tinc-vpn.org/) by library for inclusion into tinc (http://www.tinc-vpn.org/) by
Guus Sliepen <guus@tinc-vpn.org>. Guus Sliepen <guus@tinc-vpn.org>.
$Id: avl_tree.c 1439 2005-05-04 18:09:30Z guus $
*/ */
#include "system.h" #include "system.h"
@ -50,14 +52,14 @@
#endif #endif
#ifndef AVL_DEPTH #ifndef AVL_DEPTH
static int lg(unsigned int u) __attribute__((__const__)); static int lg(unsigned int u) __attribute__ ((__const__));
static int lg(unsigned int u) { static int lg(unsigned int u)
{
int r = 1; int r = 1;
if(!u) { if(!u)
return 0; return 0;
}
if(u & 0xffff0000) { if(u & 0xffff0000) {
u >>= 16; u >>= 16;
@ -79,9 +81,8 @@ static int lg(unsigned int u) {
r += 2; r += 2;
} }
if(u & 0x00000002) { if(u & 0x00000002)
r++; r++;
}
return r; return r;
} }
@ -89,7 +90,8 @@ static int lg(unsigned int u) {
/* Internal helper functions */ /* Internal helper functions */
static int avl_check_balance(const avl_node_t *node) { static int avl_check_balance(const avl_node_t *node)
{
#ifdef AVL_DEPTH #ifdef AVL_DEPTH
int d; int d;
@ -97,185 +99,171 @@ static int avl_check_balance(const avl_node_t *node) {
return d < -1 ? -1 : d > 1 ? 1 : 0; return d < -1 ? -1 : d > 1 ? 1 : 0;
#else #else
/* int d; /* int d;
* d = lg(AVL_R_COUNT(node)) - lg(AVL_L_COUNT(node)); * d = lg(AVL_R_COUNT(node)) - lg(AVL_L_COUNT(node));
* d = d<-1?-1:d>1?1:0; * d = d<-1?-1:d>1?1:0;
*/ */
int pl, r; int pl, r;
pl = lg(AVL_L_COUNT(node)); pl = lg(AVL_L_COUNT(node));
r = AVL_R_COUNT(node); r = AVL_R_COUNT(node);
if(r >> pl + 1) { if(r >> pl + 1)
return 1; return 1;
}
if(pl < 2 || r >> pl - 2) { if(pl < 2 || r >> pl - 2)
return 0; return 0;
}
return -1; return -1;
#endif #endif
} }
static void avl_rebalance(avl_tree_t *tree, avl_node_t *node) { static void avl_rebalance(avl_tree_t *tree, avl_node_t *node)
{
avl_node_t *child; avl_node_t *child;
avl_node_t *gchild; avl_node_t *gchild;
avl_node_t *parent; avl_node_t *parent;
avl_node_t **superparent; avl_node_t **superparent;
parent = node;
while(node) { while(node) {
parent = node->parent; parent = node->parent;
superparent = superparent =
parent ? node == parent ? node ==
parent->left ? &parent->left : &parent->right : &tree->root; parent->left ? &parent->left : &parent->right : &tree->root;
switch(avl_check_balance(node)) { switch (avl_check_balance(node)) {
case -1: case -1:
child = node->left; child = node->left;
#ifdef AVL_DEPTH #ifdef AVL_DEPTH
if(L_AVL_DEPTH(child) >= R_AVL_DEPTH(child)) {
if(L_AVL_DEPTH(child) >= R_AVL_DEPTH(child)) {
#else #else
if(AVL_L_COUNT(child) >= AVL_R_COUNT(child)) {
if(AVL_L_COUNT(child) >= AVL_R_COUNT(child)) {
#endif #endif
node->left = child->right; node->left = child->right;
if(node->left)
node->left->parent = node;
if(node->left) { child->right = node;
node->left->parent = node; node->parent = child;
} *superparent = child;
child->parent = parent;
child->right = node;
node->parent = child;
*superparent = child;
child->parent = parent;
#ifdef AVL_COUNT #ifdef AVL_COUNT
node->count = AVL_CALC_COUNT(node); node->count = AVL_CALC_COUNT(node);
child->count = AVL_CALC_COUNT(child); child->count = AVL_CALC_COUNT(child);
#endif #endif
#ifdef AVL_DEPTH #ifdef AVL_DEPTH
node->depth = AVL_CALC_DEPTH(node); node->depth = AVL_CALC_DEPTH(node);
child->depth = AVL_CALC_DEPTH(child); child->depth = AVL_CALC_DEPTH(child);
#endif #endif
} else { } else {
gchild = child->right; gchild = child->right;
node->left = gchild->right; node->left = gchild->right;
if(node->left) { if(node->left)
node->left->parent = node; node->left->parent = node;
} child->right = gchild->left;
child->right = gchild->left; if(child->right)
child->right->parent = child;
gchild->right = node;
if(child->right) { if(gchild->right)
child->right->parent = child; gchild->right->parent = gchild;
} gchild->left = child;
gchild->right = node; if(gchild->left)
gchild->left->parent = gchild;
*superparent = gchild;
gchild->right->parent = gchild; gchild->parent = parent;
gchild->left = child;
gchild->left->parent = gchild;
*superparent = gchild;
gchild->parent = parent;
#ifdef AVL_COUNT #ifdef AVL_COUNT
node->count = AVL_CALC_COUNT(node); node->count = AVL_CALC_COUNT(node);
child->count = AVL_CALC_COUNT(child); child->count = AVL_CALC_COUNT(child);
gchild->count = AVL_CALC_COUNT(gchild); gchild->count = AVL_CALC_COUNT(gchild);
#endif #endif
#ifdef AVL_DEPTH #ifdef AVL_DEPTH
node->depth = AVL_CALC_DEPTH(node); node->depth = AVL_CALC_DEPTH(node);
child->depth = AVL_CALC_DEPTH(child); child->depth = AVL_CALC_DEPTH(child);
gchild->depth = AVL_CALC_DEPTH(gchild); gchild->depth = AVL_CALC_DEPTH(gchild);
#endif #endif
} }
break;
break; case 1:
child = node->right;
case 1:
child = node->right;
#ifdef AVL_DEPTH #ifdef AVL_DEPTH
if(R_AVL_DEPTH(child) >= L_AVL_DEPTH(child)) {
if(R_AVL_DEPTH(child) >= L_AVL_DEPTH(child)) {
#else #else
if(AVL_R_COUNT(child) >= AVL_L_COUNT(child)) {
if(AVL_R_COUNT(child) >= AVL_L_COUNT(child)) {
#endif #endif
node->right = child->left; node->right = child->left;
if(node->right)
node->right->parent = node;
child->left = node;
node->parent = child;
*superparent = child;
child->parent = parent;
#ifdef AVL_COUNT
node->count = AVL_CALC_COUNT(node);
child->count = AVL_CALC_COUNT(child);
#endif
#ifdef AVL_DEPTH
node->depth = AVL_CALC_DEPTH(node);
child->depth = AVL_CALC_DEPTH(child);
#endif
} else {
gchild = child->left;
node->right = gchild->left;
if(node->right) { if(node->right)
node->right->parent = node; node->right->parent = node;
child->left = gchild->right;
if(child->left)
child->left->parent = child;
gchild->left = node;
if(gchild->left)
gchild->left->parent = gchild;
gchild->right = child;
if(gchild->right)
gchild->right->parent = gchild;
*superparent = gchild;
gchild->parent = parent;
#ifdef AVL_COUNT
node->count = AVL_CALC_COUNT(node);
child->count = AVL_CALC_COUNT(child);
gchild->count = AVL_CALC_COUNT(gchild);
#endif
#ifdef AVL_DEPTH
node->depth = AVL_CALC_DEPTH(node);
child->depth = AVL_CALC_DEPTH(child);
gchild->depth = AVL_CALC_DEPTH(gchild);
#endif
} }
break;
child->left = node; default:
node->parent = child;
*superparent = child;
child->parent = parent;
#ifdef AVL_COUNT #ifdef AVL_COUNT
node->count = AVL_CALC_COUNT(node); node->count = AVL_CALC_COUNT(node);
child->count = AVL_CALC_COUNT(child);
#endif #endif
#ifdef AVL_DEPTH #ifdef AVL_DEPTH
node->depth = AVL_CALC_DEPTH(node); node->depth = AVL_CALC_DEPTH(node);
child->depth = AVL_CALC_DEPTH(child);
#endif
} else {
gchild = child->left;
node->right = gchild->left;
if(node->right) {
node->right->parent = node;
}
child->left = gchild->right;
if(child->left) {
child->left->parent = child;
}
gchild->left = node;
gchild->left->parent = gchild;
gchild->right = child;
gchild->right->parent = gchild;
*superparent = gchild;
gchild->parent = parent;
#ifdef AVL_COUNT
node->count = AVL_CALC_COUNT(node);
child->count = AVL_CALC_COUNT(child);
gchild->count = AVL_CALC_COUNT(gchild);
#endif
#ifdef AVL_DEPTH
node->depth = AVL_CALC_DEPTH(node);
child->depth = AVL_CALC_DEPTH(child);
gchild->depth = AVL_CALC_DEPTH(gchild);
#endif
}
break;
default:
#ifdef AVL_COUNT
node->count = AVL_CALC_COUNT(node);
#endif
#ifdef AVL_DEPTH
node->depth = AVL_CALC_DEPTH(node);
#endif #endif
} }
node = parent; node = parent;
} }
} }
/* (De)constructors */ /* (De)constructors */
avl_tree_t *avl_alloc_tree(avl_compare_t compare, avl_action_t delete) { avl_tree_t *avl_alloc_tree(avl_compare_t compare, avl_action_t delete)
{
avl_tree_t *tree; avl_tree_t *tree;
tree = xmalloc_and_zero(sizeof(avl_tree_t)); tree = xmalloc_and_zero(sizeof(avl_tree_t));
@ -285,25 +273,28 @@ avl_tree_t *avl_alloc_tree(avl_compare_t compare, avl_action_t delete) {
return tree; return tree;
} }
void avl_free_tree(avl_tree_t *tree) { void avl_free_tree(avl_tree_t *tree)
{
free(tree); free(tree);
} }
avl_node_t *avl_alloc_node(void) { avl_node_t *avl_alloc_node(void)
{
return xmalloc_and_zero(sizeof(avl_node_t)); return xmalloc_and_zero(sizeof(avl_node_t));
} }
void avl_free_node(avl_tree_t *tree, avl_node_t *node) { void avl_free_node(avl_tree_t *tree, avl_node_t *node)
if(node->data && tree->delete) { {
if(node->data && tree->delete)
tree->delete(node->data); tree->delete(node->data);
}
free(node); free(node);
} }
/* Searching */ /* Searching */
void *avl_search(const avl_tree_t *tree, const void *data) { void *avl_search(const avl_tree_t *tree, const void *data)
{
avl_node_t *node; avl_node_t *node;
node = avl_search_node(tree, data); node = avl_search_node(tree, data);
@ -311,7 +302,8 @@ void *avl_search(const avl_tree_t *tree, const void *data) {
return node ? node->data : NULL; return node ? node->data : NULL;
} }
void *avl_search_closest(const avl_tree_t *tree, const void *data, int *result) { void *avl_search_closest(const avl_tree_t *tree, const void *data, int *result)
{
avl_node_t *node; avl_node_t *node;
node = avl_search_closest_node(tree, data, result); node = avl_search_closest_node(tree, data, result);
@ -319,7 +311,8 @@ void *avl_search_closest(const avl_tree_t *tree, const void *data, int *result)
return node ? node->data : NULL; return node ? node->data : NULL;
} }
void *avl_search_closest_smaller(const avl_tree_t *tree, const void *data) { void *avl_search_closest_smaller(const avl_tree_t *tree, const void *data)
{
avl_node_t *node; avl_node_t *node;
node = avl_search_closest_smaller_node(tree, data); node = avl_search_closest_smaller_node(tree, data);
@ -327,7 +320,8 @@ void *avl_search_closest_smaller(const avl_tree_t *tree, const void *data) {
return node ? node->data : NULL; return node ? node->data : NULL;
} }
void *avl_search_closest_greater(const avl_tree_t *tree, const void *data) { void *avl_search_closest_greater(const avl_tree_t *tree, const void *data)
{
avl_node_t *node; avl_node_t *node;
node = avl_search_closest_greater_node(tree, data); node = avl_search_closest_greater_node(tree, data);
@ -335,7 +329,8 @@ void *avl_search_closest_greater(const avl_tree_t *tree, const void *data) {
return node ? node->data : NULL; return node ? node->data : NULL;
} }
avl_node_t *avl_search_node(const avl_tree_t *tree, const void *data) { avl_node_t *avl_search_node(const avl_tree_t *tree, const void *data)
{
avl_node_t *node; avl_node_t *node;
int result; int result;
@ -345,17 +340,16 @@ avl_node_t *avl_search_node(const avl_tree_t *tree, const void *data) {
} }
avl_node_t *avl_search_closest_node(const avl_tree_t *tree, const void *data, avl_node_t *avl_search_closest_node(const avl_tree_t *tree, const void *data,
int *result) { int *result)
{
avl_node_t *node; avl_node_t *node;
int c; int c;
node = tree->root; node = tree->root;
if(!node) { if(!node) {
if(result) { if(result)
*result = 0; *result = 0;
}
return NULL; return NULL;
} }
@ -363,30 +357,24 @@ avl_node_t *avl_search_closest_node(const avl_tree_t *tree, const void *data,
c = tree->compare(data, node->data); c = tree->compare(data, node->data);
if(c < 0) { if(c < 0) {
if(node->left) { if(node->left)
node = node->left; node = node->left;
} else { else {
if(result) { if(result)
*result = -1; *result = -1;
}
break; break;
} }
} else if(c > 0) { } else if(c > 0) {
if(node->right) { if(node->right)
node = node->right; node = node->right;
} else { else {
if(result) { if(result)
*result = 1; *result = 1;
}
break; break;
} }
} else { } else {
if(result) { if(result)
*result = 0; *result = 0;
}
break; break;
} }
} }
@ -395,36 +383,37 @@ avl_node_t *avl_search_closest_node(const avl_tree_t *tree, const void *data,
} }
avl_node_t *avl_search_closest_smaller_node(const avl_tree_t *tree, avl_node_t *avl_search_closest_smaller_node(const avl_tree_t *tree,
const void *data) { const void *data)
{
avl_node_t *node; avl_node_t *node;
int result; int result;
node = avl_search_closest_node(tree, data, &result); node = avl_search_closest_node(tree, data, &result);
if(result < 0) { if(result < 0)
node = node->prev; node = node->prev;
}
return node; return node;
} }
avl_node_t *avl_search_closest_greater_node(const avl_tree_t *tree, avl_node_t *avl_search_closest_greater_node(const avl_tree_t *tree,
const void *data) { const void *data)
{
avl_node_t *node; avl_node_t *node;
int result; int result;
node = avl_search_closest_node(tree, data, &result); node = avl_search_closest_node(tree, data, &result);
if(result > 0) { if(result > 0)
node = node->next; node = node->next;
}
return node; return node;
} }
/* Insertion and deletion */ /* Insertion and deletion */
avl_node_t *avl_insert(avl_tree_t *tree, void *data) { avl_node_t *avl_insert(avl_tree_t *tree, void *data)
{
avl_node_t *closest, *new; avl_node_t *closest, *new;
int result; int result;
@ -435,21 +424,21 @@ avl_node_t *avl_insert(avl_tree_t *tree, void *data) {
} else { } else {
closest = avl_search_closest_node(tree, data, &result); closest = avl_search_closest_node(tree, data, &result);
switch(result) { switch (result) {
case -1: case -1:
new = avl_alloc_node(); new = avl_alloc_node();
new->data = data; new->data = data;
avl_insert_before(tree, closest, new); avl_insert_before(tree, closest, new);
break; break;
case 1: case 1:
new = avl_alloc_node(); new = avl_alloc_node();
new->data = data; new->data = data;
avl_insert_after(tree, closest, new); avl_insert_after(tree, closest, new);
break; break;
default: default:
return NULL; return NULL;
} }
} }
@ -463,26 +452,27 @@ avl_node_t *avl_insert(avl_tree_t *tree, void *data) {
return new; return new;
} }
avl_node_t *avl_insert_node(avl_tree_t *tree, avl_node_t *node) { avl_node_t *avl_insert_node(avl_tree_t *tree, avl_node_t *node)
{
avl_node_t *closest; avl_node_t *closest;
int result; int result;
if(!tree->root) { if(!tree->root)
avl_insert_top(tree, node); avl_insert_top(tree, node);
} else { else {
closest = avl_search_closest_node(tree, node->data, &result); closest = avl_search_closest_node(tree, node->data, &result);
switch(result) { switch (result) {
case -1: case -1:
avl_insert_before(tree, closest, node); avl_insert_before(tree, closest, node);
break; break;
case 1: case 1:
avl_insert_after(tree, closest, node); avl_insert_after(tree, closest, node);
break; break;
case 0: case 0:
return NULL; return NULL;
} }
} }
@ -496,20 +486,20 @@ avl_node_t *avl_insert_node(avl_tree_t *tree, avl_node_t *node) {
return node; return node;
} }
void avl_insert_top(avl_tree_t *tree, avl_node_t *node) { void avl_insert_top(avl_tree_t *tree, avl_node_t *node)
{
node->prev = node->next = node->parent = NULL; node->prev = node->next = node->parent = NULL;
tree->head = tree->tail = tree->root = node; tree->head = tree->tail = tree->root = node;
} }
void avl_insert_before(avl_tree_t *tree, avl_node_t *before, void avl_insert_before(avl_tree_t *tree, avl_node_t *before,
avl_node_t *node) { avl_node_t *node)
{
if(!before) { if(!before) {
if(tree->tail) { if(tree->tail)
avl_insert_after(tree, tree->tail, node); avl_insert_after(tree, tree->tail, node);
} else { else
avl_insert_top(tree, node); avl_insert_top(tree, node);
}
return; return;
} }
@ -522,11 +512,10 @@ void avl_insert_before(avl_tree_t *tree, avl_node_t *before,
return; return;
} }
if(before->prev) { if(before->prev)
before->prev->next = node; before->prev->next = node;
} else { else
tree->head = node; tree->head = node;
}
before->prev = node; before->prev = node;
before->left = node; before->left = node;
@ -534,14 +523,13 @@ void avl_insert_before(avl_tree_t *tree, avl_node_t *before,
avl_rebalance(tree, before); avl_rebalance(tree, before);
} }
void avl_insert_after(avl_tree_t *tree, avl_node_t *after, avl_node_t *node) { void avl_insert_after(avl_tree_t *tree, avl_node_t *after, avl_node_t *node)
{
if(!after) { if(!after) {
if(tree->head) { if(tree->head)
avl_insert_before(tree, tree->head, node); avl_insert_before(tree, tree->head, node);
} else { else
avl_insert_top(tree, node); avl_insert_top(tree, node);
}
return; return;
} }
@ -554,11 +542,10 @@ void avl_insert_after(avl_tree_t *tree, avl_node_t *after, avl_node_t *node) {
node->parent = after; node->parent = after;
node->next = after->next; node->next = after->next;
if(after->next) { if(after->next)
after->next->prev = node; after->next->prev = node;
} else { else
tree->tail = node; tree->tail = node;
}
after->next = node; after->next = node;
after->right = node; after->right = node;
@ -566,51 +553,47 @@ void avl_insert_after(avl_tree_t *tree, avl_node_t *after, avl_node_t *node) {
avl_rebalance(tree, after); avl_rebalance(tree, after);
} }
avl_node_t *avl_unlink(avl_tree_t *tree, void *data) { avl_node_t *avl_unlink(avl_tree_t *tree, void *data)
{
avl_node_t *node; avl_node_t *node;
node = avl_search_node(tree, data); node = avl_search_node(tree, data);
if(node) { if(node)
avl_unlink_node(tree, node); avl_unlink_node(tree, node);
}
return node; return node;
} }
void avl_unlink_node(avl_tree_t *tree, avl_node_t *node) { void avl_unlink_node(avl_tree_t *tree, avl_node_t *node)
{
avl_node_t *parent; avl_node_t *parent;
avl_node_t **superparent; avl_node_t **superparent;
avl_node_t *subst, *left, *right; avl_node_t *subst, *left, *right;
avl_node_t *balnode; avl_node_t *balnode;
if(node->prev) { if(node->prev)
node->prev->next = node->next; node->prev->next = node->next;
} else { else
tree->head = node->next; tree->head = node->next;
} if(node->next)
if(node->next) {
node->next->prev = node->prev; node->next->prev = node->prev;
} else { else
tree->tail = node->prev; tree->tail = node->prev;
}
parent = node->parent; parent = node->parent;
superparent = superparent =
parent ? node == parent ? node ==
parent->left ? &parent->left : &parent->right : &tree->root; parent->left ? &parent->left : &parent->right : &tree->root;
left = node->left; left = node->left;
right = node->right; right = node->right;
if(!left) { if(!left) {
*superparent = right; *superparent = right;
if(right) { if(right)
right->parent = parent; right->parent = parent;
}
balnode = parent; balnode = parent;
} else if(!right) { } else if(!right) {
@ -620,19 +603,14 @@ void avl_unlink_node(avl_tree_t *tree, avl_node_t *node) {
} else { } else {
subst = node->prev; subst = node->prev;
if(!subst) { // This only happens if node is not actually in a tree at all.
abort();
}
if(subst == left) { if(subst == left) {
balnode = subst; balnode = subst;
} else { } else {
balnode = subst->parent; balnode = subst->parent;
balnode->right = subst->left; balnode->right = subst->left;
if(balnode->right) { if(balnode->right)
balnode->right->parent = balnode; balnode->right->parent = balnode;
}
subst->left = left; subst->left = left;
left->parent = subst; left->parent = subst;
@ -656,27 +634,29 @@ void avl_unlink_node(avl_tree_t *tree, avl_node_t *node) {
#endif #endif
} }
void avl_delete_node(avl_tree_t *tree, avl_node_t *node) { void avl_delete_node(avl_tree_t *tree, avl_node_t *node)
{
avl_unlink_node(tree, node); avl_unlink_node(tree, node);
avl_free_node(tree, node); avl_free_node(tree, node);
} }
void avl_delete(avl_tree_t *tree, void *data) { void avl_delete(avl_tree_t *tree, void *data)
{
avl_node_t *node; avl_node_t *node;
node = avl_search_node(tree, data); node = avl_search_node(tree, data);
if(node) { if(node)
avl_delete_node(tree, node); avl_delete_node(tree, node);
}
} }
/* Fast tree cleanup */ /* Fast tree cleanup */
void avl_delete_tree(avl_tree_t *tree) { void avl_delete_tree(avl_tree_t *tree)
{
avl_node_t *node, *next; avl_node_t *node, *next;
for(node = tree->head; node; node = next) { for(node = tree->root; node; node = next) {
next = node->next; next = node->next;
avl_free_node(tree, node); avl_free_node(tree, node);
} }
@ -686,7 +666,8 @@ void avl_delete_tree(avl_tree_t *tree) {
/* Tree walking */ /* Tree walking */
void avl_foreach(const avl_tree_t *tree, avl_action_t action) { void avl_foreach(const avl_tree_t *tree, avl_action_t action)
{
avl_node_t *node, *next; avl_node_t *node, *next;
for(node = tree->head; node; node = next) { for(node = tree->head; node; node = next) {
@ -695,7 +676,8 @@ void avl_foreach(const avl_tree_t *tree, avl_action_t action) {
} }
} }
void avl_foreach_node(const avl_tree_t *tree, avl_action_t action) { void avl_foreach_node(const avl_tree_t *tree, avl_action_t action)
{
avl_node_t *node, *next; avl_node_t *node, *next;
for(node = tree->head; node; node = next) { for(node = tree->head; node; node = next) {
@ -707,11 +689,13 @@ void avl_foreach_node(const avl_tree_t *tree, avl_action_t action) {
/* Indexing */ /* Indexing */
#ifdef AVL_COUNT #ifdef AVL_COUNT
unsigned int avl_count(const avl_tree_t *tree) { unsigned int avl_count(const avl_tree_t *tree)
{
return AVL_NODE_COUNT(tree->root); return AVL_NODE_COUNT(tree->root);
} }
avl_node_t *avl_get_node(const avl_tree_t *tree, unsigned int index) { avl_node_t *avl_get_node(const avl_tree_t *tree, unsigned int index)
{
avl_node_t *node; avl_node_t *node;
unsigned int c; unsigned int c;
@ -733,17 +717,16 @@ avl_node_t *avl_get_node(const avl_tree_t *tree, unsigned int index) {
return NULL; return NULL;
} }
unsigned int avl_index(const avl_node_t *node) { unsigned int avl_index(const avl_node_t *node)
{
avl_node_t *next; avl_node_t *next;
unsigned int index; unsigned int index;
index = AVL_L_COUNT(node); index = AVL_L_COUNT(node);
while((next = node->parent)) { while((next = node->parent)) {
if(node == next->right) { if(node == next->right)
index += AVL_L_COUNT(next) + 1; index += AVL_L_COUNT(next) + 1;
}
node = next; node = next;
} }
@ -751,7 +734,8 @@ unsigned int avl_index(const avl_node_t *node) {
} }
#endif #endif
#ifdef AVL_DEPTH #ifdef AVL_DEPTH
unsigned int avl_depth(const avl_tree_t *tree) { unsigned int avl_depth(const avl_tree_t *tree)
{
return AVL_NODE_DEPTH(tree->root); return AVL_NODE_DEPTH(tree->root);
} }
#endif #endif

145
lib/avl_tree.h Normal file
View file

@ -0,0 +1,145 @@
/*
avl_tree.h -- header file for avl_tree.c
Copyright (C) 1998 Michael H. Buselli
2000-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
2000-2005 Wessel Dankers <wsl@tinc-vpn.org>
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Original AVL tree library by Michael H. Buselli <cosine@cosine.org>.
Modified 2000-11-28 by Wessel Dankers <wsl@tinc-vpn.org> to use counts
instead of depths, to add the ->next and ->prev and to generally obfuscate
the code. Mail me if you found a bug.
Cleaned up and incorporated some of the ideas from the red-black tree
library for inclusion into tinc (http://www.tinc-vpn.org/) by
Guus Sliepen <guus@tinc-vpn.org>.
$Id: avl_tree.h 1439 2005-05-04 18:09:30Z guus $
*/
#ifndef __AVL_TREE_H__
#define __AVL_TREE_H__
#ifndef AVL_DEPTH
#ifndef AVL_COUNT
#define AVL_DEPTH
#endif
#endif
typedef struct avl_node_t {
/* Linked list part */
struct avl_node_t *next;
struct avl_node_t *prev;
/* Tree part */
struct avl_node_t *parent;
struct avl_node_t *left;
struct avl_node_t *right;
#ifdef AVL_COUNT
unsigned int count;
#endif
#ifdef AVL_DEPTH
unsigned char depth;
#endif
/* Payload */
void *data;
} avl_node_t;
typedef int (*avl_compare_t)(const void *, const void *);
typedef void (*avl_action_t)(const void *);
typedef void (*avl_action_node_t)(const avl_node_t *);
typedef struct avl_tree_t {
/* Linked list part */
avl_node_t *head;
avl_node_t *tail;
/* Tree part */
avl_node_t *root;
avl_compare_t compare;
avl_action_t delete;
} avl_tree_t;
/* (De)constructors */
extern avl_tree_t *avl_alloc_tree(avl_compare_t, avl_action_t);
extern void avl_free_tree(avl_tree_t *);
extern avl_node_t *avl_alloc_node(void);
extern void avl_free_node(avl_tree_t *tree, avl_node_t *);
/* Insertion and deletion */
extern avl_node_t *avl_insert(avl_tree_t *, void *);
extern avl_node_t *avl_insert_node(avl_tree_t *, avl_node_t *);
extern void avl_insert_top(avl_tree_t *, avl_node_t *);
extern void avl_insert_before(avl_tree_t *, avl_node_t *, avl_node_t *);
extern void avl_insert_after(avl_tree_t *, avl_node_t *, avl_node_t *);
extern avl_node_t *avl_unlink(avl_tree_t *, void *);
extern void avl_unlink_node(avl_tree_t *tree, avl_node_t *);
extern void avl_delete(avl_tree_t *, void *);
extern void avl_delete_node(avl_tree_t *, avl_node_t *);
/* Fast tree cleanup */
extern void avl_delete_tree(avl_tree_t *);
/* Searching */
extern void *avl_search(const avl_tree_t *, const void *);
extern void *avl_search_closest(const avl_tree_t *, const void *, int *);
extern void *avl_search_closest_smaller(const avl_tree_t *, const void *);
extern void *avl_search_closest_greater(const avl_tree_t *, const void *);
extern avl_node_t *avl_search_node(const avl_tree_t *, const void *);
extern avl_node_t *avl_search_closest_node(const avl_tree_t *, const void *, int *);
extern avl_node_t *avl_search_closest_smaller_node(const avl_tree_t *, const void *);
extern avl_node_t *avl_search_closest_greater_node(const avl_tree_t *, const void *);
/* Tree walking */
extern void avl_foreach(const avl_tree_t *, avl_action_t);
extern void avl_foreach_node(const avl_tree_t *, avl_action_t);
/* Indexing */
#ifdef AVL_COUNT
extern unsigned int avl_count(const avl_tree_t *);
extern avl_node_t *avl_get_node(const avl_tree_t *, unsigned int);
extern unsigned int avl_index(const avl_node_t *);
#endif
#ifdef AVL_DEPTH
extern unsigned int avl_depth(const avl_tree_t *);
#endif
#endif /* __AVL_TREE_H__ */

View file

@ -1,7 +1,7 @@
/* /*
dropin.c -- a set of drop-in replacements for libc functions dropin.c -- a set of drop-in replacements for libc functions
Copyright (C) 2000-2005 Ivo Timmermans, Copyright (C) 2000-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2016 Guus Sliepen <guus@tinc-vpn.org> 2000-2005 Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -13,9 +13,11 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License
with this program; if not, write to the Free Software Foundation, Inc., along with this program; if not, write to the Free Software
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: dropin.c 1439 2005-05-04 18:09:30Z guus $
*/ */
#include "system.h" #include "system.h"
@ -36,7 +38,8 @@
Unless the argument noclose is non-zero, daemon() will redirect Unless the argument noclose is non-zero, daemon() will redirect
standard input, standard output and standard error to /dev/null. standard input, standard output and standard error to /dev/null.
*/ */
int daemon(int nochdir, int noclose) { int daemon(int nochdir, int noclose)
{
#ifdef HAVE_FORK #ifdef HAVE_FORK
pid_t pid; pid_t pid;
int fd; int fd;
@ -50,9 +53,8 @@ int daemon(int nochdir, int noclose) {
} }
/* If we are the parent, terminate */ /* If we are the parent, terminate */
if(pid) { if(pid)
exit(0); exit(0);
}
/* Detach by becoming the new process group leader */ /* Detach by becoming the new process group leader */
if(setsid() < 0) { if(setsid() < 0) {
@ -87,38 +89,63 @@ int daemon(int nochdir, int noclose) {
} }
#endif #endif
#ifndef HAVE_ASPRINTF #ifndef HAVE_GET_CURRENT_DIR_NAME
int asprintf(char **buf, const char *fmt, ...) { /*
int result; Replacement for the GNU get_current_dir_name function:
va_list ap;
va_start(ap, fmt);
result = vasprintf(buf, fmt, ap);
va_end(ap);
return result;
}
int vasprintf(char **buf, const char *fmt, va_list ap) { get_current_dir_name will malloc(3) an array big enough to hold the
current directory name. If the environment variable PWD is set, and
its value is correct, then that value will be returned.
*/
char *get_current_dir_name(void)
{
size_t size;
char *buf;
char *r;
/* Start with 100 bytes. If this turns out to be insufficient to
contain the working directory, double the size. */
size = 100;
buf = xmalloc(size);
errno = 0; /* Success */
r = getcwd(buf, size);
/* getcwd returns NULL and sets errno to ERANGE if the bufferspace
is insufficient to contain the entire working directory. */
while(r == NULL && errno == ERANGE) {
free(buf);
size <<= 1; /* double the size */
buf = xmalloc(size);
r = getcwd(buf, size);
}
return buf;
}
#endif
#ifndef HAVE_ASPRINTF
int asprintf(char **buf, const char *fmt, ...)
{
int status; int status;
va_list aq; va_list ap;
int len; int len;
len = 4096; len = 4096;
*buf = xmalloc(len); *buf = xmalloc(len);
va_copy(aq, ap); va_start(ap, fmt);
status = vsnprintf(*buf, len, fmt, aq); status = vsnprintf(*buf, len, fmt, ap);
buf[len - 1] = 0; va_end(ap);
va_end(aq);
if(status >= 0) { if(status >= 0)
*buf = xrealloc(*buf, status + 1); *buf = xrealloc(*buf, status + 1);
}
if(status > len - 1) { if(status > len - 1) {
len = status; len = status;
va_copy(aq, ap); va_start(ap, fmt);
status = vsnprintf(*buf, len, fmt, aq); status = vsnprintf(*buf, len, fmt, ap);
va_end(aq); va_end(ap);
} }
return status; return status;
@ -133,10 +160,14 @@ int gettimeofday(struct timeval *tv, void *tz) {
} }
#endif #endif
#ifndef HAVE_USLEEP #ifndef HAVE_RANDOM
int usleep(long long usec) { #include <openssl/rand.h>
struct timeval tv = {usec / 1000000, (usec / 1000) % 1000};
select(0, NULL, NULL, NULL, &tv); long int random(void) {
return 0; long int x;
RAND_pseudo_bytes((unsigned char *)&x, sizeof(x));
return x;
} }
#endif #endif

View file

@ -1,10 +1,7 @@
#ifndef TINC_DROPIN_H
#define TINC_DROPIN_H
/* /*
dropin.h -- header file for dropin.c dropin.h -- header file for dropin.c
Copyright (C) 2000-2005 Ivo Timmermans, Copyright (C) 2000-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2011 Guus Sliepen <guus@tinc-vpn.org> 2000-2005 Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -16,16 +13,21 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License
with this program; if not, write to the Free Software Foundation, Inc., along with this program; if not, write to the Free Software
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: dropin.h 1439 2005-05-04 18:09:30Z guus $
*/ */
#ifndef __DROPIN_H__
#define __DROPIN_H__
#include "fake-getaddrinfo.h" #include "fake-getaddrinfo.h"
#include "fake-getnameinfo.h" #include "fake-getnameinfo.h"
#ifndef HAVE_DAEMON #ifndef HAVE_DAEMON
extern int daemon(int nochdir, int noclose); extern int daemon(int, int);
#endif #endif
#ifndef HAVE_GET_CURRENT_DIR_NAME #ifndef HAVE_GET_CURRENT_DIR_NAME
@ -33,16 +35,20 @@ extern char *get_current_dir_name(void);
#endif #endif
#ifndef HAVE_ASPRINTF #ifndef HAVE_ASPRINTF
extern int asprintf(char **buf, const char *fmt, ...); extern int asprintf(char **, const char *, ...);
extern int vasprintf(char **buf, const char *fmt, va_list ap); #endif
#ifndef HAVE_GETNAMEINFO
extern int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
size_t hostlen, char *serv, size_t servlen, int flags);
#endif #endif
#ifndef HAVE_GETTIMEOFDAY #ifndef HAVE_GETTIMEOFDAY
extern int gettimeofday(struct timeval *tv, void *tz); extern int gettimeofday(struct timeval *, void *);
#endif #endif
#ifndef HAVE_USLEEP #ifndef HAVE_RANDOM
extern int usleep(long long usec); extern long int random(void);
#endif #endif
#endif #endif /* __DROPIN_H__ */

View file

@ -1,10 +1,7 @@
#ifndef TINC_ETHERNET_H
#define TINC_ETHERNET_H
/* /*
ethernet.h -- missing Ethernet related definitions ethernet.h -- missing Ethernet related definitions
Copyright (C) 2005 Ivo Timmermans Copyright (C) 2005 Ivo Timmermans <ivo@tinc-vpn.org>
2006 Guus Sliepen <guus@tinc-vpn.org> 2005 Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -16,11 +13,16 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License
with this program; if not, write to the Free Software Foundation, Inc., along with this program; if not, write to the Free Software
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: ethernet.h 1439 2005-05-04 18:09:30Z guus $
*/ */
#ifndef __TINC_ETHERNET_H__
#define __TINC_ETHERNET_H__
#ifndef ETH_ALEN #ifndef ETH_ALEN
#define ETH_ALEN 6 #define ETH_ALEN 6
#endif #endif
@ -41,16 +43,12 @@
#define ETH_P_IPV6 0x86DD #define ETH_P_IPV6 0x86DD
#endif #endif
#ifndef ETH_P_8021Q
#define ETH_P_8021Q 0x8100
#endif
#ifndef HAVE_STRUCT_ETHER_HEADER #ifndef HAVE_STRUCT_ETHER_HEADER
struct ether_header { struct ether_header {
uint8_t ether_dhost[ETH_ALEN]; uint8_t ether_dhost[ETH_ALEN];
uint8_t ether_shost[ETH_ALEN]; uint8_t ether_shost[ETH_ALEN];
uint16_t ether_type; uint16_t ether_type;
} __attribute__((__packed__)); } __attribute__ ((__packed__));
#endif #endif
#ifndef HAVE_STRUCT_ARPHDR #ifndef HAVE_STRUCT_ARPHDR
@ -60,7 +58,7 @@ struct arphdr {
uint8_t ar_hln; uint8_t ar_hln;
uint8_t ar_pln; uint8_t ar_pln;
uint16_t ar_op; uint16_t ar_op;
} __attribute__((__packed__)); } __attribute__ ((__packed__));
#define ARPOP_REQUEST 1 #define ARPOP_REQUEST 1
#define ARPOP_REPLY 2 #define ARPOP_REPLY 2
@ -78,7 +76,7 @@ struct ether_arp {
uint8_t arp_spa[4]; uint8_t arp_spa[4];
uint8_t arp_tha[ETH_ALEN]; uint8_t arp_tha[ETH_ALEN];
uint8_t arp_tpa[4]; uint8_t arp_tpa[4];
} __attribute__((__packed__)); } __attribute__ ((__packed__));
#define arp_hrd ea_hdr.ar_hrd #define arp_hrd ea_hdr.ar_hrd
#define arp_pro ea_hdr.ar_pro #define arp_pro ea_hdr.ar_pro
#define arp_hln ea_hdr.ar_hln #define arp_hln ea_hdr.ar_hln
@ -86,4 +84,4 @@ struct ether_arp {
#define arp_op ea_hdr.ar_op #define arp_op ea_hdr.ar_op
#endif #endif
#endif #endif /* __TINC_ETHERNET_H__ */

15
lib/fake-gai-errnos.h Normal file
View file

@ -0,0 +1,15 @@
/*
* fake library for ssh
*
* This file is included in getaddrinfo.c and getnameinfo.c.
* See getaddrinfo.c and getnameinfo.c.
*/
/* $Id: fake-gai-errnos.h 1374 2004-03-21 14:21:22Z guus $ */
/* for old netdb.h */
#ifndef EAI_NODATA
#define EAI_NODATA 1
#define EAI_MEMORY 2
#define EAI_FAMILY 3
#endif

View file

@ -2,10 +2,10 @@
* fake library for ssh * fake library for ssh
* *
* This file includes getaddrinfo(), freeaddrinfo() and gai_strerror(). * This file includes getaddrinfo(), freeaddrinfo() and gai_strerror().
* These functions are defined in rfc2133. * These funtions are defined in rfc2133.
* *
* But these functions are not implemented correctly. The minimum subset * But these functions are not implemented correctly. The minimum subset
* is implemented for ssh use only. For example, this routine assumes * is implemented for ssh use only. For exapmle, this routine assumes
* that ai_family is AF_INET. Don't use it for another purpose. * that ai_family is AF_INET. Don't use it for another purpose.
*/ */
@ -16,26 +16,25 @@
#include "fake-getaddrinfo.h" #include "fake-getaddrinfo.h"
#include "xalloc.h" #include "xalloc.h"
#if !HAVE_DECL_GAI_STRERROR #ifndef HAVE_GAI_STRERROR
char *gai_strerror(int ecode) { char *gai_strerror(int ecode)
switch(ecode) { {
case EAI_NODATA: switch (ecode) {
return "No address associated with hostname"; case EAI_NODATA:
return "No address associated with hostname";
case EAI_MEMORY: case EAI_MEMORY:
return "Memory allocation failure"; return "Memory allocation failure";
case EAI_FAMILY:
case EAI_FAMILY: return "Address family not supported";
return "Address family not supported"; default:
return "Unknown error";
default:
return "Unknown error";
} }
} }
#endif /* !HAVE_GAI_STRERROR */ #endif /* !HAVE_GAI_STRERROR */
#if !HAVE_DECL_FREEADDRINFO #ifndef HAVE_FREEADDRINFO
void freeaddrinfo(struct addrinfo *ai) { void freeaddrinfo(struct addrinfo *ai)
{
struct addrinfo *next; struct addrinfo *next;
while(ai) { while(ai) {
@ -46,8 +45,9 @@ void freeaddrinfo(struct addrinfo *ai) {
} }
#endif /* !HAVE_FREEADDRINFO */ #endif /* !HAVE_FREEADDRINFO */
#if !HAVE_DECL_GETADDRINFO #ifndef HAVE_GETADDRINFO
static struct addrinfo *malloc_ai(uint16_t port, uint32_t addr) { static struct addrinfo *malloc_ai(uint16_t port, uint32_t addr)
{
struct addrinfo *ai; struct addrinfo *ai;
ai = xmalloc_and_zero(sizeof(struct addrinfo) + sizeof(struct sockaddr_in)); ai = xmalloc_and_zero(sizeof(struct addrinfo) + sizeof(struct sockaddr_in));
@ -62,43 +62,40 @@ static struct addrinfo *malloc_ai(uint16_t port, uint32_t addr) {
return ai; return ai;
} }
int getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *hints, struct addrinfo **res) { int getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *hints, struct addrinfo **res)
{
struct addrinfo *prev = NULL; struct addrinfo *prev = NULL;
struct hostent *hp; struct hostent *hp;
struct in_addr in = {0}; struct in_addr in = {0};
int i; int i;
uint16_t port = 0; uint16_t port = 0;
if(hints && hints->ai_family != AF_INET && hints->ai_family != AF_UNSPEC) { if(hints && hints->ai_family != AF_INET && hints->ai_family != AF_UNSPEC)
return EAI_FAMILY; return EAI_FAMILY;
}
if(servname) { if (servname)
port = htons(atoi(servname)); port = htons(atoi(servname));
}
if(hints && hints->ai_flags & AI_PASSIVE) { if (hints && hints->ai_flags & AI_PASSIVE) {
*res = malloc_ai(port, htonl(0x00000000)); *res = malloc_ai(port, htonl(0x00000000));
return 0; return 0;
} }
if(!hostname) { if (!hostname) {
*res = malloc_ai(port, htonl(0x7f000001)); *res = malloc_ai(port, htonl(0x7f000001));
return 0; return 0;
} }
hp = gethostbyname(hostname); hp = gethostbyname(hostname);
if(!hp || !hp->h_addr_list || !hp->h_addr_list[0]) { if(!hp || !hp->h_addr_list || !hp->h_addr_list[0])
return EAI_NODATA; return EAI_NODATA;
}
for(i = 0; hp->h_addr_list[i]; i++) { for (i = 0; hp->h_addr_list[i]; i++) {
*res = malloc_ai(port, ((struct in_addr *)hp->h_addr_list[i])->s_addr); *res = malloc_ai(port, ((struct in_addr *)hp->h_addr_list[i])->s_addr);
if(prev) { if(prev)
prev->ai_next = *res; prev->ai_next = *res;
}
prev = *res; prev = *res;
} }

49
lib/fake-getaddrinfo.h Normal file
View file

@ -0,0 +1,49 @@
/* $Id: fake-getaddrinfo.h 1374 2004-03-21 14:21:22Z guus $ */
#ifndef _FAKE_GETADDRINFO_H
#define _FAKE_GETADDRINFO_H
#include "fake-gai-errnos.h"
#ifndef AI_PASSIVE
# define AI_PASSIVE 1
# define AI_CANONNAME 2
#endif
#ifndef NI_NUMERICHOST
# define NI_NUMERICHOST 2
# define NI_NAMEREQD 4
# define NI_NUMERICSERV 8
#endif
#ifndef AI_NUMERICHOST
#define AI_NUMERICHOST 4
#endif
#ifndef HAVE_STRUCT_ADDRINFO
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
int ai_family; /* PF_xxx */
int ai_socktype; /* SOCK_xxx */
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
size_t ai_addrlen; /* length of ai_addr */
char *ai_canonname; /* canonical name for hostname */
struct sockaddr *ai_addr; /* binary address */
struct addrinfo *ai_next; /* next structure in linked list */
};
#endif /* !HAVE_STRUCT_ADDRINFO */
#ifndef HAVE_GETADDRINFO
int getaddrinfo(const char *hostname, const char *servname,
const struct addrinfo *hints, struct addrinfo **res);
#endif /* !HAVE_GETADDRINFO */
#ifndef HAVE_GAI_STRERROR
char *gai_strerror(int ecode);
#endif /* !HAVE_GAI_STRERROR */
#ifndef HAVE_FREEADDRINFO
void freeaddrinfo(struct addrinfo *ai);
#endif /* !HAVE_FREEADDRINFO */
#endif /* _FAKE_GETADDRINFO_H */

View file

@ -2,10 +2,10 @@
* fake library for ssh * fake library for ssh
* *
* This file includes getnameinfo(). * This file includes getnameinfo().
* These functions are defined in rfc2133. * These funtions are defined in rfc2133.
* *
* But these functions are not implemented correctly. The minimum subset * But these functions are not implemented correctly. The minimum subset
* is implemented for ssh use only. For example, this routine assumes * is implemented for ssh use only. For exapmle, this routine assumes
* that ai_family is AF_INET. Don't use it for another purpose. * that ai_family is AF_INET. Don't use it for another purpose.
*/ */
@ -14,50 +14,41 @@
#include "fake-getnameinfo.h" #include "fake-getnameinfo.h"
#include "fake-getaddrinfo.h" #include "fake-getaddrinfo.h"
#if !HAVE_DECL_GETNAMEINFO #ifndef HAVE_GETNAMEINFO
int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags) { int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags)
{
struct sockaddr_in *sin = (struct sockaddr_in *)sa; struct sockaddr_in *sin = (struct sockaddr_in *)sa;
struct hostent *hp; struct hostent *hp;
int len; int len;
if(sa->sa_family != AF_INET) { if(sa->sa_family != AF_INET)
return EAI_FAMILY; return EAI_FAMILY;
}
if(serv && servlen) { if(serv && servlen) {
len = snprintf(serv, servlen, "%d", ntohs(sin->sin_port)); len = snprintf(serv, servlen, "%d", ntohs(sin->sin_port));
if(len < 0 || len >= servlen)
if(len < 0 || len >= servlen) {
return EAI_MEMORY; return EAI_MEMORY;
}
} }
if(!host || !hostlen) { if(!host || !hostlen)
return 0; return 0;
}
if(flags & NI_NUMERICHOST) { if(flags & NI_NUMERICHOST) {
len = snprintf(host, hostlen, "%s", inet_ntoa(sin->sin_addr)); len = snprintf(host, hostlen, "%s", inet_ntoa(sin->sin_addr));
if(len < 0 || len >= hostlen)
if(len < 0 || len >= hostlen) {
return EAI_MEMORY; return EAI_MEMORY;
}
return 0; return 0;
} }
hp = gethostbyaddr((char *)&sin->sin_addr, sizeof(struct in_addr), AF_INET); hp = gethostbyaddr((char *)&sin->sin_addr, sizeof(struct in_addr), AF_INET);
if(!hp || !hp->h_name || !hp->h_name[0]) { if(!hp || !hp->h_name || !hp->h_name[0])
return EAI_NODATA; return EAI_NODATA;
}
len = snprintf(host, hostlen, "%s", hp->h_name); len = snprintf(host, hostlen, "%s", hp->h_name);
if(len < 0 || len >= hostlen)
if(len < 0 || len >= hostlen) {
return EAI_MEMORY; return EAI_MEMORY;
}
return 0; return 0;
} }

View file

@ -1,7 +1,9 @@
#ifndef TINC_FAKE_GETNAMEINFO_H /* $Id: fake-getnameinfo.h 1374 2004-03-21 14:21:22Z guus $ */
#define TINC_FAKE_GETNAMEINFO_H
#if !HAVE_DECL_GETNAMEINFO #ifndef _FAKE_GETNAMEINFO_H
#define _FAKE_GETNAMEINFO_H
#ifndef HAVE_GETNAMEINFO
int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
size_t hostlen, char *serv, size_t servlen, int flags); size_t hostlen, char *serv, size_t servlen, int flags);
#endif /* !HAVE_GETNAMEINFO */ #endif /* !HAVE_GETNAMEINFO */
@ -13,4 +15,4 @@ int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
# define NI_MAXHOST 1025 # define NI_MAXHOST 1025
#endif /* !NI_MAXHOST */ #endif /* !NI_MAXHOST */
#endif #endif /* _FAKE_GETNAMEINFO_H */

1044
lib/getopt.c Normal file

File diff suppressed because it is too large Load diff

133
lib/getopt.h Normal file
View file

@ -0,0 +1,133 @@
/* Declarations for getopt.
Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
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 the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
#ifndef _GETOPT_H
#define _GETOPT_H 1
#ifdef __cplusplus
extern "C" {
#endif
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
struct option
{
#if defined (__STDC__) && __STDC__
const char *name;
#else
char *name;
#endif
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct option'. */
#define no_argument 0
#define required_argument 1
#define optional_argument 2
#if defined (__STDC__) && __STDC__
#ifdef __GNU_LIBRARY__
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
extern int getopt ();
#endif /* __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
extern int getopt_long_only (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind);
/* Internal only. Users should not call this directly. */
extern int _getopt_internal (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind,
int long_only);
#else /* not __STDC__ */
extern int getopt ();
extern int getopt_long ();
extern int getopt_long_only ();
extern int _getopt_internal ();
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _GETOPT_H */

View file

@ -14,13 +14,13 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License
with this program; if not, write to the Free Software Foundation, Inc., along with this program; if not, write to the Free Software
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
*/ USA. */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include <config.h>
#endif #endif
#include "getopt.h" #include "getopt.h"
@ -60,19 +60,19 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#ifndef NULL #ifndef NULL
#define NULL 0 #define NULL 0
#endif #endif
int int
getopt_long(argc, argv, options, long_options, opt_index) getopt_long (argc, argv, options, long_options, opt_index)
int argc; int argc;
char *const *argv; char *const *argv;
const char *options; const char *options;
const struct option *long_options; const struct option *long_options;
int *opt_index; int *opt_index;
{ {
return _getopt_internal(argc, argv, options, long_options, opt_index, 0); return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
} }
/* Like getopt_long, but '-' as well as '--' can indicate a long option. /* Like getopt_long, but '-' as well as '--' can indicate a long option.
@ -81,115 +81,109 @@ int *opt_index;
instead. */ instead. */
int int
getopt_long_only(argc, argv, options, long_options, opt_index) getopt_long_only (argc, argv, options, long_options, opt_index)
int argc; int argc;
char *const *argv; char *const *argv;
const char *options; const char *options;
const struct option *long_options; const struct option *long_options;
int *opt_index; int *opt_index;
{ {
return _getopt_internal(argc, argv, options, long_options, opt_index, 1); return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
} }
#endif /* Not ELIDE_CODE. */ #endif /* Not ELIDE_CODE. */
#ifdef TEST #ifdef TEST
#include <stdio.h> #include <stdio.h>
int int
main(argc, argv) main (argc, argv)
int argc; int argc;
char **argv; char **argv;
{ {
int c; int c;
int digit_optind = 0; int digit_optind = 0;
while(1) { while (1)
int this_option_optind = optind ? optind : 1; {
int option_index = 0; int this_option_optind = optind ? optind : 1;
static struct option long_options[] = { int option_index = 0;
{"add", 1, 0, 0}, static struct option long_options[] =
{"append", 0, 0, 0}, {
{"delete", 1, 0, 0}, {"add", 1, 0, 0},
{"verbose", 0, 0, 0}, {"append", 0, 0, 0},
{"create", 0, 0, 0}, {"delete", 1, 0, 0},
{"file", 1, 0, 0}, {"verbose", 0, 0, 0},
{0, 0, 0, 0} {"create", 0, 0, 0},
}; {"file", 1, 0, 0},
{0, 0, 0, 0}
};
c = getopt_long(argc, argv, "abc:d:0123456789", c = getopt_long (argc, argv, "abc:d:0123456789",
long_options, &option_index); long_options, &option_index);
if (c == -1)
break;
if(c == -1) { switch (c)
break; {
} case 0:
printf ("option %s", long_options[option_index].name);
if (optarg)
printf (" with arg %s", optarg);
printf ("\n");
break;
switch(c) { case '0':
case 0: case '1':
printf("option %s", long_options[option_index].name); case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf ("digits occur in two different argv-elements.\n");
digit_optind = this_option_optind;
printf ("option %c\n", c);
break;
if(optarg) { case 'a':
printf(" with arg %s", optarg); printf ("option a\n");
} break;
printf("\n"); case 'b':
break; printf ("option b\n");
break;
case '0': case 'c':
case '1': printf ("option c with value `%s'\n", optarg);
case '2': break;
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if(digit_optind != 0 && digit_optind != this_option_optind) {
printf("digits occur in two different argv-elements.\n");
}
digit_optind = this_option_optind; case 'd':
printf("option %c\n", c); printf ("option d with value `%s'\n", optarg);
break; break;
case 'a': case '?':
printf("option a\n"); break;
break;
case 'b': default:
printf("option b\n"); printf ("?? getopt returned character code 0%o ??\n", c);
break;
case 'c':
printf("option c with value `%s'\n", optarg);
break;
case 'd':
printf("option d with value `%s'\n", optarg);
break;
case '?':
break;
default:
printf("?? getopt returned character code 0%o ??\n", c);
}
} }
}
if(optind < argc) { if (optind < argc)
printf("non-option ARGV-elements: "); {
printf ("non-option ARGV-elements: ");
while (optind < argc)
printf ("%s ", argv[optind++]);
printf ("\n");
}
while(optind < argc) { exit (0);
printf("%s ", argv[optind++]);
}
printf("\n");
}
exit(0);
} }
#endif /* TEST */ #endif /* TEST */

79
lib/gettext.h Normal file
View file

@ -0,0 +1,79 @@
/* Convenience header for conditional use of GNU <libintl.h>.
Copyright (C) 1995-1998, 2000-2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
by the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
#ifndef _LIBGETTEXT_H
#define _LIBGETTEXT_H 1
/* NLS can be disabled through the configure --disable-nls option. */
#if ENABLE_NLS
/* Get declarations of GNU message catalog functions. */
# include <libintl.h>
# include <locale.h>
/* Shorthand notation */
# define _(Text) gettext (Text)
#else
/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
chokes if dcgettext is defined as a macro. So include it now, to make
later inclusions of <locale.h> a NOP. We don't include <libintl.h>
as well because people using "gettext.h" will not include <libintl.h>,
and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
is OK. */
#if defined(__sun)
# include <locale.h>
#endif
/* Disabled NLS.
The casts to 'const char *' serve the purpose of producing warnings
for invalid uses of the value returned from these functions.
On pre-ANSI systems without 'const', the config.h file is supposed to
contain "#define const". */
# define gettext(Msgid) ((const char *) (Msgid))
# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
# define ngettext(Msgid1, Msgid2, N) \
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
# define dngettext(Domainname, Msgid1, Msgid2, N) \
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
# define textdomain(Domainname) ((const char *) (Domainname))
# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
# define _(Text) Text
# define setlocale(Category, Locale) ((const char *) (Locale))
#endif
/* A pseudo function call that serves as a marker for the automated
extraction of messages, but does not call gettext(). The run-time
translation is done at a different place in the code.
The argument, String, should be a literal string. Concatenated strings
and other string expressions won't work.
The macro's expansion is not parenthesized, so that it is suitable as
initializer for static 'char[]' or 'const char[]' variables. */
#define gettext_noop(String) String
#define N_(Text) Text
#endif /* _LIBGETTEXT_H */

View file

@ -1,10 +1,7 @@
#ifndef TINC_IPV4_H
#define TINC_IPV4_H
/* /*
ipv4.h -- missing IPv4 related definitions ipv4.h -- missing IPv4 related definitions
Copyright (C) 2005 Ivo Timmermans Copyright (C) 2005 Ivo Timmermans <ivo@tinc-vpn.org>
2006-2012 Guus Sliepen <guus@tinc-vpn.org> 2005 Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -16,11 +13,16 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License
with this program; if not, write to the Free Software Foundation, Inc., along with this program; if not, write to the Free Software
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: ipv4.h 1439 2005-05-04 18:09:30Z guus $
*/ */
#ifndef __TINC_IPV4_H__
#define __TINC_IPV4_H__
#ifndef AF_INET #ifndef AF_INET
#define AF_INET 2 #define AF_INET 2
#endif #endif
@ -41,22 +43,10 @@
#define ICMP_NET_UNKNOWN 6 #define ICMP_NET_UNKNOWN 6
#endif #endif
#ifndef ICMP_TIME_EXCEEDED
#define ICMP_TIME_EXCEEDED 11
#endif
#ifndef ICMP_EXC_TTL
#define ICMP_EXC_TTL 0
#endif
#ifndef ICMP_NET_UNREACH #ifndef ICMP_NET_UNREACH
#define ICMP_NET_UNREACH 0 #define ICMP_NET_UNREACH 0
#endif #endif
#ifndef ICMP_NET_ANO
#define ICMP_NET_ANO 9
#endif
#ifndef IP_MSS #ifndef IP_MSS
#define IP_MSS 576 #define IP_MSS 576
#endif #endif
@ -64,11 +54,11 @@
#ifndef HAVE_STRUCT_IP #ifndef HAVE_STRUCT_IP
struct ip { struct ip {
#if __BYTE_ORDER == __LITTLE_ENDIAN #if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int ip_hl: 4; unsigned int ip_hl:4;
unsigned int ip_v: 4; unsigned int ip_v:4;
#else #else
unsigned int ip_v: 4; unsigned int ip_v:4;
unsigned int ip_hl: 4; unsigned int ip_hl:4;
#endif #endif
uint8_t ip_tos; uint8_t ip_tos;
uint16_t ip_len; uint16_t ip_len;
@ -81,7 +71,7 @@ struct ip {
uint8_t ip_p; uint8_t ip_p;
uint16_t ip_sum; uint16_t ip_sum;
struct in_addr ip_src, ip_dst; struct in_addr ip_src, ip_dst;
} __attribute__((__packed__)); } __attribute__ ((__packed__));
#endif #endif
#ifndef IP_OFFMASK #ifndef IP_OFFMASK
@ -143,7 +133,7 @@ struct icmp {
#define icmp_radv icmp_dun.id_radv #define icmp_radv icmp_dun.id_radv
#define icmp_mask icmp_dun.id_mask #define icmp_mask icmp_dun.id_mask
#define icmp_data icmp_dun.id_data #define icmp_data icmp_dun.id_data
} __attribute__((__packed__)); } __attribute__ ((__packed__));
#endif #endif
#endif #endif /* __TINC_IPV4_H__ */

View file

@ -1,10 +1,7 @@
#ifndef TINC_IPV6_H
#define TINC_IPV6_H
/* /*
ipv6.h -- missing IPv6 related definitions ipv6.h -- missing IPv6 related definitions
Copyright (C) 2005 Ivo Timmermans Copyright (C) 2005 Ivo Timmermans <ivo@tinc-vpn.org>
2006-2012 Guus Sliepen <guus@tinc-vpn.org> 2005 Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -16,11 +13,16 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License
with this program; if not, write to the Free Software Foundation, Inc., along with this program; if not, write to the Free Software
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: ipv6.h 1439 2005-05-04 18:09:30Z guus $
*/ */
#ifndef __TINC_IPV6_H__
#define __TINC_IPV6_H__
#ifndef AF_INET6 #ifndef AF_INET6
#define AF_INET6 10 #define AF_INET6 10
#endif #endif
@ -36,7 +38,7 @@ struct in6_addr {
uint16_t u6_addr16[8]; uint16_t u6_addr16[8];
uint32_t u6_addr32[4]; uint32_t u6_addr32[4];
} in6_u; } in6_u;
} __attribute__((__packed__)); } __attribute__ ((__packed__));
#define s6_addr in6_u.u6_addr8 #define s6_addr in6_u.u6_addr8
#define s6_addr16 in6_u.u6_addr16 #define s6_addr16 in6_u.u6_addr16
#define s6_addr32 in6_u.u6_addr32 #define s6_addr32 in6_u.u6_addr32
@ -49,14 +51,14 @@ struct sockaddr_in6 {
uint32_t sin6_flowinfo; uint32_t sin6_flowinfo;
struct in6_addr sin6_addr; struct in6_addr sin6_addr;
uint32_t sin6_scope_id; uint32_t sin6_scope_id;
} __attribute__((__packed__)); } __attribute__ ((__packed__));
#endif #endif
#ifndef IN6_IS_ADDR_V4MAPPED #ifndef IN6_IS_ADDR_V4MAPPED
#define IN6_IS_ADDR_V4MAPPED(a) \ #define IN6_IS_ADDR_V4MAPPED(a) \
((((const uint32_t *) (a))[0] == 0) \ ((((__const uint32_t *) (a))[0] == 0) \
&& (((const uint32_t *) (a))[1] == 0) \ && (((__const uint32_t *) (a))[1] == 0) \
&& (((const uint32_t *) (a))[2] == htonl (0xffff))) && (((__const uint32_t *) (a))[2] == htonl (0xffff)))
#endif #endif
#ifndef HAVE_STRUCT_IP6_HDR #ifndef HAVE_STRUCT_IP6_HDR
@ -72,7 +74,7 @@ struct ip6_hdr {
} ip6_ctlun; } ip6_ctlun;
struct in6_addr ip6_src; struct in6_addr ip6_src;
struct in6_addr ip6_dst; struct in6_addr ip6_dst;
} __attribute__((__packed__)); } __attribute__ ((__packed__));
#define ip6_vfc ip6_ctlun.ip6_un2_vfc #define ip6_vfc ip6_ctlun.ip6_un2_vfc
#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
@ -91,14 +93,11 @@ struct icmp6_hdr {
uint16_t icmp6_un_data16[2]; uint16_t icmp6_un_data16[2];
uint8_t icmp6_un_data8[4]; uint8_t icmp6_un_data8[4];
} icmp6_dataun; } icmp6_dataun;
} __attribute__((__packed__)); } __attribute__ ((__packed__));
#define ICMP6_DST_UNREACH_NOROUTE 0 #define ICMP6_DST_UNREACH_NOROUTE 0
#define ICMP6_DST_UNREACH 1 #define ICMP6_DST_UNREACH 1
#define ICMP6_PACKET_TOO_BIG 2 #define ICMP6_PACKET_TOO_BIG 2
#define ICMP6_TIME_EXCEEDED 3
#define ICMP6_DST_UNREACH_ADMIN 1
#define ICMP6_DST_UNREACH_ADDR 3 #define ICMP6_DST_UNREACH_ADDR 3
#define ICMP6_TIME_EXCEED_TRANSIT 0
#define ND_NEIGHBOR_SOLICIT 135 #define ND_NEIGHBOR_SOLICIT 135
#define ND_NEIGHBOR_ADVERT 136 #define ND_NEIGHBOR_ADVERT 136
#define icmp6_data32 icmp6_dataun.icmp6_un_data32 #define icmp6_data32 icmp6_dataun.icmp6_un_data32
@ -111,7 +110,7 @@ struct icmp6_hdr {
struct nd_neighbor_solicit { struct nd_neighbor_solicit {
struct icmp6_hdr nd_ns_hdr; struct icmp6_hdr nd_ns_hdr;
struct in6_addr nd_ns_target; struct in6_addr nd_ns_target;
} __attribute__((__packed__)); } __attribute__ ((__packed__));
#define ND_OPT_SOURCE_LINKADDR 1 #define ND_OPT_SOURCE_LINKADDR 1
#define ND_OPT_TARGET_LINKADDR 2 #define ND_OPT_TARGET_LINKADDR 2
#define nd_ns_type nd_ns_hdr.icmp6_type #define nd_ns_type nd_ns_hdr.icmp6_type
@ -124,7 +123,7 @@ struct nd_neighbor_solicit {
struct nd_opt_hdr { struct nd_opt_hdr {
uint8_t nd_opt_type; uint8_t nd_opt_type;
uint8_t nd_opt_len; uint8_t nd_opt_len;
} __attribute__((__packed__)); } __attribute__ ((__packed__));
#endif #endif
#endif #endif /* __TINC_IPV6_H__ */

View file

@ -1,7 +1,7 @@
/* /*
list.c -- functions to deal with double linked lists list.c -- functions to deal with double linked lists
Copyright (C) 2000-2005 Ivo Timmermans Copyright (C) 2000-2005 Ivo Timmermans <ivo@tinc-vpn.org>
2000-2006 Guus Sliepen <guus@tinc-vpn.org> 2000-2005 Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -13,9 +13,11 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License
with this program; if not, write to the Free Software Foundation, Inc., along with this program; if not, write to the Free Software
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: list.c 1439 2005-05-04 18:09:30Z guus $
*/ */
#include "system.h" #include "system.h"
@ -25,7 +27,8 @@
/* (De)constructors */ /* (De)constructors */
list_t *list_alloc(list_action_t delete) { list_t *list_alloc(list_action_t delete)
{
list_t *list; list_t *list;
list = xmalloc_and_zero(sizeof(list_t)); list = xmalloc_and_zero(sizeof(list_t));
@ -34,25 +37,28 @@ list_t *list_alloc(list_action_t delete) {
return list; return list;
} }
void list_free(list_t *list) { void list_free(list_t *list)
{
free(list); free(list);
} }
list_node_t *list_alloc_node(void) { list_node_t *list_alloc_node(void)
{
return xmalloc_and_zero(sizeof(list_node_t)); return xmalloc_and_zero(sizeof(list_node_t));
} }
void list_free_node(list_t *list, list_node_t *node) { void list_free_node(list_t *list, list_node_t *node)
if(node->data && list->delete) { {
if(node->data && list->delete)
list->delete(node->data); list->delete(node->data);
}
free(node); free(node);
} }
/* Insertion and deletion */ /* Insertion and deletion */
list_node_t *list_insert_head(list_t *list, void *data) { list_node_t *list_insert_head(list_t *list, void *data)
{
list_node_t *node; list_node_t *node;
node = list_alloc_node(); node = list_alloc_node();
@ -62,18 +68,18 @@ list_node_t *list_insert_head(list_t *list, void *data) {
node->next = list->head; node->next = list->head;
list->head = node; list->head = node;
if(node->next) { if(node->next)
node->next->prev = node; node->next->prev = node;
} else { else
list->tail = node; list->tail = node;
}
list->count++; list->count++;
return node; return node;
} }
list_node_t *list_insert_tail(list_t *list, void *data) { list_node_t *list_insert_tail(list_t *list, void *data)
{
list_node_t *node; list_node_t *node;
node = list_alloc_node(); node = list_alloc_node();
@ -83,67 +89,69 @@ list_node_t *list_insert_tail(list_t *list, void *data) {
node->prev = list->tail; node->prev = list->tail;
list->tail = node; list->tail = node;
if(node->prev) { if(node->prev)
node->prev->next = node; node->prev->next = node;
} else { else
list->head = node; list->head = node;
}
list->count++; list->count++;
return node; return node;
} }
void list_unlink_node(list_t *list, list_node_t *node) { void list_unlink_node(list_t *list, list_node_t *node)
if(node->prev) { {
if(node->prev)
node->prev->next = node->next; node->prev->next = node->next;
} else { else
list->head = node->next; list->head = node->next;
}
if(node->next) { if(node->next)
node->next->prev = node->prev; node->next->prev = node->prev;
} else { else
list->tail = node->prev; list->tail = node->prev;
}
list->count--; list->count--;
} }
void list_delete_node(list_t *list, list_node_t *node) { void list_delete_node(list_t *list, list_node_t *node)
{
list_unlink_node(list, node); list_unlink_node(list, node);
list_free_node(list, node); list_free_node(list, node);
} }
void list_delete_head(list_t *list) { void list_delete_head(list_t *list)
{
list_delete_node(list, list->head); list_delete_node(list, list->head);
} }
void list_delete_tail(list_t *list) { void list_delete_tail(list_t *list)
{
list_delete_node(list, list->tail); list_delete_node(list, list->tail);
} }
/* Head/tail lookup */ /* Head/tail lookup */
void *list_get_head(list_t *list) { void *list_get_head(list_t *list)
if(list->head) { {
if(list->head)
return list->head->data; return list->head->data;
} else { else
return NULL; return NULL;
}
} }
void *list_get_tail(list_t *list) { void *list_get_tail(list_t *list)
if(list->tail) { {
if(list->tail)
return list->tail->data; return list->tail->data;
} else { else
return NULL; return NULL;
}
} }
/* Fast list deletion */ /* Fast list deletion */
void list_delete_list(list_t *list) { void list_delete_list(list_t *list)
{
list_node_t *node, *next; list_node_t *node, *next;
for(node = list->head; node; node = next) { for(node = list->head; node; node = next) {
@ -156,7 +164,8 @@ void list_delete_list(list_t *list) {
/* Traversing */ /* Traversing */
void list_foreach_node(list_t *list, list_action_node_t action) { void list_foreach_node(list_t *list, list_action_node_t action)
{
list_node_t *node, *next; list_node_t *node, *next;
for(node = list->head; node; node = next) { for(node = list->head; node; node = next) {
@ -165,14 +174,13 @@ void list_foreach_node(list_t *list, list_action_node_t action) {
} }
} }
void list_foreach(list_t *list, list_action_t action) { void list_foreach(list_t *list, list_action_t action)
{
list_node_t *node, *next; list_node_t *node, *next;
for(node = list->head; node; node = next) { for(node = list->head; node; node = next) {
next = node->next; next = node->next;
if(node->data)
if(node->data) {
action(node->data); action(node->data);
}
} }
} }

View file

@ -1,10 +1,7 @@
#ifndef TINC_LIST_H
#define TINC_LIST_H
/* /*
list.h -- header file for list.c list.h -- header file for list.c
Copyright (C) 2000-2005 Ivo Timmermans Copyright (C) 2000-2005 Ivo Timmermans <ivo@tinc-vpn.org>
2000-2006 Guus Sliepen <guus@tinc-vpn.org> 2000-2005 Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -16,11 +13,16 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License
with this program; if not, write to the Free Software Foundation, Inc., along with this program; if not, write to the Free Software
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: list.h 1439 2005-05-04 18:09:30Z guus $
*/ */
#ifndef __TINC_LIST_H__
#define __TINC_LIST_H__
typedef struct list_node_t { typedef struct list_node_t {
struct list_node_t *prev; struct list_node_t *prev;
struct list_node_t *next; struct list_node_t *next;
@ -45,34 +47,34 @@ typedef struct list_t {
/* (De)constructors */ /* (De)constructors */
extern list_t *list_alloc(list_action_t) __attribute__((__malloc__)); extern list_t *list_alloc(list_action_t) __attribute__ ((__malloc__));
extern void list_free(list_t *list); extern void list_free(list_t *);
extern list_node_t *list_alloc_node(void); extern list_node_t *list_alloc_node(void);
extern void list_free_node(list_t *list, list_node_t *node); extern void list_free_node(list_t *, list_node_t *);
/* Insertion and deletion */ /* Insertion and deletion */
extern list_node_t *list_insert_head(list_t *list, void *data); extern list_node_t *list_insert_head(list_t *, void *);
extern list_node_t *list_insert_tail(list_t *list, void *data); extern list_node_t *list_insert_tail(list_t *, void *);
extern void list_unlink_node(list_t *list, list_node_t *node); extern void list_unlink_node(list_t *, list_node_t *);
extern void list_delete_node(list_t *list, list_node_t *node); extern void list_delete_node(list_t *, list_node_t *);
extern void list_delete_head(list_t *list); extern void list_delete_head(list_t *);
extern void list_delete_tail(list_t *list); extern void list_delete_tail(list_t *);
/* Head/tail lookup */ /* Head/tail lookup */
extern void *list_get_head(list_t *list); extern void *list_get_head(list_t *);
extern void *list_get_tail(list_t *list); extern void *list_get_tail(list_t *);
/* Fast list deletion */ /* Fast list deletion */
extern void list_delete_list(list_t *list); extern void list_delete_list(list_t *);
/* Traversing */ /* Traversing */
extern void list_foreach(list_t *list, list_action_t action); extern void list_foreach(list_t *, list_action_t);
extern void list_foreach_node(list_t *list, list_action_node_t action); extern void list_foreach_node(list_t *, list_action_node_t);
#endif #endif /* __TINC_LIST_H__ */

39
lib/malloc.c Normal file
View file

@ -0,0 +1,39 @@
/* Work around bug on some systems where malloc (0) fails.
Copyright (C) 1997 Free Software Foundation, Inc.
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
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* written by Jim Meyering */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#undef malloc
#include <sys/types.h>
char *malloc ();
/* Allocate an N-byte block of memory from the heap.
If N is zero, allocate a 1-byte block. */
char *
rpl_malloc (n)
size_t n;
{
if (n == 0)
n = 1;
return malloc (n);
}

391
lib/memcmp.c Normal file
View file

@ -0,0 +1,391 @@
/* Copyright (C) 1991, 1993, 1995, 1997, 1998 Free Software Foundation, Inc.
Contributed by Torbjorn Granlund (tege@sics.se).
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
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 the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#undef __ptr_t
#if defined __cplusplus || (defined __STDC__ && __STDC__)
# define __ptr_t void *
#else /* Not C++ or ANSI C. */
# undef const
# define const
# define __ptr_t char *
#endif /* C++ or ANSI C. */
#ifndef __P
# if defined __GNUC__ || (defined __STDC__ && __STDC__)
# define __P(args) args
# else
# define __P(args) ()
# endif /* GCC. */
#endif /* Not __P. */
#if defined HAVE_STRING_H || defined _LIBC
# include <string.h>
#endif
#undef memcmp
#ifdef _LIBC
# include <memcopy.h>
#else /* Not in the GNU C library. */
# include <sys/types.h>
/* Type to use for aligned memory operations.
This should normally be the biggest type supported by a single load
and store. Must be an unsigned type. */
# define op_t unsigned long int
# define OPSIZ (sizeof(op_t))
/* Threshold value for when to enter the unrolled loops. */
# define OP_T_THRES 16
/* Type to use for unaligned operations. */
typedef unsigned char byte;
# ifndef WORDS_BIGENDIAN
# define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2)))
# else
# define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2)))
# endif
#endif /* In the GNU C library. */
#ifdef WORDS_BIGENDIAN
# define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1)
#else
# define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b))
#endif
/* BE VERY CAREFUL IF YOU CHANGE THIS CODE! */
/* The strategy of this memcmp is:
1. Compare bytes until one of the block pointers is aligned.
2. Compare using memcmp_common_alignment or
memcmp_not_common_alignment, regarding the alignment of the other
block after the initial byte operations. The maximum number of
full words (of type op_t) are compared in this way.
3. Compare the few remaining bytes. */
#ifndef WORDS_BIGENDIAN
/* memcmp_bytes -- Compare A and B bytewise in the byte order of the machine.
A and B are known to be different.
This is needed only on little-endian machines. */
static int memcmp_bytes __P((op_t, op_t));
# ifdef __GNUC__
__inline
# endif
static int
memcmp_bytes (a, b)
op_t a, b;
{
long int srcp1 = (long int) &a;
long int srcp2 = (long int) &b;
op_t a0, b0;
do
{
a0 = ((byte *) srcp1)[0];
b0 = ((byte *) srcp2)[0];
srcp1 += 1;
srcp2 += 1;
}
while (a0 == b0);
return a0 - b0;
}
#endif
static int memcmp_common_alignment __P((long, long, size_t));
/* memcmp_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t'
objects (not LEN bytes!). Both SRCP1 and SRCP2 should be aligned for
memory operations on `op_t's. */
#ifdef __GNUC__
__inline
#endif
static int
memcmp_common_alignment (srcp1, srcp2, len)
long int srcp1;
long int srcp2;
size_t len;
{
op_t a0, a1;
op_t b0, b1;
switch (len % 4)
{
default: /* Avoid warning about uninitialized local variables. */
case 2:
a0 = ((op_t *) srcp1)[0];
b0 = ((op_t *) srcp2)[0];
srcp1 -= 2 * OPSIZ;
srcp2 -= 2 * OPSIZ;
len += 2;
goto do1;
case 3:
a1 = ((op_t *) srcp1)[0];
b1 = ((op_t *) srcp2)[0];
srcp1 -= OPSIZ;
srcp2 -= OPSIZ;
len += 1;
goto do2;
case 0:
if (OP_T_THRES <= 3 * OPSIZ && len == 0)
return 0;
a0 = ((op_t *) srcp1)[0];
b0 = ((op_t *) srcp2)[0];
goto do3;
case 1:
a1 = ((op_t *) srcp1)[0];
b1 = ((op_t *) srcp2)[0];
srcp1 += OPSIZ;
srcp2 += OPSIZ;
len -= 1;
if (OP_T_THRES <= 3 * OPSIZ && len == 0)
goto do0;
/* Fall through. */
}
do
{
a0 = ((op_t *) srcp1)[0];
b0 = ((op_t *) srcp2)[0];
if (a1 != b1)
return CMP_LT_OR_GT (a1, b1);
do3:
a1 = ((op_t *) srcp1)[1];
b1 = ((op_t *) srcp2)[1];
if (a0 != b0)
return CMP_LT_OR_GT (a0, b0);
do2:
a0 = ((op_t *) srcp1)[2];
b0 = ((op_t *) srcp2)[2];
if (a1 != b1)
return CMP_LT_OR_GT (a1, b1);
do1:
a1 = ((op_t *) srcp1)[3];
b1 = ((op_t *) srcp2)[3];
if (a0 != b0)
return CMP_LT_OR_GT (a0, b0);
srcp1 += 4 * OPSIZ;
srcp2 += 4 * OPSIZ;
len -= 4;
}
while (len != 0);
/* This is the right position for do0. Please don't move
it into the loop. */
do0:
if (a1 != b1)
return CMP_LT_OR_GT (a1, b1);
return 0;
}
static int memcmp_not_common_alignment __P((long, long, size_t));
/* memcmp_not_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN
`op_t' objects (not LEN bytes!). SRCP2 should be aligned for memory
operations on `op_t', but SRCP1 *should be unaligned*. */
#ifdef __GNUC__
__inline
#endif
static int
memcmp_not_common_alignment (srcp1, srcp2, len)
long int srcp1;
long int srcp2;
size_t len;
{
op_t a0, a1, a2, a3;
op_t b0, b1, b2, b3;
op_t x;
int shl, shr;
/* Calculate how to shift a word read at the memory operation
aligned srcp1 to make it aligned for comparison. */
shl = 8 * (srcp1 % OPSIZ);
shr = 8 * OPSIZ - shl;
/* Make SRCP1 aligned by rounding it down to the beginning of the `op_t'
it points in the middle of. */
srcp1 &= -OPSIZ;
switch (len % 4)
{
default: /* Avoid warning about uninitialized local variables. */
case 2:
a1 = ((op_t *) srcp1)[0];
a2 = ((op_t *) srcp1)[1];
b2 = ((op_t *) srcp2)[0];
srcp1 -= 1 * OPSIZ;
srcp2 -= 2 * OPSIZ;
len += 2;
goto do1;
case 3:
a0 = ((op_t *) srcp1)[0];
a1 = ((op_t *) srcp1)[1];
b1 = ((op_t *) srcp2)[0];
srcp2 -= 1 * OPSIZ;
len += 1;
goto do2;
case 0:
if (OP_T_THRES <= 3 * OPSIZ && len == 0)
return 0;
a3 = ((op_t *) srcp1)[0];
a0 = ((op_t *) srcp1)[1];
b0 = ((op_t *) srcp2)[0];
srcp1 += 1 * OPSIZ;
goto do3;
case 1:
a2 = ((op_t *) srcp1)[0];
a3 = ((op_t *) srcp1)[1];
b3 = ((op_t *) srcp2)[0];
srcp1 += 2 * OPSIZ;
srcp2 += 1 * OPSIZ;
len -= 1;
if (OP_T_THRES <= 3 * OPSIZ && len == 0)
goto do0;
/* Fall through. */
}
do
{
a0 = ((op_t *) srcp1)[0];
b0 = ((op_t *) srcp2)[0];
x = MERGE(a2, shl, a3, shr);
if (x != b3)
return CMP_LT_OR_GT (x, b3);
do3:
a1 = ((op_t *) srcp1)[1];
b1 = ((op_t *) srcp2)[1];
x = MERGE(a3, shl, a0, shr);
if (x != b0)
return CMP_LT_OR_GT (x, b0);
do2:
a2 = ((op_t *) srcp1)[2];
b2 = ((op_t *) srcp2)[2];
x = MERGE(a0, shl, a1, shr);
if (x != b1)
return CMP_LT_OR_GT (x, b1);
do1:
a3 = ((op_t *) srcp1)[3];
b3 = ((op_t *) srcp2)[3];
x = MERGE(a1, shl, a2, shr);
if (x != b2)
return CMP_LT_OR_GT (x, b2);
srcp1 += 4 * OPSIZ;
srcp2 += 4 * OPSIZ;
len -= 4;
}
while (len != 0);
/* This is the right position for do0. Please don't move
it into the loop. */
do0:
x = MERGE(a2, shl, a3, shr);
if (x != b3)
return CMP_LT_OR_GT (x, b3);
return 0;
}
int
rpl_memcmp (s1, s2, len)
const __ptr_t s1;
const __ptr_t s2;
size_t len;
{
op_t a0;
op_t b0;
long int srcp1 = (long int) s1;
long int srcp2 = (long int) s2;
op_t res;
if (len >= OP_T_THRES)
{
/* There are at least some bytes to compare. No need to test
for LEN == 0 in this alignment loop. */
while (srcp2 % OPSIZ != 0)
{
a0 = ((byte *) srcp1)[0];
b0 = ((byte *) srcp2)[0];
srcp1 += 1;
srcp2 += 1;
res = a0 - b0;
if (res != 0)
return res;
len -= 1;
}
/* SRCP2 is now aligned for memory operations on `op_t'.
SRCP1 alignment determines if we can do a simple,
aligned compare or need to shuffle bits. */
if (srcp1 % OPSIZ == 0)
res = memcmp_common_alignment (srcp1, srcp2, len / OPSIZ);
else
res = memcmp_not_common_alignment (srcp1, srcp2, len / OPSIZ);
if (res != 0)
return res;
/* Number of bytes remaining in the interval [0..OPSIZ-1]. */
srcp1 += len & -OPSIZ;
srcp2 += len & -OPSIZ;
len %= OPSIZ;
}
/* There are just a few bytes to compare. Use byte memory operations. */
while (len != 0)
{
a0 = ((byte *) srcp1)[0];
b0 = ((byte *) srcp2)[0];
srcp1 += 1;
srcp2 += 1;
res = a0 - b0;
if (res != 0)
return res;
len -= 1;
}
return 0;
}
#ifdef weak_alias
# undef bcmp
weak_alias (memcmp, bcmp)
#endif

View file

@ -14,21 +14,19 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License
with this program; if not, write to the Free Software Foundation, Inc., along with this program; if not, write to the Free Software
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA
*/ */
/* left unaltered for tinc -- Ivo Timmermans */ /* left unaltered for tinc -- Ivo Timmermans */
/* /*
* Sat Aug 19 13:24:33 MET DST 1995: Martin Schulze * Sat Aug 19 13:24:33 MET DST 1995: Martin Schulze
* First version (v0.2) released * First version (v0.2) released
*/ */
#include "system.h" #include "system.h"
#include "pidfile.h"
#ifndef HAVE_MINGW #ifndef HAVE_MINGW
/* read_pid /* read_pid
* *
@ -36,20 +34,16 @@
* 0 is returned if either there's no pidfile, it's empty * 0 is returned if either there's no pidfile, it's empty
* or no pid can be read. * or no pid can be read.
*/ */
pid_t read_pid(const char *pidfile) { pid_t read_pid (char *pidfile)
FILE *f; {
long pid; FILE *f;
long pid;
if(!(f = fopen(pidfile, "r"))) { if (!(f=fopen(pidfile,"r")))
return 0; return 0;
} fscanf(f,"%ld", &pid);
fclose(f);
if(fscanf(f, "%20ld", &pid) != 1) { return pid;
pid = 0;
}
fclose(f);
return (pid_t)pid;
} }
/* check_pid /* check_pid
@ -58,27 +52,25 @@ pid_t read_pid(const char *pidfile) {
* table (using /proc) to determine if the process already exists. If * table (using /proc) to determine if the process already exists. If
* so the pid is returned, otherwise 0. * so the pid is returned, otherwise 0.
*/ */
pid_t check_pid(const char *pidfile) { pid_t check_pid (char *pidfile)
pid_t pid = read_pid(pidfile); {
pid_t pid = read_pid(pidfile);
/* Amazing ! _I_ am already holding the pid file... */ /* Amazing ! _I_ am already holding the pid file... */
if((!pid) || (pid == getpid())) { if ((!pid) || (pid == getpid ()))
return 0; return 0;
}
/* /*
* The 'standard' method of doing this is to try and do a 'fake' kill * The 'standard' method of doing this is to try and do a 'fake' kill
* of the process. If an ESRCH error is returned the process cannot * of the process. If an ESRCH error is returned the process cannot
* be found -- GW * be found -- GW
*/ */
/* But... errno is usually changed only on error.. */ /* But... errno is usually changed only on error.. */
errno = 0; errno = 0;
if (kill(pid, 0) && errno == ESRCH)
return 0;
if(kill(pid, 0) && errno == ESRCH) { return pid;
return 0;
}
return pid;
} }
/* write_pid /* write_pid
@ -86,49 +78,40 @@ pid_t check_pid(const char *pidfile) {
* Writes the pid to the specified file. If that fails 0 is * Writes the pid to the specified file. If that fails 0 is
* returned, otherwise the pid. * returned, otherwise the pid.
*/ */
pid_t write_pid(const char *pidfile) { pid_t write_pid (char *pidfile)
FILE *f; {
int fd; FILE *f;
pid_t pid; int fd;
pid_t pid;
if((fd = open(pidfile, O_RDWR | O_CREAT, 0644)) == -1) { if ( ((fd = open(pidfile, O_RDWR|O_CREAT, 0644)) == -1)
return 0; || ((f = fdopen(fd, "r+")) == NULL) ) {
} return 0;
}
if((f = fdopen(fd, "r+")) == NULL) {
close(fd);
return 0;
}
#ifdef HAVE_FLOCK #ifdef HAVE_FLOCK
if (flock(fd, LOCK_EX|LOCK_NB) == -1) {
if(flock(fd, LOCK_EX | LOCK_NB) == -1) { fclose(f);
fclose(f); return 0;
return 0; }
}
#endif #endif
pid = getpid(); pid = getpid();
if (!fprintf(f,"%ld\n", (long)pid)) {
if(!fprintf(f, "%ld\n", (long)pid)) { close(fd);
fclose(f); return 0;
return 0; }
} fflush(f);
fflush(f);
#ifdef HAVE_FLOCK #ifdef HAVE_FLOCK
if (flock(fd, LOCK_UN) == -1) {
if(flock(fd, LOCK_UN) == -1) { close(fd);
fclose(f); return 0;
return 0; }
}
#endif #endif
fclose(f); close(fd);
return pid; return pid;
} }
/* remove_pid /* remove_pid
@ -136,7 +119,8 @@ pid_t write_pid(const char *pidfile) {
* Remove the the specified file. The result from unlink(2) * Remove the the specified file. The result from unlink(2)
* is returned * is returned
*/ */
int remove_pid(const char *pidfile) { int remove_pid (char *pidfile)
return unlink(pidfile); {
return unlink (pidfile);
} }
#endif #endif

View file

@ -1,6 +1,3 @@
#ifndef TINC_PIDFILE_H
#define TINC_PIDFILE_H
/* /*
pidfile.h - interact with pidfiles pidfile.h - interact with pidfiles
Copyright (c) 1995 Martin Schulze <Martin.Schulze@Linux.DE> Copyright (c) 1995 Martin Schulze <Martin.Schulze@Linux.DE>
@ -17,9 +14,9 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License
with this program; if not, write to the Free Software Foundation, Inc., along with this program; if not, write to the Free Software
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*/ */
#ifndef HAVE_MINGW #ifndef HAVE_MINGW
@ -29,7 +26,7 @@
* 0 is returned if either there's no pidfile, it's empty * 0 is returned if either there's no pidfile, it's empty
* or no pid can be read. * or no pid can be read.
*/ */
extern pid_t read_pid(const char *pidfile); pid_t read_pid (char *pidfile);
/* check_pid /* check_pid
* *
@ -37,21 +34,19 @@ extern pid_t read_pid(const char *pidfile);
* table (using /proc) to determine if the process already exists. If * table (using /proc) to determine if the process already exists. If
* so 1 is returned, otherwise 0. * so 1 is returned, otherwise 0.
*/ */
extern pid_t check_pid(const char *pidfile); pid_t check_pid (char *pidfile);
/* write_pid /* write_pid
* *
* Writes the pid to the specified file. If that fails 0 is * Writes the pid to the specified file. If that fails 0 is
* returned, otherwise the pid. * returned, otherwise the pid.
*/ */
extern pid_t write_pid(const char *pidfile); pid_t write_pid (char *pidfile);
/* remove_pid /* remove_pid
* *
* Remove the the specified file. The result from unlink(2) * Remove the the specified file. The result from unlink(2)
* is returned * is returned
*/ */
extern int remove_pid(const char *pidfile); int remove_pid (char *pidfile);
#endif
#endif #endif

44
lib/realloc.c Normal file
View file

@ -0,0 +1,44 @@
/* Work around bug on some systems where realloc (NULL, 0) fails.
Copyright (C) 1997 Free Software Foundation, Inc.
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
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* written by Jim Meyering */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#undef realloc
#include <sys/types.h>
char *malloc ();
char *realloc ();
/* Change the size of an allocated block of memory P to N bytes,
with error checking. If N is zero, change it to 1. If P is NULL,
use malloc. */
char *
rpl_realloc (p, n)
char *p;
size_t n;
{
if (n == 0)
n = 1;
if (p == 0)
return malloc (n);
return realloc (p, n);
}

102
lib/utils.c Normal file
View file

@ -0,0 +1,102 @@
/*
utils.c -- gathering of some stupid small functions
Copyright (C) 1999-2005 Ivo Timmermans <zarq@iname.com>
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "system.h"
#include "../src/logger.h"
#include "utils.h"
#ifdef ENABLE_TRACING
volatile int (cp_line[]) = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
volatile char (*cp_file[]) = {"?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?"};
volatile int cp_index = 0;
#endif
char *hexadecimals = "0123456789ABCDEF";
int charhex2bin(char c)
{
if(isdigit(c))
return c - '0';
else
return toupper(c) - 'A' + 10;
}
void hex2bin(char *src, char *dst, int length)
{
int i;
for(i = 0; i < length; i++)
dst[i] = charhex2bin(src[i * 2]) * 16 + charhex2bin(src[i * 2 + 1]);
}
void bin2hex(char *src, char *dst, int length)
{
int i;
for(i = length - 1; i >= 0; i--) {
dst[i * 2 + 1] = hexadecimals[(unsigned char) src[i] & 15];
dst[i * 2] = hexadecimals[(unsigned char) src[i] >> 4];
}
}
#ifdef ENABLE_TRACING
void cp_trace()
{
logger(LOG_DEBUG, "Checkpoint trace: %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d...",
cp_file[(cp_index + 15) % 16], cp_line[(cp_index + 15) % 16],
cp_file[(cp_index + 14) % 16], cp_line[(cp_index + 14) % 16],
cp_file[(cp_index + 13) % 16], cp_line[(cp_index + 13) % 16],
cp_file[(cp_index + 12) % 16], cp_line[(cp_index + 12) % 16],
cp_file[(cp_index + 11) % 16], cp_line[(cp_index + 11) % 16],
cp_file[(cp_index + 10) % 16], cp_line[(cp_index + 10) % 16],
cp_file[(cp_index + 9) % 16], cp_line[(cp_index + 9) % 16],
cp_file[(cp_index + 8) % 16], cp_line[(cp_index + 8) % 16],
cp_file[(cp_index + 7) % 16], cp_line[(cp_index + 7) % 16],
cp_file[(cp_index + 6) % 16], cp_line[(cp_index + 6) % 16],
cp_file[(cp_index + 5) % 16], cp_line[(cp_index + 5) % 16],
cp_file[(cp_index + 4) % 16], cp_line[(cp_index + 4) % 16],
cp_file[(cp_index + 3) % 16], cp_line[(cp_index + 3) % 16],
cp_file[(cp_index + 2) % 16], cp_line[(cp_index + 2) % 16],
cp_file[(cp_index + 1) % 16], cp_line[(cp_index + 1) % 16],
cp_file[cp_index], cp_line[cp_index]
);
}
#endif
#if defined(HAVE_MINGW) || defined(HAVE_CYGWIN)
#ifdef HAVE_CYGWIN
#include <w32api/windows.h>
#endif
char *winerror(int err) {
static char buf[1024], *newline;
if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, sizeof(buf), NULL)) {
strncpy(buf, _("(unable to format errormessage)"), sizeof(buf));
};
if((newline = strchr(buf, '\r')))
*newline = '\0';
return buf;
}
#endif

Some files were not shown because too many files have changed in this diff Show more