CVS commit: [netbsd-8] src/external/bsd/dhcpcd/dist/src

2019-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  5 08:24:04 UTC 2019

Modified Files:
src/external/bsd/dhcpcd/dist/src [netbsd-8]: bpf.c defs.h dhcp.c
dhcp6.c dhcpcd.c dhcpcd.h if-bsd.c if-linux.c if-options.c if-sun.c
if.c if.h

Log Message:
Sync to current, requested by roy in ticket #1256:

external/bsd/dhcpcd/dist/src/bpf.c  up to 1.9
external/bsd/dhcpcd/dist/src/defs.h up to 1.1.1.21
external/bsd/dhcpcd/dist/src/dhcp.c up to 1.19
external/bsd/dhcpcd/dist/src/dhcp6.cup to 1.7
external/bsd/dhcpcd/dist/src/dhcpcd.c   up to 1.19
external/bsd/dhcpcd/dist/src/dhcpcd.h   up to 1.1.1.10
external/bsd/dhcpcd/dist/src/if-bsd.c   up to 1.7
external/bsd/dhcpcd/dist/src/if-linux.c up to 1.1.1.13
external/bsd/dhcpcd/dist/src/if-options.c   up to 1.14
external/bsd/dhcpcd/dist/src/if-sun.c   up to 1.1.1.8
external/bsd/dhcpcd/dist/src/if.c   up to 1.1.1.13
external/bsd/dhcpcd/dist/src/if.h   up to 1.1.1.8

Import dhcpcd-7.2.2 with the following changes:
  *  DHCP: Ensure dhcp is running on the interface received from
  *  BSD: Link handling has been simplified, however it is expected
 that if an interface supports SIOCGIFMEDIA then it reports
 the correct link status via route(4) for reliable operations
  *  BPF: ARP filter is more robust
  *  BSD: Validate RTM message lengths

This security issue has been addressed:
  *  DHCPv6: Fix a potential read overflow with D6_OPTION_PD_EXCLUDE

Many thanks to Maxime Villard  for discovering this issue.


To generate a diff of this commit:
cvs rdiff -u -r1.3.8.3 -r1.3.8.4 src/external/bsd/dhcpcd/dist/src/bpf.c
cvs rdiff -u -r1.1.1.4.2.7 -r1.1.1.4.2.8 \
src/external/bsd/dhcpcd/dist/src/defs.h
cvs rdiff -u -r1.1.1.3.8.6 -r1.1.1.3.8.7 \
src/external/bsd/dhcpcd/dist/src/dhcp.c
cvs rdiff -u -r1.1.1.4.2.5 -r1.1.1.4.2.6 \
src/external/bsd/dhcpcd/dist/src/dhcp6.c
cvs rdiff -u -r1.4.2.5 -r1.4.2.6 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
cvs rdiff -u -r1.1.1.3.2.3 -r1.1.1.3.2.4 \
src/external/bsd/dhcpcd/dist/src/dhcpcd.h
cvs rdiff -u -r1.1.1.3.2.5 -r1.1.1.3.2.6 \
src/external/bsd/dhcpcd/dist/src/if-bsd.c \
src/external/bsd/dhcpcd/dist/src/if-linux.c
cvs rdiff -u -r1.4.2.4 -r1.4.2.5 \
src/external/bsd/dhcpcd/dist/src/if-options.c
cvs rdiff -u -r1.1.1.2.2.3 -r1.1.1.2.2.4 \
src/external/bsd/dhcpcd/dist/src/if-sun.c \
src/external/bsd/dhcpcd/dist/src/if.h
cvs rdiff -u -r1.1.1.3.2.4 -r1.1.1.3.2.5 \
src/external/bsd/dhcpcd/dist/src/if.c

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

Modified files:

Index: src/external/bsd/dhcpcd/dist/src/bpf.c
diff -u src/external/bsd/dhcpcd/dist/src/bpf.c:1.3.8.3 src/external/bsd/dhcpcd/dist/src/bpf.c:1.3.8.4
--- src/external/bsd/dhcpcd/dist/src/bpf.c:1.3.8.3	Fri Apr 26 19:18:22 2019
+++ src/external/bsd/dhcpcd/dist/src/bpf.c	Sun May  5 08:24:04 2019
@@ -301,6 +301,7 @@ bpf_close(struct interface *ifp, int fd)
 /* Normally this is needed by bootp.
  * Once that uses this again, the ARP guard here can be removed. */
 #ifdef ARP
