From: Roy Marples Date: Wed, 9 Jul 2014 04:41:23 +0000 (+0000) Subject: Only create a pseudo interface for PD when we have other IA types as well. X-Git-Tag: v6.4.1~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=441d4afe2af79ecaee7bb4d41ff9fcff60d5e350;p=thirdparty%2Fdhcpcd.git Only create a pseudo interface for PD when we have other IA types as well. --- diff --git a/dhcp6.c b/dhcp6.c index 82f5247b..3730d812 100644 --- a/dhcp6.c +++ b/dhcp6.c @@ -1323,15 +1323,22 @@ static int dhcp6_hasprefixdelegation(struct interface *ifp) { size_t i; + int r; + uint16_t t; if (ifp->options->options & DHCPCD_NOPFXDLG) return 0; + t = 0; for (i = 0; i < ifp->options->ia_len; i++) { - if (ifp->options->ia[i].ia_type == D6_OPTION_IA_PD) - return 1; + if (t && t != ifp->options->ia[i].ia_type) { + if (t == D6_OPTION_IA_PD || + ifp->options->ia[i].ia_type == D6_OPTION_IA_PD) + return 2; + } + t = ifp->options->ia[i].ia_type; } - return 0; + return t == D6_OPTION_IA_PD ? 1 : 0; } static void @@ -2967,7 +2974,7 @@ dhcp6_start1(void *arg) /* Create a 2nd interface to handle the PD state */ if (!(ifo->options & (DHCPCD_PFXDLGONLY | DHCPCD_PFXDLGMIX)) && - dhcp6_hasprefixdelegation(ifp)) + dhcp6_hasprefixdelegation(ifp) > 1) { const char * const argv[] = { ifp->name }; struct if_head *ifs;