Source-Changes-HG archive

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

[src/netbsd-9]: src Pull up the following, requested by roy in ticket #602:



details:   https://anonhg.NetBSD.org/src/rev/e081d68dc4a9
branches:  netbsd-9
changeset: 466928:e081d68dc4a9
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jan 05 09:38:28 2020 +0000

description:
Pull up the following, requested by roy in ticket #602:

        external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in up to 1.4
        external/bsd/dhcpcd/dist/src/defs.h             up to 1.1.1.36
        external/bsd/dhcpcd/dist/src/dhcp.c             up to 1.31
        external/bsd/dhcpcd/dist/src/dhcp.h             up to 1.1.1.14
        external/bsd/dhcpcd/dist/src/dhcp6.c            up to 1.15
        external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c  up to 1.1.1.3
        external/bsd/dhcpcd/dist/src/dhcpcd.c           up to 1.31
        external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in   up to 1.1.1.16
        external/bsd/dhcpcd/dist/src/if-options.c       up to 1.20
        external/bsd/dhcpcd/dist/src/ipv4.c             up to 1.1.1.20
        external/bsd/dhcpcd/dist/src/ipv6.c             up to 1.7
        external/bsd/dhcpcd/dist/src/ipv6.h             up to 1.7
        external/bsd/dhcpcd/dist/src/ipv6nd.c           up to 1.15
        doc/3RDPARTY                                    (manually updated)

Import dhcpcd 8.1.5, which fixes:

 * IPv6ND: Fix reachable test
 * DHCP6: Work better with infinite addresses
 * DHCP6: Suboption 3 of NTP Server is a FQDN
 * DHCP6: Fix deprecating a delegated prefix
 * DHCP: Ensure we have a lease to extract options from

 * options: Fix allocating the script option

 * inet: Allow forcing a host route from an interface without a lease
 * dhcpcd: Don't wait for an address family to complete if not using it

diffstat:

 doc/3RDPARTY                                       |    8 +-
 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in |    2 +-
 external/bsd/dhcpcd/dist/src/defs.h                |    2 +-
 external/bsd/dhcpcd/dist/src/dhcp.c                |   47 +++---
 external/bsd/dhcpcd/dist/src/dhcp.h                |    2 +
 external/bsd/dhcpcd/dist/src/dhcp6.c               |  147 ++++++++++++++------
 external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c     |    2 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.c              |   16 +--
 external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in      |    4 +-
 external/bsd/dhcpcd/dist/src/if-options.c          |   27 +++-
 external/bsd/dhcpcd/dist/src/ipv4.c                |    5 +-
 external/bsd/dhcpcd/dist/src/ipv6.c                |   75 ++++++----
 external/bsd/dhcpcd/dist/src/ipv6.h                |    1 +
 external/bsd/dhcpcd/dist/src/ipv6nd.c              |    4 +-
 14 files changed, 214 insertions(+), 128 deletions(-)

diffs (truncated from 716 to 300 lines):

diff -r b37336ea84d4 -r e081d68dc4a9 doc/3RDPARTY
--- a/doc/3RDPARTY      Sun Jan 05 09:32:10 2020 +0000
+++ b/doc/3RDPARTY      Sun Jan 05 09:38:28 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: 3RDPARTY,v 1.1640.2.8 2019/11/24 08:30:27 martin Exp $
+#      $NetBSD: 3RDPARTY,v 1.1640.2.9 2020/01/05 09:38:28 martin Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -341,12 +341,12 @@
 Use the dhcp2netbsd script.
 
 Package:       dhcpcd
-Version:       8.1.2
-Current Vers:  8.1.2
+Version:       8.1.5
+Current Vers:  8.1.5
 Maintainer:    roy
 Archive Site:  ftp://roy.marples.name/pub/dhcpcd/
 Home Page:     http://roy.marples.name/projects/dhcpcd/
-Date:          2019-11-13
+Date:          2020-01-03
 Mailing List:  dhcpcd-discuss%marples.name@localhost
 License:       BSD (2-clause)
 Location:      external/bsd/dhcpcd/dist
diff -r b37336ea84d4 -r e081d68dc4a9 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in
--- a/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in        Sun Jan 05 09:32:10 2020 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in        Sun Jan 05 09:38:28 2020 +0000
@@ -212,7 +212,7 @@
 
 # With the advent of alternative init systems, it's possible to have
 # more than one installed. So we need to try and guess what one we're
