summaryrefslogtreecommitdiffstats
path: root/if.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2014-11-18 12:06:08 +0000
committerRoy Marples <roy@marples.name>2014-11-18 12:06:08 +0000
commit4d91c2e720f229921793f7f04c29e31977b22896 (patch)
tree571970e212ac90c6c3dab02f8b6c315312dbbf05 /if.c
parent0b626d5c0eb7c1ea0dd77abd9af6e2cd51b63b10 (diff)
downloaddhcpcd-4d91c2e720f229921793f7f04c29e31977b22896.tar.xz
If allowinterfaces is not specified, allow all configured interfaces
to work, such as loopback and ppp.
Diffstat (limited to 'if.c')
-rw-r--r--if.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/if.c b/if.c
index c1858a03..8f012521 100644
--- a/if.c
+++ b/if.c
@@ -166,6 +166,18 @@ if_setflag(struct interface *ifp, short flag)
return r;
}
+static int
+if_hasconf(struct dhcpcd_ctx *ctx, const char *ifname)
+{
+ int i;
+
+ for (i = 0; i < ctx->ifcc; i++) {
+ if (strcmp(ctx->ifcv[i], ifname) == 0)
+ return 1;
+ }
+ return 0;
+}
+
struct if_head *
if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv)
{
@@ -285,11 +297,11 @@ if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv)
/* 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 ((argc == 0 || argc == -1) &&
+ ctx->ifac == 0 && !if_hasconf(ctx, p))
continue;
}
-
if (if_vimaster(p) == 1) {
syslog(argc ? LOG_ERR : LOG_DEBUG,
"%s: is a Virtual Interface Master, skipping", p);
@@ -336,8 +348,9 @@ if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv)
#ifdef IFT_BRIDGE
case IFT_BRIDGE:
/* Don't allow bridge unless explicit */
- if ((argc == 0 || argc == -1)
- && ctx->ifac == 0)
+ if ((argc == 0 || argc == -1) &&
+ ctx->ifac == 0 &&
+ !if_hasconf(ctx, ifp->name))
{
if_free(ifp);
continue;
@@ -386,7 +399,9 @@ if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv)
/* We only work on ethernet by default */
if (ifp->family != ARPHRD_ETHER) {
- if ((argc == 0 || argc == -1) && ctx->ifac == 0) {
+ if ((argc == 0 || argc == -1) &&
+ ctx->ifac == 0 && !if_hasconf(ctx, ifp->name))
+ {
if_free(ifp);
continue;
}
@@ -403,8 +418,8 @@ if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv)
break;
default:
syslog(LOG_WARNING,
- "%s: unsupported interface type %.2x"
- ", family %.2x",
+ "%s: unsupported interface type %.2x, "
+ "family %.2x",
ifp->name, sdl_type, ifp->family);
break;
}