Full Code of VrayoSystems/vtrunkd for AI

master fd54cced35e4 cached
173 files
1.1 MB
320.6k tokens
418 symbols
1 requests
Download .txt
Showing preview only (1,145K chars total). Download the full file or copy to clipboard to get everything.
Repository: VrayoSystems/vtrunkd
Branch: master
Commit: fd54cced35e4
Files: 173
Total size: 1.1 MB

Directory structure:
gitextract_sxebwusu/

├── .travis.yml
├── Credits
├── INSTALL
├── LICENSE
├── Makefile.in
├── README.md
├── aclocal.m4
├── auth.c
├── auth.h
├── cfg_file.l
├── cfg_file.y
├── cfg_kwords.h
├── client.c
├── compat.h
├── config.guess
├── config.h.in
├── config.sub
├── configure
├── configure.in
├── const.h
├── debian/
│   ├── changelog
│   ├── compat
│   ├── control
│   ├── copyright
│   ├── docs
│   ├── logrotate
│   ├── postinst
│   ├── postrm
│   ├── prerm
│   ├── rules
│   ├── source/
│   │   └── format
│   └── vtrunkd2.substvars
├── defines.h
├── driver.h
├── frame_llist.c
├── frame_llist.h
├── generic/
│   ├── pipe_dev.c
│   ├── pty_dev.c
│   ├── tap_dev.c
│   ├── tcp_proto.c
│   ├── tun_dev.c
│   └── udp_proto.c
├── install-sh
├── lfd_encrypt.c
├── lfd_lzo.c
├── lfd_shaper.c
├── lfd_zlib.c
├── lib.c
├── lib.h
├── linkfd.c
├── linkfd.h
├── linux/
│   ├── tap_dev.c
│   └── tun_dev.c
├── llist.c
├── llist.h
├── lock.c
├── lock.h
├── log.c
├── log.h
├── main.c
├── net_structs.h
├── netlib.c
├── netlib.h
├── netlink_socket_info.c
├── netlink_socket_info.h
├── packages/
│   ├── openwrt/
│   │   └── Makefile
│   ├── os-jessie/
│   │   ├── Dockerfile
│   │   ├── debian/
│   │   │   ├── changelog
│   │   │   ├── compat
│   │   │   ├── control
│   │   │   ├── copyright
│   │   │   ├── docs
│   │   │   ├── files
│   │   │   ├── init.d.ex
│   │   │   ├── logrotate
│   │   │   ├── postinst.ex
│   │   │   ├── postrm.ex
│   │   │   ├── rules
│   │   │   ├── source/
│   │   │   │   └── format
│   │   │   └── vtrunkd2.substvars
│   │   └── sources.list
│   ├── os-trusty/
│   │   ├── Dockerfile
│   │   └── debian/
│   │       ├── changelog
│   │       ├── compat
│   │       ├── control
│   │       ├── copyright
│   │       ├── docs
│   │       ├── files
│   │       ├── init.d.ex
│   │       ├── logrotate
│   │       ├── postinst.ex
│   │       ├── postrm.ex
│   │       ├── rules
│   │       ├── source/
│   │       │   └── format
│   │       └── vtrunkd2.substvars
│   ├── os-vivid/
│   │   ├── Dockerfile
│   │   ├── debian/
│   │   │   ├── changelog
│   │   │   ├── compat
│   │   │   ├── control
│   │   │   ├── copyright
│   │   │   ├── docs
│   │   │   ├── files
│   │   │   ├── init.d.ex
│   │   │   ├── logrotate
│   │   │   ├── postinst.ex
│   │   │   ├── postrm.ex
│   │   │   ├── rules
│   │   │   ├── source/
│   │   │   │   └── format
│   │   │   └── vtrunkd2.substvars
│   │   └── sources.list
│   ├── os-wheezy/
│   │   ├── Dockerfile
│   │   ├── debian/
│   │   │   ├── changelog
│   │   │   ├── compat
│   │   │   ├── control
│   │   │   ├── copyright
│   │   │   ├── docs
│   │   │   ├── files
│   │   │   ├── init.d.ex
│   │   │   ├── logrotate
│   │   │   ├── postinst.ex
│   │   │   ├── postrm.ex
│   │   │   ├── rules
│   │   │   ├── source/
│   │   │   │   └── format
│   │   │   └── vtrunkd2.substvars
│   │   └── sources.list
│   └── os-wily/
│       ├── Dockerfile
│       ├── debian/
│       │   ├── changelog
│       │   ├── compat
│       │   ├── control
│       │   ├── copyright
│       │   ├── docs
│       │   ├── files
│       │   ├── init.d.ex
│       │   ├── logrotate
│       │   ├── postinst.ex
│       │   ├── postrm.ex
│       │   ├── rules
│       │   ├── source/
│       │   │   └── format
│       │   └── vtrunkd2.substvars
│       └── sources.list
├── packet_code.c
├── packet_code.h
├── pid.c
├── pid.h
├── pre-commit
├── scripts/
│   ├── reroute
│   ├── rmtree.sh
│   ├── vtund-start.conf
│   ├── vtund.rc.debian
│   ├── vtund.rc.red_hat
│   ├── vtund.rc.suse
│   ├── vtund.rc.suse.config
│   └── vtund.xinetd
├── server.c
├── speed_algo.c
├── speed_algo.h
├── svr4/
│   ├── tap_dev.c
│   └── tun_dev.c
├── test/
│   └── lossed.c
├── timer.c
├── timer.h
├── tunnel.c
├── udp_states.c
├── udp_states.h
├── v_struct.h
├── version.h
├── vtrunkd.8
├── vtrunkd.conf
├── vtrunkd.conf.5
├── vtrunkd_client.conf
├── vtun.drivers
├── vtun.h
└── vtun_socks.h

================================================
FILE CONTENTS
================================================

================================================
FILE: .travis.yml
================================================
language: c
addons:
  apt:
    packages:
    - flex
    - bison



================================================
FILE: Credits
================================================
vtrunkd (c) 2015-2016 Vrayo Systems Ltd. team (http://vrayo.com)

Author of vtrunkd core algorithm is Andrew Gryaznov <realgrandrew@gmail.com>
with help of Andrey Kuznetsov <andreykyz@gmail.com>

Author of the original vtun package is Maxim Krasnyansky <max_mk@yahoo.com>.

A lot of thanks to the following people for their suggestions and 
contributions (original vtun):

Gayaneh Krasnyanskaya(Max's Wife) <gayaneh@yahoo.com> 
	Initial Web site creation. And a lot of other help :)))  

Alex Korenkov <alex@uznet.net> 
	Testing, bug reports.

Shukhrat Zakhidov <shukhrat@ishonch.uz>
	Testing, bug reports, suggestions.

Dag Wieers <dag@mind.be>
	Initial RPM packager specification file. 
	RedHat startup script. 
	Several bug reports. 
	SOCKS support suggestions.

Ted Rolle <ted@acacia.datacomm.com> 
	Spelling fixes.

Craig Sanders <cas@taz.net.au> 
	Debian startup script.

Catalin Ciocoiu <catalin@ccp.pub.ro> 
	Reported compilation problems. 

Timur Danyarhojaev <tid@podolsk.ru> 
	Added client source address option.

Andreas Kainz <aka@gams.at>
	RPM package improvements.

Chris Todd <christ@insynq.com>
	Idea of challenge based authentication. 
	Initial BlowFish encryption code. 
	Suggestions.

Garet Krampe <garet@satix.net> 
	A lot of great ideas. Mailing list.
	Web site mirror.

Denis Zapolsky <denis@granch.com.my> 
	Testing. 

Vadim Zaliva <lord@crocodile.org>
	Solaris patches.  Suggestions.

Hurricane Floyd <floyd@hurricanes.org> 
	Max had several vacations.
	Bishop had no power or water, and was able
	   to experience the Third World.
	:)))))))))))))))))))

James B. MacLean <macleajb@Trademart-1.EDnet.NS.CA> 
	Client persist mode fix. Suggestions.

Paul <xerox@httpd.net> 
	Stress tests, bug reports, suggestions.

Maksim Yevenkin <m_evmenkin@yahoo.com>
	TAP driver for FreeBSD.

Anthon Walters <anthon@ws.co.za>
	Web site mirror. Testing. Initial FAQ.

Ryan Defelice <ryand@mobiletel.com> 
	OpenBSD package maintainer. Provided OpenBSD server for 
	development and testing

Alexander Bergolth <leo@strike.wu-wien.ac.at>
	Initial multiple connection handling and host lock functionalities.
	Improvements and fixes of source address option. Incorrect error 
	handling fix. Ideas. Suggestions.

Hubert Feyrer <feyrer@rfhs8012.fh-regensburg.de>
	NetBSD package.

Hiroharu Tamaru <tamaru@ap.t.u-tokyo.ac.jp>
	Updated FreeBSD 4.0 TUN driver support. 

Terry Donaldson <tsd@geo-mis.com>
	Provided Solaris 8.0 server for development and testing.

Daniel Podlejski <underley@underley.eu.org>
	TUN/TAP driver modifications for 2.3.99-pre5 kernel.

Michael Tokarev <mjt@tls.msk.ru>
	File descriptors and memory leaks fix. 
	Tons of other bug fixes and patches. Suggestions. Ideas.

Xavier <xavier@bru-noc.net>
	European web site mirror.

Chris Snell <chris@bikeworld.com>
	Mailing list archives.

Robert Stone <talby@trap.mtview.ca.us>
	Security enhancements. Suggestions. Ideas.
	Encryption and other subsystems rework for 3.X.

Steinar H. Gunderson <sgunderson@bigfoot.com>
	Tons of stability fixes and problem reports. 
	Ideas and suggestions.

Yan Seiner <yan@cardinalengineering.com>
	Testing. Bug reports. Suggestions.

James Yonan <jim@funnybee.ntlp.com>
	Encryption and other fixes. Suggestions.

Greg Olszewski <noop@nwonknu.org>
	Config parser and other fixes. Suggestions.

Kevin P. Fleming <kevin@labsysgrp.com>
	Makefile and config parser enhancement.
	Other minor fixes and suggestions.

Robert R. Wal <rrw@hell.pl>
	Added support for iproute command.

Willems Luc <willems.luc@pandora.be>
	Initial SuSE packaging.  Testing.

Nickolai Zeldovich <nickolai@cs.stanford.edu>
	mlockall() support to prevent VM collapse.

Dale Fountain <dpf-vtun@fountainbay.com>
	Added multiple cipher support.
	Added multiple cipher modes support.
	Added support for different sized keys.
	Re-sync ciphers when using non-ECB modes over a UDP connection.
	Fixed Bug#908824 (persist=keep not re-applying routes)

Alan Grow <agrow-at-thegotonerd.com>
	Added a Listening Address/Interface (rfe936523)
	Cleaned up the code around that portion of the config.


================================================
FILE: INSTALL
================================================
System requirements:

- Linux. Kernel 2.6.25+ recommended
- Additional software:
   bison
   flex
   zlib-dev
   liblzo-dev
   libssl-dev



================================================
FILE: LICENSE
================================================
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     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
state 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 3 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, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    <program>  Copyright (C) <year>  <name of author>
    This program 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, your program's commands
might be different; for a GUI interface, you would use an "about box".

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.

  The GNU 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 Lesser General
Public License instead of this License.  But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.


================================================
FILE: Makefile.in
================================================
#
#   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. 
#
#   Copyright (C) 2011-2016  Vrayo Systems Ltd. team
#
#   Vtrunkd has been derived from VTUN package by Maxim Krasnyansky. 
#   vtun Copyright (C) 1998-2000  Maxim Krasnyansky <max_mk@yahoo.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 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.
#
#   Makefile.in,v 1.6.2.4.2.1 2006/11/16 04:03:44 mtbishop Exp
#  

VERSION=\"$(shell git describe --abbrev=4 --dirty --always)\"
CC = @CC@
CFLAGS = @CFLAGS@ @CPPFLAGS@ -W
LDFLAGS = @LIBS@ -lm

YACC = @YACC@
YACCFLAGS = -d

LEX = @LEX@
LEXFLAGS = -t 

INSTALL = @INSTALL@
INSTALL_OWNER = -o root -g 0

prefix = @prefix@
exec_prefix = @exec_prefix@

SBIN_DIR = @sbindir@
MAN_DIR  = @mandir@
ETC_DIR  = @sysconfdir@
VAR_DIR  = @localstatedir@

PID_FILE = ${VAR_DIR}/run/vtrunkd.pid
CFG_FILE = ${ETC_DIR}/vtrunkd.conf
STAT_DIR = ${VAR_DIR}/log/vtrunkd
LOCK_DIR = ${VAR_DIR}/lock/vtrunkd

DEFS = -DVTUN_CONFIG_FILE=\"$(CFG_FILE)\" -DVTUN_PID_FILE=\"$(PID_FILE)\" \
       -DVTUN_STAT_DIR=\"$(STAT_DIR)\" -DVTUN_LOCK_DIR=\"$(LOCK_DIR)\" \
       -DVERSION_NUMBER=$(VERSION)

OBJS = main.o cfg_file.tab.o cfg_file.lex.o server.o client.o lib.o \
       frame_llist.o llist.o auth.o tunnel.o lock.o netlib.o  \
       tun_dev.o tap_dev.o pty_dev.o pipe_dev.o \
       tcp_proto.o udp_proto.o log.o \
       linkfd.o lfd_shaper.o lfd_zlib.o lfd_lzo.o lfd_encrypt.o speed_algo.o timer.o packet_code.o udp_states.o pid.o

CONFIGURE_FILES = Makefile config.status config.cache config.h config.log 

%.o: %.c vtun.h lib.h log.h
	$(CC) $(CFLAGS) $(DEFS) -c $<

all: vtrunkd 

vtrunkd: $(OBJS)
	$(CC) $(CFLAGS) -o vtrunkd $(OBJS) $(FSSOBJS) $(LFD_OBJS) $(LDFLAGS)

vshm_start_debug: $(OBJS)
	$(CC) $(CFLAGS) -o vshm_debug_enable vshm_start_debug.c $(LDFLAGS)

get_cong_status: $(OBJS)
	$(CC) $(CFLAGS) -o get_cong_status get_cong_status.c $(LDFLAGS)

cfg_file.tab.c: cfg_file.y cfg_kwords.h config.h
	$(YACC) $(YACCFLAGS) -b cfg_file cfg_file.y

cfg_file.lex.c: cfg_file.l cfg_kwords.h config.h
	$(LEX) $(LEXFLAGS) cfg_file.l > cfg_file.lex.c 

depend:
	makedepend -- $(CFLAGS) -- *.c

clean:
	rm -f core cfg_file.tab.* cfg_file.lex.* *.o *~ *.bak vtrunkd vshm_debug_enable get_cong_status

distclean: clean
	rm -f $(CONFIGURE_FILES)
	rm -f `cat vtun.drivers`	

install_man: 
	$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(MAN_DIR)/man8
	$(INSTALL) -m 644 $(INSTALL_OWNER) vtrunkd.8 $(DESTDIR)$(MAN_DIR)/man8
	$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(MAN_DIR)/man5
	$(INSTALL) -m 644 $(INSTALL_OWNER) vtrunkd.conf.5 $(DESTDIR)$(MAN_DIR)/man5
	rm -f $(DESTDIR)$(MAN_DIR)/man8/vtrunkd.8 
	ln -s vtrunkd.8 $(DESTDIR)$(MAN_DIR)/man8/vtrunkd.8 

install_config: 
	$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(ETC_DIR)
	if [ ! -f $(ETC_DIR)/vtrunkd.conf ]; then \
	  $(INSTALL) -m 600 $(INSTALL_OWNER) vtrunkd.conf $(DESTDIR)$(ETC_DIR)/; \
	fi
	#if [ ! -f $(ETC_DIR)/vtrunkd-srv.test.conf ]; then \
	#  $(INSTALL) -m 600 $(INSTALL_OWNER) test/vtrunkd-srv.test.conf $(DESTDIR)$(ETC_DIR)/; \
	#fi
	#if [ ! -f $(ETC_DIR)/vtrunkd-cli.test.conf ]; then \
	#  $(INSTALL) -m 600 $(INSTALL_OWNER) test/vtrunkd-cli.test.conf $(DESTDIR)$(ETC_DIR)/; \
	#fi
install_scripts:
	#if [ ! -f $(prefix)/cli.sh ]; then \
	#  $(INSTALL) -m 755 $(INSTALL_OWNER) test/cli.sh $(DESTDIR)$(prefix)/; \
	#fi
	#if [ ! -f $(prefix)/srv.sh ]; then \
	#  $(INSTALL) -m 755 $(INSTALL_OWNER) test/srv.sh $(DESTDIR)$(prefix)/; \
	#fi


install: vtrunkd install_config install_man install_scripts
	$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(VAR_DIR)/run
	$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(STAT_DIR)
	$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(LOCK_DIR)
	$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(SBIN_DIR)
	$(INSTALL) -m 755 $(INSTALL_OWNER) vtrunkd $(DESTDIR)$(SBIN_DIR)/

# DO NOT DELETE THIS LINE -- make depend depends on it.
remove: remove_config remove_start_bin remove_docs

remove_config:
	rm -f $(DESTDIR)$(ETC_DIR)/vtrunkd*
remove_start_bin:
	rm -f $(DESTDIR)$(prefix)/srv.sh
	rm -f $(DESTDIR)$(prefix)/cli.sh
	rm -f $(DESTDIR)$(prefix)/sbin/vtrunkd
remove_docs:
	rm -f $(DESTDIR)$(MAN_DIR)/man5/vtrunkd.conf.5
	rm -f $(DESTDIR)$(MAN_DIR)/man8/vtrunkd.8 


