]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
ifclass= separates psuedo interfaces to avoid option collision.
authorRoy Marples <roy@marples.name>
Tue, 8 Jul 2014 19:25:21 +0000 (19:25 +0000)
committerRoy Marples <roy@marples.name>
Tue, 8 Jul 2014 19:25:21 +0000 (19:25 +0000)
dhcpcd-run-hooks.in
script.c

index 057af9f498f5b35a64a7240f4fbd5558fa4bfc94..1bfa1b39b410bf181daeba1979d280ad83d0f72e 100644 (file)
@@ -12,7 +12,7 @@ case "$reason" in
        *)
                ifsuffix=;;
 esac
-ifname="$interface$ifsuffix"
+ifname="$interface$ifsuffix${ifclass+.}$ifclass"
 
 from=from
 signature_base="# Generated by dhcpcd"
index e3f3405093fac0d19f8723a4794e164b0d29b558..7165ce1ebd801c39c408e9d54139f00488dacc2b 100644 (file)
--- 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);