From dc84f0265f2717b78cb0f0ea28116293514a1d85 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Thu, 12 Jan 2012 00:34:12 +0100 Subject: [PATCH] Added documentation for Ether2Any --- README | 38 ++++++++++++++++++++++++++++++++++++++ Readme | 5 ----- TODO | 7 ------- ether2any.py | 2 +- 4 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 README delete mode 100644 Readme delete mode 100644 TODO diff --git a/README b/README new file mode 100644 index 0000000..e0b2083 --- /dev/null +++ b/README @@ -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 diff --git a/Readme b/Readme deleted file mode 100644 index 80d29b1..0000000 --- a/Readme +++ /dev/null @@ -1,5 +0,0 @@ - - - -Documentation - http://www.kernel.org/doc/Documentation/networking/tuntap.txt diff --git a/TODO b/TODO deleted file mode 100644 index ae50ed4..0000000 --- a/TODO +++ /dev/null @@ -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 diff --git a/ether2any.py b/ether2any.py index 864348f..2b25cf6 100644 --- a/ether2any.py +++ b/ether2any.py @@ -6,7 +6,7 @@ import logging from pytap import TapDevice 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, if given, a set of sockets. To use this class at least sendToNet() has