Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/dhcpcd/dist Sync



details:   https://anonhg.NetBSD.org/src/rev/bf1ab7f9bd70
branches:  trunk
changeset: 331077:bf1ab7f9bd70
user:      roy <roy%NetBSD.org@localhost>
date:      Wed Jul 30 15:47:32 2014 +0000

description:
Sync

diffstat:

 external/bsd/dhcpcd/dist/dhcp.c           |  10 +++++++---
 external/bsd/dhcpcd/dist/dhcpcd.c         |  29 +++++++++++++++++++++++------
 external/bsd/dhcpcd/dist/dhcpcd.conf.5.in |   8 ++++----
 external/bsd/dhcpcd/dist/if-options.c     |   6 +++---
 external/bsd/dhcpcd/dist/ipv6nd.c         |  16 +++++++++++-----
 5 files changed, 48 insertions(+), 21 deletions(-)

diffs (194 lines):

diff -r 53e995669f19 -r bf1ab7f9bd70 external/bsd/dhcpcd/dist/dhcp.c
--- a/external/bsd/dhcpcd/dist/dhcp.c   Wed Jul 30 15:44:09 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp.c   Wed Jul 30 15:47:32 2014 +0000
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp.c,v 1.14 2014/07/14 11:49:48 roy Exp $");
+ __RCSID("$NetBSD: dhcp.c,v 1.15 2014/07/30 15:47:32 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -58,6 +58,7 @@
 #include <syslog.h>
 #include <unistd.h>
 
+#define ELOOP_QUEUE 2
 #include "config.h"
 #include "arp.h"
 #include "common.h"
@@ -205,9 +206,12 @@
                                goto exit;
                        break;
                case DHO_OPTIONSOVERLOADED:
-                       /* Ensure we only get this option once */
+                       /* Ensure we only get this option once by setting
+                        * the last bit as well as the value.
+                        * This is valid because only the first two bits
+                        * actually mean anything in RFC2132 Section 9.3 */
                        if (!overl)
-                               overl = p[1];
+                               overl = 0x80 | p[1];
                        break;
                }
                l = *p++;