+#define BPF_CMP_HWADDR_LEN	HWADDR_LEN / 4) + 2) * 2) + 1)
 static unsigned int
 bpf_cmp_hwaddr(struct bpf_insn *bpf, size_t bpf_len, size_t off,
 bool equal, uint8_t *hwaddr, size_t hwaddr_len)
@@ -414,7 +415,7 @@ static const struct bpf_insn bpf_arp_eth
 	 sizeof(((struct ether_arp *)0)->arp_sha), 1, 0),
 	BPF_STMT(BPF_RET + BPF_K, 0),
 };
-#define bpf_arp_ether_len	__arraycount(bpf_arp_ether)
+#define BPF_ARP_ETHER_LEN	__arraycount(bpf_arp_ether)
 
 static const struct bpf_insn bpf_arp_filter [] = {
 	/* Make sure this is for IP. */
@@ -425,21 +426,25 @@ static const struct bpf_insn bpf_arp_fil
 	BPF_STMT(BPF_LD + BPF_H + BPF_IND, offsetof(struct arphdr, ar_op)),
 	BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ARPOP_REQUEST, 2, 0),
 	/* or ARP REPLY. */
-	BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ARPOP_REPLY, 1, 1),
+	BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ARPOP_REPLY, 1, 0),
 	BPF_STMT(BPF_RET + BPF_K, 0),
 	/* Make sure the protocol length matches. */
 	BPF_STMT(BPF_LD + BPF_B + BPF_IND, offsetof(struct arphdr, ar_pln)),
 	BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, sizeof(in_addr_t), 1, 0),
 	BPF_STMT(BPF_RET + BPF_K, 0),
 };
