Module Name:    src
Committed By:   martin
Date:           Thu Apr 23 12:06:10 UTC 2020

Modified Files:
        src/doc [netbsd-9]: 3RDPARTY
        src/external/bsd/dhcpcd/dist/src [netbsd-9]: defs.h dhcp.c dhcp6.c
            ipv6nd.c

Log Message:
Apply patch, requested by roy in ticket #844:

        external/bsd/dhcpcd/dist/src/defs.h            (apply patch)
        external/bsd/dhcpcd/dist/src/dhcp.c            (apply patch)
        external/bsd/dhcpcd/dist/src/dhcp6.c           (apply patch)
        external/bsd/dhcpcd/dist/src/ipv6nd.c          (apply patch)
        doc/3RDPARTY                                   (apply patch)

Update to dhcpcd-8.1.9 which fixes alignment issues.


To generate a diff of this commit:
cvs rdiff -u -r1.1640.2.14 -r1.1640.2.15 src/doc/3RDPARTY
cvs rdiff -u -r1.1.1.25.2.8 -r1.1.1.25.2.9 \
    src/external/bsd/dhcpcd/dist/src/defs.h
cvs rdiff -u -r1.23.2.7 -r1.23.2.8 src/external/bsd/dhcpcd/dist/src/dhcp.c
cvs rdiff -u -r1.11.2.7 -r1.11.2.8 src/external/bsd/dhcpcd/dist/src/dhcp6.c
cvs rdiff -u -r1.10.2.6 -r1.10.2.7 src/external/bsd/dhcpcd/dist/src/ipv6nd.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.1640.2.14 src/doc/3RDPARTY:1.1640.2.15
--- src/doc/3RDPARTY:1.1640.2.14	Sun Apr 12 17:33:24 2020
+++ src/doc/3RDPARTY	Thu Apr 23 12:06:09 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1640.2.14 2020/04/12 17:33:24 martin Exp $
+#	$NetBSD: 3RDPARTY,v 1.1640.2.15 2020/04/23 12:06:09 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 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	8.1.8
-Current Vers:	8.1.8
+Version:	8.1.9
+Current Vers:	8.1.9
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/
-Date:		2020-04-12
+Date:		2020-04-21
 Mailing List: 	[email protected]
 License:	BSD (2-clause)
 Location:	external/bsd/dhcpcd/dist

Index: src/external/bsd/dhcpcd/dist/src/defs.h
diff -u src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.25.2.8 src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.25.2.9
--- src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.25.2.8	Sun Apr 12 17:33:24 2020
+++ src/external/bsd/dhcpcd/dist/src/defs.h	Thu Apr 23 12:06:09 2020
@@ -29,7 +29,7 @@
 #define CONFIG_H
 
 #define PACKAGE			"dhcpcd"
-#define VERSION			"8.1.8"
+#define VERSION			"8.1.9"
 
 #ifndef CONFIG
 # define CONFIG			SYSCONFDIR "/" PACKAGE ".conf"

Index: src/external/bsd/dhcpcd/dist/src/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp.c:1.23.2.7 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.23.2.8
--- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.23.2.7	Sun Apr 12 08:29:40 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcp.c	Thu Apr 23 12:06:09 2020
@@ -3308,7 +3308,7 @@ is_packet_udp_bootp(void *packet, size_t
 	memcpy(&udp, (char *)ip + ip_hlen, sizeof(udp));
 	if (ntohs(udp.uh_ulen) < sizeof(udp))
 		return false;
-	if (ip_hlen + (size_t)ntohs(udp.uh_ulen) > plen)
+	if (ip_hlen + ntohs(udp.uh_ulen) > plen)
 		return false;
 
 	/* Check it's to and from the right ports. */
@@ -3453,12 +3453,16 @@ dhcp_readbpf(void *arg)
 			}
 			break;
 		}
-		if (bytes < fl) {
-			logerrx("%s: %s: short frame header",
-			    __func__, ifp->name);
-			break;
+		if (fl != 0) {
+			if (bytes < fl) {
+				logerrx("%s: %s: short frame header",
+				    __func__, ifp->name);
+				break;
+			}
+			bytes -= fl;
+			memmove(buf, buf + fl, (size_t)bytes);
 		}
-		dhcp_packet(ifp, buf + fl, (size_t)(bytes - fl));
+		dhcp_packet(ifp, buf, (size_t)bytes);
 		/* Check we still have a state after processing. */
 		if ((state = D_STATE(ifp)) == NULL)
 			break;
@@ -3506,15 +3510,18 @@ dhcp_readudp(struct dhcpcd_ctx *ctx, str
 		.iov_base = buf,
 		.iov_len = sizeof(buf),
 	};
+	union {
+		struct cmsghdr hdr;
 #ifdef IP_RECVIF
-	unsigned char ctl[CMSG_SPACE(sizeof(struct sockaddr_dl))] = { 0 };
+		uint8_t buf[CMSG_SPACE(sizeof(struct sockaddr_dl))];
 #else
-	unsigned char ctl[CMSG_SPACE(sizeof(struct in_pktinfo))] = { 0 };
+		uint8_t buf[CMSG_SPACE(sizeof(struct in_pktinfo))];
 #endif
+	} cmsgbuf = { .buf = { 0 } };
 	struct msghdr msg = {
 	    .msg_name = &from, .msg_namelen = sizeof(from),
 	    .msg_iov = &iov, .msg_iovlen = 1,
-	    .msg_control = ctl, .msg_controllen = sizeof(ctl),
+	    .msg_control = buf, .msg_controllen = sizeof(cmsgbuf.buf),
 	};
 	int s;
 	ssize_t bytes;

Index: src/external/bsd/dhcpcd/dist/src/dhcp6.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.11.2.7 src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.11.2.8
--- src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.11.2.7	Sun Apr 12 17:57:13 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcp6.c	Thu Apr 23 12:06:09 2020
@@ -3581,11 +3581,14 @@ dhcp6_recv(struct dhcpcd_ctx *ctx, struc
 		.iov_base = buf,
 		.iov_len = sizeof(buf),
 	};
-	unsigned char ctl[CMSG_SPACE(sizeof(struct in6_pktinfo))] = { 0 };
+	union {
+		struct cmsghdr hdr;
+		uint8_t buf[CMSG_SPACE(sizeof(struct in6_pktinfo))];
+	} cmsgbuf = { .buf = { 0 } };
 	struct msghdr msg = {
 	    .msg_name = &from, .msg_namelen = sizeof(from),
 	    .msg_iov = &iov, .msg_iovlen = 1,
-	    .msg_control = ctl, .msg_controllen = sizeof(ctl),
+	    .msg_control = cmsgbuf.buf, .msg_controllen = sizeof(cmsgbuf.buf),
 	};
 	int s;
 	ssize_t bytes;

Index: src/external/bsd/dhcpcd/dist/src/ipv6nd.c
diff -u src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1.10.2.6 src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1.10.2.7
--- src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1.10.2.6	Sun Apr 12 08:29:40 2020
+++ src/external/bsd/dhcpcd/dist/src/ipv6nd.c	Thu Apr 23 12:06:09 2020
@@ -1832,11 +1832,15 @@ ipv6nd_handledata(void *arg)
 		.iov_base = buf,
 		.iov_len = sizeof(buf),
 	};
-	unsigned char ctl[CMSG_SPACE(sizeof(struct in6_pktinfo)) + CMSG_SPACE(sizeof(int))] = { 0 };
+	union {
+		struct cmsghdr hdr;
+		uint8_t buf[CMSG_SPACE(sizeof(struct in6_pktinfo)) +
+		    CMSG_SPACE(sizeof(int))];
+	} cmsgbuf = { .buf = { 0 } };
 	struct msghdr msg = {
 	    .msg_name = &from, .msg_namelen = sizeof(from),
 	    .msg_iov = &iov, .msg_iovlen = 1,
-	    .msg_control = ctl, .msg_controllen = sizeof(ctl),
+	    .msg_control = cmsgbuf.buf, .msg_controllen = sizeof(cmsgbuf.buf),
 	};
 	ssize_t len;
 

Reply via email to