CVS commit: src/sys

2021-02-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Feb 14 19:47:17 UTC 2021

Modified Files:
src/sys/net: if_arp.h
src/sys/netinet: if_arp.c

Log Message:
if_arp: Just KASSERT that arphrd is aligned

While here improve readability of checking ARP IEEE1394 matches interface.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/net/if_arp.h
cvs rdiff -u -r1.300 -r1.301 src/sys/netinet/if_arp.c

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

Modified files:

Index: src/sys/net/if_arp.h
diff -u src/sys/net/if_arp.h:1.38 src/sys/net/if_arp.h:1.39
--- src/sys/net/if_arp.h:1.38	Sat Feb 13 07:57:09 2021
+++ src/sys/net/if_arp.h	Sun Feb 14 19:47:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.h,v 1.38 2021/02/13 07:57:09 roy Exp $	*/
+/*	$NetBSD: if_arp.h,v 1.39 2021/02/14 19:47:16 roy Exp $	*/
 
 /*
  * Copyright (c) 1986, 1993
@@ -72,14 +72,6 @@ struct	arphdr {
 	uint8_t  ar_tpa[];	/* target protocol address */
 #endif
 };
-#ifdef __NO_STRICT_ALIGNMENT
-#define	ARP_HDR_ALIGNED_P(ah)	1
-#else
-#define	ARP_HDR_ALIGNED_P(ah)	vaddr_t) (ah)) & 3) == 0)
-#endif
-#ifdef __CTASSERT
-__CTASSERT(sizeof(struct arphdr) == 8);
-#endif
 
 static __inline uint8_t *
 ar_data(struct arphdr *ap)

Index: src/sys/netinet/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.300 src/sys/netinet/if_arp.c:1.301
--- src/sys/netinet/if_arp.c:1.300	Sat Feb 13 13:00:16 2021
+++ src/sys/netinet/if_arp.c	Sun Feb 14 19:47:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.c,v 1.300 2021/02/13 13:00:16 roy Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.301 2021/02/14 19:47:17 roy Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.300 2021/02/13 13:00:16 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.301 2021/02/14 19:47:17 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -133,6 +133,12 @@ __KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1
  */
 #define ETHERTYPE_IPTRAILERS ETHERTYPE_TRAIL
 
+#ifdef __NO_STRICT_ALIGNMENT
+#define	ARP_HDR_ALIGNED_P(ar)	1
+#else
+#define	ARP_HDR_ALIGNED_P(ar)	vaddr_t) (ar)) & 1) == 0)
+#endif
+
 /* timers */
 static int arp_reachable = REACHABLE_TIME;
 static int arp_retrans = RETRANS_TIMER;
@@ -684,10 +690,11 @@ arpintr(void)
 	struct arphdr *ar;
 	int s;
 	int arplen;
