Source-Changes-HG archive

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

[src/netbsd-8]: src Pull up the following revisions, requested by roy in tick...



details:   https://anonhg.NetBSD.org/src/rev/78d0faf1aa0e
branches:  netbsd-8
changeset: 851896:78d0faf1aa0e
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jul 27 10:22:52 2018 +0000

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

        external/bsd/dhcpcd/dist/configure              up to 1.1.1.8
        external/bsd/dhcpcd/dist/src/defs.h             up to 1.1.1.15
        external/bsd/dhcpcd/dist/src/if-linux.c         up to 1.1.1.10
        external/bsd/dhcpcd/dist/src/ipv6.c             up to 1.1.1.11
        external/bsd/dhcpcd/dist/src/route.c            up to 1.1.1.8
        doc/3RDPARTY                                    manual edit

Import dhcpcd-7.0.7 with the following changes:
   *  host routes work correctly again
   *  vlanid is also used to calculate slaac stable private addresses

diffstat:

 doc/3RDPARTY                            |   6 +++---
 external/bsd/dhcpcd/dist/configure      |  24 ++++++++++++------------
 external/bsd/dhcpcd/dist/src/defs.h     |   2 +-
 external/bsd/dhcpcd/dist/src/if-linux.c |   6 +++---
 external/bsd/dhcpcd/dist/src/ipv6.c     |  11 ++++++++++-
 external/bsd/dhcpcd/dist/src/route.c    |  23 ++++++++++++++++++-----
 6 files changed, 47 insertions(+), 25 deletions(-)

diffs (274 lines):

diff -r 49361d30325a -r 78d0faf1aa0e doc/3RDPARTY
--- a/doc/3RDPARTY      Fri Jul 27 09:57:43 2018 +0000
+++ b/doc/3RDPARTY      Fri Jul 27 10:22:52 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: 3RDPARTY,v 1.1444.2.14 2018/06/23 12:14:46 martin Exp $
+#      $NetBSD: 3RDPARTY,v 1.1444.2.15 2018/07/27 10:22:52 martin Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -334,8 +334,8 @@
 Use the dhcp2netbsd script.
 
 Package:       dhcpcd
-Version:       7.0.6
-Current Vers:  7.0.6
+Version:       7.0.7
+Current Vers:  7.0.7
 Maintainer:    roy
 Archive Site:  ftp://roy.marples.name/pub/dhcpcd/
 Home Page:     http://roy.marples.name/projects/dhcpcd/
diff -r 49361d30325a -r 78d0faf1aa0e external/bsd/dhcpcd/dist/configure
--- a/external/bsd/dhcpcd/dist/configure        Fri Jul 27 09:57:43 2018 +0000
+++ b/external/bsd/dhcpcd/dist/configure        Fri Jul 27 10:22:52 2018 +0000
@@ -713,7 +713,7 @@
 fi
 if [ "$ARC4RANDOM" = no ]; then
        echo "COMPAT_SRCS+=     compat/arc4random.c" >>$CONFIG_MK
-       echo "#include          \"compat/arc4random.h\"" >>$CONFIG_H
+       echo "#include                  \"compat/arc4random.h\"" >>$CONFIG_H
 fi
 
 if [ -z "$ARC4RANDOM_UNIFORM" ]; then
@@ -735,7 +735,7 @@
 fi
 if [ "$ARC4RANDOM_UNIFORM" = no ]; then
        echo "COMPAT_SRCS+=     compat/arc4random_uniform.c" >>$CONFIG_MK
-       echo "#include          \"compat/arc4random_uniform.h\"" >>$CONFIG_H
+       echo "#include                  \"compat/arc4random_uniform.h\"" >>$CONFIG_H
 fi
 
 if [ -z "$STRLCPY" ]; then
@@ -759,7 +759,7 @@
 fi
 if [ "$STRLCPY" = no ]; then
        echo "COMPAT_SRCS+=     compat/strlcpy.c" >>$CONFIG_MK
-       echo "#include          \"compat/strlcpy.h\"" >>$CONFIG_H
+       echo "#include                  \"compat/strlcpy.h\"" >>$CONFIG_H
 fi
 
 if [ -z "$PIDFILE_LOCK" ]; then
@@ -791,7 +791,7 @@
 fi
 if [ "$PIDFILE_LOCK" = no ]; then
        echo "COMPAT_SRCS+=     compat/pidfile.c" >>$CONFIG_MK
-       echo "#include          \"compat/pidfile.h\"" >>$CONFIG_H
+       echo "#include                  \"compat/pidfile.h\"" >>$CONFIG_H
 else
        echo "#define   HAVE_UTIL_H" >>$CONFIG_H
        if [ -n "$LIBUTIL" ]; then
@@ -842,7 +842,7 @@
 fi
 if [ "$STRTOI" = no ]; then
        echo "COMPAT_SRCS+=     compat/strtoi.c compat/strtou.c" >>$CONFIG_MK