================================================
FILE: README.md
================================================
[![Build Status](https://travis-ci.org/VrayoSystems/vtrunkd.svg?branch=master)](https://travis-ci.org/VrayoSystems/vtrunkd)

# vtrunkd - universal network link bonding and multichannel VPN.

Copyright (C) 2015-2016 Vrayo Systems team, http://vrayo.com/

Vtrunkd is a Linux VPN daemon used to combine several connection paths 
into one aggregated channel. Features latency, reordering and jitter 
management, behaviour analysis optimizations for encapsulated protocols, 
bufferbloat control, packet redundancy, and multiple cpu cores utilization. 
Up to 30 heterogenous links bonding supported. Used for live streaming, 
LTE/3G/Wi-Fi link bonding. 32/64-bit, x86, MIPS and ARM supported. 
Supports python plug-ins for new algorithms implementation. 


## Compilation and Installation:

In order to compile vtrunkd you need several software packages.
Required packages: 
  - Good C compiler (gcc, egcs, etc)
  - GNU Make (make)
  - GNU libtool (libtool)
  - Lexical Analyzer (flex, lex)
  - YACC (yacc, bison, byacc)
  - Universal TUN/TAP driver 	http://vtun.sourceforge.net/tun
  
On ubuntu, run: 

    $ sudo apt-get install build-essential flex bison
    $ ./configure --prefix=
    $ make
    $ sudo make install

## Support

If you have any suggestions, ideas, wishes send them to 

- Andrew Gryaznov 
   - ag@vrayo.com, 
   - https://www.linkedin.com/in/grandrew
- Commercial support available from Vrayo Systems team. 
   - For more info, please visit http://vrayo.com/support/
  
----

vtrunkd and vtrunkd algorithm (C) Andrew Gryaznov

Based on Vtun (C) 1998-2004 Maxim Krasnyansky

This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit. (http://www.openssl.org/).
Copyright (c) 1998-2004 The OpenSSL Project.  All rights reserved.


================================================
FILE: aclocal.m4
================================================
dnl Test files
AC_DEFUN( AC_TEST_FILES,
[
    ac_file_found=yes
    for f in $1; do
	if test ! -f $2/$f; then
    	   ac_file_found=no
	   break;
	fi
    done

    if test "$ac_file_found" = "yes" ; then
	ifelse([$3], , :,[$3])
    else
	ifelse([$4], , :,[$4])
    fi
])

dnl Search for headers, add path to CPPFLAGS if found 
AC_DEFUN( AC_SEARCH_HEADERS, 
[
    AC_MSG_CHECKING("for $1") 
    ac_hdr_found=no
    for p in $2; do
	if test -n "$p"; then
	  dir="$p"
	else
	  dir="/usr/include"
	fi
	AC_TEST_FILES($1, $dir, 
	    [ 
     	       ac_hdr_found=yes
	       break
	    ]
	)
    done 
    if test "$ac_hdr_found" = "yes" ; then
	if test -n "$p"; then
	  CPPFLAGS="$CPPFLAGS -I$p"
	fi
        AC_MSG_RESULT( [($dir) yes] ) 
	ifelse([$3], , :,[$3])
    else
        AC_MSG_RESULT("no") 
	ifelse([$4], , :,[$4])
    fi
])


dnl Create links to all files($1) in the directory($2)
AC_DEFUN( AC_LINK_DIR, 
[
    for i in $1; do
      if test -f $2/$i -a ! -f $i; then
         AC_MSG_RESULT(linking $2/$i  to  $i)
         ln -f -s $2/$i $i
      fi
    done 
])

dnl Create driver and protocol links
dnl $1 - drivers list, $2 - os dir
AC_DEFUN( AC_LINK_DRV, 
[
    AC_MSG_RESULT( creating driver and protocol links ... )

    if test "$2" != ""; then
       AC_LINK_DIR($1, $2)
    fi
    AC_LINK_DIR($1, generic)
])


================================================
FILE: auth.c
================================================
/*  
   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. 

   Copyright (C) 2011-2016  Vrayo Systems Ltd. team

   Vtrunkd has been derived from VTUN package by Maxim Krasnyansky. 
   vtun Copyright (C) 1998-2000  Maxim Krasnyansky <max_mk@yahoo.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 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.
 */

/*
 * auth.c,v 1.2.2.7.2.3 2006/11/16 04:02:33 mtbishop Exp
 */ 

/*
 * Challenge based authentication. 
 * Thanx to Chris Todd<christ@insynq.com> for the good idea.
 *
 * Jim Yonan, 05/24/2001
 * 	gen_chal rewrite to use better random number generator 
 */ 

#include "config.h"

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <syslog.h>
#include <time.h>

#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif

#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif

#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif

#include "vtun.h"
#include "lib.h"
#include "lock.h"
#include "auth.h"

/* Encryption and Decryption of the challenge key */
#ifdef HAVE_SSL

#include <openssl/md5.h>
#include <openssl/blowfish.h>
#include <openssl/rand.h>

void gen_chal(char *buf)
{
   RAND_bytes(buf, VTUN_CHAL_SIZE);
}

void encrypt_chal(char *chal, char *pwd)
{ 
   register int i;
   BF_KEY key;

   BF_set_key(&key, 16, MD5(pwd,strlen(pwd),NULL));

   for(i=0; i < VTUN_CHAL_SIZE; i += 8 )
      BF_ecb_encrypt(chal + i,  chal + i, &key, BF_ENCRYPT);
}

void decrypt_chal(char *chal, char *pwd)
{ 
   register int i;
   BF_KEY key;

   BF_set_key(&key, 16, MD5(pwd,strlen(pwd),NULL));

   for(i=0; i < VTUN_CHAL_SIZE; i += 8 )
      BF_ecb_encrypt(chal + i,  chal + i, &key, BF_DECRYPT);
}

#else /* HAVE_SSL */

void encrypt_chal(char *chal, char *pwd)
{ 
   char * xor_msk = pwd;
   register int i, xor_len = strlen(xor_msk);

   for(i=0; i < VTUN_CHAL_SIZE; i++)
      chal[i] ^= xor_msk[i%xor_len];
}

void decrypt_chal(char *chal, char *pwd)
{ 
   encrypt_chal(chal, pwd);
}

/* Generate PSEUDO random challenge key. */
void gen_chal(char *buf)
{
   register int i;
 
   srand(time(NULL));

   for(i=0; i < VTUN_CHAL_SIZE; i++)
      buf[i] = (unsigned int)(255.0 * rand()/RAND_MAX);
}
#endif /* HAVE_SSL */

/* 
 * Functions to convert binary flags to character string.
 * string format:  <CS64> 
 * C - compression, S - speed for shaper and so on.
 */ 

char *bf2cf(struct vtun_host *host)
{
     static char str[20], *ptr = str;

     *(ptr++) = '<';

     switch( host->flags & VTUN_PROT_MASK ){
	case VTUN_TCP:
	   *(ptr++) = 'T';
	   break;

	case VTUN_UDP:
	   *(ptr++) = 'U';
	   break;
     }

     switch( host->flags & VTUN_TYPE_MASK ){
	case VTUN_TTY:
	   *(ptr++) = 't'; 	
	   break;

	case VTUN_PIPE:
	   *(ptr++) = 'p';
	   break; 	

	case VTUN_ETHER:
	   *(ptr++) = 'e';
	   break;

	case VTUN_TUN:
	   *(ptr++) = 'u';
	   break;
     } 

     if( (host->flags & VTUN_SHAPE) /* && host->spd_in */)
	ptr += sprintf(ptr,"S%d",host->spd_in);

     if( host->flags & VTUN_ZLIB )
	ptr += sprintf(ptr,"C%d", host->zlevel);

     if( host->flags & VTUN_LZO )
	ptr += sprintf(ptr,"L%d", host->zlevel);

     if( host->flags & VTUN_KEEP_ALIVE )
	*(ptr++) = 'K';

     if( host->flags & VTUN_ENCRYPT )
	ptr += sprintf(ptr,"E%d", host->cipher);

     strcat(ptr,">");

     return str;
}

/* return 1 on success, otherwise 0 */

int cf2bf(char *str, struct vtun_host *host)
{
     char *ptr, *p;
     int s;

     if( (ptr = strchr(str,'<')) ){ 
	ptr++;
	while(*ptr){  
	   switch(*ptr++){
	     case 't':
		host->flags |= VTUN_TTY;
		break;
	     case 'p':
		host->flags |= VTUN_PIPE;
		break;
	     case 'e':
		host->flags |= VTUN_ETHER;
		break;
	     case 'u':
		host->flags |= VTUN_TUN;
		break;
	     case 'U':
		host->flags &= ~VTUN_PROT_MASK;
		host->flags |= VTUN_UDP;
		break;
	     case 'T':
		host->flags &= ~VTUN_PROT_MASK;
		host->flags |= VTUN_TCP;
		break;
	     case 'K':
		host->flags |= VTUN_KEEP_ALIVE;
		break;
	     case 'C':
		if((s = strtol(ptr,&p,10)) == ERANGE || ptr == p) 
		   return 0;
		host->flags |= VTUN_ZLIB;
		host->zlevel = s; 
		ptr = p;
		break;
	     case 'L':
		if((s = strtol(ptr,&p,10)) == ERANGE || ptr == p) 
		   return 0;
		host->flags |= VTUN_LZO;
		host->zlevel = s; 
		ptr = p;
		break;
	     case 'E':
		if((s = strtol(ptr,&p,10)) == ERANGE || ptr == p) 
		   return 0;
		host->flags |= VTUN_ENCRYPT;
		host->cipher = s; 
		ptr = p;
		break;
     	     case 'S':
		if((s = strtol(ptr,&p,10)) == ERANGE || ptr == p) 
		   return 0;
		if( s ){
	    	   host->flags |= VTUN_SHAPE;
		   host->spd_out = s; 
		}
		ptr = p;
		break;
	     case '>':
	        return 1;
	     default:
		return 0;
	   }
	}
     }
     return 0;
}

/* 
 * Functions to convert binary key data to character string.
 * string format:  <char_data> 
 */ 

char *cl2cs(char *chal)
{
     static char str[VTUN_CHAL_SIZE*2+3], *chr="abcdefghijklmnop";
     register char *ptr = str;
     register int i;

     *(ptr++) = '<';
     for(i=0; i<VTUN_CHAL_SIZE; i++){
	*(ptr++) = chr[ ((chal[i] & 0xf0) >> 4) ];  
	*(ptr++) = chr[ (chal[i] & 0x0f) ];
     }  

     *(ptr++) = '>';
     *ptr = '\0';

     return str;
}

int cs2cl(char *str, char *chal)
{
     register char *ptr = str;
     register int i;

     if( !(ptr = strchr(str,'<')) ) 
        return 0;
     ptr++;
     if( !strtok(ptr,">") || strlen(ptr) != VTUN_CHAL_SIZE*2 )
        return 0;

     for(i=0; i<VTUN_CHAL_SIZE && *ptr; i++, ptr+=2) {
	chal[i]  = (*ptr - 'a') << 4;  
	chal[i] |= *(ptr+1) - 'a';
     }

     return 1;
}   

/* Authentication (Server side) */
struct vtun_host * auth_server(int fd, int *reason)
{
        char chal_req[VTUN_CHAL_SIZE], chal_res[VTUN_CHAL_SIZE];	
	char buf[VTUN_MESG_SIZE], *str1, *str2;
        struct vtun_host *h = NULL;
	char *host = NULL;
	int  stage;

        set_title("authentication");

    print_p(fd, "VTRUNKD server ver %s\n", VERSION);

	stage = ST_HOST;
    *reason = D_NOREAD;
	while( readn_t(fd, buf, VTUN_MESG_SIZE, vtun.timeout) > 0 ){
        *reason = D_OTHER;
	   buf[sizeof(buf)-1]='\0';
	   strtok(buf,"\r\n");

	   if( !(str1=strtok(buf," :")) ) {
            *reason = D_NOSHAKE1;
	        break;
          }
	   if( !(str2=strtok(NULL," :")) ) {
            *reason = D_NOSHAKE2;
	        break;
          }

	   switch( stage ){
	     case ST_HOST:
	        if( !strcmp(str1,"HOST") ){
		   host = strdup(str2);

		   gen_chal(chal_req);
		   print_p(fd,"OK CHAL: %s\n", cl2cs(chal_req));

		   stage = ST_CHAL;
		   continue;
	        }
        *reason = D_ST_CHAL;
		break;
	     case ST_CHAL:
	        if( !strcmp(str1,"CHAL") ){
		   if( !cs2cl(str2,chal_res) ) {
                *reason = D_CHAL;
		        break; 
              }
		   
		   if( !(h = find_host(host)) ) {
                *reason = D_NOHOST;
	    	      break;
              }

		   decrypt_chal(chal_res, h->passwd);   		
	
		   if( !memcmp(chal_req, chal_res, VTUN_CHAL_SIZE) ){
		      /* Auth successeful. */

		      /* Lock host */	
		      if( lock_host(h) < 0 ){
		         /* Multiple connections are denied */
		         h = NULL;
                 *reason = D_NOMULT;
		         break;
		      }	
		      print_p(fd,"OK FLAGS: %s\n", bf2cf(h)); 
 		   } else
		      h = NULL;
	        }
		break;
 	   }
	   break;
	}

	if( host )
	   free(host);

	if( !h )
	   print_p(fd,"ERR\n");	

	return h;
}

/* Authentication (Client side) */
int auth_client(int fd, struct vtun_host *host, int * reason)
{
	char buf[VTUN_MESG_SIZE], chal[VTUN_CHAL_SIZE];
	int stage, success=0 ;
	
	stage = ST_INIT;
    *reason = D_NOREAD;
	while( readn_t(fd, buf, VTUN_MESG_SIZE, vtun.timeout) > 0 ){
        *reason = D_OTHER;
	   buf[sizeof(buf)-1]='\0';
	   switch( stage ){
		case ST_INIT:
            if (!strncmp(buf, "VTRUNKD", 7)) {
		      stage = ST_HOST;
		      print_p(fd,"HOST: %s\n",host->host);
		      continue;
	           }
               *reason = D_GREET;
		   break;	

	        case ST_HOST:
		   if( !strncmp(buf,"OK",2) && cs2cl(buf,chal)){
		      stage = ST_CHAL;
					
		      encrypt_chal(chal,host->passwd);
		      print_p(fd,"CHAL: %s\n", cl2cs(chal));

		      continue;
	   	   }
           *reason = D_CHAL;
		   break;	
	
	        case ST_CHAL:
		   if( !strncmp(buf,"OK",2) && cf2bf(buf,host) )
		      success = 1;
           else *reason = D_PWD;
		   break;
	   }
	   break;
	}

	return success;
}


================================================
FILE: auth.h
================================================
/*  
   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. 

   Copyright (C) 2011-2016  Vrayo Systems Ltd. team

   Vtrunkd has been derived from VTUN package by Maxim Krasnyansky. 
   vtun Copyright (C) 1998-2000  Maxim Krasnyansky <max_mk@yahoo.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 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.
 */

/*
 * auth.h,v 1.1.1.2.6.1 2006/11/16 04:02:36 mtbishop Exp
 */ 

#define VTUN_CHAL_SIZE	 16	

#define ST_INIT  0
#define ST_HOST  1
#define ST_CHAL  2

struct vtun_host * auth_server(int fd, int * reason);
int auth_client(int fd, struct vtun_host *host, int * reason);



================================================
FILE: cfg_file.l
================================================
%{
/*  
   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. 

   Copyright (C) 2011-2016  Vrayo Systems Ltd. team

   Vtrunkd has been derived from VTUN package by Maxim Krasnyansky. 
   vtun Copyright (C) 1998-2000  Maxim Krasnyansky <max_mk@yahoo.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 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.
 */

/*
 * cfg_file.l,v 1.1.1.2.2.1.2.2 2006/11/16 04:02:39 mtbishop Exp
 */ 

#include "config.h"

#include <string.h>

#include "vtun.h"

#include "cfg_file.tab.h"
#include "cfg_kwords.h"

/* static buffer for strings */
char str_buf[255];

int find_keyword(struct kword *kw, char *str);

#define ECHO {;}
#define YY_DECL int yylex(void)

/* Push and pop parser state */
static int stack[16];
static int ptr = 0;

#define PUSH_STATE()							  \
	 do {						  		  \
	   if( ptr == 16 ){						  \
	      yyerror("To many pushes to parser's state stack"); 	  \
	      return K_ERROR; 						  \
	   }								  \
	   stack[ptr++] = YY_START;					  \
         } while(0)

#define POP_STATE()	 						  \
	 do {						  		  \
	   if( !ptr ){							  \
	      yyerror("To many pops from parser's state stack"); 	  \
	      return K_ERROR; 						  \
	   }								  \
	   BEGIN(stack[--ptr]);						  \
         } while(0)

int cfg_error(const char *ftm, ...);

int yyerror(char *str);
%}

num		[0-9]+
dnum		{num}:{num}
word		[A-Za-z0-9\-\_+=\!\$\#\%\&\*\^\@@\\\~\.]+
wordnm		{word}:{num}
kword		[A-Za-z0-9\_\-]+	
comment		\#.*\n
fname		[A-Za-z0-9\_\.\-]+	
path		(\/{fname})+
string		\".*\"

%x OPTION PARAM  

%%
<*>[ \t]	;   /* Skip spaces and tabs (All stages) */

<*>\n		{ lineno++; } /* (All stages) */

<INITIAL,OPTION>{comment}	{ lineno++; } /* Skip comments */

{kword}		{
		  int kw = find_keyword(cfg_keyword,yytext);
		  if( kw != -1 )	
		     return kw;

		  /* Keyword not found, means host definition. */
		  yylval.str = yytext;
		  return K_HOST;
		}

{word}		{
		  yylval.str = yytext;
		  return K_ERROR;
		}

<*>\{		{ 
		  PUSH_STATE();
		  BEGIN(OPTION); 
		  return *yytext;
		}		
<*>\}		{
		  POP_STATE();
		  return *yytext;
		}

<OPTION>{word}	{
		  int kw = find_keyword(cfg_keyword,yytext);
		  if( kw != -1 ){	
		     /* Option found, switch to PARAM stage */
		     PUSH_STATE();
		     BEGIN(PARAM);
		     return kw;
		  }
		  yylval.str = yytext;
		  return K_ERROR;
		}

<PARAM>{string}	{
		  if(yyleng > sizeof(str_buf)-1){
		     yyerror("string to long");
		     return 0;
		  }
		  strncpy(str_buf, yytext+1, yyleng-2);
		  str_buf[yyleng-2] = '\0';

		  yylval.str = str_buf;
					  
		  return STRING;
		}

<PARAM>{dnum}   {
	          char *ptr = strchr(yytext,':') + 1;
		 
		  yylval.dnum.num1 = atoi(yytext);
		  yylval.dnum.num2 = atoi(ptr);
		  return DNUM;
		}

<PARAM>{num}	{
		  yylval.num = atoi(yytext);
		  return NUM;
		}

<PARAM>{word}	{
		  int kw = find_keyword(cfg_param,yytext);
		  if( kw != -1 ){	
		     /* Special parameter found (yes,no,etc) */
		     yylval.num = kw;
		     return NUM;
		  }
		  yylval.str = yytext;
		  return WORD;
		}

<PARAM>{wordnm} {
	          char *ptr = strchr(yytext,':'); *ptr='\0'; 
		  yylval.dnum.num1 = find_keyword(cfg_param,yytext);
		  yylval.dnum.num2 = atoi(++ptr);
		  return DNUM;
		}

<PARAM>{path}	{
		  yylval.str = yytext;
		  return PATH;
		}

<PARAM>\;	{ 
		  POP_STATE();
		}

<*>.		{ /* Garbage (All stages) */
		  cfg_error("Invalid character \'%s\'", yytext); 
		}
%%

int yywrap(void) 
{
    return 1;
}

int find_keyword(struct kword *kw, char *str)
{
    while( kw->str ){
	if( !strncmp(str,kw->str,20) )
	   return kw->type;
	kw++;
    }
    return -1;
}


================================================
FILE: cfg_file.y
================================================
%{
/*  
   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. 

   Copyright (C) 2011-2016  Vrayo Systems Ltd. team

   Vtrunkd has been derived from VTUN package by Maxim Krasnyansky. 
   vtun Copyright (C) 1998-2000  Maxim Krasnyansky <max_mk@yahoo.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 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.
 */

/*
 * cfg_file.y,v 1.1.1.2.2.13.2.4 2006/11/16 04:02:42 mtbishop Exp
 */ 

#include "config.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>

#include <syslog.h>

#include "compat.h"
#include "vtun.h"
#include "lib.h"
#include "log.h"

int lineno = 1;

struct vtun_host *parse_host;
extern struct vtun_host default_host;

llist  *parse_cmds;
struct vtun_cmd parse_cmd;

llist host_list;

int  cfg_error(const char *fmt, ...);
int  add_cmd(llist *cmds, char *prog, char *args, int flags);
void *cp_cmd(void *d, void *u);
int  free_cmd(void *d, void *u);

void copy_addr(struct vtun_host *to, struct vtun_host *from);
int  free_host(void *d, void *u);
void free_addr(struct vtun_host *h);
void free_host_list(void);

int  parse_syslog(char *facility);

int yyparse(void);
int yylex(void);	
int yyerror(char *s); 

#define YYERROR_VERBOSE 1

%}

%union {
   char *str;
   int  num;
   struct { int num1; int num2; } dnum;
}
%expect 20

%token K_OPTIONS K_DEFAULT K_PORT K_BINDADDR K_PERSIST K_TIMEOUT
%token K_PASSWD K_PROG K_PPP K_SPEED K_IFCFG K_FWALL K_ROUTE K_DEVICE 
%token K_MULTI K_SRCADDR K_IFACE K_ADDR
%token K_TYPE K_PROT K_COMPRESS K_ENCRYPT K_KALIVE K_STAT
%token K_UP K_DOWN K_SYSLOG K_IPROUTE
%token K_TICK_SECS K_RXMIT_CNT_DROP_PERIOD K_MAX_WEIGHT_NORM K_WEIGHT_SCALE K_WEIGHT_SMOOTH_DIV K_WEIGHT_START_STICKINESS K_WEIGHT_SAW_STEP_UP_DIV K_WEIGHT_SAW_STEP_UP_MIN_STEP K_WEIGHT_SAW_STEP_DN_DIV K_PEN_USEC_IMMUNE
K_WEIGHT_MSEC_DELAY K_MAX_WINDOW K_MAX_LATENCY K_MAX_LATENCY_DROP K_MAX_ALLOWED_BUF_LEN K_MAX_REORDER K_MAX_IDLE_TIMEOUT K_FRAME_COUNT_SEND_LWS K_PING_INTERVAL K_TUN_TXQUEUE_LEN K_MAX_TUNNELS_NUM K_TCP_CONN_AMOUNT K_START_WEIGHT K_RT_MARK
%token <str> K_HOST K_ERROR
%token <str> WORD PATH STRING
%token <num> NUM 
%token <dnum> DNUM

%%
config: 
  | config statement 
  ;

statement: '\n'
  | K_OPTIONS   '{' options '}' 

  | K_DEFAULT   { 
		  parse_host = &default_host; 
                }        
    '{' host_options '}' 

  | K_HOST      { 
		  if( !(parse_host = malloc(sizeof(struct vtun_host))) ){
		     yyerror("No memory for the host");
		     YYABORT;
		  }

		  /* Fill new host struct with default values.
		   * MUST dup strings to be able to reread config.
		   */
	  	  memcpy(parse_host, &default_host, sizeof(struct vtun_host));
		  parse_host->host = strdup($1);
		  parse_host->passwd = NULL;

		  /* Copy local address */
		  copy_addr(parse_host, &default_host);

		  llist_copy(&default_host.up,&parse_host->up,cp_cmd,NULL);
		  llist_copy(&default_host.down,&parse_host->down,cp_cmd,NULL);

		}    
    '{' host_options '}'
		{
		  /* Check if session definition is complete */ 
		  if (!parse_host->passwd) {
		  	cfg_error("Ignored incomplete session definition '%s'", parse_host->host);
			free_host(parse_host, NULL);			
			free(parse_host);
		  } else {
		  	/* Add host to the list */
		  	llist_add(&host_list, (void *)parse_host);
		  }
		}

  | K_ERROR	{
		  cfg_error("Invalid clause '%s'",$1);
		  YYABORT;
		}
  ;

options:
    option
  | options option
  ;

/* Don't override command line options */
option:  '\n'
  | K_PORT NUM 		{ 
			  if(vtun.bind_addr.port == -1)
			     vtun.bind_addr.port = $2;
			} 

  | K_BINDADDR '{' bindaddr_option '}'

  | K_IFACE STRING	{ 
			  if(vtun.svr_addr == -1)
			    vtun.svr_addr = strdup($2);
			} 

  | K_TYPE NUM 		{ 
			  if(vtun.svr_type == -1)
			     vtun.svr_type = $2;
			} 

  | K_TIMEOUT NUM 	{  
			  if(vtun.timeout == -1)
			     vtun.timeout = $2; 	
			}

  | K_PPP   PATH	{
			  free(vtun.ppp);
			  vtun.ppp = strdup($2);
			}

  | K_IFCFG PATH	{
			  free(vtun.ifcfg);
			  vtun.ifcfg = strdup($2);
			}

  | K_ROUTE PATH 	{   
			  free(vtun.route);  
			  vtun.route = strdup($2); 	
			}		

  | K_FWALL PATH 	{   
			  free(vtun.fwall);  
			  vtun.fwall = strdup($2); 	
			}

  | K_IPROUTE PATH 	{   
			  free(vtun.iproute);  
			  vtun.iproute = strdup($2); 	
			}

  | K_SYSLOG  syslog_opt

  | K_ERROR		{
			  cfg_error("Unknown option '%s'",$1);
			  YYABORT;
			}

 | K_MAX_TUNNELS_NUM NUM 	{  
			  if(vtun.MAX_TUNNELS_NUM == -1)
			     vtun.MAX_TUNNELS_NUM = $2; 	
			}




 ;

bindaddr_option: 
  K_ADDR WORD		{
			  vtun.bind_addr.name = strdup($2);
			  vtun.bind_addr.type = VTUN_ADDR_NAME;
			}

  | K_IFACE WORD	{
			  vtun.bind_addr.name = strdup($2);
			  vtun.bind_addr.type = VTUN_ADDR_IFACE;
			}

  | K_IFACE STRING	{
			  vtun.bind_addr.name = strdup($2);
			  vtun.bind_addr.type = VTUN_ADDR_IFACE;
			}

  | K_ERROR		{
			  cfg_error("Unknown option '%s'",$1);
			  YYABORT;
			}
  ;

syslog_opt:
  NUM 			{
                          vtun.syslog = $1;
  			}

  | WORD 	        {
                          if (parse_syslog($1)) {
                            cfg_error("Unknown syslog facility '%s'", $1);
                            YYABORT;
                          }
                        }

  | K_ERROR 		{
   			  cfg_error("Unknown syslog option '%s'",$1);
  			  YYABORT;
			}
  ;

host_options:
    host_option
  | host_options host_option
  ;

/* Host options. Must free strings first, because they 
 * could be strduped from default_host */
host_option: '\n'
  | K_PASSWD WORD 	{
			  free(parse_host->passwd);
			  parse_host->passwd = strdup($2);
			}

  | K_DEVICE WORD 	{
			  free(parse_host->dev);
			  parse_host->dev = strdup($2);
			}	

  | K_MULTI NUM		{ 
			  parse_host->multi = $2;
			}

  | K_TIMEOUT NUM	{ 
			  parse_host->timeout = $2;
			}
  | K_TICK_SECS NUM 	{  
			     parse_host->TICK_SECS = $2; 	
			}
  | K_RXMIT_CNT_DROP_PERIOD NUM 	{  
			     parse_host->RXMIT_CNT_DROP_PERIOD = $2; 	
			}
  | K_MAX_WEIGHT_NORM NUM 	{  
			     parse_host->MAX_WEIGHT_NORM = $2; 	
			}
  | K_WEIGHT_SCALE NUM 	{  
			     parse_host->WEIGHT_SCALE = $2; 	
			}
  | K_WEIGHT_SMOOTH_DIV NUM 	{  
			     parse_host->WEIGHT_SMOOTH_DIV = $2; 	
			}


 | K_WEIGHT_START_STICKINESS NUM 	{  
			     parse_host->WEIGHT_START_STICKINESS = $2; 	
			}


 | K_WEIGHT_SAW_STEP_UP_DIV NUM 	{  
			     parse_host->WEIGHT_SAW_STEP_UP_DIV = $2; 	
			}

 | K_WEIGHT_SAW_STEP_UP_MIN_STEP NUM 	{  
			     parse_host->WEIGHT_SAW_STEP_UP_MIN_STEP = $2; 	
			}

 | K_WEIGHT_SAW_STEP_DN_DIV NUM 	{  
			     parse_host->WEIGHT_SAW_STEP_DN_DIV = $2; 	
			}


 | K_WEIGHT_MSEC_DELAY NUM 	{  
			     parse_host->WEIGHT_MSEC_DELAY = $2; 	
			}


 | K_MAX_WINDOW NUM 	{  
			     parse_host->MAX_WINDOW = $2; 	
			}
			
 | K_PEN_USEC_IMMUNE NUM 	{  
			    
			}

 | K_MAX_LATENCY NUM 	{  
			     parse_host->MAX_LATENCY = $2; 	
			}


 | K_MAX_LATENCY_DROP NUM 	{  
			     parse_host->MAX_LATENCY_DROP = $2; 	
			}


 | K_MAX_ALLOWED_BUF_LEN NUM 	{  
			     parse_host->MAX_ALLOWED_BUF_LEN = $2; 	
			}


 | K_MAX_REORDER NUM 	{  
			     parse_host->MAX_REORDER = $2; 	
			}


 | K_MAX_IDLE_TIMEOUT NUM 	{  
			     parse_host->MAX_IDLE_TIMEOUT = $2; 	
			}


 | K_FRAME_COUNT_SEND_LWS NUM 	{  
			     parse_host->FRAME_COUNT_SEND_LWS = $2; 	
			}


 | K_PING_INTERVAL NUM 	{  
			     parse_host->PING_INTERVAL = $2; 	
			}


 | K_TUN_TXQUEUE_LEN NUM 	{  
			     parse_host->TUN_TXQUEUE_LEN = $2; 	
			}


 | K_TCP_CONN_AMOUNT NUM	{  
			     parse_host->TCP_CONN_AMOUNT = $2; 	
			}

 | K_START_WEIGHT NUM	{  
			     parse_host->START_WEIGHT = $2; 	
			}

 | K_RT_MARK NUM	{  
			     parse_host->RT_MARK = $2; 	
			}






  | K_SPEED NUM 	{ 
			  if( $2 ){ 
			     parse_host->spd_in = parse_host->spd_out = $2;
			     parse_host->flags |= VTUN_SHAPE;
			  } else 
			     parse_host->flags &= ~VTUN_SHAPE;
			}

  | K_SPEED DNUM 	{ 
			  if( yylval.dnum.num1 || yylval.dnum.num2 ){ 
			     parse_host->spd_out = yylval.dnum.num1;
		             parse_host->spd_in = yylval.dnum.num2; 	
			     parse_host->flags |= VTUN_SHAPE;
			  } else 
			     parse_host->flags &= ~VTUN_SHAPE;
			}

  | K_COMPRESS 		{
			  parse_host->flags &= ~(VTUN_ZLIB | VTUN_LZO); 
			}
			compress

  | K_ENCRYPT NUM 	{  
			  if( $2 ){
			     parse_host->flags |= VTUN_ENCRYPT;
			     parse_host->cipher = $2;
			  } else
			     parse_host->flags &= ~VTUN_ENCRYPT;
			}

  | K_KALIVE 		{
			  parse_host->flags &= ~VTUN_KEEP_ALIVE; 
			}
			keepalive	

  | K_STAT NUM		{
			  if( $2 )
			     parse_host->flags |= VTUN_STAT;
			  else
			     parse_host->flags &= ~VTUN_STAT;
			}

  | K_PERSIST NUM 	{ 
	      		  parse_host->persist = $2;

			  if(vtun.persist == -1) 
			     vtun.persist = $2; 	
			}

  | K_TYPE NUM 		{  
			  parse_host->flags &= ~VTUN_TYPE_MASK;
			  parse_host->flags |= $2;
			}	

  | K_PROT NUM 		{  
			  parse_host->flags &= ~VTUN_PROT_MASK;
			  parse_host->flags |= $2;
			}

  | K_SRCADDR 		'{' srcaddr_options '}'

  | K_UP 	        { 
			  parse_cmds = &parse_host->up; 
   			  llist_free(parse_cmds, free_cmd, NULL);   
			} '{' command_options '}' 

  | K_DOWN 	        { 
			  parse_cmds = &parse_host->down; 
   			  llist_free(parse_cmds, free_cmd, NULL);   
			} '{' command_options '}' 

  | K_ERROR		{
			  cfg_error("Unknown option '%s'",$1);
			  YYABORT;
			} 
  ;

compress:  
  NUM	 		{ 
			  if( $1 ){  
      			     parse_host->flags |= VTUN_ZLIB; 
			     parse_host->zlevel = $1;
			  }
			}

  | DNUM		{
			  parse_host->flags |= yylval.dnum.num1;
		          parse_host->zlevel = yylval.dnum.num2;
  			}

  | K_ERROR		{
			  cfg_error("Unknown compression '%s'",$1);
			  YYABORT;
			} 
  ;

keepalive:  
  NUM	 		{ 
			  if( $1 )
			     parse_host->flags |= VTUN_KEEP_ALIVE;
			}

  | DNUM		{
			  if( yylval.dnum.num1 ){
			     parse_host->flags |= VTUN_KEEP_ALIVE;
			     parse_host->ka_interval = yylval.dnum.num1;
		             parse_host->ka_failure  = yylval.dnum.num2;
			  }
  			}

  | K_ERROR		{
			  cfg_error("Unknown keepalive option '%s'",$1);
			  YYABORT;
			} 
  ;

srcaddr_options: /* empty */
  | srcaddr_option
  | srcaddr_options srcaddr_option
  ;

srcaddr_option:  
  K_ADDR WORD		{
			  free_addr(parse_host);
			  parse_host->src_addr.name = strdup($2);
			  parse_host->src_addr.type = VTUN_ADDR_NAME;
			}

  | K_IFACE WORD	{
			  free_addr(parse_host);
			  parse_host->src_addr.name = strdup($2);
			  parse_host->src_addr.type = VTUN_ADDR_IFACE;
			}

  | K_IFACE STRING	{
			  free_addr(parse_host);
			  parse_host->src_addr.name = strdup($2);
			  parse_host->src_addr.type = VTUN_ADDR_IFACE;
			}

  | K_PORT NUM 		{
			  parse_host->src_addr.port = $2;
			}

  | K_ERROR		{
			  cfg_error("Unknown option '%s'",$1);
			  YYABORT;
			} 
  ;

command_options: /* empty */
  | command_option
  | command_options command_option
  ;

command_option: '\n' 
  | K_PROG		{
			  memset(&parse_cmd, 0, sizeof(struct vtun_cmd));
			} 
 	prog_options    {
			  add_cmd(parse_cmds, parse_cmd.prog, 
				  parse_cmd.args, parse_cmd.flags);
			}

  | K_PPP STRING 	{   
			  add_cmd(parse_cmds, strdup(vtun.ppp), strdup($2), 
					VTUN_CMD_DELAY);
			}		

  | K_IFCFG STRING 	{   
			  add_cmd(parse_cmds, strdup(vtun.ifcfg),strdup($2),
					VTUN_CMD_WAIT);
			}

  | K_ROUTE STRING 	{   
			  add_cmd(parse_cmds, strdup(vtun.route),strdup($2),
					VTUN_CMD_WAIT);
			}

  | K_FWALL STRING 	{   
			  add_cmd(parse_cmds, strdup(vtun.fwall),strdup($2),
					VTUN_CMD_WAIT);
			}

  | K_IPROUTE STRING 	{   
			  add_cmd(parse_cmds, strdup(vtun.iproute),strdup($2),
					VTUN_CMD_WAIT);
			}

  | K_ERROR		{
			  cfg_error("Unknown cmd '%s'",$1);
			  YYABORT;
			} 
  ;

prog_options:
    prog_option
  | prog_options prog_option
  ;

prog_option:
  PATH  		{
			  parse_cmd.prog = strdup($1);
			}

  | STRING 		{
			  parse_cmd.args = strdup($1);
			}

  | NUM		   	{
			  parse_cmd.flags = $1;
			}
  ;
%%

int yyerror(char *s) 
{
   vlog(LOG_ERR, "%s line %d\n", s, lineno);
   return 0;
}

int cfg_error(const char *fmt, ...)
{
   char buf[255];
   va_list ap;

   /* print the argument string */
   va_start(ap, fmt);
   vsnprintf(buf,sizeof(buf),fmt,ap);
   va_end(ap);

   yyerror(buf);
   return 0;
}

int add_cmd(llist *cmds, char *prog, char *args, int flags)
{
   struct vtun_cmd *cmd;
   if( !(cmd = malloc(sizeof(struct vtun_cmd))) ){
      yyerror("No memory for the command");
      return -1;
   }
   memset(cmd, 0, sizeof(struct vtun_cmd)); 		   			

   cmd->prog = prog;
   cmd->args = args;
   cmd->flags = flags;
   llist_add(cmds, cmd);

   return 0;
}		

void *cp_cmd(void *d, void *u)
{
   struct vtun_cmd *cmd = d, *cmd_copy; 

   if( !(cmd_copy = malloc(sizeof(struct vtun_cmd))) ){
      yyerror("No memory to copy the command");
      return NULL;
   }
 
   cmd_copy->prog = strdup(cmd->prog);
   cmd_copy->args = strdup(cmd->args);
   cmd_copy->flags = cmd->flags;
   return cmd_copy;
}

int free_cmd(void *d, void *u)
{
   struct vtun_cmd *cmd = d; 
   free(cmd->prog);
   free(cmd->args);
   free(cmd);
   return 0;
}

void copy_addr(struct vtun_host *to, struct vtun_host *from)
{  
   if( from->src_addr.type ){
      to->src_addr.type = from->src_addr.type;
      to->src_addr.name = strdup(from->src_addr.name);
   }
   to->src_addr.port = from->src_addr.port;
}

void free_addr(struct vtun_host *h)
{  
   if( h->src_addr.type ){
      h->src_addr.type = 0;
      free(h->src_addr.name);
   }
}

int free_host(void *d, void *u)
{
   struct vtun_host *h = d;

   if (u && !strcmp(h->host, u))
      return 1;

   free(h->host);   
   free(h->passwd);   
   
   llist_free(&h->up, free_cmd, NULL);   
   llist_free(&h->down, free_cmd, NULL);

   free_addr(h);

   /* releases only host struct instances which were
    * allocated in the case of K_HOST except default_host */
   if( h->passwd )
      free(h);
 
   return 0;   
}

/* Find host in the hosts list.
 * NOTE: This function can be called only once since it deallocates hosts list.
 */ 
inline struct vtun_host* find_host(char *host)
{
   return (struct vtun_host *)llist_free(&host_list, free_host, host);
}

inline void free_host_list(void)
{
   llist_free(&host_list, free_host, NULL);
}

static struct {
   char *c_name;
   int  c_val;
} syslog_names[] = {
    { "auth",   LOG_AUTH },
    { "cron",   LOG_CRON },
    { "daemon", LOG_DAEMON },
    { "kern",   LOG_KERN },
    { "lpr",    LOG_LPR },
    { "mail",   LOG_MAIL },
    { "news",   LOG_NEWS },
    { "syslog", LOG_SYSLOG },
    { "user",   LOG_USER },
    { "uucp",   LOG_UUCP },
    { "local0", LOG_LOCAL0 },
    { "local1", LOG_LOCAL1 },
    { "local2", LOG_LOCAL2 },
    { "local3", LOG_LOCAL3 },
    { "local4", LOG_LOCAL4 },
    { "local5", LOG_LOCAL5 },
    { "local6", LOG_LOCAL6 },
    { "local7", LOG_LOCAL7 },
    { NULL, -1 }
};

int parse_syslog(char *facility)
{
   int i;

   for (i=0; syslog_names[i].c_name;i++) {
      if (!strcmp(syslog_names[i].c_name, facility)) {
         vtun.syslog = syslog_names[i].c_val;
         return(0);
      }
   }
}

/* 
 * Read config file. 
 */ 
int read_config(char *file) 
{
   static int cfg_loaded = 0;
   extern FILE *yyin;

   if( cfg_loaded ){
      free_host_list();
      vlog(LOG_INFO,"Reloading configuration file");
   }	 
   cfg_loaded = 1;

   llist_init(&host_list);

   if( !(yyin = fopen(file,"r")) ){
      vlog(LOG_ERR,"Can not open %s", file);
      return -1;      
   }

   yyparse();

   free_host(&default_host, NULL);

   fclose(yyin);
  
   return !llist_empty(&host_list);     
}


================================================
FILE: cfg_kwords.h
================================================
/*  
   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. 

   Copyright (C) 2011-2016  Vrayo Systems Ltd. team

   Vtrunkd has been derived from VTUN package by Maxim Krasnyansky. 
   vtun Copyright (C) 1998-2000  Maxim Krasnyansky <max_mk@yahoo.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 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.
 */

/*
 * cfg_kwords.h,v 1.1.1.1.2.3.2.8 2006/11/16 04:02:45 mtbishop Exp
 */ 

extern int lineno;

struct kword {
   char *str;
   int  type;
}; 

struct kword cfg_keyword[] = {
   { "options",  K_OPTIONS }, 
   { "default",  K_DEFAULT },
   { "up",	 K_UP },
   { "down",	 K_DOWN },
   { "port",     K_PORT }, 
   { "srcaddr",  K_SRCADDR }, 
   { "addr",  	 K_ADDR }, 
   { "iface",  	 K_IFACE }, 
   { "bindaddr", K_BINDADDR },
   { "persist",	 K_PERSIST }, 
   { "multi",	 K_MULTI }, 
   { "iface",    K_IFACE }, 
   { "timeout",	 K_TIMEOUT }, 
   { "passwd",   K_PASSWD }, 
   { "password", K_PASSWD }, 
   { "program",  K_PROG }, 
   { "speed",    K_SPEED }, 
   { "compress", K_COMPRESS }, 
   { "encrypt",  K_ENCRYPT }, 
   { "type",	 K_TYPE }, 
   { "proto",	 K_PROT }, 
   { "device",	 K_DEVICE }, 
   { "ppp",	 K_PPP },
   { "ifconfig", K_IFCFG },
   { "ifcfg", 	 K_IFCFG },
   { "firewall", K_FWALL }, 
   { "route", 	 K_ROUTE }, 
   { "ip", 	 K_IPROUTE }, 
   { "keepalive",K_KALIVE }, 
   { "stat",	 K_STAT }, 
   { "syslog",   K_SYSLOG },


   { "tick_secs",   K_TICK_SECS },
   { "rxmit_cnt_drop_period",   K_RXMIT_CNT_DROP_PERIOD },
   { "max_weight_norm",   K_MAX_WEIGHT_NORM },
   { "weight_scale",   K_WEIGHT_SCALE },
   { "weight_smooth_div",   K_WEIGHT_SMOOTH_DIV },
   { "weight_start_stickiness",   K_WEIGHT_START_STICKINESS },
   { "weight_saw_step_up_div",   K_WEIGHT_SAW_STEP_UP_DIV },
   { "weight_saw_step_up_min_step",   K_WEIGHT_SAW_STEP_UP_MIN_STEP },
   { "weight_saw_step_dn_div",   K_WEIGHT_SAW_STEP_DN_DIV },
   { "weight_msec_delay",   K_WEIGHT_MSEC_DELAY },
   { "weight_usec_delay",   K_WEIGHT_MSEC_DELAY },
   { "max_window",   K_MAX_WINDOW },
   { "pen_usec_immune",   K_PEN_USEC_IMMUNE},
   { "max_latency",   K_MAX_LATENCY },
   { "max_latency_drop",   K_MAX_LATENCY_DROP },
   { "max_allowed_buf_len",   K_MAX_ALLOWED_BUF_LEN },
   { "max_reorder",   K_MAX_REORDER },
   { "max_idle_timeout",   K_MAX_IDLE_TIMEOUT },
   { "frame_count_send_lws",   K_FRAME_COUNT_SEND_LWS },
   { "ping_interval",   K_PING_INTERVAL },
   { "tun_txqueue_len",   K_TUN_TXQUEUE_LEN },
   { "max_tunnels_num",   K_MAX_TUNNELS_NUM },
   { "tcp_conn_amount",   K_TCP_CONN_AMOUNT },
   { "start_weight", K_START_WEIGHT },
   { "rt_mark", K_RT_MARK },


   { NULL , 0 }
};

struct kword cfg_param[] = {
   { "yes",      1 }, 
   { "no",       0 },
   { "allow",	 1 },
   { "deny",	 0 },
   { "enable",	 1 },
   { "disable",	 0 },
   { "tty",      VTUN_TTY }, 
   { "pipe",	 VTUN_PIPE }, 
   { "ether",	 VTUN_ETHER }, 
   { "tun",	 VTUN_TUN }, 
   { "tcp",      VTUN_TCP }, 
   { "udp",      VTUN_UDP }, 
   { "lzo",      VTUN_LZO }, 
   { "zlib",     VTUN_ZLIB }, 
   { "wait",	 1 },
   { "killold",	 VTUN_MULTI_KILL },
   { "inetd",	 VTUN_INETD },
   { "stand",	 VTUN_STAND_ALONE },
   { "keep",     VTUN_PERSIST_KEEPIF },
   { "blowfish128ecb", VTUN_ENC_BF128ECB },
   { "blowfish128cbc", VTUN_ENC_BF128CBC },
   { "blowfish128cfb", VTUN_ENC_BF128CFB },
   { "blowfish128ofb", VTUN_ENC_BF128OFB },
   { "blowfish256ecb", VTUN_ENC_BF256ECB },
   { "blowfish256cbc", VTUN_ENC_BF256CBC },
   { "blowfish256cfb", VTUN_ENC_BF256CFB },
   { "blowfish256ofb", VTUN_ENC_BF256OFB },
   { "aes128ecb",      VTUN_ENC_AES128ECB },
   { "aes128cbc",      VTUN_ENC_AES128CBC },
   { "aes128cfb",      VTUN_ENC_AES128CFB },
   { "aes128ofb",      VTUN_ENC_AES128OFB },
   { "aes256ecb",      VTUN_ENC_AES256ECB },
   { "aes256cbc",      VTUN_ENC_AES256CBC },
   { "aes256cfb",      VTUN_ENC_AES256CFB },
   { "aes256ofb",      VTUN_ENC_AES256OFB },
   { NULL , 0 }
};


================================================
FILE: client.c
================================================
/*  
   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. 

   Copyright (C) 2011-2016  Vrayo Systems Ltd. team

   Vtrunkd has been derived from VTUN package by Maxim Krasnyansky. 
   vtun Copyright (C) 1998-2000  Maxim Krasnyansky <max_mk@yahoo.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 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.
 */

/*
 * client.c,v 1.5.2.8.2.1 2006/11/16 04:02:48 mtbishop Exp
 */ 

#include "config.h"
#include "vtun_socks.h"

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <syslog.h>

#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif

#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif

#include <sys/types.h>   /* basic system data types */
#include <sys/socket.h>  /* basic socket definitions */
#include <sys/time.h>    /* timeval{} for select() */
#include <time.h>        /* timespec{} for pselect() */
#include <netinet/in.h>  /* sockaddr_in{} and other Internet defns */
#include <arpa/inet.h>   /* inet(3) functions */
#include <errno.h>
#include <fcntl.h>       /* for nonblocking */
#include <netdb.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>    /* for S_xxx file mode constants */
#include <sys/uio.h>     /* for iovec{} and readv/writev */
#include <unistd.h>
#include <sys/wait.h>
#include <sys/un.h>      /* for Unix domain sockets */


#include "vtun.h"
#include "lib.h"
#include "log.h"
#include "llist.h"
#include "auth.h"
#include "compat.h"
#include "netlib.h"

static volatile sig_atomic_t client_term;
static void sig_term(int sig)
{
    vlog(LOG_INFO, "Terminated");
    client_term = VTUN_SIG_TERM;
}
/*
int cshit3(struct conn_info * sci, int fx) {
     int cnt = 0, cnt2=0;
     int nnl = sci->resend_buf.frames.rel_head;
     int nnf = sci->resend_buf.free_frames.rel_head;
     
     while(nnl > -1) {
          cnt++;
          nnl = sci->resend_buf.frames_buf[nnl].rel_next;
     }
     
     while(nnf > -1) {
          cnt++;
          nnf = sci->resend_buf.frames_buf[nnf].rel_next;
     }
     vlog(LOG_INFO, "%d count l: %d f: %d", fx, cnt, cnt2);
     return 0;
}
*/

void client(struct vtun_host *host)
{
    struct sockaddr_in my_addr, svr_addr;
    struct sigaction sa;
    int s, opt, reconnect, sss, len;
    int shm_new = 0;
    struct sockaddr_un remote;

    vlog_close();
    vlog_open(host->host, LOG_PID | LOG_NDELAY | LOG_PERROR, LOG_DAEMON);

#ifdef CLIENTONLY
    vlog(LOG_INFO, "vtrunkd client only ver %s %s started", VTUN_VER, BUILD_DATE);
#else
    vlog(LOG_INFO, "vtrunkd client ver %s %s started", VTUN_VER, BUILD_DATE);
#endif
    memset(&sa, 0, sizeof(sa));
    sa.sa_handler = SIG_IGN;
    sa.sa_flags = SA_NOCLDWAIT;
    sigaction(SIGHUP, &sa, NULL);
    sigaction(SIGQUIT, &sa, NULL);
    sigaction(SIGPIPE, &sa, NULL);
    sigaction(SIGCHLD, &sa, NULL);

    memset(&sa, 0, sizeof(sa));
    sa.sa_handler = sig_term;
    sigaction(SIGTERM, &sa, NULL);
    // sigaction(SIGINT, &sa, NULL);


    // now init everything...
    int shmid;
    int reason = 0; // connection denial reason
    key_t key;
    struct conn_info *shm_conn_info;
    struct timeval cur_time;
    /*
    * We'll name our shared memory segment
    * "5678".
    */
    key = vtun.shm_key;


    /*
    * First, try to open shm
    */

    if ((shmid = shmget(key, sizeof(struct conn_info), 0666)) < 0) {
        /*
        * Create the segment.
        */
        vlog(LOG_INFO, "client: init new shm...");
        if ((shmid = shmget(key, sizeof(struct conn_info), IPC_CREAT | 0666)) < 0) {
            vlog(LOG_ERR, "shmget 2 size %d", sizeof(struct conn_info));
            exit(1);
        }
        shm_new = 1;
    } else {
        vlog(LOG_INFO, "client: reusing shm...");
        shm_new = 0;
    }
    /*
    * Now we attach the segment to our data space.
    */
    if ((shm_conn_info = shmat(shmid, NULL, 0)) == (struct conn_info *) - 1) {
        vlog(LOG_ERR, "shmat 2");
        exit(1);
    }
    //cshit3(&shm_conn_info[0], 36);
    // now try to connect to socket if shm_new ==0
    if (!shm_new) {
        if ((sss = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
            vlog(LOG_ERR, "socket 44");
            exit(1);
        }
        remote.sun_family = AF_UNIX;
        sprintf(remote.sun_path, "/tmp/vtrunkd_%s.socket", shm_conn_info[0].devname);
        len = strlen(remote.sun_path) + sizeof(remote.sun_family);
        if ( (shm_conn_info->rdy) && (connect(sss, (struct sockaddr *)&remote, len) == -1)) {
            vlog(LOG_INFO, "SHM ready but socket not open! Assuming we're only process running;");
            shm_new = 1; // could not connect; assume we're new!
        } else {
            vlog(LOG_INFO, "Socket connected OK seems all OK");
        }
        close(sss);
    }
    if (shm_new) {
        vlog(LOG_INFO, "client doing memset");
        memset(shm_conn_info, 0, sizeof(struct conn_info));
    }
    //cshit3(&shm_conn_info[0], 37);

    client_term = 0; reconnect = 0;
    while ( (!client_term) || (client_term == VTUN_SIG_HUP) ) {
        if ( reconnect && (client_term != VTUN_SIG_HUP) ) {
            if ( vtun.persist || host->persist ) {
                /* Persist mode. Sleep and reconnect. */
                sleep(5);
            } else {
                /* Exit */
                break;
            }
        } else {
            reconnect = 1;
        }

        set_title("%s init initializing", host->host);

        /* Set server address */
        if ( server_addr(&svr_addr, host) < 0 )
            continue;

        /* Set local address */
        if ( local_addr(&my_addr, host, 0) < 0 )
            continue;

        /* We have to create socket again every time
         * we want to connect, since STREAM sockets
         * can be successfully connected only once.
         */
        if ( (s = socket(AF_INET, SOCK_STREAM, 0)) == -1 ) {
            vlog(LOG_ERR, "Can't create socket. %s(%d)",
                        strerror(errno), errno);
            continue;
        }
        //cshit3(&shm_conn_info[0], 38);

        /* Required when client is forced to bind to specific port */
        opt = 1;
        setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));

//        #ifndef W_O_SO_MARK
        if (host->RT_MARK != -1) {
            if (setsockopt(s, SOL_SOCKET, SO_MARK, &host->RT_MARK, sizeof(host->RT_MARK))) {
                vlog(LOG_ERR, "client socket rt mark error %s(%d)",
                            strerror(errno), errno);
                break;
            }
        }
//        #endif


        if ( bind(s, (struct sockaddr *)&my_addr, sizeof(my_addr)) ) {
            vlog(LOG_ERR, "Can't bind socket. %s(%d)",
                        strerror(errno), errno);
            continue;
        }

        /*
         * Clear speed and flags which will be supplied by server.
         */
        host->spd_in = host->spd_out = 0;
        host->flags &= VTUN_CLNT_MASK;

        io_init();

        set_title("%s connecting to %s", host->host, vtun.svr_name);
        vlog(LOG_INFO, "Connecting to %s", vtun.svr_name);

        if ( connect_t(s, (struct sockaddr *) &svr_addr, host->timeout) ) {
            vlog(LOG_ERR, "Connect to %s failed. %s(%d)", vtun.svr_name,
                        strerror(errno), errno);
        } else {
            if ( auth_client(s, host, &reason) ) {
                vlog(LOG_ERR, "Session %s[%s] opened (build %s)", host->host, vtun.svr_name, BUILD_DATE);



                host->rmt_fd = s;
                //cshit3(&shm_conn_info[0], 39);

                /* Start the tunnel */
                client_term = tunnel(host, 0, NULL);
                gettimeofday(&cur_time, NULL);
                shm_conn_info->alive = cur_time.tv_sec; // show we are alive and trying to reconnect still.. (or fd_server will quit)

                vlog(LOG_ERR, "Session %s[%s] closed", host->host, vtun.svr_name);
            } else {
                vlog(LOG_ERR, "Connection denied by %s, reason: %d", vtun.svr_name, reason);
            }
        }
        close(s);
        free_sopt(&host->sopt);
    }

    vlog(LOG_INFO, "Exit");
    return;
}


================================================
FILE: compat.h
================================================
/*  
   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. 

   Copyright (C) 2011-2016  Vrayo Systems Ltd. team

   Vtrunkd has been derived from VTUN package by Maxim Krasnyansky. 
   vtun Copyright (C) 1998-2000  Maxim Krasnyansky <max_mk@yahoo.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 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.
 */

/*
 * compat.h,v 1.1.1.2.6.1 2006/11/16 04:02:51 mtbishop Exp
 */ 
#ifndef _VTUN_COMPAT_H
#define _VTUN_COMPAT_H

#ifndef LOG_PERROR
#define LOG_PERROR 0
#endif

#ifndef SA_NOCLDWAIT
#define SA_NOCLDWAIT 0
#endif

#endif /* _VTUN_COMPAT_H */


================================================
FILE: config.guess
================================================
#! /bin/sh
# Attempt to guess a canonical system name.
#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
#   Free Software Foundation, Inc.

timestamp='2001-11-08'

# This file 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.

# Originally written by Per Bothner <bothner@cygnus.com>.
# Please send patches to <config-patches@gnu.org>.  Submit a context
# diff and a properly formatted ChangeLog entry.
#
# This script attempts to guess a canonical system name similar to
# config.sub.  If it succeeds, it prints the system name on stdout, and
# exits with 0.  Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit build system type.

me=`echo "$0" | sed -e 's,.*/,,'`

usage="\
Usage: $0 [OPTION]

Output the configuration name of the system \`$me' is run on.

Operation modes:
  -h, --help         print this help, then exit
  -t, --time-stamp   print date of last modification, then exit
  -v, --version      print version number, then exit

Report bugs and patches to <config-patches@gnu.org>."

version="\
GNU config.guess ($timestamp)

Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."

help="
Try \`$me --help' for more information."

# Parse command line
while test $# -gt 0 ; do
  case $1 in
    --time-stamp | --time* | -t )
       echo "$timestamp" ; exit 0 ;;
    --version | -v )
       echo "$version" ; exit 0 ;;
    --help | --h* | -h )
       echo "$usage"; exit 0 ;;
    -- )     # Stop option processing
       shift; break ;;
    - )	# Use stdin as input.
       break ;;
    -* )
       echo "$me: invalid option $1$help" >&2
       exit 1 ;;
    * )
       break ;;
  esac
done

if test $# != 0; then
  echo "$me: too many arguments$help" >&2
  exit 1
fi


dummy=dummy-$$
trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15

# CC_FOR_BUILD -- compiler used by this script.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.

set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
 ,,)    echo "int dummy(){}" > $dummy.c ;
	for c in cc gcc c89 ; do
	  ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
	  if test $? = 0 ; then
	     CC_FOR_BUILD="$c"; break ;
	  fi ;
	done ;
	rm -f $dummy.c $dummy.o $dummy.rel ;
	if test x"$CC_FOR_BUILD" = x ; then
	  CC_FOR_BUILD=no_compiler_found ;
	fi
	;;
 ,,*)   CC_FOR_BUILD=$CC ;;
 ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
esac'

# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
	PATH=$PATH:/.attbin ; export PATH
fi

UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown

# Note: order is significant - the case branches are not exclusive.

case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
    *:NetBSD:*:*)
	# NetBSD (nbsd) targets should (where applicable) match one or
	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
	# switched to ELF, *-*-netbsd* would select the old
	# object file format.  This provides both forward
	# compatibility and a consistent mechanism for selecting the
	# object file format.
	# Determine the machine/vendor (is the vendor relevant).
	case "${UNAME_MACHINE}" in
	    amiga) machine=m68k-unknown ;;
	    arm32) machine=arm-unknown ;;
	    atari*) machine=m68k-atari ;;
	    sun3*) machine=m68k-sun ;;
	    mac68k) machine=m68k-apple ;;
	    macppc) machine=powerpc-apple ;;
	    hp3[0-9][05]) machine=m68k-hp ;;
	    ibmrt|romp-ibm) machine=romp-ibm ;;
	    sparc*) machine=`uname -p`-unknown ;;
	    *) machine=${UNAME_MACHINE}-unknown ;;
	esac
	# The Operating System including object format, if it has switched
	# to ELF recently, or will in the future.
	case "${UNAME_MACHINE}" in
	    i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
		eval $set_cc_for_build
		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
			| grep __ELF__ >/dev/null
		then
		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
		    # Return netbsd for either.  FIX?
		    os=netbsd
		else
		    os=netbsdelf
		fi
		;;
	    *)
	        os=netbsd
		;;
	esac
	# The OS release
	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
	# contains redundant information, the shorter form:
	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
	echo "${machine}-${os}${release}"
	exit 0 ;;
    amiga:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    arc:OpenBSD:*:*)
	echo mipsel-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    hp300:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    mac68k:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    macppc:OpenBSD:*:*)
	echo powerpc-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    mvme68k:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    mvme88k:OpenBSD:*:*)
	echo m88k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    mvmeppc:OpenBSD:*:*)
	echo powerpc-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    pmax:OpenBSD:*:*)
	echo mipsel-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    sgi:OpenBSD:*:*)
	echo mipseb-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    sun3:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    wgrisc:OpenBSD:*:*)
	echo mipsel-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    *:OpenBSD:*:*)
	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    alpha:OSF1:*:*)
	if test $UNAME_RELEASE = "V4.0"; then
		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
	fi
	# A Vn.n version is a released version.
	# A Tn.n version is a released field test version.
	# A Xn.n version is an unreleased experimental baselevel.
	# 1.2 uses "1.2" for uname -r.
	cat <<EOF >$dummy.s
	.data
\$Lformat:
	.byte 37,100,45,37,120,10,0	# "%d-%x\n"

	.text
	.globl main
	.align 4
	.ent main
main:
	.frame \$30,16,\$26,0
	ldgp \$29,0(\$27)
	.prologue 1
	.long 0x47e03d80 # implver \$0
	lda \$2,-1
	.long 0x47e20c21 # amask \$2,\$1
	lda \$16,\$Lformat
	mov \$0,\$17
	not \$1,\$18
	jsr \$26,printf
	ldgp \$29,0(\$26)
	mov 0,\$16
	jsr \$26,exit
	.end main
EOF
	eval $set_cc_for_build
	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
	if test "$?" = 0 ; then
		case `./$dummy` in
			0-0)
				UNAME_MACHINE="alpha"
				;;
			1-0)
				UNAME_MACHINE="alphaev5"
				;;
			1-1)
				UNAME_MACHINE="alphaev56"
				;;
			1-101)
				UNAME_MACHINE="alphapca56"
				;;
			2-303)
				UNAME_MACHINE="alphaev6"
				;;
			2-307)
				UNAME_MACHINE="alphaev67"
				;;
			2-1307)
				UNAME_MACHINE="alphaev68"
				;;
		esac
	fi
	rm -f $dummy.s $dummy
	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
	exit 0 ;;
    Alpha\ *:Windows_NT*:*)
	# How do we know it's Interix rather than the generic POSIX subsystem?
	# Should we change UNAME_MACHINE based on the output of uname instead
	# of the specific Alpha model?
	echo alpha-pc-interix
	exit 0 ;;
    21064:Windows_NT:50:3)
	echo alpha-dec-winnt3.5
	exit 0 ;;
    Amiga*:UNIX_System_V:4.0:*)
	echo m68k-unknown-sysv4
	exit 0;;
    *:[Aa]miga[Oo][Ss]:*:*)
	echo ${UNAME_MACHINE}-unknown-amigaos
	exit 0 ;;
    *:OS/390:*:*)
	echo i370-ibm-openedition
	exit 0 ;;
    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
	echo arm-acorn-riscix${UNAME_RELEASE}
	exit 0;;
    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
	echo hppa1.1-hitachi-hiuxmpp
	exit 0;;
    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
	if test "`(/bin/universe) 2>/dev/null`" = att ; then
		echo pyramid-pyramid-sysv3
	else
		echo pyramid-pyramid-bsd
	fi
	exit 0 ;;
    NILE*:*:*:dcosx)
	echo pyramid-pyramid-svr4
	exit 0 ;;
    sun4H:SunOS:5.*:*)
	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    i86pc:SunOS:5.*:*)
	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    sun4*:SunOS:6*:*)
	# According to config.sub, this is the proper way to canonicalize
	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
	# it's likely to be more like Solaris than SunOS4.
	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    sun4*:SunOS:*:*)
	case "`/usr/bin/arch -k`" in
	    Series*|S4*)
		UNAME_RELEASE=`uname -v`
		;;
	esac
	# Japanese Language versions have a version number like `4.1.3-JL'.
	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
	exit 0 ;;
    sun3*:SunOS:*:*)
	echo m68k-sun-sunos${UNAME_RELEASE}
	exit 0 ;;
    sun*:*:4.2BSD:*)
	UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
	case "`/bin/arch`" in
	    sun3)
		echo m68k-sun-sunos${UNAME_RELEASE}
		;;
	    sun4)
		echo sparc-sun-sunos${UNAME_RELEASE}
		;;
	esac
	exit 0 ;;
    aushp:SunOS:*:*)
	echo sparc-auspex-sunos${UNAME_RELEASE}
	exit 0 ;;
    # The situation for MiNT is a little confusing.  The machine name
    # can be virtually everything (everything which is not
    # "atarist" or "atariste" at least should have a processor
    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
    # to the lowercase version "mint" (or "freemint").  Finally
    # the system name "TOS" denotes a system which is actually not
    # MiNT.  But MiNT is downward compatible to TOS, so this should
    # be no problem.
    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
        echo m68k-atari-mint${UNAME_RELEASE}
	exit 0 ;;
    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
	echo m68k-atari-mint${UNAME_RELEASE}
        exit 0 ;;
    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
        echo m68k-atari-mint${UNAME_RELEASE}
	exit 0 ;;
    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
        echo m68k-milan-mint${UNAME_RELEASE}
        exit 0 ;;
    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
        echo m68k-hades-mint${UNAME_RELEASE}
        exit 0 ;;
    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
        echo m68k-unknown-mint${UNAME_RELEASE}
        exit 0 ;;
    powerpc:machten:*:*)
	echo powerpc-apple-machten${UNAME_RELEASE}
	exit 0 ;;
    RISC*:Mach:*:*)
	echo mips-dec-mach_bsd4.3
	exit 0 ;;
    RISC*:ULTRIX:*:*)
	echo mips-dec-ultrix${UNAME_RELEASE}
	exit 0 ;;
    VAX*:ULTRIX*:*:*)
	echo vax-dec-ultrix${UNAME_RELEASE}
	exit 0 ;;
    2020:CLIX:*:* | 2430:CLIX:*:*)
	echo clipper-intergraph-clix${UNAME_RELEASE}
	exit 0 ;;
    mips:*:*:UMIPS | mips:*:*:RISCos)
	eval $set_cc_for_build
	sed 's/^	//' << EOF >$dummy.c
