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/30b3b7de2832
branches:  trunk
changeset: 348202:30b3b7de2832
user:      roy <roy%NetBSD.org@localhost>
date:      Sun Oct 09 09:18:26 2016 +0000

description:
Sync

diffstat:

 external/bsd/dhcpcd/dist/arp.c             |    4 +-
 external/bsd/dhcpcd/dist/auth.h            |    4 +-
 external/bsd/dhcpcd/dist/common.c          |   57 ++++-
 external/bsd/dhcpcd/dist/common.h          |    8 +-
 external/bsd/dhcpcd/dist/config.h          |    5 +-
 external/bsd/dhcpcd/dist/defs.h            |    4 +-
 external/bsd/dhcpcd/dist/dhcp.c            |   52 ++-
 external/bsd/dhcpcd/dist/dhcp6.c           |  201 ++++++++++----
 external/bsd/dhcpcd/dist/dhcp6.h           |   11 +-
 external/bsd/dhcpcd/dist/dhcpcd-embedded.c |  381 -----------------------------
 external/bsd/dhcpcd/dist/dhcpcd-embedded.h |   34 --
 external/bsd/dhcpcd/dist/dhcpcd.c          |   80 +++--
 external/bsd/dhcpcd/dist/dhcpcd.h          |    3 +-
 external/bsd/dhcpcd/dist/if-bsd.c          |  228 +++++++++++------
 external/bsd/dhcpcd/dist/if-options.c      |   42 ++-
 external/bsd/dhcpcd/dist/if.c              |   32 ++-
 external/bsd/dhcpcd/dist/if.h              |   14 +-
 external/bsd/dhcpcd/dist/ipv4.c            |   97 +++++--
 external/bsd/dhcpcd/dist/ipv4.h            |    5 +-
 external/bsd/dhcpcd/dist/ipv4ll.c          |    4 +-
 external/bsd/dhcpcd/dist/ipv4ll.h          |   35 +-
 external/bsd/dhcpcd/dist/ipv6.c            |  142 +++++++---
 external/bsd/dhcpcd/dist/ipv6.h            |   11 +-
 external/bsd/dhcpcd/dist/ipv6nd.c          |   27 +-
 external/bsd/dhcpcd/dist/script.c          |   16 +-
 25 files changed, 743 insertions(+), 754 deletions(-)

diffs (truncated from 3314 to 300 lines):

diff -r cbc148cc79db -r 30b3b7de2832 external/bsd/dhcpcd/dist/arp.c
--- a/external/bsd/dhcpcd/dist/arp.c    Sun Oct 09 08:21:35 2016 +0000
+++ b/external/bsd/dhcpcd/dist/arp.c    Sun Oct 09 09:18:26 2016 +0000
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: arp.c,v 1.21 2016/07/29 10:07:57 roy Exp $");
+ __RCSID("$NetBSD: arp.c,v 1.22 2016/10/09 09:18:26 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -448,6 +448,8 @@
        struct iarp_state *state;
        struct arp_state *astate, *asn;
 
+       /* If the address is deleted, the ARP state should be freed by the
+        * state owner, such as DHCP or IPv4LL. */
        if (cmd != RTM_NEWADDR || (state = ARP_STATE(addr->iface)) == NULL)
                return;
 
diff -r cbc148cc79db -r 30b3b7de2832 external/bsd/dhcpcd/dist/auth.h
--- a/external/bsd/dhcpcd/dist/auth.h   Sun Oct 09 08:21:35 2016 +0000
+++ b/external/bsd/dhcpcd/dist/auth.h   Sun Oct 09 09:18:26 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auth.h,v 1.9 2015/05/16 23:31:32 roy Exp $ */
+/* $NetBSD: auth.h,v 1.10 2016/10/09 09:18:26 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -65,12 +65,14 @@
 
 struct auth {
        int options;
+#ifdef AUTH
        uint8_t protocol;
        uint8_t algorithm;
        uint8_t rdm;
        uint64_t last_replay;
        uint8_t last_replay_set;
        struct token_head tokens;
+#endif
 };
 
 struct authstate {
diff -r cbc148cc79db -r 30b3b7de2832 external/bsd/dhcpcd/dist/common.c
--- a/external/bsd/dhcpcd/dist/common.c Sun Oct 09 08:21:35 2016 +0000
+++ b/external/bsd/dhcpcd/dist/common.c Sun Oct 09 09:18:26 2016 +0000
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: common.c,v 1.20 2016/05/09 10:15:59 roy Exp $");
+ __RCSID("$NetBSD: common.c,v 1.21 2016/10/09 09:18:26 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -30,7 +30,11 @@
 
 #include <sys/param.h>
 #include <sys/time.h>
+#ifdef __sun
+#include <sys/sysmacros.h>
+#endif
 
+#include <assert.h>
 #include <ctype.h>
 #include <err.h>
 #include <errno.h>
@@ -56,6 +60,9 @@
 #  define _PATH_DEVNULL "/dev/null"
 #endif
 
+/* Most route(4) messages are less than 256 bytes. */
+#define IOVEC_BUFSIZ   256
+
 #if USE_LOGFILE
 void
 logger_open(struct dhcpcd_ctx *ctx)
@@ -377,3 +384,51 @@
        fclose(fp);
        return len;
 }
