From: Roy Marples Date: Tue, 8 Jul 2014 19:25:21 +0000 (+0000) Subject: ifclass= separates psuedo interfaces to avoid option collision. X-Git-Tag: v6.4.1~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=892407a226ca143835aa1d42a7b7059b284e441a;p=thirdparty%2Fdhcpcd.git ifclass= separates psuedo interfaces to avoid option collision. --- diff --git a/dhcpcd-run-hooks.in b/dhcpcd-run-hooks.in index 057af9f4..1bfa1b39 100644 --- a/dhcpcd-run-hooks.in +++ b/dhcpcd-run-hooks.in @@ -12,7 +12,7 @@ case "$reason" in *) ifsuffix=;; esac -ifname="$interface$ifsuffix" +ifname="$interface$ifsuffix${ifclass+.}$ifclass" from=from signature_base="# Generated by dhcpcd" diff --git a/script.c b/script.c index e3f34050..7165ce1e 100644 --- a/script.c +++ b/script.c @@ -312,7 +312,8 @@ make_env(const struct interface *ifp, const char *reason, char ***argv) snprintf(env[7], e, "ifmtu=%d", if_getmtu(ifp->name)); l = e = strlen("interface_order="); TAILQ_FOREACH(ifp2, ifp->ctx->ifaces, next) { - e += strlen(ifp2->name) + 1; + if (!(ifp2->options->options & DHCPCD_PFXDLGONLY)) + e += strlen(ifp2->name) + 1; } EMALLOC(8, e); p = env[8]; @@ -320,11 +321,13 @@ make_env(const struct interface *ifp, const char *reason, char ***argv) e -= l; p += l; TAILQ_FOREACH(ifp2, ifp->ctx->ifaces, next) { - l = strlcpy(p, ifp2->name, e); - p += l; - e -= l; - *p++ = ' '; - e--; + if (!(ifp2->options->options & DHCPCD_PFXDLGONLY)) { + l = strlcpy(p, ifp2->name, e); + p += l; + e -= l; + *p++ = ' '; + e--; + } } *--p = '\0'; if (strcmp(reason, "TEST") == 0) { @@ -393,6 +396,16 @@ make_env(const struct interface *ifp, const char *reason, char ***argv) } #endif #ifdef INET6 + if (dhcp6 && d6_state && ifo->options & DHCPCD_PFXDLGONLY) { + nenv = realloc(env, sizeof(char *) * (elen + 2)); + if (nenv == NULL) + goto eexit; + env = nenv; + env[elen] = strdup("ifclass=pd"); + if (env[elen] == NULL) + goto eexit; + elen++; + } if (dhcp6 && d6_state && d6_state->old) { n = dhcp6_env(NULL, NULL, ifp, d6_state->old, d6_state->old_len);