[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

first shot at tunnel interface for pfinet


in light of the recent discussions, and considering that no code resulted
from them, I had a go at the Hurd related changes for a tunnel interface in

NOTE: This is an early-development-stage-patch-for-interested-hacker, NOT
a user-consumable-ready-to-go-patch-to-get-ppp-working.

The tunnel interface is almost done[1]. What is missing? Well, there are some
interface options for the linux kernel code we glue to, that need to be
adjusted to get the correct input/output for a BSD tunnel interface. At
least I think that is necessary. Currently, the interface emits ethernet
frames, if I am not completely mistaken, and who knows what happens with the
data you send to it. Apropos sending: Writing seems to be quite unstable,
there are a couple of callbacks missing, and if you try to write with tools
like "cat > /dev/tun0" you will get EIOIO and Resource lost and other
inconvient stuff. However, normal write() seems to work fine. Mmmh.

What do you get with this patch? Well, a new interface type,
--interface=tunX, where X is something. This creates a new translated node,
/dev/tunX, which you can read and write to. There is a new option to set the
peer address (-p, --peer). This is used like this:

settrans -fg /servers/socket/2 -i tun0 -a -p

The netmask must not be set (it will be set to
automatically). I did not try setting the gateway, but it should work.

If you have screen, try "cat /dev/tun0" on one screen, and "ping"
on the other. You will see how the packages appear on the first screen when
pfinet sends them. Testing if write works correctly is harder, as you need
to produce valid network packages in user space. I expect that some further
debugging is necessary to make it work with ppp.

What else? select() works! As well as reading in O_NONBLOCK mode. This is
required for ppp as well.

What's to be done?
* Implement all other required callbacks for trivfs.
* If this doesn't fix write(), check it out.
* Correct protocol details, see tunnel.c::tunnel_xmit (for packages
  from the IP layer to the tunnel device), tunnel.c::trivfs_S_io_write
  (for packages from the tunnel device in the IP layer) and probably
  tunnel.c::setup_tunnel_device for initial setup of the interface.

Especially with the latter I could use help. This is NOT Hurd specific, but
rather requires some knowledge about the Linux networking code in general
and the BSD tunnel device in particular. Both areas are quite new to me, and
I really would appreciate help here.

* Porting user space ppp.
  This should be a piece of cake, but requires some careful code reading and
  debugging. There are generic porting issues, as well as the need to turn
  ioctls into fsysopts calls.

So. 'nuff said. The patch is attached.

Further discussion will happen on bug-hurd@gnu.org ONLY, so please subscribe
if you haven't already.


[1] But remember that the remaining 10% take 90% of the time.

`Rhubarb is no Egyptian god.' Debian http://www.debian.org Check Key server 
Marcus Brinkmann              GNU    http://www.gnu.org    for public PGP Key 
Marcus.Brinkmann@ruhr-uni-bochum.de,     marcus@gnu.org    PGP Key ID 36E7CD09
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/       brinkmd@debian.org

Attachment: pfinet-tunnel.diff.gz
Description: Binary data

Reply to: