Allow the cloning /dev/tap interface to be used on FreeBSD and NetBSD.
[oweals/tinc.git] / src / bsd / device.c
index fd1f35ddaa77e83bdef189d6f0e4afff1ccac85e..06889e3c30e372d3cf7fdfb1ecbbc7a5e1847ed3 100644 (file)
@@ -150,6 +150,17 @@ bool setup_device(void) {
                        if(routing_mode == RMODE_ROUTER)
                                overwrite_mac = true;
                        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;
 #ifdef HAVE_TUNEMU
                case DEVICE_TYPE_TUNEMU: