Module Name:    src
Committed By:   martin
Date:           Fri Jul 27 10:22:52 UTC 2018

Modified Files:
        src/doc [netbsd-8]: 3RDPARTY
        src/external/bsd/dhcpcd/dist [netbsd-8]: configure
        src/external/bsd/dhcpcd/dist/src [netbsd-8]: defs.h if-linux.c ipv6.c
            route.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.1444.2.14 -r1.1444.2.15 src/doc/3RDPARTY
cvs rdiff -u -r1.1.1.3.2.2 -r1.1.1.3.2.3 \
    src/external/bsd/dhcpcd/dist/configure
cvs rdiff -u -r1.1.1.4.2.4 -r1.1.1.4.2.5 \
    src/external/bsd/dhcpcd/dist/src/defs.h
cvs rdiff -u -r1.1.1.3.2.3 -r1.1.1.3.2.4 \
    src/external/bsd/dhcpcd/dist/src/if-linux.c \
    src/external/bsd/dhcpcd/dist/src/ipv6.c \
    src/external/bsd/dhcpcd/dist/src/route.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1444.2.14 src/doc/3RDPARTY:1.1444.2.15
--- src/doc/3RDPARTY:1.1444.2.14	Sat Jun 23 12:14:46 2018
+++ src/doc/3RDPARTY	Fri Jul 27 10:22:52 2018
@@ -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 @@ Notes:
 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/

Index: src/external/bsd/dhcpcd/dist/configure
diff -u src/external/bsd/dhcpcd/dist/configure:1.1.1.3.2.2 src/external/bsd/dhcpcd/dist/configure:1.1.1.3.2.3
--- src/external/bsd/dhcpcd/dist/configure:1.1.1.3.2.2	Mon Apr  9 16:46:34 2018
+++ src/external/bsd/dhcpcd/dist/configure	Fri Jul 27 10:22:52 2018
@@ -713,7 +713,7 @@ EOF
 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 @@ EOF
 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 @@ EOF
 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 @@ EOF
 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 @@ EOF
 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 @@ EOF
 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_SAFE" = no -o "$TAI
 	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 @@ EOF
 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 @@ EOF
 	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 @@ EOF
 	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 @@ EOF
 	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 @@ EOF
 	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

Index: src/external/bsd/dhcpcd/dist/src/defs.h
diff -u src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.4.2.4 src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.4.2.5
--- src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.4.2.4	Sat Jun 23 11:13:33 2018
+++ src/external/bsd/dhcpcd/dist/src/defs.h	Fri Jul 27 10:22:52 2018
@@ -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"

Index: src/external/bsd/dhcpcd/dist/src/if-linux.c
diff -u src/external/bsd/dhcpcd/dist/src/if-linux.c:1.1.1.3.2.3 src/external/bsd/dhcpcd/dist/src/if-linux.c:1.1.1.3.2.4
--- src/external/bsd/dhcpcd/dist/src/if-linux.c:1.1.1.3.2.3	Thu Jun  7 18:34:03 2018
+++ src/external/bsd/dhcpcd/dist/src/if-linux.c	Fri Jul 27 10:22:52 2018
@@ -430,8 +430,6 @@ if_copyrt(struct dhcpcd_ctx *ctx, struct
 	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 @@ if_copyrt(struct dhcpcd_ctx *ctx, struct
 
 	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 @@ if_route(unsigned char cmd, const struct
 			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;
Index: src/external/bsd/dhcpcd/dist/src/ipv6.c
diff -u src/external/bsd/dhcpcd/dist/src/ipv6.c:1.1.1.3.2.3 src/external/bsd/dhcpcd/dist/src/ipv6.c:1.1.1.3.2.4
--- src/external/bsd/dhcpcd/dist/src/ipv6.c:1.1.1.3.2.3	Thu Jun  7 18:34:03 2018
+++ src/external/bsd/dhcpcd/dist/src/ipv6.c	Fri Jul 27 10:22:52 2018
@@ -253,6 +253,7 @@ ipv6_makestableprivate1(struct in6_addr 
     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 @@ ipv6_makestableprivate1(struct in6_addr 
 
 	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 @@ ipv6_makestableprivate1(struct in6_addr 
 		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 @@ ipv6_makestableprivate(struct in6_addr *
 	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)
Index: src/external/bsd/dhcpcd/dist/src/route.c
diff -u src/external/bsd/dhcpcd/dist/src/route.c:1.1.1.3.2.3 src/external/bsd/dhcpcd/dist/src/route.c:1.1.1.3.2.4
--- src/external/bsd/dhcpcd/dist/src/route.c:1.1.1.3.2.3	Thu Jun  7 18:34:03 2018
+++ src/external/bsd/dhcpcd/dist/src/route.c	Fri Jul 27 10:22:52 2018
@@ -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 @@ rt_desc(const char *cmd, const struct rt
 
 	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 @@ rt_find(struct rt_head *rts, const struc
 		    (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 @@ rt_add(struct rt *nrt, struct rt *ort)
 	    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)

Reply via email to