-# using unless overriden by configure.
+# using unless overridden by configure.
 detect_init()
 {
        _service_exists="@SERVICEEXISTS@"
diff -r b37336ea84d4 -r e081d68dc4a9 external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h       Sun Jan 05 09:32:10 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h       Sun Jan 05 09:38:28 2020 +0000
@@ -29,7 +29,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "8.1.2"
+#define VERSION                        "8.1.5"
 
 #ifndef CONFIG
 # define CONFIG                        SYSCONFDIR "/" PACKAGE ".conf"
diff -r b37336ea84d4 -r e081d68dc4a9 external/bsd/dhcpcd/dist/src/dhcp.c
--- a/external/bsd/dhcpcd/dist/src/dhcp.c       Sun Jan 05 09:32:10 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp.c       Sun Jan 05 09:38:28 2020 +0000
@@ -176,6 +176,11 @@
        const uint8_t *op;
        size_t bl;
 
+       if (bootp == NULL || bootp_len < DHCP_MIN_LEN) {
+               errno = EINVAL;
+               return NULL;
+       }
+
        /* Check we have the magic cookie */
        if (!IS_DHCP(bootp)) {
                errno = ENOTSUP;
@@ -484,7 +489,7 @@
                        return -1;
                break;
        case 1:
-               if (dl == 0 || dl % 4 != 0) {
+               if (dl % 4 != 0) {
                        errno = EINVAL;
                        break;
                }
@@ -1179,7 +1184,7 @@
         * (it should be more, and our read packet enforces this so this
         * code should not be needed, but of course people could
         * scribble whatever in the stored lease file. */
-       if (bytes < offsetof(struct bootp, vend) + 4) {
+       if (bytes < DHCP_MIN_LEN) {
                free(lease);
                logerrx("%s: %s: truncated lease", ifp->name, __func__);
                return 0;
@@ -1540,7 +1545,7 @@
 }
 
 static int
-dhcp_openudp(struct interface *ifp)
+dhcp_openudp(struct in_addr *ia)
 {
        int s;
        struct sockaddr_in sin;
@@ -1551,29 +1556,25 @@
 
        n = 1;
        if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n)) == -1)
-               goto eexit;
+               goto errexit;
 #ifdef IP_RECVIF
        if (setsockopt(s, IPPROTO_IP, IP_RECVIF, &n, sizeof(n)) == -1)
-               goto eexit;
+               goto errexit;
 #else
        if (setsockopt(s, IPPROTO_IP, IP_RECVPKTINFO, &n, sizeof(n)) == -1)
-               goto eexit;
+               goto errexit;
 #endif
        memset(&sin, 0, sizeof(sin));
        sin.sin_family = AF_INET;
        sin.sin_port = htons(BOOTPC);
-       if (ifp) {
-               const struct dhcp_state *state = D_CSTATE(ifp);
-
-               if (state->addr)
-                       sin.sin_addr.s_addr = state->addr->addr.s_addr;
-       }
+       if (ia != NULL)
+               sin.sin_addr = *ia;
        if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) == -1)
-               goto eexit;
+               goto errexit;
 
        return s;
 
-eexit:
+errexit:
        close(s);
        return -1;
 }
@@ -1675,7 +1676,7 @@
 
        fd = state->udp_fd;
        if (fd == -1) {
-               fd = dhcp_openudp(ifp);
+               fd = dhcp_openudp(state->addr != NULL ?&state->addr->addr:NULL);
                if (fd == -1)
                        return -1;
        }
@@ -1734,7 +1735,9 @@
                goto fail;
        len = (size_t)r;
 
-       if (ipv4_iffindaddr(ifp, &state->lease.addr, NULL) != NULL)
+       if (!(state->added & STATE_FAKE) &&
+           state->addr != NULL &&
+           ipv4_iffindaddr(ifp, &state->lease.addr, NULL) != NULL)
                from.s_addr = state->lease.addr.s_addr;
        else
                from.s_addr = INADDR_ANY;
@@ -1751,7 +1754,7 @@
         * even if they are setup to send them.
         * Broadcasting from UDP is only an optimisation for rebinding
         * and on BSD, at least, is reliant on the subnet route being
-        * correctly configured to recieve the unicast reply.
+        * correctly configured to receive the unicast reply.
         * As such, we always broadcast and receive the reply to it via BPF.
         * This also guarantees we have a DHCP server attached to the
         * interface we want to configure because we can't dictate the
@@ -2266,10 +2269,11 @@
                return;
        dhcp_close(ifp);
 
+
        /* If not in master mode, open an address specific socket. */
        if (ctx->udp_fd != -1)
                return;
