summaryrefslogtreecommitdiffstats
path: root/net.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2014-01-21 15:57:30 +0000
committerRoy Marples <roy@marples.name>2014-01-21 15:57:30 +0000
commitddfe5016ba8f7068100e16e6099a3d3555da0658 (patch)
treeb716b27120c54b4e54f3ee83fcefbd9138295e44 /net.c
parent5979b608418931a73b2be8c0bd5011af44624299 (diff)
downloaddhcpcd-ddfe5016ba8f7068100e16e6099a3d3555da0658.tar.xz
Skip Virtual Interface Masters.
Currently this only applies to FreeBSD VAP masters as dhcpcd should only work on wlandev created clones.
Diffstat (limited to 'net.c')
-rw-r--r--net.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/net.c b/net.c
index 390fff9f..1cf601e4 100644
--- a/net.c
+++ b/net.c
@@ -186,6 +186,33 @@ carrier_status(struct interface *iface)
return ret;
}
+/*
+ * FreeBSD allows for Virtual Access Points
+ * We need to check if the interface is a Virtual Interface Master
+ * and if so, don't use it.
+ */
+static int
+vi_master(const char *ifname)
+{
+#ifdef SIOCGIFMEDIA
+ struct ifmediareq ifmr;
+ char ssid[IF_SSIDSIZE];
+
+ memset(&ifmr, 0, sizeof(ifmr));
+ strlcpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name));
+ if (ioctl(socket_afnet, SIOCGIFMEDIA, &ifmr) == -1)
+ return -1;
+ if (ifmr.ifm_status & IFM_AVALID &&
+ IFM_TYPE(ifmr.ifm_active) == IFM_IEEE80211)
+ {
+ if (getifssid(ifname, ssid) == -1)
+ return 1;
+ }
+#endif
+
+ return 0;
+}
+
int
up_interface(struct interface *iface)
{
@@ -318,6 +345,13 @@ discover_interfaces(int argc, char * const *argv)
if (ifac && i == ifac)
continue;
+ if (vi_master(ifa->ifa_name) == 1) {
+ syslog(LOG_DEBUG,
+ "%s: is a Virtual Interface Master, skipping",
+ ifa->ifa_name);
+ continue;
+ }
+
ifp = calloc(1, sizeof(*ifp));
if (ifp == NULL)
return NULL;