#ifdef __cplusplus
#include <stdio.h>  /* for printf() prototype */
	int main (int argc, char *argv[]) {
#else
	int main (argc, argv) int argc; char *argv[]; {
#endif
	#if defined (host_mips) && defined (MIPSEB)
	#if defined (SYSTYPE_SYSV)
	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
	#endif
	#if defined (SYSTYPE_SVR4)
	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
	#endif
	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
	#endif
	#endif
	  exit (-1);
	}
EOF
	$CC_FOR_BUILD $dummy.c -o $dummy \
	  && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
	  && rm -f $dummy.c $dummy && exit 0
	rm -f $dummy.c $dummy
	echo mips-mips-riscos${UNAME_RELEASE}
	exit 0 ;;
    Motorola:PowerMAX_OS:*:*)
	echo powerpc-motorola-powermax
	exit 0 ;;
    Night_Hawk:Power_UNIX:*:*)
	echo powerpc-harris-powerunix
	exit 0 ;;
    m88k:CX/UX:7*:*)
	echo m88k-harris-cxux7
	exit 0 ;;
    m88k:*:4*:R4*)
	echo m88k-motorola-sysv4
	exit 0 ;;
    m88k:*:3*:R3*)
	echo m88k-motorola-sysv3
	exit 0 ;;
    AViiON:dgux:*:*)
        # DG/UX returns AViiON for all architectures
        UNAME_PROCESSOR=`/usr/bin/uname -p`
	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
	then
	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
	       [ ${TARGET_BINARY_INTERFACE}x = x ]
	    then
		echo m88k-dg-dgux${UNAME_RELEASE}
	    else
		echo m88k-dg-dguxbcs${UNAME_RELEASE}
	    fi
	else
	    echo i586-dg-dgux${UNAME_RELEASE}
	fi
 	exit 0 ;;
    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
	echo m88k-dolphin-sysv3
	exit 0 ;;
    M88*:*:R3*:*)
	# Delta 88k system running SVR3
	echo m88k-motorola-sysv3
	exit 0 ;;
    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
	echo m88k-tektronix-sysv3
	exit 0 ;;
    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
	echo m68k-tektronix-bsd
	exit 0 ;;
    *:IRIX*:*:*)
	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
	exit 0 ;;
    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
    i*86:AIX:*:*)
	echo i386-ibm-aix
	exit 0 ;;
    ia64:AIX:*:*)
	if [ -x /usr/bin/oslevel ] ; then
		IBM_REV=`/usr/bin/oslevel`
	else
		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
	fi
	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
	exit 0 ;;
    *:AIX:2:3)
	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
		eval $set_cc_for_build
		sed 's/^		//' << EOF >$dummy.c
		#include <sys/systemcfg.h>

		main()
			{
			if (!__power_pc())
				exit(1);
			puts("powerpc-ibm-aix3.2.5");
			exit(0);
			}
EOF
		$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
		rm -f $dummy.c $dummy
		echo rs6000-ibm-aix3.2.5
	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
		echo rs6000-ibm-aix3.2.4
	else
		echo rs6000-ibm-aix3.2
	fi
	exit 0 ;;
    *:AIX:*:[45])
	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
		IBM_ARCH=rs6000
	else
		IBM_ARCH=powerpc
	fi
	if [ -x /usr/bin/oslevel ] ; then
		IBM_REV=`/usr/bin/oslevel`
	else
		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
	fi
	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
	exit 0 ;;
    *:AIX:*:*)
	echo rs6000-ibm-aix
	exit 0 ;;
    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
	echo romp-ibm-bsd4.4
	exit 0 ;;
    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
	exit 0 ;;                           # report: romp-ibm BSD 4.3
    *:BOSX:*:*)
	echo rs6000-bull-bosx
	exit 0 ;;
    DPX/2?00:B.O.S.:*:*)
	echo m68k-bull-sysv3
	exit 0 ;;
    9000/[34]??:4.3bsd:1.*:*)
	echo m68k-hp-bsd
	exit 0 ;;
    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
	echo m68k-hp-bsd4.4
	exit 0 ;;
    9000/[34678]??:HP-UX:*:*)
	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
	case "${UNAME_MACHINE}" in
	    9000/31? )            HP_ARCH=m68000 ;;
	    9000/[34]?? )         HP_ARCH=m68k ;;
	    9000/[678][0-9][0-9])
		if [ -x /usr/bin/getconf ]; then
		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
                    case "${sc_cpu_version}" in
                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
                      532)                      # CPU_PA_RISC2_0
                        case "${sc_kernel_bits}" in
                          32) HP_ARCH="hppa2.0n" ;;
                          64) HP_ARCH="hppa2.0w" ;;
			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
                        esac ;;
                    esac
		fi
		if [ "${HP_ARCH}" = "" ]; then
		    eval $set_cc_for_build
		    sed 's/^              //' << EOF >$dummy.c

              #define _HPUX_SOURCE
              #include <stdlib.h>
              #include <unistd.h>

              int main ()
              {
              #if defined(_SC_KERNEL_BITS)
                  long bits = sysconf(_SC_KERNEL_BITS);
              #endif
                  long cpu  = sysconf (_SC_CPU_VERSION);

                  switch (cpu)
              	{
              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
              	case CPU_PA_RISC2_0:
              #if defined(_SC_KERNEL_BITS)
              	    switch (bits)
              		{
              		case 64: puts ("hppa2.0w"); break;
              		case 32: puts ("hppa2.0n"); break;
              		default: puts ("hppa2.0"); break;
              		} break;
              #else  /* !defined(_SC_KERNEL_BITS) */
              	    puts ("hppa2.0"); break;
              #endif
              	default: puts ("hppa1.0"); break;
              	}
                  exit (0);
              }
