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 usage, which is at best quirky in languages other
| >> than C/C++.  That feels like a step backward to me.
| >
| > sure, we can totally leave tun for legacy use in the shell scripts.
| > so i guess reyk should go ahead and implement a dynamic tun interface
| > (dun?) with whatever semantics we need and want.
| 
| Or even better duh? ;-) I wrote this diff because I wanted to
| experiment with clonable device nodes, I still don't like the fact
| that you have to MAKEDEV a device per dynamic interface, and because
| it adds some extra flexibility. But it doesn't have to go anywhere, I
| didn't even waste much time with writing it yesterday in the
| afternoon.
| 
| 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";
| $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: tun".unpack("i", $unit)."\n";
| close(TUN0);
| 
| reyk

Wouldn't it just be easier to auto assign on first read/write if the
$TUNSIFUNIT ioctl has not yet been called?

Thanks,
-- 
Todd Fries .. t...@fries.net

 ____________________________________________
|                                            \  1.636.410.0632 (voice)
| Free Daemon Consulting, LLC                \  1.405.227.9094 (voice)
| http://FreeDaemonConsulting.com            \  1.866.792.3418 (FAX)
| PO Box 16169, Oklahoma City, OK 73113      \  sip:freedae...@ekiga.net
| "..in support of free software solutions." \  sip:4052279...@ekiga.net
 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
                                                 
              37E7 D3EB 74D0 8D66 A68D  B866 0326 204E 3F42 004A
                        http://todd.fries.net/pgp.txt

Reply via email to