Reading packets from a tun device.

PenguinOfDoom pahan at gmx.net
Sun Jul 13 09:26:35 EDT 2003


Andre <andre at netvision.com.br> wrote in message news:<mailman.1058041398.21541.python-list at python.org>...
> I'm trying to read packets from a tun device in Python, the code I used 
> for this is the following:
> 
> f = file( '/dev/tun0', 'r+' )
<snip sad story>

You appear to be using the ethertap driver. That is obsolete. You want
the new tuntap driver (module tun).
Also, Twisted (www.twistedmatrix.com) can conveniently handle tuntap
devices. You'll have to get the CVS version. The code is in
twisted.pair.tuntap. This is not terribly tested or stable.
Low-level functionality (opening the tuntap device) is provided by the
Eunuchs project. I can't seem to find a website for it, but the module
is available in Debian as python2.2-eunuchs.
You could poke Tommi Virtanen for more details. He's Tv on
irc.freenode.net




More information about the Python-list mailing list