EOF
		    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
		    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
		    rm -f $dummy.c $dummy
		fi ;;
	esac
	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
	exit 0 ;;
    ia64:HP-UX:*:*)
	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
	echo ia64-hp-hpux${HPUX_REV}
	exit 0 ;;
    3050*:HI-UX:*:*)
	eval $set_cc_for_build
	sed 's/^	//' << EOF >$dummy.c
	#include <unistd.h>
	int
	main ()
	{
	  long cpu = sysconf (_SC_CPU_VERSION);
	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
	     results, however.  */
	  if (CPU_IS_PA_RISC (cpu))
	    {
	      switch (cpu)
		{
		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
		  default: puts ("hppa-hitachi-hiuxwe2"); break;
		}
	    }
	  else if (CPU_IS_HP_MC68K (cpu))
	    puts ("m68k-hitachi-hiuxwe2");
	  else puts ("unknown-hitachi-hiuxwe2");
	  exit (0);
	}
EOF
	$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
	rm -f $dummy.c $dummy
	echo unknown-hitachi-hiuxwe2
	exit 0 ;;
    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
	echo hppa1.1-hp-bsd
	exit 0 ;;
    9000/8??:4.3bsd:*:*)
	echo hppa1.0-hp-bsd
	exit 0 ;;
    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
	echo hppa1.0-hp-mpeix
	exit 0 ;;
    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
	echo hppa1.1-hp-osf
	exit 0 ;;
    hp8??:OSF1:*:*)
	echo hppa1.0-hp-osf
	exit 0 ;;
    i*86:OSF1:*:*)
	if [ -x /usr/sbin/sysversion ] ; then
	    echo ${UNAME_MACHINE}-unknown-osf1mk
	else
	    echo ${UNAME_MACHINE}-unknown-osf1
	fi
	exit 0 ;;
    parisc*:Lites*:*:*)
	echo hppa1.1-hp-lites
	exit 0 ;;
    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
	echo c1-convex-bsd
        exit 0 ;;
    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
	if getsysinfo -f scalar_acc
	then echo c32-convex-bsd
	else echo c2-convex-bsd
	fi
        exit 0 ;;
    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
	echo c34-convex-bsd
        exit 0 ;;
    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
	echo c38-convex-bsd
        exit 0 ;;
    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
	echo c4-convex-bsd
        exit 0 ;;
    CRAY*X-MP:*:*:*)
	echo xmp-cray-unicos
        exit 0 ;;
    CRAY*Y-MP:*:*:*)
	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
	exit 0 ;;
    CRAY*[A-Z]90:*:*:*)
	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
	      -e 's/\.[^.]*$/.X/'
	exit 0 ;;
    CRAY*TS:*:*:*)
	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
	exit 0 ;;
    CRAY*T3D:*:*:*)
	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
	exit 0 ;;
    CRAY*T3E:*:*:*)
	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
	exit 0 ;;
    CRAY*SV1:*:*:*)
	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
	exit 0 ;;
    CRAY-2:*:*:*)
	echo cray2-cray-unicos
        exit 0 ;;
    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
        exit 0 ;;
    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
	exit 0 ;;
    sparc*:BSD/OS:*:*)
	echo sparc-unknown-bsdi${UNAME_RELEASE}
	exit 0 ;;
    *:BSD/OS:*:*)
	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
	exit 0 ;;
    *:FreeBSD:*:*)
	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
	exit 0 ;;
    i*:CYGWIN*:*)
	echo ${UNAME_MACHINE}-pc-cygwin
	exit 0 ;;
    i*:MINGW*:*)
	echo ${UNAME_MACHINE}-pc-mingw32
	exit 0 ;;
    i*:PW*:*)
	echo ${UNAME_MACHINE}-pc-pw32
	exit 0 ;;
    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
	# How do we know it's Interix rather than the generic POSIX subsystem?
	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
	# UNAME_MACHINE based on the output of uname instead of i386?
	echo i386-pc-interix
	exit 0 ;;
    i*:UWIN*:*)
	echo ${UNAME_MACHINE}-pc-uwin
	exit 0 ;;
    p*:CYGWIN*:*)
	echo powerpcle-unknown-cygwin
	exit 0 ;;
    prep*:SunOS:5.*:*)
	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    *:GNU:*:*)
	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
	exit 0 ;;
    i*86:Minix:*:*)
	echo ${UNAME_MACHINE}-pc-minix
	exit 0 ;;
    arm*:Linux:*:*)
	echo ${UNAME_MACHINE}-unknown-linux-gnu
	exit 0 ;;
    ia64:Linux:*:*)
	echo ${UNAME_MACHINE}-unknown-linux
	exit 0 ;;
    m68*:Linux:*:*)
	echo ${UNAME_MACHINE}-unknown-linux-gnu
	exit 0 ;;
    mips:Linux:*:*)
	case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in
	  big)    echo mips-unknown-linux-gnu && exit 0 ;;
	  little) echo mipsel-unknown-linux-gnu && exit 0 ;;
	esac
	;;
    ppc:Linux:*:*)
	echo powerpc-unknown-linux-gnu
	exit 0 ;;
    ppc64:Linux:*:*)
	echo powerpc64-unknown-linux-gnu
	exit 0 ;;
    alpha:Linux:*:*)
	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
	  EV5)   UNAME_MACHINE=alphaev5 ;;
	  EV56)  UNAME_MACHINE=alphaev56 ;;
	  PCA56) UNAME_MACHINE=alphapca56 ;;
	  PCA57) UNAME_MACHINE=alphapca56 ;;
	  EV6)   UNAME_MACHINE=alphaev6 ;;
	  EV67)  UNAME_MACHINE=alphaev67 ;;
	  EV68*) UNAME_MACHINE=alphaev68 ;;
        esac
	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
	exit 0 ;;
    parisc:Linux:*:* | hppa:Linux:*:*)
	# Look for CPU level
	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
	  *)    echo hppa-unknown-linux-gnu ;;
	esac
	exit 0 ;;
    parisc64:Linux:*:* | hppa64:Linux:*:*)
	echo hppa64-unknown-linux-gnu
	exit 0 ;;
    s390:Linux:*:* | s390x:Linux:*:*)
	echo ${UNAME_MACHINE}-ibm-linux
	exit 0 ;;
    sh*:Linux:*:*)
	echo ${UNAME_MACHINE}-unknown-linux-gnu
	exit 0 ;;
    sparc:Linux:*:* | sparc64:Linux:*:*)
	echo ${UNAME_MACHINE}-unknown-linux-gnu
	exit 0 ;;
    x86_64:Linux:*:*)
	echo x86_64-unknown-linux-gnu
	exit 0 ;;
    i*86:Linux:*:*)
	# The BFD linker knows what the default object file format is, so
	# first see if it will tell us. cd to the root directory to prevent
	# problems with other programs or directories called `ld' in the path.
	ld_supported_targets=`cd /; ld --help 2>&1 \
			 | sed -ne '/supported targets:/!d
				    s/[ 	][ 	]*/ /g
				    s/.*supported targets: *//
				    s/ .*//
				    p'`
        case "$ld_supported_targets" in
	  elf32-i386)
		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
		;;
	  a.out-i386-linux)
		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
		exit 0 ;;		
	  coff-i386)
		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
		exit 0 ;;
	  "")
		# Either a pre-BFD a.out linker (linux-gnuoldld) or
		# one that does not give us useful --help.
		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
		exit 0 ;;
	esac
	# Determine whether the default compiler is a.out or elf
	eval $set_cc_for_build
	cat >$dummy.c <<EOF
#include <features.h>
#ifdef __cplusplus
#include <stdio.h>  /* for printf() prototype */
	int main (int argc, char *argv[]) {
#else
	int main (argc, argv) int argc; char *argv[]; {
#endif
#ifdef __ELF__
# ifdef __GLIBC__
#  if __GLIBC__ >= 2
    printf ("%s-pc-linux-gnu\n", argv[1]);
#  else
    printf ("%s-pc-linux-gnulibc1\n", argv[1]);
#  endif
# else
   printf ("%s-pc-linux-gnulibc1\n", argv[1]);
# endif
#else
  printf ("%s-pc-linux-gnuaout\n", argv[1]);
#endif
  return 0;
}
EOF
	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
	rm -f $dummy.c $dummy
	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
	;;
    i*86:DYNIX/ptx:4*:*)
	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
	# earlier versions are messed up and put the nodename in both
	# sysname and nodename.
	echo i386-sequent-sysv4
	exit 0 ;;
    i*86:UNIX_SV:4.2MP:2.*)
        # Unixware is an offshoot of SVR4, but it has its own version
        # number series starting with 2...
        # I am not positive that other SVR4 systems won't match this,
	# I just have to hope.  -- rms.
        # Use sysv4.2uw... so that sysv4* matches it.
	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
	exit 0 ;;
    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
	else
		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
	fi
	exit 0 ;;
    i*86:*:5:[78]*)
	case `/bin/uname -X | grep "^Machine"` in
	    *486*)	     UNAME_MACHINE=i486 ;;
	    *Pentium)	     UNAME_MACHINE=i586 ;;
	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
	esac
	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
	exit 0 ;;
    i*86:*:3.2:*)
	if test -f /usr/options/cb.name; then
		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
	elif /bin/uname -X 2>/dev/null >/dev/null ; then
		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
			&& UNAME_MACHINE=i586
		(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
			&& UNAME_MACHINE=i686
		(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
			&& UNAME_MACHINE=i686
		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
	else
		echo ${UNAME_MACHINE}-pc-sysv32
	fi
	exit 0 ;;
    i*86:*DOS:*:*)
	echo ${UNAME_MACHINE}-pc-msdosdjgpp
	exit 0 ;;
    pc:*:*:*)
	# Left here for compatibility:
        # uname -m prints for DJGPP always 'pc', but it prints nothing about
        # the processor, so we play safe by assuming i386.
	echo i386-pc-msdosdjgpp
        exit 0 ;;
    Intel:Mach:3*:*)
	echo i386-pc-mach3
	exit 0 ;;
    paragon:*:*:*)
	echo i860-intel-osf1
	exit 0 ;;
    i860:*:4.*:*) # i860-SVR4
	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
	else # Add other i860-SVR4 vendors below as they are discovered.
	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
	fi
	exit 0 ;;
    mini*:CTIX:SYS*5:*)
	# "miniframe"
	echo m68010-convergent-sysv
	exit 0 ;;
    M68*:*:R3V[567]*:*)
	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
	OS_REL=''
	test -r /etc/.relid \
	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
          && echo i486-ncr-sysv4 && exit 0 ;;
    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
	echo m68k-unknown-lynxos${UNAME_RELEASE}
	exit 0 ;;
    mc68030:UNIX_System_V:4.*:*)
	echo m68k-atari-sysv4
	exit 0 ;;
    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
	echo i386-unknown-lynxos${UNAME_RELEASE}
	exit 0 ;;
    TSUNAMI:LynxOS:2.*:*)
	echo sparc-unknown-lynxos${UNAME_RELEASE}
	exit 0 ;;
    rs6000:LynxOS:2.*:*)
	echo rs6000-unknown-lynxos${UNAME_RELEASE}
	exit 0 ;;
    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
	echo powerpc-unknown-lynxos${UNAME_RELEASE}
	exit 0 ;;
    SM[BE]S:UNIX_SV:*:*)
	echo mips-dde-sysv${UNAME_RELEASE}
	exit 0 ;;
    RM*:ReliantUNIX-*:*:*)
	echo mips-sni-sysv4
	exit 0 ;;
    RM*:SINIX-*:*:*)
	echo mips-sni-sysv4
	exit 0 ;;
    *:SINIX-*:*:*)
	if uname -p 2>/dev/null >/dev/null ; then
		UNAME_MACHINE=`(uname -p) 2>/dev/null`
		echo ${UNAME_MACHINE}-sni-sysv4
	else
		echo ns32k-sni-sysv
	fi
	exit 0 ;;
    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
                      # says <Richard.M.Bartel@ccMail.Census.GOV>
        echo i586-unisys-sysv4
        exit 0 ;;
    *:UNIX_System_V:4*:FTX*)
	# From Gerald Hewes <hewes@openmarket.com>.
	# How about differentiating between stratus architectures? -djm
	echo hppa1.1-stratus-sysv4
	exit 0 ;;
    *:*:*:FTX*)
	# From seanf@swdc.stratus.com.
	echo i860-stratus-sysv4
	exit 0 ;;
    *:VOS:*:*)
	# From Paul.Green@stratus.com.
	echo hppa1.1-stratus-vos
	exit 0 ;;
    mc68*:A/UX:*:*)
	echo m68k-apple-aux${UNAME_RELEASE}
	exit 0 ;;
    news*:NEWS-OS:6*:*)
	echo mips-sony-newsos6
	exit 0 ;;
    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
	if [ -d /usr/nec ]; then
	        echo mips-nec-sysv${UNAME_RELEASE}
	else
	        echo mips-unknown-sysv${UNAME_RELEASE}
	fi
        exit 0 ;;
    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
	echo powerpc-be-beos
	exit 0 ;;
    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
	echo powerpc-apple-beos
	exit 0 ;;
    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
	echo i586-pc-beos
	exit 0 ;;
    SX-4:SUPER-UX:*:*)
	echo sx4-nec-superux${UNAME_RELEASE}
	exit 0 ;;
    SX-5:SUPER-UX:*:*)
	echo sx5-nec-superux${UNAME_RELEASE}
	exit 0 ;;
    Power*:Rhapsody:*:*)
	echo powerpc-apple-rhapsody${UNAME_RELEASE}
	exit 0 ;;
    *:Rhapsody:*:*)
	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
	exit 0 ;;
    *:Darwin:*:*)
	echo `uname -p`-apple-darwin${UNAME_RELEASE}
	exit 0 ;;
    *:procnto*:*:* | *:QNX:[0123456789]*:*)
	if test "${UNAME_MACHINE}" = "x86pc"; then
		UNAME_MACHINE=pc
	fi
	echo `uname -p`-${UNAME_MACHINE}-nto-qnx
	exit 0 ;;
    *:QNX:*:4*)
	echo i386-pc-qnx
	exit 0 ;;
    NSR-[KW]:NONSTOP_KERNEL:*:*)
	echo nsr-tandem-nsk${UNAME_RELEASE}
	exit 0 ;;
    *:NonStop-UX:*:*)
	echo mips-compaq-nonstopux
	exit 0 ;;
    BS2000:POSIX*:*:*)
	echo bs2000-siemens-sysv
	exit 0 ;;
    DS/*:UNIX_System_V:*:*)
	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
	exit 0 ;;
    *:Plan9:*:*)
	# "uname -m" is not consistent, so use $cputype instead. 386
	# is converted to i386 for consistency with other x86
	# operating systems.
	if test "$cputype" = "386"; then
	    UNAME_MACHINE=i386
	else
	    UNAME_MACHINE="$cputype"
	fi
	echo ${UNAME_MACHINE}-unknown-plan9
	exit 0 ;;
    i*86:OS/2:*:*)
	# If we were able to find `uname', then EMX Unix compatibility
	# is probably installed.
	echo ${UNAME_MACHINE}-pc-os2-emx
	exit 0 ;;
    *:TOPS-10:*:*)
	echo pdp10-unknown-tops10
	exit 0 ;;
    *:TENEX:*:*)
	echo pdp10-unknown-tenex
	exit 0 ;;
    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
	echo pdp10-dec-tops20
	exit 0 ;;
    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
	echo pdp10-xkl-tops20
	exit 0 ;;
    *:TOPS-20:*:*)
	echo pdp10-unknown-tops20
	exit 0 ;;
    *:ITS:*:*)
	echo pdp10-unknown-its
	exit 0 ;;
    i*86:XTS-300:*:STOP)
	echo ${UNAME_MACHINE}-unknown-stop
	exit 0 ;;
    i*86:atheos:*:*)
	echo ${UNAME_MACHINE}-unknown-atheos
	exit 0 ;;
esac

#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2

eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
     I don't know....  */
  printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
  printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
          "4"
#else
	  ""
#endif
         ); exit (0);
#endif
#endif

#if defined (__arm) && defined (__acorn) && defined (__unix)
  printf ("arm-acorn-riscix"); exit (0);
#endif

#if defined (hp300) && !defined (hpux)
  printf ("m68k-hp-bsd\n"); exit (0);
#endif

#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
  int version;
  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
  if (version < 4)
    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
  else
    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
  exit (0);
#endif

#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
  printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
  printf ("ns32k-encore-mach\n"); exit (0);
#else
  printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif

#if defined (__386BSD__)
  printf ("i386-pc-bsd\n"); exit (0);
#endif

#if defined (sequent)
#if defined (i386)
  printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
  printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif

#if defined (_SEQUENT_)
    struct utsname un;

    uname(&un);

    if (strncmp(un.version, "V2", 2) == 0) {
	printf ("i386-sequent-ptx2\n"); exit (0);
    }
    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
	printf ("i386-sequent-ptx1\n"); exit (0);
    }
    printf ("i386-sequent-ptx\n"); exit (0);

#endif

#if defined (vax)
# if !defined (ultrix)
#  include <sys/param.h>
#  if defined (BSD)
#   if BSD == 43
      printf ("vax-dec-bsd4.3\n"); exit (0);
#   else
#    if BSD == 199006
      printf ("vax-dec-bsd4.3reno\n"); exit (0);
#    else
      printf ("vax-dec-bsd\n"); exit (0);
#    endif
#   endif
#  else
    printf ("vax-dec-bsd\n"); exit (0);
#  endif
# else
    printf ("vax-dec-ultrix\n"); exit (0);
# endif
#endif

#if defined (alliant) && defined (i860)
  printf ("i860-alliant-bsd\n"); exit (0);
#endif

  exit (1);
}
EOF

$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy

# Apollos put the system type in the environment.

test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }

# Convex versions that predate uname can use getsysinfo(1)

if [ -x /usr/convex/getsysinfo ]
then
    case `getsysinfo -f cpu_type` in
    c1*)
	echo c1-convex-bsd
	exit 0 ;;
    c2*)
	if getsysinfo -f scalar_acc
	then echo c32-convex-bsd
	else echo c2-convex-bsd
	fi
	exit 0 ;;
    c34*)
	echo c34-convex-bsd
	exit 0 ;;
    c38*)
	echo c38-convex-bsd
	exit 0 ;;
    c4*)
	echo c4-convex-bsd
	exit 0 ;;
    esac
fi

cat >&2 <<EOF
$0: unable to guess system type

This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from

    ftp://ftp.gnu.org/pub/gnu/config/

If the version you run ($0) is already up to date, please
send the following data and any information you think might be
pertinent to <config-patches@gnu.org> in order to provide the needed
information to handle your system.

config.guess timestamp = $timestamp

uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`

/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`

hostinfo               = `(hostinfo) 2>/dev/null`
/bin/universe          = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch              = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`

UNAME_MACHINE = ${UNAME_MACHINE}
UNAME_RELEASE = ${UNAME_RELEASE}
UNAME_SYSTEM  = ${UNAME_SYSTEM}
UNAME_VERSION = ${UNAME_VERSION}
EOF

exit 1

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:


================================================
FILE: config.h.in
================================================
/* config.h.in.  Generated automatically from configure.in by autoheader.  */

/* Define to empty if the keyword does not work.  */
#undef const

/* Define as __inline if that's what the C compiler calls it.  */
#undef inline

/* Define if you have the ANSI C header files.  */
#undef STDC_HEADERS

/* Define if you have the gettimeofday function.  */
#undef HAVE_GETTIMEOFDAY

/* Define if you have the <arpa/inet.h> header file.  */
#undef HAVE_ARPA_INET_H

/* Define if you have the <fcntl.h> header file.  */
#undef HAVE_FCNTL_H

/* Define if you have the <netinet/in.h> header file.  */
#undef HAVE_NETINET_IN_H

/* Define if you have the <netinet/ip.h> header file.  */
#undef HAVE_NETINET_IP_H

/* Define if you have the <netinet/tcp.h> header file.  */
#undef HAVE_NETINET_TCP_H

/* Define if you have the <netinet/in_systm.h> header file.  */
#undef HAVE_NETINET_IN_SYSTM_H

/* Define if you have the <netdb.h> header file.  */
#undef HAVE_NETDB_H

/* Define if you have the <sched.h> header file.  */
#undef HAVE_SCHED_H

/* Define if you have the <sys/resource.h> header file.  */
#undef HAVE_SYS_RESOURCE_H

/* Define if you have the <sys/time.h> header file.  */
#undef HAVE_SYS_TIME_H

/* Define if you have the <sys/sockio.h> header file.  */
#undef HAVE_SYS_SOCKIO_H

/* Define if you have the <linux/if_tun.h> header file.  */
#undef HAVE_LINUX_IF_TUN_H

/* Define if you have setproctitle. */
#undef HAVE_SETPROC_TITLE

#undef HAVE_LIBUTIL_H

/* Define if you have ZLIB */
#undef HAVE_ZLIB

/* Define if you have LZO */
#undef HAVE_LZO

/* Define if you have OpenSSL */
#undef HAVE_SSL

#undef HAVE_SSL_BLOWFISH

#undef HAVE_SSL_AES

#undef HAVE_SSL_EVP

#undef HAVE_SHAPER

/* Release version and date */
#undef VTUN_VER


================================================
FILE: config.sub
================================================
#! /bin/sh
# Configuration validation subroutine script.
#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
#   Free Software Foundation, Inc.

timestamp='2001-11-08'

# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine.  It does not imply ALL GNU software can.
#
# This file 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.

# Please send patches to <config-patches@gnu.org>.  Submit a context
# diff and a properly formatted ChangeLog entry.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.

# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support.  The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.

# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.

me=`echo "$0" | sed -e 's,.*/,,'`

usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS
       $0 [OPTION] ALIAS

Canonicalize a configuration name.

Operation modes:
  -h, --help         print this help, then exit
  -t, --time-stamp   print date of last modification, then exit
  -v, --version      print version number, then exit

Report bugs and patches to <config-patches@gnu.org>."

version="\
GNU config.sub ($timestamp)

Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."

help="
Try \`$me --help' for more information."

# Parse command line
while test $# -gt 0 ; do
  case $1 in
    --time-stamp | --time* | -t )
       echo "$timestamp" ; exit 0 ;;
    --version | -v )
       echo "$version" ; exit 0 ;;
    --help | --h* | -h )
       echo "$usage"; exit 0 ;;
    -- )     # Stop option processing
       shift; break ;;
    - )	# Use stdin as input.
       break ;;
    -* )
       echo "$me: invalid option $1$help"
       exit 1 ;;

    *local*)
       # First pass through any local machine types.
       echo $1
       exit 0;;

    * )
       break ;;
  esac
done

case $# in
 0) echo "$me: missing argument$help" >&2
    exit 1;;
 1) ;;
 *) echo "$me: too many arguments$help" >&2
    exit 1;;
esac

# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
    os=-$maybe_os
    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
    ;;
  *)
    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
    if [ $basic_machine != $1 ]
    then os=`echo $1 | sed 's/.*-/-/'`
    else os=; fi
    ;;
esac

### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work.  We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
	-sun*os*)
		# Prevent following clause from handling this invalid input.
		;;
	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
	-apple | -axis)
		os=
		basic_machine=$1
		;;
	-sim | -cisco | -oki | -wec | -winbond)
		os=
		basic_machine=$1
		;;
	-scout)
		;;
	-wrs)
		os=-vxworks
		basic_machine=$1
		;;
	-chorusos*)
		os=-chorusos
		basic_machine=$1
		;;
 	-chorusrdb)
 		os=-chorusrdb
		basic_machine=$1
 		;;
	-hiux*)
		os=-hiuxwe2
		;;
	-sco5)
		os=-sco3.2v5
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-sco4)
		os=-sco3.2v4
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-sco3.2.[4-9]*)
		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-sco3.2v[4-9]*)
		# Don't forget version if it is 3.2v4 or newer.
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-sco*)
		os=-sco3.2v2
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-udk*)
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-isc)
		os=-isc2.2
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-clix*)
		basic_machine=clipper-intergraph
		;;
	-isc*)
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-lynx*)
		os=-lynxos
		;;
	-ptx*)
		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
		;;
	-windowsnt*)
		os=`echo $os | sed -e 's/windowsnt/winnt/'`
		;;
	-psos*)
		os=-psos
		;;
	-mint | -mint[0-9]*)
		basic_machine=m68k-atari
		os=-mint
		;;
esac

# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
	# Recognize the basic CPU types without company name.
	# Some are omitted here because they have special meanings below.
	1750a | 580 \
	| a29k \
	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
	| c4x | clipper \
	| d10v | d30v | dsp16xx \
	| fr30 \
	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
	| i370 | i860 | i960 | ia64 \
	| m32r | m68000 | m68k | m88k | mcore \
	| mips16 | mips64 | mips64el | mips64orion | mips64orionel \
	| mips64vr4100 | mips64vr4100el | mips64vr4300 \
	| mips64vr4300el | mips64vr5000 | mips64vr5000el \
	| mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
	| mipsisa32 \
	| mn10200 | mn10300 \
	| ns16k | ns32k \
	| openrisc \
	| pdp10 | pdp11 | pj | pjl \
	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
	| pyramid \
	| sh | sh[34] | sh[34]eb | shbe | shle \
	| sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
	| strongarm \
	| tahoe | thumb | tic80 | tron \
	| v850 \
	| we32k \
	| x86 | xscale | xstormy16 \
	| z8k)
		basic_machine=$basic_machine-unknown
		;;
	m6811 | m68hc11 | m6812 | m68hc12)
		# Motorola 68HC11/12.
		basic_machine=$basic_machine-unknown
		os=-none
		;;
	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
		;;

	# We use `pc' rather than `unknown'
	# because (1) that's what they normally are, and
	# (2) the word "unknown" tends to confuse beginning users.
	i*86 | x86_64)
	  basic_machine=$basic_machine-pc
	  ;;
	# Object if more than one company name word.
	*-*-*)
		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
		exit 1
		;;
	# Recognize the basic CPU types with company name.
	580-* \
	| a29k-* \
	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
	| alphapca5[67]-* | arc-* \
	| arm-*  | armbe-* | armle-* | armv*-* \
	| avr-* \
	| bs2000-* \
	| c[123]* | c30-* | [cjt]90-* | c54x-* \
	| clipper-* | cray2-* | cydra-* \
	| d10v-* | d30v-* \
	| elxsi-* \
	| f30[01]-* | f700-* | fr30-* | fx80-* \
	| h8300-* | h8500-* \
	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
	| i*86-* | i860-* | i960-* | ia64-* \
	| m32r-* \
	| m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
	| m88110-* | m88k-* | mcore-* \
	| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
	| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
	| mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
	| mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \
	| none-* | np1-* | ns16k-* | ns32k-* \
	| orion-* \
	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
	| pyramid-* \
	| romp-* | rs6000-* \
	| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
	| sparc-* | sparc64-* | sparc86x-* | sparclite-* \
	| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* \
	| t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
	| v850-* | vax-* \
	| we32k-* \
	| x86-* | x86_64-* | xmp-* | xps100-* | xscale-* | xstormy16-* \
	| ymp-* \
	| z8k-*)
		;;
	# Recognize the various machine names and aliases which stand
	# for a CPU type and a company and sometimes even an OS.
	386bsd)
		basic_machine=i386-unknown
		os=-bsd
		;;
	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
		basic_machine=m68000-att
		;;
	3b*)
		basic_machine=we32k-att
		;;
	a29khif)
		basic_machine=a29k-amd
		os=-udi
		;;
	adobe68k)
		basic_machine=m68010-adobe
		os=-scout
		;;
	alliant | fx80)
		basic_machine=fx80-alliant
		;;
	altos | altos3068)
		basic_machine=m68k-altos
		;;
	am29k)
		basic_machine=a29k-none
		os=-bsd
		;;
	amdahl)
		basic_machine=580-amdahl
		os=-sysv
		;;
	amiga | amiga-*)
		basic_machine=m68k-unknown
		;;
	amigaos | amigados)
		basic_machine=m68k-unknown
		os=-amigaos
		;;
	amigaunix | amix)
		basic_machine=m68k-unknown
		os=-sysv4
		;;
	apollo68)
		basic_machine=m68k-apollo
		os=-sysv
		;;
	apollo68bsd)
		basic_machine=m68k-apollo
		os=-bsd
		;;
	aux)
		basic_machine=m68k-apple
		os=-aux
		;;
	balance)
		basic_machine=ns32k-sequent
		os=-dynix
		;;
	convex-c1)
		basic_machine=c1-convex
		os=-bsd
		;;
	convex-c2)
		basic_machine=c2-convex
		os=-bsd
		;;
	convex-c32)
		basic_machine=c32-convex
		os=-bsd
		;;
	convex-c34)
		basic_machine=c34-convex
		os=-bsd
		;;
	convex-c38)
		basic_machine=c38-convex
		os=-bsd
		;;
	cray | ymp)
		basic_machine=ymp-cray
		os=-unicos
		;;
	cray2)
		basic_machine=cray2-cray
		os=-unicos
		;;
	[cjt]90)
		basic_machine=${basic_machine}-cray
		os=-unicos
		;;
	crds | unos)
		basic_machine=m68k-crds
		;;
	cris | cris-* | etrax*)
		basic_machine=cris-axis
		;;
	da30 | da30-*)
		basic_machine=m68k-da30
		;;
	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
		basic_machine=mips-dec
		;;
	delta | 3300 | motorola-3300 | motorola-delta \
	      | 3300-motorola | delta-motorola)
		basic_machine=m68k-motorola
		;;
	delta88)
		basic_machine=m88k-motorola
		os=-sysv3
		;;
	dpx20 | dpx20-*)
		basic_machine=rs6000-bull
		os=-bosx
		;;
	dpx2* | dpx2*-bull)
		basic_machine=m68k-bull
		os=-sysv3
		;;
	ebmon29k)
		basic_machine=a29k-amd
		os=-ebmon
		;;
	elxsi)
		basic_machine=elxsi-elxsi
		os=-bsd
		;;
	encore | umax | mmax)
		basic_machine=ns32k-encore
		;;
	es1800 | OSE68k | ose68k | ose | OSE)
		basic_machine=m68k-ericsson
		os=-ose
		;;
	fx2800)
		basic_machine=i860-alliant
		;;
	genix)
		basic_machine=ns32k-ns
		;;
	gmicro)
		basic_machine=tron-gmicro
		os=-sysv
		;;
	go32)
		basic_machine=i386-pc
		os=-go32
		;;
	h3050r* | hiux*)
		basic_machine=hppa1.1-hitachi
		os=-hiuxwe2
		;;
	h8300hms)
		basic_machine=h8300-hitachi
		os=-hms
		;;
	h8300xray)
		basic_machine=h8300-hitachi
		os=-xray
		;;
	h8500hms)
		basic_machine=h8500-hitachi
		os=-hms
		;;
	harris)
		basic_machine=m88k-harris
		os=-sysv3
		;;
	hp300-*)
		basic_machine=m68k-hp
		;;
	hp300bsd)
		basic_machine=m68k-hp
		os=-bsd
		;;
	hp300hpux)
		basic_machine=m68k-hp
		os=-hpux
		;;
	hp3k9[0-9][0-9] | hp9[0-9][0-9])
		basic_machine=hppa1.0-hp
		;;
	hp9k2[0-9][0-9] | hp9k31[0-9])
		basic_machine=m68000-hp
		;;
	hp9k3[2-9][0-9])
		basic_machine=m68k-hp
		;;
	hp9k6[0-9][0-9] | hp6[0-9][0-9])
		basic_machine=hppa1.0-hp
		;;
	hp9k7[0-79][0-9] | hp7[0-79][0-9])
		basic_machine=hppa1.1-hp
		;;
	hp9k78[0-9] | hp78[0-9])
		# FIXME: really hppa2.0-hp
		basic_machine=hppa1.1-hp
		;;
	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
		# FIXME: really hppa2.0-hp
		basic_machine=hppa1.1-hp
		;;
	hp9k8[0-9][13679] | hp8[0-9][13679])
		basic_machine=hppa1.1-hp
		;;
	hp9k8[0-9][0-9] | hp8[0-9][0-9])
		basic_machine=hppa1.0-hp
		;;
	hppa-next)
		os=-nextstep3
		;;
	hppaosf)
		basic_machine=hppa1.1-hp
		os=-osf
		;;
	hppro)
		basic_machine=hppa1.1-hp
		os=-proelf
		;;
	i370-ibm* | ibm*)
		basic_machine=i370-ibm
		;;
# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
	i*86v32)
		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
		os=-sysv32
		;;
	i*86v4*)
		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
		os=-sysv4
		;;
	i*86v)
		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
		os=-sysv
		;;
	i*86sol2)
		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
		os=-solaris2
		;;
	i386mach)
		basic_machine=i386-mach
		os=-mach
		;;
	i386-vsta | vsta)
		basic_machine=i386-unknown
		os=-vsta
		;;
	iris | iris4d)
		basic_machine=mips-sgi
		case $os in
		    -irix*)
			;;
		    *)
			os=-irix4
			;;
		esac
		;;
	isi68 | isi)
		basic_machine=m68k-isi
		os=-sysv
		;;
	m88k-omron*)
		basic_machine=m88k-omron
		;;
	magnum | m3230)
		basic_machine=mips-mips
		os=-sysv
		;;
	merlin)
		basic_machine=ns32k-utek
		os=-sysv
		;;
	mingw32)
		basic_machine=i386-pc
		os=-mingw32
		;;
	miniframe)
		basic_machine=m68000-convergent
		;;
	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
		basic_machine=m68k-atari
		os=-mint
		;;
	mipsel*-linux*)
		basic_machine=mipsel-unknown
		os=-linux-gnu
		;;
	mips*-linux*)
		basic_machine=mips-unknown
		os=-linux-gnu
		;;
	mips3*-*)
		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
		;;
	mips3*)
		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
		;;
	mmix*)
		basic_machine=mmix-knuth
		os=-mmixware
		;;
	monitor)
		basic_machine=m68k-rom68k
		os=-coff
		;;
	msdos)
		basic_machine=i386-pc
		os=-msdos
		;;
	mvs)
		basic_machine=i370-ibm
		os=-mvs
		;;
	ncr3000)
		basic_machine=i486-ncr
		os=-sysv4
		;;
	netbsd386)
		basic_machine=i386-unknown
		os=-netbsd
		;;
	netwinder)
		basic_machine=armv4l-rebel
		os=-linux
		;;
	news | news700 | news800 | news900)
		basic_machine=m68k-sony
		os=-newsos
		;;
	news1000)
		basic_machine=m68030-sony
		os=-newsos
		;;
	news-3600 | risc-news)
		basic_machine=mips-sony
		os=-newsos
		;;
	necv70)
		basic_machine=v70-nec
		os=-sysv
		;;
	next | m*-next )
		basic_machine=m68k-next
		case $os in
		    -nextstep* )
			;;
		    -ns2*)
		      os=-nextstep2
			;;
		    *)
		      os=-nextstep3
			;;
		esac
		;;
	nh3000)
		basic_machine=m68k-harris
		os=-cxux
		;;
	nh[45]000)
		basic_machine=m88k-harris
		os=-cxux
		;;
	nindy960)
		basic_machine=i960-intel
		os=-nindy
		;;
	mon960)
		basic_machine=i960-intel
		os=-mon960
		;;
	nonstopux)
		basic_machine=mips-compaq
		os=-nonstopux
		;;
	np1)
		basic_machine=np1-gould
		;;
	nsr-tandem)
		basic_machine=nsr-tandem
		;;
	op50n-* | op60c-*)
		basic_machine=hppa1.1-oki
		os=-proelf
		;;
	OSE68000 | ose68000)
		basic_machine=m68000-ericsson
		os=-ose
		;;
	os68k)
		basic_machine=m68k-none
		os=-os68k
		;;
	pa-hitachi)
		basic_machine=hppa1.1-hitachi
		os=-hiuxwe2
		;;
	paragon)
		basic_machine=i860-intel
		os=-osf
		;;
	pbd)
		basic_machine=sparc-tti
		;;
	pbb)
		basic_machine=m68k-tti
		;;
        pc532 | pc532-*)
		basic_machine=ns32k-pc532
		;;
	pentium | p5 | k5 | k6 | nexgen | viac3)
		basic_machine=i586-pc
		;;
	pentiumpro | p6 | 6x86 | athlon)
		basic_machine=i686-pc
		;;
	pentiumii | pentium2)
		basic_machine=i686-pc
		;;
	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	pentiumpro-* | p6-* | 6x86-* | athlon-*)
		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	pentiumii-* | pentium2-*)
		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	pn)
		basic_machine=pn-gould
		;;
	power)	basic_machine=power-ibm
		;;
	ppc)	basic_machine=powerpc-unknown
	        ;;
	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	ppcle | powerpclittle | ppc-le | powerpc-little)
		basic_machine=powerpcle-unknown
	        ;;
	ppcle-* | powerpclittle-*)
		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	ppc64)	basic_machine=powerpc64-unknown
	        ;;
	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
		basic_machine=powerpc64le-unknown
	        ;;
	ppc64le-* | powerpc64little-*)
		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	ps2)
		basic_machine=i386-ibm
		;;
	pw32)
		basic_machine=i586-unknown
		os=-pw32
		;;
	rom68k)
		basic_machine=m68k-rom68k
		os=-coff
		;;
	rm[46]00)
		basic_machine=mips-siemens
		;;
	rtpc | rtpc-*)
		basic_machine=romp-ibm
		;;
	s390 | s390-*)
		basic_machine=s390-ibm
		;;
	s390x | s390x-*)
		basic_machine=s390x-ibm
		;;
	sa29200)
		basic_machine=a29k-amd
		os=-udi
		;;
	sequent)
		basic_machine=i386-sequent
		;;
	sh)
		basic_machine=sh-hitachi
		os=-hms
		;;
	sparclite-wrs | simso-wrs)
		basic_machine=sparclite-wrs
		os=-vxworks
		;;
	sps7)
		basic_machine=m68k-bull
		os=-sysv2
		;;
	spur)
		basic_machine=spur-unknown
		;;
	st2000)
		basic_machine=m68k-tandem
		;;
	stratus)
		basic_machine=i860-stratus
		os=-sysv4
		;;
	sun2)
		basic_machine=m68000-sun
		;;
	sun2os3)
		basic_machine=m68000-sun
		os=-sunos3
		;;
	sun2os4)
		basic_machine=m68000-sun
		os=-sunos4
		;;
	sun3os3)
		basic_machine=m68k-sun
		os=-sunos3
		;;
	sun3os4)
		basic_machine=m68k-sun
		os=-sunos4
		;;
	sun4os3)
		basic_machine=sparc-sun
		os=-sunos3
		;;
	sun4os4)
		basic_machine=sparc-sun
		os=-sunos4
		;;
	sun4sol2)
		basic_machine=sparc-sun
		os=-solaris2
		;;
	sun3 | sun3-*)
		basic_machine=m68k-sun
		;;
	sun4)
		basic_machine=sparc-sun
		;;
	sun386 | sun386i | roadrunner)
		basic_machine=i386-sun
		;;
	sv1)
		basic_machine=sv1-cray
		os=-unicos
		;;
	symmetry)
		basic_machine=i386-sequent
		os=-dynix
		;;
	t3e)
		basic_machine=t3e-cray
		os=-unicos
		;;
	tic54x | c54x*)
		basic_machine=tic54x-unknown
		os=-coff
		;;
	tx39)
		basic_machine=mipstx39-unknown
		;;
	tx39el)
		basic_machine=mipstx39el-unknown
		;;
	tower | tower-32)
		basic_machine=m68k-ncr
		;;
	udi29k)
		basic_machine=a29k-amd
		os=-udi
		;;
	ultra3)
		basic_machine=a29k-nyu
		os=-sym1
		;;
	v810 | necv810)
		basic_machine=v810-nec
		os=-none
		;;
	vaxv)
		basic_machine=vax-dec
		os=-sysv
		;;
	vms)
		basic_machine=vax-dec
		os=-vms
		;;
	vpp*|vx|vx-*)
               basic_machine=f301-fujitsu
               ;;
	vxworks960)
		basic_machine=i960-wrs
		os=-vxworks
		;;
	vxworks68)
		basic_machine=m68k-wrs
		os=-vxworks
		;;
	vxworks29k)
		basic_machine=a29k-wrs
		os=-vxworks
		;;
	w65*)
		basic_machine=w65-wdc
		os=-none
		;;
	w89k-*)
		basic_machine=hppa1.1-winbond
		os=-proelf
		;;
	windows32)
		basic_machine=i386-pc
		os=-windows32-msvcrt
		;;
	xmp)
		basic_machine=xmp-cray
		os=-unicos
		;;
        xps | xps100)
		basic_machine=xps100-honeywell
		;;
	z8k-*-coff)
		basic_machine=z8k-unknown
		os=-sim
		;;
	none)
		basic_machine=none-none
		os=-none
		;;

# Here we handle the default manufacturer of certain CPU types.  It is in
# some cases the only manufacturer, in others, it is the most popular.
	w89k)
		basic_machine=hppa1.1-winbond
		;;
	op50n)
		basic_machine=hppa1.1-oki
		;;
	op60c)
		basic_machine=hppa1.1-oki
		;;
	mips)
		if [ x$os = x-linux-gnu ]; then
			basic_machine=mips-unknown
		else
			basic_machine=mips-mips
		fi
		;;
	romp)
		basic_machine=romp-ibm
		;;
	rs6000)
		basic_machine=rs6000-ibm
		;;
	vax)
		basic_machine=vax-dec
		;;
	pdp10)
		# there are many clones, so DEC is not a safe bet
		basic_machine=pdp10-unknown
		;;
	pdp11)
		basic_machine=pdp11-dec
		;;
	we32k)
		basic_machine=we32k-att
		;;
	sh3 | sh4 | sh3eb | sh4eb)
		basic_machine=sh-unknown
		;;
	sparc | sparcv9 | sparcv9b)
		basic_machine=sparc-sun
		;;
        cydra)
		basic_machine=cydra-cydrome
		;;
	orion)
		basic_machine=orion-highlevel
		;;
	orion105)
		basic_machine=clipper-highlevel
		;;
	mac | mpw | mac-mpw)
		basic_machine=m68k-apple
		;;
	pmac | pmac-mpw)
		basic_machine=powerpc-apple
		;;
	c4x*)
		basic_machine=c4x-none
		os=-coff
		;;
	*-unknown)
		# Make sure to match an already-canonicalized machine name.
		;;
	*)
		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
		exit 1
		;;
esac

# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
	*-digital*)
		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
		;;
	*-commodore*)
		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
		;;
	*)
		;;
esac

# Decode manufacturer-specific aliases for certain operating systems.

if [ x"$os" != x"" ]
then
case $os in
        # First match some system type aliases
        # that might get confused with valid system types.
	# -solaris* is a basic system type, with this one exception.
	-solaris1 | -solaris1.*)
		os=`echo $os | sed -e 's|solaris1|sunos4|'`
		;;
	-solaris)
		os=-solaris2
		;;
	-svr4*)
		os=-sysv4
		;;
	-unixware*)
		os=-sysv4.2uw
		;;
	-gnu/linux*)
		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
		;;
	# First accept the basic system types.
	# The portable systems comes first.
	# Each alternative MUST END IN A *, to match a version number.
	# -sysv* is not here because it comes later, after sysvr4.
	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
	      | -aos* \
	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
	      | -chorusos* | -chorusrdb* \
	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
	      | -os2* | -vos* | -palmos* | -uclinux*)
	# Remember, each alternative MUST END IN *, to match a version number.
		;;
	-qnx*)
		case $basic_machine in
		    x86-* | i*86-*)
			;;
		    *)
			os=-nto$os
			;;
		esac
		;;
	-nto*)
		os=-nto-qnx
		;;
	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
		;;
	-mac*)
		os=`echo $os | sed -e 's|mac|macos|'`
		;;
	-linux*)
		os=`echo $os | sed -e 's|linux|linux-gnu|'`
		;;
	-sunos5*)
		os=`echo $os | sed -e 's|sunos5|solaris2|'`
		;;
	-sunos6*)
		os=`echo $os | sed -e 's|sunos6|solaris3|'`
		;;
	-opened*)
		os=-openedition
		;;
	-wince*)
		os=-wince
		;;
	-osfrose*)
		os=-osfrose
		;;
	-osf*)
		os=-osf
		;;
	-utek*)
		os=-bsd
		;;
	-dynix*)
		os=-bsd
		;;
	-acis*)
		os=-aos
		;;
	-386bsd)
		os=-bsd
		;;
	-ctix* | -uts*)
		os=-sysv
		;;
	-ns2 )
	        os=-nextstep2
		;;
	-nsk*)
		os=-nsk
		;;
	# Preserve the version number of sinix5.
	-sinix5.*)
		os=`echo $os | sed -e 's|sinix|sysv|'`
		;;
	-sinix*)
		os=-sysv4
		;;
	-triton*)
		os=-sysv3
		;;
	-oss*)
		os=-sysv3
		;;
	-svr4)
		os=-sysv4
		;;
	-svr3)
		os=-sysv3
		;;
	-sysvr4)
		os=-sysv4
		;;
	# This must come after -sysvr4.
	-sysv*)
		;;
	-ose*)
		os=-ose
		;;
	-es1800*)
		os=-ose
		;;
	-xenix)
		os=-xenix
		;;
        -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
	        os=-mint
		;;
	-none)
		;;
	*)
		# Get rid of the `-' at the beginning of $os.
		os=`echo $os | sed 's/[^-]*-//'`
		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
		exit 1
		;;
esac
else

# Here we handle the default operating systems that come with various machines.
# The value should be what the vendor currently ships out the door with their
# machine or put another way, the most popular os provided with the machine.

# Note that if you're going to try to match "-MANUFACTURER" here (say,
# "-sun"), then you have to tell the case statement up towards the top
# that MANUFACTURER isn't an operating system.  Otherwise, code above
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.

case $basic_machine in
	*-acorn)
		os=-riscix1.2
		;;
	arm*-rebel)
		os=-linux
		;;
	arm*-semi)
		os=-aout
		;;
	pdp10-*)
		os=-tops20
		;;
        pdp11-*)
		os=-none
		;;
	*-dec | vax-*)
		os=-ultrix4.2
		;;
	m68*-apollo)
		os=-domain
		;;
	i386-sun)
		os=-sunos4.0.2
		;;
	m68000-sun)
		os=-sunos3
		# This also exists in the configure program, but was not the
		# default.
		# os=-sunos4
		;;
	m68*-cisco)
		os=-aout
		;;
	mips*-cisco)
		os=-elf
		;;
	mips*-*)
		os=-elf
		;;
	*-tti)	# must be before sparc entry or we get the wrong os.
		os=-sysv3
		;;
	sparc-* | *-sun)
		os=-sunos4.1.1
		;;
	*-be)
		os=-beos
		;;
	*-ibm)
		os=-aix
		;;
	*-wec)
		os=-proelf
		;;
	*-winbond)
		os=-proelf
		;;
	*-oki)
		os=-proelf
		;;
	*-hp)
		os=-hpux
		;;
	*-hitachi)
		os=-hiux
		;;
	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
		os=-sysv
		;;
	*-cbm)
		os=-amigaos
		;;
	*-dg)
		os=-dgux
		;;
	*-dolphin)
		os=-sysv3
		;;
	m68k-ccur)
		os=-rtu
		;;
	m88k-omron*)
		os=-luna
		;;
	*-next )
		os=-nextstep
		;;
	*-sequent)
		os=-ptx
		;;
	*-crds)
		os=-unos
		;;
	*-ns)
		os=-genix
		;;
	i370-*)
		os=-mvs
		;;
	*-next)
		os=-nextstep3
		;;
        *-gould)
		os=-sysv
		;;
        *-highlevel)
		os=-bsd
		;;
	*-encore)
		os=-bsd
		;;
        *-sgi)
		os=-irix
		;;
        *-siemens)
		os=-sysv4
		;;
	*-masscomp)
		os=-rtu
		;;
	f30[01]-fujitsu | f700-fujitsu)
		os=-uxpv
		;;
	*-rom68k)
		os=-coff
		;;
	*-*bug)
		os=-coff
		;;
	*-apple)
		os=-macos
		;;
	*-atari*)
		os=-mint
		;;
	*)
		os=-none
		;;
esac
fi

# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer.  We pick the logical manufacturer.
vendor=unknown
case $basic_machine in
	*-unknown)
		case $os in
			-riscix*)
				vendor=acorn
				;;
			-sunos*)
				vendor=sun
				;;
			-aix*)
				vendor=ibm
				;;
			-beos*)
				vendor=be
				;;
			-hpux*)
				vendor=hp
				;;
			-mpeix*)
				vendor=hp
				;;
			-hiux*)
				vendor=hitachi
				;;
			-unos*)
				vendor=crds
				;;
			-dgux*)
				vendor=dg
				;;
			-luna*)
				vendor=omron
				;;
			-genix*)
				vendor=ns
				;;
			-mvs* | -opened*)
				vendor=ibm
				;;
			-ptx*)
				vendor=sequent
				;;
			-vxsim* | -vxworks*)
				vendor=wrs
				;;
			-aux*)
				vendor=apple
				;;
			-hms*)
				vendor=hitachi
				;;
			-mpw* | -macos*)
				vendor=apple
				;;
			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
				vendor=atari
				;;
			-vos*)
				vendor=stratus
				;;
		esac
		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
		;;
esac

echo $basic_machine$os
exit 0

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:


================================================
FILE: configure
================================================
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##

# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
  emulate sh
  NULLCMD=:
  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
  # is contrary to our usage.  Disable this feature.
  alias -g '${1+"$@"}'='"$@"'
  setopt NO_GLOB_SUBST
else
  case `(set -o) 2>/dev/null` in #(
  *posix*) :
    set -o posix ;; #(
  *) :
     ;;
esac
fi


as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
  as_echo='print -r --'
  as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
  as_echo='printf %s\n'
  as_echo_n='printf %s'
else
  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
    as_echo_n='/usr/ucb/echo -n'
  else
    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
    as_echo_n_body='eval
      arg=$1;
      case $arg in #(
      *"$as_nl"*)
	expr "X$arg" : "X\\(.*\\)$as_nl";
	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
      esac;
      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
    '
    export as_echo_n_body
    as_echo_n='sh -c $as_echo_n_body as_echo'
  fi
  export as_echo_body
  as_echo='sh -c $as_echo_body as_echo'
fi

# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
  PATH_SEPARATOR=:
  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
      PATH_SEPARATOR=';'
  }
fi


# IFS
# We need space, tab and new line, in precisely that order.  Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" ""	$as_nl"

# Find who we are.  Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
  *[\\/]* ) as_myself=$0 ;;
  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
  done
IFS=$as_save_IFS

     ;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
  as_myself=$0
fi
if test ! -f "$as_myself"; then
  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
  exit 1
fi

# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there.  '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '

# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE

# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH

# Use a proper internal environment variable to ensure we don't fall
  # into an infinite loop, continuously re-executing ourselves.
  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
    _as_can_reexec=no; export _as_can_reexec;
    # We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
  *v*x* | *x*v* ) as_opts=-vx ;;
  *v* ) as_opts=-v ;;
  *x* ) as_opts=-x ;;
  * ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
as_fn_exit 255
  fi
  # We don't want this to propagate to other subprocesses.
          { _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
  emulate sh
  NULLCMD=:
  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
  # is contrary to our usage.  Disable this feature.
  alias -g '\${1+\"\$@\"}'='\"\$@\"'
  setopt NO_GLOB_SUBST
else
  case \`(set -o) 2>/dev/null\` in #(
  *posix*) :
    set -o posix ;; #(
  *) :
     ;;
esac
fi
"
  as_required="as_fn_return () { (exit \$1); }
as_fn_success () { as_fn_return 0; }
as_fn_failure () { as_fn_return 1; }
as_fn_ret_success () { return 0; }
as_fn_ret_failure () { return 1; }

exitcode=0
as_fn_success || { exitcode=1; echo as_fn_success failed.; }
as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :

else
  exitcode=1; echo positional parameters were not saved.
fi
test x\$exitcode = x0 || exit 1
test -x / || exit 1"
  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
test \$(( 1 + 1 )) = 2 || exit 1"
  if (eval "$as_required") 2>/dev/null; then :
  as_have_required=yes
else
  as_have_required=no
fi
  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :

else
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_found=false
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  as_found=:
  case $as_dir in #(
	 /*)
	   for as_base in sh bash ksh sh5; do
	     # Try only shells that exist, to save several forks.
	     as_shell=$as_dir/$as_base
	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
  CONFIG_SHELL=$as_shell as_have_required=yes
		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
  break 2
fi
fi
	   done;;
       esac
  as_found=false
done
$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
  CONFIG_SHELL=$SHELL as_have_required=yes
fi; }
IFS=$as_save_IFS


      if test "x$CONFIG_SHELL" != x; then :
  export CONFIG_SHELL
             # We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
  *v*x* | *x*v* ) as_opts=-vx ;;
  *v* ) as_opts=-v ;;
  *x* ) as_opts=-x ;;
  * ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi

    if test x$as_have_required = xno; then :
  $as_echo "$0: This script requires a shell more modern than all"
  $as_echo "$0: the shells that I found on your system."
  if test x${ZSH_VERSION+set} = xset ; then
    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
  else
    $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
$0: including any error possibly output before this
$0: message. Then install a modern shell, or manually run
$0: the script under such a shell if you do have one."
  fi
  exit 1
fi
fi
fi
SHELL=${CONFIG_SHELL-/bin/sh}
export SHELL
# Unset more variables known to interfere with behavior of common tools.
CLICOLOR_FORCE= GREP_OPTIONS=
unset CLICOLOR_FORCE GREP_OPTIONS

## --------------------- ##
## M4sh Shell Functions. ##
## --------------------- ##
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
  { eval $1=; unset $1;}
}
as_unset=as_fn_unset

# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
  return $1
} # as_fn_set_status

# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
  set +e
  as_fn_set_status $1
  exit $1
} # as_fn_exit

# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{

  case $as_dir in #(
  -*) as_dir=./$as_dir;;
  esac
  test -d "$as_dir" || eval $as_mkdir_p || {
    as_dirs=
    while :; do
      case $as_dir in #(
      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
      *) as_qdir=$as_dir;;
      esac
      as_dirs="'$as_qdir' $as_dirs"
      as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$as_dir" : 'X\(//\)[^/]' \| \
	 X"$as_dir" : 'X\(//\)$' \| \
	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)[^/].*/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\).*/{
	    s//\1/
	    q
	  }
	  s/.*/./; q'`
      test -d "$as_dir" && break
    done
    test -z "$as_dirs" || eval "mkdir $as_dirs"
  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"


} # as_fn_mkdir_p

# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
  test -f "$1" && test -x "$1"
} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
  eval 'as_fn_append ()
  {
    eval $1+=\$2
  }'
else
  as_fn_append ()
  {
    eval $1=\$$1\$2
  }
fi # as_fn_append

# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
  eval 'as_fn_arith ()
  {
    as_val=$(( $* ))
  }'
else
  as_fn_arith ()
  {
    as_val=`expr "$@" || test $? -eq 1`
  }
fi # as_fn_arith


# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
  as_status=$1; test $as_status -eq 0 && as_status=1
  if test "$4"; then
    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
  fi
  $as_echo "$as_me: error: $2" >&2
  as_fn_exit $as_status
} # as_fn_error

if expr a : '\(a\)' >/dev/null 2>&1 &&
   test "X`expr 00001 : '.*\(...\)'`" = X001; then
  as_expr=expr
else
  as_expr=false
fi

if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
  as_basename=basename
else
  as_basename=false
fi

if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
  as_dirname=dirname
else
  as_dirname=false
fi

as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
	 X"$0" : 'X\(//\)$' \| \
	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X/"$0" |
    sed '/^.*\/\([^/][^/]*\)\/*$/{
	    s//\1/
	    q
	  }
	  /^X\/\(\/\/\)$/{
	    s//\1/
	    q
	  }
	  /^X\/\(\/\).*/{
	    s//\1/
	    q
	  }
	  s/.*/./; q'`

# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits


  as_lineno_1=$LINENO as_lineno_1a=$LINENO
  as_lineno_2=$LINENO as_lineno_2a=$LINENO
  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
  sed -n '
    p
    /[$]LINENO/=
  ' <$as_myself |
    sed '
      s/[$]LINENO.*/&-/
      t lineno
      b
      :lineno
      N
      :loop
      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
      t loop
      s/-\n.*//
    ' >$as_me.lineno &&
  chmod +x "$as_me.lineno" ||
    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }

  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
  # already done that, so ensure we don't try to do so again and fall
  # in an infinite loop.  This has already happened in practice.
  _as_can_reexec=no; export _as_can_reexec
  # Don't try to exec as it changes $[0], causing all sort of problems
  # (the dirname of $[0] is not the place where we might find the
  # original and so on.  Autoconf is especially sensitive to this).
  . "./$as_me.lineno"
  # Exit status is that of the last command.
  exit
}

ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
  case `echo 'xy\c'` in
  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
  xy)  ECHO_C='\c';;
  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
       ECHO_T='	';;
  esac;;
*)
  ECHO_N='-n';;
esac

rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
  rm -f conf$$.dir/conf$$.file
