close(priv->pf_inet6_fd);
}
-bool
-if_ignore(const char *drvname)
+static bool
+if_ignore1(const char *drvname)
{
const char * const *p;
return false;
}
+bool
+if_ignore(struct dhcpcd_ctx *ctx, const char *ifname)
+{
+ struct if_spec spec;
+
+ if (if_nametospec(ifname, &spec) != 0)
+ return false;
+
+ if (if_ignore1(spec.drvname))
+ return true;
+
+#ifdef SIOCGIFGROUP
+ struct ifgroupreq ifgr = { .ifgr_len = 0 };
+ struct ifg_req *ifg;
+ size_t ifg_len;
+
+ strlcpy(ifgr.ifgr_name, ifname, sizeof(ifgr.ifgr_name));
+ if (ioctl(ctx->pf_inet_fd, SIOCGIFGROUP, &ifgr) == -1 ||
+ (ifgr.ifgr_groups = malloc(ifgr.ifgr_len)) == NULL ||
+ ioctl(ctx->pf_inet_fd, SIOCGIFGROUP, &ifgr) == -1)
+ {
+ logerr(__func__);
+ return false;
+ }
+
+ for (ifg = ifgr.ifgr_groups, ifg_len = ifgr.ifgr_len;
+ ifg && ifg_len >= sizeof(*ifg);
+ ifg++, ifg_len -= sizeof(*ifg))
+ {
+ if (if_ignore1(ifg->ifgrq_group))
+ return true;
+ }
+#else
+ UNUSED(ctx);
+#endif
+
+ return false;
+}
+
int
if_carrier(struct interface *ifp)
{
/* XXX work out TAP interfaces? */
bool
-if_ignore(__unused const char *drvname)
+if_ignore(__unused struct dhcpcd_ctx *ctx, __unused const char *ifname)
{
return false;
/* XXX work out TAP interfaces? */
bool
-if_ignore(__unused const char *drvname)
+if_ignore(__unused struct dhcpcd_ctx *ctx, __unused const char *ifname)
{
return false;
* Don't allow some reserved interface names unless explicit. */
if (IF_NOCONF) {
if (ifa->ifa_flags & (IFF_LOOPBACK | IFF_POINTOPOINT) ||
- if_ignore(spec.drvname))
+ if_ignore(ctx, spec.devname))
active = IF_INACTIVE;
}
int if_conf(struct interface *);
int if_init(struct interface *);
int if_getssid(struct interface *);
-bool if_ignore(const char *);
+bool if_ignore(struct dhcpcd_ctx *, 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 *);