summaryrefslogtreecommitdiffstats
path: root/src/if.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.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.c')
-rw-r--r--src/if.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/if.c b/src/if.c
index c483f046..b9cf63ed 100644
--- a/src/if.c
+++ b/src/if.c
@@ -405,13 +405,6 @@ if_discover(struct dhcpcd_ctx *ctx, struct ifaddrs **ifaddrs,
continue;
#endif
- /* Don't allow loopback or pointopoint unless explicit */
- if (ifa->ifa_flags & (IFF_LOOPBACK | IFF_POINTOPOINT)) {
- if ((argc == 0 || argc == -1) &&
- ctx->ifac == 0 && !if_hasconf(ctx, spec.devname))
- active = IF_INACTIVE;
- }
-
if (if_vimaster(ctx, spec.devname) == 1) {
logfunc_t *logfunc = argc != 0 ? logerrx : logdebugx;
logfunc("%s: is a Virtual Interface Master, skipping",
@@ -419,6 +412,17 @@ if_discover(struct dhcpcd_ctx *ctx, struct ifaddrs **ifaddrs,
continue;
}
+#define IF_NOCONF ((argc == 0 || argc == -1) && ctx->ifac == 0 && \
+ !if_hasconf(ctx, spec.devname))
+
+ /* Don't allow loopback or pointopoint unless explicit.
+ * Don't allow some reserved interface names unless explicit. */
+ if (IF_NOCONF) {
+ if (ifa->ifa_flags & (IFF_LOOPBACK | IFF_POINTOPOINT) ||
+ if_ignore(spec.drvname))
+ active = IF_INACTIVE;
+ }
+
ifp = calloc(1, sizeof(*ifp));
if (ifp == NULL) {
logerr(__func__);
@@ -495,9 +499,7 @@ if_discover(struct dhcpcd_ctx *ctx, struct ifaddrs **ifaddrs,
#endif
default:
/* Don't allow unless explicit */
- if ((argc == 0 || argc == -1) &&
- ctx->ifac == 0 &&
- !if_hasconf(ctx, ifp->name))
+ if (IF_NOCONF)
active = IF_INACTIVE;
if (active)
logwarnx("%s: unsupported"