else
  rm -f conf$$.dir
  mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
  if ln -s conf$$.file conf$$ 2>/dev/null; then
    as_ln_s='ln -s'
    # ... but there are two gotchas:
    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
    # In both cases, we have to default to `cp -pR'.
    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
      as_ln_s='cp -pR'
  elif ln conf$$.file conf$$ 2>/dev/null; then
    as_ln_s=ln
  else
    as_ln_s='cp -pR'
  fi
else
  as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null

if mkdir -p . 2>/dev/null; then
  as_mkdir_p='mkdir -p "$as_dir"'
else
  test -d ./-p && rmdir ./-p
  as_mkdir_p=false
fi

as_test_x='test -x'
as_executable_p=as_fn_executable_p

# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"

# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"


test -n "$DJDIR" || exec 7<&0 </dev/null
exec 6>&1

# Name of the host.
# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`

#
# Initializations.
#
ac_default_prefix=/usr/local
ac_clean_files=
ac_config_libobj_dir=.
LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=

# Identity of this package.
PACKAGE_NAME=
PACKAGE_TARNAME=
PACKAGE_VERSION=
PACKAGE_STRING=
PACKAGE_BUGREPORT=
PACKAGE_URL=

ac_unique_file="lib.c"
# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# ifdef HAVE_STDLIB_H
#  include <stdlib.h>
# endif
#endif
#ifdef HAVE_STRING_H
# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
#  include <memory.h>
# endif
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif"

ac_subst_vars='LTLIBOBJS
LIBOBJS
EGREP
GREP
CPP
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
LEXLIB
OBJEXT
EXEEXT
ac_ct_CC
CPPFLAGS
LDFLAGS
CFLAGS
CC
LEX_OUTPUT_ROOT
LEX
YFLAGS
YACC
target_os
target_vendor
target_cpu
target
host_os
host_vendor
host_cpu
host
build_os
build_vendor
build_cpu
build
target_alias
host_alias
build_alias
LIBS
ECHO_T
ECHO_N
ECHO_C
DEFS
mandir
localedir
libdir
psdir
pdfdir
dvidir
htmldir
infodir
docdir
oldincludedir
includedir
localstatedir
sharedstatedir
sysconfdir
datadir
datarootdir
libexecdir
sbindir
bindir
program_transform_name
prefix
exec_prefix
PACKAGE_URL
PACKAGE_BUGREPORT
PACKAGE_STRING
PACKAGE_VERSION
PACKAGE_TARNAME
PACKAGE_NAME
PATH_SEPARATOR
SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_o3
enable_sum_send
enable_mark
enable_syslog
enable_low_mem
enable_json
enable_debugg
enable_self_testing
enable_client_only
with_ssl_headers
with_ssl_lib
with_lzo_headers
with_lzo_lib
with_blowfish_headers
with_socks_lib
'
      ac_precious_vars='build_alias
host_alias
target_alias
YACC
YFLAGS
CC
CFLAGS
LDFLAGS
LIBS
CPPFLAGS
CPP'


# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
ac_unrecognized_opts=
ac_unrecognized_sep=
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE

# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datarootdir='${prefix}/share'
datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE}'
infodir='${datarootdir}/info'
htmldir='${docdir}'
dvidir='${docdir}'
pdfdir='${docdir}'
psdir='${docdir}'
libdir='${exec_prefix}/lib'
localedir='${datarootdir}/locale'
mandir='${datarootdir}/man'

ac_prev=
ac_dashdash=
for ac_option
do
  # If the previous option needs an argument, assign it.
  if test -n "$ac_prev"; then
    eval $ac_prev=\$ac_option
    ac_prev=
    continue
  fi

  case $ac_option in
  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
  *=)   ac_optarg= ;;
  *)    ac_optarg=yes ;;
  esac

  # Accept the important Cygnus configure options, so we can diagnose typos.

  case $ac_dashdash$ac_option in
  --)
    ac_dashdash=yes ;;

  -bindir | --bindir | --bindi | --bind | --bin | --bi)
    ac_prev=bindir ;;
  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
    bindir=$ac_optarg ;;

  -build | --build | --buil | --bui | --bu)
    ac_prev=build_alias ;;
  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
    build_alias=$ac_optarg ;;

  -cache-file | --cache-file | --cache-fil | --cache-fi \
  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
    ac_prev=cache_file ;;
  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
    cache_file=$ac_optarg ;;

  --config-cache | -C)
    cache_file=config.cache ;;

  -datadir | --datadir | --datadi | --datad)
    ac_prev=datadir ;;
  -datadir=* | --datadir=* | --datadi=* | --datad=*)
    datadir=$ac_optarg ;;

  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
  | --dataroo | --dataro | --datar)
    ac_prev=datarootdir ;;
  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
    datarootdir=$ac_optarg ;;

  -disable-* | --disable-*)
    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
    # Reject names that are not valid shell variable names.
    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
      as_fn_error $? "invalid feature name: $ac_useropt"
    ac_useropt_orig=$ac_useropt
    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
    case $ac_user_opts in
      *"
"enable_$ac_useropt"
"*) ;;
      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
	 ac_unrecognized_sep=', ';;
    esac
    eval enable_$ac_useropt=no ;;

  -docdir | --docdir | --docdi | --doc | --do)
    ac_prev=docdir ;;
  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
    docdir=$ac_optarg ;;

  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
    ac_prev=dvidir ;;
  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
    dvidir=$ac_optarg ;;

  -enable-* | --enable-*)
    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
    # Reject names that are not valid shell variable names.
    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
      as_fn_error $? "invalid feature name: $ac_useropt"
    ac_useropt_orig=$ac_useropt
    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
    case $ac_user_opts in
      *"
"enable_$ac_useropt"
"*) ;;
      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
	 ac_unrecognized_sep=', ';;
    esac
    eval enable_$ac_useropt=\$ac_optarg ;;

  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
  | --exec | --exe | --ex)
    ac_prev=exec_prefix ;;
  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
  | --exec=* | --exe=* | --ex=*)
    exec_prefix=$ac_optarg ;;

  -gas | --gas | --ga | --g)
    # Obsolete; use --with-gas.
    with_gas=yes ;;

  -help | --help | --hel | --he | -h)
    ac_init_help=long ;;
  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
    ac_init_help=recursive ;;
  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
    ac_init_help=short ;;

  -host | --host | --hos | --ho)
    ac_prev=host_alias ;;
  -host=* | --host=* | --hos=* | --ho=*)
    host_alias=$ac_optarg ;;

  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
    ac_prev=htmldir ;;
  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
  | --ht=*)
    htmldir=$ac_optarg ;;

  -includedir | --includedir | --includedi | --included | --include \
  | --includ | --inclu | --incl | --inc)
    ac_prev=includedir ;;
  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
  | --includ=* | --inclu=* | --incl=* | --inc=*)
    includedir=$ac_optarg ;;

  -infodir | --infodir | --infodi | --infod | --info | --inf)
    ac_prev=infodir ;;
  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
    infodir=$ac_optarg ;;

  -libdir | --libdir | --libdi | --libd)
    ac_prev=libdir ;;
  -libdir=* | --libdir=* | --libdi=* | --libd=*)
    libdir=$ac_optarg ;;

  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
  | --libexe | --libex | --libe)
    ac_prev=libexecdir ;;
  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
  | --libexe=* | --libex=* | --libe=*)
    libexecdir=$ac_optarg ;;

  -localedir | --localedir | --localedi | --localed | --locale)
    ac_prev=localedir ;;
  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
    localedir=$ac_optarg ;;

  -localstatedir | --localstatedir | --localstatedi | --localstated \
  | --localstate | --localstat | --localsta | --localst | --locals)
    ac_prev=localstatedir ;;
  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
    localstatedir=$ac_optarg ;;

  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
    ac_prev=mandir ;;
  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
    mandir=$ac_optarg ;;

  -nfp | --nfp | --nf)
    # Obsolete; use --without-fp.
    with_fp=no ;;

  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  | --no-cr | --no-c | -n)
    no_create=yes ;;

  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
    no_recursion=yes ;;

  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
  | --oldin | --oldi | --old | --ol | --o)
    ac_prev=oldincludedir ;;
  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
    oldincludedir=$ac_optarg ;;

  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
    ac_prev=prefix ;;
  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
    prefix=$ac_optarg ;;

  -program-prefix | --program-prefix | --program-prefi | --program-pref \
  | --program-pre | --program-pr | --program-p)
    ac_prev=program_prefix ;;
  -program-prefix=* | --program-prefix=* | --program-prefi=* \
  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
    program_prefix=$ac_optarg ;;

  -program-suffix | --program-suffix | --program-suffi | --program-suff \
  | --program-suf | --program-su | --program-s)
    ac_prev=program_suffix ;;
  -program-suffix=* | --program-suffix=* | --program-suffi=* \
  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
    program_suffix=$ac_optarg ;;

  -program-transform-name | --program-transform-name \
  | --program-transform-nam | --program-transform-na \
  | --program-transform-n | --program-transform- \
  | --program-transform | --program-transfor \
  | --program-transfo | --program-transf \
  | --program-trans | --program-tran \
  | --progr-tra | --program-tr | --program-t)
    ac_prev=program_transform_name ;;
  -program-transform-name=* | --program-transform-name=* \
  | --program-transform-nam=* | --program-transform-na=* \
  | --program-transform-n=* | --program-transform-=* \
  | --program-transform=* | --program-transfor=* \
  | --program-transfo=* | --program-transf=* \
  | --program-trans=* | --program-tran=* \
  | --progr-tra=* | --program-tr=* | --program-t=*)
    program_transform_name=$ac_optarg ;;

  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
    ac_prev=pdfdir ;;
  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
    pdfdir=$ac_optarg ;;

  -psdir | --psdir | --psdi | --psd | --ps)
    ac_prev=psdir ;;
  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
    psdir=$ac_optarg ;;

  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
  | -silent | --silent | --silen | --sile | --sil)
    silent=yes ;;

  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
    ac_prev=sbindir ;;
  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
  | --sbi=* | --sb=*)
    sbindir=$ac_optarg ;;

  -sharedstatedir | --sharedstatedir | --sharedstatedi \
  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
  | --sharedst | --shareds | --shared | --share | --shar \
  | --sha | --sh)
    ac_prev=sharedstatedir ;;
  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
  | --sha=* | --sh=*)
    sharedstatedir=$ac_optarg ;;

  -site | --site | --sit)
    ac_prev=site ;;
  -site=* | --site=* | --sit=*)
    site=$ac_optarg ;;

  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
    ac_prev=srcdir ;;
  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
    srcdir=$ac_optarg ;;

  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
  | --syscon | --sysco | --sysc | --sys | --sy)
    ac_prev=sysconfdir ;;
  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
    sysconfdir=$ac_optarg ;;

  -target | --target | --targe | --targ | --tar | --ta | --t)
    ac_prev=target_alias ;;
  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
    target_alias=$ac_optarg ;;

  -v | -verbose | --verbose | --verbos | --verbo | --verb)
    verbose=yes ;;

  -version | --version | --versio | --versi | --vers | -V)
    ac_init_version=: ;;

  -with-* | --with-*)
    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
    # Reject names that are not valid shell variable names.
    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
      as_fn_error $? "invalid package name: $ac_useropt"
    ac_useropt_orig=$ac_useropt
    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
    case $ac_user_opts in
      *"
"with_$ac_useropt"
"*) ;;
      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
	 ac_unrecognized_sep=', ';;
    esac
    eval with_$ac_useropt=\$ac_optarg ;;

  -without-* | --without-*)
    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
    # Reject names that are not valid shell variable names.
    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
      as_fn_error $? "invalid package name: $ac_useropt"
    ac_useropt_orig=$ac_useropt
    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
    case $ac_user_opts in
      *"
"with_$ac_useropt"
"*) ;;
      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
	 ac_unrecognized_sep=', ';;
    esac
    eval with_$ac_useropt=no ;;

  --x)
    # Obsolete; use --with-x.
    with_x=yes ;;

  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
  | --x-incl | --x-inc | --x-in | --x-i)
    ac_prev=x_includes ;;
  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
    x_includes=$ac_optarg ;;

  -x-libraries | --x-libraries | --x-librarie | --x-librari \
  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
    ac_prev=x_libraries ;;
  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
    x_libraries=$ac_optarg ;;

  -*) as_fn_error $? "unrecognized option: \`$ac_option'
Try \`$0 --help' for more information"
    ;;

  *=*)
    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
    # Reject names that are not valid shell variable names.
    case $ac_envvar in #(
      '' | [0-9]* | *[!_$as_cr_alnum]* )
      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
    esac
    eval $ac_envvar=\$ac_optarg
    export $ac_envvar ;;

  *)
    # FIXME: should be removed in autoconf 3.0.
    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
    ;;

  esac
done

if test -n "$ac_prev"; then
  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
  as_fn_error $? "missing argument to $ac_option"
fi

if test -n "$ac_unrecognized_opts"; then
  case $enable_option_checking in
    no) ;;
    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
  esac
fi

# Check all directory arguments for consistency.
for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
		datadir sysconfdir sharedstatedir localstatedir includedir \
		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
		libdir localedir mandir
do
  eval ac_val=\$$ac_var
  # Remove trailing slashes.
  case $ac_val in
    */ )
      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
      eval $ac_var=\$ac_val;;
  esac
  # Be sure to have absolute directory names.
  case $ac_val in
    [\\/$]* | ?:[\\/]* )  continue;;
    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
  esac
  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done

# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias

# FIXME: To remove some day.
if test "x$host_alias" != x; then
  if test "x$build_alias" = x; then
    cross_compiling=maybe
  elif test "x$build_alias" != "x$host_alias"; then
    cross_compiling=yes
  fi
fi

ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-

test "$silent" = yes && exec 6>/dev/null


ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
  as_fn_error $? "working directory cannot be determined"
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
  as_fn_error $? "pwd does not report name of working directory"


# Find the source files, if location was not specified.
if test -z "$srcdir"; then
  ac_srcdir_defaulted=yes
  # Try the directory containing this script, then the parent directory.
  ac_confdir=`$as_dirname -- "$as_myself" ||
$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$as_myself" : 'X\(//\)[^/]' \| \
	 X"$as_myself" : 'X\(//\)$' \| \
	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_myself" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)[^/].*/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\).*/{
	    s//\1/
	    q
	  }
	  s/.*/./; q'`
  srcdir=$ac_confdir
  if test ! -r "$srcdir/$ac_unique_file"; then
    srcdir=..
  fi
else
  ac_srcdir_defaulted=no
fi
if test ! -r "$srcdir/$ac_unique_file"; then
  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
	pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
  srcdir=.
fi
# Remove unnecessary trailing slashes from srcdir.
# Double slashes in file names in object file debugging info
# mess up M-x gdb in Emacs.
case $srcdir in
*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
esac
for ac_var in $ac_precious_vars; do
  eval ac_env_${ac_var}_set=\${${ac_var}+set}
  eval ac_env_${ac_var}_value=\$${ac_var}
  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
  eval ac_cv_env_${ac_var}_value=\$${ac_var}
done

#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
  # Omit some internal or obsolete options to make the list less imposing.
  # This message is too long to be a string in the A/UX 3.1 sh.
  cat <<_ACEOF
