Source

Tapper /

Filename Size Date modified Message
220 B
2.6 KB
448 B
906 B
5.2 KB
5.8 KB
116 B
102 B
1.8 KB
TAPPER - sample code for work with tap devices on linux

Copyright (c) 2009, Ivan Vucica, http://ivan.vucica.net/
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

 * Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above
   copyright notice, this list of conditions and the following
   disclaimer in the documentation and/or other materials
   provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.

-
 Purpose

Providing simple code for creating a tap device, outputting onto stdout the
network traffic generated by kernel for the tap device, and writing into
tap device the traffic from stdin for processing by the kernel.

That is: a two way tunnel between stdio and tap network device.

-
 Requirements

Not sure. You obviously need tun driver for networking (to be able to
create tap device) -- if you don't have /dev/net/tun something's wrong.

Otherwise, this was made in the era of 2.6.30 kernels on a 2.6.26 kernel,
and with eglibc 2.9 installed (debian release of eglibc 2.9-12).

-
 Files

tapper files:
* tapper.c - provides the tap device
* README - this file
* Makefile - builds tapper
* testrun.sh - shows how to use twinpipe and netcat to tunnel traffic
  in a simple way

nontapper files:
* TINYFREELICENSE - does not apply to tapper. license of twinpipe.sh
* twinpipe.sh - runs two processes and interconnects them via pipes.

twinpipe was obtained from this URL:
 http://bisqwit.iki.fi/source/twinpipe.html

-
 Alternative tutorial with extra info

This is neat and simple code, but perhaps not best and definitely with 
much room for improvement and cleanup. So here's another nice article:
 http://linuxgazette.net/149/melinte.html 
and another one:
 http://waldner.netsons.org/d2-tuntap.php
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.