Added documentation for Ether2Any

This commit is contained in:
Sebastian Lohff 2012-01-12 00:34:12 +01:00
parent 12aa0d08e0
commit dc84f0265f
4 changed files with 39 additions and 13 deletions

38
README Normal file
View File

@ -0,0 +1,38 @@
Ether2Any and PyTap
===================
Ether2Any is a python baseclass for writing arbitrary Ethernet/IP tunnel using
a TUN/TAP device.
PyTap is a python class for handling a TUN/TAP device. It exposes read/write
and abstracts a bit of the network configuration.
Installation and requirements
=============================
Just put it somewhere and import it. For PyTaps network configuration
functions you need /sbin/ifconfig.
How to write an Ethernet/IP tunnel
==================================
Writing a tunnel with this is rather easy. All you have to do create a class
inheriting from Ether2Any and implement the method sendToNet(). sendToNet()
will be called for each incoming network packet. If you add extra sockets
to the select loop via addSocket, sendToDev() needs to be implemented,
which gets the socket on which new data is ready. If you don't want to rely
on select you are free to pass self.dev (which is a PyTap() instance) and
call dev.write() whenever you like. Note that if you write invalid network
packets on it, you might get an exception.
Afterwards you can instanciate your class and call the run() method to start
your tunnel.
What could be done
==================
* At the beginning of each packet there are
* Builtin packet aggregation would be nice
* Various FIXMEs/TODOs
* Replace ifconfig with the ip utility
* Add plugin architecture to pytap for traffic mangling
* setuptools/pypi dance

5
Readme
View File

@ -1,5 +0,0 @@
Documentation
http://www.kernel.org/doc/Documentation/networking/tuntap.txt

7
TODO
View File

@ -1,7 +0,0 @@
TODO
- 00 80 at beginning of every packet - what is this?
- writing random data to dev generates OSError - handle this
FEATURES
- implement configurable packet aggregation
- if possible and useful: helper to replace ethernet

View File

@ -6,7 +6,7 @@ import logging
from pytap import TapDevice from pytap import TapDevice
class Ether2Any: class Ether2Any:
""" Baseclass for writing arbitrary Ethernet/IP Tunnels using TUN/TAP device. """ Baseclass for writing arbitrary Ethernet/IP tunnel using a TUN/TAP device.
This class handles a TUN/TAP devices and runs a select loop for it and, This class handles a TUN/TAP devices and runs a select loop for it and,
if given, a set of sockets. To use this class at least sendToNet() has if given, a set of sockets. To use this class at least sendToNet() has