+
+ssize_t
+recvmsg_realloc(int fd, struct msghdr *msg, int flags)
+{
+       struct iovec *iov;
+       ssize_t slen;
+       size_t len;
+       void *n;
+
+       assert(msg != NULL);
+       assert(msg->msg_iov != NULL && msg->msg_iovlen > 0);
+       assert((flags & (MSG_PEEK | MSG_TRUNC)) == 0);
+
+       /* Assume we are reallocing the last iovec. */
+       iov = &msg->msg_iov[msg->msg_iovlen - 1];
+
+       for (;;) {
+               /* Passing MSG_TRUNC should return the actual size needed. */
+               slen = recvmsg(fd, msg, flags | MSG_PEEK | MSG_TRUNC);
+               if (slen == -1)
+                       return -1;
+               if (!(msg->msg_flags & MSG_TRUNC))
+                       break;
+
+               len = (size_t)slen;
+
+               /* Some kernels return the size of the receive buffer
+                * on truncation, not the actual size needed.
+                * So grow the buffer and try again. */
+               if (iov->iov_len == len)
+                       len++;
+               else if (iov->iov_len > len)
+                       break;
+               len = roundup(len, IOVEC_BUFSIZ);
+               if ((n = realloc(iov->iov_base, len)) == NULL)
+                       return -1;
+               iov->iov_base = n;
+               iov->iov_len = len;
+       }
+
+       slen = recvmsg(fd, msg, flags);
+       if (slen != -1 && msg->msg_flags & MSG_TRUNC) {
+               /* This should not be possible ... */
+               errno = ENOBUFS;
+               return -1;
+       }
+       return slen;
+}
diff -r cbc148cc79db -r 30b3b7de2832 external/bsd/dhcpcd/dist/common.h
--- a/external/bsd/dhcpcd/dist/common.h Sun Oct 09 08:21:35 2016 +0000
+++ b/external/bsd/dhcpcd/dist/common.h Sun Oct 09 09:18:26 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: common.h,v 1.14 2016/05/09 10:15:59 roy Exp $ */
+/* $NetBSD: common.h,v 1.15 2016/10/09 09:18:26 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -167,6 +167,10 @@
  * However, this results in a ugly output on the command line
  * and relies on syslogd(8) starting before dhcpcd which is not
  * always the case. */
+#ifdef SMALL
+# undef USE_LOGFILE
+# define USE_LOGFILE 0
+#endif
 #ifndef USE_LOGFILE
 # define USE_LOGFILE 1
 #endif
@@ -198,4 +202,6 @@
 char *hwaddr_ntoa(const uint8_t *, size_t, char *, size_t);
 size_t hwaddr_aton(uint8_t *, const char *);
 size_t read_hwaddr_aton(uint8_t **, const char *);
+
+ssize_t recvmsg_realloc(int, struct msghdr *, int);
 #endif
diff -r cbc148cc79db -r 30b3b7de2832 external/bsd/dhcpcd/dist/config.h
--- a/external/bsd/dhcpcd/dist/config.h Sun Oct 09 08:21:35 2016 +0000
+++ b/external/bsd/dhcpcd/dist/config.h Sun Oct 09 09:18:26 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: config.h,v 1.11 2016/05/09 10:15:59 roy Exp $ */
+/* $NetBSD: config.h,v 1.12 2016/10/09 09:18:26 roy Exp $ */
 
 /* netbsd */
 #define SYSCONFDIR     "/etc"
@@ -7,6 +7,9 @@
 #define LIBEXECDIR     "/libexec"
 #define DBDIR          "/var/db"
 #define RUNDIR         "/var/run"
+#define HAVE_IFAM_PID
+#define HAVE_IFAM_ADDRFLAGS
+#define HAVE_IFADDRS_ADDRFLAGS
 #define HAVE_UTIL_H
 #define HAVE_SYS_QUEUE_H
 #define HAVE_SPAWN_H
