From owner-freebsd-hackers Fri Nov 1 07:49:23 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id HAA15952 for hackers-outgoing; Fri, 1 Nov 1996 07:49:23 -0800 (PST) Received: from brasil.moneng.mei.com (brasil.moneng.mei.com [151.186.109.160]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id HAA15915 for ; Fri, 1 Nov 1996 07:49:09 -0800 (PST) Received: (from jgreco@localhost) by brasil.moneng.mei.com (8.7.Beta.1/8.7.Beta.1) id JAA00306; Fri, 1 Nov 1996 09:47:33 -0600 From: Joe Greco Message-Id: <199611011547.JAA00306@brasil.moneng.mei.com> Subject: Re: FreeBSD and IP tunneling To: fenner@parc.xerox.com (Bill Fenner) Date: Fri, 1 Nov 1996 09:47:32 -0600 (CST) Cc: bruno@cs.ucla.edu, freebsd-hackers@FreeBSD.ORG In-Reply-To: <96Oct30.100232pst.177480@crevenia.parc.xerox.com> from "Bill Fenner" at Oct 30, 96 10:02:20 am X-Mailer: ELM [version 2.4 PL24] Content-Type: text 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 > } Here this is in code... do not be deceived by the name, it is literally a VERY simple set of bare bones functions to play with this stuff right now. I hope to develop it into a useful set of tools. begin 644 tunneltools.tar.gz M'XL("`S#-#("`W1U;FYE;'1O;VQS+G1A<@#M&6MOVS;07^U?P6:8(R>N+3_3 MQDV!H&F&8%T")"W6+0L,6J)L+K)DD)33;,A_WQTIR9*EI"VV-%AA`K&H.]Z; MNCLR*@H"YJLP]&6[\DB#].V]P8!4"!G:_:Y^]OI]?";#!E"W,^CT.[UACY!. M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