Re: cloneable tun

2012-12-03 Thread Anders Berggren
>> dev_t dev = makedev(40, i); // from MAKEDEV :( > > 40 is incorrect. It is MD. > > /usr/src/etc/etc.alpha/MAKEDEV: M tun$U c 7 $U 600 > /usr/src/etc/etc.amd64/MAKEDEV: M tun$U c 40 $U 600 Thanks, guess I'd better use system("cd /dev; sh MAKEDEV tunX");

Re: cloneable tun

2012-12-03 Thread Theo de Raadt
> dev_t dev = makedev(40, i); // from MAKEDEV :( 40 is incorrect. It is MD. /usr/src/etc/etc.alpha/MAKEDEV: M tun$U c 7 $U 600 /usr/src/etc/etc.amd64/MAKEDEV: M tun$U c 40 $U 600 /usr/src/etc/etc.armish/MAKEDEV:M tun$U c 33 $U 600 /usr/src/etc/etc.aviion/MAKEDEV:M tun$U c 23 $U 6

Re: cloneable tun

2012-12-03 Thread Anders Berggren
> unit = 13; >if ((fd = open("/dev/tun0", O_RDONLY)) == -1) >err(1, "failed to open /dev/tun0"); >if (ioctl(fd, TUNSIFUNIT, &unit) == -1) >err(1, "ioctl failed"); I like it. I've got a few questions from npppd and openvpn users hitting the 4 t

Re: cloneable tun

2012-12-01 Thread Alexander Hall
Reyk Floeter wrote: >On Wed, Nov 28, 2012 at 10:42 PM, Mark Kettenis > wrote: >> But currently /dev/tunN is usable from any programming language that >> that can do reads and writes. With Reyk's changes you need to do an >> ioctl even for basic usage, which is at best quirky in languages >other

Re: cloneable tun

2012-11-30 Thread Reyk Floeter
On Thu, Nov 29, 2012 at 11:05 PM, Mark Kettenis wrote: >> #!/usr/bin/perl >> require "sys/ioctl.ph"; >> $TUNSIFUNIT = _IOC(&IOC_INOUT, ord('t'), 90, 4); >> open(TUN0, "+> ioctl(TUN0, $TUNSIFUNIT, $unit = pack("i", -1)) or die "ioctl $!"; >> print "Returned: tun".unpack("i", $unit)."\n"; >> close(T

Re: cloneable tun

2012-11-29 Thread Todd T. Fries
Penned by Reyk Floeter on 20121129 6:33.47, we have: | On Thu, Nov 29, 2012 at 10:59 AM, Mike Belopuhov wrote: | >> But currently /dev/tunN is usable from any programming language that | >> that can do reads and writes. With Reyk's changes you need to do an | >> ioctl even for basic usage, which

Re: cloneable tun

2012-11-29 Thread Mark Kettenis
> Date: Thu, 29 Nov 2012 00:12:39 +0100 > From: Reyk Floeter > > On Wed, Nov 28, 2012 at 10:42 PM, Mark Kettenis > wrote: > > But currently /dev/tunN is usable from any programming language that > > that can do reads and writes. With Reyk's changes you need to do an > > ioctl even for basic us

Re: cloneable tun

2012-11-29 Thread Grumpy
> My favourite "quick-and-dirty" language is Python, and I consider > myself a fairly proficient Python programmer. I've never, ever, done > ioctls from Python, and while it looks indeed as if it is possible to > do so, I'm sure it'd take me some effort to get it right. I definitely agree with yo

Re: cloneable tun

2012-11-29 Thread Mark Kettenis
> Date: Thu, 29 Nov 2012 13:33:47 +0100 > From: Reyk Floeter > > btw., I like C and it is still my favorite language (sorry, CS > people). But it shouldn't be a problem to do simple ioctls with most > other languages except shell scripts. > > #!/usr/bin/perl > require "sys/ioctl.ph"; > $TUNSIFUN

Re: cloneable tun

2012-11-29 Thread Gerhard Roth
On 11/29/2012 01:33 PM, Reyk Floeter wrote: > On Thu, Nov 29, 2012 at 10:59 AM, Mike Belopuhov wrote: >>> But currently /dev/tunN is usable from any programming language that >>> that can do reads and writes. With Reyk's changes you need to do an >>> ioctl even for basic usage, which is at best q

Re: cloneable tun

2012-11-29 Thread Marc Espie
On Thu, Nov 29, 2012 at 01:33:47PM +0100, Reyk Floeter wrote: > On Thu, Nov 29, 2012 at 10:59 AM, Mike Belopuhov wrote: > >> But currently /dev/tunN is usable from any programming language that > >> that can do reads and writes. With Reyk's changes you need to do an > >> ioctl even for basic usag

Re: cloneable tun

2012-11-29 Thread Reyk Floeter
On Thu, Nov 29, 2012 at 10:59 AM, Mike Belopuhov wrote: >> But currently /dev/tunN is usable from any programming language that >> that can do reads and writes. With Reyk's changes you need to do an >> ioctl even for basic usage, which is at best quirky in languages other >> than C/C++. That fee

Re: cloneable tun

2012-11-29 Thread Stuart Henderson
On 2012/11/28 22:21, Mike Belopuhov wrote: > >> Drawback: This diff would require to patch all the existing users of > >> /dev/tun* in ports and the tree to add the TUNSIFUNIT ioctl. The > >> benefit is that you don't have to MAKEDEV all the tuns anymore and can > >> open up to around 1024 active

Re: cloneable tun

2012-11-29 Thread Mike Belopuhov
On Wed, Nov 28, 2012 at 10:42 PM, Mark Kettenis wrote: >> From: Mike Belopuhov >> Date: Wed, 28 Nov 2012 22:21:07 +0100 >> >> On Wed, Nov 28, 2012 at 8:21 PM, Mark Kettenis >> wrote: >> >> Date: Wed, 28 Nov 2012 17:39:24 +0100 >> >> From: Reyk Floeter >> >> >> >> Hi, >> >> >> >> inspired by mi

Re: cloneable tun

2012-11-28 Thread Reyk Floeter
On Wed, Nov 28, 2012 at 10:42 PM, Mark Kettenis wrote: > But currently /dev/tunN is usable from any programming language that > that can do reads and writes. With Reyk's changes you need to do an > ioctl even for basic usage, which is at best quirky in languages other > than C/C++. That feels li

Re: cloneable tun

2012-11-28 Thread Philip Guenther
On Wed, Nov 28, 2012 at 1:42 PM, Mark Kettenis wrote: > But currently /dev/tunN is usable from any programming language that > that can do reads and writes. With Reyk's changes you need to do an > ioctl even for basic usage, which is at best quirky in languages other > than C/C++. That feels lik

Re: cloneable tun

2012-11-28 Thread Mark Kettenis
> From: Mike Belopuhov > Date: Wed, 28 Nov 2012 22:21:07 +0100 > > On Wed, Nov 28, 2012 at 8:21 PM, Mark Kettenis > wrote: > >> Date: Wed, 28 Nov 2012 17:39:24 +0100 > >> From: Reyk Floeter > >> > >> Hi, > >> > >> inspired by mikeb@'s clonable bpf patch, this slightly more complex > >> diff im

Re: cloneable tun

2012-11-28 Thread Mike Belopuhov
On Wed, Nov 28, 2012 at 8:21 PM, Mark Kettenis wrote: >> Date: Wed, 28 Nov 2012 17:39:24 +0100 >> From: Reyk Floeter >> >> Hi, >> >> inspired by mikeb@'s clonable bpf patch, this slightly more complex >> diff implements clonable interface support to tun(4). >> >> The idea is to split the fixed re

Re: cloneable tun

2012-11-28 Thread Mark Kettenis
> Date: Wed, 28 Nov 2012 17:39:24 +0100 > From: Reyk Floeter > > Hi, > > inspired by mikeb@'s clonable bpf patch, this slightly more complex > diff implements clonable interface support to tun(4). > > The idea is to split the fixed relation between device minor number > (/dev/tunX) and interfac

cloneable tun

2012-11-28 Thread Reyk Floeter
Hi, inspired by mikeb@'s clonable bpf patch, this slightly more complex diff implements clonable interface support to tun(4). The idea is to split the fixed relation between device minor number (/dev/tunX) and interface unit (ifconfig tunY). In difference to the current tun(4) implementation, op