-       echo "#include          \"compat/strtoi.h\"" >>$CONFIG_H
+       echo "#include                  \"compat/strtoi.h\"" >>$CONFIG_H
 fi
 
 if [ -z "$DPRINTF" ]; then
@@ -863,7 +863,7 @@
 fi
 if [ "$DPRINTF" = no ]; then
        echo "COMPAT_SRCS+=     compat/dprintf.c" >>$CONFIG_MK
-       echo "#include          \"compat/dprintf.h\"" >>$CONFIG_H
+       echo "#include                  \"compat/dprintf.h\"" >>$CONFIG_H
 fi
 
 if [ -z "$TAILQ_FOREACH_SAFE" ]; then
@@ -937,7 +937,7 @@
        if [ "$TAILQ_FOREACH" = yes ]; then
                echo "#include          <sys/queue.h>">>$CONFIG_H
        fi
-       echo "#include          \"compat/queue.h\"">>$CONFIG_H
+       echo "#include                  \"compat/queue.h\"">>$CONFIG_H
 else
        echo "#define   HAVE_SYS_QUEUE_H" >>$CONFIG_H
 fi
@@ -962,7 +962,7 @@
 fi
 if [ "$REALLOCARRAY" = no ]; then
        echo "COMPAT_SRCS+=     compat/reallocarray.c" >>$CONFIG_MK
-       echo "#include          \"compat/reallocarray.h\"">>$CONFIG_H
+       echo "#include                  \"compat/reallocarray.h\"">>$CONFIG_H
 fi
 # Set this for eloop
 echo "#define  HAVE_REALLOCARRAY" >>$CONFIG_H
@@ -1091,7 +1091,7 @@
        rm -f _be64enc.c _be64enc
 fi
 if [ "$BE64ENC" = no ]; then
-       echo "#include          \"compat/endian.h\"" >>$CONFIG_H
+       echo "#include                  \"compat/endian.h\"" >>$CONFIG_H
 fi
 
 if [ -z "$FLS64" ]; then
@@ -1145,7 +1145,7 @@
        rm -f _md5.c _md5
 fi
 if [ "$MD5" = no ]; then
-       echo "#include          \"compat/crypt/md5.h\"" >>$CONFIG_H
+       echo "#include                  \"compat/crypt/md5.h\"" >>$CONFIG_H
        echo "MD5_SRC=  compat/crypt/md5.c" >>$CONFIG_MK
 else
        echo "MD5_SRC=" >>$CONFIG_MK
@@ -1236,7 +1236,7 @@
        fi
 fi
 if [ "$SHA2" = no ]; then
-       echo "#include          \"compat/crypt/sha256.h\"" >>$CONFIG_H
+       echo "#include                  \"compat/crypt/sha256.h\"" >>$CONFIG_H
        echo "SHA256_SRC=       compat/crypt/sha256.c" >>$CONFIG_MK
 else
        echo "SHA256_SRC=" >>$CONFIG_MK
@@ -1284,7 +1284,7 @@
        rm -f _hmac.c _hmac
 fi
 if [ "$HMAC" = no ]; then
-       echo "#include          \"compat/crypt/hmac.h\"" >>$CONFIG_H
+       echo "#include                  \"compat/crypt/hmac.h\"" >>$CONFIG_H
        echo "HMAC_SRC= compat/crypt/hmac.c" >>$CONFIG_MK
 else
        # echo "#define HAVE_HMAC_H" >>$CONFIG_H
diff -r 49361d30325a -r 78d0faf1aa0e external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h       Fri Jul 27 09:57:43 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h       Fri Jul 27 10:22:52 2018 +0000
@@ -28,7 +28,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "7.0.6"
+#define VERSION                        "7.0.7"
 
 #ifndef CONFIG
 # define CONFIG                        SYSCONFDIR "/" PACKAGE ".conf"
diff -r 49361d30325a -r 78d0faf1aa0e external/bsd/dhcpcd/dist/src/if-linux.c
--- a/external/bsd/dhcpcd/dist/src/if-linux.c   Fri Jul 27 09:57:43 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/if-linux.c   Fri Jul 27 10:22:52 2018 +0000
@@ -430,8 +430,6 @@
        memset(rt, 0, sizeof(*rt));
        if (rtm->rtm_type == RTN_UNREACHABLE)
                rt->rt_flags |= RTF_REJECT;
-       if (rtm->rtm_scope == RT_SCOPE_HOST)
-               rt->rt_flags |= RTF_HOST;
 
        rta = (struct rtattr *)RTM_RTA(rtm);
        len = RTM_PAYLOAD(nlm);
@@ -491,6 +489,8 @@
 
        rt->rt_netmask.sa_family = rtm->rtm_family;
        sa_fromprefix(&rt->rt_netmask, rtm->rtm_dst_len);
