]> git.proxmox.com Git - mirror_kronosnet.git/commitdiff
[nozzle] fix tapX range on newer FreeBSD
authorFabio M. Di Nitto <fdinitto@redhat.com>
Thu, 12 Sep 2019 04:01:38 +0000 (06:01 +0200)
committerFabio M. Di Nitto <fdinitto@redhat.com>
Thu, 12 Sep 2019 04:01:38 +0000 (06:01 +0200)
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
libnozzle/libnozzle.c

index 91946c64a317c4ae3d031c1ad1b1cb4f739a905b..3a1f827c117e32de04c2ad53aa08faeb56d7b4fa 100644 (file)
@@ -488,7 +488,23 @@ nozzle_t nozzle_open(char *devname, size_t devname_size, const char *updownpath)
 
 #ifdef KNET_BSD
        if (!strlen(devname)) {
+               /*
+                * FreeBSD 13 kernel has changed how the tap module
+                * works and tap0 cannot be removed from the system.
+                * This means that tap0 settings are never reset to default
+                * and nozzle cannot control the default state of the device
+                * when taking over.
+                * nozzle expects some parameters to be default when opening
+                * a tap device (such as random mac address, default MTU, no
+                * other attributes, etc.)
+                *
+                * For 13 and higher, simply skip tap0 as usable device.
+                */
+#if __FreeBSD__ >= 13
+               for (i = 1; i < 256; i++) {
+#else
                for (i = 0; i < 256; i++) {
+#endif
                        snprintf(curnozzle, sizeof(curnozzle) - 1, "/dev/tap%u", i);
                        nozzle->fd = open(curnozzle, O_RDWR);
                        savederrno = errno;