Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Oct 1996 10:02:20 PST
From:      Bill Fenner <fenner@parc.xerox.com>
To:        Hemon Bruno <bruno@cs.ucla.edu>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: FreeBSD and IP tunneling 
Message-ID:  <96Oct30.100232pst.177480@crevenia.parc.xerox.com>
In-Reply-To: Your message of "Tue, 29 Oct 1996 15:37:30 PST." <Pine.SOL.3.95.961029153419.2627D-100000@tusk.cs.ucla.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
Packets sent on the tun* interfaces show up as data to be read on /dev/tun*.
Data written on /dev/tun* shows up as input packets on the tun* interfaces.
So, if you want to do UDP encapsulated tunnelling, you should do something like

	open(/dev/tun0)
	socket(...,SOCK_DGRAM,...);
	bind();
	connect();
	while(1) {
		select on the file and the socket
		if data is available from the file, write it to the socket
		if data is available from the socket, write it to the file
	}

You probably want to make the MTU of the tun device 28 bytes less than the 
path-MTU of the tunnel.  You can do this with ioctl(...,TUNSIFINFO,...) on the 
file.

  Bill




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?96Oct30.100232pst.177480>