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 tun limit,

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

Re: cloneable tun

2012-11-30 Thread Reyk Floeter
On Thu, Nov 29, 2012 at 11:05 PM, Mark Kettenis mark.kette...@xs4all.nl wrote: #!/usr/bin/perl require sys/ioctl.ph; $TUNSIFUNIT = _IOC(IOC_INOUT, ord('t'), 90, 4); open(TUN0, +/dev/tun0) or die open; ioctl(TUN0, $TUNSIFUNIT, $unit = pack(i, -1)) or die ioctl $!; print Returned:

Re: cloneable tun

2012-11-29 Thread Mike Belopuhov
On Wed, Nov 28, 2012 at 10:42 PM, Mark Kettenis mark.kette...@xs4all.nl wrote: From: Mike Belopuhov m...@belopuhov.com Date: Wed, 28 Nov 2012 22:21:07 +0100 On Wed, Nov 28, 2012 at 8:21 PM, Mark Kettenis mark.kette...@xs4all.nl wrote: Date: Wed, 28 Nov 2012 17:39:24 +0100 From: Reyk

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 tun(4)

Re: cloneable tun

2012-11-29 Thread Reyk Floeter
On Thu, Nov 29, 2012 at 10:59 AM, Mike Belopuhov m...@belopuhov.com 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

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 m...@belopuhov.com 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

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 m...@belopuhov.com 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

Re: cloneable tun

2012-11-29 Thread Mark Kettenis
Date: Thu, 29 Nov 2012 13:33:47 +0100 From: Reyk Floeter r...@openbsd.org 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;

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 your

Re: cloneable tun

2012-11-29 Thread Mark Kettenis
Date: Thu, 29 Nov 2012 00:12:39 +0100 From: Reyk Floeter r...@openbsd.org On Wed, Nov 28, 2012 at 10:42 PM, Mark Kettenis mark.kette...@xs4all.nl 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

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 m...@belopuhov.com 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

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,

Re: cloneable tun

2012-11-28 Thread Mark Kettenis
Date: Wed, 28 Nov 2012 17:39:24 +0100 From: Reyk Floeter r...@openbsd.org 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

Re: cloneable tun

2012-11-28 Thread Mark Kettenis
From: Mike Belopuhov m...@belopuhov.com Date: Wed, 28 Nov 2012 22:21:07 +0100 On Wed, Nov 28, 2012 at 8:21 PM, Mark Kettenis mark.kette...@xs4all.nl wrote: Date: Wed, 28 Nov 2012 17:39:24 +0100 From: Reyk Floeter r...@openbsd.org Hi, inspired by mikeb@'s clonable bpf patch, this

Re: cloneable tun

2012-11-28 Thread Philip Guenther
On Wed, Nov 28, 2012 at 1:42 PM, Mark Kettenis mark.kette...@xs4all.nl 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

Re: cloneable tun

2012-11-28 Thread Reyk Floeter
On Wed, Nov 28, 2012 at 10:42 PM, Mark Kettenis mark.kette...@xs4all.nl 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