+       if (sa_is_allones(&rt->rt_netmask))
+               rt->rt_flags |= RTF_HOST;
 
        #if 0
        if (rt->rtp_ifp == NULL && rt->src.s_addr != INADDR_ANY) {
@@ -1228,7 +1228,7 @@
                        nlm.rt.rtm_protocol = RTPROT_BOOT;
                if (rt->rt_ifp->flags & IFF_LOOPBACK)
                        nlm.rt.rtm_scope = RT_SCOPE_HOST;
-               else if (gateway_unspec || sa_is_allones(&rt->rt_netmask))
+               else if (gateway_unspec)
                        nlm.rt.rtm_scope = RT_SCOPE_LINK;
                else
                        nlm.rt.rtm_scope = RT_SCOPE_UNIVERSE;
diff -r 49361d30325a -r 78d0faf1aa0e external/bsd/dhcpcd/dist/src/ipv6.c
--- a/external/bsd/dhcpcd/dist/src/ipv6.c       Fri Jul 27 09:57:43 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv6.c       Fri Jul 27 10:22:52 2018 +0000
@@ -253,6 +253,7 @@
     const struct in6_addr *prefix, int prefix_len,
     const unsigned char *netiface, size_t netiface_len,
     const unsigned char *netid, size_t netid_len,
+    unsigned short vlanid,
     uint32_t *dad_counter,
     const unsigned char *secret, size_t secret_len)
 {
@@ -267,6 +268,8 @@
 
        l = (size_t)(ROUNDUP8(prefix_len) / NBBY);
        len = l + netiface_len + netid_len + sizeof(*dad_counter) + secret_len;
+       if (vlanid != 0)
+               len += sizeof(vlanid);
        if (len > sizeof(buf)) {
                errno = ENOBUFS;
                return -1;
@@ -281,6 +284,12 @@
                p += netiface_len;
                memcpy(p, netid, netid_len);
                p += netid_len;
+               /* Don't use a vlanid if not set.
+                * This ensures prior versions have the same unique address. */
+               if (vlanid != 0) {
+                       memcpy(p, &vlanid, sizeof(vlanid));
+                       p += sizeof(vlanid);
+               }
                memcpy(p, dad_counter, sizeof(*dad_counter));
                p += sizeof(*dad_counter);
                memcpy(p, secret, secret_len);
@@ -333,7 +342,7 @@
        r = ipv6_makestableprivate1(addr, prefix, prefix_len,
            ifp->hwaddr, ifp->hwlen,
            ifp->ssid, ifp->ssid_len,
-           &dad,
+           ifp->vlanid, &dad,
            ifp->ctx->secret, ifp->ctx->secret_len);
 
        if (r == 0)
diff -r 49361d30325a -r 78d0faf1aa0e external/bsd/dhcpcd/dist/src/route.c
--- a/external/bsd/dhcpcd/dist/src/route.c      Fri Jul 27 09:57:43 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/route.c      Fri Jul 27 10:22:52 2018 +0000
@@ -44,6 +44,21 @@
 #include "route.h"
 #include "sa.h"
 
+/*
+ * On some systems, host routes have no need for a netmask.
+ * However DHCP specifies host routes using an all-ones netmask.
+ * This handy function allows easy comparison when the two
+ * differ.
+ */
+static int
+rt_cmp_netmask(const struct rt *rt1, const struct rt *rt2)
+{
+
+       if (rt1->rt_flags & RTF_HOST && rt2->rt_flags & RTF_HOST)
+               return 0;
+       return sa_cmp(&rt1->rt_netmask, &rt2->rt_netmask);
+}
+
 void
 rt_init(struct dhcpcd_ctx *ctx)
 {
@@ -63,14 +78,12 @@
 
        assert(cmd != NULL);
        assert(rt != NULL);
-       assert(rt->rt_ifp != NULL);
 
-       ifname = rt->rt_ifp->name;
        sa_addrtop(&rt->rt_dest, dest, sizeof(dest));
        prefix = sa_toprefix(&rt->rt_netmask);
        sa_addrtop(&rt->rt_gateway, gateway, sizeof(gateway));
-
        gateway_unspec = sa_is_unspecified(&rt->rt_gateway);
+       ifname = rt->rt_ifp == NULL ? "(null)" : rt->rt_ifp->name;
 
        if (rt->rt_flags & RTF_HOST) {
                if (gateway_unspec)
@@ -236,7 +249,7 @@
                    (f->rt_ifp == NULL ||
                    rt->rt_ifp->metric == f->rt_ifp->metric) &&
 #endif
-                   sa_cmp(&rt->rt_netmask, &f->rt_netmask) == 0)
+                   rt_cmp_netmask(f, rt) == 0)
                        return rt;
        }
        return NULL;
@@ -345,7 +358,7 @@
            ort->rt_metric == nrt->rt_metric &&
 #endif
            sa_cmp(&ort->rt_dest, &nrt->rt_dest) == 0 &&
-           sa_cmp(&ort->rt_netmask, &nrt->rt_netmask) == 0 &&
+           rt_cmp_netmask(ort, nrt) == 0 &&
            sa_cmp(&ort->rt_gateway, &nrt->rt_gateway) == 0)
        {
                if (ort->rt_mtu == nrt->rt_mtu)



Home | Main Index | Thread Index | Old Index