summaryrefslogtreecommitdiffstats
path: root/src/if-bsd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-10-09 12:47:06 +0100
committerRoy Marples <roy@marples.name>2019-10-09 12:47:06 +0100
commit53228e9540e7a3bc22bac03371b617fd49856a4b (patch)
treed7eb0b35638bd1083727bc503035e196451da69a /src/if-bsd.c
parentd7e6800161ea3811de8726612862e989e8983066 (diff)
downloaddhcpcd-53228e9540e7a3bc22bac03371b617fd49856a4b.tar.xz
if: Ignore TAP interfaces by default
TAP interfaces are virtual ethernet and not really distinguishable from real interfaces other than the interface name. On BSD the interfaces are always called tapN.
Diffstat (limited to 'src/if-bsd.c')
-rw-r--r--src/if-bsd.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/if-bsd.c b/src/if-bsd.c
index 89013b11..476a3fe2 100644
--- a/src/if-bsd.c
+++ b/src/if-bsd.c
@@ -101,6 +101,12 @@
#define RT_ADVANCE(x, n) (x += RT_ROUNDUP((n)->sa_len))
#endif
+/* Ignore these interface names which look like ethernet but are virtual. */
+static const char * const ifnames_ignore[] = {
+ "tap",
+ NULL
+};
+
#ifdef INET6
static void ifa_setscope(struct sockaddr_in6 *, unsigned int);
static unsigned int ifa_getscope(const struct sockaddr_in6 *);
@@ -208,6 +214,18 @@ if_closesockets_os(struct dhcpcd_ctx *ctx)
close(priv->pf_inet6_fd);
}
+bool
+if_ignore(const char *drvname)
+{
+ const char * const *p;
+
+ for (p = ifnames_ignore; *p; p++) {
+ if (strcmp(*p, drvname) == 0)
+ return true;
+ }
+ return false;
+}
+
int
if_carrier(struct interface *ifp)
{