-#define bpf_arp_filter_len	__arraycount(bpf_arp_filter)
-#define bpf_arp_extra		ARP_ADDRS_MAX + 1) * 2) * 2) + 2)
-#define bpf_arp_hw		HWADDR_LEN / 4) + 2) * 2) + 1)
+#define BPF_ARP_FILTER_LEN	__arraycount(bpf_arp_filter)
+
+#define BPF_ARP_ADDRS_LEN	1 + (ARP_ADDRS_MAX * 2) + 3 + \
+(ARP_ADDRS_MAX * 2) + 1
+
+#define BPF_ARP_LEN		BPF_ARP_ETHER_LEN + BPF_ARP_FILTER_LEN + \
+BPF_CMP_HWADDR_LEN + BPF_ARP_ADDRS_LEN
 
 int
 bpf_arp(struct interface *ifp, int fd)
 {
-	struct bpf_insn bpf[3+ bpf_arp_filter_len + bpf_arp_hw + 

CVS commit: [netbsd-8] src/external/bsd/dhcpcd/dist/src

2019-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  5 08:24:04 UTC 2019

Modified Files:
src/external/bsd/dhcpcd/dist/src [netbsd-8]: bpf.c defs.h dhcp.c
dhcp6.c dhcpcd.c dhcpcd.h if-bsd.c if-linux.c if-options.c if-sun.c
if.c if.h

Log Message:
Sync to current, requested by roy in ticket #1256:

external/bsd/dhcpcd/dist/src/bpf.c  up to 1.9
external/bsd/dhcpcd/dist/src/defs.h up to 1.1.1.21
external/bsd/dhcpcd/dist/src/dhcp.c up to 1.19
external/bsd/dhcpcd/dist/src/dhcp6.cup to 1.7
external/bsd/dhcpcd/dist/src/dhcpcd.c   up to 1.19
external/bsd/dhcpcd/dist/src/dhcpcd.h   up to 1.1.1.10
external/bsd/dhcpcd/dist/src/if-bsd.c   up to 1.7
external/bsd/dhcpcd/dist/src/if-linux.c up to 1.1.1.13
external/bsd/dhcpcd/dist/src/if-options.c   up to 1.14
external/bsd/dhcpcd/dist/src/if-sun.c   up to 1.1.1.8
external/bsd/dhcpcd/dist/src/if.c   up to 1.1.1.13
external/bsd/dhcpcd/dist/src/if.h   up to 1.1.1.8

Import dhcpcd-7.2.2 with the following changes:
  *  DHCP: Ensure dhcp is running on the interface received from
  *  BSD: Link handling has been simplified, however it is expected
 that if an interface supports SIOCGIFMEDIA then it reports
 the correct link status via route(4) for reliable operations
  *  BPF: ARP filter is more robust
  *  BSD: Validate RTM message lengths

This security issue has been addressed:
  *  DHCPv6: Fix a potential read overflow with D6_OPTION_PD_EXCLUDE

Many thanks to Maxime Villard  for discovering this issue.


To generate a diff of this commit:
cvs rdiff -u -r1.3.8.3 -r1.3.8.4 src/external/bsd/dhcpcd/dist/src/bpf.c
cvs rdiff -u -r1.1.1.4.2.7 -r1.1.1.4.2.8 \
src/external/bsd/dhcpcd/dist/src/defs.h
cvs rdiff -u -r1.1.1.3.8.6 -r1.1.1.3.8.7 \
src/external/bsd/dhcpcd/dist/src/dhcp.c
cvs rdiff -u -r1.1.1.4.2.5 -r1.1.1.4.2.6 \
src/external/bsd/dhcpcd/dist/src/dhcp6.c
cvs rdiff -u -r1.4.2.5 -r1.4.2.6 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
cvs rdiff -u -r1.1.1.3.2.3 -r1.1.1.3.2.4 \
src/external/bsd/dhcpcd/dist/src/dhcpcd.h
cvs rdiff -u -r1.1.1.3.2.5 -r1.1.1.3.2.6 \
src/external/bsd/dhcpcd/dist/src/if-bsd.c \
src/external/bsd/dhcpcd/dist/src/if-linux.c
cvs rdiff -u -r1.4.2.4 -r1.4.2.5 \
src/external/bsd/dhcpcd/dist/src/if-options.c
cvs rdiff -u -r1.1.1.2.2.3 -r1.1.1.2.2.4 \
src/external/bsd/dhcpcd/dist/src/if-sun.c \
src/external/bsd/dhcpcd/dist/src/if.h
cvs rdiff -u -r1.1.1.3.2.4 -r1.1.1.3.2.5 \
src/external/bsd/dhcpcd/dist/src/if.c

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



CVS commit: [netbsd-8] src/external/bsd/dhcpcd/dist/src

2018-06-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 23 11:13:33 UTC 2018

Modified Files:
src/external/bsd/dhcpcd/dist/src [netbsd-8]: common.c defs.h
dhcpcd.8.in dhcpcd.c dhcpcd.conf.5.in duid.c

Log Message:
Pull up the following, requested by roy in ticket #896:

external/bsd/dhcpcd/dist/src/common.c   up to 1.1.1.5
external/bsd/dhcpcd/dist/src/defs.h up to 1.1.1.14
external/bsd/dhcpcd/dist/src/dhcpcd.8.inup to 1.1.1.10
external/bsd/dhcpcd/dist/src/dhcpcd.c   up to 1.13
external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in   up to 1.1.1.10
external/bsd/dhcpcd/dist/src/duid.c up to 1.1.1.3

Import dhcpcd 7.0.6.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2.8.1 -r1.1.1.2.8.2 \
src/external/bsd/dhcpcd/dist/src/common.c
cvs rdiff -u -r1.1.1.4.2.3 -r1.1.1.4.2.4 \
src/external/bsd/dhcpcd/dist/src/defs.h \
src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in \
src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
cvs rdiff -u -r1.4.2.3 -r1.4.2.4 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.8.1 src/external/bsd/dhcpcd/dist/src/duid.c

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

Modified files:

Index: src/external/bsd/dhcpcd/dist/src/common.c
diff -u src/external/bsd/dhcpcd/dist/src/common.c:1.1.1.2.8.1 src/external/bsd/dhcpcd/dist/src/common.c:1.1.1.2.8.2
--- src/external/bsd/dhcpcd/dist/src/common.c:1.1.1.2.8.1	Sat Jan 13 21:35:30 2018
+++ src/external/bsd/dhcpcd/dist/src/common.c	Sat Jun 23 11:13:33 2018
@@ -140,10 +140,15 @@ hwaddr_aton(uint8_t *buffer, const char 
 	size_t len = 0;
 
 	c[2] = '\0';
-	while (*p) {
+	while (*p != '\0') {
+		/* Skip separators */
 		c[0] = *p++;
-		if (c[0] == '\n')
+		switch (c[0]) {
+		case '\n':	/* long duid split on lines */
+		case ':':	/* typical mac address */
+		case '-':	/* uuid */
 			continue;
+		}
 		c[1] = *p++;
 		/* Ensure that digits are hex */
 		if (isxdigit((unsigned char)c[0]) == 0 ||
@@ -157,15 +162,6 @@ hwaddr_aton(uint8_t *buffer, const char 
 			errno = EINVAL;
 			return 0;
 		}
-		/* Ensure that next data is EOL or a seperator with data */
-		if (!(*p == '\0' || *p == '\n' ||
-		(*p == ':' && *(p + 1) != '\0')))
-		{
-			errno = EINVAL;
-			return 0;
-		}
-		if (*p)
-			p++;
 		if (bp)
 			*bp++ = (uint8_t)strtol(c, NULL, 16);
 		len++;

Index: src/external/bsd/dhcpcd/dist/src/defs.h
diff -u src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.4.2.3 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.3	Thu Jun  7 18:34:03 2018
+++ src/external/bsd/dhcpcd/dist/src/defs.h	Sat Jun 23 11:13:33 2018
@@ -28,7 +28,7 @@
 #define CONFIG_H
 
 #define PACKAGE			"dhcpcd"
-#define VERSION			"7.0.5"
+#define VERSION			"7.0.6"
 
 #ifndef CONFIG
 # define CONFIG			SYSCONFDIR "/" PACKAGE ".conf"
Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in:1.1.1.4.2.3 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in:1.1.1.4.2.4
--- src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in:1.1.1.4.2.3	Thu Jun  7 18:34:03 2018
+++ src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in	Sat Jun 23 11:13:33 2018
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd April 29, 2018
+.Dd June 5, 2018
 .Dt DHCPCD 8
 .Os
 .Sh NAME
@@ -253,15 +253,17 @@ Use this
 instead of the default
 .Pa @SCRIPT@ .
 .It Fl D , Fl Fl duid
-Generate an
-.Li RFC 4361
-compliant clientid.
-This requires persistent storage and not all DHCP servers work with it so it
-is not enabled by default.
-.Nm
-generates the DUID and stores it in
-.Pa @DBDIR@/duid .
-This file should not be copied to other hosts.
+Use a DHCP Unique Identifier.
+If a system UUID is available, that will be used to create a DUID-UUID,
+otheriwse if persistent storage is available then a DUID-LLT
+(link local address + time) is generated,
+otherwise DUID-LL is generated (link local address).
+This, plus the IAID will be used as the
+.Fl I, Fl Fl clientid .
+The DUID generated will be held in
+.Pa @DBDIR@/duid
+and should not be copied to other hosts.
+This file also takes precedence over the above rules.
 .It Fl d , Fl Fl debug
 Echo debug messages to the stderr and syslog.
 .It Fl E , Fl Fl lastlease
@@ -823,8 +825,8 @@ RFC\ 951, RFC\ 1534, RFC\ 2104, RFC\ 213
 RFC\ 3004, RFC\ 3118, RFC\ 3203, RFC\ 3315, RFC\ 3361, RFC\ 3633, RFC\ 3396,
 RFC\ 3397, RFC\ 3442, RFC\ 3495, RFC\ 3925, RFC\ 3927, RFC\ 4039, RFC\ 4075,
 RFC\ 4242, RFC\ 4361, RFC\ 4390, RFC\ 4702, RFC\ 4074, RFC\ 4861, RFC\ 4833,
-RFC\ 4941, RFC\ 5227, RFC\ 5942, RFC\ 5969, RFC\ 6106, RFC\ 6334, RFC\ 6603,
-RFC\ 6704, RFC\ 7217, RFC\ 7550.
+RFC\ 4941, RFC\ 5227, RFC\ 5942, RFC\ 5969, RFC\ 6106, RFC\ 6334, RFC\ 6355,
+RFC\ 6603, RFC\ 6704, RFC\ 7217, RFC\ 7550.
 .Sh AUTHORS
 .An Roy Marples Aq Mt 

CVS commit: [netbsd-8] src/external/bsd/dhcpcd/dist/src

2018-06-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 23 11:13:33 UTC 2018

Modified Files:
src/external/bsd/dhcpcd/dist/src [netbsd-8]: common.c defs.h
dhcpcd.8.in dhcpcd.c dhcpcd.conf.5.in duid.c

Log Message:
Pull up the following, requested by roy in ticket #896:

external/bsd/dhcpcd/dist/src/common.c   up to 1.1.1.5
external/bsd/dhcpcd/dist/src/defs.h up to 1.1.1.14
external/bsd/dhcpcd/dist/src/dhcpcd.8.inup to 1.1.1.10
external/bsd/dhcpcd/dist/src/dhcpcd.c   up to 1.13
external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in   up to 1.1.1.10
external/bsd/dhcpcd/dist/src/duid.c up to 1.1.1.3

Import dhcpcd 7.0.6.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2.8.1 -r1.1.1.2.8.2 \
src/external/bsd/dhcpcd/dist/src/common.c
cvs rdiff -u -r1.1.1.4.2.3 -r1.1.1.4.2.4 \
src/external/bsd/dhcpcd/dist/src/defs.h \
src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in \
src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
cvs rdiff -u -r1.4.2.3 -r1.4.2.4 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.8.1 src/external/bsd/dhcpcd/dist/src/duid.c

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



CVS commit: [netbsd-8] src/external/bsd/dhcpcd/dist/src

2017-09-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Sep 11 05:18:34 UTC 2017

Modified Files:
src/external/bsd/dhcpcd/dist/src [netbsd-8]: dhcp.c

Log Message:
Pull up following revision(s) (requested by bsiegert in ticket #266):
external/bsd/dhcpcd/dist/src/dhcp.c: revision 1.2
dhcp: Fix classless static routes
Assign the netwask correctly from the message.
Cherry-picked from upstream in
https://dev.marples.name/rDHC510c760cb24ef4b1b16cc14732c5ffe0fbb0d96d.
This fixes route assignments when running on Google Compute Engine,
which uses classless static routes.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.8.1 src/external/bsd/dhcpcd/dist/src/dhcp.c

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



CVS commit: [netbsd-8] src/external/bsd/dhcpcd/dist/src

2017-09-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Sep 11 05:18:34 UTC 2017

Modified Files:
src/external/bsd/dhcpcd/dist/src [netbsd-8]: dhcp.c

Log Message:
Pull up following revision(s) (requested by bsiegert in ticket #266):
external/bsd/dhcpcd/dist/src/dhcp.c: revision 1.2
dhcp: Fix classless static routes
Assign the netwask correctly from the message.
Cherry-picked from upstream in
https://dev.marples.name/rDHC510c760cb24ef4b1b16cc14732c5ffe0fbb0d96d.
This fixes route assignments when running on Google Compute Engine,
which uses classless static routes.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.8.1 src/external/bsd/dhcpcd/dist/src/dhcp.c

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

Modified files:

Index: src/external/bsd/dhcpcd/dist/src/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp.c:1.1.1.3 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.1.1.3.8.1
--- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.1.1.3	Fri Apr 14 09:53:07 2017
+++ src/external/bsd/dhcpcd/dist/src/dhcp.c	Mon Sep 11 05:18:34 2017
@@ -452,7 +452,7 @@ decode_rfc3442_rt(struct rt_head *routes
 		}
 
 		sa_in_init(>rt_dest, );
-		sa_in_init(>rt_dest, );
+		sa_in_init(>rt_netmask, );
 		sa_in_init(>rt_gateway, );
 
 		/* If CIDR is 32 then it's a host route. */