From owner-freebsd-hackers Wed Oct 30 10:03:32 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id KAA16988 for hackers-outgoing; Wed, 30 Oct 1996 10:03:32 -0800 (PST) Received: from alpha.xerox.com (alpha.Xerox.COM [13.1.64.93]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id KAA16978 for ; Wed, 30 Oct 1996 10:03:25 -0800 (PST) Received: from crevenia.parc.xerox.com ([13.2.116.11]) by alpha.xerox.com with SMTP id <14972(4)>; Wed, 30 Oct 1996 10:02:43 PST Received: from localhost ([127.0.0.1]) by crevenia.parc.xerox.com with SMTP id <177480>; Wed, 30 Oct 1996 10:02:32 -0800 X-Mailer: exmh version 1.6.7 5/3/96 To: Hemon Bruno cc: freebsd-hackers@freebsd.org Subject: Re: FreeBSD and IP tunneling In-reply-to: Your message of "Tue, 29 Oct 1996 15:37:30 PST." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 30 Oct 1996 10:02:20 PST From: Bill Fenner Message-Id: <96Oct30.100232pst.177480@crevenia.parc.xerox.com> Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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