+	struct ifnet *rcvif;
+	bool badhrd;
 
 	SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
 	for (;;) {
-		struct ifnet *rcvif;
 
 		IFQ_LOCK();
 		IF_DEQUEUE(, m);
@@ -700,15 +707,12 @@ arpintr(void)
 		MCLAIM(m, _mowner);
 		ARP_STATINC(ARP_STAT_RCVTOTAL);
 
-		/* Enforce alignment */
-		if (ARP_HDR_ALIGNED_P(mtod(m, void *)) == 0) {
-			if ((m = m_copyup(m, sizeof(*ar), 0)) == NULL)
-goto badlen;
-		} else if (__predict_false(m->m_len < sizeof(*ar))) {
+		if (__predict_false(m->m_len < sizeof(*ar))) {
 			if ((m = m_pullup(m, sizeof(*ar))) == NULL)
 goto badlen;
 		}
 		ar = mtod(m, struct arphdr *);
+		KASSERT(ARP_HDR_ALIGNED_P(ar));
 
 		rcvif = m_get_rcvif(m, );
 		if (__predict_false(rcvif == NULL)) {
@@ -720,27 +724,20 @@ arpintr(void)
 		 * We don't want non-IEEE1394 ARP packets on IEEE1394
 		 * interfaces, and vice versa. Our life depends on that.
 		 */
-		switch (rcvif->if_type) {
-		case IFT_IEEE1394:
-			if (ntohs(ar->ar_hrd) != ARPHRD_IEEE1394) {
-m_put_rcvif(rcvif, );
-ARP_STATINC(ARP_STAT_RCVBADPROTO);
-goto free;
-			}
-			break;
-		default:
-			if (ntohs(ar->ar_hrd) == ARPHRD_IEEE1394) {
-m_put_rcvif(rcvif, );
-ARP_STATINC(ARP_STAT_RCVBADPROTO);
-goto free;
-			}
-			break;
-		}
+		if (ntohs(ar->ar_hrd) == ARPHRD_IEEE1394)
+			badhrd = rcvif->if_type != IFT_IEEE1394;
+		else
+			badhrd = rcvif->if_type == IFT_IEEE1394;
 
 		m_put_rcvif(rcvif, );
 
+		if (badhrd) {
+			ARP_STATINC(ARP_STAT_RCVBADPROTO);
+			goto free;
+		}
+
 		arplen = sizeof(*ar) + 2 * ar->ar_hln + 2 * ar->ar_pln;
-		if (m->m_len < arplen) {
+		if (__predict_false(m->m_len < arplen)) {
 			if ((m = m_pullup(m, arplen)) == NULL)
 goto badlen;
 			ar = mtod(m, struct arphdr *);



CVS commit: src/sys/net

2021-02-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Feb 14 19:35:38 UTC 2021

Modified Files:
src/sys/net: if_ether.h if_ethersubr.c

Log Message:
if_ether: revert prior alignment checks

Apparently not needed as our drivers ensure this.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/net/if_ether.h
cvs rdiff -u -r1.291 -r1.292 src/sys/net/if_ethersubr.c

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

Modified files:

Index: src/sys/net/if_ether.h
diff -u src/sys/net/if_ether.h:1.85 src/sys/net/if_ether.h:1.86
--- src/sys/net/if_ether.h:1.85	Sat Feb 13 07:28:04 2021
+++ src/sys/net/if_ether.h	Sun Feb 14 19:35:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.85 2021/02/13 07:28:04 roy Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.86 2021/02/14 19:35:37 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -89,15 +89,6 @@ struct ether_header {
 	uint8_t  ether_shost[ETHER_ADDR_LEN];
 	uint16_t ether_type;
 };
-#ifdef __NO_STRICT_ALIGNMENT
-#define	ETHER_HDR_ALIGNED_P(eh)	1
-#else
-#define	ETHER_HDR_ALIGNED_P(eh)	vaddr_t) (eh)) & 3) == 0)
-#endif
-#ifdef __CTASSERT
-__CTASSERT(sizeof(struct ether_addr) == 6);
-__CTASSERT(sizeof(struct ether_header) == 14);
-#endif
 
 #include 
 

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.291 src/sys/net/if_ethersubr.c:1.292
--- src/sys/net/if_ethersubr.c:1.291	Sat Feb 13 13:00:16 2021
+++ src/sys/net/if_ethersubr.c	Sun Feb 14 19:35:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.291 2021/02/13 13:00:16 roy Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.292 2021/02/14 19:35:37 roy Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.291 2021/02/13 13:00:16 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.292 2021/02/14 19:35:37 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -164,6 +164,9 @@ extern u_char	aarp_org_code[3];
 #include 
 #endif
 
+CTASSERT(sizeof(struct ether_addr) == 6);
+CTASSERT(sizeof(struct ether_header) == 14);
+
 #ifdef DIAGNOSTIC
 static struct timeval bigpktppslim_last;
 static int bigpktppslim = 2;	/* XXX */
@@ -653,11 +656,7 @@ ether_input(struct ifnet *ifp, struct mb
 	m_claimm(m, >ec_rx_mowner);
 #endif
 
-	/* Enforce alignement */
-	if (ETHER_HDR_ALIGNED_P(mtod(m, void *)) == 0) {
-		if ((m = m_copyup(m, sizeof(*eh), 0)) == NULL)
-			goto dropped;
-	} else if (__predict_false(m->m_len < sizeof(*eh))) {
+	if (__predict_false(m->m_len < sizeof(*eh))) {
 		if ((m = m_pullup(m, sizeof(*eh))) == NULL)
 			goto dropped;
 	}



CVS commit: src/sys/net

2021-02-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Feb 14 19:33:29 UTC 2021

Modified Files:
src/sys/net: if_gre.c if_gre.h

Log Message:
if_gre: Remove alignment checks in favour copying to stack

Makes the code a lot simpler, idea from dyoung@


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/net/if_gre.c
cvs rdiff -u -r1.48 -r1.49 src/sys/net/if_gre.h

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

Modified files:

Index: src/sys/net/if_gre.c
diff -u src/sys/net/if_gre.c:1.179 src/sys/net/if_gre.c:1.180
--- src/sys/net/if_gre.c:1.179	Sat Feb 13 13:00:16 2021
+++ src/sys/net/if_gre.c	Sun Feb 14 19:33:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.c,v 1.179 2021/02/13 13:00:16 roy Exp $ */
+/*	$NetBSD: if_gre.c,v 1.180 2021/02/14 19:33:29 roy Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.179 2021/02/13 13:00:16 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.180 2021/02/14 19:33:29 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_atalk.h"
@@ -142,6 +142,8 @@ int gre_debug = 0;
 #define	GRE_DPRINTF(__sc, __fmt, ...)	do { } while (/*CONSTCOND*/0)
 #endif /* GRE_DEBUG */
 
+CTASSERT(sizeof(struct gre_h) == 4);
+
 int ip_gre_ttl = GRE_TTL;
 
 static u_int gre_count;
@@ -374,7 +376,7 @@ gre_receive(struct socket *so, void *arg
 {
 	struct gre_softc *sc = (struct gre_softc *)arg;
 	int rc;
-	const struct gre_h *gh;
+	struct gre_h gh;
 	struct mbuf *m;
 
 	GRE_DPRINTF(sc, "enter\n");
@@ -396,24 +398,16 @@ gre_receive(struct socket *so, void *arg
 		return;
 	}
 
-	/* Enforce alignment */
-	if (GRE_HDR_ALIGNED_P(mtod(m, void *)) == 0) {
-		if ((m = m_copyup(m, sizeof(struct gre_h), 0)) == NULL) {
-			/* XXXJRT new stat, please */
-			GRE_DPRINTF(sc, "m_copyup failed\n");
-			sc->sc_pullup_ev.ev_count++;
-			return;
-		}
-	} else if (__predict_false(m->m_len < sizeof(struct gre_h))) {
-		if ((m = m_pullup(m, sizeof(struct gre_h))) == NULL) {
+	if (__predict_false(m->m_len < sizeof(gh))) {
+		if ((m = m_pullup(m, sizeof(gh))) == NULL) {
 			GRE_DPRINTF(sc, "m_pullup failed\n");
 			sc->sc_pullup_ev.ev_count++;
 			return;
 		}
 	}
-	gh = mtod(m, const struct gre_h *);
+	memcpy(, mtod(m, void *), sizeof(gh));
 
-	if (gre_input(sc, m, gh) == 0) {
+	if (gre_input(sc, m, ) == 0) {
 		sc->sc_unsupp_ev.ev_count++;
 		GRE_DPRINTF(sc, "dropping unsupported\n");
 		m_freem(m);
@@ -898,7 +892,7 @@ gre_output(struct ifnet *ifp, struct mbu
 {
 	int error = 0;
 	struct gre_softc *sc = ifp->if_softc;
-	struct gre_h *gh;
+	struct gre_h gh = { .flags = 0 };
 	uint16_t etype = 0;
 
 	KASSERT((m->m_flags & M_PKTHDR) != 0);
@@ -950,17 +944,15 @@ gre_output(struct ifnet *ifp, struct mbu
 	}
 #endif
 
-	M_PREPEND(m, sizeof(*gh), M_DONTWAIT);
+	M_PREPEND(m, sizeof(gh), M_DONTWAIT);
 	if (m == NULL) {
 		IF_DROP(>if_snd);
 		error = ENOBUFS;
 		goto end;
 	}
 
-	gh = mtod(m, struct gre_h *);
-	KASSERT(GRE_HDR_ALIGNED_P(gh));
-	gh->flags = 0;
-	gh->ptype = etype;
+	gh.ptype = etype;
+	memcpy(mtod(m, void *), , sizeof(gh));
 	/* XXX Need to handle IP ToS.  Look at how I handle IP TTL. */
 
 	if_statadd2(ifp, if_opackets, 1, if_obytes, m->m_pkthdr.len);

Index: src/sys/net/if_gre.h
diff -u src/sys/net/if_gre.h:1.48 src/sys/net/if_gre.h:1.49
--- src/sys/net/if_gre.h:1.48	Fri Feb 12 19:57:49 2021
+++ src/sys/net/if_gre.h	Sun Feb 14 19:33:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.h,v 1.48 2021/02/12 19:57:49 roy Exp $ */
+/*	$NetBSD: if_gre.h,v 1.49 2021/02/14 19:33:29 roy Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -131,15 +131,6 @@ struct gre_h {
 Present if (rt_pres == 1)
  */
 };
-#ifdef __NO_STRICT_ALIGNMENT
-#define	GRE_HDR_ALIGNED_P(gh)	1
-#else
-#define	GRE_HDR_ALIGNED_P(gh)	vaddr_t) (gh)) & 3) == 0)
-#endif
-#ifdef __CTASSERT
-__CTASSERT(sizeof(struct gre_h) == 4);
-#endif
-
 #define GRE_CP		0x8000  /* Checksum Present */
 #define GRE_RP		0x4000  /* Routing Present */
 #define GRE_KP		0x2000  /* Key Present */



CVS commit: src/sys

2021-02-13 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Feb 13 13:00:16 UTC 2021

Modified Files:
src/sys/net: if_ethersubr.c if_gre.c
src/sys/netinet: if_arp.c

Log Message:
Prior alignment fixes should not use an offset


To generate a diff of this commit:
cvs rdiff -u -r1.290 -r1.291 src/sys/net/if_ethersubr.c
cvs rdiff -u -r1.178 -r1.179 src/sys/net/if_gre.c
cvs rdiff -u -r1.299 -r1.300 src/sys/netinet/if_arp.c

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

Modified files:

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.290 src/sys/net/if_ethersubr.c:1.291
--- src/sys/net/if_ethersubr.c:1.290	Sat Feb 13 07:28:04 2021
+++ src/sys/net/if_ethersubr.c	Sat Feb 13 13:00:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.290 2021/02/13 07:28:04 roy Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.291 2021/02/13 13:00:16 roy Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.290 2021/02/13 07:28:04 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.291 2021/02/13 13:00:16 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -649,23 +649,19 @@ ether_input(struct ifnet *ifp, struct mb
 	if ((ifp->if_flags & IFF_UP) == 0)
 		goto drop;
 
-	/* If the Ethernet header is not aligned, slurp it up into a new
-	 * mbuf with space for link headers, in the event we forward
-	 * it.  Otherwise, if it is aligned, make sure the entire
-	 * base Ethernet header is in the first mbuf of the chain.
-	 */
+#ifdef MBUFTRACE
+	m_claimm(m, >ec_rx_mowner);
+#endif
+
+	/* Enforce alignement */
 	if (ETHER_HDR_ALIGNED_P(mtod(m, void *)) == 0) {
-		if ((m = m_copyup(m, sizeof(*eh),
-		(max_linkhdr + 3) & ~3)) == NULL)
+		if ((m = m_copyup(m, sizeof(*eh), 0)) == NULL)
 			goto dropped;
 	} else if (__predict_false(m->m_len < sizeof(*eh))) {
 		if ((m = m_pullup(m, sizeof(*eh))) == NULL)
 			goto dropped;
 	}
 
-#ifdef MBUFTRACE
-	m_claimm(m, >ec_rx_mowner);
-#endif
 	eh = mtod(m, struct ether_header *);
 	etype = ntohs(eh->ether_type);
 	ehlen = sizeof(*eh);

Index: src/sys/net/if_gre.c
diff -u src/sys/net/if_gre.c:1.178 src/sys/net/if_gre.c:1.179
--- src/sys/net/if_gre.c:1.178	Fri Feb 12 19:57:49 2021
+++ src/sys/net/if_gre.c	Sat Feb 13 13:00:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.c,v 1.178 2021/02/12 19:57:49 roy Exp $ */
+/*	$NetBSD: if_gre.c,v 1.179 2021/02/13 13:00:16 roy Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.178 2021/02/12 19:57:49 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.179 2021/02/13 13:00:16 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_atalk.h"
@@ -396,14 +396,9 @@ gre_receive(struct socket *so, void *arg
 		return;
 	}
 
-	/* If the GRE header is not aligned, slurp it up into a new
-	 * mbuf with space for link headers, in the event we forward
-	 * it.  Otherwise, if it is aligned, make sure the entire
-	 * base GRE header is in the first mbuf of the chain.
-	 */
+	/* Enforce alignment */
 	if (GRE_HDR_ALIGNED_P(mtod(m, void *)) == 0) {
-		if ((m = m_copyup(m, sizeof(struct gre_h),
-		(max_linkhdr + 3) & ~3)) == NULL) {
+		if ((m = m_copyup(m, sizeof(struct gre_h), 0)) == NULL) {
 			/* XXXJRT new stat, please */
 			GRE_DPRINTF(sc, "m_copyup failed\n");
 			sc->sc_pullup_ev.ev_count++;

Index: src/sys/netinet/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.299 src/sys/netinet/if_arp.c:1.300
--- src/sys/netinet/if_arp.c:1.299	Sat Feb 13 07:57:09 2021
+++ src/sys/netinet/if_arp.c	Sat Feb 13 13:00:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.c,v 1.299 2021/02/13 07:57:09 roy Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.300 2021/02/13 13:00:16 roy Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.299 2021/02/13 07:57:09 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.300 2021/02/13 13:00:16 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -700,14 +700,9 @@ arpintr(void)
 		MCLAIM(m, _mowner);
 		ARP_STATINC(ARP_STAT_RCVTOTAL);
 
-		/* If the ARP header is not aligned, slurp it up into a new
-		 * mbuf with space for link headers, in the event we forward
-		 * it.  Otherwise, if it is aligned, make sure the entire
-		 * base ARP header is in the first mbuf of the chain.
-		 */
+		/* Enforce alignment */
 		if (ARP_HDR_ALIGNED_P(mtod(m, void *)) == 0) {
-			if ((m = m_copyup(m, sizeof(*ar),
-			(max_linkhdr + 3) & ~3)) == NULL)
+			if ((m = m_copyup(m, sizeof(*ar), 0)) == NULL)
 goto badlen;
 		} else if (__predict_false(m->m_len < sizeof(*ar))) {
 			if ((m = m_pullup(m, sizeof(*ar))) == NULL)
@@ -732,9 +727,6 @@ arpintr(void)
 ARP_STATINC(ARP_STAT_RCVBADPROTO);
 goto free;
 			}
-
-			arplen = sizeof(struct arphdr) +
-			ar->ar_hln 

CVS commit: src/sys

2021-02-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Feb 13 07:57:09 UTC 2021

Modified Files:
src/sys/net: if_arp.h
src/sys/netinet: if_arp.c

Log Message:
if_arp: Ensure that arphdr is aligned


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/net/if_arp.h
cvs rdiff -u -r1.298 -r1.299 src/sys/netinet/if_arp.c

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

Modified files:

Index: src/sys/net/if_arp.h
diff -u src/sys/net/if_arp.h:1.37 src/sys/net/if_arp.h:1.38
--- src/sys/net/if_arp.h:1.37	Wed Feb  3 18:13:13 2021
+++ src/sys/net/if_arp.h	Sat Feb 13 07:57:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.h,v 1.37 2021/02/03 18:13:13 roy Exp $	*/
+/*	$NetBSD: if_arp.h,v 1.38 2021/02/13 07:57:09 roy Exp $	*/
 
 /*
  * Copyright (c) 1986, 1993
@@ -72,6 +72,11 @@ struct	arphdr {
 	uint8_t  ar_tpa[];	/* target protocol address */
 #endif
 };
+#ifdef __NO_STRICT_ALIGNMENT
+#define	ARP_HDR_ALIGNED_P(ah)	1
+#else
+#define	ARP_HDR_ALIGNED_P(ah)	vaddr_t) (ah)) & 3) == 0)
+#endif
 #ifdef __CTASSERT
 __CTASSERT(sizeof(struct arphdr) == 8);
 #endif

Index: src/sys/netinet/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.298 src/sys/netinet/if_arp.c:1.299
--- src/sys/netinet/if_arp.c:1.298	Tue Feb  2 10:48:33 2021
+++ src/sys/netinet/if_arp.c	Sat Feb 13 07:57:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.c,v 1.298 2021/02/02 10:48:33 yamt Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.299 2021/02/13 07:57:09 roy Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.298 2021/02/02 10:48:33 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.299 2021/02/13 07:57:09 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -700,9 +700,19 @@ arpintr(void)
 		MCLAIM(m, _mowner);
 		ARP_STATINC(ARP_STAT_RCVTOTAL);
 
-		arplen = sizeof(struct arphdr);
-		if (m->m_len < arplen && (m = m_pullup(m, arplen)) == NULL)
-			goto badlen;
+		/* If the ARP header is not aligned, slurp it up into a new
+		 * mbuf with space for link headers, in the event we forward
+		 * it.  Otherwise, if it is aligned, make sure the entire
+		 * base ARP header is in the first mbuf of the chain.
+		 */
+		if (ARP_HDR_ALIGNED_P(mtod(m, void *)) == 0) {
+			if ((m = m_copyup(m, sizeof(*ar),
+			(max_linkhdr + 3) & ~3)) == NULL)
+goto badlen;
+		} else if (__predict_false(m->m_len < sizeof(*ar))) {
+			if ((m = m_pullup(m, sizeof(*ar))) == NULL)
+goto badlen;
+		}
 		ar = mtod(m, struct arphdr *);
 
 		rcvif = m_get_rcvif(m, );



CVS commit: src/sys/net

2021-02-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Feb 13 07:28:05 UTC 2021

Modified Files:
src/sys/net: if_ether.h if_ethersubr.c

Log Message:
if_ether: Ensure that ether_header is aligned


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/net/if_ether.h
cvs rdiff -u -r1.289 -r1.290 src/sys/net/if_ethersubr.c

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

Modified files:

Index: src/sys/net/if_ether.h
diff -u src/sys/net/if_ether.h:1.84 src/sys/net/if_ether.h:1.85
--- src/sys/net/if_ether.h:1.84	Wed Feb  3 18:13:13 2021
+++ src/sys/net/if_ether.h	Sat Feb 13 07:28:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.84 2021/02/03 18:13:13 roy Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.85 2021/02/13 07:28:04 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -89,7 +89,11 @@ struct ether_header {
 	uint8_t  ether_shost[ETHER_ADDR_LEN];
 	uint16_t ether_type;
 };
-
+#ifdef __NO_STRICT_ALIGNMENT
+#define	ETHER_HDR_ALIGNED_P(eh)	1
+#else
+#define	ETHER_HDR_ALIGNED_P(eh)	vaddr_t) (eh)) & 3) == 0)
+#endif
 #ifdef __CTASSERT
 __CTASSERT(sizeof(struct ether_addr) == 6);
 __CTASSERT(sizeof(struct ether_header) == 14);

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.289 src/sys/net/if_ethersubr.c:1.290
--- src/sys/net/if_ethersubr.c:1.289	Sat Sep 26 18:38:09 2020
+++ src/sys/net/if_ethersubr.c	Sat Feb 13 07:28:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.289 2020/09/26 18:38:09 roy Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.290 2021/02/13 07:28:04 roy Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.289 2020/09/26 18:38:09 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.290 2021/02/13 07:28:04 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -648,9 +648,18 @@ ether_input(struct ifnet *ifp, struct mb
 
 	if ((ifp->if_flags & IFF_UP) == 0)
 		goto drop;
-	if (m->m_len < sizeof(*eh)) {
-		m = m_pullup(m, sizeof(*eh));
-		if (m == NULL)
+
+	/* If the Ethernet header is not aligned, slurp it up into a new
+	 * mbuf with space for link headers, in the event we forward
+	 * it.  Otherwise, if it is aligned, make sure the entire
+	 * base Ethernet header is in the first mbuf of the chain.
+	 */
+	if (ETHER_HDR_ALIGNED_P(mtod(m, void *)) == 0) {
+		if ((m = m_copyup(m, sizeof(*eh),
+		(max_linkhdr + 3) & ~3)) == NULL)
+			goto dropped;
+	} else if (__predict_false(m->m_len < sizeof(*eh))) {
+		if ((m = m_pullup(m, sizeof(*eh))) == NULL)
 			goto dropped;
 	}
 



CVS commit: src/sys/net

2021-02-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Feb 12 19:57:49 UTC 2021

Modified Files:
src/sys/net: if_gre.c if_gre.h

Log Message:
if_gre: Ensure that gre_h is aligned


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/net/if_gre.c
cvs rdiff -u -r1.47 -r1.48 src/sys/net/if_gre.h

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

Modified files:

Index: src/sys/net/if_gre.c
diff -u src/sys/net/if_gre.c:1.177 src/sys/net/if_gre.c:1.178
--- src/sys/net/if_gre.c:1.177	Wed Jan 29 04:18:34 2020
+++ src/sys/net/if_gre.c	Fri Feb 12 19:57:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.c,v 1.177 2020/01/29 04:18:34 thorpej Exp $ */
+/*	$NetBSD: if_gre.c,v 1.178 2021/02/12 19:57:49 roy Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.177 2020/01/29 04:18:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.178 2021/02/12 19:57:49 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_atalk.h"
@@ -395,10 +395,26 @@ gre_receive(struct socket *so, void *arg
 		sc->sc_error_ev.ev_count++;
 		return;
 	}
-	if (m->m_len < sizeof(*gh) && (m = m_pullup(m, sizeof(*gh))) == NULL) {
-		GRE_DPRINTF(sc, "m_pullup failed\n");
-		sc->sc_pullup_ev.ev_count++;
-		return;
+
+	/* If the GRE header is not aligned, slurp it up into a new
+	 * mbuf with space for link headers, in the event we forward
+	 * it.  Otherwise, if it is aligned, make sure the entire
+	 * base GRE header is in the first mbuf of the chain.
+	 */
+	if (GRE_HDR_ALIGNED_P(mtod(m, void *)) == 0) {
+		if ((m = m_copyup(m, sizeof(struct gre_h),
+		(max_linkhdr + 3) & ~3)) == NULL) {
+			/* XXXJRT new stat, please */
+			GRE_DPRINTF(sc, "m_copyup failed\n");
+			sc->sc_pullup_ev.ev_count++;
+			return;
+		}
+	} else if (__predict_false(m->m_len < sizeof(struct gre_h))) {
+		if ((m = m_pullup(m, sizeof(struct gre_h))) == NULL) {
+			GRE_DPRINTF(sc, "m_pullup failed\n");
+			sc->sc_pullup_ev.ev_count++;
+			return;
+		}
 	}
 	gh = mtod(m, const struct gre_h *);
 
@@ -940,7 +956,6 @@ gre_output(struct ifnet *ifp, struct mbu
 #endif
 
 	M_PREPEND(m, sizeof(*gh), M_DONTWAIT);
-
 	if (m == NULL) {
 		IF_DROP(>if_snd);
 		error = ENOBUFS;
@@ -948,6 +963,7 @@ gre_output(struct ifnet *ifp, struct mbu
 	}
 
 	gh = mtod(m, struct gre_h *);
+	KASSERT(GRE_HDR_ALIGNED_P(gh));
 	gh->flags = 0;
 	gh->ptype = etype;
 	/* XXX Need to handle IP ToS.  Look at how I handle IP TTL. */

Index: src/sys/net/if_gre.h
diff -u src/sys/net/if_gre.h:1.47 src/sys/net/if_gre.h:1.48
--- src/sys/net/if_gre.h:1.47	Wed Feb  3 18:13:13 2021
+++ src/sys/net/if_gre.h	Fri Feb 12 19:57:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.h,v 1.47 2021/02/03 18:13:13 roy Exp $ */
+/*	$NetBSD: if_gre.h,v 1.48 2021/02/12 19:57:49 roy Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -131,6 +131,11 @@ struct gre_h {
 Present if (rt_pres == 1)
  */
 };
+#ifdef __NO_STRICT_ALIGNMENT
+#define	GRE_HDR_ALIGNED_P(gh)	1
+#else
+#define	GRE_HDR_ALIGNED_P(gh)	vaddr_t) (gh)) & 3) == 0)
+#endif
 #ifdef __CTASSERT
 __CTASSERT(sizeof(struct gre_h) == 4);
 #endif



CVS commit: src/sys

2021-02-03 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 18:13:14 UTC 2021

Modified Files:
src/sys/net: if_arp.h if_ether.h if_gre.h if_llc.h
src/sys/netinet: igmp.h in.h ip.h ip6.h ip_carp.h ip_icmp.h ip_mroute.h
ip_var.h tcp.h tcp_debug.h udp.h

Log Message:
CTASSERT -> __CTASSERT to unbreak userland build.

While here move __packed in tcp_debug.h back to where it was and
note removal warrants more investigation.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/net/if_arp.h
cvs rdiff -u -r1.83 -r1.84 src/sys/net/if_ether.h
cvs rdiff -u -r1.46 -r1.47 src/sys/net/if_gre.h
cvs rdiff -u -r1.22 -r1.23 src/sys/net/if_llc.h
cvs rdiff -u -r1.14 -r1.15 src/sys/netinet/igmp.h
cvs rdiff -u -r1.113 -r1.114 src/sys/netinet/in.h
cvs rdiff -u -r1.37 -r1.38 src/sys/netinet/ip.h
cvs rdiff -u -r1.28 -r1.29 src/sys/netinet/ip6.h
cvs rdiff -u -r1.13 -r1.14 src/sys/netinet/ip_carp.h
cvs rdiff -u -r1.42 -r1.43 src/sys/netinet/ip_icmp.h
cvs rdiff -u -r1.34 -r1.35 src/sys/netinet/ip_mroute.h
cvs rdiff -u -r1.132 -r1.133 src/sys/netinet/ip_var.h
cvs rdiff -u -r1.36 -r1.37 src/sys/netinet/tcp.h
cvs rdiff -u -r1.20 -r1.21 src/sys/netinet/tcp_debug.h
cvs rdiff -u -r1.18 -r1.19 src/sys/netinet/udp.h

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

Modified files:

Index: src/sys/net/if_arp.h
diff -u src/sys/net/if_arp.h:1.36 src/sys/net/if_arp.h:1.37
--- src/sys/net/if_arp.h:1.36	Wed Feb  3 11:53:43 2021
+++ src/sys/net/if_arp.h	Wed Feb  3 18:13:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.h,v 1.36 2021/02/03 11:53:43 roy Exp $	*/
+/*	$NetBSD: if_arp.h,v 1.37 2021/02/03 18:13:13 roy Exp $	*/
 
 /*
  * Copyright (c) 1986, 1993
@@ -72,8 +72,8 @@ struct	arphdr {
 	uint8_t  ar_tpa[];	/* target protocol address */
 #endif
 };
-#ifdef CTASSERT
-CTASSERT(sizeof(struct arphdr) == 8);
+#ifdef __CTASSERT
+__CTASSERT(sizeof(struct arphdr) == 8);
 #endif
 
 static __inline uint8_t *

Index: src/sys/net/if_ether.h
diff -u src/sys/net/if_ether.h:1.83 src/sys/net/if_ether.h:1.84
--- src/sys/net/if_ether.h:1.83	Wed Feb  3 11:53:43 2021
+++ src/sys/net/if_ether.h	Wed Feb  3 18:13:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.83 2021/02/03 11:53:43 roy Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.84 2021/02/03 18:13:13 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -90,9 +90,9 @@ struct ether_header {
 	uint16_t ether_type;
 };
 
-#ifdef CTASSERT
-CTASSERT(sizeof(struct ether_addr) == 6);
-CTASSERT(sizeof(struct ether_header) == 14);
+#ifdef __CTASSERT
+__CTASSERT(sizeof(struct ether_addr) == 6);
+__CTASSERT(sizeof(struct ether_header) == 14);
 #endif
 
 #include 

Index: src/sys/net/if_gre.h
diff -u src/sys/net/if_gre.h:1.46 src/sys/net/if_gre.h:1.47
--- src/sys/net/if_gre.h:1.46	Wed Feb  3 11:53:43 2021
+++ src/sys/net/if_gre.h	Wed Feb  3 18:13:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.h,v 1.46 2021/02/03 11:53:43 roy Exp $ */
+/*	$NetBSD: if_gre.h,v 1.47 2021/02/03 18:13:13 roy Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -131,8 +131,8 @@ struct gre_h {
 Present if (rt_pres == 1)
  */
 };
-#ifdef CTASSERT
-CTASSERT(sizeof(struct gre_h) == 4);
+#ifdef __CTASSERT
+__CTASSERT(sizeof(struct gre_h) == 4);
 #endif
 
 #define GRE_CP		0x8000  /* Checksum Present */

Index: src/sys/net/if_llc.h
diff -u src/sys/net/if_llc.h:1.22 src/sys/net/if_llc.h:1.23
--- src/sys/net/if_llc.h:1.22	Wed Feb  3 12:11:34 2021
+++ src/sys/net/if_llc.h	Wed Feb  3 18:13:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_llc.h,v 1.22 2021/02/03 12:11:34 roy Exp $	*/
+/*	$NetBSD: if_llc.h,v 1.23 2021/02/03 18:13:13 roy Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -92,9 +92,9 @@ struct frmrinfo {
 	uint8_t frmr_cause;
 };
 
-#ifdef CTASSERT
-CTASSERT(sizeof(struct llc) == 8);
-CTASSERT(sizeof(struct frmrinfo) == 5);
+#ifdef __CTASSERT
+__CTASSERT(sizeof(struct llc) == 8);
+__CTASSERT(sizeof(struct frmrinfo) == 5);
 #endif
 
 #define	llc_control		llc_un.type_u.control

Index: src/sys/netinet/igmp.h
diff -u src/sys/netinet/igmp.h:1.14 src/sys/netinet/igmp.h:1.15
--- src/sys/netinet/igmp.h:1.14	Wed Feb  3 11:53:43 2021
+++ src/sys/netinet/igmp.h	Wed Feb  3 18:13:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: igmp.h,v 1.14 2021/02/03 11:53:43 roy Exp $	*/
+/*	$NetBSD: igmp.h,v 1.15 2021/02/03 18:13:13 roy Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -89,8 +89,8 @@ struct igmp {
 	uint16_t	igmp_cksum;	/* IP-style checksum   */
 	struct in_addr	igmp_group;	/* group address being reported*/
 };			/*  (zero for queries) */
-#ifdef CTASSERT
-CTASSERT(sizeof(struct igmp) == 8);
+#ifdef __CTASSERT
+__CTASSERT(sizeof(struct igmp) == 8);
 #endif
 
 #define	IGMP_MINLEN			8

Index: src/sys/netinet/in.h
diff -u src/sys/netinet/in.h:1.113 src/sys/netinet/in.h:1.114
--- src/sys/netinet/in.h:1.113	Wed Feb  3 11:53:43 2021
+++ src/sys/netinet/in.h	Wed Feb  3 18:13:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: in.h,v 1.113 

CVS commit: src/sys/netinet

2021-02-03 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 17:10:13 UTC 2021

Modified Files:
src/sys/netinet: if_ether.h

Log Message:
Guard CTASSERT


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/netinet/if_ether.h

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

Modified files:

Index: src/sys/netinet/if_ether.h
diff -u src/sys/netinet/if_ether.h:1.36 src/sys/netinet/if_ether.h:1.37
--- src/sys/netinet/if_ether.h:1.36	Wed Feb  3 11:53:43 2021
+++ src/sys/netinet/if_ether.h	Wed Feb  3 17:10:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.36 2021/02/03 11:53:43 roy Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.37 2021/02/03 17:10:13 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -76,7 +76,9 @@ struct	ether_arp {
 	u_int8_t arp_tha[ETHER_ADDR_LEN];	/* target hardware address */
 	u_int8_t arp_tpa[4];			/* target protocol address */
 };
+#ifdef CTASSERT
 CTASSERT(sizeof(struct ether_arp) == 28);
+#endif
 #define	arp_hrd	ea_hdr.ar_hrd
 #define	arp_pro	ea_hdr.ar_pro
 #define	arp_hln	ea_hdr.ar_hln



CVS commit: src/sys/net

2021-02-03 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 12:11:34 UTC 2021

Modified Files:
src/sys/net: if_llc.h

Log Message:
if_llc.h: Replace __packed with CTASSERT


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/net/if_llc.h

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

Modified files:

Index: src/sys/net/if_llc.h
diff -u src/sys/net/if_llc.h:1.21 src/sys/net/if_llc.h:1.22
--- src/sys/net/if_llc.h:1.21	Fri Sep  5 05:32:07 2014
+++ src/sys/net/if_llc.h	Wed Feb  3 12:11:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_llc.h,v 1.21 2014/09/05 05:32:07 matt Exp $	*/
+/*	$NetBSD: if_llc.h,v 1.22 2021/02/03 12:11:34 roy Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -82,7 +82,7 @@ struct llc {
 		uint8_t control_ext;
 	} type_raw /* XXX __packed ??? */;
 	} llc_un /* XXX __packed ??? */;
-} __packed;
+};
 
 struct frmrinfo {
 	uint8_t frmr_rej_pdu0;
@@ -90,7 +90,12 @@ struct frmrinfo {
 	uint8_t frmr_control;
 	uint8_t frmr_control_ext;
 	uint8_t frmr_cause;
-} __packed;
+};
+
+#ifdef CTASSERT
+CTASSERT(sizeof(struct llc) == 8);
+CTASSERT(sizeof(struct frmrinfo) == 5);
+#endif
 
 #define	llc_control		llc_un.type_u.control
 #define	llc_control_ext		llc_un.type_raw.control_ext



CVS commit: src/sys

2021-02-03 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 11:53:43 UTC 2021

Modified Files:
src/sys/net: if_arp.h if_ether.h if_gre.h
src/sys/netinet: if_ether.h igmp.h in.h ip.h ip6.h ip_icmp.h
ip_mroute.h ip_var.h tcp.h tcp_var.h udp.h udp_var.h

Log Message:
Sprinkle CTASSERT to enforce on-wire layout without __packed


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/net/if_arp.h
cvs rdiff -u -r1.82 -r1.83 src/sys/net/if_ether.h
cvs rdiff -u -r1.45 -r1.46 src/sys/net/if_gre.h
cvs rdiff -u -r1.35 -r1.36 src/sys/netinet/if_ether.h src/sys/netinet/tcp.h
cvs rdiff -u -r1.13 -r1.14 src/sys/netinet/igmp.h
cvs rdiff -u -r1.112 -r1.113 src/sys/netinet/in.h
cvs rdiff -u -r1.36 -r1.37 src/sys/netinet/ip.h
cvs rdiff -u -r1.27 -r1.28 src/sys/netinet/ip6.h
cvs rdiff -u -r1.41 -r1.42 src/sys/netinet/ip_icmp.h
cvs rdiff -u -r1.33 -r1.34 src/sys/netinet/ip_mroute.h
cvs rdiff -u -r1.131 -r1.132 src/sys/netinet/ip_var.h
cvs rdiff -u -r1.193 -r1.194 src/sys/netinet/tcp_var.h
cvs rdiff -u -r1.17 -r1.18 src/sys/netinet/udp.h
cvs rdiff -u -r1.47 -r1.48 src/sys/netinet/udp_var.h

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

Modified files:

Index: src/sys/net/if_arp.h
diff -u src/sys/net/if_arp.h:1.35 src/sys/net/if_arp.h:1.36
--- src/sys/net/if_arp.h:1.35	Wed Feb  3 10:31:10 2021
+++ src/sys/net/if_arp.h	Wed Feb  3 11:53:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.h,v 1.35 2021/02/03 10:31:10 roy Exp $	*/
+/*	$NetBSD: if_arp.h,v 1.36 2021/02/03 11:53:43 roy Exp $	*/
 
 /*
  * Copyright (c) 1986, 1993
@@ -72,6 +72,9 @@ struct	arphdr {
 	uint8_t  ar_tpa[];	/* target protocol address */
 #endif
 };
+#ifdef CTASSERT
+CTASSERT(sizeof(struct arphdr) == 8);
+#endif
 
 static __inline uint8_t *
 ar_data(struct arphdr *ap)

Index: src/sys/net/if_ether.h
diff -u src/sys/net/if_ether.h:1.82 src/sys/net/if_ether.h:1.83
--- src/sys/net/if_ether.h:1.82	Wed Feb  3 05:51:40 2021
+++ src/sys/net/if_ether.h	Wed Feb  3 11:53:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.82 2021/02/03 05:51:40 roy Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.83 2021/02/03 11:53:43 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -90,6 +90,11 @@ struct ether_header {
 	uint16_t ether_type;
 };
 
+#ifdef CTASSERT
+CTASSERT(sizeof(struct ether_addr) == 6);
+CTASSERT(sizeof(struct ether_header) == 14);
+#endif
+
 #include 
 
 #define	ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */

Index: src/sys/net/if_gre.h
diff -u src/sys/net/if_gre.h:1.45 src/sys/net/if_gre.h:1.46
--- src/sys/net/if_gre.h:1.45	Wed Feb  3 05:51:40 2021
+++ src/sys/net/if_gre.h	Wed Feb  3 11:53:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.h,v 1.45 2021/02/03 05:51:40 roy Exp $ */
+/*	$NetBSD: if_gre.h,v 1.46 2021/02/03 11:53:43 roy Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -131,6 +131,9 @@ struct gre_h {
 Present if (rt_pres == 1)
  */
 };
+#ifdef CTASSERT
+CTASSERT(sizeof(struct gre_h) == 4);
+#endif
 
 #define GRE_CP		0x8000  /* Checksum Present */
 #define GRE_RP		0x4000  /* Routing Present */

Index: src/sys/netinet/if_ether.h
diff -u src/sys/netinet/if_ether.h:1.35 src/sys/netinet/if_ether.h:1.36
--- src/sys/netinet/if_ether.h:1.35	Wed Feb  3 05:51:40 2021
+++ src/sys/netinet/if_ether.h	Wed Feb  3 11:53:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.35 2021/02/03 05:51:40 roy Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.36 2021/02/03 11:53:43 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -76,6 +76,7 @@ struct	ether_arp {
 	u_int8_t arp_tha[ETHER_ADDR_LEN];	/* target hardware address */
 	u_int8_t arp_tpa[4];			/* target protocol address */
 };
+CTASSERT(sizeof(struct ether_arp) == 28);
 #define	arp_hrd	ea_hdr.ar_hrd
 #define	arp_pro	ea_hdr.ar_pro
 #define	arp_hln	ea_hdr.ar_hln
Index: src/sys/netinet/tcp.h
diff -u src/sys/netinet/tcp.h:1.35 src/sys/netinet/tcp.h:1.36
--- src/sys/netinet/tcp.h:1.35	Wed Feb  3 05:51:40 2021
+++ src/sys/netinet/tcp.h	Wed Feb  3 11:53:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp.h,v 1.35 2021/02/03 05:51:40 roy Exp $	*/
+/*	$NetBSD: tcp.h,v 1.36 2021/02/03 11:53:43 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -73,6 +73,9 @@ struct tcphdr {
 	uint16_t th_sum;			/* checksum */
 	uint16_t th_urp;			/* urgent pointer */
 };
+#ifdef CTASSERT
+CTASSERT(sizeof(struct tcphdr) == 20);
+#endif
 
 #define	TCPOPT_EOL		0
 #define	   TCPOLEN_EOL			1

Index: src/sys/netinet/igmp.h
diff -u src/sys/netinet/igmp.h:1.13 src/sys/netinet/igmp.h:1.14
--- src/sys/netinet/igmp.h:1.13	Wed Feb  3 05:51:40 2021
+++ src/sys/netinet/igmp.h	Wed Feb  3 11:53:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: igmp.h,v 1.13 2021/02/03 05:51:40 roy Exp $	*/
+/*	$NetBSD: igmp.h,v 1.14 2021/02/03 11:53:43 roy Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -89,6 +89,9 @@ struct igmp {
 	uint16_t	igmp_cksum;	/* IP-style checksum   */
 	struct in_addr	igmp_group;	/* group address being reported

CVS commit: src/sys/netinet

2021-02-03 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 11:52:23 UTC 2021

Modified Files:
src/sys/netinet: tcp_debug.h

Log Message:
tcp_debug: restore __packed


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/netinet/tcp_debug.h

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

Modified files:

Index: src/sys/netinet/tcp_debug.h
diff -u src/sys/netinet/tcp_debug.h:1.19 src/sys/netinet/tcp_debug.h:1.20
--- src/sys/netinet/tcp_debug.h:1.19	Wed Feb  3 05:51:40 2021
+++ src/sys/netinet/tcp_debug.h	Wed Feb  3 11:52:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_debug.h,v 1.19 2021/02/03 05:51:40 roy Exp $	*/
+/*	$NetBSD: tcp_debug.h,v 1.20 2021/02/03 11:52:23 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -58,7 +58,7 @@ struct	tcp_debug {
 	} td_ti6;
 	short	td_req;
 	struct	tcpcb td_cb;
-};
+} __packed;
 
 #define	TA_INPUT	0
 #define	TA_OUTPUT	1



CVS commit: src/sys/net

2021-02-03 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 10:31:10 UTC 2021

Modified Files:
src/sys/net: if_arp.h

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/net/if_arp.h

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

Modified files:

Index: src/sys/net/if_arp.h
diff -u src/sys/net/if_arp.h:1.34 src/sys/net/if_arp.h:1.35
--- src/sys/net/if_arp.h:1.34	Wed Feb  3 05:51:40 2021
+++ src/sys/net/if_arp.h	Wed Feb  3 10:31:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.h,v 1.34 2021/02/03 05:51:40 roy Exp $	*/
+/*	$NetBSD: if_arp.h,v 1.35 2021/02/03 10:31:10 roy Exp $	*/
 
 /*
  * Copyright (c) 1986, 1993
@@ -45,22 +45,22 @@
  */
 struct	arphdr {
 	uint16_t ar_hrd;	/* format of hardware address */
-#define ARPHRD_ETHER 	1	/* ethernet hardware format */
-#define ARPHRD_IEEE802 	6	/* IEEE 802 hardware format */
-#define ARPHRD_ARCNET 	7	/* ethernet hardware format */
-#define ARPHRD_FRELAY 	15	/* frame relay hardware format */
-#define ARPHRD_STRIP 	23	/* Ricochet Starmode Radio hardware format */
-#define	ARPHRD_IEEE1394	24	/* IEEE 1394 (FireWire) hardware format */
-	uint16_t ar_pro;	/* format of protocol address */
-	uint8_t  ar_hln;	/* length of hardware address */
-	uint8_t  ar_pln;	/* length of protocol address */
-	uint16_t ar_op;		/* one of: */
-#define	ARPOP_REQUEST	1	/* request to resolve address */
-#define	ARPOP_REPLY	2	/* response to previous request */
-#define	ARPOP_REVREQUEST 3	/* request protocol address given hardware */
-#define	ARPOP_REVREPLY	4	/* response giving protocol address */
-#define	ARPOP_INVREQUEST 8 	/* request to identify peer */
-#define	ARPOP_INVREPLY	9	/* response identifying peer */
+#define ARPHRD_ETHER		1  /* ethernet hardware format */
+#define ARPHRD_IEEE802		6  /* IEEE 802 hardware format */
+#define ARPHRD_ARCNET		7  /* ethernet hardware format */
+#define ARPHRD_FRELAY		15 /* frame relay hardware format */
+#define ARPHRD_STRIP		23 /* Ricochet Starmode Radio hardware format */
+#define	ARPHRD_IEEE1394		24 /* IEEE 1394 (FireWire) hardware format */
+	uint16_t ar_pro;	   /* format of protocol address */
+	uint8_t  ar_hln;	   /* length of hardware address */
+	uint8_t  ar_pln;	   /* length of protocol address */
+	uint16_t ar_op;		   /* one of: */
+#define	ARPOP_REQUEST		1  /* request to resolve address */
+#define	ARPOP_REPLY		2  /* response to previous request */
+#define	ARPOP_REVREQUEST	3  /* request protocol address given hardware */
+#define	ARPOP_REVREPLY		4  /* response giving protocol address */
+#define	ARPOP_INVREQUEST	8  /* request to identify peer */
+#define	ARPOP_INVREPLY		9  /* response identifying peer */
 /*
  * The remaining fields are variable in size,
  * according to the sizes above.



CVS commit: src/usr.bin/tftp

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 06:51:26 UTC 2021

Modified Files:
src/usr.bin/tftp: Makefile

Log Message:
tftp: no longer need packed member warning


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/tftp/Makefile

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

Modified files:

Index: src/usr.bin/tftp/Makefile
diff -u src/usr.bin/tftp/Makefile:1.14 src/usr.bin/tftp/Makefile:1.15
--- src/usr.bin/tftp/Makefile:1.14	Mon Sep  7 00:26:24 2020
+++ src/usr.bin/tftp/Makefile	Wed Feb  3 06:51:26 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.14 2020/09/07 00:26:24 mrg Exp $
+#	$NetBSD: Makefile,v 1.15 2021/02/03 06:51:26 roy Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 WARNS?=2
@@ -8,8 +8,7 @@ USE_FORT?= yes	# network client
 PROG=	tftp
 SRCS=	main.c tftp.c tftpsubs.c
 
-CWARNFLAGS.gcc+=	${GCC_NO_ADDR_OF_PACKED_MEMBER} \
-			${GCC_NO_STRINGOP_OVERFLOW} \
+CWARNFLAGS.gcc+=	${GCC_NO_STRINGOP_OVERFLOW} \
 			${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8:? -Wno-array-bounds :}
 
 .include 



CVS commit: src/usr.sbin/rtadvd

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 06:50:08 UTC 2021

Modified Files:
src/usr.sbin/rtadvd: Makefile

Log Message:
rtadvd: no longer need packed member warning


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/rtadvd/Makefile

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

Modified files:

Index: src/usr.sbin/rtadvd/Makefile
diff -u src/usr.sbin/rtadvd/Makefile:1.25 src/usr.sbin/rtadvd/Makefile:1.26
--- src/usr.sbin/rtadvd/Makefile:1.25	Sun Sep  6 07:20:32 2020
+++ src/usr.sbin/rtadvd/Makefile	Wed Feb  3 06:50:07 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.25 2020/09/06 07:20:32 mrg Exp $
+# $NetBSD: Makefile,v 1.26 2021/02/03 06:50:07 roy Exp $
 
 WARNS?=	4
 
@@ -31,9 +31,6 @@ LDADD.rump+=	-lrumpres
 DPADD.rump+=	${LIBRUMPRES}
 .endif
 
-CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member
-CWARNFLAGS.gcc+=	${GCC_NO_ADDR_OF_PACKED_MEMBER}
-
 COPTS.if.c+=		${GCC_NO_STRINGOP_TRUNCATION}
 COPTS.config.c+=	${GCC_NO_STRINGOP_TRUNCATION}
 



CVS commit: src/usr.sbin/traceroute

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 06:49:18 UTC 2021

Modified Files:
src/usr.sbin/traceroute: Makefile

Log Message:
traceroute: no longer need gcc packed member warning


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/traceroute/Makefile

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

Modified files:

Index: src/usr.sbin/traceroute/Makefile
diff -u src/usr.sbin/traceroute/Makefile:1.21 src/usr.sbin/traceroute/Makefile:1.22
--- src/usr.sbin/traceroute/Makefile:1.21	Sun Sep  6 07:20:33 2020
+++ src/usr.sbin/traceroute/Makefile	Wed Feb  3 06:49:18 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.21 2020/09/06 07:20:33 mrg Exp $	
+#	$NetBSD: Makefile,v 1.22 2021/02/03 06:49:18 roy Exp $	
 
 USE_FORT?= yes	# network client
 
@@ -30,6 +30,4 @@ SANITIZER_RENAME_SYMBOL.rump+=	getifaddr
 
 AWKS=	median.awk mean.awk 
 
-CWARNFLAGS.gcc+=${GCC_NO_ADDR_OF_PACKED_MEMBER}
-
 .include 



CVS commit: src/usr.sbin/ldpd

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 06:46:27 UTC 2021

Modified Files:
src/usr.sbin/ldpd: Makefile

Log Message:
ldpd: Discard warning about accessing packed member

I don't see a good way of fixing this right now.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/ldpd/Makefile

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

Modified files:

Index: src/usr.sbin/ldpd/Makefile
diff -u src/usr.sbin/ldpd/Makefile:1.5 src/usr.sbin/ldpd/Makefile:1.6
--- src/usr.sbin/ldpd/Makefile:1.5	Fri Oct 18 10:49:19 2013
+++ src/usr.sbin/ldpd/Makefile	Wed Feb  3 06:46:27 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2013/10/18 10:49:19 kefren Exp $
+# $NetBSD: Makefile,v 1.6 2021/02/03 06:46:27 roy Exp $
 
 .include 
 
@@ -26,4 +26,6 @@ LDADD+=	-lcrypt
 CPPFLAGS+=-DINET6
 .endif
 
+CWARNFLAGS.gcc+=${GCC_NO_ADDR_OF_PACKED_MEMBER}
+
 .include 



CVS commit: src/usr.sbin/traceroute6

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 06:42:50 UTC 2021

Modified Files:
src/usr.sbin/traceroute6: Makefile traceroute6.c

Log Message:
traceroute6: Remove __packed


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/traceroute6/Makefile
cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/traceroute6/traceroute6.c

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

Modified files:

Index: src/usr.sbin/traceroute6/Makefile
diff -u src/usr.sbin/traceroute6/Makefile:1.11 src/usr.sbin/traceroute6/Makefile:1.12
--- src/usr.sbin/traceroute6/Makefile:1.11	Sun Sep  6 07:20:33 2020
+++ src/usr.sbin/traceroute6/Makefile	Wed Feb  3 06:42:50 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.11 2020/09/06 07:20:33 mrg Exp $
+# $NetBSD: Makefile,v 1.12 2021/02/03 06:42:50 roy Exp $
 
 USE_FORT?= yes	# network client
 
@@ -20,6 +20,4 @@ CPPFLAGS+=-I${TRACEROUTE}
 
 .PATH: ${TRACEROUTE}
 
-CWARNFLAGS.gcc+=${GCC_NO_ADDR_OF_PACKED_MEMBER}
-
 .include 

Index: src/usr.sbin/traceroute6/traceroute6.c
diff -u src/usr.sbin/traceroute6/traceroute6.c:1.51 src/usr.sbin/traceroute6/traceroute6.c:1.52
--- src/usr.sbin/traceroute6/traceroute6.c:1.51	Mon Apr 23 18:59:03 2018
+++ src/usr.sbin/traceroute6/traceroute6.c	Wed Feb  3 06:42:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: traceroute6.c,v 1.51 2018/04/23 18:59:03 maxv Exp $	*/
+/*	$NetBSD: traceroute6.c,v 1.52 2021/02/03 06:42:50 roy Exp $	*/
 /*	$KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $	*/
 
 /*
@@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: traceroute6.c,v 1.51 2018/04/23 18:59:03 maxv Exp $");
+__RCSID("$NetBSD: traceroute6.c,v 1.52 2021/02/03 06:42:50 roy Exp $");
 #endif
 #endif
 
@@ -306,7 +306,7 @@ struct opacket {
 	u_char hops;		/* hop limit of the packet */
 	u_char pad[2];
 	struct tv32 tv;		/* time packet left */
-} __packed;
+};
 
 static u_char	packet[512];		/* last inbound (icmp) packet */
 static struct opacket	*outpacket;	/* last output (udp) packet */



CVS commit: src/sys

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 05:51:40 UTC 2021

Modified Files:
src/sys/net: if_arp.h if_ether.h if_gre.h
src/sys/netinet: if_ether.h igmp.h in.h ip.h ip6.h ip_carp.h ip_icmp.h
ip_mroute.h ip_var.h tcp.h tcp_debug.h tcp_var.h udp.h udp_var.h

Log Message:
Remove __packed from various network structures

They are already network aligned and adding the __packed attribute
just causes needless compiler warnings about accssing members of packed
objects.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/net/if_arp.h
cvs rdiff -u -r1.81 -r1.82 src/sys/net/if_ether.h
cvs rdiff -u -r1.44 -r1.45 src/sys/net/if_gre.h
cvs rdiff -u -r1.34 -r1.35 src/sys/netinet/if_ether.h src/sys/netinet/tcp.h
cvs rdiff -u -r1.12 -r1.13 src/sys/netinet/igmp.h src/sys/netinet/ip_carp.h
cvs rdiff -u -r1.111 -r1.112 src/sys/netinet/in.h
cvs rdiff -u -r1.35 -r1.36 src/sys/netinet/ip.h
cvs rdiff -u -r1.26 -r1.27 src/sys/netinet/ip6.h
cvs rdiff -u -r1.40 -r1.41 src/sys/netinet/ip_icmp.h
cvs rdiff -u -r1.32 -r1.33 src/sys/netinet/ip_mroute.h
cvs rdiff -u -r1.130 -r1.131 src/sys/netinet/ip_var.h
cvs rdiff -u -r1.18 -r1.19 src/sys/netinet/tcp_debug.h
cvs rdiff -u -r1.192 -r1.193 src/sys/netinet/tcp_var.h
cvs rdiff -u -r1.16 -r1.17 src/sys/netinet/udp.h
cvs rdiff -u -r1.46 -r1.47 src/sys/netinet/udp_var.h

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

Modified files:

Index: src/sys/net/if_arp.h
diff -u src/sys/net/if_arp.h:1.33 src/sys/net/if_arp.h:1.34
--- src/sys/net/if_arp.h:1.33	Sat Jun 30 15:08:04 2018
+++ src/sys/net/if_arp.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.h,v 1.33 2018/06/30 15:08:04 christos Exp $	*/
+/*	$NetBSD: if_arp.h,v 1.34 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1986, 1993
@@ -71,7 +71,7 @@ struct	arphdr {
 	uint8_t  ar_tha[];	/* target hardware address (!IEEE1394) */
 	uint8_t  ar_tpa[];	/* target protocol address */
 #endif
-} __packed;
+};
 
 static __inline uint8_t *
 ar_data(struct arphdr *ap)

Index: src/sys/net/if_ether.h
diff -u src/sys/net/if_ether.h:1.81 src/sys/net/if_ether.h:1.82
--- src/sys/net/if_ether.h:1.81	Wed Jul 17 03:26:24 2019
+++ src/sys/net/if_ether.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.81 2019/07/17 03:26:24 msaitoh Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.82 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -79,7 +79,7 @@
  */
 struct ether_addr {
 	uint8_t ether_addr_octet[ETHER_ADDR_LEN];
-} __packed;
+};
 
 /*
  * Structure of a 10Mb/s Ethernet header.
@@ -88,7 +88,7 @@ struct ether_header {
 	uint8_t  ether_dhost[ETHER_ADDR_LEN];
 	uint8_t  ether_shost[ETHER_ADDR_LEN];
 	uint16_t ether_type;
-} __packed;
+};
 
 #include 
 

Index: src/sys/net/if_gre.h
diff -u src/sys/net/if_gre.h:1.44 src/sys/net/if_gre.h:1.45
--- src/sys/net/if_gre.h:1.44	Tue Feb 26 09:43:37 2019
+++ src/sys/net/if_gre.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.h,v 1.44 2019/02/26 09:43:37 msaitoh Exp $ */
+/*	$NetBSD: if_gre.h,v 1.45 2021/02/03 05:51:40 roy Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@ struct gre_h {
 	struct gre_sre[] routing Routing fileds (see below)
 Present if (rt_pres == 1)
  */
-} __packed;
+};
 
 #define GRE_CP		0x8000  /* Checksum Present */
 #define GRE_RP		0x4000  /* Routing Present */

Index: src/sys/netinet/if_ether.h
diff -u src/sys/netinet/if_ether.h:1.34 src/sys/netinet/if_ether.h:1.35
--- src/sys/netinet/if_ether.h:1.34	Tue Dec 25 18:33:46 2007
+++ src/sys/netinet/if_ether.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.34 2007/12/25 18:33:46 perry Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.35 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -75,7 +75,7 @@ struct	ether_arp {
 	u_int8_t arp_spa[4];			/* sender protocol address */
 	u_int8_t arp_tha[ETHER_ADDR_LEN];	/* target hardware address */
 	u_int8_t arp_tpa[4];			/* target protocol address */
-} __packed;
+};
 #define	arp_hrd	ea_hdr.ar_hrd
 #define	arp_pro	ea_hdr.ar_pro
 #define	arp_hln	ea_hdr.ar_hln
Index: src/sys/netinet/tcp.h
diff -u src/sys/netinet/tcp.h:1.34 src/sys/netinet/tcp.h:1.35
--- src/sys/netinet/tcp.h:1.34	Fri Nov  1 13:54:59 2019
+++ src/sys/netinet/tcp.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp.h,v 1.34 2019/11/01 13:54:59 christos Exp $	*/
+/*	$NetBSD: tcp.h,v 1.35 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -72,7 +72,7 @@ struct tcphdr {
 	uint16_t th_win;			/* window */
 	uint16_t th_sum;			/* checksum */
 	uint16_t th_urp;			/* urgent pointer */
-} __packed;
+};
 
 #define	TCPOPT_EOL		0
 #define	   TCPOLEN_EOL			1

Index: src/sys/netinet/igmp.h
diff -u src/sys/netinet/igmp.h:1.12 src/sys/netinet/igmp.h:1.13
--- src/sys/netinet/igmp.h:1.12	Thu May 29 23:02:48 2014
+++ src/sys/netinet/igmp.h	Wed Feb  3 05:51:40 

CVS commit: src/external/bsd/ntp/dist/ntpd

2021-01-31 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Jan 31 08:27:49 UTC 2021

Modified Files:
src/external/bsd/ntp/dist/ntpd: ntp_io.c

Log Message:
ntpd: ignore errno EINTR on reads from the routing socket


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/external/bsd/ntp/dist/ntpd/ntp_io.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/ntp/dist/ntpd/ntp_io.c
diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.30 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.31
--- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.30	Sun Jan 31 08:26:47 2021
+++ src/external/bsd/ntp/dist/ntpd/ntp_io.c	Sun Jan 31 08:27:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntp_io.c,v 1.30 2021/01/31 08:26:47 roy Exp $	*/
+/*	$NetBSD: ntp_io.c,v 1.31 2021/01/31 08:27:49 roy Exp $	*/
 
 /*
  * ntp_io.c - input/output routines for ntpd.	The socket-opening code
@@ -4741,7 +4741,7 @@ process_routing_msgs(struct asyncio_read
 cnt = read(reader->fd, buffer, sizeof(buffer));
 			} while (cnt != -1 || errno == ENOBUFS);
 			timer_interfacetimeout(current_time + UPDATE_GRACE);
-		} else {
+		} else if (errno != EINTR) {
 			msyslog(LOG_ERR,
 "routing socket reports: %m - disabling");
 			remove_asyncio_reader(reader);



CVS commit: src/external/bsd/ntp/dist/ntpd

2021-01-31 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Jan 31 08:26:47 UTC 2021

Modified Files:
src/external/bsd/ntp/dist/ntpd: ntp_io.c

Log Message:
ntpd: move route socket overflow message from LOG_ERR to LOG_DEBUG

While here stop caring about RTM_LOSING as that's purely informational.
If routing does change then we get RTM_ADD/DEL/CHANGE.
Also stop caring about RTM_IFANNOUNCE as we really only want addresses
and interface flag updates which we get by RTM_NEWADDR/DELADDR/CHGADDR and
RTM_IFINFO.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/external/bsd/ntp/dist/ntpd/ntp_io.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/ntp/dist/ntpd/ntp_io.c
diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.29 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.30
--- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.29	Sun Jan  3 15:33:05 2021
+++ src/external/bsd/ntp/dist/ntpd/ntp_io.c	Sun Jan 31 08:26:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntp_io.c,v 1.29 2021/01/03 15:33:05 roy Exp $	*/
+/*	$NetBSD: ntp_io.c,v 1.30 2021/01/31 08:26:47 roy Exp $	*/
 
 /*
  * ntp_io.c - input/output routines for ntpd.	The socket-opening code
@@ -4730,8 +4730,9 @@ process_routing_msgs(struct asyncio_read
 
 	if (cnt < 0) {
 		if (errno == ENOBUFS) {
-			msyslog(LOG_ERR,
-"routing socket reports: %m");
+			msyslog(LOG_DEBUG,
+"routing socket overflowed"
+" - will update interfaces");
 			/*
 			 * drain the routing socket as we need to update
 			 * the interfaces anyway
@@ -4792,15 +4793,9 @@ process_routing_msgs(struct asyncio_read
 #ifdef RTM_CHANGE
 		case RTM_CHANGE:
 #endif
-#ifdef RTM_LOSING
-		case RTM_LOSING:
-#endif
 #ifdef RTM_IFINFO
 		case RTM_IFINFO:
 #endif
-#ifdef RTM_IFANNOUNCE
-		case RTM_IFANNOUNCE:
-#endif
 #ifdef RTM_NEWLINK
 		case RTM_NEWLINK:
 #endif
@@ -4874,15 +4869,9 @@ init_async_notifications()
 #ifdef RTM_CHANGE
 		RTM_CHANGE,
 #endif
-#ifdef RTM_LOSING
-		RTM_LOSING,
-#endif
 #ifdef RTM_IFINFO
 		RTM_IFINFO,
 #endif
-#ifdef RTM_IFANNOUNCE
-		RTM_IFANNOUNCE,
-#endif
 #ifdef RTM_NEWLINK
 		RTM_NEWLINK,
 #endif



CVS commit: src/external/bsd/ntp/dist/ntpd

2021-01-03 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Jan  3 15:33:05 UTC 2021

Modified Files:
src/external/bsd/ntp/dist/ntpd: cmd_args.c ntp_io.c ntp_timer.c

Log Message:
ntp: respect user's wishes to disable interface scanning

While here, disable periodic scanning by default on NetBSD as it's
no longer needed.
The user can still enable it though with a positive number to the -U
option.

kardel@ So far I see no other issues from the pitfalls I know of


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/ntp/dist/ntpd/cmd_args.c
cvs rdiff -u -r1.28 -r1.29 src/external/bsd/ntp/dist/ntpd/ntp_io.c
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/ntp/dist/ntpd/ntp_timer.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/ntp/dist/ntpd/cmd_args.c
diff -u src/external/bsd/ntp/dist/ntpd/cmd_args.c:1.6 src/external/bsd/ntp/dist/ntpd/cmd_args.c:1.7
--- src/external/bsd/ntp/dist/ntpd/cmd_args.c:1.6	Mon May 25 20:47:25 2020
+++ src/external/bsd/ntp/dist/ntpd/cmd_args.c	Sun Jan  3 15:33:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cmd_args.c,v 1.6 2020/05/25 20:47:25 christos Exp $	*/
+/*	$NetBSD: cmd_args.c,v 1.7 2021/01/03 15:33:05 roy Exp $	*/
 
 /*
  * cmd_args.c = command-line argument processing
@@ -181,9 +181,11 @@ getCmdOpts(
 	if (HAVE_OPT( UPDATEINTERVAL )) {
 		long val = OPT_VALUE_UPDATEINTERVAL;
 
-		if (val >= 0)
+		if (val >= 0) {
 			interface_interval = val;
-		else {
+			if (interface_interval == 0)
+disable_dynamic_updates = 1;
+		} else {
 			fprintf(stderr,
 "command line interface update interval %ld must not be negative\n",
 val);

Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c
diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.28 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.29
--- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.28	Fri Jan  1 17:21:47 2021
+++ src/external/bsd/ntp/dist/ntpd/ntp_io.c	Sun Jan  3 15:33:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntp_io.c,v 1.28 2021/01/01 17:21:47 roy Exp $	*/
+/*	$NetBSD: ntp_io.c,v 1.29 2021/01/03 15:33:05 roy Exp $	*/
 
 /*
  * ntp_io.c - input/output routines for ntpd.	The socket-opening code
@@ -455,8 +455,13 @@ init_io(void)
 {
 	/* Init buffer free list and stat counters */
 	init_recvbuff(RECV_INIT);
+#ifdef SO_RERROR
+	/* route(4) overflow can be observed */
+	interface_interval = 0;
+#else
 	/* update interface every 5 minutes as default */
 	interface_interval = 300;
+#endif
 
 #ifdef WORK_PIPE
 	addremove_io_fd = _addremove_io_fd;

Index: src/external/bsd/ntp/dist/ntpd/ntp_timer.c
diff -u src/external/bsd/ntp/dist/ntpd/ntp_timer.c:1.8 src/external/bsd/ntp/dist/ntpd/ntp_timer.c:1.9
--- src/external/bsd/ntp/dist/ntpd/ntp_timer.c:1.8	Mon May 25 20:47:25 2020
+++ src/external/bsd/ntp/dist/ntpd/ntp_timer.c	Sun Jan  3 15:33:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntp_timer.c,v 1.8 2020/05/25 20:47:25 christos Exp $	*/
+/*	$NetBSD: ntp_timer.c,v 1.9 2021/01/03 15:33:05 roy Exp $	*/
 
 /*
  * ntp_timer.c - event timer support routines
@@ -423,9 +423,11 @@ timer(void)
 	/*
 	 * Interface update timer
 	 */
-	if (interface_interval && interface_timer <= current_time) {
-		timer_interfacetimeout(current_time +
-		interface_interval);
+	if (!disable_dynamic_updates &&
+	interface_timer && interface_timer <= current_time) {
+		if (interface_interval)
+			timer_interfacetimeout(current_time +
+			interface_interval);
 		DPRINTF(2, ("timer: interface update\n"));
 		interface_update(NULL, NULL);
 	}



CVS commit: src/external/bsd/unbound/dist/util

2021-01-01 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jan  1 23:24:31 UTC 2021

Modified Files:
src/external/bsd/unbound/dist/util: mini_event.c

Log Message:
libunbound: Enforce that mini_event isn't used by include/config.h

As I tire of fixing it to use libevent.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/unbound/dist/util/mini_event.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/unbound/dist/util/mini_event.c
diff -u src/external/bsd/unbound/dist/util/mini_event.c:1.3 src/external/bsd/unbound/dist/util/mini_event.c:1.4
--- src/external/bsd/unbound/dist/util/mini_event.c:1.3	Sun Dec 15 16:16:34 2019
+++ src/external/bsd/unbound/dist/util/mini_event.c	Fri Jan  1 23:24:31 2021
@@ -51,6 +51,9 @@
 #include 
 #include "util/fptr_wlist.h"
 
+/* Enforce a correct include/config.h as I tire of fixin it. */
+#error This code should not be active on NetBSD, please use libevent.
+
 /** compare events in tree, based on timevalue, ptr for uniqueness */
 int mini_ev_cmp(const void* a, const void* b)
 {



CVS commit: src/external/bsd/unbound/lib/libunbound

2021-01-01 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jan  1 23:17:15 UTC 2021

Modified Files:
src/external/bsd/unbound/lib/libunbound: Makefile

Log Message:
Revert prior

With the correct #defines mini_event.c and winsock_event.c are
compiled but practically unused.

What is exposed is not part of the public API, but appease the
peanut gallery.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/unbound/lib/libunbound/Makefile

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/unbound/lib/libunbound/Makefile
diff -u src/external/bsd/unbound/lib/libunbound/Makefile:1.5 src/external/bsd/unbound/lib/libunbound/Makefile:1.6
--- src/external/bsd/unbound/lib/libunbound/Makefile:1.5	Fri Jan  1 20:38:36 2021
+++ src/external/bsd/unbound/lib/libunbound/Makefile	Fri Jan  1 23:17:15 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2021/01/01 20:38:36 roy Exp $
+# $NetBSD: Makefile,v 1.6 2021/01/01 23:17:15 roy Exp $
 
 .include 
 
@@ -55,6 +55,7 @@ log.c \
 lookup3.c \
 lruhash.c \
 mesh.c \
+mini_event.c \
 modstack.c \
 module.c \
 msgencode.c \
@@ -92,6 +93,7 @@ val_sigcrypt.c \
 val_utils.c \
 validator.c \
 view.c \
+winsock_event.c \
 wire2str.c
 
 LIBDPLIBS+= ${DPLIBS}



CVS commit: src/external/bsd/unbound/lib/libunbound

2021-01-01 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jan  1 20:38:36 UTC 2021

Modified Files:
src/external/bsd/unbound/lib/libunbound: Makefile

Log Message:
libunbound: Now we use libevent, don't build mini_event or winsock_event.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/unbound/lib/libunbound/Makefile

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/unbound/lib/libunbound/Makefile
diff -u src/external/bsd/unbound/lib/libunbound/Makefile:1.4 src/external/bsd/unbound/lib/libunbound/Makefile:1.5
--- src/external/bsd/unbound/lib/libunbound/Makefile:1.4	Sun May 26 02:49:12 2019
+++ src/external/bsd/unbound/lib/libunbound/Makefile	Fri Jan  1 20:38:36 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2019/05/26 02:49:12 christos Exp $
+# $NetBSD: Makefile,v 1.5 2021/01/01 20:38:36 roy Exp $
 
 .include 
 
@@ -55,7 +55,6 @@ log.c \
 lookup3.c \
 lruhash.c \
 mesh.c \
-mini_event.c \
 modstack.c \
 module.c \
 msgencode.c \
@@ -93,7 +92,6 @@ val_sigcrypt.c \
 val_utils.c \
 validator.c \
 view.c \
-winsock_event.c \
 wire2str.c
 
 LIBDPLIBS+= ${DPLIBS}



CVS commit: src/external/bsd/unbound/include

2021-01-01 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jan  1 20:16:16 UTC 2021

Modified Files:
src/external/bsd/unbound/include: config.h

Log Message:
libunbound: actually use libevent as we link to it

Would appreciate if people modify this file to actually test what
polling mechanism unbound uses as select(2) is pretty poor.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/unbound/include/config.h

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/unbound/include/config.h
diff -u src/external/bsd/unbound/include/config.h:1.7 src/external/bsd/unbound/include/config.h:1.8
--- src/external/bsd/unbound/include/config.h:1.7	Sun Dec 15 16:16:34 2019
+++ src/external/bsd/unbound/include/config.h	Fri Jan  1 20:16:16 2021
@@ -175,22 +175,22 @@
 /* #undef HAVE_ERR_LOAD_CRYPTO_STRINGS */
 
 /* Define to 1 if you have the `event_assign' function. */
-/* #undef HAVE_EVENT_ASSIGN */
+#define HAVE_EVENT_ASSIGN 1
 
 /* Define to 1 if you have the `event_base_free' function. */
-/* #undef HAVE_EVENT_BASE_FREE */
+#define HAVE_EVENT_BASE_FREE 1
 
 /* Define to 1 if you have the `event_base_get_method' function. */
-/* #undef HAVE_EVENT_BASE_GET_METHOD */
+#define HAVE_EVENT_BASE_GET_METHOD 1
 
 /* Define to 1 if you have the `event_base_new' function. */
-/* #undef HAVE_EVENT_BASE_NEW */
+#define HAVE_EVENT_BASE_NEW 1
 
 /* Define to 1 if you have the `event_base_once' function. */
-/* #undef HAVE_EVENT_BASE_ONCE */
+#define HAVE_EVENT_BASE_ONCE 1
 
 /* Define to 1 if you have the  header file. */
-/* #undef HAVE_EVENT_H */
+#define HAVE_EVENT_H 1
 
 /* Define to 1 if you have the `EVP_aes_256_cbc' function. */
 #define HAVE_EVP_AES_256_CBC 1
@@ -792,7 +792,7 @@
 /* #undef USE_IPSET */
 
 /* Define if you want to use internal select based events */
-#define USE_MINI_EVENT 1
+/* #undef USE_MINI_EVENT */
 
 /* Define this to enable client TCP Fast Open. */
 /* #undef USE_MSG_FASTOPEN */



CVS commit: src/external/bsd/ntp/dist/ntpd

2021-01-01 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jan  1 17:21:47 UTC 2021

Modified Files:
src/external/bsd/ntp/dist/ntpd: ntp_io.c

Log Message:
ntpd: In the event of route(4) overflow, update the interfaces


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/external/bsd/ntp/dist/ntpd/ntp_io.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/ntp/dist/ntpd/ntp_io.c
diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.27 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.28
--- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.27	Mon May 25 20:47:25 2020
+++ src/external/bsd/ntp/dist/ntpd/ntp_io.c	Fri Jan  1 17:21:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntp_io.c,v 1.27 2020/05/25 20:47:25 christos Exp $	*/
+/*	$NetBSD: ntp_io.c,v 1.28 2021/01/01 17:21:47 roy Exp $	*/
 
 /*
  * ntp_io.c - input/output routines for ntpd.	The socket-opening code
@@ -4727,6 +4727,14 @@ process_routing_msgs(struct asyncio_read
 		if (errno == ENOBUFS) {
 			msyslog(LOG_ERR,
 "routing socket reports: %m");
+			/*
+			 * drain the routing socket as we need to update
+			 * the interfaces anyway
+			 */
+			do {
+cnt = read(reader->fd, buffer, sizeof(buffer));
+			} while (cnt != -1 || errno == ENOBUFS);
+			timer_interfacetimeout(current_time + UPDATE_GRACE);
 		} else {
 			msyslog(LOG_ERR,
 "routing socket reports: %m - disabling");
@@ -4837,6 +4845,9 @@ init_async_notifications()
 	struct sockaddr_nl sa;
 #else
 	int fd = socket(PF_ROUTE, SOCK_RAW, 0);
+#ifdef SO_RERROR
+	int on = 1;
+#endif
 #endif
 #ifdef RO_MSGFILTER
 	unsigned char msgfilter[] = {
@@ -4907,6 +4918,10 @@ init_async_notifications()
 	, sizeof(msgfilter)) == -1)
 		msyslog(LOG_ERR, "RO_MSGFILTER: %m");
 #endif
+#ifdef SO_RERROR
+	if (setsockopt(fd, SOL_SOCKET, SO_RERROR, , sizeof(on)) == -1)
+		msyslog(LOG_ERR, "SO_RERROR: %m");
+#endif
 	make_socket_nonblocking(fd);
 #if defined(HAVE_SIGNALED_IO)
 	init_socket_sig(fd);



CVS commit: src/external/bsd/wpa/dist/src/drivers

2021-01-01 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jan  1 14:57:14 UTC 2021

Modified Files:
src/external/bsd/wpa/dist/src/drivers: driver_bsd.c

Log Message:
wpa: If route socket overflows, sync drivers to system interfaces

Messages such as RTM_IFNFO or RTM_IFANNOUNCE could have been lost.
As such, sync the state of our internal driver to the state of the
system interfaces as reported by getifaddrs(2).

This change requires the routing socket be placed in non-blocking
mode. While here, set the routing and inet sockets to close on exec.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/external/bsd/wpa/dist/src/drivers/driver_bsd.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/wpa/dist/src/drivers/driver_bsd.c
diff -u src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.37 src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.38
--- src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.37	Tue Jul 21 10:34:16 2020
+++ src/external/bsd/wpa/dist/src/drivers/driver_bsd.c	Fri Jan  1 14:57:14 2021
@@ -16,7 +16,9 @@
 #include "common/ieee802_11_defs.h"
 #include "common/wpa_common.h"
 
+#include 
 #include 
+#include 
 #include 
 
 #ifdef __NetBSD__
@@ -615,6 +617,108 @@ bsd_set_opt_ie(void *priv, const u8 *ie,
 	return 0;
 }
 
+#ifdef SO_RERROR
+static void
+bsd_route_overflow(int sock, void *ctx, struct bsd_driver_global *global)
+{
+	char event_buf[2048]; /* max size of a single route(4) msg */
+	int n;
+	struct ifaddrs *ifaddrs, *ifa;
+	struct bsd_driver_data *drv;
+	struct sockaddr_dl *sdl;
+	union wpa_event_data event;
+
+	/* We need to match the system state, so drain the route
+	 * socket to avoid stale messages. */
+	do {
+		n = read(sock, event_buf, sizeof(event_buf));
+	} while (n != -1 || errno == ENOBUFS);
+
+	if (getifaddrs() == -1) {
+		wpa_printf(MSG_ERROR, "%s getifaddrs() failed: %s",
+			   __func__, strerror(errno));
+			   return;
+	}
+
+	/* add or update existing interfaces */
+	for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
+		if (ifa->ifa_addr == NULL ||
+		ifa->ifa_addr->sa_family != AF_LINK)
+			continue;
+		sdl = (struct sockaddr_dl *)(void *)ifa->ifa_addr;
+		drv = bsd_get_drvname(global, ifa->ifa_name);
+		if (drv != NULL &&
+		(drv->ifindex != sdl->sdl_index || drv->if_removed)) {
+			wpa_printf(MSG_DEBUG,
+			"RTM_IFANNOUNCE: Interface '%s' added",
+			drv->ifname);
+			drv->ifindex = sdl->sdl_index;
+			drv->if_removed = 0;
+			event.interface_status.ievent = EVENT_INTERFACE_ADDED;
+			os_strlcpy(event.interface_status.ifname, ifa->ifa_name,
+			sizeof(event.interface_status.ifname));
+			wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_STATUS,
+	 );
+		}
+		if (drv == NULL &&
+		(drv = bsd_get_drvindex(global, sdl->sdl_index)) != NULL) {
+			/* Driver name is invalid */
+			wpa_printf(MSG_DEBUG,
+			"RTM_IFANNOUNCE: Interface '%s' removed",
+			drv->ifname);
+			drv->if_removed = 1;
+			event.interface_status.ievent = EVENT_INTERFACE_REMOVED;
+			os_strlcpy(event.interface_status.ifname, drv->ifname,
+			sizeof(event.interface_status.ifname));
+			wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_STATUS,
+	 );
+		}
+	}
+
+	/* punt missing interfaces and update flags */
+	dl_list_for_each(drv, >ifaces, struct bsd_driver_data, list) {
+		for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
+			if (ifa->ifa_addr == NULL ||
+			ifa->ifa_addr->sa_family != AF_LINK)
+continue;
+			sdl = (struct sockaddr_dl *)(void *)ifa->ifa_addr;
+			if (os_strcmp(drv->ifname, ifa->ifa_name) == 0)
+break;
+		}
+		if (ifa == NULL && !drv->if_removed) {
+			wpa_printf(MSG_DEBUG,
+			"RTM_IFANNOUNCE: Interface '%s' removed",
+			drv->ifname);
+			drv->if_removed = 1;
+			event.interface_status.ievent = EVENT_INTERFACE_REMOVED;
+			os_strlcpy(event.interface_status.ifname, drv->ifname,
+			sizeof(event.interface_status.ifname));
+			wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_STATUS,
+	 );
+		}
+		if (ifa == NULL)
+			continue;
+
+		if ((ifa->ifa_flags & IFF_UP) == 0 &&
+		(drv->flags & IFF_UP) != 0) {
+			wpa_printf(MSG_DEBUG, "RTM_IFINFO: Interface '%s' DOWN",
+   drv->ifname);
+			wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_DISABLED,
+	 NULL);
+		} else if ((ifa->ifa_flags & IFF_UP) != 0 &&
+		(drv->flags & IFF_UP) == 0) {
+			wpa_printf(MSG_DEBUG, "RTM_IFINFO: Interface '%s' UP",
+   drv->ifname);
+			wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED,
+	 NULL);
+		}
+		drv->flags = ifa->ifa_flags;
+	}
+
+	freeifaddrs(ifaddrs);
+}
+#endif
+
 static void
 bsd_wireless_event_receive(int sock, void *ctx, void *sock_ctx)
 {
@@ -635,6 +739,10 @@ bsd_wireless_event_receive(int sock, voi
 		if (errno != EINTR && errno != EAGAIN)
 			wpa_printf(MSG_ERROR, "%s read() failed: %s",
    __func__, strerror(errno));
+#ifdef SO_RERROR
+		if 

CVS commit: src/doc

2020-12-28 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Dec 28 13:59:50 UTC 2020

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note update to dhcpcd-9.4.0


To generate a diff of this commit:
cvs rdiff -u -r1.1770 -r1.1771 src/doc/3RDPARTY
cvs rdiff -u -r1.2771 -r1.2772 src/doc/CHANGES

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.1770 src/doc/3RDPARTY:1.1771
--- src/doc/3RDPARTY:1.1770	Sun Dec 27 18:28:25 2020
+++ src/doc/3RDPARTY	Mon Dec 28 13:59:50 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1770 2020/12/27 18:28:25 roy Exp $
+#	$NetBSD: 3RDPARTY,v 1.1771 2020/12/28 13:59:50 roy Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -352,17 +352,17 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	9.3.4
-Current Vers:	9.3.4
+Version:	9.4.0
+Current Vers:	9.4.0
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/
-Date:		2020-11-28
+Date:		2020-12-28
 Mailing List: 	dhcpcd-disc...@marples.name
 License:	BSD (2-clause)
 Location:	external/bsd/dhcpcd/dist
 Notes:
-Please submit all changes to the author.
+Please submit all changes to the project mailing list.
 
 Package:   drm
 Version:   Linux 3.15

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2771 src/doc/CHANGES:1.2772
--- src/doc/CHANGES:1.2771	Sun Dec 27 21:13:17 2020
+++ src/doc/CHANGES	Mon Dec 28 13:59:50 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2771 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2772 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -324,4 +324,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	nvmm: implement support for trapping REP CMPS [reinoud 20201227]
 	resize: Import Xterm's resize(1) for querying (x)terminal sizes in
 		base for headless clients [reinoud 20201227]
-
+	dhcpcd: Update to version 9.4.0 [roy 20201228]



CVS commit: src/external/bsd/dhcpcd/dist

2020-12-28 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Dec 28 13:57:40 UTC 2020

Modified Files:
src/external/bsd/dhcpcd/dist/hooks: 20-resolv.conf
src/external/bsd/dhcpcd/dist/src: dhcp.c dhcp6.c dhcpcd.c if-bsd.c
if-options.c ipv6nd.c privsep.c script.c

Log Message:
Sync with dhcpcd-9.4.0


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf
cvs rdiff -u -r1.44 -r1.45 src/external/bsd/dhcpcd/dist/src/dhcp.c
cvs rdiff -u -r1.26 -r1.27 src/external/bsd/dhcpcd/dist/src/dhcp6.c \
src/external/bsd/dhcpcd/dist/src/ipv6nd.c
cvs rdiff -u -r1.47 -r1.48 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
cvs rdiff -u -r1.25 -r1.26 src/external/bsd/dhcpcd/dist/src/if-bsd.c
cvs rdiff -u -r1.30 -r1.31 src/external/bsd/dhcpcd/dist/src/if-options.c
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/dhcpcd/dist/src/privsep.c
cvs rdiff -u -r1.12 -r1.13 src/external/bsd/dhcpcd/dist/src/script.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/hooks/20-resolv.conf
diff -u src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf:1.5 src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf:1.6
--- src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf:1.5	Fri Nov 20 13:24:58 2020
+++ src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf	Mon Dec 28 13:57:40 2020
@@ -7,9 +7,15 @@
 # or dnsmasq. This is important as the libc resolver isn't that powerful.
 
 resolv_conf_dir="$state_dir/resolv.conf"
+nocarrier_roaming_dir="$state_dir/roaming"
 NL="
 "
 : ${resolvconf:=resolvconf}
+if type "$resolvconf" >/dev/null 2>&1; then
+	have_resolvconf=true
+else
+	have_resolvconf=false
+fi
 
 build_resolv_conf()
 {
@@ -164,7 +170,7 @@ add_resolv_conf()
 	for x in ${new_domain_name_servers}; do
 		conf="${conf}nameserver $x$NL"
 	done
-	if type "$resolvconf" >/dev/null 2>&1; then
+	if $have_resolvconf; then
 		[ -n "$ifmetric" ] && export IF_METRIC="$ifmetric"
 		printf %s "$conf" | "$resolvconf" -a "$ifname"
 		return $?
@@ -180,7 +186,7 @@ add_resolv_conf()
 
 remove_resolv_conf()
 {
-	if type "$resolvconf" >/dev/null 2>&1; then
+	if $have_resolvconf; then
 		"$resolvconf" -d "$ifname" -f
 	else
 		if [ -e "$resolv_conf_dir/$ifname" ]; then
@@ -199,7 +205,18 @@ BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
 esac
 
 if $if_configured; then
-	if $if_up || [ "$reason" = ROUTERADVERT ]; then
+	if $have_resolvconf && [ "$reason" = NOCARRIER_ROAMING ]; then
+		# avoid calling resolvconf -c on CARRIER unless we roam
+		mkdir -p "$nocarrier_roaming_dir"
+		echo " " >"$nocarrier_roaming_dir/$interface"
+		"$resolvconf" -C "$interface.*"
+	elif $have_resolvconf && [ "$reason" = CARRIER ]; then
+		# Not all resolvconf implementations support -c
+		if [ -e "$nocarrier_roaming_dir/$interface" ]; then
+			rm -f "$nocarrier_roaming_dir/$interface"
+			"$resolvconf" -c "$interface.*"
+		fi
+	elif $if_up || [ "$reason" = ROUTERADVERT ]; then
 		add_resolv_conf
 	elif $if_down; then
 		remove_resolv_conf

Index: src/external/bsd/dhcpcd/dist/src/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp.c:1.44 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.45
--- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.44	Sat Nov 28 14:27:20 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcp.c	Mon Dec 28 13:57:40 2020
@@ -3886,20 +3886,9 @@ dhcp_init(struct interface *ifp)
 	state->clientid = NULL;
 
 	if (ifo->options & DHCPCD_ANONYMOUS) {
-		uint8_t duid[DUID_LEN];
-		uint8_t duid_len;
-
-		duid_len = (uint8_t)duid_make(duid, ifp, DUID_LL);
-		if (duid_len != 0) {
-			state->clientid = malloc((size_t)duid_len + 6);
-			if (state->clientid == NULL)
-goto eexit;
-			state->clientid[0] =(uint8_t)(duid_len + 5);
-			state->clientid[1] = 255; /* RFC 4361 */
-			memcpy(state->clientid + 2, ifo->iaid, 4);
-			memset(state->clientid + 2, 0, 4); /* IAID */
-			memcpy(state->clientid + 6, duid, duid_len);
-		}
+		/* Removing the option could show that we want anonymous.
+		 * As such keep it as it's already in the hwaddr field. */
+		goto make_clientid;
 	} else if (*ifo->clientid) {
 		state->clientid = malloc((size_t)(ifo->clientid[0] + 1));
 		if (state->clientid == NULL)
@@ -3917,6 +3906,7 @@ dhcp_init(struct interface *ifp)
 			memcpy(state->clientid + 6, ifp->ctx->duid,
 			ifp->ctx->duid_len);
 		} else {
+make_clientid:
 			len = (uint8_t)(ifp->hwlen + 1);
 			state->clientid = malloc((size_t)len + 1);
 			if (state->clientid == NULL)

Index: src/external/bsd/dhcpcd/dist/src/dhcp6.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.26 src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.27
--- src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.26	Sat Nov 28 14:27:20 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcp6.c	Mon Dec 28 13:57:40 2020
@@ -2065,7 +2065,8 @@ dhcp6_checkstatusok(const struct interfa
 	state->lerror = code;
 	errno = 0;
 
-	if (code != 0 && ifp->ctx->options & DHCPCD_TEST)
+	/* code cannot be D6_STATUS_OK, so 

CVS import: src/external/bsd/dhcpcd/dist

2020-12-28 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Dec 28 13:56:26 UTC 2020

Update of /cvsroot/src/external/bsd/dhcpcd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv23356

Log Message:
Update to dhcpcd-9.4.0 with the following changes:

 * DHCP: For anonymous, just use a generic ClientID
 * link: Split hardware address randomisation out of anonymous option
 * link: Only report hardware changes for active interfaces
 * link: Report errors obtaining recv buffer size on overflow
 * hooks: Add NOCARRIER_ROAMING reason
 * hooks: interface_order now reflects priorities again

Status:

Vendor Tag: ROY
Release Tags:   dhcpcd-9_4_0

U src/external/bsd/dhcpcd/dist/LICENSE
U src/external/bsd/dhcpcd/dist/README.md
U src/external/bsd/dhcpcd/dist/src/defs.h
U src/external/bsd/dhcpcd/dist/src/common.c
U src/external/bsd/dhcpcd/dist/src/control.c
C src/external/bsd/dhcpcd/dist/src/dhcpcd.c
U src/external/bsd/dhcpcd/dist/src/duid.c
U src/external/bsd/dhcpcd/dist/src/eloop.c
U src/external/bsd/dhcpcd/dist/src/logerr.c
U src/external/bsd/dhcpcd/dist/src/if.c
C src/external/bsd/dhcpcd/dist/src/if-options.c
U src/external/bsd/dhcpcd/dist/src/sa.c
U src/external/bsd/dhcpcd/dist/src/route.c
U src/external/bsd/dhcpcd/dist/src/dhcp-common.c
C src/external/bsd/dhcpcd/dist/src/script.c
U src/external/bsd/dhcpcd/dist/src/auth.c
C src/external/bsd/dhcpcd/dist/src/if-bsd.c
C src/external/bsd/dhcpcd/dist/src/dhcp.c
U src/external/bsd/dhcpcd/dist/src/ipv4.c
U src/external/bsd/dhcpcd/dist/src/bpf.c
U src/external/bsd/dhcpcd/dist/src/arp.c
U src/external/bsd/dhcpcd/dist/src/ipv4ll.c
U src/external/bsd/dhcpcd/dist/src/ipv6.c
C src/external/bsd/dhcpcd/dist/src/ipv6nd.c
C src/external/bsd/dhcpcd/dist/src/dhcp6.c
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c
C src/external/bsd/dhcpcd/dist/src/privsep.c
U src/external/bsd/dhcpcd/dist/src/privsep-root.c
U src/external/bsd/dhcpcd/dist/src/privsep-control.c
U src/external/bsd/dhcpcd/dist/src/privsep-inet.c
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.c
U src/external/bsd/dhcpcd/dist/src/privsep-bsd.c
U src/external/bsd/dhcpcd/dist/src/common.h
U src/external/bsd/dhcpcd/dist/src/control.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.h
U src/external/bsd/dhcpcd/dist/src/duid.h
U src/external/bsd/dhcpcd/dist/src/eloop.h
U src/external/bsd/dhcpcd/dist/src/logerr.h
U src/external/bsd/dhcpcd/dist/src/if.h
U src/external/bsd/dhcpcd/dist/src/if-options.h
U src/external/bsd/dhcpcd/dist/src/sa.h
U src/external/bsd/dhcpcd/dist/src/route.h
U src/external/bsd/dhcpcd/dist/src/dhcp-common.h
U src/external/bsd/dhcpcd/dist/src/script.h
U src/external/bsd/dhcpcd/dist/src/auth.h
U src/external/bsd/dhcpcd/dist/src/dhcp.h
U src/external/bsd/dhcpcd/dist/src/ipv4.h
U src/external/bsd/dhcpcd/dist/src/bpf.h
U src/external/bsd/dhcpcd/dist/src/arp.h
U src/external/bsd/dhcpcd/dist/src/ipv4ll.h
U src/external/bsd/dhcpcd/dist/src/ipv6.h
U src/external/bsd/dhcpcd/dist/src/ipv6nd.h
U src/external/bsd/dhcpcd/dist/src/dhcp6.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h
U src/external/bsd/dhcpcd/dist/src/privsep.h
U src/external/bsd/dhcpcd/dist/src/privsep-root.h
U src/external/bsd/dhcpcd/dist/src/privsep-control.h
U src/external/bsd/dhcpcd/dist/src/privsep-inet.h
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.h
U src/external/bsd/dhcpcd/dist/src/dev.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in
U src/external/bsd/dhcpcd/dist/hooks/01-test
U src/external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant
U src/external/bsd/dhcpcd/dist/hooks/15-timezone
C src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf
U src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname
U src/external/bsd/dhcpcd/dist/hooks/30-hostname.in
U src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf
U src/external/bsd/dhcpcd/dist/hooks/50-ypbind.in

9 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jROY:yesterday -jROY src/external/bsd/dhcpcd/dist



CVS commit: src/doc

2020-12-27 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Dec 27 18:28:25 UTC 2020

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note openresolv-3.12.0 update


To generate a diff of this commit:
cvs rdiff -u -r1.1769 -r1.1770 src/doc/3RDPARTY
cvs rdiff -u -r1.2768 -r1.2769 src/doc/CHANGES

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.1769 src/doc/3RDPARTY:1.1770
--- src/doc/3RDPARTY:1.1769	Sat Dec 12 11:02:06 2020
+++ src/doc/3RDPARTY	Sun Dec 27 18:28:25 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1769 2020/12/12 11:02:06 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1770 2020/12/27 18:28:25 roy Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1043,12 +1043,12 @@ Location:	external/bsd/openpam/dist
 Notes:
 
 Package:	openresolv
-Version:	3.11.0
-Current Vers:	3.11.0
+Version:	3.12.0
+Current Vers:	3.12.0
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/openresolv/
 Home Page:	http://roy.marples.name/projects/openresolv/
-Date:		2020-07-22
+Date:		2020-12-27
 Mailing List: 	openresolv-disc...@marples.name
 License:	BSD (2-clause)
 Location:	external/bsd/openresolv/dist

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2768 src/doc/CHANGES:1.2769
--- src/doc/CHANGES:1.2768	Wed Dec 23 08:38:45 2020
+++ src/doc/CHANGES	Sun Dec 27 18:28:25 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2768 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2769 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -320,3 +320,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	sparc64: Add environment monitoring for the E250 [jdc 20201223]
 	sti(4), hp300: Add bitmap access ops support for SGC CRX (A1659-66001)
 		framebuffer for HP9000/425t. [tsutsui 20201223]
+	openresolv: Update to version 3.12.0 [roy 20201227]



CVS commit: src/external/bsd/openresolv/dist

2020-12-27 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Dec 27 18:26:50 UTC 2020

Modified Files:
src/external/bsd/openresolv/dist: resolvconf.8.in resolvconf.conf.5.in
resolvconf.in

Log Message:
Sync with openresolv-3.12.0


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/openresolv/dist/resolvconf.8.in
cvs rdiff -u -r1.20 -r1.21 \
src/external/bsd/openresolv/dist/resolvconf.conf.5.in
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/openresolv/dist/resolvconf.in

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/openresolv/dist/resolvconf.8.in
diff -u src/external/bsd/openresolv/dist/resolvconf.8.in:1.10 src/external/bsd/openresolv/dist/resolvconf.8.in:1.11
--- src/external/bsd/openresolv/dist/resolvconf.8.in:1.10	Mon Jan 27 21:13:05 2020
+++ src/external/bsd/openresolv/dist/resolvconf.8.in	Sun Dec 27 18:26:50 2020
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd November 29, 2016
+.Dd December 23, 2016
 .Dt RESOLVCONF 8
 .Os
 .Sh NAME
@@ -38,6 +38,10 @@
 .Fl a Ar interface Ns Op Ar .protocol
 .No < Ns Pa file
 .Nm
+.Fl C Ar pattern
+.Nm
+.Fl c Ar pattern
+.Nm
 .Op Fl f
 .Fl d Ar interface Ns Op Ar .protocol
 .Nm
@@ -126,6 +130,15 @@ file(s) for all the
 .Ar protocols
 on the
 .Ar interface .
+For systems that support the concept of persisting configuration when
+the carrier goes down, then it should instead call
+.Nm
+with
+.Fl C Ar interface.*
+arguments to deprecate the matching interfaces and
+.Fl c Ar interface.*
+to activate the matching interfaces when the carrier comes up.
+This only affects the order in which interfaces are processed.
 .Pp
 Here are some options for the above commands:-
 .Bl -tag -width pattern_opt

Index: src/external/bsd/openresolv/dist/resolvconf.conf.5.in
diff -u src/external/bsd/openresolv/dist/resolvconf.conf.5.in:1.20 src/external/bsd/openresolv/dist/resolvconf.conf.5.in:1.21
--- src/external/bsd/openresolv/dist/resolvconf.conf.5.in:1.20	Mon Jan 27 21:13:05 2020
+++ src/external/bsd/openresolv/dist/resolvconf.conf.5.in	Sun Dec 27 18:26:50 2020
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd September 8, 2019
+.Dd October 1, 2020
 .Dt RESOLVCONF.CONF 5
 .Os
 .Sh NAME
@@ -220,7 +220,7 @@ openresolv ships with subscribers for th
 and
 .Xr unbound 8 .
 Each subscriber can create configuration files which should be included in
-in the subscribers main configuration file.
+the subscribers main configuration file.
 .Pp
 To disable a subscriber, simply set it's name to NO.
 For example, to disable the libc subscriber you would set:

Index: src/external/bsd/openresolv/dist/resolvconf.in
diff -u src/external/bsd/openresolv/dist/resolvconf.in:1.8 src/external/bsd/openresolv/dist/resolvconf.in:1.9
--- src/external/bsd/openresolv/dist/resolvconf.in:1.8	Wed Jul 22 13:19:17 2020
+++ src/external/bsd/openresolv/dist/resolvconf.in	Sun Dec 27 18:26:50 2020
@@ -25,7 +25,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 RESOLVCONF="$0"
-OPENRESOLV_VERSION="3.11.0"
+OPENRESOLV_VERSION="3.12.0"
 SYSCONFDIR=@SYSCONFDIR@
 LIBEXECDIR=@LIBEXECDIR@
 VARDIR=@VARDIR@
@@ -64,6 +64,7 @@ IFACEDIR="$VARDIR/interfaces"
 METRICDIR="$VARDIR/metrics"
 PRIVATEDIR="$VARDIR/private"
 EXCLUSIVEDIR="$VARDIR/exclusive"
+DEPRECATEDDIR="$VARDIR/deprecated"
 LOCKDIR="$VARDIR/lock"
 _PWD="$PWD"
 
@@ -88,6 +89,8 @@ usage()
 	Commands:
 	  -a \$INTERFACEAdd DNS information to the specified interface
 	   (DNS supplied via stdin in resolv.conf format)
+	  -C \$PATTERN  Deprecate DNS information for matched interfaces
+	  -c \$PATTERN  Configure DNS information for matched interfaces
 	  -d \$INTERFACEDelete DNS information from the specified interface
 	  -h   Show this help cruft
 	  -i [\$PATTERN]Show interfaces that have supplied DNS information
@@ -275,19 +278,14 @@ dirname()
 
 config_mkdirs()
 {
-	e=0
 	for f; do
 		[ -n "$f" ] || continue
 		d="$(dirname "$f")"
 		if [ ! -d "$d" ]; then
-			if type install >/dev/null 2>&1; then
-install -d "$d" || e=$?
-			else
-mkdir "$d" || e=$?
-			fi
+			mkdir -p "$d" || return $?
 		fi
 	done
-	return $e
+	return 0
 }
 
 # With the advent of alternative init systems, it's possible to have
@@ -412,6 +410,22 @@ echo_resolv()
 	IFS="$OIFS"
 }
 
+deprecated_interface()
+{
+	[ -d "$DEPRECATEDDIR" ] || return 1
+
+	cd "$DEPRECATEDDIR"
+	for da; do
+		for daf in *; do
+			[ -f "$daf" ] || continue
+			case "$da" in
+			$daf) return 0;;
+			esac
+		done
+	done
+	return 1
+}
+
 list_resolv()
 {
 	[ -d "$IFACEDIR" ] || return 0
@@ -453,12 +467,14 @@ list_resolv()
 		$force || report=true
 	elif ! $excl; then
 		cd "$IFACEDIR"
+
 		for i in $interface_order; do
 			[ -f "$i" ] && list="$list $i"
 			for 

CVS import: src/external/bsd/openresolv/dist

2020-12-27 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Dec 27 18:25:08 UTC 2020

Update of /cvsroot/src/external/bsd/openresolv/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv14098

Log Message:
Update to openresolv-3.12.0 with the following changes:

 * Allow configurations to be marked as Deprecated and Acivtated
 * Harden resolvconf lock detection

Status:

Vendor Tag: ROY
Release Tags:   openresolv-3_12_0

U src/external/bsd/openresolv/dist/LICENSE
U src/external/bsd/openresolv/dist/README.md
C src/external/bsd/openresolv/dist/resolvconf.in
C src/external/bsd/openresolv/dist/resolvconf.8.in
C src/external/bsd/openresolv/dist/resolvconf.conf.5.in
U src/external/bsd/openresolv/dist/libc.in
U src/external/bsd/openresolv/dist/dnsmasq.in
U src/external/bsd/openresolv/dist/named.in
U src/external/bsd/openresolv/dist/pdnsd.in
U src/external/bsd/openresolv/dist/pdns_recursor.in
U src/external/bsd/openresolv/dist/unbound.in
U src/external/bsd/openresolv/dist/avahi-daemon.in
U src/external/bsd/openresolv/dist/mdnsd.in
U src/external/bsd/openresolv/dist/resolvconf.conf

3 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jROY:yesterday -jROY src/external/bsd/openresolv/dist



CVS commit: src/distrib/sets/lists/tests

2020-12-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Dec 13 00:37:43 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
t_ossaudio was installed for clang, so remove gcc marking


To generate a diff of this commit:
cvs rdiff -u -r1.990 -r1.991 src/distrib/sets/lists/tests/mi

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.990 src/distrib/sets/lists/tests/mi:1.991
--- src/distrib/sets/lists/tests/mi:1.990	Sat Dec 12 15:06:11 2020
+++ src/distrib/sets/lists/tests/mi	Sun Dec 13 00:37:43 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.990 2020/12/12 15:06:11 rillig Exp $
+# $NetBSD: mi,v 1.991 2020/12/13 00:37:43 roy Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3800,7 +3800,7 @@
 ./usr/tests/lib/libossaudiotests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libossaudio/Atffile			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libossaudio/Kyuafile			tests-lib-tests		compattestfile,atf,kyua
-./usr/tests/lib/libossaudio/t_ossaudio			tests-lib-tests		compattestfile,atf,gcc
+./usr/tests/lib/libossaudio/t_ossaudio			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libposixtests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libposix/Atffile			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libposix/Kyuafile			tests-lib-tests		compattestfile,atf,kyua



CVS commit: src/external/gpl2/diffutils/dist/src

2020-12-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Dec 13 00:04:40 UTC 2020

Modified Files:
src/external/gpl2/diffutils/dist/src: util.c

Log Message:
diffutils: execl requires a NULL sentinel


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl2/diffutils/dist/src/util.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/gpl2/diffutils/dist/src/util.c
diff -u src/external/gpl2/diffutils/dist/src/util.c:1.1.1.1 src/external/gpl2/diffutils/dist/src/util.c:1.2
--- src/external/gpl2/diffutils/dist/src/util.c:1.1.1.1	Wed Jan 13 03:15:30 2016
+++ src/external/gpl2/diffutils/dist/src/util.c	Sun Dec 13 00:04:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.1.1.1 2016/01/13 03:15:30 christos Exp $	*/
+/*	$NetBSD: util.c,v 1.2 2020/12/13 00:04:40 roy Exp $	*/
 
 /* Support routines for GNU DIFF.
 
@@ -217,7 +217,7 @@ begin_output (void)
 		close (pipes[0]);
 	  }
 
-	execl (pr_program, pr_program, "-h", name, 0);
+	execl (pr_program, pr_program, "-h", name, NULL);
 	_exit (errno == ENOEXEC ? 126 : 127);
 	  }
 	else



CVS commit: src/doc

2020-11-28 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Nov 28 14:29:25 UTC 2020

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note update to dhcpcd-9.3.4


To generate a diff of this commit:
cvs rdiff -u -r1.1762 -r1.1763 src/doc/3RDPARTY
cvs rdiff -u -r1.2755 -r1.2756 src/doc/CHANGES

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.1762 src/doc/3RDPARTY:1.1763
--- src/doc/3RDPARTY:1.1762	Fri Nov 27 17:01:18 2020
+++ src/doc/3RDPARTY	Sat Nov 28 14:29:25 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1762 2020/11/27 17:01:18 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1763 2020/11/28 14:29:25 roy Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -352,12 +352,12 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	9.3.3
-Current Vers:	9.3.3
+Version:	9.3.4
+Current Vers:	9.3.4
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/
-Date:		2020-11-20
+Date:		2020-11-28
 Mailing List: 	dhcpcd-disc...@marples.name
 License:	BSD (2-clause)
 Location:	external/bsd/dhcpcd/dist

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2755 src/doc/CHANGES:1.2756
--- src/doc/CHANGES:1.2755	Fri Nov 27 17:01:18 2020
+++ src/doc/CHANGES	Sat Nov 28 14:29:25 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2755 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2756 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -301,5 +301,5 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	tmux(1): Imported 3.1c. [christos 20201101]
 	kernel: Better default for kern.maxfiles for systems with
 		larger RAM [simonb 20201112]
-	dhcpcd: Update to version 9.3.3 [roy 20201120]
 	acpi(4): Updated ACPICA to 20201113. [christos 20201127]
+	dhcpcd: Update to version 9.3.4 [roy 20201128]



CVS commit: src/external/bsd/dhcpcd/dist/src

2020-11-28 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Nov 28 14:27:20 UTC 2020

Modified Files:
src/external/bsd/dhcpcd/dist/src: dhcp.c dhcp6.c dhcpcd.8.in dhcpcd.c
if-options.c

Log Message:
Sync with dhcpcd-9.3.4


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/external/bsd/dhcpcd/dist/src/dhcp.c
cvs rdiff -u -r1.25 -r1.26 src/external/bsd/dhcpcd/dist/src/dhcp6.c
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
cvs rdiff -u -r1.46 -r1.47 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
cvs rdiff -u -r1.29 -r1.30 src/external/bsd/dhcpcd/dist/src/if-options.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.43 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.44
--- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.43	Fri Nov 20 13:24:58 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcp.c	Sat Nov 28 14:27:20 2020
@@ -2364,13 +2364,21 @@ dhcp_bind(struct interface *ifp)
 		return;
 	}
 
+	/* Add the address */
+	if (ipv4_applyaddr(ifp) == NULL) {
+		/* There was an error adding the address.
+		 * If we are in oneshot, exit with a failure. */
+		if (ctx->options & DHCPCD_ONESHOT) {
+			loginfox("exiting due to oneshot");
+			eloop_exit(ctx->eloop, EXIT_FAILURE);
+		}
+		return;
+	}
+
 	/* Close the BPF filter as we can now receive DHCP messages
 	 * on a UDP socket. */
 	dhcp_closebpf(ifp);
 
-	/* Add the address */
-	ipv4_applyaddr(ifp);
-
 openudp:
 	/* If not in master mode, open an address specific socket. */
 	if (ctx->options & DHCPCD_MASTER ||

Index: src/external/bsd/dhcpcd/dist/src/dhcp6.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.25 src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.26
--- src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.25	Fri Nov 20 13:24:58 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcp6.c	Sat Nov 28 14:27:20 2020
@@ -2064,6 +2064,10 @@ dhcp6_checkstatusok(const struct interfa
 	free(sbuf);
 	state->lerror = code;
 	errno = 0;
+
+	if (code != 0 && ifp->ctx->options & DHCPCD_TEST)
+		eloop_exit(ifp->ctx->eloop, EXIT_FAILURE);
+
 	return (int)code;
 }
 

Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in:1.10 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in:1.11
--- src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in:1.10	Fri Nov 20 13:24:58 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in	Sat Nov 28 14:27:20 2020
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd November 3, 2020
+.Dd November 25, 2020
 .Dt DHCPCD 8
 .Os
 .Sh NAME
@@ -264,18 +264,29 @@ Use this
 .Ar script
 instead of the default
 .Pa @SCRIPT@ .
-.It Fl D , Fl Fl duid
+.It Fl D , Fl Fl duid Op Ar ll | lt | uuid | value
 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).
+The DUID type can be hinted as an optional parameter if the file
+.Pa @DBDIR@/duid
+does not exist.
+If not
+.Va ll ,
+.Va lt
+or
+.Va uuid
+then
+.Va value
+will be converted from 00:11:22:33 format.
 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.
+This file also takes precedence over the above rules except for setting a value.
 .It Fl d , Fl Fl debug
 Echo debug messages to the stderr and syslog.
 .It Fl E , Fl Fl lastlease
@@ -747,7 +758,7 @@ This is the default behaviour and sets
 .Ev if_configured=true .
 .It Fl Fl noconfigure
 .Nm
-will not configure the system add all.
+will not configure the system at all.
 This is only of use if the
 .Fl Fl script
 that

Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.46 src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.47
--- src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.46	Fri Nov 20 13:24:58 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c	Sat Nov 28 14:27:20 2020
@@ -841,13 +841,17 @@ dhcpcd_initduid(struct dhcpcd_ctx *ctx, 
 {
 	char buf[DUID_LEN * 3];
 
-	if (ctx->duid != NULL)
+	if (ctx->duid != NULL) {
+		if (ifp == NULL)
+			goto log;
 		return;
+	}
 
 	duid_init(ctx, ifp);
 	if (ctx->duid == NULL)
 		return;
 
+log:
 	loginfox("DUID %s",
 	hwaddr_ntoa(ctx->duid, ctx->duid_len, buf, sizeof(buf)));
 }
@@ -991,17 +995,20 @@ void
 dhcpcd_activateinterface(struct interface *ifp, unsigned long long options)
 {
 
-	if (!ifp->active) {
-		ifp->active = IF_ACTIVE;
-		dhcpcd_initstate2(ifp, options);
-		/* It's possible we might not have been able to load
-		 * a config. */
-		if (ifp->active) {
-			configure_interface1(ifp);
-			run_preinit(ifp);
-			

CVS import: src/external/bsd/dhcpcd/dist

2020-11-28 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Nov 28 14:26:17 UTC 2020

Update of /cvsroot/src/external/bsd/dhcpcd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv1431

Log Message:
Upate to dhcpcd-9.3.4 with the following changes:

With the following changes:
 * DHCP: If error adding the address in oneshot, exit with failure
 * DHCP: Only listen to the address if we successfully added it
 * DHCP6: Fix segfault introduced in dhcpcd-9.3.3
 * DHCP6: Abort in test mode when an error is returned by server
 * options: allow --ia_na=1 and --ia_pd=2 on the command line
 * options: Allow duid to take a value

Status:

Vendor Tag: ROY
Release Tags:   dhcpcd-9_3_4

U src/external/bsd/dhcpcd/dist/LICENSE
U src/external/bsd/dhcpcd/dist/README.md
U src/external/bsd/dhcpcd/dist/src/defs.h
U src/external/bsd/dhcpcd/dist/src/common.c
U src/external/bsd/dhcpcd/dist/src/control.c
C src/external/bsd/dhcpcd/dist/src/dhcpcd.c
U src/external/bsd/dhcpcd/dist/src/duid.c
U src/external/bsd/dhcpcd/dist/src/eloop.c
U src/external/bsd/dhcpcd/dist/src/logerr.c
U src/external/bsd/dhcpcd/dist/src/if.c
C src/external/bsd/dhcpcd/dist/src/if-options.c
U src/external/bsd/dhcpcd/dist/src/sa.c
U src/external/bsd/dhcpcd/dist/src/route.c
U src/external/bsd/dhcpcd/dist/src/dhcp-common.c
U src/external/bsd/dhcpcd/dist/src/script.c
U src/external/bsd/dhcpcd/dist/src/auth.c
U src/external/bsd/dhcpcd/dist/src/if-bsd.c
C src/external/bsd/dhcpcd/dist/src/dhcp.c
U src/external/bsd/dhcpcd/dist/src/ipv4.c
U src/external/bsd/dhcpcd/dist/src/bpf.c
U src/external/bsd/dhcpcd/dist/src/arp.c
U src/external/bsd/dhcpcd/dist/src/ipv4ll.c
U src/external/bsd/dhcpcd/dist/src/ipv6.c
U src/external/bsd/dhcpcd/dist/src/ipv6nd.c
C src/external/bsd/dhcpcd/dist/src/dhcp6.c
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c
U src/external/bsd/dhcpcd/dist/src/privsep.c
U src/external/bsd/dhcpcd/dist/src/privsep-root.c
U src/external/bsd/dhcpcd/dist/src/privsep-control.c
U src/external/bsd/dhcpcd/dist/src/privsep-inet.c
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.c
U src/external/bsd/dhcpcd/dist/src/privsep-bsd.c
U src/external/bsd/dhcpcd/dist/src/common.h
U src/external/bsd/dhcpcd/dist/src/control.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.h
U src/external/bsd/dhcpcd/dist/src/duid.h
U src/external/bsd/dhcpcd/dist/src/eloop.h
U src/external/bsd/dhcpcd/dist/src/logerr.h
U src/external/bsd/dhcpcd/dist/src/if.h
U src/external/bsd/dhcpcd/dist/src/if-options.h
U src/external/bsd/dhcpcd/dist/src/sa.h
U src/external/bsd/dhcpcd/dist/src/route.h
U src/external/bsd/dhcpcd/dist/src/dhcp-common.h
U src/external/bsd/dhcpcd/dist/src/script.h
U src/external/bsd/dhcpcd/dist/src/auth.h
U src/external/bsd/dhcpcd/dist/src/dhcp.h
U src/external/bsd/dhcpcd/dist/src/ipv4.h
U src/external/bsd/dhcpcd/dist/src/bpf.h
U src/external/bsd/dhcpcd/dist/src/arp.h
U src/external/bsd/dhcpcd/dist/src/ipv4ll.h
U src/external/bsd/dhcpcd/dist/src/ipv6.h
U src/external/bsd/dhcpcd/dist/src/ipv6nd.h
U src/external/bsd/dhcpcd/dist/src/dhcp6.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h
U src/external/bsd/dhcpcd/dist/src/privsep.h
U src/external/bsd/dhcpcd/dist/src/privsep-root.h
U src/external/bsd/dhcpcd/dist/src/privsep-control.h
U src/external/bsd/dhcpcd/dist/src/privsep-inet.h
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.h
U src/external/bsd/dhcpcd/dist/src/dev.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
C src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in
U src/external/bsd/dhcpcd/dist/hooks/01-test
U src/external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant
U src/external/bsd/dhcpcd/dist/hooks/15-timezone
U src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf
U src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname
U src/external/bsd/dhcpcd/dist/hooks/30-hostname.in
U src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf
U src/external/bsd/dhcpcd/dist/hooks/50-ypbind.in

5 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jROY:yesterday -jROY src/external/bsd/dhcpcd/dist



CVS commit: src/doc

2020-11-20 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Nov 20 13:33:07 UTC 2020

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note import of dhcpcd-9.3.3


To generate a diff of this commit:
cvs rdiff -u -r1.1760 -r1.1761 src/doc/3RDPARTY
cvs rdiff -u -r1.2753 -r1.2754 src/doc/CHANGES

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.1760 src/doc/3RDPARTY:1.1761
--- src/doc/3RDPARTY:1.1760	Sun Nov  8 15:57:01 2020
+++ src/doc/3RDPARTY	Fri Nov 20 13:33:07 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1760 2020/11/08 15:57:01 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1761 2020/11/20 13:33:07 roy Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -352,12 +352,12 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	9.3.2
-Current Vers:	9.3.2
+Version:	9.3.3
+Current Vers:	9.3.3
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/
-Date:		2020-11-01
+Date:		2020-11-20
 Mailing List: 	dhcpcd-disc...@marples.name
 License:	BSD (2-clause)
 Location:	external/bsd/dhcpcd/dist

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2753 src/doc/CHANGES:1.2754
--- src/doc/CHANGES:1.2753	Thu Nov 12 12:19:46 2020
+++ src/doc/CHANGES	Fri Nov 20 13:33:07 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2753 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2754 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -297,7 +297,8 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	tzcode: Updated to 2020c. [christos 20201017]
 	ossaudio(3): Added support for the OSSv4 Mixer API [nia 20201017]
 	tzdata updated to 2020d  [kre 20201022]
-	dhcpcd: Update to version 9.3.1 [roy 20201101]
+	dhcpcd: Update to version 9.3.2 [roy 20201101]
 	tmux(1): Imported 3.1c. [christos 20201101]
 	kernel: Better default for kern.maxfiles for systems with
 		larger RAM [simonb 20201112]
+	dhcpcd: Update to version 9.3.3 [roy 20201120]



CVS commit: src/external/bsd/dhcpcd/dist

2020-11-20 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Nov 20 13:24:58 UTC 2020

Modified Files:
src/external/bsd/dhcpcd/dist/hooks: 20-resolv.conf 50-ntp.conf
50-ypbind.in
src/external/bsd/dhcpcd/dist/src: dhcp.c dhcp6.c dhcpcd.8.in dhcpcd.c
if-options.c ipv6.c ipv6nd.c privsep.c script.c

Log Message:
Sync with dhcpcd-9.3.3


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf \
src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/dhcpcd/dist/hooks/50-ypbind.in
cvs rdiff -u -r1.42 -r1.43 src/external/bsd/dhcpcd/dist/src/dhcp.c
cvs rdiff -u -r1.24 -r1.25 src/external/bsd/dhcpcd/dist/src/dhcp6.c
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
cvs rdiff -u -r1.45 -r1.46 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
cvs rdiff -u -r1.28 -r1.29 src/external/bsd/dhcpcd/dist/src/if-options.c
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/dhcpcd/dist/src/ipv6.c
cvs rdiff -u -r1.25 -r1.26 src/external/bsd/dhcpcd/dist/src/ipv6nd.c
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/dhcpcd/dist/src/privsep.c
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/dhcpcd/dist/src/script.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/hooks/20-resolv.conf
diff -u src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf:1.4 src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf:1.5
--- src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf:1.4	Thu Apr  2 12:41:47 2020
+++ src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf	Fri Nov 20 13:24:58 2020
@@ -198,8 +198,10 @@ BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
 	;;
 esac
 
-if $if_up || [ "$reason" = ROUTERADVERT ]; then
-	add_resolv_conf
-elif $if_down; then
-	remove_resolv_conf
+if $if_configured; then
+	if $if_up || [ "$reason" = ROUTERADVERT ]; then
+		add_resolv_conf
+	elif $if_down; then
+		remove_resolv_conf
+	fi
 fi
Index: src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf
diff -u src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf:1.4 src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf:1.5
--- src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf:1.4	Thu Apr  2 12:41:48 2020
+++ src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf	Fri Nov 20 13:24:58 2020
@@ -135,8 +135,10 @@ BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
 ;;
 esac
 
-if $if_up; then
-	add_ntp_conf
-elif $if_down; then
-	remove_ntp_conf
+if $if_configured; then
+	if $if_up; then
+		add_ntp_conf
+	elif $if_down; then
+		remove_ntp_conf
+	fi
 fi

Index: src/external/bsd/dhcpcd/dist/hooks/50-ypbind.in
diff -u src/external/bsd/dhcpcd/dist/hooks/50-ypbind.in:1.2 src/external/bsd/dhcpcd/dist/hooks/50-ypbind.in:1.3
--- src/external/bsd/dhcpcd/dist/hooks/50-ypbind.in:1.2	Sat Sep 22 13:17:46 2018
+++ src/external/bsd/dhcpcd/dist/hooks/50-ypbind.in	Fri Nov 20 13:24:58 2020
@@ -68,7 +68,9 @@ restore_yp_binding()
 	fi
 }
 
-if [ "$reason" = PREINIT ]; then
+if ! $if_configured; then
+	;
+elif [ "$reason" = PREINIT ]; then
 	rm -f "$ypbind_dir/$interface".*
 elif $if_up || $if_down; then
 	if [ -n "$new_nis_domain" ]; then

Index: src/external/bsd/dhcpcd/dist/src/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp.c:1.42 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.43
--- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.42	Sun Nov  1 14:24:01 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcp.c	Fri Nov 20 13:24:58 2020
@@ -2346,6 +2346,24 @@ dhcp_bind(struct interface *ifp)
 
 	old_state = state->added;
 
+	if (!(ifo->options & DHCPCD_CONFIGURE)) {
+		struct ipv4_addr *ia;
+
+		script_runreason(ifp, state->reason);
+		dhcpcd_daemonise(ifp->ctx);
+
+		/* We we are not configuring the address, we need to keep
+		 * the BPF socket open if the address does not exist. */
+		ia = ipv4_iffindaddr(ifp, >lease.addr, NULL);
+		if (ia != NULL) {
+			state->addr = ia;
+			state->added = STATE_ADDED;
+			dhcp_closebpf(ifp);
+			goto openudp;
+		}
+		return;
+	}
+
 	/* Close the BPF filter as we can now receive DHCP messages
 	 * on a UDP socket. */
 	dhcp_closebpf(ifp);
@@ -2353,6 +2371,7 @@ dhcp_bind(struct interface *ifp)
 	/* Add the address */
 	ipv4_applyaddr(ifp);
 
+openudp:
 	/* If not in master mode, open an address specific socket. */
 	if (ctx->options & DHCPCD_MASTER ||
 	(state->old != NULL &&
@@ -2361,7 +2380,6 @@ dhcp_bind(struct interface *ifp)
 		return;
 
 	dhcp_closeinet(ifp);
-
 #ifdef PRIVSEP
 	if (IN_PRIVSEP_SE(ctx)) {
 		if (ps_inet_openbootp(state->addr) == -1)
@@ -2805,7 +2823,13 @@ dhcp_drop(struct interface *ifp, const c
 	state->new = NULL;
 	state->new_len = 0;
 	state->reason = reason;
-	ipv4_applyaddr(ifp);
+	if (ifp->options->options & DHCPCD_CONFIGURE)
+		ipv4_applyaddr(ifp);
+	else {
+		state->addr = NULL;
+		state->added = 0;
+		script_runreason(ifp, state->reason);
+	}
 	free(state->old);
 	state->old = NULL;
 	state->old_len = 0;
@@ -4219,6 +4243,20 @@ dhcp_handleifa(int cmd, struct ipv4_addr
 

CVS import: src/external/bsd/dhcpcd/dist

2020-11-20 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Nov 20 13:23:39 UTC 2020

Update of /cvsroot/src/external/bsd/dhcpcd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv8156

Log Message:
Update to dhcpcd-9.3.3 with the following changes:

 * dhcpcd: Don't create a launcher process if keeping in foreground
 * dhcpcd: Add --noconfigure option
 * control: Create an unpriv socket for non master mode
 * options: Don't log unknown ones when printing pidfile location

Status:

Vendor Tag: ROY
Release Tags:   dhcpcd-9_3_3

U src/external/bsd/dhcpcd/dist/LICENSE
U src/external/bsd/dhcpcd/dist/README.md
U src/external/bsd/dhcpcd/dist/src/defs.h
U src/external/bsd/dhcpcd/dist/src/common.c
U src/external/bsd/dhcpcd/dist/src/control.c
C src/external/bsd/dhcpcd/dist/src/dhcpcd.c
U src/external/bsd/dhcpcd/dist/src/duid.c
U src/external/bsd/dhcpcd/dist/src/eloop.c
U src/external/bsd/dhcpcd/dist/src/logerr.c
U src/external/bsd/dhcpcd/dist/src/if.c
C src/external/bsd/dhcpcd/dist/src/if-options.c
U src/external/bsd/dhcpcd/dist/src/sa.c
U src/external/bsd/dhcpcd/dist/src/route.c
U src/external/bsd/dhcpcd/dist/src/dhcp-common.c
C src/external/bsd/dhcpcd/dist/src/script.c
U src/external/bsd/dhcpcd/dist/src/auth.c
U src/external/bsd/dhcpcd/dist/src/if-bsd.c
C src/external/bsd/dhcpcd/dist/src/dhcp.c
U src/external/bsd/dhcpcd/dist/src/ipv4.c
U src/external/bsd/dhcpcd/dist/src/bpf.c
U src/external/bsd/dhcpcd/dist/src/arp.c
U src/external/bsd/dhcpcd/dist/src/ipv4ll.c
C src/external/bsd/dhcpcd/dist/src/ipv6.c
C src/external/bsd/dhcpcd/dist/src/ipv6nd.c
C src/external/bsd/dhcpcd/dist/src/dhcp6.c
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c
C src/external/bsd/dhcpcd/dist/src/privsep.c
U src/external/bsd/dhcpcd/dist/src/privsep-root.c
U src/external/bsd/dhcpcd/dist/src/privsep-control.c
U src/external/bsd/dhcpcd/dist/src/privsep-inet.c
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.c
U src/external/bsd/dhcpcd/dist/src/privsep-bsd.c
U src/external/bsd/dhcpcd/dist/src/common.h
U src/external/bsd/dhcpcd/dist/src/control.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.h
U src/external/bsd/dhcpcd/dist/src/duid.h
U src/external/bsd/dhcpcd/dist/src/eloop.h
U src/external/bsd/dhcpcd/dist/src/logerr.h
U src/external/bsd/dhcpcd/dist/src/if.h
U src/external/bsd/dhcpcd/dist/src/if-options.h
U src/external/bsd/dhcpcd/dist/src/sa.h
U src/external/bsd/dhcpcd/dist/src/route.h
U src/external/bsd/dhcpcd/dist/src/dhcp-common.h
U src/external/bsd/dhcpcd/dist/src/script.h
U src/external/bsd/dhcpcd/dist/src/auth.h
U src/external/bsd/dhcpcd/dist/src/dhcp.h
U src/external/bsd/dhcpcd/dist/src/ipv4.h
U src/external/bsd/dhcpcd/dist/src/bpf.h
U src/external/bsd/dhcpcd/dist/src/arp.h
U src/external/bsd/dhcpcd/dist/src/ipv4ll.h
U src/external/bsd/dhcpcd/dist/src/ipv6.h
U src/external/bsd/dhcpcd/dist/src/ipv6nd.h
U src/external/bsd/dhcpcd/dist/src/dhcp6.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h
U src/external/bsd/dhcpcd/dist/src/privsep.h
U src/external/bsd/dhcpcd/dist/src/privsep-root.h
U src/external/bsd/dhcpcd/dist/src/privsep-control.h
U src/external/bsd/dhcpcd/dist/src/privsep-inet.h
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.h
U src/external/bsd/dhcpcd/dist/src/dev.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
C src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in
U src/external/bsd/dhcpcd/dist/hooks/01-test
U src/external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant
U src/external/bsd/dhcpcd/dist/hooks/15-timezone
C src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf
U src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname
U src/external/bsd/dhcpcd/dist/hooks/30-hostname.in
C src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf
C src/external/bsd/dhcpcd/dist/hooks/50-ypbind.in

12 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jROY:yesterday -jROY src/external/bsd/dhcpcd/dist



CVS commit: src/sys/net

2020-11-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Nov  2 12:14:59 UTC 2020

Modified Files:
src/sys/net: if_bridge.c

Log Message:
bridge: revert prior

It's of little use.
If we need to do this in the future, consider a sysctl to do it for all
interfaces in the bridge and not just the one being added.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/net/if_bridge.c

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

Modified files:

Index: src/sys/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.176 src/sys/net/if_bridge.c:1.177
--- src/sys/net/if_bridge.c:1.176	Sun Sep 27 19:16:28 2020
+++ src/sys/net/if_bridge.c	Mon Nov  2 12:14:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.176 2020/09/27 19:16:28 roy Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.177 2020/11/02 12:14:59 roy Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.176 2020/09/27 19:16:28 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.177 2020/11/02 12:14:59 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -904,13 +904,6 @@ bridge_ioctl_add(struct bridge_softc *sc
 	PSLIST_ENTRY_INIT(bif, bif_next);
 	psref_target_init(>bif_psref, bridge_psref_class);
 
-	/*
-	 * Pretend that the link is down for domains.
-	 * This will detach any addresses assigned to the interface.
-	 */
-	if (ifs->if_link_state != LINK_STATE_DOWN)
-		if_domain_link_state_change(ifs, LINK_STATE_DOWN);
-
 	BRIDGE_LOCK(sc);
 
 	ifs->if_bridge = sc;
@@ -928,13 +921,6 @@ bridge_ioctl_add(struct bridge_softc *sc
 	else
 		bstp_stop(sc);
 
-	/*
-	 * If the link was not initially down then mark any detached addresses
-	 * as tentative and start Duplicate Address Detection for them.
-	 */
-	if (ifs->if_link_state != LINK_STATE_DOWN)
-		if_domain_link_state_change(ifs, ifs->if_link_state);
-
 out:
 	if_put(ifs, );
 	if (error) {



CVS commit: src/doc

2020-11-01 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Nov  1 14:25:48 UTC 2020

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note dhcpcd update


To generate a diff of this commit:
cvs rdiff -u -r1.1757 -r1.1758 src/doc/3RDPARTY
cvs rdiff -u -r1.2750 -r1.2751 src/doc/CHANGES

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.1757 src/doc/3RDPARTY:1.1758
--- src/doc/3RDPARTY:1.1757	Sun Nov  1 11:06:30 2020
+++ src/doc/3RDPARTY	Sun Nov  1 14:25:48 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1757 2020/11/01 11:06:30 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1758 2020/11/01 14:25:48 roy Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -352,12 +352,12 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	9.3.1
-Current Vers:	9.3.1
+Version:	9.3.2
+Current Vers:	9.3.2
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/
-Date:		2020-10-12
+Date:		2020-11-01
 Mailing List: 	dhcpcd-disc...@marples.name
 License:	BSD (2-clause)
 Location:	external/bsd/dhcpcd/dist

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2750 src/doc/CHANGES:1.2751
--- src/doc/CHANGES:1.2750	Thu Oct 22 08:26:00 2020
+++ src/doc/CHANGES	Sun Nov  1 14:25:48 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2750 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2751 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -297,3 +297,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	tzcode: Updated to 2020c. [christos 20201017]
 	ossaudio(3): Added support for the OSSv4 Mixer API [nia 20201017]
 	tzdata updated to 2020d  [kre 20201022]
+	dhcpcd: Update to version 9.3.1 [roy 20201101]



CVS commit: src/external/bsd/dhcpcd/dist/src

2020-11-01 Thread Roy Marples
cp_drop(ifp, "EXPIRE");
+		dhcp_unlink(ifp->ctx, state->leasefile);
+		eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
+		eloop_timeout_add_sec(ifp->ctx->eloop, v6only_time,
+		dhcp_discover, ifp);
+		return;
+	}
+
 	/* Ensure that the address offered is valid */
 	if ((type == 0 || type == DHCP_OFFER || type == DHCP_ACK) &&
 	(bootp->ciaddr == INADDR_ANY || bootp->ciaddr == INADDR_BROADCAST)

Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in:1.8 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in:1.9
--- src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in:1.8	Sun Sep  6 14:55:34 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in	Sun Nov  1 14:24:01 2020
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd September 2, 2020
+.Dd October 30, 2020
 .Dt DHCPCD 8
 .Os
 .Sh NAME
@@ -846,13 +846,5 @@ RFC\ 6603, RFC\ 6704, RFC\ 7217, RFC\ 75
 .Sh AUTHORS
 .An Roy Marples Aq Mt r...@marples.name
 .Sh BUGS
-If
-.Nm
-is running in a
-.Xr chroot 2
-then re-opening the
-.Fl Fl logfile
-from SIGUSR2 may not work.
-.Pp
 Please report them to
 .Lk http://roy.marples.name/projects/dhcpcd

Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.44 src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.45
--- src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.44	Mon Oct 12 14:09:03 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c	Sun Nov  1 14:24:01 2020
@@ -1422,10 +1422,15 @@ dhcpcd_signal_cb(int sig, void *arg)
 		return;
 	case SIGUSR2:
 		loginfox(sigmsg, "SIGUSR2", "reopening log");
-		/* XXX This may not work that well in a chroot */
-		logclose();
+#ifdef PRIVSEP
+		if (IN_PRIVSEP(ctx)) {
+			if (ps_root_logreopen(ctx) == -1)
+logerr("ps_root_logreopen");
+			return;
+		}
+#endif
 		if (logopen(ctx->logfile) == -1)
-			logerr(__func__);
+			logerr("logopen");
 		return;
 	case SIGCHLD:
 		while (waitpid(-1, NULL, WNOHANG) > 0)
@@ -1860,7 +1865,7 @@ main(int argc, char **argv, char **envp)
 	ctx.dhcp6_wfd = -1;
 #endif
 #ifdef PRIVSEP
-	ctx.ps_root_fd = ctx.ps_data_fd = -1;
+	ctx.ps_root_fd = ctx.ps_log_fd = ctx.ps_data_fd = -1;
 	ctx.ps_inet_fd = ctx.ps_control_fd = -1;
 	TAILQ_INIT(_processes);
 #endif
@@ -2328,6 +2333,7 @@ printpidfile:
 	/* We have now forked, setsid, forked once more.
 	 * From this point on, we are the controlling daemon. */
 	ctx.options |= DHCPCD_STARTED;
+	logdebugx("spawned master process on PID %d", getpid());
 	if ((pid = pidfile_lock(ctx.pidfile)) != 0) {
 		logerr("%s: pidfile_lock %d", __func__, pid);
 #ifdef PRIVSEP

Index: src/external/bsd/dhcpcd/dist/src/logerr.c
diff -u src/external/bsd/dhcpcd/dist/src/logerr.c:1.10 src/external/bsd/dhcpcd/dist/src/logerr.c:1.11
--- src/external/bsd/dhcpcd/dist/src/logerr.c:1.10	Mon Oct 12 14:09:03 2020
+++ src/external/bsd/dhcpcd/dist/src/logerr.c	Sun Nov  1 14:24:01 2020
@@ -47,11 +47,16 @@
 #undef LOGERR_TAG
 #endif
 
+/* syslog protocol is 1k message max, RFC 3164 section 4.1 */
+#define LOGERR_SYSLOGBUF	1024 + sizeof(int) + sizeof(pid_t)
+
 #define UNUSED(a)		(void)(a)
 
 struct logctx {
 	char		 log_buf[BUFSIZ];
 	unsigned int	 log_opts;
+	int		 log_fd;
+	pid_t		 log_pid;
 #ifndef SMALL
 	FILE		*log_file;
 #ifdef LOGERR_TAG
@@ -63,9 +68,11 @@ struct logctx {
 static struct logctx _logctx = {
 	/* syslog style, but without the hostname or tag. */
 	.log_opts = LOGERR_LOG | LOGERR_LOG_DATE | LOGERR_LOG_PID,
+	.log_fd = -1,
+	.log_pid = 0,
 };
 
-#if defined(LOGERR_TAG) && defined(__linux__)
+#if defined(__linux__)
 /* Poor man's getprogname(3). */
 static char *_logprog;
 static const char *
@@ -79,9 +86,12 @@ getprogname(void)
 		 * so zero the buffer. */
 		if ((_logprog = calloc(1, PATH_MAX + 1)) == NULL)
 			return NULL;
+		if (readlink("/proc/self/exe", _logprog, PATH_MAX + 1) == -1) {
+			free(_logprog);
+			_logprog = NULL;
+			return NULL;
+		}
 	}
-	if (readlink("/proc/self/exe", _logprog, PATH_MAX + 1) == -1)
-		return NULL;
 	if (_logprog[0] == '[')
 		return NULL;
 	p = strrchr(_logprog, '/');
@@ -147,7 +157,13 @@ vlogprintf_r(struct logctx *ctx, FILE *s
 	log_pid = ((stream == stderr && ctx->log_opts & LOGERR_ERR_PID) ||
 	(stream != stderr && ctx->log_opts & LOGERR_LOG_PID));
 	if (log_pid) {
-		if ((e = fprintf(stream, "[%d]", getpid())) == -1)
+		pid_t pid;
+
+		if (ctx->log_pid == 0)
+			pid = getpid();
+		else
+			pid = ctx->log_pid;
+		if ((e = fprintf(stream, "[%d]", pid)) == -1)
 			return -1;
 		len += e;
 	}
@@ -198,22 +214,37 @@ vlogmessage(int pri, const char *fmt, va
 	struct logctx *ctx = &_logctx;
 	int len = 0;
 
+	if (ctx->log_fd != -1) {
+		char buf[LOGERR_SYSLOGBUF];
+		pid_t pid;
+
+		memcpy(buf, , sizeof(pri));
+		pid = getpid();
+		memcpy(b

CVS import: src/external/bsd/dhcpcd/dist

2020-11-01 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Nov  1 14:23:04 UTC 2020

Update of /cvsroot/src/external/bsd/dhcpcd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv28627

Log Message:
Update to dhcpcd-9.3.2 with the following changes:

 * DHCP: Add support for IPv6-Only Preferred option, RFC 8925.
 * BSD: `LINK_STATE_UNKNOWN` is treated as UP once again
 * privsep: pass logging to the privileged actioneer
 * privsep: allow logfile re-opening to work
 * privsep: close BPF socket on ENXIO
 * privsep: don't leave a BOOTP BPF listener rebooting in non master mode

Status:

Vendor Tag: ROY
Release Tags:   dhcpcd-9_3_2

U src/external/bsd/dhcpcd/dist/LICENSE
U src/external/bsd/dhcpcd/dist/README.md
U src/external/bsd/dhcpcd/dist/src/defs.h
U src/external/bsd/dhcpcd/dist/src/common.c
U src/external/bsd/dhcpcd/dist/src/control.c
C src/external/bsd/dhcpcd/dist/src/dhcpcd.c
U src/external/bsd/dhcpcd/dist/src/duid.c
U src/external/bsd/dhcpcd/dist/src/eloop.c
C src/external/bsd/dhcpcd/dist/src/logerr.c
U src/external/bsd/dhcpcd/dist/src/if.c
U src/external/bsd/dhcpcd/dist/src/if-options.c
U src/external/bsd/dhcpcd/dist/src/sa.c
U src/external/bsd/dhcpcd/dist/src/route.c
U src/external/bsd/dhcpcd/dist/src/dhcp-common.c
U src/external/bsd/dhcpcd/dist/src/script.c
U src/external/bsd/dhcpcd/dist/src/auth.c
U src/external/bsd/dhcpcd/dist/src/if-bsd.c
C src/external/bsd/dhcpcd/dist/src/dhcp.c
U src/external/bsd/dhcpcd/dist/src/ipv4.c
U src/external/bsd/dhcpcd/dist/src/bpf.c
U src/external/bsd/dhcpcd/dist/src/arp.c
U src/external/bsd/dhcpcd/dist/src/ipv4ll.c
U src/external/bsd/dhcpcd/dist/src/ipv6.c
U src/external/bsd/dhcpcd/dist/src/ipv6nd.c
U src/external/bsd/dhcpcd/dist/src/dhcp6.c
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c
C src/external/bsd/dhcpcd/dist/src/privsep.c
U src/external/bsd/dhcpcd/dist/src/privsep-root.c
U src/external/bsd/dhcpcd/dist/src/privsep-control.c
U src/external/bsd/dhcpcd/dist/src/privsep-inet.c
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.c
U src/external/bsd/dhcpcd/dist/src/privsep-bsd.c
U src/external/bsd/dhcpcd/dist/src/common.h
U src/external/bsd/dhcpcd/dist/src/control.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.h
U src/external/bsd/dhcpcd/dist/src/duid.h
U src/external/bsd/dhcpcd/dist/src/eloop.h
U src/external/bsd/dhcpcd/dist/src/logerr.h
U src/external/bsd/dhcpcd/dist/src/if.h
U src/external/bsd/dhcpcd/dist/src/if-options.h
U src/external/bsd/dhcpcd/dist/src/sa.h
U src/external/bsd/dhcpcd/dist/src/route.h
U src/external/bsd/dhcpcd/dist/src/dhcp-common.h
U src/external/bsd/dhcpcd/dist/src/script.h
U src/external/bsd/dhcpcd/dist/src/auth.h
U src/external/bsd/dhcpcd/dist/src/dhcp.h
U src/external/bsd/dhcpcd/dist/src/ipv4.h
U src/external/bsd/dhcpcd/dist/src/bpf.h
U src/external/bsd/dhcpcd/dist/src/arp.h
U src/external/bsd/dhcpcd/dist/src/ipv4ll.h
U src/external/bsd/dhcpcd/dist/src/ipv6.h
U src/external/bsd/dhcpcd/dist/src/ipv6nd.h
U src/external/bsd/dhcpcd/dist/src/dhcp6.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h
U src/external/bsd/dhcpcd/dist/src/privsep.h
U src/external/bsd/dhcpcd/dist/src/privsep-root.h
U src/external/bsd/dhcpcd/dist/src/privsep-control.h
U src/external/bsd/dhcpcd/dist/src/privsep-inet.h
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.h
U src/external/bsd/dhcpcd/dist/src/dev.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
C src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in
U src/external/bsd/dhcpcd/dist/hooks/01-test
U src/external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant
U src/external/bsd/dhcpcd/dist/hooks/15-timezone
U src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf
U src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname
U src/external/bsd/dhcpcd/dist/hooks/30-hostname.in
U src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf
U src/external/bsd/dhcpcd/dist/hooks/50-ypbind.in

5 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jROY:yesterday -jROY src/external/bsd/dhcpcd/dist



CVS commit: src/sys/net

2020-10-25 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Oct 25 08:18:39 UTC 2020

Modified Files:
src/sys/net: if_l2tp.c

Log Message:
l2tp: call if_link_state_change rather then directly setting it.

This allows protocols to do their thing.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/net/if_l2tp.c

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

Modified files:

Index: src/sys/net/if_l2tp.c
diff -u src/sys/net/if_l2tp.c:1.45 src/sys/net/if_l2tp.c:1.46
--- src/sys/net/if_l2tp.c:1.45	Sun Oct 25 08:15:54 2020
+++ src/sys/net/if_l2tp.c	Sun Oct 25 08:18:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_l2tp.c,v 1.45 2020/10/25 08:15:54 roy Exp $	*/
+/*	$NetBSD: if_l2tp.c,v 1.46 2020/10/25 08:18:39 roy Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.45 2020/10/25 08:15:54 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.46 2020/10/25 08:18:39 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -324,6 +324,7 @@ l2tpattach0(struct l2tp_softc *sc)
 	rv = if_attach(>l2tp_ec.ec_if);
 	if (rv != 0)
 		return rv;
+	if_link_state_change(>l2tp_ec.ec_if, LINK_STATE_DOWN);
 	if_alloc_sadl(>l2tp_ec.ec_if);
 	bpf_attach(>l2tp_ec.ec_if, DLT_EN10MB, sizeof(struct ether_header));
 
@@ -1354,6 +1355,7 @@ l2tp_set_state(struct l2tp_softc *sc, in
 {
 	struct ifnet *ifp = >l2tp_ec.ec_if;
 	struct l2tp_variant *nvar;
+	int ostate;
 
 	nvar = kmem_alloc(sizeof(*nvar), KM_SLEEP);
 
@@ -1361,16 +1363,21 @@ l2tp_set_state(struct l2tp_softc *sc, in
 
 	*nvar = *sc->l2tp_var;
 	psref_target_init(>lv_psref, lv_psref_class);
+	ostate = nvar->lv_state;
 	nvar->lv_state = state;
 	l2tp_variant_update(sc, nvar);
+	mutex_exit(>l2tp_lock);
 
-	if (nvar->lv_state == L2TP_STATE_UP) {
-		ifp->if_link_state = LINK_STATE_UP;
-	} else {
-		ifp->if_link_state = LINK_STATE_DOWN;
-	}
+	if (ostate != state) {
+		int lstate;
 
-	mutex_exit(>l2tp_lock);
+		if (state == L2TP_STATE_UP)
+			lstate = LINK_STATE_UP;
+		else
+			lstate = LINK_STATE_DOWN;
+
+		if_link_state_change(ifp, lstate);
+	}
 
 #ifdef NOTYET
 	vlan_linkstate_notify(ifp, ifp->if_link_state);



CVS commit: src/sys/net

2020-10-25 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Oct 25 08:15:54 UTC 2020

Modified Files:
src/sys/net: if_l2tp.c

Log Message:
l2tp: Revert prior

It proves I can't read comments and that if_initialize should not be used.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/net/if_l2tp.c

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

Modified files:

Index: src/sys/net/if_l2tp.c
diff -u src/sys/net/if_l2tp.c:1.44 src/sys/net/if_l2tp.c:1.45
--- src/sys/net/if_l2tp.c:1.44	Thu Oct 15 02:54:10 2020
+++ src/sys/net/if_l2tp.c	Sun Oct 25 08:15:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_l2tp.c,v 1.44 2020/10/15 02:54:10 roy Exp $	*/
+/*	$NetBSD: if_l2tp.c,v 1.45 2020/10/25 08:15:54 roy Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.44 2020/10/15 02:54:10 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.45 2020/10/25 08:15:54 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -321,13 +321,11 @@ l2tpattach0(struct l2tp_softc *sc)
 	 * if_percpuq_enqueue(). However, that causes recursive softnet_lock
 	 * when NET_MPSAFE is not set.
 	 */
-	rv = if_initialize(>l2tp_ec.ec_if);
+	rv = if_attach(>l2tp_ec.ec_if);
 	if (rv != 0)
 		return rv;
-	sc->l2tp_ec.ec_if.if_link_state = LINK_STATE_DOWN;
 	if_alloc_sadl(>l2tp_ec.ec_if);
 	bpf_attach(>l2tp_ec.ec_if, DLT_EN10MB, sizeof(struct ether_header));
-	if_register(>l2tp_ec.ec_if);
 
 	return 0;
 }
@@ -811,7 +809,6 @@ l2tp_ioctl(struct ifnet *ifp, u_long cmd
 
 	case SIOCDIFPHYADDR:
 		l2tp_delete_tunnel(>l2tp_ec.ec_if);
-		if_link_state_change(>l2tp_ec.ec_if, LINK_STATE_DOWN);
 		break;
 
 	case SIOCGIFPSRCADDR:
@@ -1074,8 +1071,6 @@ l2tp_set_tunnel(struct ifnet *ifp, struc
 	if (odst)
 		sockaddr_free(odst);
 	kmem_free(ovar, sizeof(*ovar));
-
-	if_link_state_change(ifp, LINK_STATE_UP);
 	return 0;
 
 error:



CVS commit: src/tests/lib/libcurses/director

2020-10-24 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Oct 24 14:45:06 UTC 2020

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
Remove extra parens


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/tests/lib/libcurses/director/testlang_parse.y

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.18 src/tests/lib/libcurses/director/testlang_parse.y:1.19
--- src/tests/lib/libcurses/director/testlang_parse.y:1.18	Sat Oct 24 04:46:17 2020
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sat Oct 24 14:45:06 2020
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.18 2020/10/24 04:46:17 blymn Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.19 2020/10/24 14:45:06 roy Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -990,7 +990,7 @@ compare_streams(char *filename, bool dis
 
 	int create_check_file = 0;
 
-	if ((check_file_flag == (GEN_CHECK_FILE | FORCE_GEN)))
+	if (check_file_flag == (GEN_CHECK_FILE | FORCE_GEN))
 		create_check_file = 1;
 	else if ((check_fd = open(check_file, O_RDONLY, 0)) < 0){
 		if (check_file_flag & GEN_CHECK_FILE)



CVS commit: src/lib/libossaudio

2020-10-24 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Oct 24 14:43:53 UTC 2020

Modified Files:
src/lib/libossaudio: ossaudio.c

Log Message:
libossaudio: return newfd here as we return retval elsewhere


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/lib/libossaudio/ossaudio.c

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

Modified files:

Index: src/lib/libossaudio/ossaudio.c
diff -u src/lib/libossaudio/ossaudio.c:1.57 src/lib/libossaudio/ossaudio.c:1.58
--- src/lib/libossaudio/ossaudio.c:1.57	Fri Oct 23 12:13:04 2020
+++ src/lib/libossaudio/ossaudio.c	Sat Oct 24 14:43:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.57 2020/10/23 12:13:04 wiz Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.58 2020/10/24 14:43:53 roy Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: ossaudio.c,v 1.57 2020/10/23 12:13:04 wiz Exp $");
+__RCSID("$NetBSD: ossaudio.c,v 1.58 2020/10/24 14:43:53 roy Exp $");
 
 /*
  * This is an Open Sound System compatibility layer, which provides
@@ -1158,7 +1158,7 @@ mixer_oss4_ioctl(int fd, unsigned long c
 			"/dev/audio%d", cardinfo->card);
 			newfd = open(devname, O_RDONLY);
 			if (newfd < 0)
-return retval;
+return newfd;
 		} else {
 			newfd = fd;
 		}



CVS commit: src/sys

2020-10-20 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Oct 20 18:17:58 UTC 2020

Modified Files:
src/sys/arch/mac68k/dev: if_mc.c
src/sys/arch/macppc/dev: am79c950.c
src/sys/dev/ic: am7990.c am79900.c

Log Message:
le(4): add link status change reporting to drivers which support it

Reviewed by thorpej@
Tested by martin@


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/mac68k/dev/if_mc.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/macppc/dev/am79c950.c
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/ic/am7990.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ic/am79900.c

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

Modified files:

Index: src/sys/arch/mac68k/dev/if_mc.c
diff -u src/sys/arch/mac68k/dev/if_mc.c:1.55 src/sys/arch/mac68k/dev/if_mc.c:1.56
--- src/sys/arch/mac68k/dev/if_mc.c:1.55	Thu Jan 30 06:30:52 2020
+++ src/sys/arch/mac68k/dev/if_mc.c	Tue Oct 20 18:17:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mc.c,v 1.55 2020/01/30 06:30:52 martin Exp $	*/
+/*	$NetBSD: if_mc.c,v 1.56 2020/10/20 18:17:58 roy Exp $	*/
 
 /*-
  * Copyright (c) 1997 David Huang 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.55 2020/01/30 06:30:52 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.56 2020/10/20 18:17:58 roy Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -455,6 +455,7 @@ struct mc_softc *sc = arg;
 	 * Pretend we have carrier; if we don't this will be cleared
 	 * shortly.
 	 */
+	const int ocarrier = sc->sc_havecarrier;
 	sc->sc_havecarrier = 1;
 
 	if (ir & XMTINT)
@@ -462,6 +463,10 @@ struct mc_softc *sc = arg;
 
 	if (ir & RCVINT)
 		mc_rint(sc);
+
+	if (sc->sc_havecarrier != ocarrier)
+		if_link_state_change(>sc_if,
+		sc->sc_havecarrier ? LINK_STATE_UP : LINK_STATE_DOWN);
 }
 
 integrate void

Index: src/sys/arch/macppc/dev/am79c950.c
diff -u src/sys/arch/macppc/dev/am79c950.c:1.49 src/sys/arch/macppc/dev/am79c950.c:1.50
--- src/sys/arch/macppc/dev/am79c950.c:1.49	Tue Feb  4 13:47:34 2020
+++ src/sys/arch/macppc/dev/am79c950.c	Tue Oct 20 18:17:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: am79c950.c,v 1.49 2020/02/04 13:47:34 martin Exp $	*/
+/*	$NetBSD: am79c950.c,v 1.50 2020/10/20 18:17:58 roy Exp $	*/
 
 /*-
  * Copyright (c) 1997 David Huang 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.49 2020/02/04 13:47:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.50 2020/10/20 18:17:58 roy Exp $");
 
 #include "opt_inet.h"
 
@@ -458,6 +458,7 @@ mcintr(void *arg)
 	 * Pretend we have carrier; if we don't this will be cleared
 	 * shortly.
 	 */
+	const int ocarrier = sc->sc_havecarrier;
 	sc->sc_havecarrier = 1;
 
 	if (ir & XMTINT)
@@ -466,6 +467,10 @@ mcintr(void *arg)
 	if (ir & RCVINT)
 		mc_rint(sc);
 
+	if (sc->sc_havecarrier != ocarrier)
+		if_link_state_change(>sc_if,
+		sc->sc_havecarrier ? LINK_STATE_UP : LINK_STATE_DOWN);
+
 	return 1;
 }
 

Index: src/sys/dev/ic/am7990.c
diff -u src/sys/dev/ic/am7990.c:1.82 src/sys/dev/ic/am7990.c:1.83
--- src/sys/dev/ic/am7990.c:1.82	Thu Mar 19 02:31:28 2020
+++ src/sys/dev/ic/am7990.c	Tue Oct 20 18:17:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: am7990.c,v 1.82 2020/03/19 02:31:28 thorpej Exp $	*/
+/*	$NetBSD: am7990.c,v 1.83 2020/10/20 18:17:58 roy Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: am7990.c,v 1.82 2020/03/19 02:31:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am7990.c,v 1.83 2020/10/20 18:17:58 roy Exp $");
 
 #include 
 #include 
@@ -435,6 +435,7 @@ am7990_intr(void *arg)
 	 * Pretend we have carrier; if we don't this will be cleared
 	 * shortly.
 	 */
+	const int ocarrier = sc->sc_havecarrier;
 	sc->sc_havecarrier = 1;
 
 	if (isr & LE_C0_RINT)
@@ -442,6 +443,10 @@ am7990_intr(void *arg)
 	if (isr & LE_C0_TINT)
 		am7990_tint(sc);
 
+	if (sc->sc_havecarrier != ocarrier)
+		if_link_state_change(ifp,
+		sc->sc_havecarrier ? LINK_STATE_UP : LINK_STATE_DOWN);
+
 	rnd_add_uint32(>rnd_source, isr);
 
 	return (1);

Index: src/sys/dev/ic/am79900.c
diff -u src/sys/dev/ic/am79900.c:1.30 src/sys/dev/ic/am79900.c:1.31
--- src/sys/dev/ic/am79900.c:1.30	Thu Mar 19 02:31:28 2020
+++ src/sys/dev/ic/am79900.c	Tue Oct 20 18:17:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: am79900.c,v 1.30 2020/03/19 02:31:28 thorpej Exp $	*/
+/*	$NetBSD: am79900.c,v 1.31 2020/10/20 18:17:58 roy Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: am79900.c,v 1.30 2020/03/19 02:31:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am79900.c,v 1.31 2020/10/20 18:17:58 roy Exp $");
 
 #include 
 #include 
@@ -456,6 +456,7 @@ am79900_intr(void *arg)
 	 * Pretend we have carrier; if we don't this will be cleared
 	 * shortly.
 	 */
+	const int ocarrier = sc->sc_havecarrier;
 	sc->sc_havecarrier = 1;
 
 	if (isr & LE_C0_RINT)
@@ -463,6 

CVS commit: src/tests/net/if_wg

2020-10-16 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Oct 16 16:17:23 UTC 2020

Modified Files:
src/tests/net/if_wg: t_basic.sh t_misc.sh

Log Message:
wg: Fix tests by sprinkling ifconfig -w 10

So protocols have time to finish setup.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_wg/t_basic.sh
cvs rdiff -u -r1.5 -r1.6 src/tests/net/if_wg/t_misc.sh

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

Modified files:

Index: src/tests/net/if_wg/t_basic.sh
diff -u src/tests/net/if_wg/t_basic.sh:1.1 src/tests/net/if_wg/t_basic.sh:1.2
--- src/tests/net/if_wg/t_basic.sh:1.1	Wed Aug 26 16:03:42 2020
+++ src/tests/net/if_wg/t_basic.sh	Fri Oct 16 16:17:23 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: t_basic.sh,v 1.1 2020/08/26 16:03:42 riastradh Exp $
+#	$NetBSD: t_basic.sh,v 1.2 2020/10/16 16:17:23 roy Exp $
 #
 # Copyright (c) 2018 Ryota Ozaki 
 # All rights reserved.
@@ -92,16 +92,14 @@ test_common()
 	export RUMP_SERVER=$SOCK_LOCAL
 	setup_common shmif0 $outer_proto $ip_local $outer_prefix
 	setup_wg_common wg0 $inner_proto $ip_wg_local $inner_prefix $port "$key_priv_local"
+	add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/$inner_prefixall
+	$ifconfig -w 10
 
 	export RUMP_SERVER=$SOCK_PEER
 	setup_common shmif0 $outer_proto $ip_peer $outer_prefix
 	setup_wg_common wg0 $inner_proto $ip_wg_peer $inner_prefix $port "$key_priv_peer"
-
-	export RUMP_SERVER=$SOCK_LOCAL
-	add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/$inner_prefixall
-
-	export RUMP_SERVER=$SOCK_PEER
 	add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/$inner_prefixall
+	$ifconfig -w 10
 
 	if [ $type = basic ]; then
 		export RUMP_SERVER=$SOCK_LOCAL
@@ -327,24 +325,21 @@ wg_multiple_interfaces_body()
 	setup_common shmif1 inet $ip_local2 24
 	setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local"
 	setup_wg_common wg1 inet $ip_wg_local2 24 $port2 "$key_priv_local"
+	add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
+	add_peer wg1 peer0 $key_pub_peer2 $ip_peer2:$port2 $ip_wg_peer2/32
+	$ifconfig -w 10
 
 	export RUMP_SERVER=$SOCK_PEER
 	setup_common shmif0 inet $ip_peer 24
 	setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer"
+	add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
+	$ifconfig -w 10
 
 	export RUMP_SERVER=$SOCK_PEER2
 	setup_common shmif0 inet $ip_peer2 24
 	setup_wg_common wg0 inet $ip_wg_peer2 24 $port2 "$key_priv_peer2"
-
-	export RUMP_SERVER=$SOCK_LOCAL
-	add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
-	add_peer wg1 peer0 $key_pub_peer2 $ip_peer2:$port2 $ip_wg_peer2/32
-
-	export RUMP_SERVER=$SOCK_PEER
-	add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
-
-	export RUMP_SERVER=$SOCK_PEER2
 	add_peer wg0 peer0 $key_pub_local $ip_local2:$port2 $ip_wg_local2/32
+	$ifconfig -w 10
 
 	export RUMP_SERVER=$SOCK_LOCAL
 
@@ -415,24 +410,21 @@ wg_multiple_peers_body()
 	export RUMP_SERVER=$SOCK_LOCAL
 	setup_common shmif0 inet $ip_local 24
 	setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local"
+	add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
+	add_peer wg0 peer1 $key_pub_peer2 $ip_peer2:$port $ip_wg_peer2/32
+	$ifconfig -w 10
 
 	export RUMP_SERVER=$SOCK_PEER
 	setup_common shmif0 inet $ip_peer 24
 	setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer"
+	add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
+	$ifconfig -w 10
 
 	export RUMP_SERVER=$SOCK_PEER2
 	setup_common shmif0 inet $ip_peer2 24
 	setup_wg_common wg0 inet $ip_wg_peer2 24 $port "$key_priv_peer2"
-
-	export RUMP_SERVER=$SOCK_LOCAL
-	add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
-	add_peer wg0 peer1 $key_pub_peer2 $ip_peer2:$port $ip_wg_peer2/32
-
-	export RUMP_SERVER=$SOCK_PEER
-	add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
-
-	export RUMP_SERVER=$SOCK_PEER2
 	add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
+	$ifconfig -w 10
 
 	export RUMP_SERVER=$SOCK_LOCAL
 

Index: src/tests/net/if_wg/t_misc.sh
diff -u src/tests/net/if_wg/t_misc.sh:1.5 src/tests/net/if_wg/t_misc.sh:1.6
--- src/tests/net/if_wg/t_misc.sh:1.5	Mon Aug 31 20:32:58 2020
+++ src/tests/net/if_wg/t_misc.sh	Fri Oct 16 16:17:23 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: t_misc.sh,v 1.5 2020/08/31 20:32:58 riastradh Exp $
+#	$NetBSD: t_misc.sh,v 1.6 2020/10/16 16:17:23 roy Exp $
 #
 # Copyright (c) 2018 Ryota Ozaki 
 # All rights reserved.
@@ -65,16 +65,14 @@ wg_rekey_body()
 	export RUMP_SERVER=$SOCK_LOCAL
 	setup_common shmif0 inet $ip_local 24
 	setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local"
+	add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
+	$fconfig -w 10
 
 	export RUMP_SERVER=$SOCK_PEER
 	setup_common shmif0 inet $ip_peer 24
 	setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer"
-
-	export RUMP_SERVER=$SOCK_LOCAL
-	add_peer wg0 peer0 $key_pub_peer $ip_peer:$port 

CVS commit: src/sys/net

2020-10-15 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Oct 15 10:20:44 UTC 2020

Modified Files:
src/sys/net: if.c if.h

Log Message:
net: remove IFEF_NO_LINK_STATE_CHANGE

This flag was only set for virtual interfaces.
All virtual interfaces have a means of knowing if they are going to work
or not and as such now support link state changes.

If we want this flag back, it should be used as an indicator that
the interfaces does not support link state changes that userland can use
so it can make a decision on what to do when the link state is UNKNOWN.


To generate a diff of this commit:
cvs rdiff -u -r1.483 -r1.484 src/sys/net/if.c
cvs rdiff -u -r1.288 -r1.289 src/sys/net/if.h

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

Modified files:

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.483 src/sys/net/if.c:1.484
--- src/sys/net/if.c:1.483	Sun Sep 27 19:16:28 2020
+++ src/sys/net/if.c	Thu Oct 15 10:20:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.483 2020/09/27 19:16:28 roy Exp $	*/
+/*	$NetBSD: if.c,v 1.484 2020/10/15 10:20:44 roy Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.483 2020/09/27 19:16:28 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.484 2020/10/15 10:20:44 roy Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2277,10 +2277,6 @@ if_link_state_change(struct ifnet *ifp, 
 {
 	int idx;
 
-	KASSERTMSG(if_is_link_state_changeable(ifp),
-	"%s: IFEF_NO_LINK_STATE_CHANGE must not be set, but if_extflags=0x%x",
-	ifp->if_xname, ifp->if_extflags);
-
 	/* Ensure change is to a valid state */
 	switch (link_state) {
 	case LINK_STATE_UNKNOWN:	/* FALLTHROUGH */

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.288 src/sys/net/if.h:1.289
--- src/sys/net/if.h:1.288	Sun Sep 27 19:16:28 2020
+++ src/sys/net/if.h	Thu Oct 15 10:20:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.288 2020/09/27 19:16:28 roy Exp $	*/
+/*	$NetBSD: if.h,v 1.289 2020/10/15 10:20:44 roy Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -457,7 +457,6 @@ typedef struct ifnet {
 #define	IFF_MULTICAST	0x8000		/* supports multicast */
 
 #define	IFEF_MPSAFE			__BIT(0)	/* handlers can run in parallel (see below) */
-#define	IFEF_NO_LINK_STATE_CHANGE	__BIT(1)	/* doesn't use link state interrupts */
 
 /*
  * The guidelines for converting an interface to IFEF_MPSAFE are as follows
@@ -537,13 +536,6 @@ if_start_lock(struct ifnet *ifp)
 	}
 }
 
-static __inline bool
-if_is_link_state_changeable(struct ifnet *ifp)
-{
-
-	return ((ifp->if_extflags & IFEF_NO_LINK_STATE_CHANGE) == 0);
-}
-
 #define KERNEL_LOCK_IF_IFP_MPSAFE(ifp)	\
 	do { if (if_is_mpsafe(ifp)) { KERNEL_LOCK(1, NULL); } } while (0)
 #define KERNEL_UNLOCK_IF_IFP_MPSAFE(ifp)\



CVS commit: src/sys/net

2020-10-15 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Oct 15 10:09:50 UTC 2020

Modified Files:
src/sys/net: if_wg.c

Log Message:
wg: with no peers, the link status is DOWN, otherwise UP

This mirrors the recent changes to gif(4) where the link is UP when a
tunnel is set, otherwise DOWN.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/net/if_wg.c

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

Modified files:

Index: src/sys/net/if_wg.c
diff -u src/sys/net/if_wg.c:1.60 src/sys/net/if_wg.c:1.61
--- src/sys/net/if_wg.c:1.60	Mon Sep 14 04:57:20 2020
+++ src/sys/net/if_wg.c	Thu Oct 15 10:09:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wg.c,v 1.60 2020/09/14 04:57:20 riastradh Exp $	*/
+/*	$NetBSD: if_wg.c,v 1.61 2020/10/15 10:09:49 roy Exp $	*/
 
 /*
  * Copyright (C) Ryota Ozaki 
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.60 2020/09/14 04:57:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.61 2020/10/15 10:09:49 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq_enabled.h"
@@ -3509,6 +3509,8 @@ wg_destroy_peer_name(struct wg_softc *wg
 		garbage_bypubkey = thmap_stage_gc(wg->wg_peers_bypubkey);
 		WG_PEER_WRITER_REMOVE(wgp);
 		wg->wg_npeers--;
+		if (wg->wg_npeers == 0)
+			if_link_state_change(>wg_if, LINK_STATE_DOWN);
 		mutex_enter(wgp->wgp_lock);
 		pserialize_perform(wgp->wgp_psz);
 		mutex_exit(wgp->wgp_lock);
@@ -3536,8 +3538,7 @@ wg_if_attach(struct wg_softc *wg)
 	wg->wg_if.if_addrlen = 0;
 	wg->wg_if.if_mtu = WG_MTU;
 	wg->wg_if.if_flags = IFF_MULTICAST;
-	wg->wg_if.if_extflags = IFEF_NO_LINK_STATE_CHANGE;
-	wg->wg_if.if_extflags |= IFEF_MPSAFE;
+	wg->wg_if.if_extflags = IFEF_MPSAFE;
 	wg->wg_if.if_ioctl = wg_ioctl;
 	wg->wg_if.if_output = wg_output;
 	wg->wg_if.if_init = wg_init;
@@ -3556,6 +3557,7 @@ wg_if_attach(struct wg_softc *wg)
 	if (error != 0)
 		return error;
 
+	wg->wg_if.if_link_state = LINK_STATE_DOWN;
 	if_alloc_sadl(>wg_if);
 	if_register(>wg_if);
 
@@ -4381,6 +4383,8 @@ wg_ioctl_add_peer(struct wg_softc *wg, s
 	wg->wg_npeers++;
 	mutex_exit(wg->wg_lock);
 
+	if_link_state_change(>wg_if, LINK_STATE_UP);
+
 out:
 	kmem_free(buf, ifd->ifd_len + 1);
 	return error;



CVS commit: src/sys/net

2020-10-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Oct 15 02:54:10 UTC 2020

Modified Files:
src/sys/net: if_l2tp.c

Log Message:
l2tp: Set the link state UP if we have a tunnel, otherwise DOWN.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/net/if_l2tp.c

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

Modified files:

Index: src/sys/net/if_l2tp.c
diff -u src/sys/net/if_l2tp.c:1.43 src/sys/net/if_l2tp.c:1.44
--- src/sys/net/if_l2tp.c:1.43	Sat Feb  1 12:54:50 2020
+++ src/sys/net/if_l2tp.c	Thu Oct 15 02:54:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_l2tp.c,v 1.43 2020/02/01 12:54:50 riastradh Exp $	*/
+/*	$NetBSD: if_l2tp.c,v 1.44 2020/10/15 02:54:10 roy Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.43 2020/02/01 12:54:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.44 2020/10/15 02:54:10 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -286,9 +286,8 @@ l2tpattach0(struct l2tp_softc *sc)
 	sc->l2tp_ec.ec_if.if_addrlen = 0;
 	sc->l2tp_ec.ec_if.if_mtu= L2TP_MTU;
 	sc->l2tp_ec.ec_if.if_flags  = IFF_POINTOPOINT|IFF_MULTICAST|IFF_SIMPLEX;
-	sc->l2tp_ec.ec_if.if_extflags = IFEF_NO_LINK_STATE_CHANGE;
 #ifdef NET_MPSAFE
-	sc->l2tp_ec.ec_if.if_extflags |= IFEF_MPSAFE;
+	sc->l2tp_ec.ec_if.if_extflags = IFEF_MPSAFE;
 #endif
 	sc->l2tp_ec.ec_if.if_ioctl  = l2tp_ioctl;
 	sc->l2tp_ec.ec_if.if_output = l2tp_output;
@@ -322,11 +321,13 @@ l2tpattach0(struct l2tp_softc *sc)
 	 * if_percpuq_enqueue(). However, that causes recursive softnet_lock
 	 * when NET_MPSAFE is not set.
 	 */
-	rv = if_attach(>l2tp_ec.ec_if);
+	rv = if_initialize(>l2tp_ec.ec_if);
 	if (rv != 0)
 		return rv;
+	sc->l2tp_ec.ec_if.if_link_state = LINK_STATE_DOWN;
 	if_alloc_sadl(>l2tp_ec.ec_if);
 	bpf_attach(>l2tp_ec.ec_if, DLT_EN10MB, sizeof(struct ether_header));
+	if_register(>l2tp_ec.ec_if);
 
 	return 0;
 }
@@ -810,6 +811,7 @@ l2tp_ioctl(struct ifnet *ifp, u_long cmd
 
 	case SIOCDIFPHYADDR:
 		l2tp_delete_tunnel(>l2tp_ec.ec_if);
+		if_link_state_change(>l2tp_ec.ec_if, LINK_STATE_DOWN);
 		break;
 
 	case SIOCGIFPSRCADDR:
@@ -1073,6 +1075,7 @@ l2tp_set_tunnel(struct ifnet *ifp, struc
 		sockaddr_free(odst);
 	kmem_free(ovar, sizeof(*ovar));
 
+	if_link_state_change(ifp, LINK_STATE_UP);
 	return 0;
 
 error:



CVS commit: src/sys/net

2020-10-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Oct 14 18:48:05 UTC 2020

Modified Files:
src/sys/net: if_ipsec.c

Log Message:
ipsecif: Set the link state UP if we have a tunnel, otherwise DOWN.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/net/if_ipsec.c

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

Modified files:

Index: src/sys/net/if_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.29 src/sys/net/if_ipsec.c:1.30
--- src/sys/net/if_ipsec.c:1.29	Fri Mar 13 02:43:31 2020
+++ src/sys/net/if_ipsec.c	Wed Oct 14 18:48:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.29 2020/03/13 02:43:31 knakahara Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.30 2020/10/14 18:48:05 roy Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.29 2020/03/13 02:43:31 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.30 2020/10/14 18:48:05 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -336,7 +336,7 @@ if_ipsec_attach0(struct ipsec_softc *sc)
 	sc->ipsec_if.if_flags  = IFF_POINTOPOINT | IFF_MULTICAST;
 	/* set ipsec(4) specific default flags. */
 	sc->ipsec_if.if_flags  |= IFF_FWD_IPV6;
-	sc->ipsec_if.if_extflags = IFEF_NO_LINK_STATE_CHANGE | IFEF_MPSAFE;
+	sc->ipsec_if.if_extflags = IFEF_MPSAFE;
 	sc->ipsec_if.if_ioctl  = if_ipsec_ioctl;
 	sc->ipsec_if.if_output = if_ipsec_output;
 	sc->ipsec_if.if_type   = IFT_IPSEC;
@@ -344,6 +344,7 @@ if_ipsec_attach0(struct ipsec_softc *sc)
 	sc->ipsec_if.if_softc  = sc;
 	IFQ_SET_READY(>ipsec_if.if_snd);
 	if_initialize(>ipsec_if);
+	sc->ipsec_if.if_link_state = LINK_STATE_DOWN;
 	if_alloc_sadl(>ipsec_if);
 	bpf_attach(>ipsec_if, DLT_NULL, sizeof(u_int));
 	if_register(>ipsec_if);
@@ -774,12 +775,14 @@ if_ipsec_ioctl(struct ifnet *ifp, u_long
 		error = if_ipsec_set_tunnel(>ipsec_if, src, dst);
 		if (error)
 			goto bad;
+		if_link_state_change(>ipsec_if, LINK_STATE_UP);
 		curlwp_bindx(bound);
 		break;
 
 	case SIOCDIFPHYADDR:
 		bound = curlwp_bind();
 		if_ipsec_delete_tunnel(>ipsec_if);
+		if_link_state_change(>ipsec_if, LINK_STATE_DOWN);
 		curlwp_bindx(bound);
 		break;
 



CVS commit: src/sys/net

2020-10-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Oct 14 16:10:32 UTC 2020

Modified Files:
src/sys/net: if_loop.c

Log Message:
loop: set LINK_STATE_UP a touch earlier


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/net/if_loop.c

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

Modified files:

Index: src/sys/net/if_loop.c
diff -u src/sys/net/if_loop.c:1.111 src/sys/net/if_loop.c:1.112
--- src/sys/net/if_loop.c:1.111	Wed Oct 14 15:55:49 2020
+++ src/sys/net/if_loop.c	Wed Oct 14 16:10:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_loop.c,v 1.111 2020/10/14 15:55:49 roy Exp $	*/
+/*	$NetBSD: if_loop.c,v 1.112 2020/10/14 16:10:32 roy Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.111 2020/10/14 15:55:49 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.112 2020/10/14 16:10:32 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -203,6 +203,7 @@ loop_clone_create(struct if_clone *ifc, 
 		if_free(ifp);
 		return rv;
 	}
+	ifp->if_link_state = LINK_STATE_UP;
 	if_alloc_sadl(ifp);
 	bpf_attach(ifp, DLT_NULL, sizeof(u_int));
 #ifdef MBUFTRACE
@@ -214,7 +215,6 @@ loop_clone_create(struct if_clone *ifc, 
 #endif
 
 	ifp->if_flags |= IFF_RUNNING;
-	ifp->if_link_state = LINK_STATE_UP;
 	if_register(ifp);
 
 	return (0);



CVS commit: src/sys/net

2020-10-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Oct 14 15:55:49 UTC 2020

Modified Files:
src/sys/net: if_loop.c

Log Message:
loop: this interface's link state cannot be anything other than UP

Let's not pretend it's UNKNOWN anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/net/if_loop.c

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

Modified files:

Index: src/sys/net/if_loop.c
diff -u src/sys/net/if_loop.c:1.110 src/sys/net/if_loop.c:1.111
--- src/sys/net/if_loop.c:1.110	Wed Jan 29 04:18:34 2020
+++ src/sys/net/if_loop.c	Wed Oct 14 15:55:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_loop.c,v 1.110 2020/01/29 04:18:34 thorpej Exp $	*/
+/*	$NetBSD: if_loop.c,v 1.111 2020/10/14 15:55:49 roy Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.110 2020/01/29 04:18:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.111 2020/10/14 15:55:49 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -183,9 +183,8 @@ loop_clone_create(struct if_clone *ifc, 
 
 	ifp->if_mtu = LOMTU;
 	ifp->if_flags = IFF_LOOPBACK | IFF_MULTICAST;
-	ifp->if_extflags = IFEF_NO_LINK_STATE_CHANGE;
 #ifdef NET_MPSAFE
-	ifp->if_extflags |= IFEF_MPSAFE;
+	ifp->if_extflags = IFEF_MPSAFE;
 #endif
 	ifp->if_ioctl = loioctl;
 	ifp->if_output = looutput;
@@ -199,7 +198,7 @@ loop_clone_create(struct if_clone *ifc, 
 	IFQ_SET_READY(>if_snd);
 	if (unit == 0)
 		lo0ifp = ifp;
-	rv = if_attach(ifp);
+	rv = if_initialize(ifp);
 	if (rv != 0) {
 		if_free(ifp);
 		return rv;
@@ -215,6 +214,8 @@ loop_clone_create(struct if_clone *ifc, 
 #endif
 
 	ifp->if_flags |= IFF_RUNNING;
+	ifp->if_link_state = LINK_STATE_UP;
+	if_register(ifp);
 
 	return (0);
 }



CVS commit: src/sys/net

2020-10-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Oct 14 15:22:17 UTC 2020

Modified Files:
src/sys/net: if_gif.c

Log Message:
gif: Set the link state UP if we have a tunnel, otherwise DOWN.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/net/if_gif.c

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

Modified files:

Index: src/sys/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.153 src/sys/net/if_gif.c:1.154
--- src/sys/net/if_gif.c:1.153	Mon Mar 30 11:57:50 2020
+++ src/sys/net/if_gif.c	Wed Oct 14 15:22:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.153 2020/03/30 11:57:50 christos Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.154 2020/10/14 15:22:17 roy Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.153 2020/03/30 11:57:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.154 2020/10/14 15:22:17 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -384,7 +384,6 @@ gifattach0(struct gif_softc *sc)
 	sc->gif_if.if_addrlen = 0;
 	sc->gif_if.if_mtu= GIF_MTU;
 	sc->gif_if.if_flags  = IFF_POINTOPOINT | IFF_MULTICAST;
-	sc->gif_if.if_extflags  = IFEF_NO_LINK_STATE_CHANGE;
 #ifdef GIF_MPSAFE
 	sc->gif_if.if_extflags  |= IFEF_MPSAFE;
 #endif
@@ -400,6 +399,7 @@ gifattach0(struct gif_softc *sc)
 	if (rv != 0)
 		return rv;
 
+	sc->gif_if.if_link_state = LINK_STATE_DOWN;
 	if_alloc_sadl(>gif_if);
 	bpf_attach(>gif_if, DLT_NULL, sizeof(u_int));
 	if_register(>gif_if);
@@ -848,19 +848,24 @@ gif_ioctl(struct ifnet *ifp, u_long cmd,
 			/* checks done in the above */
 			break;
 		}
+
 		/*
 		 * calls gif_getref_variant() for other softcs to check
 		 * address pair duplicattion
 		 */
 		bound = curlwp_bind();
 		error = gif_set_tunnel(>gif_if, src, dst);
+		if (error == 0)
+			if_link_state_change(>gif_if, LINK_STATE_UP);
 		curlwp_bindx(bound);
+
 		break;
 
 #ifdef SIOCDIFPHYADDR
 	case SIOCDIFPHYADDR:
 		bound = curlwp_bind();
 		gif_delete_tunnel(>gif_if);
+		if_link_state_change(>gif_if, LINK_STATE_DOWN);
 		curlwp_bindx(bound);
 		break;
 #endif



CVS commit: src/sys/netinet

2020-10-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Oct 14 13:43:56 UTC 2020

Modified Files:
src/sys/netinet: ip_carp.c

Log Message:
carp: Don't set a link level address if vhid == -1

Link level address for carp is dervied from vhid.
Until vhid is set, carp is useless, so don't give it a link level address
until a vhid is set.

This fixes recent test case breakage where carp was fixed to actually
print the ethernet address set by default. Note that neither carp nor
the test case itself was actually broken as the error is the common
ATF net code assuming that a cloned interface's link level address is
unique upon creation.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/netinet/ip_carp.c

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

Modified files:

Index: src/sys/netinet/ip_carp.c
diff -u src/sys/netinet/ip_carp.c:1.113 src/sys/netinet/ip_carp.c:1.114
--- src/sys/netinet/ip_carp.c:1.113	Mon Oct 12 15:18:48 2020
+++ src/sys/netinet/ip_carp.c	Wed Oct 14 13:43:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_carp.c,v 1.113 2020/10/12 15:18:48 roy Exp $	*/
+/*	$NetBSD: ip_carp.c,v 1.114 2020/10/14 13:43:56 roy Exp $	*/
 /*	$OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $	*/
 
 /*
@@ -33,7 +33,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.113 2020/10/12 15:18:48 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.114 2020/10/14 13:43:56 roy Exp $");
 
 /*
  * TODO:
@@ -878,7 +878,7 @@ carp_clone_create(struct if_clone *ifc, 
 	IFQ_SET_MAXLEN(>if_snd, ifqmaxlen);
 	IFQ_SET_READY(>if_snd);
 	rv = if_initialize(ifp);
-	if (rv != 0) {	
+	if (rv != 0) {
 		callout_destroy(>sc_ad_tmo);
 		callout_destroy(>sc_md_tmo);
 		callout_destroy(>sc_md6_tmo);
@@ -1733,7 +1733,15 @@ carp_set_ifp(struct carp_softc *sc, stru
 static void
 carp_set_enaddr(struct carp_softc *sc)
 {
+	struct ifnet *ifp = >sc_if;
 	uint8_t enaddr[ETHER_ADDR_LEN];
+
+	if (sc->sc_vhid == -1) {
+		ifp->if_addrlen = 0;
+		if_alloc_sadl(ifp);
+		return;
+	}
+
 	if (sc->sc_carpdev && sc->sc_carpdev->if_type == IFT_ISO88025) {
 		enaddr[0] = 3;
 		enaddr[1] = 0;
@@ -1749,7 +1757,8 @@ carp_set_enaddr(struct carp_softc *sc)
 		enaddr[4] = 1;
 		enaddr[5] = sc->sc_vhid;
 	}
-	if_set_sadl(>sc_if, enaddr, sizeof(enaddr), false);
+
+	if_set_sadl(ifp, enaddr, sizeof(enaddr), false);
 }
 
 #if 0



CVS commit: src/sbin/ifconfig

2020-10-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Oct 14 13:37:14 UTC 2020

Modified Files:
src/sbin/ifconfig: ifconfig.c media.c media.h

Log Message:
ifconfig: go back to using direct ioctls rather than data from getifaddrs

AF_LINK may not be the first address returned for the interface.
Technically, it *might* not even exist on the interface even though
other families do.
This is likely a driver bug if this really is the case though.

As such it's just easier to use direct ioctls rather than thump around
getifaddrs results. As it stands, the code makes a lot of getifaddrs
calls anyway, so an extra ioctl or two won't break the bank.


To generate a diff of this commit:
cvs rdiff -u -r1.247 -r1.248 src/sbin/ifconfig/ifconfig.c
cvs rdiff -u -r1.12 -r1.13 src/sbin/ifconfig/media.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/ifconfig/media.h

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

Modified files:

Index: src/sbin/ifconfig/ifconfig.c
diff -u src/sbin/ifconfig/ifconfig.c:1.247 src/sbin/ifconfig/ifconfig.c:1.248
--- src/sbin/ifconfig/ifconfig.c:1.247	Mon Sep 28 13:50:22 2020
+++ src/sbin/ifconfig/ifconfig.c	Wed Oct 14 13:37:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ifconfig.c,v 1.247 2020/09/28 13:50:22 roy Exp $	*/
+/*	$NetBSD: ifconfig.c,v 1.248 2020/10/14 13:37:14 roy Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1983, 1993\
  The Regents of the University of California.  All rights reserved.");
-__RCSID("$NetBSD: ifconfig.c,v 1.247 2020/09/28 13:50:22 roy Exp $");
+__RCSID("$NetBSD: ifconfig.c,v 1.248 2020/10/14 13:37:14 roy Exp $");
 #endif /* not lint */
 
 #include 
@@ -135,8 +135,7 @@ static int setlinkstr(prop_dictionary_t,
 static int unsetlinkstr(prop_dictionary_t, prop_dictionary_t);
 static int setifdescr(prop_dictionary_t, prop_dictionary_t);
 static int unsetifdescr(prop_dictionary_t, prop_dictionary_t);
-static void status(const struct sockaddr_dl *, const void *,
-prop_dictionary_t, prop_dictionary_t);
+static void status(prop_dictionary_t, prop_dictionary_t);
 __dead static void usage(void);
 
 static const struct kwinst ifflagskw[] = {
@@ -850,9 +849,6 @@ void
 printall(const char *ifname, prop_dictionary_t env0)
 {
 	struct ifaddrs *ifap, *ifa;
-	struct ifreq ifr;
-	const struct sockaddr_dl *sdl = NULL;
-	const struct if_data *ifi = NULL;
 	prop_dictionary_t env, oenv;
 	int idx;
 	char *p;
@@ -872,19 +868,8 @@ printall(const char *ifname, prop_dictio
 	p = NULL;
 	idx = 0;
 	for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
-		memset(, 0, sizeof(ifr));
-		estrlcpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name));
-		if (sizeof(ifr.ifr_addr) >= ifa->ifa_addr->sa_len) {
-			memcpy(_addr, ifa->ifa_addr,
-			ifa->ifa_addr->sa_len);
-		}
-
 		if (ifname != NULL && strcmp(ifname, ifa->ifa_name) != 0)
 			continue;
-		if (ifa->ifa_addr->sa_family == AF_LINK) {
-			sdl = (const struct sockaddr_dl *)ifa->ifa_addr;
-			ifi = (const struct if_data *)ifa->ifa_data;
-		}
 		if (p && strcmp(p, ifa->ifa_name) == 0)
 			continue;
 		if (!prop_dictionary_set_string(env, "if", ifa->ifa_name))
@@ -898,8 +883,7 @@ printall(const char *ifname, prop_dictio
 		if (uflag && (ifa->ifa_flags & IFF_UP) == 0)
 			continue;
 
-		if (sflag && (ifi == NULL ||
-		  ifi->ifi_link_state == LINK_STATE_DOWN))
+		if (sflag && carrier(env) == LINK_STATE_DOWN)
 			continue;
 		idx++;
 		/*
@@ -912,9 +896,7 @@ printall(const char *ifname, prop_dictio
 			continue;
 		}
 
-		status(sdl, ifa->ifa_data, env, oenv);
-		sdl = NULL;
-		ifi = NULL;
+		status(env, oenv);
 	}
 	if (lflag)
 		printf("\n");
@@ -1256,13 +1238,12 @@ print_human_bytes(bool humanize, uint64_
 #define MAX_PRINT_LEN 58	/* XXX need a better way to determine this! */
 
 void
-status(const struct sockaddr_dl *sdl, const void *ifa_data,
-prop_dictionary_t env, prop_dictionary_t oenv)
+status(prop_dictionary_t env, prop_dictionary_t oenv)
 {
-	const struct if_data *ifi = ifa_data;
 	status_func_t *status_f;
 	statistics_func_t *statistics_f;
 	struct ifdatareq ifdr;
+	struct if_data *ifi;
 	struct ifreq ifr;
 	struct ifdrv ifdrv;
 	char fbuf[BUFSIZ];
@@ -1351,18 +1332,16 @@ status(const struct sockaddr_dl *sdl, co
 		free(p);
 	}
 
-	media_status(sdl->sdl_type, ifi->ifi_link_state, env, oenv);
+	media_status(env, oenv);
 
 	if (!vflag && !zflag)
 		goto proto_status;
 
 	/* We already have if_data from SIOCGIFDATA in ifa_data. */
-	if (zflag) {
-		estrlcpy(ifdr.ifdr_name, ifname, sizeof(ifdr.ifdr_name));
-		if (prog_ioctl(s, SIOCZIFDATA, ) == -1)
-			err(EXIT_FAILURE, "SIOCZIFDATA");
-		ifi = _data;
-	}
+	estrlcpy(ifdr.ifdr_name, ifname, sizeof(ifdr.ifdr_name));
+	if (prog_ioctl(s, zflag ? SIOCZIFDATA : SIOCGIFDATA, ) == -1)
+		err(EXIT_FAILURE, zflag ? "SIOCZIFDATA" : "SIOCGIFDATA");
+	ifi = _data;
 
 	print_plural("\tinput: ", ifi->ifi_ipackets, "packet");
 	

CVS commit: src/usr.sbin/powerd

2020-10-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Oct 12 16:54:43 UTC 2020

Modified Files:
src/usr.sbin/powerd: powerd.c

Log Message:
powerd: Stop crashing if entries are not found in the dictionary

If the first three are not found, log a diagnostic and do nothing.
If the latter two are not found, set them to NULL rather than garbage.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/powerd/powerd.c

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

Modified files:

Index: src/usr.sbin/powerd/powerd.c
diff -u src/usr.sbin/powerd/powerd.c:1.19 src/usr.sbin/powerd/powerd.c:1.20
--- src/usr.sbin/powerd/powerd.c:1.19	Sun Jun  7 05:54:00 2020
+++ src/usr.sbin/powerd/powerd.c	Mon Oct 12 16:54:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: powerd.c,v 1.19 2020/06/07 05:54:00 thorpej Exp $	*/
+/*	$NetBSD: powerd.c,v 1.20 2020/10/12 16:54:43 roy Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -325,18 +325,33 @@ dispatch_power_event_state_change(int fd
 			__func__, error);
 		return;
 	}
-	
+
 	if (debug) {
 		buf = prop_dictionary_externalize(dict);
 		printf("%s", buf);
 		free(buf);
 	}
 
-	prop_dictionary_get_string(dict, "powerd-script-name", [0]);
-	prop_dictionary_get_string(dict, "driver-name", [1]);
-	prop_dictionary_get_string(dict, "powerd-event-name", [2]);
-	prop_dictionary_get_string(dict, "sensor-name", [3]);
-	prop_dictionary_get_string(dict, "state-description", [4]);
+	/* First three arguments are not optional. */
+	if (!prop_dictionary_get_string(dict, "powerd-script-name", [0])) {
+		powerd_log(LOG_ERR, "dict does not have powerd-script-name");
+		return;
+	}
+	if (!prop_dictionary_get_string(dict, "driver-name", [1])) {
+		powerd_log(LOG_ERR, "dict does not have driver-name");
+		return;
+	}
+	if (!prop_dictionary_get_string(dict, "powerd-event-name", [2])) {
+		powerd_log(LOG_ERR, "dict does not have powerd-event-name");
+		return;
+	}
+
+	/* These arguments are optional. */
+	if (!prop_dictionary_get_string(dict, "sensor-name", [3]))
+		argv[3] = NULL;
+	if (!prop_dictionary_get_string(dict, "state-description", [4]))
+		argv[4] = NULL;
+
 	argv[5] = NULL;
 
 	run_script(argv);



CVS commit: src

2020-10-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Oct 12 15:18:48 UTC 2020

Modified Files:
src/share/man/man4: carp.4
src/sys/netinet: ip_carp.c ip_carp.h

Log Message:
carp: link state is DOWN until it becomes a MASTER

This is consitent with other BSD's handling of CARP and means
we don't have to carry a custom flag for it.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man4/carp.4
cvs rdiff -u -r1.112 -r1.113 src/sys/netinet/ip_carp.c
cvs rdiff -u -r1.11 -r1.12 src/sys/netinet/ip_carp.h

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

Modified files:

Index: src/share/man/man4/carp.4
diff -u src/share/man/man4/carp.4:1.7 src/share/man/man4/carp.4:1.8
--- src/share/man/man4/carp.4:1.7	Thu Jan 16 12:56:39 2020
+++ src/share/man/man4/carp.4	Mon Oct 12 15:18:48 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: carp.4,v 1.7 2020/01/16 12:56:39 kardel Exp $
+.\"	$NetBSD: carp.4,v 1.8 2020/10/12 15:18:48 roy Exp $
 .\"	$OpenBSD: carp.4,v 1.19 2005/08/09 09:52:12 jmc Exp $
 .\"
 .\" Copyright (c) 2003, Ryan McBride.  All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd January 16, 2020
+.Dd October 12, 2020
 .Dt CARP 4
 .Os
 .Sh NAME
@@ -76,20 +76,6 @@ or through the
 .Dv SIOCSVH
 ioctl.
 .Pp
-Setting the
-.Cm link0
-parameter will cause the carp interface to report
-.Dv LINK_STATE_DOWN
-in non
-.Dv MASTER/BACKUP
-mode instead of
-.Dv LINK_STATE_UNKNOWN
-as link status.
-This prevents routing software to announce routes for the carp
-interface when in
-.Dv INIT
-mode.
-.Pp
 Additionally, there are a number of global parameters which can be set using
 .Xr sysctl 8 :
 .Bl -tag -width xx

Index: src/sys/netinet/ip_carp.c
diff -u src/sys/netinet/ip_carp.c:1.112 src/sys/netinet/ip_carp.c:1.113
--- src/sys/netinet/ip_carp.c:1.112	Mon Oct 12 11:07:27 2020
+++ src/sys/netinet/ip_carp.c	Mon Oct 12 15:18:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_carp.c,v 1.112 2020/10/12 11:07:27 roy Exp $	*/
+/*	$NetBSD: ip_carp.c,v 1.113 2020/10/12 15:18:48 roy Exp $	*/
 /*	$OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $	*/
 
 /*
@@ -33,7 +33,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.112 2020/10/12 11:07:27 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.113 2020/10/12 15:18:48 roy Exp $");
 
 /*
  * TODO:
@@ -890,6 +890,7 @@ carp_clone_create(struct if_clone *ifc, 
 	/* Overwrite ethernet defaults */
 	ifp->if_type = IFT_CARP;
 	ifp->if_output = carp_output;
+	ifp->if_link_state = LINK_STATE_DOWN;
 	carp_set_enaddr(sc);
 	if_register(ifp);
 
@@ -2228,8 +2229,8 @@ carp_update_link_state(struct carp_softc
 		link_state = LINK_STATE_UP;
 		break;
 	default:
-		link_state = ((sc->sc_if.if_flags & IFF_ONLY_MASTER_UP) != 0)
-			 ? LINK_STATE_DOWN : LINK_STATE_UNKNOWN;
+		/* Not useable, so down makes perfect sense. */
+		link_state = LINK_STATE_DOWN;
 		break;
 	}
 	if_link_state_change(>sc_if, link_state);

Index: src/sys/netinet/ip_carp.h
diff -u src/sys/netinet/ip_carp.h:1.11 src/sys/netinet/ip_carp.h:1.12
--- src/sys/netinet/ip_carp.h:1.11	Thu Jan 16 12:56:40 2020
+++ src/sys/netinet/ip_carp.h	Mon Oct 12 15:18:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_carp.h,v 1.11 2020/01/16 12:56:40 kardel Exp $	*/
+/*	$NetBSD: ip_carp.h,v 1.12 2020/10/12 15:18:48 roy Exp $	*/
 /*	$OpenBSD: ip_carp.h,v 1.18 2005/04/20 23:00:41 mpf Exp $	*/
 
 /*
@@ -133,9 +133,6 @@ struct carpreq {
 	unsigned char	carpr_key[CARP_KEY_LEN];
 };
 
-/* enable link status up only for MASTER state */
-#define IFF_ONLY_MASTER_UP   IFF_LINK0
-
 /*
  * Names for CARP sysctl objects
  */



CVS commit: src/doc

2020-10-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Oct 12 14:10:38 UTC 2020

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note update to dhcpcd-9.3.1


To generate a diff of this commit:
cvs rdiff -u -r1.1751 -r1.1752 src/doc/3RDPARTY
cvs rdiff -u -r1.2745 -r1.2746 src/doc/CHANGES

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.1751 src/doc/3RDPARTY:1.1752
--- src/doc/3RDPARTY:1.1751	Fri Oct  9 19:05:57 2020
+++ src/doc/3RDPARTY	Mon Oct 12 14:10:37 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1751 2020/10/09 19:05:57 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1752 2020/10/12 14:10:37 roy Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -352,12 +352,12 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	9.3.0
-Current Vers:	9.3.0
+Version:	9.3.1
+Current Vers:	9.3.1
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/
-Date:		2020-10-05
+Date:		2020-10-12
 Mailing List: 	dhcpcd-disc...@marples.name
 License:	BSD (2-clause)
 Location:	external/bsd/dhcpcd/dist

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2745 src/doc/CHANGES:1.2746
--- src/doc/CHANGES:1.2745	Fri Oct  9 19:05:57 2020
+++ src/doc/CHANGES	Mon Oct 12 14:10:37 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2745 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2746 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -292,3 +292,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	dhcpcd: Update to version 9.3.0 [roy 20201005]
 	tzdata updated to 2020b  [kre 20201008]
 	tzcode: Updated to 2020b. [christos 20201009]
+	dhcpcd: Update to version 9.3.1 [roy 20201012]



CVS commit: src/external/bsd/dhcpcd/dist/src

2020-10-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Oct 12 14:09:03 UTC 2020

Modified Files:
src/external/bsd/dhcpcd/dist/src: dhcp.c dhcp6.c dhcpcd.c if-bsd.c
ipv6.c ipv6nd.c logerr.c privsep.c script.c

Log Message:
Sync withn dhcpcd-9.3.1


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/external/bsd/dhcpcd/dist/src/dhcp.c
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/dhcpcd/dist/src/dhcp6.c
cvs rdiff -u -r1.43 -r1.44 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
cvs rdiff -u -r1.24 -r1.25 src/external/bsd/dhcpcd/dist/src/if-bsd.c \
src/external/bsd/dhcpcd/dist/src/ipv6nd.c
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/dhcpcd/dist/src/ipv6.c
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/dhcpcd/dist/src/logerr.c
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/dhcpcd/dist/src/privsep.c
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/dhcpcd/dist/src/script.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.40 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.41
--- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.40	Mon Oct  5 16:02:15 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcp.c	Mon Oct 12 14:09:03 2020
@@ -1712,7 +1712,7 @@ send_message(struct interface *ifp, uint
 
 	if (callback == NULL) {
 		/* No carrier? Don't bother sending the packet. */
-		if (ifp->carrier <= LINK_DOWN)
+		if (!if_is_link_up(ifp))
 			return;
 		logdebugx("%s: sending %s with xid 0x%x",
 		ifp->name,
@@ -1731,7 +1731,7 @@ send_message(struct interface *ifp, uint
 		(arc4random_uniform(MSEC_PER_SEC * 2) - MSEC_PER_SEC);
 		/* No carrier? Don't bother sending the packet.
 		 * However, we do need to advance the timeout. */
-		if (ifp->carrier <= LINK_DOWN)
+		if (!if_is_link_up(ifp))
 			goto fail;
 		logdebugx("%s: sending %s (xid 0x%x), next in %0.1f seconds",
 		ifp->name,
@@ -2633,7 +2633,7 @@ dhcp_reboot(struct interface *ifp)
 	state->state = DHS_REBOOT;
 	state->interval = 0;
 
-	if (ifo->options & DHCPCD_LINK && ifp->carrier <= LINK_DOWN) {
+	if (ifo->options & DHCPCD_LINK && !if_is_link_up(ifp)) {
 		loginfox("%s: waiting for carrier", ifp->name);
 		return;
 	}
@@ -2733,7 +2733,7 @@ dhcp_drop(struct interface *ifp, const c
 		state->state = DHS_RELEASE;
 
 		dhcp_unlink(ifp->ctx, state->leasefile);
-		if (ifp->carrier > LINK_DOWN &&
+		if (if_is_link_up(ifp) &&
 		state->new != NULL &&
 		state->lease.server.s_addr != INADDR_ANY)
 		{

Index: src/external/bsd/dhcpcd/dist/src/dhcp6.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.23 src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.24
--- src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.23	Mon Oct  5 16:02:15 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcp6.c	Mon Oct 12 14:09:03 2020
@@ -1237,7 +1237,7 @@ dhcp6_sendmessage(struct interface *ifp,
 	};
 	char uaddr[INET6_ADDRSTRLEN];
 
-	if (!callback && ifp->carrier <= LINK_DOWN)
+	if (!callback && !if_is_link_up(ifp))
 		return 0;
 
 	if (!IN6_IS_ADDR_UNSPECIFIED(>unicast)) {
@@ -1298,7 +1298,7 @@ dhcp6_sendmessage(struct interface *ifp,
 		+ (unsigned int)((float)state->RT
 		* ((float)lr / DHCP6_RAND_DIV));
 
-		if (ifp->carrier > LINK_DOWN)
+		if (if_is_link_up(ifp))
 			logdebugx("%s: %s %s (xid 0x%02x%02x%02x)%s%s,"
 			" next in %0.1f seconds",
 			ifp->name,
@@ -1320,7 +1320,7 @@ dhcp6_sendmessage(struct interface *ifp,
 		}
 	}
 
-	if (ifp->carrier <= LINK_DOWN)
+	if (!if_is_link_up(ifp))
 		return 0;
 
 	/* Update the elapsed time */
@@ -2906,7 +2906,7 @@ dhcp6_delegate_prefix(struct interface *
 if (ia->sla_len == 0) {
 	/* no SLA configured, so lets
 	 * automate it */
-	if (ifd->carrier != LINK_UP) {
+	if (!if_is_link_up(ifd)) {
 		logdebugx(
 		"%s: has no carrier, cannot"
 		" delegate addresses",
@@ -2922,7 +2922,7 @@ dhcp6_delegate_prefix(struct interface *
 	sla = >sla[j];
 	if (strcmp(ifd->name, sla->ifname))
 		continue;
-	if (ifd->carrier != LINK_UP) {
+	if (!if_is_link_up(ifd)) {
 		logdebugx(
 		"%s: has no carrier, cannot"
 		" delegate addresses",
@@ -4029,7 +4029,7 @@ dhcp6_freedrop(struct interface *ifp, in
 		if (drop && options & DHCPCD_RELEASE &&
 		state->state != DH6S_DELEGATED)
 		{
-			if (ifp->carrier == LINK_UP &&
+			if (if_is_link_up(ifp) &&
 			state->state != DH6S_RELEASED &&
 			state->state != DH6S_INFORMED)
 			{

Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.43 src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.44
--- src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.43	Mon Oct  5 16:02:15 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c	Mon Oct 12 14:09:03 2020
@@ -97,9 +97,6 @@ const int dhcpcd_signals_ignore[] = {
 const size_t dhcpcd_signals_ignore_len = __arraycount(dhcpcd_signals_ignore);
 #endif
 
-#define 

CVS import: src/external/bsd/dhcpcd/dist

2020-10-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Oct 12 14:07:56 UTC 2020

Update of /cvsroot/src/external/bsd/dhcpcd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv8895

Log Message:
Update to dhcpcd-9.3.1 with the following changes:
 * dhcpcd: carrier handling issue fixed from 9.3.0
 * dhcpcd: log if interface type is unsupported in debug
 * duid: memory leak fixed if UUID wanted but none available
 * privsep: fix receiving inet and no BPF running
 * privsep: allow gettimeofday for SECCOMP
 * privsep: fix stderr redirection again

Status:

Vendor Tag: ROY
Release Tags:   dhcpcd-9_3_1

U src/external/bsd/dhcpcd/dist/LICENSE
U src/external/bsd/dhcpcd/dist/README.md
U src/external/bsd/dhcpcd/dist/src/defs.h
U src/external/bsd/dhcpcd/dist/src/common.c
U src/external/bsd/dhcpcd/dist/src/control.c
C src/external/bsd/dhcpcd/dist/src/dhcpcd.c
U src/external/bsd/dhcpcd/dist/src/duid.c
U src/external/bsd/dhcpcd/dist/src/eloop.c
C src/external/bsd/dhcpcd/dist/src/logerr.c
U src/external/bsd/dhcpcd/dist/src/if.c
U src/external/bsd/dhcpcd/dist/src/if-options.c
U src/external/bsd/dhcpcd/dist/src/sa.c
U src/external/bsd/dhcpcd/dist/src/route.c
U src/external/bsd/dhcpcd/dist/src/dhcp-common.c
C src/external/bsd/dhcpcd/dist/src/script.c
U src/external/bsd/dhcpcd/dist/src/auth.c
C src/external/bsd/dhcpcd/dist/src/if-bsd.c
C src/external/bsd/dhcpcd/dist/src/dhcp.c
U src/external/bsd/dhcpcd/dist/src/ipv4.c
U src/external/bsd/dhcpcd/dist/src/bpf.c
U src/external/bsd/dhcpcd/dist/src/arp.c
U src/external/bsd/dhcpcd/dist/src/ipv4ll.c
C src/external/bsd/dhcpcd/dist/src/ipv6.c
C src/external/bsd/dhcpcd/dist/src/ipv6nd.c
C src/external/bsd/dhcpcd/dist/src/dhcp6.c
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c
C src/external/bsd/dhcpcd/dist/src/privsep.c
U src/external/bsd/dhcpcd/dist/src/privsep-root.c
U src/external/bsd/dhcpcd/dist/src/privsep-control.c
U src/external/bsd/dhcpcd/dist/src/privsep-inet.c
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.c
U src/external/bsd/dhcpcd/dist/src/privsep-bsd.c
U src/external/bsd/dhcpcd/dist/src/common.h
U src/external/bsd/dhcpcd/dist/src/control.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.h
U src/external/bsd/dhcpcd/dist/src/duid.h
U src/external/bsd/dhcpcd/dist/src/eloop.h
U src/external/bsd/dhcpcd/dist/src/logerr.h
U src/external/bsd/dhcpcd/dist/src/if.h
U src/external/bsd/dhcpcd/dist/src/if-options.h
U src/external/bsd/dhcpcd/dist/src/sa.h
U src/external/bsd/dhcpcd/dist/src/route.h
U src/external/bsd/dhcpcd/dist/src/dhcp-common.h
U src/external/bsd/dhcpcd/dist/src/script.h
U src/external/bsd/dhcpcd/dist/src/auth.h
U src/external/bsd/dhcpcd/dist/src/dhcp.h
U src/external/bsd/dhcpcd/dist/src/ipv4.h
U src/external/bsd/dhcpcd/dist/src/bpf.h
U src/external/bsd/dhcpcd/dist/src/arp.h
U src/external/bsd/dhcpcd/dist/src/ipv4ll.h
U src/external/bsd/dhcpcd/dist/src/ipv6.h
U src/external/bsd/dhcpcd/dist/src/ipv6nd.h
U src/external/bsd/dhcpcd/dist/src/dhcp6.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h
U src/external/bsd/dhcpcd/dist/src/privsep.h
U src/external/bsd/dhcpcd/dist/src/privsep-root.h
U src/external/bsd/dhcpcd/dist/src/privsep-control.h
U src/external/bsd/dhcpcd/dist/src/privsep-inet.h
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.h
U src/external/bsd/dhcpcd/dist/src/dev.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in
U src/external/bsd/dhcpcd/dist/hooks/01-test
U src/external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant
U src/external/bsd/dhcpcd/dist/hooks/15-timezone
U src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf
U src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname
U src/external/bsd/dhcpcd/dist/hooks/30-hostname.in
U src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf
U src/external/bsd/dhcpcd/dist/hooks/50-ypbind.in

9 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jROY:yesterday -jROY src/external/bsd/dhcpcd/dist



CVS commit: src/sys/netinet

2020-10-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Oct 12 11:07:27 UTC 2020

Modified Files:
src/sys/netinet: ip_carp.c

Log Message:
carp: Set ethernet address just before interface registation

Otherwise ifconfig reports SIOCGLIFADDR errors.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/netinet/ip_carp.c

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

Modified files:

Index: src/sys/netinet/ip_carp.c
diff -u src/sys/netinet/ip_carp.c:1.111 src/sys/netinet/ip_carp.c:1.112
--- src/sys/netinet/ip_carp.c:1.111	Fri Oct  9 08:10:41 2020
+++ src/sys/netinet/ip_carp.c	Mon Oct 12 11:07:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_carp.c,v 1.111 2020/10/09 08:10:41 roy Exp $	*/
+/*	$NetBSD: ip_carp.c,v 1.112 2020/10/12 11:07:27 roy Exp $	*/
 /*	$OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $	*/
 
 /*
@@ -33,7 +33,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.111 2020/10/09 08:10:41 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.112 2020/10/12 11:07:27 roy Exp $");
 
 /*
  * TODO:
@@ -887,10 +887,10 @@ carp_clone_create(struct if_clone *ifc, 
 		return rv;
 	}
 	ether_ifattach(ifp, NULL);
-	carp_set_enaddr(sc);
 	/* Overwrite ethernet defaults */
 	ifp->if_type = IFT_CARP;
 	ifp->if_output = carp_output;
+	carp_set_enaddr(sc);
 	if_register(ifp);
 
 	return (0);



CVS commit: src/sbin/ifconfig

2020-10-11 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Oct 11 21:32:37 UTC 2020

Modified Files:
src/sbin/ifconfig: util.c

Log Message:
ifconfig: if SIOCGLIFADDR fails, continue to the next address


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sbin/ifconfig/util.c

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

Modified files:

Index: src/sbin/ifconfig/util.c
diff -u src/sbin/ifconfig/util.c:1.19 src/sbin/ifconfig/util.c:1.20
--- src/sbin/ifconfig/util.c:1.19	Tue Oct  1 10:52:53 2019
+++ src/sbin/ifconfig/util.c	Sun Oct 11 21:32:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.19 2019/10/01 10:52:53 kardel Exp $	*/
+/*	$NetBSD: util.c,v 1.20 2020/10/11 21:32:37 roy Exp $	*/
 
 /*-
  * Copyright (c) 2008 David Young.  All rights reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: util.c,v 1.19 2019/10/01 10:52:53 kardel Exp $");
+__RCSID("$NetBSD: util.c,v 1.20 2020/10/11 21:32:37 roy Exp $");
 #endif /* not lint */
 
 #include 
@@ -275,8 +275,10 @@ print_link_addresses(prop_dictionary_t e
 		iflr.flags = IFLR_PREFIX;
 		iflr.prefixlen = sdl->sdl_alen * NBBY;
 
-		if (prog_ioctl(s, SIOCGLIFADDR, ) == -1)
+		if (prog_ioctl(s, SIOCGLIFADDR, ) == -1) {
 			warn("%s: ioctl SIOCGLIFADDR", __func__);
+			continue;
+		}
 
 		if (((iflr.flags & IFLR_ACTIVE) != 0) != print_active_only)
 			continue;



CVS commit: src/sys/netinet

2020-10-09 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Oct  9 08:10:41 UTC 2020

Modified Files:
src/sys/netinet: ip_carp.c

Log Message:
carp: Remove media, software should use link status.

carp literally has no media just like ppp, vlan, etc.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/netinet/ip_carp.c

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

Modified files:

Index: src/sys/netinet/ip_carp.c
diff -u src/sys/netinet/ip_carp.c:1.110 src/sys/netinet/ip_carp.c:1.111
--- src/sys/netinet/ip_carp.c:1.110	Thu Feb  6 23:30:20 2020
+++ src/sys/netinet/ip_carp.c	Fri Oct  9 08:10:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_carp.c,v 1.110 2020/02/06 23:30:20 thorpej Exp $	*/
+/*	$NetBSD: ip_carp.c,v 1.111 2020/10/09 08:10:41 roy Exp $	*/
 /*	$OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $	*/
 
 /*
@@ -33,7 +33,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.110 2020/02/06 23:30:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.111 2020/10/09 08:10:41 roy Exp $");
 
 /*
  * TODO:
@@ -67,7 +67,6 @@ __KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -116,7 +115,6 @@ struct carp_softc {
 #define	sc_carpdev	sc_ac.ec_if.if_carpdev
 	int ah_cookie;
 	int lh_cookie;
-	struct ifmedia  sc_im;	/* ifmedia for link status */
 	struct ip_moptions sc_imo;
 #ifdef INET6
 	struct ip6_moptions sc_im6o;
@@ -228,8 +226,6 @@ static int	carp_clone_destroy(struct ifn
 static int	carp_ether_addmulti(struct carp_softc *, struct ifreq *);
 static int	carp_ether_delmulti(struct carp_softc *, struct ifreq *);
 static void	carp_ether_purgemulti(struct carp_softc *);
-static int  carp_mediachange(struct ifnet *ifp);
-static void	carp_mediastatus(struct ifnet *ifp, struct ifmediareq *imr);
 static void	carp_update_link_state(struct carp_softc *sc);
 
 static void	sysctl_net_inet_carp_setup(struct sysctllog **);
@@ -890,8 +886,6 @@ carp_clone_create(struct if_clone *ifc, 
 
 		return rv;
 	}
-	ifmedia_init(>sc_im, 0, carp_mediachange, carp_mediastatus);
-	sc->sc_im.ifm_media = IFM_CARP;
 	ether_ifattach(ifp, NULL);
 	carp_set_enaddr(sc);
 	/* Overwrite ethernet defaults */
@@ -910,7 +904,6 @@ carp_clone_destroy(struct ifnet *ifp)
 	carpdetach(ifp->if_softc);
 	ether_ifdetach(ifp);
 	if_detach(ifp);
-	ifmedia_fini(>sc_im);
 	callout_destroy(>sc_ad_tmo);
 	callout_destroy(>sc_md_tmo);
 	callout_destroy(>sc_md6_tmo);
@@ -2173,10 +2166,6 @@ carp_ioctl(struct ifnet *ifp, u_long cmd
 			error = 0;
 		break;
 
-case SIOCGIFMEDIA:
-		error = ifmedia_ioctl(ifp, ifr, >sc_im, cmd);
-		break;
-
 	default:
 		error = ether_ioctl(ifp, cmd, data);
 	}
@@ -2212,28 +2201,6 @@ carp_output(struct ifnet *ifp, struct mb
 	}
 }
 
-static int
-carp_mediachange(struct ifnet *ifp)
-{
-return (0);
-}
-
-static void
-carp_mediastatus(struct ifnet *ifp, struct ifmediareq *imr)
-{
-switch (ifp->if_link_state) {
-case LINK_STATE_UP:
-imr->ifm_status = IFM_AVALID | IFM_ACTIVE;
-break;
-case LINK_STATE_DOWN:
-imr->ifm_status = IFM_AVALID;
-break;
-default:
-imr->ifm_status = 0;
-break;
-}
-}
-
 static void
 carp_set_state(struct carp_softc *sc, int state)
 {



CVS commit: src/sys/net80211

2020-10-06 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Oct  6 23:51:06 UTC 2020

Modified Files:
src/sys/net80211: ieee80211.c

Log Message:
net80211: Initialise the interface with a decent link state.

Link state transitions to UP when a node is joined and DOWN when left.
This means that with the interface UP, the link state could be UNKNOWN
for a while, implying it can be used in BSS mode.
Which is of course false.

Add a function to set an initial link state based on the operating mode.
Also call this when the operating mode changes.

Basically in BSS and MONITOR it starts off down.
BSS will transition UP and DOWN as before, MONITOR will stay down.
IBSS, AHDEMO and HOSTAP will remain as link unknown because the state is
. unknown.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/net80211/ieee80211.c

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

Modified files:

Index: src/sys/net80211/ieee80211.c
diff -u src/sys/net80211/ieee80211.c:1.59 src/sys/net80211/ieee80211.c:1.60
--- src/sys/net80211/ieee80211.c:1.59	Sun Mar 15 23:04:51 2020
+++ src/sys/net80211/ieee80211.c	Tue Oct  6 23:51:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211.c,v 1.59 2020/03/15 23:04:51 thorpej Exp $	*/
+/*	$NetBSD: ieee80211.c,v 1.60 2020/10/06 23:51:05 roy Exp $	*/
 /*-
  * Copyright (c) 2001 Atsushi Onoe
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211.c,v 1.22 2005/08/10 16:22:29 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.59 2020/03/15 23:04:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.60 2020/10/06 23:51:05 roy Exp $");
 #endif
 
 /*
@@ -150,6 +150,30 @@ ieee80211_default_reset(struct ifnet *if
 	return ENETRESET;
 }
 
+static void
+ieee80211_init_link_state(struct ieee80211com *ic)
+{
+	struct ifnet *ifp = ic->ic_ifp;
+
+	/*
+	 * Link state does not make sense in IBSS or HOSTAP modes.
+	 * We know that the link in MONITOR mode is DOWN as we cannot
+	 * transmit, only monitor.
+	 * That leaves BSS mode, which starts off DOWN and will
+	 * transition to UP when it joins a node.
+	 */
+	switch (ic->ic_opmode) {
+	case IEEE80211_M_AHDEMO:
+	case IEEE80211_M_HOSTAP:
+	case IEEE80211_M_IBSS:
+		if_link_state_change(ifp, LINK_STATE_UNKNOWN);
+		break;
+	default:
+		if_link_state_change(ifp, LINK_STATE_DOWN);
+		break;
+	}
+}
+
 void
 ieee80211_ifattach(struct ieee80211com *ic)
 {
@@ -246,6 +270,8 @@ ieee80211_ifattach(struct ieee80211com *
 	 */
 	if (ic->ic_reset == NULL)
 		ic->ic_reset = ieee80211_default_reset;
+
+	ieee80211_init_link_state(ic);
 }
 
 void
@@ -703,6 +729,7 @@ ieee80211_media_change(struct ifnet *ifp
 		 */
 		ieee80211_reset_erp(ic);
 		ieee80211_wme_initparams(ic);	/* after opmode change */
+		ieee80211_init_link_state(ic);	/* after opmode change */
 		error = ENETRESET;
 	}
 #ifdef notdef



CVS commit: src/sbin/ifconfig

2020-10-05 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Oct  5 17:29:22 UTC 2020

Modified Files:
src/sbin/ifconfig: media.c

Log Message:
Minor correction to prior


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sbin/ifconfig/media.c

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

Modified files:

Index: src/sbin/ifconfig/media.c
diff -u src/sbin/ifconfig/media.c:1.11 src/sbin/ifconfig/media.c:1.12
--- src/sbin/ifconfig/media.c:1.11	Mon Oct  5 16:17:05 2020
+++ src/sbin/ifconfig/media.c	Mon Oct  5 17:29:22 2020
@@ -1,6 +1,6 @@
 #include 
 #ifndef lint
-__RCSID("$NetBSD: media.c,v 1.11 2020/10/05 16:17:05 roy Exp $");
+__RCSID("$NetBSD: media.c,v 1.12 2020/10/05 17:29:22 roy Exp $");
 #endif /* not lint */
 
 #include 
@@ -424,10 +424,10 @@ media_status(int media_type, int link_st
 		return;
 	}
 
-	/* Interface link status is queried through SIOCGIFMEDIA.
-	 * Not all interfaces have actual media. */
-	if (ifmr.ifm_count == 0)
+	if (ifmr.ifm_count == 0) {
 		warnx("%s: no media types?", ifname);
+		return;
+	}
 
 	media_list = calloc(ifmr.ifm_count, sizeof(int));
 	if (media_list == NULL)



CVS commit: src/sbin/ifconfig

2020-10-05 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Oct  5 16:17:05 UTC 2020

Modified Files:
src/sbin/ifconfig: media.c

Log Message:
ifconfig: Warn once more if media supported but no types

This reverts media.c -r1.7


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/ifconfig/media.c

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

Modified files:

Index: src/sbin/ifconfig/media.c
diff -u src/sbin/ifconfig/media.c:1.10 src/sbin/ifconfig/media.c:1.11
--- src/sbin/ifconfig/media.c:1.10	Tue Sep 22 14:14:17 2020
+++ src/sbin/ifconfig/media.c	Mon Oct  5 16:17:05 2020
@@ -1,6 +1,6 @@
 #include 
 #ifndef lint
-__RCSID("$NetBSD: media.c,v 1.10 2020/09/22 14:14:17 roy Exp $");
+__RCSID("$NetBSD: media.c,v 1.11 2020/10/05 16:17:05 roy Exp $");
 #endif /* not lint */
 
 #include 
@@ -426,25 +426,25 @@ media_status(int media_type, int link_st
 
 	/* Interface link status is queried through SIOCGIFMEDIA.
 	 * Not all interfaces have actual media. */
-	if (ifmr.ifm_count != 0) {
-		media_list = calloc(ifmr.ifm_count, sizeof(int));
-		if (media_list == NULL)
-			err(EXIT_FAILURE, "malloc");
-		ifmr.ifm_ulist = media_list;
-
-		if (prog_ioctl(s, SIOCGIFMEDIA, ) == -1)
-			err(EXIT_FAILURE, "SIOCGIFMEDIA");
-
-		printf("\tmedia: %s ", get_media_type_string(ifmr.ifm_current));
-		print_media_word(ifmr.ifm_current, " ");
-		if (ifmr.ifm_active != ifmr.ifm_current) {
-			printf(" (");
-			print_media_word(ifmr.ifm_active, " ");
-			printf(")");
-		}
-		printf("\n");
-	} else
-		media_list = NULL;
+	if (ifmr.ifm_count == 0)
+		warnx("%s: no media types?", ifname);
+
+	media_list = calloc(ifmr.ifm_count, sizeof(int));
+	if (media_list == NULL)
+		err(EXIT_FAILURE, "malloc");
+	ifmr.ifm_ulist = media_list;
+
+	if (prog_ioctl(s, SIOCGIFMEDIA, ) == -1)
+		err(EXIT_FAILURE, "SIOCGIFMEDIA");
+
+	printf("\tmedia: %s ", get_media_type_string(ifmr.ifm_current));
+	print_media_word(ifmr.ifm_current, " ");
+	if (ifmr.ifm_active != ifmr.ifm_current) {
+		printf(" (");
+		print_media_word(ifmr.ifm_active, " ");
+		printf(")");
+	}
+	printf("\n");
 
 	if (ifmr.ifm_status & IFM_STATUS_VALID)
 		print_media_status(IFM_TYPE(ifmr.ifm_current), ifmr.ifm_status);



CVS commit: src/sys/net

2020-10-05 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Oct  5 16:11:25 UTC 2020

Modified Files:
src/sys/net: if_spppsubr.c if_spppvar.h

Log Message:
ppp: Remove media

There is none after all.
Applications should be using ifi_link_state and not checking media.


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.23 -r1.24 src/sys/net/if_spppvar.h

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

Modified files:

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.189 src/sys/net/if_spppsubr.c:1.190
--- src/sys/net/if_spppsubr.c:1.189	Sat Apr  4 17:12:33 2020
+++ src/sys/net/if_spppsubr.c	Mon Oct  5 16:11:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.189 2020/04/04 17:12:33 is Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.190 2020/10/05 16:11:25 roy Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.189 2020/04/04 17:12:33 is Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.190 2020/10/05 16:11:25 roy Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -969,33 +969,6 @@ sppp_output(struct ifnet *ifp, struct mb
 	return error;
 }
 
-static int
-sppp_mediachange(struct ifnet *ifp)
-{
-
-	return (0);
-}
-
-static void
-sppp_mediastatus(struct ifnet *ifp, struct ifmediareq *imr)
-{
-	int link_state;
-
-	link_state = atomic_load_relaxed(>if_link_state);
-	switch (link_state) {
-	case LINK_STATE_UP:
-		imr->ifm_status = IFM_AVALID | IFM_ACTIVE;
-		break;
-	case LINK_STATE_DOWN:
-		imr->ifm_status = IFM_AVALID;
-		break;
-	default:
-		/* Should be impossible as we set link state down in attach. */
-		imr->ifm_status = 0;
-		break;
-	}
-}
-
 void
 sppp_attach(struct ifnet *ifp)
 {
@@ -1038,8 +1011,6 @@ sppp_attach(struct ifnet *ifp)
 
 	/* Lets not beat about the bush, we know we're down. */
 	ifp->if_link_state = LINK_STATE_DOWN;
-	/* There is no media for PPP, but it's needed to report link status. */
-	ifmedia_init(>pp_im, 0, sppp_mediachange, sppp_mediastatus);
 
 	memset(>myauth, 0, sizeof sp->myauth);
 	memset(>hisauth, 0, sizeof sp->hisauth);
@@ -1097,8 +1068,6 @@ sppp_detach(struct ifnet *ifp)
 	if (sp->hisauth.secret) free(sp->hisauth.secret, M_DEVBUF);
 	SPPP_UNLOCK(sp);
 	rw_destroy(>pp_lock);
-
-	ifmedia_fini(>pp_im);
 }
 
 /*
@@ -1276,10 +1245,6 @@ sppp_ioctl(struct ifnet *ifp, u_long cmd
 		error = sppp_params(sp, cmd, data);
 		break;
 
-	case SIOCGIFMEDIA:
-		error = ifmedia_ioctl(ifp, ifr, >pp_im, cmd);
-		break;
-
 	default:
 		error = ifioctl_common(ifp, cmd, data);
 		break;

Index: src/sys/net/if_spppvar.h
diff -u src/sys/net/if_spppvar.h:1.23 src/sys/net/if_spppvar.h:1.24
--- src/sys/net/if_spppvar.h:1.23	Sat Apr  4 17:12:33 2020
+++ src/sys/net/if_spppvar.h	Mon Oct  5 16:11:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppvar.h,v 1.23 2020/04/04 17:12:33 is Exp $	*/
+/*	$NetBSD: if_spppvar.h,v 1.24 2020/10/05 16:11:25 roy Exp $	*/
 
 #ifndef _NET_IF_SPPPVAR_H_
 #define _NET_IF_SPPPVAR_H_
@@ -29,8 +29,6 @@
 #include 
 #include 
 
-#include 
-
 #define IDX_LCP 0		/* idx into state table */
 
 struct slcp {
@@ -92,7 +90,6 @@ struct sauth {
 struct sppp {
 	/* NB: pp_if _must_ be first */
 	struct  ifnet pp_if;/* network interface data */
-	struct	ifmedia pp_im;	/* interface media, to report link status */
 	struct  ifqueue pp_fastq; /* fast output queue */
 	struct	ifqueue pp_cpq;	/* PPP control protocol queue */
 	struct  sppp *pp_next;  /* next interface in keepalive list */



CVS commit: src/doc

2020-10-05 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Oct  5 16:04:11 UTC 2020

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note import of dhcpcd-9.3.0


To generate a diff of this commit:
cvs rdiff -u -r1.1747 -r1.1748 src/doc/3RDPARTY
cvs rdiff -u -r1.2742 -r1.2743 src/doc/CHANGES

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.1747 src/doc/3RDPARTY:1.1748
--- src/doc/3RDPARTY:1.1747	Sun Sep 27 00:32:22 2020
+++ src/doc/3RDPARTY	Mon Oct  5 16:04:11 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1747 2020/09/27 00:32:22 mrg Exp $
+#	$NetBSD: 3RDPARTY,v 1.1748 2020/10/05 16:04:11 roy Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -352,12 +352,12 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	9.2.0
-Current Vers:	9.2.0
+Version:	9.3.0
+Current Vers:	9.3.0
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/
-Date:		2020-09-06
+Date:		2020-10-05
 Mailing List: 	dhcpcd-disc...@marples.name
 License:	BSD (2-clause)
 Location:	external/bsd/dhcpcd/dist

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2742 src/doc/CHANGES:1.2743
--- src/doc/CHANGES:1.2742	Sun Sep 27 13:46:19 2020
+++ src/doc/CHANGES	Mon Oct  5 16:04:11 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2742 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2743 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -289,3 +289,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 		MULTIPROCESSOR in GENERIC.  [thorpej 20200918]
 	ld.so(1): Upgrade r_debug to the protocol version 1. [kamil 20200921]
 	vether(4): Imported from OpenBSD. [roy 20200927]
+	dhcpcd: Update to version 9.3.0 [roy 20201005]



CVS commit: src/external/bsd/dhcpcd/dist/src

2020-10-05 Thread Roy Marples
OPTION_DNS_SERVERS },
 	{ DHO_HOSTNAME,		D6_OPTION_FQDN },
 	{ DHO_DNSDOMAIN,	D6_OPTION_FQDN },
@@ -2588,7 +2588,7 @@ dhcp6_readlease(struct interface *ifp, i
 		logdebugx("reading standard input");
 		bytes = read(fileno(stdin), buf.buf, sizeof(buf.buf));
 	} else {
-		logdebugx("%s: reading lease `%s'",
+		logdebugx("%s: reading lease: %s",
 		ifp->name, state->leasefile);
 		bytes = dhcp_readfile(ifp->ctx, state->leasefile,
 		buf.buf, sizeof(buf.buf));
@@ -3218,7 +3218,7 @@ dhcp6_bind(struct interface *ifp, const 
 			ifp->name, state->expire);
 		rt_build(ifp->ctx, AF_INET6);
 		if (!confirmed && !timedout) {
-			logdebugx("%s: writing lease `%s'",
+			logdebugx("%s: writing lease: %s",
 			ifp->name, state->leasefile);
 			if (dhcp_writefile(ifp->ctx, state->leasefile, 0640,
 			state->new, state->new_len) == -1)
@@ -3657,12 +3657,12 @@ dhcp6_recvmsg(struct dhcpcd_ctx *ctx, st
 	"/tmp/dhcp6.reply%d.raw", replyn++);
 	fd = open(fname, O_RDONLY, 0);
 	if (fd == -1) {
-		logerr("%s: open `%s'", __func__, fname);
+		logerr("%s: open: %s", __func__, fname);
 		return;
 	}
 	tlen = read(fd, tbuf, sizeof(tbuf));
 	if (tlen == -1)
-		logerr("%s: read `%s'", __func__, fname);
+		logerr("%s: read: %s", __func__, fname);
 	close(fd);
 
 	/* Copy across ServerID so we can work with our own server. */

Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.42 src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.43
--- src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.42	Sun Sep  6 14:55:34 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c	Mon Oct  5 16:02:15 2020
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 
-const char dhcpcd_copyright[] = "Copyright (c) 2006-2020 Roy Marples";
+static const char dhcpcd_copyright[] = "Copyright (c) 2006-2020 Roy Marples";
 
 #include 
 #include 
@@ -360,7 +360,7 @@ dhcpcd_daemonise(struct dhcpcd_ctx *ctx)
 		return;
 
 	/* Don't use loginfo because this makes no sense in a log. */
-	if (!(logopts & LOGERR_QUIET))
+	if (!(logopts & LOGERR_QUIET) && ctx->stderr_valid)
 		(void)fprintf(stderr,
 		"forked to background, child pid %d\n", getpid());
 	i = EXIT_SUCCESS;
@@ -432,8 +432,6 @@ stop_interface(struct interface *ifp)
 	/* De-activate the interface */
 	ifp->active = IF_INACTIVE;
 	ifp->options->options &= ~DHCPCD_STOPPING;
-	/* Set the link state to unknown as we're no longer tracking it. */
-	ifp->carrier = LINK_UNKNOWN;
 
 	if (!(ctx->options & (DHCPCD_MASTER | DHCPCD_TEST)))
 		eloop_exit(ctx->eloop, EXIT_FAILURE);
@@ -700,43 +698,36 @@ dhcpcd_reportssid(struct interface *ifp)
 		return;
 	}
 
-	loginfox("%s: connected to Access Point `%s'", ifp->name, pssid);
+	loginfox("%s: connected to Access Point: %s", ifp->name, pssid);
 }
 
 void
-dhcpcd_handlecarrier(struct dhcpcd_ctx *ctx, int carrier, unsigned int flags,
-const char *ifname)
+dhcpcd_handlecarrier(struct interface *ifp, int carrier, unsigned int flags)
 {
-	struct interface *ifp;
-
-	ifp = if_find(ctx->ifaces, ifname);
-	if (ifp == NULL ||
-	ifp->options == NULL || !(ifp->options->options & DHCPCD_LINK) ||
-	!ifp->active)
-		return;
+	bool nolink = ifp->options == NULL ||
+	!(ifp->options->options & DHCPCD_LINK);
 
+	ifp->flags = flags;
 	if (carrier == LINK_UNKNOWN) {
-		if (ifp->wireless) {
+		if (ifp->wireless)
 			carrier = LINK_DOWN;
-			ifp->flags = flags;
-		} else
-			carrier = if_carrier(ifp);
-	} else
-		ifp->flags = flags;
-	if (carrier == LINK_UNKNOWN)
-		carrier = IF_UPANDRUNNING(ifp) ? LINK_UP : LINK_DOWN;
+		else
+			carrier = IF_UPANDRUNNING(ifp) ? LINK_UP : LINK_DOWN;
+	}
 
 	if (carrier == LINK_DOWN || (ifp->flags & IFF_UP) == 0) {
 		if (ifp->carrier != LINK_DOWN) {
-			if (ifp->carrier == LINK_UP)
-loginfox("%s: carrier lost", ifp->name);
 #ifdef NOCARRIER_PRESERVE_IP
 			if (ifp->flags & IFF_UP &&
-			!(ifp->options->options & DHCPCD_ANONYMOUS))
+			(ifp->options == NULL ||
+			!(ifp->options->options & DHCPCD_ANONYMOUS)))
 ifp->carrier = LINK_DOWN_IFFUP;
 			else
 #endif
 ifp->carrier = LINK_DOWN;
+			if (!ifp->active || nolink)
+return;
+			loginfox("%s: carrier lost", ifp->name);
 			script_runreason(ifp, "NOCARRIER");
 #ifdef NOCARRIER_PRESERVE_IP
 			if (ifp->flags & IFF_UP &&
@@ -767,13 +758,14 @@ dhcpcd_handlecarrier(struct dhcpcd_ctx *
 		}
 	} else if (carrier == LINK_UP && ifp->flags & IFF_UP) {
 		if (ifp->carrier != LINK_UP) {
-			loginfox("%s: carrier acquired", ifp->name);
 			ifp->carrier = LINK_UP;
+			if (ifp->active)
+loginfox("%s

CVS import: src/external/bsd/dhcpcd/dist

2020-10-05 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Oct  5 16:01:14 UTC 2020

Update of /cvsroot/src/external/bsd/dhcpcd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv12318

Log Message:
Update to dhcpcd-9.3.0 with the following changes:
 * dhcpcd: Backticks have been removed from quoting filenames
 * dhcpcd: Only manipulate stdin, stdout and stderr if they are valid
 * duid: Adjust option so the type can be specified
 * logerr: Don't leak logfile fd to scripts
 * privsep: Run the launcher process in the sandbox
 * BSD: Use `ifi_link_state` as the single source of truth about carrier
 * BSD: Ignore vether(4) devices by default

Status:

Vendor Tag: ROY
Release Tags:   dhcpcd-9_3_0

U src/external/bsd/dhcpcd/dist/LICENSE
U src/external/bsd/dhcpcd/dist/README.md
U src/external/bsd/dhcpcd/dist/src/defs.h
U src/external/bsd/dhcpcd/dist/src/common.c
U src/external/bsd/dhcpcd/dist/src/control.c
C src/external/bsd/dhcpcd/dist/src/dhcpcd.c
U src/external/bsd/dhcpcd/dist/src/duid.c
U src/external/bsd/dhcpcd/dist/src/eloop.c
C src/external/bsd/dhcpcd/dist/src/logerr.c
U src/external/bsd/dhcpcd/dist/src/if.c
C src/external/bsd/dhcpcd/dist/src/if-options.c
U src/external/bsd/dhcpcd/dist/src/sa.c
U src/external/bsd/dhcpcd/dist/src/route.c
U src/external/bsd/dhcpcd/dist/src/dhcp-common.c
C src/external/bsd/dhcpcd/dist/src/script.c
U src/external/bsd/dhcpcd/dist/src/auth.c
C src/external/bsd/dhcpcd/dist/src/if-bsd.c
C src/external/bsd/dhcpcd/dist/src/dhcp.c
U src/external/bsd/dhcpcd/dist/src/ipv4.c
C src/external/bsd/dhcpcd/dist/src/bpf.c
U src/external/bsd/dhcpcd/dist/src/arp.c
U src/external/bsd/dhcpcd/dist/src/ipv4ll.c
U src/external/bsd/dhcpcd/dist/src/ipv6.c
C src/external/bsd/dhcpcd/dist/src/ipv6nd.c
C src/external/bsd/dhcpcd/dist/src/dhcp6.c
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c
C src/external/bsd/dhcpcd/dist/src/privsep.c
U src/external/bsd/dhcpcd/dist/src/privsep-root.c
U src/external/bsd/dhcpcd/dist/src/privsep-control.c
U src/external/bsd/dhcpcd/dist/src/privsep-inet.c
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.c
U src/external/bsd/dhcpcd/dist/src/privsep-bsd.c
U src/external/bsd/dhcpcd/dist/src/common.h
U src/external/bsd/dhcpcd/dist/src/control.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.h
U src/external/bsd/dhcpcd/dist/src/duid.h
U src/external/bsd/dhcpcd/dist/src/eloop.h
U src/external/bsd/dhcpcd/dist/src/logerr.h
U src/external/bsd/dhcpcd/dist/src/if.h
U src/external/bsd/dhcpcd/dist/src/if-options.h
U src/external/bsd/dhcpcd/dist/src/sa.h
U src/external/bsd/dhcpcd/dist/src/route.h
U src/external/bsd/dhcpcd/dist/src/dhcp-common.h
U src/external/bsd/dhcpcd/dist/src/script.h
U src/external/bsd/dhcpcd/dist/src/auth.h
U src/external/bsd/dhcpcd/dist/src/dhcp.h
U src/external/bsd/dhcpcd/dist/src/ipv4.h
U src/external/bsd/dhcpcd/dist/src/bpf.h
U src/external/bsd/dhcpcd/dist/src/arp.h
U src/external/bsd/dhcpcd/dist/src/ipv4ll.h
U src/external/bsd/dhcpcd/dist/src/ipv6.h
U src/external/bsd/dhcpcd/dist/src/ipv6nd.h
U src/external/bsd/dhcpcd/dist/src/dhcp6.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h
U src/external/bsd/dhcpcd/dist/src/privsep.h
U src/external/bsd/dhcpcd/dist/src/privsep-root.h
U src/external/bsd/dhcpcd/dist/src/privsep-control.h
U src/external/bsd/dhcpcd/dist/src/privsep-inet.h
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.h
U src/external/bsd/dhcpcd/dist/src/dev.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in
U src/external/bsd/dhcpcd/dist/hooks/01-test
U src/external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant
U src/external/bsd/dhcpcd/dist/hooks/15-timezone
U src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf
U src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname
U src/external/bsd/dhcpcd/dist/hooks/30-hostname.in
U src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf
U src/external/bsd/dhcpcd/dist/hooks/50-ypbind.in

10 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jROY:yesterday -jROY src/external/bsd/dhcpcd/dist



CVS commit: src/sys/sys

2020-10-05 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Oct  5 08:38:18 UTC 2020

Modified Files:
src/sys/sys: socketvar.h

Log Message:
soreadable() should consider so_rerror


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/sys/socketvar.h

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

Modified files:

Index: src/sys/sys/socketvar.h
diff -u src/sys/sys/socketvar.h:1.160 src/sys/sys/socketvar.h:1.161
--- src/sys/sys/socketvar.h:1.160	Thu Mar  7 12:29:14 2019
+++ src/sys/sys/socketvar.h	Mon Oct  5 08:38:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: socketvar.h,v 1.160 2019/03/07 12:29:14 maxv Exp $	*/
+/*	$NetBSD: socketvar.h,v 1.161 2020/10/05 08:38:17 roy Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -442,7 +442,7 @@ soreadable(const struct socket *so)
 
 	return so->so_rcv.sb_cc >= so->so_rcv.sb_lowat ||
 	(so->so_state & SS_CANTRCVMORE) != 0 ||
-	so->so_qlen != 0 || so->so_error != 0;
+	so->so_qlen != 0 || so->so_error != 0 || so->so_rerror != 0;
 }
 
 /* can we write something to so? */



CVS commit: src/usr.sbin/ifwatchd

2020-10-04 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Oct  4 20:36:32 UTC 2020

Modified Files:
src/usr.sbin/ifwatchd: ifwatchd.c

Log Message:
ifwatchd: Enable SO_RERROR to re-sync interface state.

Interface arrival, departure and link state changes will sync
and if different will be actioned.

Currently we do not track addresses, so any changes there are still lost.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/ifwatchd/ifwatchd.c

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

Modified files:

Index: src/usr.sbin/ifwatchd/ifwatchd.c
diff -u src/usr.sbin/ifwatchd/ifwatchd.c:1.45 src/usr.sbin/ifwatchd/ifwatchd.c:1.46
--- src/usr.sbin/ifwatchd/ifwatchd.c:1.45	Sun Sep 27 19:55:21 2020
+++ src/usr.sbin/ifwatchd/ifwatchd.c	Sun Oct  4 20:36:32 2020
@@ -1,6 +1,6 @@
-/*	$NetBSD: ifwatchd.c,v 1.45 2020/09/27 19:55:21 roy Exp $	*/
+/*	$NetBSD: ifwatchd.c,v 1.46 2020/10/04 20:36:32 roy Exp $	*/
 #include 
-__RCSID("$NetBSD: ifwatchd.c,v 1.45 2020/09/27 19:55:21 roy Exp $");
+__RCSID("$NetBSD: ifwatchd.c,v 1.46 2020/10/04 20:36:32 roy Exp $");
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -44,15 +44,16 @@ __RCSID("$NetBSD: ifwatchd.c,v 1.45 2020
 #include 
 #include 
 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
 #include 
+#include 
 
 enum event { ARRIVAL, DEPARTURE, UP, DOWN, CARRIER, NO_CARRIER };
 enum addrflag { NOTREADY, DETACHED, READY };
@@ -69,7 +70,7 @@ static void check_announce(const struct 
 static void check_carrier(const struct if_msghdr *ifm);
 static void free_interfaces(void);
 static struct interface_data * find_interface(int index);
-static void run_initial_ups(void);
+static void run_initial_ups(bool);
 
 /* global variables */
 static int verbose = 0, quiet = 0;
@@ -197,9 +198,12 @@ main(int argc, char **argv)
 	if (setsockopt(s, PF_ROUTE, RO_MSGFILTER,
 	, sizeof(msgfilter)) < 0)
 		syslog(LOG_ERR, "RO_MSGFILTER: %m");
+	n = 1;
+	if (setsockopt(s, SOL_SOCKET, SO_RERROR, , sizeof(n)) < 0)
+		syslog(LOG_ERR, "SO_RERROR: %m");
 
 	if (!inhibit_initial)
-		run_initial_ups();
+		run_initial_ups(true);
 
 	iov[0].iov_base = buf;
 	iov[0].iov_len = sizeof(buf);
@@ -210,6 +214,15 @@ main(int argc, char **argv)
 	for (;;) {
 		n = recvmsg(s, , 0);
 		if (n == -1) {
+			if (errno == ENOBUFS) {
+syslog(LOG_ERR,
+"routing socket overflow detected");
+/* XXX We don't track addresses, so they
+ * won't be reported. */
+if (!inhibit_initial)
+	run_initial_ups(false);
+continue;
+			}
 			syslog(LOG_ERR, "recvmsg: %m");
 			exit(EXIT_FAILURE);
 		}
@@ -482,6 +495,28 @@ check_carrier(const struct if_msghdr *if
 }
 
 static void
+do_announce(struct interface_data *ifd,
+unsigned short what, unsigned short index)
+{
+
+	switch (what) {
+	case IFAN_ARRIVAL:
+		ifd->index = index;
+		invoke_script(ifd->ifname, ARRIVAL, NULL, NULL);
+		break;
+	case IFAN_DEPARTURE:
+		ifd->index = -1;
+		ifd->last_carrier_status = -1;
+		invoke_script(ifd->ifname, DEPARTURE, NULL, NULL);
+		break;
+	default:
+		if (verbose)
+			(void) printf("unknown announce: what=%d\n", what);
+		break;
+	}
+}
+
+static void
 check_announce(const struct if_announcemsghdr *ifan)
 {
 	struct interface_data * p;
@@ -491,22 +526,7 @@ check_announce(const struct if_announcem
 		if (strcmp(p->ifname, ifname) != 0)
 			continue;
 
-		switch (ifan->ifan_what) {
-		case IFAN_ARRIVAL:
-			p->index = ifan->ifan_index;
-			invoke_script(p->ifname, ARRIVAL, NULL, NULL);
-			break;
-		case IFAN_DEPARTURE:
-			p->index = -1;
-			p->last_carrier_status = -1;
-			invoke_script(p->ifname, DEPARTURE, NULL, NULL);
-			break;
-		default:
-			if (verbose)
-(void) printf("unknown announce: "
-"what=%d\n", ifan->ifan_what);
-			break;
-		}
+		do_announce(p, ifan->ifan_what, ifan->ifan_index);
 		return;
 	}
 }
@@ -536,7 +556,7 @@ find_interface(int idx)
 }
 
 static void
-run_initial_ups(void)
+run_initial_ups(bool do_addrs)
 {
 	struct interface_data * ifd;
 	struct ifaddrs *res = NULL, *p;
@@ -551,6 +571,19 @@ run_initial_ups(void)
 	if (getifaddrs() != 0)
 		goto out;
 
+	/* Check if any interfaces vanished */
+	SLIST_FOREACH(ifd, , next) {
+		for (p = res; p; p = p->ifa_next) {
+			if (strcmp(ifd->ifname, p->ifa_name) != 0)
+continue;
+			ifa = p->ifa_addr;
+			if (ifa != NULL && ifa->sa_family == AF_LINK)
+break;
+		}
+		if (p == NULL)
+			do_announce(ifd, IFAN_DEPARTURE, ifd->index);
+	}
+
 	for (p = res; p; p = p->ifa_next) {
 		SLIST_FOREACH(ifd, , next) {
 			if (strcmp(ifd->ifname, p->ifa_name) == 0)
@@ -560,7 +593,8 @@ run_initial_ups(void)
 			continue;
 
 		ifa = p->ifa_addr;
-		if (ifa != NULL && ifa->sa_family == AF_LINK)
+		if (ifa != NULL && ifa->sa_family == AF_LINK &&
+		ifd->index == -1)
 			invoke_script(ifd->ifname, ARRIVAL, NULL, NULL);
 
 		if ((p->ifa_flags & 

CVS commit: src/etc/mtree

2020-09-30 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Sep 30 20:20:53 UTC 2020

Modified Files:
src/etc/mtree: NetBSD.dist.tests

Log Message:
Add if_tap directory for DEBUG builds.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/etc/mtree/NetBSD.dist.tests

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

Modified files:

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.179 src/etc/mtree/NetBSD.dist.tests:1.180
--- src/etc/mtree/NetBSD.dist.tests:1.179	Wed Sep 30 08:32:00 2020
+++ src/etc/mtree/NetBSD.dist.tests	Wed Sep 30 20:20:53 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.179 2020/09/30 08:32:00 martin Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.180 2020/09/30 20:20:53 roy Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -147,6 +147,8 @@
 ./usr/libdata/debug/usr/tests/net/icmp
 ./usr/libdata/debug/usr/tests/net/if
 ./usr/libdata/debug/usr/tests/net/if_loop
+./usr/libdata/debug/usr/tests/net/if_tap
+./usr/libdata/debug/usr/tests/net/if_vether
 ./usr/libdata/debug/usr/tests/net/if_vlan
 ./usr/libdata/debug/usr/tests/net/in_cksum
 ./usr/libdata/debug/usr/tests/net/ipsec



CVS commit: src/tests/net/if_tap

2020-09-30 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Sep 30 17:14:11 UTC 2020

Modified Files:
src/tests/net/if_tap: Makefile

Log Message:
Be like other tests and speciy the binary name we install


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/if_tap/Makefile

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

Modified files:

Index: src/tests/net/if_tap/Makefile
diff -u src/tests/net/if_tap/Makefile:1.4 src/tests/net/if_tap/Makefile:1.5
--- src/tests/net/if_tap/Makefile:1.4	Wed Sep 30 17:05:59 2020
+++ src/tests/net/if_tap/Makefile	Wed Sep 30 17:14:11 2020
@@ -1,15 +1,15 @@
-# $NetBSD: Makefile,v 1.4 2020/09/30 17:05:59 roy Exp $
+# $NetBSD: Makefile,v 1.5 2020/09/30 17:14:11 roy Exp $
 #
 
 .include 
 
-PROG=		rump_open_tap
-MAN=		# empty
-DPADD=		${LIBRUMPRES}
-LDADD=		-lrumpres
-BINDIR=		${TESTSDIR}
+PROG=			rump_open_tap
+MAN=			# empty
+DPADD=			${LIBRUMPRES}
+LDADD=			-lrumpres
+BINDIR.rump_open_tap=	${TESTSDIR}
 
-TESTSDIR=	${TESTSBASE}/net/if_tap
+TESTSDIR=		${TESTSBASE}/net/if_tap
 
 .for name in tap
 TESTS_SH+=		t_${name}



CVS commit: src/tests/net/if_tap

2020-09-30 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Sep 30 17:05:59 UTC 2020

Modified Files:
src/tests/net/if_tap: Makefile

Log Message:
Fix prior


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/net/if_tap/Makefile

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

Modified files:

Index: src/tests/net/if_tap/Makefile
diff -u src/tests/net/if_tap/Makefile:1.3 src/tests/net/if_tap/Makefile:1.4
--- src/tests/net/if_tap/Makefile:1.3	Wed Sep 30 14:43:15 2020
+++ src/tests/net/if_tap/Makefile	Wed Sep 30 17:05:59 2020
@@ -1,12 +1,13 @@
-# $NetBSD: Makefile,v 1.3 2020/09/30 14:43:15 roy Exp $
+# $NetBSD: Makefile,v 1.4 2020/09/30 17:05:59 roy Exp $
 #
 
 .include 
 
 PROG=		rump_open_tap
-MAN=
+MAN=		# empty
 DPADD=		${LIBRUMPRES}
 LDADD=		-lrumpres
+BINDIR=		${TESTSDIR}
 
 TESTSDIR=	${TESTSBASE}/net/if_tap
 



CVS commit: src/distrib/sets/lists/tests

2020-09-30 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Sep 30 14:54:33 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
Add rump_open_tap


To generate a diff of this commit:
cvs rdiff -u -r1.932 -r1.933 src/distrib/sets/lists/tests/mi

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.932 src/distrib/sets/lists/tests/mi:1.933
--- src/distrib/sets/lists/tests/mi:1.932	Tue Sep 29 19:41:48 2020
+++ src/distrib/sets/lists/tests/mi	Wed Sep 30 14:54:33 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.932 2020/09/29 19:41:48 roy Exp $
+# $NetBSD: mi,v 1.933 2020/09/30 14:54:33 roy Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3857,6 +3857,7 @@
 ./usr/tests/net/if_tap	tests-net-tests		compattestfile,atf
 ./usr/tests/net/if_tap/Atffiletests-net-tests		atf,rump
 ./usr/tests/net/if_tap/Kyuafiletests-net-tests		atf,rump,kyua
+./usr/tests/net/if_tap/rump_open_tap			tests-net-tests		atf,rump
 ./usr/tests/net/if_tap/t_taptests-net-tests		atf,rump
 ./usr/tests/net/if_tun	tests-net-tests		compattestfile,atf
 ./usr/tests/net/if_tun/Atffiletests-net-tests		atf,rump



CVS commit: src/tests/net/if_tap

2020-09-30 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Sep 30 14:43:15 UTC 2020

Modified Files:
src/tests/net/if_tap: Makefile t_tap.sh
Added Files:
src/tests/net/if_tap: rump_open_tap.c

Log Message:
tap(4): update the test so that we can open the tap to ping across a bridge

ping with tap closed to ensure it fails
ping with tap open to ensure it works


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/if_tap/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/net/if_tap/rump_open_tap.c
cvs rdiff -u -r1.10 -r1.11 src/tests/net/if_tap/t_tap.sh

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

Modified files:

Index: src/tests/net/if_tap/Makefile
diff -u src/tests/net/if_tap/Makefile:1.2 src/tests/net/if_tap/Makefile:1.3
--- src/tests/net/if_tap/Makefile:1.2	Fri Nov 25 08:51:16 2016
+++ src/tests/net/if_tap/Makefile	Wed Sep 30 14:43:15 2020
@@ -1,8 +1,13 @@
-# $NetBSD: Makefile,v 1.2 2016/11/25 08:51:16 ozaki-r Exp $
+# $NetBSD: Makefile,v 1.3 2020/09/30 14:43:15 roy Exp $
 #
 
 .include 
 
+PROG=		rump_open_tap
+MAN=
+DPADD=		${LIBRUMPRES}
+LDADD=		-lrumpres
+
 TESTSDIR=	${TESTSBASE}/net/if_tap
 
 .for name in tap

Index: src/tests/net/if_tap/t_tap.sh
diff -u src/tests/net/if_tap/t_tap.sh:1.10 src/tests/net/if_tap/t_tap.sh:1.11
--- src/tests/net/if_tap/t_tap.sh:1.10	Mon Aug 19 03:22:05 2019
+++ src/tests/net/if_tap/t_tap.sh	Wed Sep 30 14:43:15 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: t_tap.sh,v 1.10 2019/08/19 03:22:05 ozaki-r Exp $
+#	$NetBSD: t_tap.sh,v 1.11 2020/09/30 14:43:15 roy Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -34,6 +34,7 @@ IP4_REMOTE=10.0.0.3
 IP6_LOCAL=fc00::1
 IP6_TAP=fc00::2
 IP6_REMOTE=fc00::3
+TAP_PID=./.__tap.pid
 
 DEBUG=${DEBUG:-false}
 TIMEOUT=1
@@ -130,6 +131,7 @@ tap_bridged_head()
 
 tap_bridged_body()
 {
+	local src="$(atf_get_srcdir)"
 
 	rump_server_fs_start $SOCK_LOCAL netinet6 tap bridge
 	rump_server_fs_start $SOCK_REMOTE netinet6 tap
@@ -146,7 +148,6 @@ tap_bridged_body()
 	atf_check -s exit:0 rump.ifconfig tap0 $IP4_TAP
 	atf_check -s exit:0 rump.ifconfig tap0 inet6 $IP6_TAP
 	atf_check -s exit:0 rump.ifconfig tap0 up
-	atf_check -s exit:0 rump.ifconfig -w 10
 
 	rump_server_add_iface $SOCK_LOCAL bridge0
 	atf_check -s exit:0 rump.ifconfig bridge0 up
@@ -155,6 +156,8 @@ tap_bridged_body()
 	atf_check -s exit:0 brconfig bridge0 add tap0
 	unset LD_PRELOAD
 
+	atf_check -s exit:0 rump.ifconfig -w 10
+
 	export RUMP_SERVER=${SOCK_REMOTE}
 
 	atf_check -s exit:0 rump.ifconfig shmif0 $IP4_REMOTE
@@ -162,10 +165,22 @@ tap_bridged_body()
 	atf_check -s exit:0 rump.ifconfig shmif0 up
 	atf_check -s exit:0 rump.ifconfig -w 10
 
+	# shmif0 on the server bridge is active, we expect this to work
 	atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 $IP4_LOCAL
-	atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 $IP4_TAP
-
 	atf_check -s exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 $IP6_LOCAL
+
+	# The tap is not open, we expect this to fail
+	atf_check -s not-exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 $IP4_TAP
+	atf_check -s not-exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 $IP6_TAP
+
+	# Open the tap on the server
+	export RUMP_SERVER=${SOCK_LOCAL}
+	atf_check -s exit:0 "$src"/rump_open_tap /dev/tap0 $TAP_PID
+	atf_check -s exit:0 rump.ifconfig -w 10
+
+	# Now we can ping the tap address
+	export RUMP_SERVER=${SOCK_LOCAL}
+	atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 $IP4_TAP
 	atf_check -s exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 $IP6_TAP
 
 	rump_server_destroy_ifaces
@@ -174,6 +189,11 @@ tap_bridged_body()
 tap_bridged_cleanup()
 {
 
+if [ -f $TAP_PID ]; then
+		kill -9 $(cat $TAP_PID)
+		rm -f $TAP_PID
+		sleep 1
+	fi
 	$DEBUG && dump
 	cleanup
 }

Added files:

Index: src/tests/net/if_tap/rump_open_tap.c
diff -u /dev/null src/tests/net/if_tap/rump_open_tap.c:1.1
--- /dev/null	Wed Sep 30 14:43:15 2020
+++ src/tests/net/if_tap/rump_open_tap.c	Wed Sep 30 14:43:15 2020
@@ -0,0 +1,79 @@
+/* $NetBSD: rump_open_tap.c,v 1.1 2020/09/30 14:43:15 roy Exp $ */
+
+/*
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Roy Marples.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITE

CVS commit: src

2020-09-29 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Sep 29 19:41:48 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/net: Makefile
Added Files:
src/tests/net/if_vether: Makefile t_vether.sh

Log Message:
vether(4): Add ATF tests based on the tap(4) tests.


To generate a diff of this commit:
cvs rdiff -u -r1.931 -r1.932 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.36 -r1.37 src/tests/net/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/net/if_vether/Makefile \
src/tests/net/if_vether/t_vether.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.931 src/distrib/sets/lists/tests/mi:1.932
--- src/distrib/sets/lists/tests/mi:1.931	Sun Sep 27 20:11:33 2020
+++ src/distrib/sets/lists/tests/mi	Tue Sep 29 19:41:48 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.931 2020/09/27 20:11:33 rillig Exp $
+# $NetBSD: mi,v 1.932 2020/09/29 19:41:48 roy Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3862,6 +3862,10 @@
 ./usr/tests/net/if_tun/Atffiletests-net-tests		atf,rump
 ./usr/tests/net/if_tun/Kyuafiletests-net-tests		atf,rump,kyua
 ./usr/tests/net/if_tun/t_tuntests-net-tests		atf,rump
+./usr/tests/net/if_vethertests-net-tests		compattestfile,atf
+./usr/tests/net/if_vether/Atffile			tests-net-tests		atf,rump
+./usr/tests/net/if_vether/Kyuafile			tests-net-tests		atf,rump,kyua
+./usr/tests/net/if_vether/t_vether			tests-net-tests		atf,rump
 ./usr/tests/net/if_vlan	tests-net-tests		compattestfile,atf
 ./usr/tests/net/if_vlan/Atffiletests-net-tests		atf,rump
 ./usr/tests/net/if_vlan/Kyuafile			tests-net-tests		atf,rump,kyua

Index: src/tests/net/Makefile
diff -u src/tests/net/Makefile:1.36 src/tests/net/Makefile:1.37
--- src/tests/net/Makefile:1.36	Wed Aug 26 16:03:42 2020
+++ src/tests/net/Makefile	Tue Sep 29 19:41:48 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.36 2020/08/26 16:03:42 riastradh Exp $
+# $NetBSD: Makefile,v 1.37 2020/09/29 19:41:48 roy Exp $
 
 .include 
 
@@ -8,7 +8,7 @@ TESTS_SUBDIRS=		fdpass in_cksum net sys
 .if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE)
 TESTS_SUBDIRS+=		arp bpf bpfilter can carp icmp if if_bridge if_gif
 TESTS_SUBDIRS+=		if_ipsec if_l2tp if_loop if_pppoe if_tap if_tun ipsec
-TESTS_SUBDIRS+=		mcast mpls ndp npf route if_vlan if_wg
+TESTS_SUBDIRS+=		mcast mpls ndp npf route if_vether if_vlan if_wg
 .if (${MKSLJIT} != "no")
 TESTS_SUBDIRS+=		bpfjit
 .endif

Added files:

Index: src/tests/net/if_vether/Makefile
diff -u /dev/null src/tests/net/if_vether/Makefile:1.1
--- /dev/null	Tue Sep 29 19:41:48 2020
+++ src/tests/net/if_vether/Makefile	Tue Sep 29 19:41:48 2020
@@ -0,0 +1,13 @@
+# $NetBSD: Makefile,v 1.1 2020/09/29 19:41:48 roy Exp $
+#
+
+.include 
+
+TESTSDIR=	${TESTSBASE}/net/if_vether
+
+.for name in vether
+TESTS_SH+=		t_${name}
+TESTS_SH_SRC_t_${name}=	../net_common.sh t_${name}.sh
+.endfor
+
+.include 
Index: src/tests/net/if_vether/t_vether.sh
diff -u /dev/null src/tests/net/if_vether/t_vether.sh:1.1
--- /dev/null	Tue Sep 29 19:41:48 2020
+++ src/tests/net/if_vether/t_vether.sh	Tue Sep 29 19:41:48 2020
@@ -0,0 +1,185 @@
+#	$NetBSD: t_vether.sh,v 1.1 2020/09/29 19:41:48 roy Exp $
+#
+# Copyright (c) 2016 Internet Initiative Japan Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+SOCK_LOCAL=unix://commsock1
+SOCK_REMOTE=unix://commsock2
+BUS=bus1
+IP4_LOCAL=10.0.0.1
+IP4_VETHER=10.0.0.2
+IP4_REMOTE=10.0.0.3
+IP6_LOCAL=fc00::1
+IP6_VETHER=fc00::2
+IP6_REMOTE=fc00::3
+
+DEBUG=${DEBUG:-false}
+TIMEOUT=1
+
+atf_test_case 

CVS commit: src/sys

2020-09-29 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Sep 29 19:33:36 UTC 2020

Modified Files:
src/sys/netinet: in.c
src/sys/netinet6: in6.c

Log Message:
inet: Treat LINK_STATE_UNKNOWN as LINK_STATE_UP when changing

It's something we have always done.
it's really rare for anything to transition to UNKNOWN from either
UP or DOWN, but technically it is possible.


To generate a diff of this commit:
cvs rdiff -u -r1.240 -r1.241 src/sys/netinet/in.c
cvs rdiff -u -r1.281 -r1.282 src/sys/netinet6/in6.c

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

Modified files:

Index: src/sys/netinet/in.c
diff -u src/sys/netinet/in.c:1.240 src/sys/netinet/in.c:1.241
--- src/sys/netinet/in.c:1.240	Fri Sep 11 15:22:12 2020
+++ src/sys/netinet/in.c	Tue Sep 29 19:33:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: in.c,v 1.240 2020/09/11 15:22:12 roy Exp $	*/
+/*	$NetBSD: in.c,v 1.241 2020/09/29 19:33:36 roy Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.240 2020/09/11 15:22:12 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.241 2020/09/29 19:33:36 roy Exp $");
 
 #include "arp.h"
 
@@ -1579,14 +1579,15 @@ void
 in_if_link_state_change(struct ifnet *ifp, int link_state)
 {
 
-	switch (link_state) {
-	case LINK_STATE_DOWN:
+	/*
+	 * Treat LINK_STATE_UNKNOWN as UP.
+	 * LINK_STATE_UNKNOWN transitions to LINK_STATE_DOWN when
+	 * if_link_state_change() transitions to LINK_STATE_UP.
+	 */
+	if (link_state == LINK_STATE_DOWN)
 		in_if_link_down(ifp);
-		break;
-	case LINK_STATE_UP:
+	else
 		in_if_link_up(ifp);
-		break;
-	}
 }
 
 /*

Index: src/sys/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.281 src/sys/netinet6/in6.c:1.282
--- src/sys/netinet6/in6.c:1.281	Tue Jun 16 17:12:18 2020
+++ src/sys/netinet6/in6.c	Tue Sep 29 19:33:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.281 2020/06/16 17:12:18 maxv Exp $	*/
+/*	$NetBSD: in6.c,v 1.282 2020/09/29 19:33:36 roy Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.281 2020/06/16 17:12:18 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.282 2020/09/29 19:33:36 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2250,14 +2250,15 @@ void
 in6_if_link_state_change(struct ifnet *ifp, int link_state)
 {
 
-	switch (link_state) {
-	case LINK_STATE_DOWN:
+	/*
+	 * Treat LINK_STATE_UNKNOWN as UP.
+	 * LINK_STATE_UNKNOWN transitions to LINK_STATE_DOWN when
+	 * if_link_state_change() transitions to LINK_STATE_UP.
+	 */
+	if (link_state == LINK_STATE_DOWN)
 		in6_if_link_down(ifp);
-		break;
-	case LINK_STATE_UP:
+	else
 		in6_if_link_up(ifp);
-		break;
-	}
 }
 
 int



CVS commit: src

2020-09-29 Thread Roy Marples
.a			comp-c-debuglib		debuglib,rump
 ./usr/lib/librumpnet_vlan_g.a			comp-c-debuglib		debuglib,rump
 ./usr/lib/librumpnet_wg_g.a			comp-c-debuglib		debuglib,rump

Index: src/distrib/sets/lists/debug/shl.mi
diff -u src/distrib/sets/lists/debug/shl.mi:1.265 src/distrib/sets/lists/debug/shl.mi:1.266
--- src/distrib/sets/lists/debug/shl.mi:1.265	Sat Sep 26 17:49:50 2020
+++ src/distrib/sets/lists/debug/shl.mi	Tue Sep 29 18:33:23 2020
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.265 2020/09/26 17:49:50 jmcneill Exp $
+# $NetBSD: shl.mi,v 1.266 2020/09/29 18:33:23 roy Exp $
 ./usr/lib/libbfd_g.a		comp-c-debuglib	debuglib,compatfile,binutils
 ./usr/libdata/debug/lib		base-sys-usr	debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libavl.so.0.0.debug			comp-zfs-debug	debug,dynamicroot,zfs
@@ -292,6 +292,7 @@
 ./usr/libdata/debug/usr/lib/librumpnet_sockin.so.0.0.debug	comp-rump-debug	debug,rump
 ./usr/libdata/debug/usr/lib/librumpnet_tap.so.0.0.debug		comp-rump-debug	debug,rump
 ./usr/libdata/debug/usr/lib/librumpnet_tun.so.0.0.debug		comp-rump-debug	debug,rump
+./usr/libdata/debug/usr/lib/librumpnet_vether.so.0.0.debug	comp-rump-debug	debug,rump
 ./usr/libdata/debug/usr/lib/librumpnet_virtif.so.0.0.debug	comp-rump-debug	debug,rump
 ./usr/libdata/debug/usr/lib/librumpnet_vlan.so.0.0.debug	comp-rump-debug	debug,rump
 ./usr/libdata/debug/usr/lib/librumpnet_wg.so.0.0.debug		comp-rump-debug	debug,rump

Index: src/sys/rump/net/Makefile.rumpnetcomp
diff -u src/sys/rump/net/Makefile.rumpnetcomp:1.22 src/sys/rump/net/Makefile.rumpnetcomp:1.23
--- src/sys/rump/net/Makefile.rumpnetcomp:1.22	Wed Aug 26 16:03:41 2020
+++ src/sys/rump/net/Makefile.rumpnetcomp	Tue Sep 29 18:33:23 2020
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile.rumpnetcomp,v 1.22 2020/08/26 16:03:41 riastradh Exp $
+#	$NetBSD: Makefile.rumpnetcomp,v 1.23 2020/09/29 18:33:23 roy Exp $
 #
 
 .include 
 
 RUMPNETCOMP=	agr bridge net net80211 netbt netcan netinet netinet6 netipsec
-RUMPNETCOMP+=	gif ipsec netmpls npf l2tp local pppoe shmif tap tun vlan
+RUMPNETCOMP+=	gif ipsec netmpls npf l2tp local pppoe shmif tap tun vlan vether
 RUMPNETCOMP+=	wg
 
 .if ${MKSLJIT} != "no" || make(rumpdescribe)

Added files:

Index: src/sys/rump/net/lib/libvether/Makefile
diff -u /dev/null src/sys/rump/net/lib/libvether/Makefile:1.1
--- /dev/null	Tue Sep 29 18:33:23 2020
+++ src/sys/rump/net/lib/libvether/Makefile	Tue Sep 29 18:33:23 2020
@@ -0,0 +1,15 @@
+#	$NetBSD: Makefile,v 1.1 2020/09/29 18:33:23 roy Exp $
+#
+
+.PATH:	${.CURDIR}/../../../../net
+
+LIB=	rumpnet_vether
+COMMENT=virtual Ethernet interface
+
+IOCONF=	VETHER.ioconf
+SRCS=	if_vether.c
+
+SRCS+=	vether_component.c
+
+.include 
+.include 
Index: src/sys/rump/net/lib/libvether/VETHER.ioconf
diff -u /dev/null src/sys/rump/net/lib/libvether/VETHER.ioconf:1.1
--- /dev/null	Tue Sep 29 18:33:23 2020
+++ src/sys/rump/net/lib/libvether/VETHER.ioconf	Tue Sep 29 18:33:23 2020
@@ -0,0 +1,7 @@
+#	$NetBSD: VETHER.ioconf,v 1.1 2020/09/29 18:33:23 roy Exp $
+
+ioconf		vether
+
+include		"conf/files"
+
+pseudo-device   vether
Index: src/sys/rump/net/lib/libvether/vether_component.c
diff -u /dev/null src/sys/rump/net/lib/libvether/vether_component.c:1.1
--- /dev/null	Tue Sep 29 18:33:23 2020
+++ src/sys/rump/net/lib/libvether/vether_component.c	Tue Sep 29 18:33:23 2020
@@ -0,0 +1,41 @@
+/*	$NetBSD: vether_component.c,v 1.1 2020/09/29 18:33:23 roy Exp $	*/
+
+/*
+ * Copyright (c) 2020 Roy Marples.  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: vether_component.c,v 1.1 2020/09/29 18:33:23 roy Exp $");
+
+#include 
+
+#include 
+
+void vetherattach(int);
+
+RUMP_COMPONENT(RUMP_COMPONENT_NET_IF)
+{
+
+	vetherattach(0);
+}



CVS commit: src/sys/rump/net/lib/libtap

2020-09-29 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Sep 29 18:31:31 UTC 2020

Modified Files:
src/sys/rump/net/lib/libtap: Makefile

Log Message:
libtap: Improve comment


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/rump/net/lib/libtap/Makefile

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

Modified files:

Index: src/sys/rump/net/lib/libtap/Makefile
diff -u src/sys/rump/net/lib/libtap/Makefile:1.5 src/sys/rump/net/lib/libtap/Makefile:1.6
--- src/sys/rump/net/lib/libtap/Makefile:1.5	Tue Jan 26 23:12:19 2016
+++ src/sys/rump/net/lib/libtap/Makefile	Tue Sep 29 18:31:31 2020
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.5 2016/01/26 23:12:19 pooka Exp $
+#	$NetBSD: Makefile,v 1.6 2020/09/29 18:31:31 roy Exp $
 #
 
 .PATH:	${.CURDIR}/../../../../net
 
 LIB=	rumpnet_tap
-COMMENT=/dev/tap virtual Ethernet interface
+COMMENT=/dev/tap Ethernet tunnel software network interface
 
 IOCONF=	TAP.ioconf
 SRCS=	if_tap.c



CVS commit: src/tests/libexec/ld.elf_so

2020-09-29 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Sep 29 16:35:42 UTC 2020

Modified Files:
src/tests/libexec/ld.elf_so: t_rtld_r_debug.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c

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

Modified files:

Index: src/tests/libexec/ld.elf_so/t_rtld_r_debug.c
diff -u src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.2 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.3
--- src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.2	Tue Sep 29 16:34:07 2020
+++ src/tests/libexec/ld.elf_so/t_rtld_r_debug.c	Tue Sep 29 16:35:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_rtld_r_debug.c,v 1.2 2020/09/29 16:34:07 roy Exp $	*/
+/*	$NetBSD: t_rtld_r_debug.c,v 1.3 2020/09/29 16:35:42 roy Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@ getauxval(unsigned int type)
 	const AuxInfo *aux;
 
 	for (aux = _dlauxinfo(); aux->a_type != AT_NULL; ++aux) {
-		if (type == aux->a_type)  
+		if (type == aux->a_type)
 			return aux->a_v;
 	}
 
@@ -67,11 +67,11 @@ get_dynamic_section(void)
 	dynphdr = NULL;
 
 	for (; phdr < phlimit; ++phdr) {
-if (phdr->p_type == PT_DYNAMIC)
-dynphdr = phdr;   
-if (phdr->p_type == PT_PHDR)
-relocbase = (uintptr_t)phdr - phdr->p_vaddr;
-}
+		if (phdr->p_type == PT_DYNAMIC)
+			dynphdr = phdr;
+		if (phdr->p_type == PT_PHDR)
+			relocbase = (uintptr_t)phdr - phdr->p_vaddr;
+	}
 
 	return (Elf_Dyn *)((uint8_t *)dynphdr->p_vaddr + relocbase);
 }



CVS commit: src/tests/libexec/ld.elf_so

2020-09-29 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Sep 29 16:34:08 UTC 2020

Modified Files:
src/tests/libexec/ld.elf_so: t_rtld_r_debug.c

Log Message:
Fix build with clang.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c

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

Modified files:

Index: src/tests/libexec/ld.elf_so/t_rtld_r_debug.c
diff -u src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.1 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.2
--- src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.1	Tue Sep 22 01:09:32 2020
+++ src/tests/libexec/ld.elf_so/t_rtld_r_debug.c	Tue Sep 29 16:34:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_rtld_r_debug.c,v 1.1 2020/09/22 01:09:32 kamil Exp $	*/
+/*	$NetBSD: t_rtld_r_debug.c,v 1.2 2020/09/29 16:34:07 roy Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@ get_dynamic_section(void)
 static struct r_debug *
 get_rtld_r_debug(void)
 {
-	struct r_debug *debug;
+	struct r_debug *debug = NULL;
 	Elf_Dyn *dynp;
 
 	for (dynp = get_dynamic_section(); dynp->d_tag != DT_NULL; dynp++) {



CVS commit: src/usr.bin/xinstall

2020-09-29 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Sep 29 12:04:48 UTC 2020

Modified Files:
src/usr.bin/xinstall: Makefile

Log Message:
xinstall: define MAKE_NATIVE so our make parts compile


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/xinstall/Makefile

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

Modified files:

Index: src/usr.bin/xinstall/Makefile
diff -u src/usr.bin/xinstall/Makefile:1.27 src/usr.bin/xinstall/Makefile:1.28
--- src/usr.bin/xinstall/Makefile:1.27	Mon Sep  7 00:26:24 2020
+++ src/usr.bin/xinstall/Makefile	Tue Sep 29 12:04:48 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.27 2020/09/07 00:26:24 mrg Exp $
+#	$NetBSD: Makefile,v 1.28 2020/09/29 12:04:48 roy Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 .include 
@@ -9,6 +9,7 @@ MAN=	install.1
 
 .PATH:		${NETBSDSRCDIR}/usr.bin/make
 CPPFLAGS+=	-I${NETBSDSRCDIR}/usr.bin/make
+CPPFLAGS+=	-DMAKE_NATIVE
 
 .PATH:		${NETBSDSRCDIR}/usr.sbin/mtree
 CPPFLAGS+=	-I${NETBSDSRCDIR}/usr.sbin/mtree



CVS commit: src/sbin/ifconfig

2020-09-28 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Sep 28 13:50:22 UTC 2020

Modified Files:
src/sbin/ifconfig: ifconfig.c

Log Message:
ifconfig: Just look at if_data->ifi_link_state for carrier

It should be the sole source of truth.
if_data is also carried in ifa_data from getifaddrs(3) which saves
more ioctl calls.


To generate a diff of this commit:
cvs rdiff -u -r1.246 -r1.247 src/sbin/ifconfig/ifconfig.c

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

Modified files:

Index: src/sbin/ifconfig/ifconfig.c
diff -u src/sbin/ifconfig/ifconfig.c:1.246 src/sbin/ifconfig/ifconfig.c:1.247
--- src/sbin/ifconfig/ifconfig.c:1.246	Sat Sep 26 23:43:26 2020
+++ src/sbin/ifconfig/ifconfig.c	Mon Sep 28 13:50:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ifconfig.c,v 1.246 2020/09/26 23:43:26 roy Exp $	*/
+/*	$NetBSD: ifconfig.c,v 1.247 2020/09/28 13:50:22 roy Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1983, 1993\
  The Regents of the University of California.  All rights reserved.");
-__RCSID("$NetBSD: ifconfig.c,v 1.246 2020/09/26 23:43:26 roy Exp $");
+__RCSID("$NetBSD: ifconfig.c,v 1.247 2020/09/28 13:50:22 roy Exp $");
 #endif /* not lint */
 
 #include 
@@ -852,6 +852,7 @@ printall(const char *ifname, prop_dictio
 	struct ifaddrs *ifap, *ifa;
 	struct ifreq ifr;
 	const struct sockaddr_dl *sdl = NULL;
+	const struct if_data *ifi = NULL;
 	prop_dictionary_t env, oenv;
 	int idx;
 	char *p;
@@ -880,8 +881,10 @@ printall(const char *ifname, prop_dictio
 
 		if (ifname != NULL && strcmp(ifname, ifa->ifa_name) != 0)
 			continue;
-		if (ifa->ifa_addr->sa_family == AF_LINK)
+		if (ifa->ifa_addr->sa_family == AF_LINK) {
 			sdl = (const struct sockaddr_dl *)ifa->ifa_addr;
+			ifi = (const struct if_data *)ifa->ifa_data;
+		}
 		if (p && strcmp(p, ifa->ifa_name) == 0)
 			continue;
 		if (!prop_dictionary_set_string(env, "if", ifa->ifa_name))
@@ -895,7 +898,8 @@ printall(const char *ifname, prop_dictio
 		if (uflag && (ifa->ifa_flags & IFF_UP) == 0)
 			continue;
 
-		if (sflag && carrier(env))
+		if (sflag && (ifi == NULL ||
+		  ifi->ifi_link_state == LINK_STATE_DOWN))
 			continue;
 		idx++;
 		/*
@@ -910,6 +914,7 @@ printall(const char *ifname, prop_dictio
 
 		status(sdl, ifa->ifa_data, env, oenv);
 		sdl = NULL;
+		ifi = NULL;
 	}
 	if (lflag)
 		printf("\n");
@@ -1213,34 +1218,15 @@ setifmtu(prop_dictionary_t env, prop_dic
 static int
 carrier(prop_dictionary_t env)
 {
-	struct ifmediareq ifmr = { .ifm_status = 0 };
+	struct ifdatareq ifdr = { .ifdr_data.ifi_link_state = 0 };
 
-	if (direct_ioctl(env, SIOCGIFMEDIA, ) == -1) {
-		/*
-		 * Interface doesn't support SIOC{G,S}IFMEDIA;
-		 * check link state.
-		 */
-		struct ifdatareq ifdr = { .ifdr_data.ifi_link_state = 0 };
+	if (direct_ioctl(env, SIOCGIFDATA, ) == -1)
+		return EXIT_FAILURE;
 
-		if (direct_ioctl(env, SIOCGIFDATA, ) == -1)
-			return EXIT_FAILURE;
-		if (ifdr.ifdr_data.ifi_link_state == LINK_STATE_DOWN)
-			return EXIT_FAILURE;
-		else
-			return EXIT_SUCCESS;
-	}
-	if ((ifmr.ifm_status & IFM_AVALID) == 0) {
-		/*
-		 * Interface doesn't report media-valid status.
-		 * assume ok.
-		 */
-		return EXIT_SUCCESS;
-	}
-	/* otherwise, return ok for active, not-ok if not active. */
-	if (ifmr.ifm_status & IFM_ACTIVE)
-		return EXIT_SUCCESS;
-	else
+	if (ifdr.ifdr_data.ifi_link_state == LINK_STATE_DOWN)
 		return EXIT_FAILURE;
+	else /* Assume UP if UNKNOWN */
+		return EXIT_SUCCESS;
 }
 
 static void



CVS commit: src/usr.sbin/ifwatchd

2020-09-27 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Sep 27 19:55:22 UTC 2020

Modified Files:
src/usr.sbin/ifwatchd: ifwatchd.c

Log Message:
ifwatchd: remove SIOCGIFDATA and SIOCGIFMEDIA ioctls

getifaddrs(3) and route(4) provide all the data we need.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/ifwatchd/ifwatchd.c

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

Modified files:

Index: src/usr.sbin/ifwatchd/ifwatchd.c
diff -u src/usr.sbin/ifwatchd/ifwatchd.c:1.44 src/usr.sbin/ifwatchd/ifwatchd.c:1.45
--- src/usr.sbin/ifwatchd/ifwatchd.c:1.44	Wed Sep 23 02:32:04 2020
+++ src/usr.sbin/ifwatchd/ifwatchd.c	Sun Sep 27 19:55:21 2020
@@ -1,6 +1,6 @@
-/*	$NetBSD: ifwatchd.c,v 1.44 2020/09/23 02:32:04 roy Exp $	*/
+/*	$NetBSD: ifwatchd.c,v 1.45 2020/09/27 19:55:21 roy Exp $	*/
 #include 
-__RCSID("$NetBSD: ifwatchd.c,v 1.44 2020/09/23 02:32:04 roy Exp $");
+__RCSID("$NetBSD: ifwatchd.c,v 1.45 2020/09/27 19:55:21 roy Exp $");
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -39,7 +39,6 @@ __RCSID("$NetBSD: ifwatchd.c,v 1.44 2020
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -536,46 +535,13 @@ find_interface(int idx)
 	return NULL;
 }
 
-static bool
-has_carrier(int s, const char *ifname)
-{
-	struct ifmediareq ifmr = { .ifm_status = 0 };
-
-	strlcpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name));
-	if (ioctl(s, SIOCGIFMEDIA, ) == -1) {
-		struct ifdatareq ifdr = { .ifdr_data.ifi_link_state = 0 };
-
-		strlcpy(ifdr.ifdr_name, ifname, sizeof(ifdr.ifdr_name));
-		if (ioctl(s, SIOCGIFDATA, ) == -1) {
-			/* Should not be possible. */
-			return false;
-		}
-		if (ifdr.ifdr_data.ifi_link_state == LINK_STATE_UP)
-			return true;
-		else
-			return false;
-	}
-
-	if (!(ifmr.ifm_status & IFM_AVALID)) {
-		/*
-		 * Interface doesn't report media-valid status.
-		 * assume ok.
-		 */
-		return true;
-	}
-
-	if (ifmr.ifm_status & IFM_ACTIVE)
-		return true;
-	else
-		return false;
-}
-
 static void
 run_initial_ups(void)
 {
 	struct interface_data * ifd;
 	struct ifaddrs *res = NULL, *p;
 	struct sockaddr *ifa;
+	const struct if_data *ifi;
 	int s, aflag;
 
 	s = socket(AF_INET, SOCK_DGRAM, 0);
@@ -602,11 +568,10 @@ run_initial_ups(void)
 		if (ifa == NULL)
 			continue;
 		if (ifa->sa_family == AF_LINK) {
-			if (has_carrier(s, ifd->ifname) == 0) {
+			ifi = (const struct if_data *)p->ifa_data;
+			if (ifi->ifi_link_state == LINK_STATE_UP)
 invoke_script(ifd->ifname, CARRIER, NULL, NULL);
-ifd->last_carrier_status =
-LINK_STATE_UP;
-			}
+			ifd->last_carrier_status = ifi->ifi_link_state;
 			continue;
 		}
 		aflag = check_addrflags(ifa->sa_family, p->ifa_addrflags);



CVS commit: src/share/man/man4

2020-09-27 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Sep 27 19:36:54 UTC 2020

Modified Files:
src/share/man/man4: tap.4 tun.4

Log Message:
Note that opening and closing the tun/tap devices affects link state.

And how this influences Duplicate Address Detection.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/share/man/man4/tap.4
cvs rdiff -u -r1.24 -r1.25 src/share/man/man4/tun.4

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

Modified files:

Index: src/share/man/man4/tap.4
diff -u src/share/man/man4/tap.4:1.14 src/share/man/man4/tap.4:1.15
--- src/share/man/man4/tap.4:1.14	Sun Sep 27 15:19:04 2020
+++ src/share/man/man4/tap.4	Sun Sep 27 19:36:54 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: tap.4,v 1.14 2020/09/27 15:19:04 roy Exp $
+.\" $NetBSD: tap.4,v 1.15 2020/09/27 19:36:54 roy Exp $
 .\"
 .\"  Copyright (c) 2004, 2005 The NetBSD Foundation.
 .\"  All rights reserved.
@@ -159,6 +159,14 @@ ioctl on a
 .Dv PF_LINK
 socket, as it is not available on
 the ioctl handler of the character device interface.
+.Ss LINK STATE
+When an application has opened the
+.Nm
+character device the link is considered up, otherwise down.
+As such, it is best to open the character device once connectivity has
+been established so that Duplicate Address Detection, if applicable,
+can be performed.
+If connectivity is lost, the character device should be closed.
 .Sh FILES
 .Bl -tag -compact -width /dev/tap[0-9]*
 .It Pa /dev/tap

Index: src/share/man/man4/tun.4
diff -u src/share/man/man4/tun.4:1.24 src/share/man/man4/tun.4:1.25
--- src/share/man/man4/tun.4:1.24	Tue Mar 26 09:58:20 2019
+++ src/share/man/man4/tun.4	Sun Sep 27 19:36:54 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: tun.4,v 1.24 2019/03/26 09:58:20 pgoyette Exp $
+.\" $NetBSD: tun.4,v 1.25 2020/09/27 19:36:54 roy Exp $
 .\"
 .\" Copyright (c) 1996-2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 8, 2006
+.Dd September 27, 2020
 .Dt TUN 4
 .Os
 .Sh NAME
@@ -272,6 +272,14 @@ All queued packets are thrown away.
 If the interface is up when the data device is not open
 output packets are always thrown away rather than letting
 them pile up.
+.Ss LINK STATE
+When an application has opened the
+.Nm
+character device the link is considered up, otherwise down.
+As such, it is best to open the character device once connectivity has
+been established so that Duplicate Address Detection, if applicable,
+can be performed.
+If connectivity is lost, the character device should be closed.
 .Sh SEE ALSO
 .Xr inet 4 ,
 .Xr intro 4



CVS commit: src/sys/net

2020-09-27 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Sep 27 19:25:54 UTC 2020

Modified Files:
src/sys/net: if_tun.c

Log Message:
tun: Report link state based on if the interface has been opened or not

This mirrors tap(4).


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/net/if_tun.c

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

Modified files:

Index: src/sys/net/if_tun.c
diff -u src/sys/net/if_tun.c:1.160 src/sys/net/if_tun.c:1.161
--- src/sys/net/if_tun.c:1.160	Sat Aug 29 07:14:50 2020
+++ src/sys/net/if_tun.c	Sun Sep 27 19:25:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tun.c,v 1.160 2020/08/29 07:14:50 maxv Exp $	*/
+/*	$NetBSD: if_tun.c,v 1.161 2020/09/27 19:25:54 roy Exp $	*/
 
 /*
  * Copyright (c) 1988, Julian Onions 
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.160 2020/08/29 07:14:50 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.161 2020/09/27 19:25:54 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -256,12 +256,12 @@ tunattach0(struct tun_softc *tp)
 	ifp->if_start = tunstart;
 #endif
 	ifp->if_flags = IFF_POINTOPOINT;
-	ifp->if_extflags = IFEF_NO_LINK_STATE_CHANGE;
 	ifp->if_type = IFT_TUNNEL;
 	ifp->if_snd.ifq_maxlen = ifqmaxlen;
 	ifp->if_dlt = DLT_NULL;
 	IFQ_SET_READY(>if_snd);
 	if_attach(ifp);
+	ifp->if_link_state = LINK_STATE_DOWN;
 	if_alloc_sadl(ifp);
 	bpf_attach(ifp, DLT_NULL, sizeof(uint32_t));
 }
@@ -347,6 +347,7 @@ tunopen(dev_t dev, int flag, int mode, s
 	ifp = >tun_if;
 	tp->tun_flags |= TUN_OPEN;
 	TUNDEBUG("%s: open\n", ifp->if_xname);
+	if_link_state_change(ifp, LINK_STATE_UP);
 
 	mutex_exit(>tun_lock);
 
@@ -411,6 +412,9 @@ tunclose(dev_t dev, int flag, int mode,
 			}
 		}
 	}
+
+	if_link_state_change(ifp, LINK_STATE_DOWN);
+
 out_nolock:
 	return 0;
 }



CVS commit: src/sys/net

2020-09-27 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Sep 27 19:16:28 UTC 2020

Modified Files:
src/sys/net: if.c if.h if_bridge.c

Log Message:
bridge: When an interface joins then mark addresses on it as tentative

The exact flow is detatch addresses, join bridge and then mark detached
addresses as tentative.
This ensures that Duplicate Address Detection for the joining interface
are performed across all members of the bridge.


To generate a diff of this commit:
cvs rdiff -u -r1.482 -r1.483 src/sys/net/if.c
cvs rdiff -u -r1.287 -r1.288 src/sys/net/if.h
cvs rdiff -u -r1.175 -r1.176 src/sys/net/if_bridge.c

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

Modified files:

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.482 src/sys/net/if.c:1.483
--- src/sys/net/if.c:1.482	Sun Sep 27 00:32:17 2020
+++ src/sys/net/if.c	Sun Sep 27 19:16:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.482 2020/09/27 00:32:17 roy Exp $	*/
+/*	$NetBSD: if.c,v 1.483 2020/09/27 19:16:28 roy Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.482 2020/09/27 00:32:17 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.483 2020/09/27 19:16:28 roy Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2473,6 +2473,28 @@ out:
 }
 
 /*
+ * Used to mark addresses on an interface as DETATCHED or TENTATIVE
+ * and thus start Duplicate Address Detection without changing the
+ * real link state.
+ */
+void
+if_domain_link_state_change(struct ifnet *ifp, int link_state)
+{
+	struct domain *dp;
+	int s = splnet();
+
+	KERNEL_LOCK_UNLESS_NET_MPSAFE();
+
+	DOMAIN_FOREACH(dp) {
+		if (dp->dom_if_link_state_change != NULL)
+			dp->dom_if_link_state_change(ifp, link_state);
+	}
+
+	splx(s);
+	KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
+}
+
+/*
  * Default action when installing a local route on a point-to-point
  * interface.
  */

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.287 src/sys/net/if.h:1.288
--- src/sys/net/if.h:1.287	Sat Sep 26 18:35:12 2020
+++ src/sys/net/if.h	Sun Sep 27 19:16:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.287 2020/09/26 18:35:12 roy Exp $	*/
+/*	$NetBSD: if.h,v 1.288 2020/09/27 19:16:28 roy Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -1134,6 +1134,7 @@ void	if_detach(struct ifnet *);
 void	if_down(struct ifnet *);
 void	if_down_locked(struct ifnet *);
 void	if_link_state_change(struct ifnet *, int);
+void	if_domain_link_state_change(struct ifnet *, int);
 void	if_up(struct ifnet *);
 void	ifinit(void);
 void	ifinit1(void);

Index: src/sys/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.175 src/sys/net/if_bridge.c:1.176
--- src/sys/net/if_bridge.c:1.175	Sun Sep 27 00:32:17 2020
+++ src/sys/net/if_bridge.c	Sun Sep 27 19:16:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.175 2020/09/27 00:32:17 roy Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.176 2020/09/27 19:16:28 roy Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.175 2020/09/27 00:32:17 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.176 2020/09/27 19:16:28 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -904,6 +904,13 @@ bridge_ioctl_add(struct bridge_softc *sc
 	PSLIST_ENTRY_INIT(bif, bif_next);
 	psref_target_init(>bif_psref, bridge_psref_class);
 
+	/*
+	 * Pretend that the link is down for domains.
+	 * This will detach any addresses assigned to the interface.
+	 */
+	if (ifs->if_link_state != LINK_STATE_DOWN)
+		if_domain_link_state_change(ifs, LINK_STATE_DOWN);
+
 	BRIDGE_LOCK(sc);
 
 	ifs->if_bridge = sc;
@@ -921,6 +928,13 @@ bridge_ioctl_add(struct bridge_softc *sc
 	else
 		bstp_stop(sc);
 
+	/*
+	 * If the link was not initially down then mark any detached addresses
+	 * as tentative and start Duplicate Address Detection for them.
+	 */
+	if (ifs->if_link_state != LINK_STATE_DOWN)
+		if_domain_link_state_change(ifs, ifs->if_link_state);
+
 out:
 	if_put(ifs, );
 	if (error) {



CVS commit: src/sys/conf

2020-09-27 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Sep 27 19:08:11 UTC 2020

Modified Files:
src/sys/conf: files

Log Message:
Wups, forgot to commit this with vether.


To generate a diff of this commit:
cvs rdiff -u -r1.1275 -r1.1276 src/sys/conf/files

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

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1275 src/sys/conf/files:1.1276
--- src/sys/conf/files:1.1275	Thu Aug 20 21:21:31 2020
+++ src/sys/conf/files	Sun Sep 27 19:08:11 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1275 2020/08/20 21:21:31 riastradh Exp $
+#	$NetBSD: files,v 1.1276 2020/09/27 19:08:11 roy Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20171118
@@ -1420,6 +1420,7 @@ defpseudo pppoe:	ifnet, ether, sppp
 defpseudo tun:		ifnet
 defpseudo vlan:		ifnet, ether
 defpseudo bridge:	ifnet, ether
+defpseudo vether:	ifnet, ether
 defpseudo bpfilter:	ifnet, bpf_filter
 defpseudo strip:	ifnet
 defpseudo gre:		ifnet



CVS commit: src/share/man/man4

2020-09-27 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Sep 27 15:42:48 UTC 2020

Modified Files:
src/share/man/man4: bridge.4

Log Message:
bridge(4): Note that the bridge does not allow assignment of IP addresses

Document using vether(4) instead to get the same effect.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/bridge.4

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

Modified files:

Index: src/share/man/man4/bridge.4
diff -u src/share/man/man4/bridge.4:1.13 src/share/man/man4/bridge.4:1.14
--- src/share/man/man4/bridge.4:1.13	Sat Aug  1 08:20:47 2020
+++ src/share/man/man4/bridge.4	Sun Sep 27 15:42:48 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: bridge.4,v 1.13 2020/08/01 08:20:47 maxv Exp $
+.\"	$NetBSD: bridge.4,v 1.14 2020/09/27 15:42:48 roy Exp $
 .\"
 .\" Copyright 2001 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 1, 2020
+.Dd September 27, 2020
 .Dt BRIDGE 4
 .Os
 .Sh NAME
@@ -96,10 +96,18 @@ driver will enable passing of VLAN tagge
 interfaces support it.
 This is to facilitate XEN network configurations with
 .Xr xennet 4 .
+.Pp
+It is not possible to assign an IP address directly to the
+.Nm
+interface.
+Instead, assign an IP address to a
+.Xr vether 4
+interface which can be added to the bridge.
 .Sh SEE ALSO
 .Xr l2tp 4 ,
 .Xr options 4 ,
 .Xr xennet 4 ,
+.Xr vether 4 ,
 .Xr brconfig 8 ,
 .Xr ipf 8
 .Sh HISTORY



CVS commit: src/share/man/man4

2020-09-27 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Sep 27 15:19:04 UTC 2020

Modified Files:
src/share/man/man4: tap.4

Log Message:
tap(4): Improve the description to differentiate from vether(4)


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/tap.4

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

Modified files:

Index: src/share/man/man4/tap.4
diff -u src/share/man/man4/tap.4:1.13 src/share/man/man4/tap.4:1.14
--- src/share/man/man4/tap.4:1.13	Sun Sep 27 13:44:47 2020
+++ src/share/man/man4/tap.4	Sun Sep 27 15:19:04 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: tap.4,v 1.13 2020/09/27 13:44:47 roy Exp $
+.\" $NetBSD: tap.4,v 1.14 2020/09/27 15:19:04 roy Exp $
 .\"
 .\"  Copyright (c) 2004, 2005 The NetBSD Foundation.
 .\"  All rights reserved.
@@ -29,7 +29,7 @@
 .Os
 .Sh NAME
 .Nm tap
-.Nd virtual Ethernet device
+.Nd Ethernet tunnel software network interface
 .Sh SYNOPSIS
 .Cd pseudo-device tap
 .Sh DESCRIPTION



CVS commit: src/sys/arch

2020-09-27 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Sep 27 13:48:55 UTC 2020

Modified Files:
src/sys/arch/acorn32/conf: EB7500ATX GENERIC INSTALL
src/sys/arch/alpha/conf: GENERIC
src/sys/arch/amd64/conf: ALL GENERIC MODULAR XEN3_DOM0 XEN3_DOMU
src/sys/arch/amiga/conf: DRACO GENERIC GENERIC.in INSTALL
src/sys/arch/amigappc/conf: GENERIC NULL
src/sys/arch/arc/conf: GENERIC RAMDISK RPC44
src/sys/arch/atari/conf: GENERIC.in
src/sys/arch/bebox/conf: GENERIC
src/sys/arch/cats/conf: GENERIC
src/sys/arch/cesfic/conf: GENERIC
src/sys/arch/cobalt/conf: GENERIC INSTALL
src/sys/arch/dreamcast/conf: G1IDE GENERIC
src/sys/arch/emips/conf: GENERIC
src/sys/arch/evbarm/conf: ARMADILLO210 ARMADILLO9 BCM5301X CP3100 CUBOX
DUOVERO GENERIC.common GUMSTIX HDL_G HPT5325 INTEGRATOR
INTEGRATOR_CP IYONIX MARVELL_NAS MINI2440 MMNET_GENERIC
MPCSA_GENERIC MV2120 NSLU2 OPENBLOCKS_A6 OPENBLOCKS_AX3 PEPPER
SHEEVAPLUG SMDK2410 SMDK2800 TWINTAIL
src/sys/arch/evbmips/conf: ALCHEMY AP30 CI20 CPMBR1400 DB120 GDIUM
LINKITSMART7688 LOONGSON MALTA MERAKI OCTEON RB433UAH SBMIPS
WGT624V3 XLSATX ZYXELKX
src/sys/arch/evbppc/conf: EXPLORA451 OPENBLOCKS266 OPENBLOCKS600
src/sys/arch/evbsh3/conf: NEXTVOD
src/sys/arch/ews4800mips/conf: GENERIC RAMDISK
src/sys/arch/hp300/conf: GENERIC INSTALL
src/sys/arch/hppa/conf: GENERIC
src/sys/arch/i386/conf: ALL GENERIC GENERIC_TINY NET4501 XEN3PAE_DOM0
XEN3PAE_DOMU
src/sys/arch/ia64/conf: GENERIC.SKI
src/sys/arch/iyonix/conf: GENERIC
src/sys/arch/landisk/conf: GENERIC
src/sys/arch/luna68k/conf: GENERIC INSTALL
src/sys/arch/mac68k/conf: GENERIC SMALLRAM
src/sys/arch/macppc/conf: GENERIC GENERIC_601
src/sys/arch/mipsco/conf: GENERIC
src/sys/arch/mmeye/conf: GENERIC MMEYE_WLF
src/sys/arch/mvme68k/conf: GENERIC
src/sys/arch/mvmeppc/conf: GENERIC
src/sys/arch/netwinder/conf: GENERIC
src/sys/arch/news68k/conf: GENERIC GENERIC_TINY
src/sys/arch/newsmips/conf: GENERIC
src/sys/arch/next68k/conf: GENERIC
src/sys/arch/ofppc/conf: GENERIC
src/sys/arch/pmax/conf: GENERIC GENERIC64
src/sys/arch/prep/conf: GENERIC
src/sys/arch/rs6000/conf: GENERIC
src/sys/arch/sandpoint/conf: ENCPP1 GENERIC SANDPOINT
src/sys/arch/sbmips/conf: GENERIC
src/sys/arch/sgimips/conf: GENERIC32_IP12 GENERIC32_IP2x GENERIC32_IP3x
INSTALL32_IP2x
src/sys/arch/sparc/conf: GENERIC INSTALL
src/sys/arch/sparc64/conf: GENERIC
src/sys/arch/sun2/conf: GENERIC VME
src/sys/arch/sun3/conf: DISKLESS GENERIC GENERIC3X
src/sys/arch/vax/conf: GENERIC VAX780
src/sys/arch/x68k/conf: GENERIC

Log Message:
vether: Add to kernel configurations

It's only enabled if the kernel enabled bridge AND tap.
Otherwise it's commented out.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/acorn32/conf/EB7500ATX
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/acorn32/conf/GENERIC
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/acorn32/conf/INSTALL
cvs rdiff -u -r1.407 -r1.408 src/sys/arch/alpha/conf/GENERIC
cvs rdiff -u -r1.163 -r1.164 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.579 -r1.580 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/conf/MODULAR
cvs rdiff -u -r1.184 -r1.185 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/amd64/conf/XEN3_DOMU
cvs rdiff -u -r1.194 -r1.195 src/sys/arch/amiga/conf/DRACO
cvs rdiff -u -r1.329 -r1.330 src/sys/arch/amiga/conf/GENERIC
cvs rdiff -u -r1.145 -r1.146 src/sys/arch/amiga/conf/GENERIC.in
cvs rdiff -u -r1.135 -r1.136 src/sys/arch/amiga/conf/INSTALL
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amigappc/conf/GENERIC
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/amigappc/conf/NULL
cvs rdiff -u -r1.199 -r1.200 src/sys/arch/arc/conf/GENERIC
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/arc/conf/RAMDISK
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/arc/conf/RPC44
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/atari/conf/GENERIC.in
cvs rdiff -u -r1.163 -r1.164 src/sys/arch/bebox/conf/GENERIC
cvs rdiff -u -r1.182 -r1.183 src/sys/arch/cats/conf/GENERIC
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/cesfic/conf/GENERIC
cvs rdiff -u -r1.169 -r1.170 src/sys/arch/cobalt/conf/GENERIC
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/cobalt/conf/INSTALL
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/dreamcast/conf/G1IDE
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/dreamcast/conf/GENERIC
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/emips/conf/GENERIC
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/evbarm/conf/ARMADILLO210
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/evbarm/conf/ARMADILLO9 \
src/sys/arch/evbarm/conf/SMDK2800
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/evbarm/conf/BCM5301X

CVS commit: src/doc

2020-09-27 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Sep 27 13:46:19 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
Note import of vether(4)


To generate a diff of this commit:
cvs rdiff -u -r1.2741 -r1.2742 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2741 src/doc/CHANGES:1.2742
--- src/doc/CHANGES:1.2741	Mon Sep 21 16:12:16 2020
+++ src/doc/CHANGES	Sun Sep 27 13:46:19 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2741 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2742 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -288,3 +288,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 		pmap module.  Implemented fast-soft-interrupts.  Enabled
 		MULTIPROCESSOR in GENERIC.  [thorpej 20200918]
 	ld.so(1): Upgrade r_debug to the protocol version 1. [kamil 20200921]
+	vether(4): Imported from OpenBSD. [roy 20200927]



  1   2   3   4   5   6   7   8   9   10   >