>       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, and think it would make more sense to to write code that dynamically 
creates tun interfaces (in C/C++ progs such as the mentioned) if you didn't 
have to use system() or something like

if (stat(node, &_stat) == 0)
        continue;
dev_t dev = makedev(40, i); // from MAKEDEV :(
if (mknod(node, 0600 | S_IFCHR, dev) < 0) // from MAKEDEV :(
        syslog(LOG_ERR, "mknod %s: %m", node);
chown(node, 0, 0);

but rather the ioctl example above.

Reply via email to