\`configure' configures this package to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print \`checking ...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for \`--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or \`..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [$ac_default_prefix]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
an installation prefix other than \`$ac_default_prefix' using \`--prefix',
for instance \`--prefix=\$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR            user executables [EPREFIX/bin]
  --sbindir=DIR           system admin executables [EPREFIX/sbin]
  --libexecdir=DIR        program executables [EPREFIX/libexec]
  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
  --libdir=DIR            object code libraries [EPREFIX/lib]
  --includedir=DIR        C header files [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  --datarootdir=DIR       read-only arch.-independent data root [P
Download .txt
gitextract_sxebwusu/

├── .travis.yml
├── Credits
├── INSTALL
├── LICENSE
├── Makefile.in
├── README.md
├── aclocal.m4
├── auth.c
├── auth.h
├── cfg_file.l
├── cfg_file.y
├── cfg_kwords.h
├── client.c
├── compat.h
├── config.guess
├── config.h.in
├── config.sub
├── configure
├── configure.in
├── const.h
├── debian/
│   ├── changelog
│   ├── compat
│   ├── control
│   ├── copyright
│   ├── docs
│   ├── logrotate
│   ├── postinst
│   ├── postrm
│   ├── prerm
│   ├── rules
│   ├── source/
│   │   └── format
│   └── vtrunkd2.substvars
├── defines.h
├── driver.h
├── frame_llist.c
├── frame_llist.h
├── generic/
│   ├── pipe_dev.c
│   ├── pty_dev.c
│   ├── tap_dev.c
│   ├── tcp_proto.c
│   ├── tun_dev.c
│   └── udp_proto.c
├── install-sh
├── lfd_encrypt.c
├── lfd_lzo.c
├── lfd_shaper.c
├── lfd_zlib.c
├── lib.c
├── lib.h
├── linkfd.c
├── linkfd.h
├── linux/
│   ├── tap_dev.c
│   └── tun_dev.c
├── llist.c
├── llist.h
├── lock.c
├── lock.h
├── log.c
├── log.h
├── main.c
├── net_structs.h
├── netlib.c
├── netlib.h
├── netlink_socket_info.c
├── netlink_socket_info.h
├── packages/
│   ├── openwrt/
│   │   └── Makefile
│   ├── os-jessie/
│   │   ├── Dockerfile
│   │   ├── debian/
│   │   │   ├── changelog
│   │   │   ├── compat
│   │   │   ├── control
│   │   │   ├── copyright
│   │   │   ├── docs
│   │   │   ├── files
│   │   │   ├── init.d.ex
│   │   │   ├── logrotate
│   │   │   ├── postinst.ex
│   │   │   ├── postrm.ex
│   │   │   ├── rules
│   │   │   ├── source/
│   │   │   │   └── format
│   │   │   └── vtrunkd2.substvars
│   │   └── sources.list
│   ├── os-trusty/
│   │   ├── Dockerfile
│   │   └── debian/
│   │       ├── changelog
│   │       ├── compat
│   │       ├── control
│   │       ├── copyright
│   │       ├── docs
│   │       ├── files
│   │       ├── init.d.ex
│   │       ├── logrotate
│   │       ├── postinst.ex
│   │       ├── postrm.ex
│   │       ├── rules
│   │       ├── source/
│   │       │   └── format
│   │       └── vtrunkd2.substvars
│   ├── os-vivid/
│   │   ├── Dockerfile
│   │   ├── debian/
│   │   │   ├── changelog
│   │   │   ├── compat
│   │   │   ├── control
│   │   │   ├── copyright
│   │   │   ├── docs
│   │   │   ├── files
│   │   │   ├── init.d.ex
│   │   │   ├── logrotate
│   │   │   ├── postinst.ex
│   │   │   ├── postrm.ex
│   │   │   ├── rules
│   │   │   ├── source/
│   │   │   │   └── format
│   │   │   └── vtrunkd2.substvars
│   │   └── sources.list
│   ├── os-wheezy/
│   │   ├── Dockerfile
│   │   ├── debian/
│   │   │   ├── changelog
│   │   │   ├── compat
│   │   │   ├── control
│   │   │   ├── copyright
│   │   │   ├── docs
│   │   │   ├── files
│   │   │   ├── init.d.ex
│   │   │   ├── logrotate
│   │   │   ├── postinst.ex
│   │   │   ├── postrm.ex
│   │   │   ├── rules
│   │   │   ├── source/
│   │   │   │   └── format
│   │   │   └── vtrunkd2.substvars
│   │   └── sources.list
│   └── os-wily/
│       ├── Dockerfile
│       ├── debian/
│       │   ├── changelog
│       │   ├── compat
│       │   ├── control
│       │   ├── copyright
│       │   ├── docs
│       │   ├── files
│       │   ├── init.d.ex
│       │   ├── logrotate
│       │   ├── postinst.ex
│       │   ├── postrm.ex
│       │   ├── rules
│       │   ├── source/
│       │   │   └── format
│       │   └── vtrunkd2.substvars
│       └── sources.list
├── packet_code.c
├── packet_code.h
├── pid.c
├── pid.h
├── pre-commit
├── scripts/
│   ├── reroute
│   ├── rmtree.sh
│   ├── vtund-start.conf
│   ├── vtund.rc.debian
│   ├── vtund.rc.red_hat
│   ├── vtund.rc.suse
│   ├── vtund.rc.suse.config
│   └── vtund.xinetd
├── server.c
├── speed_algo.c
├── speed_algo.h
├── svr4/
│   ├── tap_dev.c
│   └── tun_dev.c
├── test/
│   └── lossed.c
├── timer.c
├── timer.h
├── tunnel.c
├── udp_states.c
├── udp_states.h
├── v_struct.h
├── version.h
├── vtrunkd.8
├── vtrunkd.conf
├── vtrunkd.conf.5
├── vtrunkd_client.conf
├── vtun.drivers
├── vtun.h
└── vtun_socks.h
Download .txt
SYMBOL INDEX (418 symbols across 50 files)

FILE: auth.c
  function gen_chal (line 69) | void gen_chal(char *buf)
  function encrypt_chal (line 74) | void encrypt_chal(char *chal, char *pwd)
  function decrypt_chal (line 85) | void decrypt_chal(char *chal, char *pwd)
  function encrypt_chal (line 98) | void encrypt_chal(char *chal, char *pwd)
  function decrypt_chal (line 107) | void decrypt_chal(char *chal, char *pwd)
  function gen_chal (line 113) | void gen_chal(char *buf)
  type vtun_host (line 130) | struct vtun_host
  function cf2bf (line 186) | int cf2bf(char *str, struct vtun_host *host)
  function cs2cl (line 281) | int cs2cl(char *str, char *chal)
  type vtun_host (line 301) | struct vtun_host
  type vtun_host (line 305) | struct vtun_host
  function auth_client (line 385) | int auth_client(int fd, struct vtun_host *host, int * reason)

FILE: auth.h
  type vtun_host (line 30) | struct vtun_host
  type vtun_host (line 31) | struct vtun_host

FILE: cfg_kwords.h
  type kword (line 26) | struct kword {
  type kword (line 31) | struct kword
  type kword (line 95) | struct kword

FILE: client.c
  function sig_term (line 72) | static void sig_term(int sig)
  function client (line 97) | void client(struct vtun_host *host)

FILE: frame_llist.c
  function frame_llist_init (line 33) | void frame_llist_init(struct frame_llist *l) {
  function frame_llist_fill (line 39) | void frame_llist_fill(struct frame_llist *l, struct frame_seq flist[], i...
  function frame_llist_empty (line 53) | int frame_llist_empty(struct frame_llist *l)
  function frame_llist_pull (line 59) | int frame_llist_pull(struct frame_llist *lfree, struct frame_seq flist[]...
  function frame_llist_append (line 73) | void frame_llist_append(struct frame_llist *l, int f, struct frame_seq b...
  function frame_llist_prepend (line 85) | void frame_llist_prepend(struct frame_llist *l, int f, struct frame_seq ...
  function frame_llist_free (line 98) | int frame_llist_free(struct frame_llist *l, struct frame_llist *lfree, s...

FILE: frame_llist.h
  type frame_seq (line 33) | struct frame_seq {
  type frame_llist (line 51) | struct frame_llist{
  type frame_llist (line 58) | struct frame_llist
  type frame_seq (line 58) | struct frame_seq
  type frame_llist (line 59) | struct frame_llist
  type frame_llist (line 60) | struct frame_llist
  type frame_llist (line 61) | struct frame_llist
  type frame_llist (line 61) | struct frame_llist
  type frame_seq (line 61) | struct frame_seq
  type frame_llist (line 62) | struct frame_llist
  type frame_seq (line 62) | struct frame_seq
  type frame_llist (line 63) | struct frame_llist
  type frame_seq (line 63) | struct frame_seq
  type frame_llist (line 64) | struct frame_llist
  type frame_seq (line 64) | struct frame_seq

FILE: generic/pipe_dev.c
  function pipe_open (line 40) | int pipe_open(int *fd)
  function pipe_write (line 46) | int pipe_write(int fd, char *buf, int len)
  function pipe_read (line 52) | int pipe_read(int fd, char *buf, int len)

FILE: generic/pty_dev.c
  function pty_open (line 40) | int pty_open(char *sl_name)
  function pty_write (line 88) | int pty_write(int fd, char *buf, int len)
  function pty_read (line 94) | int pty_read(int fd, char *buf, int len)

FILE: generic/tap_dev.c
  function tap_open (line 39) | int tap_open(char *dev)
  function tap_close (line 60) | int tap_close(int fd, char *dev)
  function tap_write (line 66) | int tap_write(int fd, char *buf, int len)
  function tap_read (line 72) | int tap_read(int fd, char *buf, int len)

FILE: generic/tcp_proto.c
  function tcp_write (line 60) | int tcp_write(int fd, char *buf, int len)
  function tcp_read (line 85) | int tcp_read(int fd, char *buf)

FILE: generic/tun_dev.c
  function tun_open (line 40) | int tun_open(char *dev)
  function tun_close (line 61) | int tun_close(int fd, char *dev)
  function tun_write (line 67) | int tun_write(int fd, char *buf, int len)
  function tun_read (line 72) | int tun_read(int fd, char *buf, int len)

FILE: generic/udp_proto.c
  function udp_write (line 65) | int udp_write(int fd, char *buf, int len)
  function udp_read (line 122) | int udp_read(int fd, char *buf)

FILE: lfd_encrypt.c
  type vtun_host (line 78) | struct vtun_host
  function prep_key (line 106) | int prep_key(char **key, int size, struct vtun_host *host)
  function free_key (line 141) | void free_key (char *key)
  function alloc_encrypt (line 146) | int alloc_encrypt(struct vtun_host *host)
  function free_encrypt (line 287) | int free_encrypt()
  function encrypt_buf (line 302) | int encrypt_buf(int len, char *in, char **out)
  function decrypt_buf (line 331) | int decrypt_buf(int len, char *in, char **out)
  function cipher_enc_init (line 356) | int cipher_enc_init(char * iv)
  function cipher_dec_init (line 447) | int cipher_dec_init(char * iv)
  function send_msg (line 537) | int send_msg(int len, char *in, char **out)
  function recv_msg (line 575) | int recv_msg(int len, char *in, char **out)
  function send_ib_mesg (line 650) | int send_ib_mesg(int *len, char **in)
  function recv_ib_mesg (line 689) | int recv_ib_mesg(int *len, char **in)
  type lfd_mod (line 738) | struct lfd_mod
  function no_encrypt (line 752) | int no_encrypt(struct vtun_host *host)
  type lfd_mod (line 758) | struct lfd_mod

FILE: lfd_lzo.c
  function alloc_lzo (line 56) | int alloc_lzo(struct vtun_host *host)
  function free_lzo (line 95) | int free_lzo()
  function comp_lzo (line 106) | int comp_lzo(int len, char *in, char **out)
  function decomp_lzo (line 120) | int decomp_lzo(int len, char *in, char **out)
  type lfd_mod (line 134) | struct lfd_mod
  function no_lzo (line 148) | int no_lzo(struct vtun_host *host)
  type lfd_mod (line 154) | struct lfd_mod

FILE: lfd_shaper.c
  type timeval (line 44) | struct timeval
  function shaper_init (line 49) | int shaper_init(struct vtun_host *host)
  function shaper_counter (line 64) | int shaper_counter(int len, char *in, char **out)
  function shaper_avail (line 92) | int shaper_avail(void)
  type lfd_mod (line 128) | struct lfd_mod
  function no_shaper (line 142) | int no_shaper(struct vtun_host *host)
  type lfd_mod (line 148) | struct lfd_mod

FILE: lfd_zlib.c
  function zlib_alloc (line 50) | int zlib_alloc(struct vtun_host *host)
  function zlib_free (line 83) | int zlib_free()
  function expand_zbuf (line 93) | static int expand_zbuf(z_stream *zs, int len)
  function zlib_comp (line 109) | int zlib_comp(int len, char *in, char **out)
  function zlib_decomp (line 138) | int zlib_decomp(int len, char *in, char **out)
  type lfd_mod (line 166) | struct lfd_mod
  function no_zlib (line 180) | int no_zlib(struct vtun_host *host)
  type lfd_mod (line 186) | struct lfd_mod

FILE: lib.c
  function init_title (line 55) | void init_title(int argc, char *argv[], char *envp[], char *name)
  function set_title (line 95) | void set_title(const char *fmt, ...)
  type my_ip (line 114) | struct my_ip {
  function print_p (line 136) | int print_p(int fd, const char *fmt, ...)
  function readn_t (line 152) | int readn_t(int fd, void *buf, size_t count, time_t timeout)
  type vtun_sopt (line 171) | struct vtun_sopt
  function split_args (line 246) | void split_args(char *str, char **argv)
  function run_cmd (line 299) | int run_cmd(void *d, void *opt)
  function free_sopt (line 348) | void free_sopt( struct vtun_sopt *opt )
  function llsqrt (line 366) | static int llsqrt(long a)
  function std_dev (line 385) | int std_dev(int nums[], int len)
  function getTcpSeq (line 407) | uint32_t getTcpSeq(char* buf) {
  function isACK (line 419) | int isACK(char* buf, int len) {

FILE: lib.h
  function ms2tv (line 52) | static void ms2tv(struct timeval *result, uint64_t interval_ms) {
  function tv2ms (line 57) | static uint64_t tv2ms(struct timeval *a) {
  type vtun_sopt (line 66) | struct vtun_sopt
  function io_init (line 73) | static inline void io_init(void)
  function io_cancel (line 78) | static inline void io_cancel(void)
  function read_n (line 90) | static inline int read_n(int fd, char *buf, int len)
  function write_n (line 107) | static inline int write_n(int fd, char *buf, int len)
  function NumberOfSetBits (line 124) | static inline int NumberOfSetBits(int32_t i)

FILE: linkfd.c
  type my_ip (line 100) | struct my_ip {
  type timeval (line 219) | struct timeval
  type udp_stats (line 244) | struct udp_stats
  type timeval (line 263) | struct timeval
  type timeval (line 274) | struct timeval
  type vtun_host (line 282) | struct vtun_host
  type conn_info (line 283) | struct conn_info
  type lfd_mod (line 285) | struct lfd_mod
  type channel_info (line 286) | struct channel_info
  type phisical_status (line 288) | struct phisical_status
  type mini_path_desc (line 337) | struct mini_path_desc
  type time_lag_info (line 344) | struct time_lag_info
  type time_lag (line 345) | struct time_lag
  type timeval (line 346) | struct timeval
  type last_sent_packet (line 348) | struct last_sent_packet
  function fit_wlinear (line 371) | int fit_wlinear (const double *x, const size_t xstride,
  function percent_delta_equal (line 453) | int percent_delta_equal(int A, int B, int percent) {
  function frame_llist_getLostPacket_byRange (line 466) | int frame_llist_getLostPacket_byRange(struct frame_llist *l, struct fram...
  function frame_llist_check_index_range (line 511) | int frame_llist_check_index_range(int index, int memory_size) {
  function update_prev_flushed (line 536) | int update_prev_flushed(int logical_channel, int fprev) {
  function flush_reason_chan (line 550) | int flush_reason_chan(int status, int logical_channel, char *pname, int ...
  function segfault_sigaction (line 627) | void segfault_sigaction(int signal, siginfo_t *si, void *arg)
  function sig_term (line 633) | static void sig_term(int sig)
  function sig_hup (line 641) | static void sig_hup(int sig)
  function sig_usr1 (line 649) | static void sig_usr1(int sig)
  function sig_send1 (line 658) | void sig_send1() {
  function missing_resend_buffer (line 679) | int missing_resend_buffer (int chan_num, uint32_t buf[], int *buf_len, u...
  function discard_packets (line 745) | int discard_packets(int chan_num, uint32_t stop_sqn) {
  function calculate_hsqs_percents (line 777) | int calculate_hsqs_percents(int max, int percent_fill) {
  function count_sequential_loss_unsync (line 789) | int count_sequential_loss_unsync(int chan_num) {
  function fire_event (line 825) | int fire_event(int *ecount) {
  function get_wb_oldest_ts_unsync (line 832) | int get_wb_oldest_ts_unsync(struct timeval *min_tv) {
  function check_drop_period_unsync (line 850) | int check_drop_period_unsync() {
  function check_delivery_time (line 864) | int check_delivery_time(int mld_divider) {
  function check_delivery_time_unsynced (line 875) | int check_delivery_time_unsynced(int mld_divider) {
  function check_delivery_time_path_unsynced (line 879) | int check_delivery_time_path_unsynced(int pnum, int mld_divider) {
  function check_rtt_latency_drop (line 900) | int check_rtt_latency_drop() { // TODO: remove this dumb method (refacto...
  function check_rtt_latency_drop_chan (line 907) | int check_rtt_latency_drop_chan(int chan_num) {
  function add_tokens (line 935) | static inline int add_tokens(int chan_num, int *next_token_ms) {
  function check_tokens (line 1056) | int check_tokens(int chan_num) {
  function DL_flag_drop_allowed_unsync_stats (line 1085) | int DL_flag_drop_allowed_unsync_stats(uint32_t chan_mask) {
  function get_write_buf_wait_data (line 1106) | int get_write_buf_wait_data(uint32_t chan_mask, int *next_token_ms) {
  function get_resend_frame (line 1218) | int get_resend_frame(int chan_num, uint32_t *seq_num, char **out, int *s...
  function get_resend_frame_unconditional (line 1327) | int get_resend_frame_unconditional(int chan_num, uint32_t *seq_num, char...
  function get_resend_frame_local_sqn (line 1370) | int get_resend_frame_local_sqn(int chan_num, int process_num, uint32_t l...
  function is_priority_packet (line 1411) | int is_priority_packet(char *buf) {
  function get_l4_hash (line 1423) | unsigned int get_l4_hash(char *buf, unsigned int *tcp_seq) {
  function get_last_packet_seq_num (line 1452) | int get_last_packet_seq_num(int chan_num, uint32_t *seq_num) {
  function get_oldest_packet_seq_num (line 1468) | int get_oldest_packet_seq_num(int chan_num, uint32_t *seq_num) {
  function get_last_packet (line 1484) | int get_last_packet(int chan_num, uint32_t *seq_num, char **out, int *se...
  function seqn_break_tail (line 1495) | int seqn_break_tail(char *out, int len, uint32_t *seq_num, uint16_t *fla...
  function pack_packet (line 1519) | int pack_packet(int chan_num, char *buf, int len, uint32_t seq_num, uint...
  function seqn_add_tail (line 1554) | int seqn_add_tail(int conn_num, char *buf, int len, uint32_t seq_num, ui...
  function add_fast_resend_frame (line 1583) | int add_fast_resend_frame(int conn_num, char *buf, int len, uint32_t seq...
  function get_fast_resend_frame (line 1606) | int get_fast_resend_frame(int *conn_num, char *buf, int *len, uint32_t *...
  function print_head_of_packet (line 1618) | void print_head_of_packet(char *buf, char* str, uint32_t seq_num, int le...
  function check_fast_resend (line 1639) | int check_fast_resend() {
  function is_fast_resend_available (line 1649) | int is_fast_resend_available() {
  function is_single (line 1656) | int is_single() {
  function send_packet (line 1663) | int send_packet(int chan_num, char *buf, int len) {
  function retransmit_send (line 1698) | int retransmit_send(char *out2) {
  function get_total_sqe_mean_pkt (line 1901) | int get_total_sqe_mean_pkt(int *aavg, int *lim_pkt, int ignore_msqa) {
  function is_a_hold (line 1937) | int is_a_hold() {
  function select_net_write (line 1958) | int select_net_write(int chan_num) {
  function select_devread_send (line 1995) | int select_devread_send(char *buf, char *out2) {
  function write_buf_check_n_flush (line 2393) | int write_buf_check_n_flush(int logical_channel) {
  function msbl_push_up_loss_unsync (line 2652) | void msbl_push_up_loss_unsync() {
  function write_buf_add (line 2681) | int write_buf_add(int conn_num, char *out, int len, uint32_t seq_num, ui...
  function sem_post_if (line 3016) | void sem_post_if(int *dev_my, sem_t *rd_sem) {
  function check_sent (line 3028) | int check_sent (uint32_t seq_num, struct resent_chk sq_rq_buf[], int *sq...
  function sem_wait_tw (line 3048) | int sem_wait_tw(sem_t *sem) {
  function set_max_chan (line 3071) | int set_max_chan(uint32_t chan_mask) {
  function check_plp_ok (line 3087) | int check_plp_ok(int pnum, int32_t chan_mask) { // TODO TCP model => remove
  function transition_period_time (line 3122) | int transition_period_time(int hsqs) {
  function redetect_head_unsynced (line 3130) | int redetect_head_unsynced(int32_t chan_mask, int exclude) { // TODO: ex...
  function hsnum2pnum (line 3325) | int hsnum2pnum(int hsnum) {
  function name2hsnum (line 3338) | uint32_t name2hsnum(char *name) {
  function ag_mask2hsag_mask (line 3350) | uint32_t ag_mask2hsag_mask(uint32_t ag_mask) {
  function hsag_mask2ag_mask (line 3360) | uint32_t hsag_mask2ag_mask(uint32_t hsag_mask) {
  function t_from_W (line 3374) | double t_from_W (double W, double M, double B, double C) {
  function get_t_loss (line 3380) | int get_t_loss(struct timeval *loss_tv, int tmax) {
  function cubic_recalculate (line 3389) | int cubic_recalculate(int t, int cubic_max, double beta, double c) {
  function set_W_cubic_unrecoverable (line 3395) | int set_W_cubic_unrecoverable(int t) {
  function set_W_unsync (line 3400) | int set_W_unsync(int t) {
  function set_W_to (line 3407) | int set_W_to(int send_q, int slowness, struct timeval *loss_time) {
  function set_Wu_to (line 3414) | int set_Wu_to(int send_q) {
  function set_IDLE (line 3421) | int set_IDLE() {
  function plp_avg_pbl (line 3453) | int plp_avg_pbl(int pnum) {
  function plp_avg_pbl_unrecoverable (line 3463) | int plp_avg_pbl_unrecoverable(int pnum) {
  function fill_path_descs_unsync (line 3475) | int fill_path_descs_unsync(struct mini_path_desc *path_descs, uint32_t c...
  function compare_descs_pbl (line 3491) | int compare_descs_pbl (struct mini_path_desc *a, struct mini_path_desc *...
  function calc_xhi (line 3501) | int calc_xhi(struct mini_path_desc *path_descs, int count) {
  function xhi_function (line 3537) | double xhi_function(int rtt_ms, int pbl) {
  function print_xhi_data (line 3548) | int print_xhi_data(struct mini_path_desc *path_descs, int count) {
  function set_xhi_brl_flags_unsync (line 3555) | int set_xhi_brl_flags_unsync() {
  function lossed_count (line 3594) | int lossed_count() {
  function lossed_latency_drop (line 3621) | int lossed_latency_drop(unsigned int *last_received_seq) {
  function is_loss (line 3639) | int is_loss() {
  function lossed_consume (line 3646) | int lossed_consume(unsigned int local_seq_num, unsigned int seq_num, uns...
  function get_rttlag (line 3853) | int get_rttlag(uint32_t ag_mask) {
  function get_rto_usec (line 3886) | int get_rto_usec() {
  function get_lbuf_len (line 3895) | int get_lbuf_len() {
  function set_rttlag (line 3910) | int set_rttlag() { // TODO: rewrite using get_rttlag
  function set_rttlag_total (line 3951) | int set_rttlag_total() {  // unused TODO REMOVE
  function infer_lost_seq_num (line 3983) | int infer_lost_seq_num(uint32_t *incomplete_seq_buf) {
  function lost_buf_exists (line 4009) | int lost_buf_exists(uint32_t seq_num) {
  function get_cwnd (line 4020) | int get_cwnd() {
  function get_cwnd2 (line 4059) | int get_cwnd2() {
  function compute_max_allowed_rtt (line 4063) | int compute_max_allowed_rtt() {
  function is_happiness_reached (line 4072) | int is_happiness_reached() {
  function mawmar_allowed (line 4080) | int mawmar_allowed() {
  function lfd_linker (line 4124) | int lfd_linker(void)
  function linkfd (line 8343) | int linkfd(struct vtun_host *host, struct conn_info *ci, int ss, int phy...

FILE: linkfd.h
  function lfd_free (line 75) | static inline void lfd_free(void *buf)
  type vtun_host (line 85) | struct vtun_host
  type conn_info (line 85) | struct conn_info
  type lfd_mod (line 87) | struct lfd_mod {
  type lfd_mod (line 102) | struct lfd_mod
  type lfd_mod (line 103) | struct lfd_mod
  type lfd_mod (line 104) | struct lfd_mod
  type lfd_mod (line 105) | struct lfd_mod

FILE: linux/tun_dev.c
  function tun_open_common0 (line 45) | static int tun_open_common0(char *dev, int istun)
  function tun_open_common (line 86) | static int tun_open_common(char *dev, int istun)
  function tun_open (line 122) | int tun_open(char *dev) { return tun_open_common(dev, 1); }
  function tap_open (line 123) | int tap_open(char *dev) { return tun_open_common(dev, 0); }
  function tun_close (line 125) | int tun_close(int fd, char *dev) { return close(fd); }
  function tap_close (line 126) | int tap_close(int fd, char *dev) { return close(fd); }
  function tun_write (line 129) | int tun_write(int fd, char *buf, int len) { return write(fd, buf, len); }
  function tap_write (line 130) | int tap_write(int fd, char *buf, int len) { return write(fd, buf, len); }
  function tun_read (line 132) | int tun_read(int fd, char *buf, int len) { return read(fd, buf, len); }
  function tap_read (line 133) | int tap_read(int fd, char *buf, int len) { return read(fd, buf, len); }

FILE: llist.c
  function llist_init (line 30) | void llist_init(llist *l)
  function llist_empty (line 35) | int llist_empty(llist *l)
  function llist_add (line 40) | int llist_add(llist *l, void * d)
  function llist_copy (line 72) | int llist_copy(llist *l, llist *t, void* (*f)(void *d, void *u), void *u)

FILE: llist.h
  type llist_element (line 28) | struct llist_element {
  type llist_elm (line 32) | typedef struct llist_element llist_elm;
  type llist (line 34) | typedef struct {

FILE: lock.c
  function create_lock (line 45) | int create_lock(char * file)
  function pid_t (line 88) | pid_t read_lock(char * file)
  function lock_host (line 122) | int lock_host(struct vtun_host * host)
  function unlock_host (line 167) | void unlock_host(struct vtun_host *host)

FILE: lock.h
  type vtun_host (line 29) | struct vtun_host
  type vtun_host (line 30) | struct vtun_host

FILE: log.c
  function vlog_shm_set (line 35) | void vlog_shm_set(int state, sem_t *logSem, char *log, int *counter, int...
  function vlog_shm_print (line 50) | void vlog_shm_print(int priority, char *format, ...) {
  function vlog_shm_process (line 75) | void vlog_shm_process(struct conn_info *shm_conn_info) {
  function vlog_init (line 121) | void vlog_init() {
  function vlog_free (line 129) | void vlog_free() {
  function vlog_open (line 136) | void vlog_open(const char *ident, int option, int facility) {
  function vlog_close (line 141) | void vlog_close() {
  function vlog (line 145) | void vlog(int priority, char *format, ...) {

FILE: log.h
  type conn_info (line 21) | struct conn_info

FILE: main.c
  type vtun_opts (line 53) | struct vtun_opts
  type vtun_host (line 54) | struct vtun_host
  function main (line 65) | int main(int argc, char *argv[], char *env[])
  function write_pid (line 306) | void write_pid(void)
  function reread_config (line 319) | void reread_config(int sig)
  function usage (line 327) | void usage(void)
  function version (line 340) | void version() {

FILE: net_structs.h
  type info_packet (line 15) | struct info_packet {
  type time_lag_packet (line 24) | struct time_lag_packet {

FILE: netlib.c
  function connect_t (line 81) | int connect_t(int s, struct sockaddr *svr, time_t timeout)
  function getifaddr (line 120) | unsigned long getifaddr(char * ifname)
  function udp_session (line 147) | int udp_session(struct vtun_host *host)
  function local_addr (line 210) | int local_addr(struct sockaddr_in *addr, struct vtun_host *host, int con)
  function server_addr (line 231) | int server_addr(struct sockaddr_in *addr, struct vtun_host *host)
  function generic_addr (line 256) | int generic_addr(struct sockaddr_in *addr, struct vtun_addr *vaddr)

FILE: netlib.h
  type sockaddr (line 37) | struct sockaddr
  type vtun_host (line 38) | struct vtun_host
  type sockaddr_in (line 40) | struct sockaddr_in
  type vtun_host (line 40) | struct vtun_host
  type sockaddr_in (line 41) | struct sockaddr_in
  type vtun_host (line 41) | struct vtun_host
  type sockaddr_in (line 42) | struct sockaddr_in
  type vtun_addr (line 42) | struct vtun_addr

FILE: netlink_socket_info.c
  type ssfilter (line 58) | struct ssfilter {
  type filter (line 64) | struct filter {
  type filter (line 71) | struct filter
  type filter (line 77) | struct filter
  type channel_info (line 79) | struct channel_info
  type rtattr (line 81) | struct rtattr
  type rtattr (line 81) | struct rtattr
  type nlmsghdr (line 82) | struct nlmsghdr
  type filter (line 82) | struct filter
  type filter (line 83) | struct filter
  type nlmsghdr (line 84) | struct nlmsghdr
  type inet_diag_msg (line 84) | struct inet_diag_msg
  function parse_rtattr (line 86) | int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len)
  function tcp_show_sock (line 100) | static int tcp_show_sock(struct nlmsghdr *nlh, struct filter *f) {
  function tcp_show_netlink (line 132) | static int tcp_show_netlink(struct filter *f, FILE *dump_fp, int socktyp...
  function get_format_tcp_info (line 280) | int get_format_tcp_info(struct channel_info* channel_info_vt, int channe...
  function format_info (line 316) | int format_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r) {
  function clear_channel_info (line 365) | void clear_channel_info(struct channel_info* channel_info, int channel_a...

FILE: netlink_socket_info.h
  type channel_info (line 13) | struct channel_info {
  type channel_info (line 32) | struct channel_info

FILE: packet_code.c
  function sum_init (line 16) | void sum_init(struct packet_sum* sum, uint32_t start_seq, uint32_t stop_...
  function add_packet_code (line 28) | __attribute__ ((section ("code_packing"))) void add_packet_code(char* re...
  function del_packet_code (line 40) | void del_packet_code(struct packet_sum* sum, int index) {
  function add_redundancy_packet_code (line 47) | int add_redundancy_packet_code(struct packet_sum *sum, int *bulk_counter...
  function pack_redundancy_packet_code (line 77) | int pack_redundancy_packet_code(char *buf, struct packet_sum* sum, uint3...
  function check_bulk_packet_code (line 99) | int check_bulk_packet_code(struct packet_sum* sum, uint32_t seq_num, int...
  function check_n_repair_packet_code (line 121) | int check_n_repair_packet_code(struct packet_sum* sum, struct frame_llis...
  function get_packet_code (line 192) | int get_packet_code(struct packet_sum* sum, int *bulk_counter, uint32_t ...

FILE: packet_code.h
  type packet_sum (line 29) | struct packet_sum {
  type packet_sum (line 40) | struct packet_sum
  type packet_sum (line 41) | struct packet_sum
  type packet_sum (line 42) | struct packet_sum
  type packet_sum (line 43) | struct packet_sum
  type packet_sum (line 44) | struct packet_sum
  type packet_sum (line 45) | struct packet_sum
  type packet_sum (line 46) | struct packet_sum
  type packet_sum (line 47) | struct packet_sum
  type frame_llist (line 47) | struct frame_llist
  type frame_llist (line 47) | struct frame_llist
  type frame_seq (line 47) | struct frame_seq
  type packet_sum (line 48) | struct packet_sum

FILE: pid.c
  function computePID (line 19) | void computePID(float error, float *lastError, float *output, float *ITe...

FILE: pid.h
  type PIDstruct (line 11) | struct PIDstruct {

FILE: server.c
  type conn_info (line 64) | struct conn_info
  function sig_term (line 68) | static void sig_term(int sig) {
  function connection (line 97) | void connection(int sock, sem_t *shm_sem)
  function listener (line 158) | void listener(void)
  function server (line 274) | void server(int sock)

FILE: speed_algo.c
  function speed_algo_ack_speed (line 25) | int speed_algo_ack_speed(struct timeval *time_start, struct timeval *tim...
  function speed_algo_avg_speed (line 63) | int speed_algo_avg_speed(int32_t *arr, int arr_size, int new_speed, int ...

FILE: speed_algo.h
  type speed_algo_rtt_speed (line 22) | struct speed_algo_rtt_speed {
  type timeval (line 27) | struct timeval
  type timeval (line 27) | struct timeval

FILE: svr4/tap_dev.c
  function tap_open (line 68) | int tap_open(char *dev)
  function tap_close (line 123) | int tap_close(int fd, char *dev)
  function tap_write (line 128) | int tap_write(int fd, char *buf, int len)
  function tap_read (line 136) | int tap_read(int fd, char *buf, int len)

FILE: svr4/tun_dev.c
  function tun_open (line 70) | int tun_open(char *dev)
  function tun_close (line 136) | int tun_close(int fd, char *dev)
  function tun_write (line 161) | int tun_write(int fd, char *buf, int len)
  function tun_read (line 169) | int tun_read(int fd, char *buf, int len)

FILE: test/lossed.c
  function lossed_count (line 40) | int lossed_count() {
  function is_loss (line 61) | int is_loss() {

FILE: timer.c
  type timer_obj (line 13) | struct timer_obj
  type timer_obj (line 14) | struct timer_obj
  function free_timer (line 17) | void free_timer(struct timer_obj *timer) {
  function set_timer (line 21) | void set_timer(struct timer_obj *timer, struct timeval *timer_time) {
  function update_timer (line 27) | void update_timer(struct timer_obj *timer){
  function fast_update_timer (line 31) | void fast_update_timer(struct timer_obj *timer, struct timeval *cur_time){
  function check_timer (line 36) | int check_timer(struct timer_obj *timer) {
  function fast_check_timer (line 42) | int fast_check_timer(struct timer_obj *timer, struct timeval *cur_time){
  type timeval (line 47) | struct timeval
  type timer_obj (line 47) | struct timer_obj
  type timeval (line 47) | struct timeval

FILE: timer.h
  type timer_obj (line 13) | struct timer_obj {
  type timer_obj (line 20) | struct timer_obj
  type timer_obj (line 21) | struct timer_obj
  type timer_obj (line 23) | struct timer_obj
  type timeval (line 23) | struct timeval
  type timer_obj (line 24) | struct timer_obj
  type timer_obj (line 25) | struct timer_obj
  type timeval (line 25) | struct timeval
  type timer_obj (line 26) | struct timer_obj
  type timer_obj (line 27) | struct timer_obj
  type timeval (line 27) | struct timeval
  type timeval (line 28) | struct timeval
  type timer_obj (line 28) | struct timer_obj
  type timeval (line 28) | struct timeval

FILE: tunnel.c
  function read_fd (line 94) | ssize_t
  function write_fd (line 154) | ssize_t
  function fd_server_term (line 192) | static void fd_server_term(int sig) {
  function run_fd_server (line 197) | int run_fd_server(int fd, char * dev, struct conn_info *shm_conn_info, i...
  function read_fd_full (line 337) | int read_fd_full(int *fd, char *dev) {
  function release_shm (line 365) | void release_shm(struct conn_info *shm_conn_info, sem_t *shm_sem, int co...
  function tunnel (line 371) | int tunnel(struct vtun_host *host, int srv, sem_t *shm_sem_unused)

FILE: udp_states.c
  type udp_stats (line 22) | struct udp_stats
  function get_udp_stats (line 24) | int get_udp_stats(struct udp_stats* udp_struct, int conn_amount) {
  function add_line (line 66) | int add_line(char* line, struct udp_stats* udp_struct, int conn_amount) {

FILE: udp_states.h
  type udp_stats (line 13) | struct udp_stats {
  type udp_stats (line 25) | struct udp_stats

FILE: v_struct.h
  type frame_hash (line 21) | struct frame_hash {
  type timed_loss (line 26) | struct timed_loss {
  type _write_buf (line 36) | struct _write_buf {
  type time_lag_info (line 59) | struct time_lag_info {
  type time_lag (line 71) | struct time_lag {
  type _events (line 78) | struct _events {
  type speed_chan_data_struct (line 84) | struct speed_chan_data_struct {
  type conn_stats (line 100) | struct conn_stats {
  type logical_status (line 177) | struct logical_status {
  type phisical_status (line 228) | struct phisical_status { // A.K.A. "info"
  type conn_info (line 364) | struct conn_info {

FILE: vtun.h
  type vtun_sopt (line 123) | struct vtun_sopt {
  type vtun_stat (line 131) | struct vtun_stat {
  type vtun_cmd (line 139) | struct vtun_cmd {
  type vtun_addr (line 149) | struct vtun_addr {
  type vtun_host (line 159) | struct vtun_host {
  type streams_seq (line 284) | struct streams_seq {
  type resent_chk (line 293) | struct resent_chk {
  type last_sent_packet (line 300) | struct last_sent_packet {
  type vtun_opts (line 396) | struct vtun_opts {
  type vtun_opts (line 427) | struct vtun_opts
  type vtun_host (line 431) | struct vtun_host
  type vtun_host (line 432) | struct vtun_host
  type vtun_host (line 434) | struct vtun_host
Condensed preview — 173 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,174K chars).
[
  {
    "path": ".travis.yml",
    "chars": 65,
    "preview": "language: c\naddons:\n  apt:\n    packages:\n    - flex\n    - bison\n\n"
  },
  {
    "path": "Credits",
    "chars": 4061,
    "preview": "vtrunkd (c) 2015-2016 Vrayo Systems Ltd. team (http://vrayo.com)\n\nAuthor of vtrunkd core algorithm is Andrew Gryaznov <r"
  },
  {
    "path": "INSTALL",
    "chars": 139,
    "preview": "System requirements:\n\n- Linux. Kernel 2.6.25+ recommended\n- Additional software:\n   bison\n   flex\n   zlib-dev\n   liblzo-"
  },
  {
    "path": "LICENSE",
    "chars": 35147,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "Makefile.in",
    "chars": 4639,
    "preview": "#\n#   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n#\n#   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n#\n#"
  },
  {
    "path": "README.md",
    "chars": 1780,
    "preview": "[![Build Status](https://travis-ci.org/VrayoSystems/vtrunkd.svg?branch=master)](https://travis-ci.org/VrayoSystems/vtrun"
  },
  {
    "path": "aclocal.m4",
    "chars": 1322,
    "preview": "dnl Test files\nAC_DEFUN( AC_TEST_FILES,\n[\n    ac_file_found=yes\n    for f in $1; do\n\tif test ! -f $2/$f; then\n    \t   ac"
  },
  {
    "path": "auth.c",
    "chars": 8840,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "auth.h",
    "chars": 1033,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "cfg_file.l",
    "chars": 4020,
    "preview": "%{\n/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n"
  },
  {
    "path": "cfg_file.y",
    "chars": 15945,
    "preview": "%{\n/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n"
  },
  {
    "path": "cfg_kwords.h",
    "chars": 4330,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "client.c",
    "chars": 8604,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "compat.h",
    "chars": 1004,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "config.guess",
    "chars": 38315,
    "preview": "#! /bin/sh\n# Attempt to guess a canonical system name.\n#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,"
  },
  {
    "path": "config.h.in",
    "chars": 1740,
    "preview": "/* config.h.in.  Generated automatically from configure.in by autoheader.  */\n\n/* Define to empty if the keyword does no"
  },
  {
    "path": "config.sub",
    "chars": 28412,
    "preview": "#! /bin/sh\n# Configuration validation subroutine script.\n#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 199"
  },
  {
    "path": "configure",
    "chars": 180672,
    "preview": "#! /bin/sh\n# Guess values for system-dependent variables and create Makefiles.\n# Generated by GNU Autoconf 2.69.\n#\n#\n# C"
  },
  {
    "path": "configure.in",
    "chars": 4627,
    "preview": "dnl\ndnl vtrunkd - Virtual Tunnel Trunking over TCP/IP network.\ndnl Copyright (C) 2011-2016  Vrayo Systems Ltd. team\ndnl "
  },
  {
    "path": "const.h",
    "chars": 2313,
    "preview": "\n#ifndef _CONST_H\n#define _CONST_H\n\n// max aggregated VPN-links compiled-in (+ some extras for racing)\n#define MAX_TCP_P"
  },
  {
    "path": "debian/changelog",
    "chars": 140,
    "preview": "vtrunkd (0.1-1) unstable; urgency=low\n\n  * Initial release (Closes: #205)\n\n -- David Parunakian <dp@dp.io>  Sat, 16 Jan "
  },
  {
    "path": "debian/compat",
    "chars": 2,
    "preview": "9\n"
  },
  {
    "path": "debian/control",
    "chars": 582,
    "preview": "Source: vtrunkd\nSection: net\nPriority: optional\nMaintainer: David Parunakian <dp@dp.io>\nBuild-Depends: debhelper (>= 9),"
  },
  {
    "path": "debian/copyright",
    "chars": 2806,
    "preview": "Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/\nUpstream-Name: vtrunkd\nSource: <http://vrayo.c"
  },
  {
    "path": "debian/docs",
    "chars": 32,
    "preview": "Credits\nFAQ\nREADME\nREADME.Setup\n"
  },
  {
    "path": "debian/logrotate",
    "chars": 86,
    "preview": "/var/log/vtrunkd/*.dump {\n  rotate 54\n  daily\n  compress\n  copytruncate\n  missingok\n}\n"
  },
  {
    "path": "debian/postinst",
    "chars": 467,
    "preview": "#!/bin/sh\n# postinst script for vtrunkd\n#\n# see: dh_installdeb(1)\n\nset -e\n\ncase \"$1\" in\n    configure)\n\n\tpip install cff"
  },
  {
    "path": "debian/postrm",
    "chars": 477,
    "preview": "#!/bin/sh\n# postrm script for vtrunkd\n#\n# see: dh_installdeb(1)\n\nset -e\n\ncase \"$1\" in\n    purge|remove|upgrade|failed-up"
  },
  {
    "path": "debian/prerm",
    "chars": 317,
    "preview": "#!/bin/bash -e\n# postrm script for vtrunkd\n#\n# see: dh_installdeb(1)\n\nset -e\n\ncase ${1} in\n\n    remove|upgrade|deconfigu"
  },
  {
    "path": "debian/rules",
    "chars": 889,
    "preview": "#!/usr/bin/make -f\n# See debhelper(7) (uncomment to enable)\n# output every command that modifies files on the build syst"
  },
  {
    "path": "debian/source/format",
    "chars": 12,
    "preview": "3.0 (quilt)\n"
  },
  {
    "path": "debian/vtrunkd2.substvars",
    "chars": 45,
    "preview": "shlibs:Depends=libc6 (>= 2.15)\nmisc:Depends=\n"
  },
  {
    "path": "defines.h",
    "chars": 181,
    "preview": "/*\n * defines.h\n *\n *  Created on: 03.09.2014\n *      Author: Vrayo Systems Ltd. team\n */\n\n#ifndef DEFINES_H_\n#define DE"
  },
  {
    "path": "driver.h",
    "chars": 1865,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "frame_llist.c",
    "chars": 3049,
    "preview": "\n/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n "
  },
  {
    "path": "frame_llist.h",
    "chars": 2290,
    "preview": "\n/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Andrew Gryaznov <realgrand"
  },
  {
    "path": "generic/pipe_dev.c",
    "chars": 1373,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "generic/pty_dev.c",
    "chars": 2389,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "generic/tap_dev.c",
    "chars": 1742,
    "preview": "/*  \n    VTun - Virtual Tunnel over TCP/IP network.\n\n    Copyright (C) 1998-2000  Maxim Krasnyansky <max_mk@yahoo.com>\n\n"
  },
  {
    "path": "generic/tcp_proto.c",
    "chars": 3244,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team,\n\n "
  },
  {
    "path": "generic/tun_dev.c",
    "chars": 1771,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "generic/udp_proto.c",
    "chars": 4430,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "install-sh",
    "chars": 4772,
    "preview": "#! /bin/sh\n#\n# install - install a program, script, or datafile\n# This comes from X11R5.\n#\n# Calling this script install"
  },
  {
    "path": "lfd_encrypt.c",
    "chars": 19280,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "lfd_lzo.c",
    "chars": 3541,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "lfd_shaper.c",
    "chars": 3684,
    "preview": "/*\n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network.\n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n   Vt"
  },
  {
    "path": "lfd_zlib.c",
    "chars": 4303,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "lib.c",
    "chars": 10447,
    "preview": "/*\n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network.\n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n   Vt"
  },
  {
    "path": "lib.h",
    "chars": 3198,
    "preview": "/*  \n    VTun - Virtual Tunnel over TCP/IP network.\n\n    Copyright (C) 1998-2000  Maxim Krasnyansky <max_mk@yahoo.com>\n\n"
  },
  {
    "path": "linkfd.c",
    "chars": 437944,
    "preview": "/*\n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network.\n\n   Copyright (C) 2011-2016 Vrayo Systems Ltd. team \n\n   Vt"
  },
  {
    "path": "linkfd.h",
    "chars": 2965,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team,\n\n "
  },
  {
    "path": "linux/tap_dev.c",
    "chars": 1096,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "linux/tun_dev.c",
    "chars": 3538,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "llist.c",
    "chars": 2067,
    "preview": "\n/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n "
  },
  {
    "path": "llist.h",
    "chars": 1378,
    "preview": "\n/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n "
  },
  {
    "path": "lock.c",
    "chars": 4622,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "lock.h",
    "chars": 1046,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "log.c",
    "chars": 11640,
    "preview": "#include \"config.h\"\n\n#include \"log.h\"\n\n#include <inttypes.h>\n#include <signal.h>\n#include <stdarg.h>\n#include <stdlib.h>"
  },
  {
    "path": "log.h",
    "chars": 866,
    "preview": "#ifndef _VTUN_LOG_H\n#define _VTUN_LOG_H\n\n#include \"config.h\"\n\n#include <semaphore.h>\n\n#include \"vtun.h\"\n\n#define\tLOG_EME"
  },
  {
    "path": "main.c",
    "chars": 9717,
    "preview": "/*\n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network.\n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n   Vt"
  },
  {
    "path": "net_structs.h",
    "chars": 458,
    "preview": "/*\n * net_structs.h\n *\n *  Created on: 04.07.2012\n *      Author: Vrayo Systems Ltd. team \n */\n\n#ifndef NET_STRUCTS_H_\n#"
  },
  {
    "path": "netlib.c",
    "chars": 7212,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "netlib.h",
    "chars": 1405,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "netlink_socket_info.c",
    "chars": 11691,
    "preview": "/*\n * netlink_socket_info.c\n\n *\n * According by ss from iproute2 and fss is written by Matt Tierney\n *\n *  Created on: 3"
  },
  {
    "path": "netlink_socket_info.h",
    "chars": 745,
    "preview": "/*\n * socket_info.h\n *\n *  Created on: 30.11.2012\n *       Copyright (C) 2011-2016 Vrayo Systems Ltd. team \n */\n\n#ifndef"
  },
  {
    "path": "packages/openwrt/Makefile",
    "chars": 1644,
    "preview": "#\n# Copyright (C) 2011 Andrew Gryaznov <realgrandrew@gmail.com>\n#\n# This is free software, licensed under the GNU Genera"
  },
  {
    "path": "packages/os-jessie/Dockerfile",
    "chars": 218,
    "preview": "FROM debian:jessie\nADD sources.list /etc/apt/\nRUN apt-get update\nRUN apt-get install -y build-essential autotools-dev bi"
  },
  {
    "path": "packages/os-jessie/debian/changelog",
    "chars": 141,
    "preview": "vtrunkd2 (0.1-1) unstable; urgency=low\n\n  * Initial release (Closes: #205)\n\n -- David Parunakian <dp@dp.io>  Sat, 16 Jan"
  },
  {
    "path": "packages/os-jessie/debian/compat",
    "chars": 2,
    "preview": "9\n"
  },
  {
    "path": "packages/os-jessie/debian/control",
    "chars": 544,
    "preview": "Source: vtrunkd2\nSection: net\nPriority: optional\nMaintainer: David Parunakian <dp@dp.io>\nBuild-Depends: debhelper (>= 9)"
  },
  {
    "path": "packages/os-jessie/debian/copyright",
    "chars": 2807,
    "preview": "Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/\nUpstream-Name: vtrunkd2\nSource: <http://vrayo."
  },
  {
    "path": "packages/os-jessie/debian/docs",
    "chars": 18,
    "preview": "Credits\nREADME.md\n"
  },
  {
    "path": "packages/os-jessie/debian/files",
    "chars": 38,
    "preview": "vtrunkd2_0.1-1_amd64.deb net optional\n"
  },
  {
    "path": "packages/os-jessie/debian/init.d.ex",
    "chars": 4585,
    "preview": "#!/bin/sh\n### BEGIN INIT INFO\n# Provides:          vtrunkd2\n# Required-Start:    $local_fs $network $remote_fs $syslog\n#"
  },
  {
    "path": "packages/os-jessie/debian/logrotate",
    "chars": 86,
    "preview": "/var/log/vtrunkd/*.dump {\n  rotate 54\n  daily\n  compress\n  copytruncate\n  missingok\n}\n"
  },
  {
    "path": "packages/os-jessie/debian/postinst.ex",
    "chars": 958,
    "preview": "#!/bin/sh\n# postinst script for vtrunkd2\n#\n# see: dh_installdeb(1)\n\nset -e\n\n# summary of how this script can be called:\n"
  },
  {
    "path": "packages/os-jessie/debian/postrm.ex",
    "chars": 931,
    "preview": "#!/bin/sh\n# postrm script for vtrunkd2\n#\n# see: dh_installdeb(1)\n\nset -e\n\n# summary of how this script can be called:\n# "
  },
  {
    "path": "packages/os-jessie/debian/rules",
    "chars": 865,
    "preview": "#!/usr/bin/make -f\n# See debhelper(7) (uncomment to enable)\n# output every command that modifies files on the build syst"
  },
  {
    "path": "packages/os-jessie/debian/source/format",
    "chars": 12,
    "preview": "3.0 (quilt)\n"
  },
  {
    "path": "packages/os-jessie/debian/vtrunkd2.substvars",
    "chars": 45,
    "preview": "shlibs:Depends=libc6 (>= 2.15)\nmisc:Depends=\n"
  },
  {
    "path": "packages/os-jessie/sources.list",
    "chars": 386,
    "preview": "deb http://security.debian.org/ jessie/updates main\ndeb-src http://security.debian.org/ jessie/updates main\n\ndeb http://"
  },
  {
    "path": "packages/os-trusty/Dockerfile",
    "chars": 191,
    "preview": "FROM ubuntu:trusty\nRUN apt-get update\nRUN apt-get install -y build-essential autotools-dev bison flex build-essential li"
  },
  {
    "path": "packages/os-trusty/debian/changelog",
    "chars": 141,
    "preview": "vtrunkd2 (0.1-1) unstable; urgency=low\n\n  * Initial release (Closes: #205)\n\n -- David Parunakian <dp@dp.io>  Sat, 16 Jan"
  },
  {
    "path": "packages/os-trusty/debian/compat",
    "chars": 2,
    "preview": "9\n"
  },
  {
    "path": "packages/os-trusty/debian/control",
    "chars": 544,
    "preview": "Source: vtrunkd2\nSection: net\nPriority: optional\nMaintainer: David Parunakian <dp@dp.io>\nBuild-Depends: debhelper (>= 9)"
  },
  {
    "path": "packages/os-trusty/debian/copyright",
    "chars": 2807,
    "preview": "Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/\nUpstream-Name: vtrunkd2\nSource: <http://vrayo."
  },
  {
    "path": "packages/os-trusty/debian/docs",
    "chars": 18,
    "preview": "Credits\nREADME.md\n"
  },
  {
    "path": "packages/os-trusty/debian/files",
    "chars": 38,
    "preview": "vtrunkd2_0.1-1_amd64.deb net optional\n"
  },
  {
    "path": "packages/os-trusty/debian/init.d.ex",
    "chars": 4585,
    "preview": "#!/bin/sh\n### BEGIN INIT INFO\n# Provides:          vtrunkd2\n# Required-Start:    $local_fs $network $remote_fs $syslog\n#"
  },
  {
    "path": "packages/os-trusty/debian/logrotate",
    "chars": 86,
    "preview": "/var/log/vtrunkd/*.dump {\n  rotate 54\n  daily\n  compress\n  copytruncate\n  missingok\n}\n"
  },
  {
    "path": "packages/os-trusty/debian/postinst.ex",
    "chars": 958,
    "preview": "#!/bin/sh\n# postinst script for vtrunkd2\n#\n# see: dh_installdeb(1)\n\nset -e\n\n# summary of how this script can be called:\n"
  },
  {
    "path": "packages/os-trusty/debian/postrm.ex",
    "chars": 931,
    "preview": "#!/bin/sh\n# postrm script for vtrunkd2\n#\n# see: dh_installdeb(1)\n\nset -e\n\n# summary of how this script can be called:\n# "
  },
  {
    "path": "packages/os-trusty/debian/rules",
    "chars": 865,
    "preview": "#!/usr/bin/make -f\n# See debhelper(7) (uncomment to enable)\n# output every command that modifies files on the build syst"
  },
  {
    "path": "packages/os-trusty/debian/source/format",
    "chars": 12,
    "preview": "3.0 (quilt)\n"
  },
  {
    "path": "packages/os-trusty/debian/vtrunkd2.substvars",
    "chars": 45,
    "preview": "shlibs:Depends=libc6 (>= 2.15)\nmisc:Depends=\n"
  },
  {
    "path": "packages/os-vivid/Dockerfile",
    "chars": 227,
    "preview": "FROM ubuntu:vivid\nADD sources.list /etc/apt/\nRUN apt-get update\nRUN apt-get install -y build-essential autotools-dev bis"
  },
  {
    "path": "packages/os-vivid/debian/changelog",
    "chars": 141,
    "preview": "vtrunkd2 (0.1-1) unstable; urgency=low\n\n  * Initial release (Closes: #205)\n\n -- David Parunakian <dp@dp.io>  Sat, 16 Jan"
  },
  {
    "path": "packages/os-vivid/debian/compat",
    "chars": 2,
    "preview": "9\n"
  },
  {
    "path": "packages/os-vivid/debian/control",
    "chars": 544,
    "preview": "Source: vtrunkd2\nSection: net\nPriority: optional\nMaintainer: David Parunakian <dp@dp.io>\nBuild-Depends: debhelper (>= 9)"
  },
  {
    "path": "packages/os-vivid/debian/copyright",
    "chars": 2807,
    "preview": "Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/\nUpstream-Name: vtrunkd2\nSource: <http://vrayo."
  },
  {
    "path": "packages/os-vivid/debian/docs",
    "chars": 18,
    "preview": "Credits\nREADME.md\n"
  },
  {
    "path": "packages/os-vivid/debian/files",
    "chars": 38,
    "preview": "vtrunkd2_0.1-1_amd64.deb net optional\n"
  },
  {
    "path": "packages/os-vivid/debian/init.d.ex",
    "chars": 4585,
    "preview": "#!/bin/sh\n### BEGIN INIT INFO\n# Provides:          vtrunkd2\n# Required-Start:    $local_fs $network $remote_fs $syslog\n#"
  },
  {
    "path": "packages/os-vivid/debian/logrotate",
    "chars": 86,
    "preview": "/var/log/vtrunkd/*.dump {\n  rotate 54\n  daily\n  compress\n  copytruncate\n  missingok\n}\n"
  },
  {
    "path": "packages/os-vivid/debian/postinst.ex",
    "chars": 958,
    "preview": "#!/bin/sh\n# postinst script for vtrunkd2\n#\n# see: dh_installdeb(1)\n\nset -e\n\n# summary of how this script can be called:\n"
  },
  {
    "path": "packages/os-vivid/debian/postrm.ex",
    "chars": 931,
    "preview": "#!/bin/sh\n# postrm script for vtrunkd2\n#\n# see: dh_installdeb(1)\n\nset -e\n\n# summary of how this script can be called:\n# "
  },
  {
    "path": "packages/os-vivid/debian/rules",
    "chars": 865,
    "preview": "#!/usr/bin/make -f\n# See debhelper(7) (uncomment to enable)\n# output every command that modifies files on the build syst"
  },
  {
    "path": "packages/os-vivid/debian/source/format",
    "chars": 12,
    "preview": "3.0 (quilt)\n"
  },
  {
    "path": "packages/os-vivid/debian/vtrunkd2.substvars",
    "chars": 45,
    "preview": "shlibs:Depends=libc6 (>= 2.15)\nmisc:Depends=\n"
  },
  {
    "path": "packages/os-vivid/sources.list",
    "chars": 546,
    "preview": "deb http://us.archive.ubuntu.com/ubuntu/ vivid main universe restricted multiverse\ndeb-src http://us.archive.ubuntu.com/"
  },
  {
    "path": "packages/os-wheezy/Dockerfile",
    "chars": 218,
    "preview": "FROM debian:wheezy\nADD sources.list /etc/apt/\nRUN apt-get update\nRUN apt-get install -y build-essential autotools-dev bi"
  },
  {
    "path": "packages/os-wheezy/debian/changelog",
    "chars": 139,
    "preview": "vtrunkd2 (0.1-1) stable; urgency=low\n\n  * Initial release (Closes: #205)\n\n -- David Parunakian <dp@dp.io>  Sat, 16 Jan 2"
  },
  {
    "path": "packages/os-wheezy/debian/compat",
    "chars": 2,
    "preview": "5\n"
  },
  {
    "path": "packages/os-wheezy/debian/control",
    "chars": 520,
    "preview": "Source: vtrunkd2\nSection: net\nPriority: optional\nMaintainer: David Parunakian <dp@dp.io>\nBuild-Depends: debhelper (>= 5)"
  },
  {
    "path": "packages/os-wheezy/debian/copyright",
    "chars": 2807,
    "preview": "Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/\nUpstream-Name: vtrunkd2\nSource: <http://vrayo."
  },
  {
    "path": "packages/os-wheezy/debian/docs",
    "chars": 18,
    "preview": "Credits\nREADME.md\n"
  },
  {
    "path": "packages/os-wheezy/debian/files",
    "chars": 38,
    "preview": "vtrunkd2_0.1-1_amd64.deb net optional\n"
  },
  {
    "path": "packages/os-wheezy/debian/init.d.ex",
    "chars": 4585,
    "preview": "#!/bin/sh\n### BEGIN INIT INFO\n# Provides:          vtrunkd2\n# Required-Start:    $local_fs $network $remote_fs $syslog\n#"
  },
  {
    "path": "packages/os-wheezy/debian/logrotate",
    "chars": 86,
    "preview": "/var/log/vtrunkd/*.dump {\n  rotate 54\n  daily\n  compress\n  copytruncate\n  missingok\n}\n"
  },
  {
    "path": "packages/os-wheezy/debian/postinst.ex",
    "chars": 958,
    "preview": "#!/bin/sh\n# postinst script for vtrunkd2\n#\n# see: dh_installdeb(1)\n\nset -e\n\n# summary of how this script can be called:\n"
  },
  {
    "path": "packages/os-wheezy/debian/postrm.ex",
    "chars": 931,
    "preview": "#!/bin/sh\n# postrm script for vtrunkd2\n#\n# see: dh_installdeb(1)\n\nset -e\n\n# summary of how this script can be called:\n# "
  },
  {
    "path": "packages/os-wheezy/debian/rules",
    "chars": 861,
    "preview": "#!/usr/bin/make -f\n# See debhelper(7) (uncomment to enable)\n# output every command that modifies files on the build syst"
  },
  {
    "path": "packages/os-wheezy/debian/source/format",
    "chars": 12,
    "preview": "3.0 (quilt)\n"
  },
  {
    "path": "packages/os-wheezy/debian/vtrunkd2.substvars",
    "chars": 45,
    "preview": "shlibs:Depends=libc6 (>= 2.15)\nmisc:Depends=\n"
  },
  {
    "path": "packages/os-wheezy/sources.list",
    "chars": 386,
    "preview": "deb http://security.debian.org/ wheezy/updates main\ndeb-src http://security.debian.org/ wheezy/updates main\n\ndeb http://"
  },
  {
    "path": "packages/os-wily/Dockerfile",
    "chars": 226,
    "preview": "FROM ubuntu:wily\nADD sources.list /etc/apt/\nRUN apt-get update\nRUN apt-get install -y build-essential autotools-dev biso"
  },
  {
    "path": "packages/os-wily/debian/changelog",
    "chars": 141,
    "preview": "vtrunkd2 (0.1-1) unstable; urgency=low\n\n  * Initial release (Closes: #205)\n\n -- David Parunakian <dp@dp.io>  Sat, 16 Jan"
  },
  {
    "path": "packages/os-wily/debian/compat",
    "chars": 2,
    "preview": "9\n"
  },
  {
    "path": "packages/os-wily/debian/control",
    "chars": 544,
    "preview": "Source: vtrunkd2\nSection: net\nPriority: optional\nMaintainer: David Parunakian <dp@dp.io>\nBuild-Depends: debhelper (>= 9)"
  },
  {
    "path": "packages/os-wily/debian/copyright",
    "chars": 2807,
    "preview": "Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/\nUpstream-Name: vtrunkd2\nSource: <http://vrayo."
  },
  {
    "path": "packages/os-wily/debian/docs",
    "chars": 18,
    "preview": "Credits\nREADME.md\n"
  },
  {
    "path": "packages/os-wily/debian/files",
    "chars": 38,
    "preview": "vtrunkd2_0.1-1_amd64.deb net optional\n"
  },
  {
    "path": "packages/os-wily/debian/init.d.ex",
    "chars": 4585,
    "preview": "#!/bin/sh\n### BEGIN INIT INFO\n# Provides:          vtrunkd2\n# Required-Start:    $local_fs $network $remote_fs $syslog\n#"
  },
  {
    "path": "packages/os-wily/debian/logrotate",
    "chars": 86,
    "preview": "/var/log/vtrunkd/*.dump {\n  rotate 54\n  daily\n  compress\n  copytruncate\n  missingok\n}\n"
  },
  {
    "path": "packages/os-wily/debian/postinst.ex",
    "chars": 958,
    "preview": "#!/bin/sh\n# postinst script for vtrunkd2\n#\n# see: dh_installdeb(1)\n\nset -e\n\n# summary of how this script can be called:\n"
  },
  {
    "path": "packages/os-wily/debian/postrm.ex",
    "chars": 931,
    "preview": "#!/bin/sh\n# postrm script for vtrunkd2\n#\n# see: dh_installdeb(1)\n\nset -e\n\n# summary of how this script can be called:\n# "
  },
  {
    "path": "packages/os-wily/debian/rules",
    "chars": 865,
    "preview": "#!/usr/bin/make -f\n# See debhelper(7) (uncomment to enable)\n# output every command that modifies files on the build syst"
  },
  {
    "path": "packages/os-wily/debian/source/format",
    "chars": 12,
    "preview": "3.0 (quilt)\n"
  },
  {
    "path": "packages/os-wily/debian/vtrunkd2.substvars",
    "chars": 45,
    "preview": "shlibs:Depends=libc6 (>= 2.15)\nmisc:Depends=\n"
  },
  {
    "path": "packages/os-wily/sources.list",
    "chars": 534,
    "preview": "deb http://us.archive.ubuntu.com/ubuntu/ wily main universe restricted multiverse\ndeb-src http://us.archive.ubuntu.com/u"
  },
  {
    "path": "packet_code.c",
    "chars": 7647,
    "preview": "/*\n * packet_code.c\n *\n *  Created on: 03.04.2014\n *       Copyright (C) 2011-2016 Vrayo Systems Ltd. team \n */\n\n#includ"
  },
  {
    "path": "packet_code.h",
    "chars": 1757,
    "preview": "/*\n * packet_code.h\n *\n *  Created on: 02.04.2014\n *      Author: Vrayo Systems Ltd. team\n */\n\n#ifndef PACKET_CODE_H_\n#d"
  },
  {
    "path": "pid.c",
    "chars": 693,
    "preview": "/*\n * pid.c\n *\n *  Created on: 04.03.2015\n *      Author: Vrayo Systems Ltd. team\n *      issue #635\n */\n\n/**\n *\n * @par"
  },
  {
    "path": "pid.h",
    "chars": 351,
    "preview": "/*\n * pid.h\n *\n *  Created on: 04.03.2015\n *      Author: Vrayo Systems Ltd. team\n */\n\n#ifndef PID_H_\n#define PID_H_\n\nst"
  },
  {
    "path": "pre-commit",
    "chars": 156,
    "preview": "#!/bin/sh\n \nrevision_number=`git describe --abbrev=4 --dirty --always`;\necho \"#define VERSION \\\"$revision_number\\\"\" > ./"
  },
  {
    "path": "scripts/reroute",
    "chars": 1269,
    "preview": "#!/bin/bash\n#\n# Maxim Krasnyansky <max_mk@yahoo.com>\n# reroute,v 1.2.6.1 2006/11/16 04:04:59 mtbishop Exp\n#\nIP=/sbin/ip\n"
  },
  {
    "path": "scripts/rmtree.sh",
    "chars": 422,
    "preview": "#/bin/bash\n\nDIR=$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\n\ncd $DIR\ncd ..\n\n#git rev-parse HEAD > ./REV-HASH\n#if ["
  },
  {
    "path": "scripts/vtund-start.conf",
    "chars": 1174,
    "preview": "### this file defines whether vtund is run as a client or a server\n###\n### format is \"[host] [server] <args>\" or \"--serv"
  },
  {
    "path": "scripts/vtund.rc.debian",
    "chars": 1694,
    "preview": "#! /bin/sh\n#\n# submitted by Morgon Kanter\n# \n\nPATH=/bin:/usr/bin:/sbin:/usr/sbin\nDAEMON=/usr/sbin/vtund\nCONFFILE=/etc/vt"
  },
  {
    "path": "scripts/vtund.rc.red_hat",
    "chars": 891,
    "preview": "#!/bin/sh\n#\n# Script for starting and stoping vtund.\n#\n# Writen by Dag Wieers <dag@mind.be>. \n#\n# chkconfig: 345 55 45\n#"
  },
  {
    "path": "scripts/vtund.rc.suse",
    "chars": 3058,
    "preview": "#!/bin/sh\n#\n# Script for starting and stoping vtund.\n#\n# Writen by Dag Wieers <dag@mind.be>.\n# Updated by willems luc <w"
  },
  {
    "path": "scripts/vtund.rc.suse.config",
    "chars": 55,
    "preview": "#\n# Start VTunnel daemon ? (yes/no)\n#\nSTART_VTUNNEL=no\n"
  },
  {
    "path": "scripts/vtund.xinetd",
    "chars": 412,
    "preview": "service unlisted\n{\n        type                    = UNLISTED\n        port                    = 5000\n        socket_type"
  },
  {
    "path": "server.c",
    "chars": 8345,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  },
  {
    "path": "speed_algo.c",
    "chars": 2544,
    "preview": "/*\n * speed_algo.c\n *\n *  Created on: 22.01.2013\n *      Author: Vrayo Systems Ltd. team\n */\n\n#include <sys/time.h>\n#inc"
  },
  {
    "path": "speed_algo.h",
    "chars": 696,
    "preview": "/*\n * speed_algo.h\n *\n *  Created on: 22.01.2013\n *      Author: Vrayo Systems Ltd. team\n */\n\n#ifndef SPEED_ALGO_H_\n#def"
  },
  {
    "path": "svr4/tap_dev.c",
    "chars": 3374,
    "preview": "/*  \n    VTun - Virtual Tunnel over TCP/IP network.\n\n    Copyright (C) 1998-2000  Maxim Krasnyansky <max_mk@yahoo.com>\n\n"
  },
  {
    "path": "svr4/tun_dev.c",
    "chars": 4125,
    "preview": "/*  \n    VTun - Virtual Tunnel over TCP/IP network.\n\n    Copyright (C) 1998-2000  Maxim Krasnyansky <max_mk@yahoo.com>\n\n"
  },
  {
    "path": "test/lossed.c",
    "chars": 2276,
    "preview": "/*\n Detected loss +-1 by REORDER lsn: 6495; last lsn: 6489, sqn: 1\n2884, lsq before loss 6489\n lossed buffer: complete: "
  },
  {
    "path": "timer.c",
    "chars": 1428,
    "preview": "/*\n * timer.c\n *\n *  Created on: 11.12.2013\n *      Author: Vrayo Systems Ltd. team\n */\n\n#include <sys/time.h>\n#include "
  },
  {
    "path": "timer.h",
    "chars": 777,
    "preview": "/*\n * timer.h\n *\n *  Created on: 11.12.2013\n *      Author: Vrayo Systems Ltd. team\n */\n\n#ifndef TIMER_H_\n#define TIMER_"
  },
  {
    "path": "tunnel.c",
    "chars": 31449,
    "preview": "/*\n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network.\n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n   Vt"
  },
  {
    "path": "udp_states.c",
    "chars": 2987,
    "preview": "/*\n * udp_states.c\n *\n *  Created on: 15.10.2014\n *      Author: Vrayo Systems Ltd. team\n *\n *\n */\n\n#include <errno.h>\n#"
  },
  {
    "path": "udp_states.h",
    "chars": 466,
    "preview": "/*\n * udp_states.h\n *\n *  Created on: 15.10.2014\n *      Author: Vrayo Systems Ltd. team\n */\n\n#ifndef UDP_STATES_H_\n#def"
  },
  {
    "path": "v_struct.h",
    "chars": 19376,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016 Vrayo Systems Ltd. team \n   "
  },
  {
    "path": "version.h",
    "chars": 42,
    "preview": "#define VERSION \"v0.1601-10-g82e93-dirty\"\n"
  },
  {
    "path": "vtrunkd.8",
    "chars": 4612,
    "preview": ".\\\" Manual page for vtrunkd\n.\\\" vtrunkd.8,v 1.4.2.3.2.2 2011/05/08 04:03:59 realgrandrew\n.\\\" SH section heading\n.\\\" SS s"
  },
  {
    "path": "vtrunkd.conf",
    "chars": 8330,
    "preview": "#\n# vtrunkd - Virtual link Trunking daemon\n# (C) 2015-2016 Vrayo Systems Ltd. team (http://vrayo.com/)\n# Copyright (C) 2"
  },
  {
    "path": "vtrunkd.conf.5",
    "chars": 8799,
    "preview": ".\\\" Manual page for vtrunkd.conf\n.\\\" vtrunkd.conf.5,v 1.1.2.6.2.3 2011/05/08 04:04:12 realgrandrew Exp\n.TH VTRUNKD.CONF "
  },
  {
    "path": "vtrunkd_client.conf",
    "chars": 1358,
    "preview": "options {\n    port 5000;\n    timeout 2;\n    ppp /usr/sbin/pppd;\n    ifconfig /sbin/ifconfig;\n    route /sbin/route;\n    "
  },
  {
    "path": "vtun.drivers",
    "chars": 65,
    "preview": "tun_dev.c\ntap_dev.c\npty_dev.c\npipe_dev.c\ntcp_proto.c\nudp_proto.c\n"
  },
  {
    "path": "vtun.h",
    "chars": 11792,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016 Vrayo Systems Ltd. team \n\n  "
  },
  {
    "path": "vtun_socks.h",
    "chars": 1466,
    "preview": "/*  \n   vtrunkd - Virtual Tunnel Trunking over TCP/IP network. \n\n   Copyright (C) 2011-2016  Vrayo Systems Ltd. team\n\n  "
  }
]

About this extraction

This page contains the full source code of the VrayoSystems/vtrunkd GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 173 files (1.1 MB), approximately 320.6k tokens, and a symbol index with 418 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!