Handle tun/tap device returning EPERM or EBUSY.
[oweals/tinc.git] / src / linux / device.c
index f75f4bdb741ca58c5f9b0df32fa7fdf3b71764ef..990de6a812149131190ebd2918bee0b471c14536 100644 (file)
@@ -125,6 +125,9 @@ static bool setup_device(void) {
                ifrname[IFNAMSIZ - 1] = 0;
                free(iface);
                iface = xstrdup(ifrname);
+       } else if(errno == EPERM || errno == EBUSY) {
+               logger(LOG_ERR, "Error while trying to configure %s: %s", device, strerror(errno));
+               return false;
        } else if(!ioctl(device_fd, (('T' << 8) | 202), &ifr)) {
                logger(LOG_WARNING, "Old ioctl() request was needed for %s", device);
                strncpy(ifrname, ifr.ifr_name, IFNAMSIZ);