#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 *);
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)
{
return 0;
}
+/* XXX work out TAP interfaces? */
+bool
+if_ignore(__unused const char *drvname)
+{
+
+ return false;
+}
+
/* XXX work out Virtal Interface Masters */
int
if_vimaster(__unused const struct dhcpcd_ctx *ctx, __unused const char *ifname)
}
int
-if_getssid(struct interface *ifp)
+if_getssid(__unused struct interface *ifp)
{
- UNUSED(ifp);
errno = ENOTSUP;
return -1;
}
+/* XXX work out TAP interfaces? */
+bool
+if_ignore(__unused const char *drvname)
+{
+
+ return false;
+}
+
unsigned short
if_vlanid(__unused const struct interface *ifp)
{
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",
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__);
#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"
int if_conf(struct interface *);
int if_init(struct interface *);
int if_getssid(struct interface *);
+bool if_ignore(const char *);
int if_vimaster(const struct dhcpcd_ctx *ctx, const char *);
unsigned short if_vlanid(const struct interface *);
int if_opensockets(struct dhcpcd_ctx *);