diff --git a/src/ap/vlan_ifconfig.c b/src/ap/vlan_ifconfig.c
index 6a4d10cd4..ef953a5c4 100644
--- a/src/ap/vlan_ifconfig.c
+++ b/src/ap/vlan_ifconfig.c
@@ -61,3 +61,9 @@ int ifconfig_up(const char *if_name)
 	wpa_printf(MSG_DEBUG, "VLAN: Set interface %s up", if_name);
 	return ifconfig_helper(if_name, 1);
 }
+
+
+int iface_exists(const char *ifname)
+{
+	return if_nametoindex(ifname);
+}
diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c
index b8ca4f759..31e4fc6b3 100644
--- a/src/ap/vlan_init.c
+++ b/src/ap/vlan_init.c
@@ -9,9 +9,6 @@
  */
 
 #include "utils/includes.h"
-#include <net/if.h>
-/* Avoid conflicts due to NetBSD net/if.h if_type define with driver.h */
-#undef if_type
 
 #include "utils/common.h"
 #include "hostapd.h"
@@ -36,7 +33,7 @@ static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
 		return -1;
 	}
 
-	if (!if_nametoindex(vlan->ifname))
+	if (!iface_exists(vlan->ifname))
 		ret = hostapd_vlan_if_add(hapd, vlan->ifname);
 	else if (!existsok)
 		return -1;
diff --git a/src/ap/vlan_util.h b/src/ap/vlan_util.h
index 5e9e690c0..244685975 100644
--- a/src/ap/vlan_util.h
+++ b/src/ap/vlan_util.h
@@ -19,6 +19,7 @@ int vlan_set_name_type(unsigned int name_type);
 
 int ifconfig_helper(const char *if_name, int up);
 int ifconfig_up(const char *if_name);
+int iface_exists(const char *ifname);
 int vlan_if_remove(struct hostapd_data *hapd, struct hostapd_vlan *vlan);
 
 struct full_dynamic_vlan *