#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;