Browse Source

Added documentation for Ether2Any

Sebastian Lohff 7 years ago
parent
commit
dc84f0265f
4 changed files with 39 additions and 13 deletions
  1. 38
    0
      README
  2. 0
    5
      Readme
  3. 0
    7
      TODO
  4. 1
    1
      ether2any.py

+ 38
- 0
README View File

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

+ 0
- 5
Readme View File

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

+ 0
- 7
TODO View File

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

+ 1
- 1
ether2any.py View File

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

Loading…
Cancel
Save