diff -r 53e995669f19 -r bf1ab7f9bd70 external/bsd/dhcpcd/dist/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/dhcpcd.c Wed Jul 30 15:44:09 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.c Wed Jul 30 15:47:32 2014 +0000
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcpcd.c,v 1.6 2014/07/14 11:49:48 roy Exp $");
+ __RCSID("$NetBSD: dhcpcd.c,v 1.7 2014/07/30 15:47:32 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -345,8 +345,6 @@
                ifo->options &= ~(DHCPCD_ARP | DHCPCD_IPV4LL);
        if (!(ifp->flags & (IFF_POINTOPOINT | IFF_LOOPBACK | IFF_MULTICAST)))
                ifo->options &= ~DHCPCD_IPV6RS;
-       if (ifo->options & DHCPCD_LINK && ifp->carrier == LINK_UNKNOWN)
-               ifo->options &= ~DHCPCD_LINK;
 
        if (ifo->metric != -1)
                ifp->metric = (unsigned int)ifo->metric;
@@ -613,14 +611,33 @@
        struct if_options *ifo = ifp->options;
        size_t i;
        char buf[DUID_LEN * 3];
+       struct timeval tv;
 
        pre_start(ifp);
        if (if_up(ifp) == -1)
                syslog(LOG_ERR, "%s: if_up: %m", ifp->name);
 
-       if (ifp->carrier == LINK_DOWN && ifo->options & DHCPCD_LINK) {
-               syslog(LOG_INFO, "%s: waiting for carrier", ifp->name);
-               return;
+       if (ifo->options & DHCPCD_LINK) {
+link_retry:
+               switch (ifp->carrier) {
+               case LINK_UP:
+                       break;
+               case LINK_DOWN:
+                       syslog(LOG_INFO, "%s: waiting for carrier", ifp->name);
+                       return;
+               case LINK_UNKNOWN:
+                       /* No media state available, so we loop until
+                        * IFF_UP and IFF_RUNNING are set. */
+                       ifp->carrier = if_carrier(ifp);
+                       if (ifp->carrier != LINK_UNKNOWN)
+                               goto link_retry;
+                       syslog(LOG_INFO, "%s: unknown carrier", ifp->name);
+                       tv.tv_sec = 0;
+                       tv.tv_usec = 100;
+                       eloop_timeout_add_tv(ifp->ctx->eloop, &tv,
+                           dhcpcd_startinterface, ifp);
+                       return;
+               }
        }
 
        if (ifo->options & (DHCPCD_DUID | DHCPCD_IPV6)) {
diff -r 53e995669f19 -r bf1ab7f9bd70 external/bsd/dhcpcd/dist/dhcpcd.conf.5.in
--- a/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in Wed Jul 30 15:44:09 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in Wed Jul 30 15:47:32 2014 +0000
@@ -1,4 +1,4 @@
-.\"     $NetBSD: dhcpcd.conf.5.in,v 1.9 2014/07/14 11:49:48 roy Exp $
+.\"     $NetBSD: dhcpcd.conf.5.in,v 1.10 2014/07/30 15:47:32 roy Exp $
 .\" Copyright (c) 2006-2014 Roy Marples
 .\" All rights reserved
 .\"
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd July 7, 2014
+.Dd July 14, 2014
 .Dt DHCPCD.CONF 5
 .Os
 .Sh NAME
@@ -264,7 +264,7 @@
 does not fit.
 In this case
 .Ar prefix_len
-is increased to the highest multiple of 8 that can accomodate the
+is increased to the highest multiple of 8 that can accommodate the
 .Ar sla_id .
 .Ar sla_id
 is an integer and is added to the prefix which must fit inside
@@ -653,7 +653,7 @@
 .It Ic index
 The option can appear more than once and will be indexed.
 .It Ic array
-The option data is split into a space seperated array, each element being
+The option data is split into a space separated array, each element being
 the same type.
 .El
 .Ss Types to define
diff -r 53e995669f19 -r bf1ab7f9bd70 external/bsd/dhcpcd/dist/if-options.c
--- a/external/bsd/dhcpcd/dist/if-options.c     Wed Jul 30 15:44:09 2014 +0000
+++ b/external/bsd/dhcpcd/dist/if-options.c     Wed Jul 30 15:47:32 2014 +0000
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: if-options.c,v 1.10 2014/07/14 11:49:48 roy Exp $");
+ __RCSID("$NetBSD: if-options.c,v 1.11 2014/07/30 15:47:32 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -2065,11 +2065,11 @@
                for (e = dhcpcd_embedded_conf; *e; e++) {
                        ol = strlen(*e) + 1;
                        if (ol > buflen) {
-                               free(buf);
                                buflen = ol;
-                               buf = malloc(buflen);
+                               buf = realloc(buf, buflen);
                                if (buf == NULL) {
                                        syslog(LOG_ERR, "%s: %m", __func__);
+                                       free(buf);
                                        return NULL;
                                }
                        }
diff -r 53e995669f19 -r bf1ab7f9bd70 external/bsd/dhcpcd/dist/ipv6nd.c
--- a/external/bsd/dhcpcd/dist/ipv6nd.c Wed Jul 30 15:44:09 2014 +0000
+++ b/external/bsd/dhcpcd/dist/ipv6nd.c Wed Jul 30 15:47:32 2014 +0000
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: ipv6nd.c,v 1.9 2014/07/14 11:49:48 roy Exp $");
+ __RCSID("$NetBSD: ipv6nd.c,v 1.10 2014/07/30 15:47:32 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -49,7 +49,7 @@
 #include <syslog.h>
 #include <unistd.h>
 
-#define ELOOP_QUEUE 2
+#define ELOOP_QUEUE 3
 #include "common.h"
 #include "dhcpcd.h"
 #include "dhcp6.h"
@@ -606,9 +606,14 @@
                 * Because ap->dadcounter is always increamented,
                 * a different address is generated. */
                /* XXX Cache DAD counter per prefix/id/ssid? */
-               if (ifp->options->options & DHCPCD_SLAACPRIVATE &&
-                   ap->dadcounter < IDGEN_RETRIES)
-               {
+               if (ifp->options->options & DHCPCD_SLAACPRIVATE) {
+                       if (ap->dadcounter >= IDGEN_RETRIES) {
+                               syslog(LOG_ERR,
+                                   "%s: unable to obtain a"
+                                   " stable private address",
+                                   ifp->name);
+                               goto try_script;
+                       }
                        syslog(LOG_INFO, "%s: deleting address %s",
                                ifp->name, ap->saddr);
                        if (if_deladdress6(ap) == -1 &&
@@ -645,6 +650,7 @@
                }
        }
 
+try_script:
        if (!wascompleted) {
                TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) {
                        if (rap->iface != ifp)



Home | Main Index | Thread Index | Old Index