Allow the cloning /dev/tap interface to be used on FreeBSD and NetBSD.
This device works like /dev/tun on Linux, automatically creating a new tap interface when a program opens it. We now pass the actual name of the newly created interface in $INTERFACE.
This commit is contained in:
parent
92b8abc921
commit
ec4c8bcb18
1 changed files with 11 additions and 0 deletions
|
@ -150,6 +150,17 @@ bool setup_device(void) {
|
||||||
if(routing_mode == RMODE_ROUTER)
|
if(routing_mode == RMODE_ROUTER)
|
||||||
overwrite_mac = true;
|
overwrite_mac = true;
|
||||||
device_info = "Generic BSD tap device";
|
device_info = "Generic BSD tap device";
|
||||||
|
#ifdef TAPGIFNAME
|
||||||
|
{
|
||||||
|
struct ifreq ifr;
|
||||||
|
if(ioctl(device_fd, TAPGIFNAME, (void*)&ifr) == 0) {
|
||||||
|
if(iface)
|
||||||
|
free(iface);
|
||||||
|
iface = xstrdup(ifr.ifr_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_TUNEMU
|
#ifdef HAVE_TUNEMU
|
||||||
case DEVICE_TYPE_TUNEMU:
|
case DEVICE_TYPE_TUNEMU:
|
||||||
|
|
Loading…
Reference in a new issue