-       state->udp_fd = dhcp_openudp(ifp);
+       state->udp_fd = dhcp_openudp(&state->addr->addr);
        if (state->udp_fd == -1) {
                logerr(__func__);
                /* Address sharing without master mode is not supported.
@@ -2352,6 +2356,7 @@
 #ifdef KERNEL_RFC5227
        astate->announced_cb = dhcp_arp_announced;
 #else
+       astate->announced_cb = NULL;
        astate->defend_failed_cb = dhcp_arp_defend_failed;
 #endif
        return astate;
@@ -2501,7 +2506,7 @@
                        state->offer_len = dhcp_message_new(&state->offer,
                            &ifo->req_addr, &ifo->req_mask);
 #ifdef ARP
-                       if (dhcp_arp_address(ifp) == 0)
+                       if (dhcp_arp_address(ifp) != 1)
                                return;
 #endif
                        ia = ipv4_iffindaddr(ifp,
@@ -3390,7 +3395,7 @@
 }
 
 static void
-dhcp_handlebpf(struct interface *ifp, uint8_t *data, size_t len)
+dhcp_packet(struct interface *ifp, uint8_t *data, size_t len)
 {
        struct bootp *bootp;
        struct in_addr from;
@@ -3445,7 +3450,7 @@
                        }
                        break;
                }
-               dhcp_handlebpf(ifp, buf, (size_t)bytes);
+               dhcp_packet(ifp, buf, (size_t)bytes);
                /* Check we still have a state after processing. */
                if ((state = D_STATE(ifp)) == NULL)
                        break;
diff -r b37336ea84d4 -r e081d68dc4a9 external/bsd/dhcpcd/dist/src/dhcp.h
--- a/external/bsd/dhcpcd/dist/src/dhcp.h       Sun Jan 05 09:32:10 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp.h       Sun Jan 05 09:38:28 2020 +0000
@@ -164,6 +164,8 @@
        /* DHCP allows a variable length vendor area */
 };
 
+#define        DHCP_MIN_LEN            (offsetof(struct bootp, vend) + 4)
+
 struct bootp_pkt
 {
        struct ip ip;
diff -r b37336ea84d4 -r e081d68dc4a9 external/bsd/dhcpcd/dist/src/dhcp6.c
--- a/external/bsd/dhcpcd/dist/src/dhcp6.c      Sun Jan 05 09:32:10 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp6.c      Sun Jan 05 09:38:28 2020 +0000
@@ -171,7 +171,7 @@
 
 static void dhcp6_bind(struct interface *, const char *, const char *);
 static void dhcp6_failinform(void *);
-static int dhcp6_listen(struct dhcpcd_ctx *, struct ipv6_addr *);
+static int dhcp6_openudp(unsigned int, struct in6_addr *);
 static void dhcp6_recvaddr(void *);
 
 void
@@ -2132,13 +2132,10 @@
                        a->dadcallback = dhcp6_dadcallback;
                        a->ia_type = D6_OPTION_IA_PD;
                        memcpy(a->iaid, iaid, sizeof(a->iaid));
-                       TAILQ_INIT(&a->pd_pfxs);
                        TAILQ_INSERT_TAIL(&state->addrs, a, next);
                } else {
-                       if (!(a->flags & IPV6_AF_DELEGATEDPFX)) {
+                       if (!(a->flags & IPV6_AF_DELEGATEDPFX))
                                a->flags |= IPV6_AF_NEW | IPV6_AF_DELEGATEDPFX;
-                               TAILQ_INIT(&a->pd_pfxs);
-                       }
                        a->flags &= ~(IPV6_AF_STALE |
                                      IPV6_AF_EXTENDED |
                                      IPV6_AF_REQUEST);
@@ -2341,6 +2338,46 @@
        return i;
 }
 
+#ifndef SMALL
+static void
+dhcp6_deprecatedele(struct ipv6_addr *ia)
+{
+       struct ipv6_addr *da, *dan, *dda;
+       struct timespec now;
+       struct dhcp6_state *state;
+
+       timespecclear(&now);
+       TAILQ_FOREACH_SAFE(da, &ia->pd_pfxs, pd_next, dan) {
+               if (ia->prefix_vltime == 0) {
+                       if (da->prefix_vltime != 0)
+                               da->prefix_vltime = 0;
+                       else
+                               continue;
+               } else if (da->prefix_pltime != 0)
+                       da->prefix_pltime = 0;
+               else
+                       continue;
+
+               if (ipv6_doaddr(da, &now) != -1)
+                       continue;
+
+               /* Delegation deleted, forget it. */
+               TAILQ_REMOVE(&ia->pd_pfxs, da, pd_next);
+
+               /* Delete it from the interface. */
+               state = D6_STATE(da->iface);
+               TAILQ_FOREACH(dda, &state->addrs, next) {
+                       if (IN6_ARE_ADDR_EQUAL(&dda->addr, &da->addr))
+                               break;
+               }
+               if (dda != NULL) {
+                       TAILQ_REMOVE(&state->addrs, dda, next);
+                       ipv6_freeaddr(dda);
+               }
+       }
+}
+#endif
+
 static void
 dhcp6_deprecateaddrs(struct ipv6_addrhead *addrs)
 {
@@ -2363,24 +2400,8 @@
 #ifndef SMALL
                /* If we delegated from this prefix, deprecate or remove
                 * the delegations. */
-               if (ia->flags & IPV6_AF_DELEGATEDPFX) {
-                       struct ipv6_addr *da;
-                       bool touched = false;
-
-                       TAILQ_FOREACH(da, &ia->pd_pfxs, pd_next) {



Home | Main Index | Thread Index | Old Index