diff -r cbc148cc79db -r 30b3b7de2832 external/bsd/dhcpcd/dist/defs.h
--- a/external/bsd/dhcpcd/dist/defs.h   Sun Oct 09 08:21:35 2016 +0000
+++ b/external/bsd/dhcpcd/dist/defs.h   Sun Oct 09 09:18:26 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.30 2016/08/15 11:04:53 roy Exp $ */
+/* $NetBSD: defs.h,v 1.31 2016/10/09 09:18:26 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -30,7 +30,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "6.11.3"
+#define VERSION                        "6.11.4"
 
 #ifndef CONFIG
 # define CONFIG                        SYSCONFDIR "/" PACKAGE ".conf"
diff -r cbc148cc79db -r 30b3b7de2832 external/bsd/dhcpcd/dist/dhcp.c
--- a/external/bsd/dhcpcd/dist/dhcp.c   Sun Oct 09 08:21:35 2016 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp.c   Sun Oct 09 09:18:26 2016 +0000
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp.c,v 1.46 2016/09/18 15:37:23 christos Exp $");
+ __RCSID("$NetBSD: dhcp.c,v 1.47 2016/10/09 09:18:26 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -742,7 +742,7 @@
        const char *hostname;
        const struct vivco *vivco;
        int mtu;
-#ifndef NO_AUTH
+#ifdef AUTH
        uint8_t *auth, auth_len;
 #endif
 
@@ -977,6 +977,7 @@
                        p += ifo->vendor[0] + 1;
                }
 
+#ifdef AUTH
                if ((ifo->auth.options & DHCPCD_AUTH_SENDREQUIRE) !=
                    DHCPCD_AUTH_SENDREQUIRE)
                {
@@ -986,6 +987,7 @@
                        *p++ = 1;
                        *p++ = AUTH_ALG_HMAC_MD5;
                }
+#endif
 
                if (ifo->vivco_len) {
                        AREA_CHECK(sizeof(ul));
@@ -1059,11 +1061,9 @@
                *n_params = (uint8_t)(p - n_params - 1);
        }
 
-#ifndef NO_AUTH
-       /* silence GCC */
+#ifdef AUTH
+       auth = NULL;    /* appease GCC */
        auth_len = 0;
-       auth = NULL;
-
        if (ifo->auth.options & DHCPCD_AUTH_SEND) {
                ssize_t alen = dhcp_auth_encode(&ifo->auth,
                    state->auth.token,
@@ -1085,6 +1085,7 @@
                }
        }
 #endif
+
        *p++ = DHO_END;
        len = (size_t)(p - (uint8_t *)bootp);
 
@@ -1097,7 +1098,7 @@
                *p++ = DHO_PAD;
                len++;
        }
-#ifndef NO_AUTH
+#ifdef AUTH
        if (ifo->auth.options & DHCPCD_AUTH_SEND && auth_len != 0)
                dhcp_auth_encode(&ifo->auth, state->auth.token,
                    (uint8_t *)bootp, len, 4, type, auth, auth_len);
@@ -1138,9 +1139,9 @@
        uint8_t *lease;
        size_t bytes;
        uint8_t type;
-#ifndef NO_AUTH
+#ifdef AUTH
+       const uint8_t *auth;
        size_t auth_len;
-       const uint8_t *auth;
 #endif
 
        /* Safety */
@@ -1194,7 +1195,7 @@
            DHO_MESSAGETYPE) == -1)
                type = 0;
 
-#ifndef NO_AUTH
+#ifdef AUTH
        /* Authenticate the message */
        auth = get_option(ifp->ctx, (struct bootp *)lease, bytes,
            DHO_AUTHENTICATION, &auth_len);
@@ -1223,6 +1224,7 @@
                return 0;
        }
 #endif
+
 out:
        *bootp = (struct bootp *)lease;
        return bytes;
@@ -1845,9 +1847,11 @@
        if (ifo->fallback)
                eloop_timeout_add_sec(ifp->ctx->eloop,
                    ifo->reboot, dhcp_fallback, ifp);
+#ifdef IPV4LL
        else if (ifo->options & DHCPCD_IPV4LL)
                eloop_timeout_add_sec(ifp->ctx->eloop,
                    ifo->reboot, ipv4ll_start, ifp);
+#endif
        if (ifo->options & DHCPCD_REQUEST)
                logger(ifp->ctx, LOG_INFO,
                    "%s: soliciting a DHCP lease (requesting %s)",
@@ -2510,10 +2514,12 @@
        state->lease.server.s_addr = 0;



Home | Main Index | Thread Index | Old Index