CVS commit: src/tests/net/if_wg

2020-08-29 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Sat Aug 29 07:22:49 UTC 2020

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

Log Message:
Update the if_wg tests for the human readable 'latest-handshake'
output of wgconfig.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/net/if_wg/t_misc.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_wg/t_tunnel.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_misc.sh
diff -u src/tests/net/if_wg/t_misc.sh:1.3 src/tests/net/if_wg/t_misc.sh:1.4
--- src/tests/net/if_wg/t_misc.sh:1.3	Thu Aug 27 02:52:33 2020
+++ src/tests/net/if_wg/t_misc.sh	Sat Aug 29 07:22:49 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: t_misc.sh,v 1.3 2020/08/27 02:52:33 riastradh Exp $
+#	$NetBSD: t_misc.sh,v 1.4 2020/08/29 07:22:49 tih Exp $
 #
 # Copyright (c) 2018 Ryota Ozaki 
 # All rights reserved.
@@ -81,7 +81,7 @@ wg_rekey_body()
 	$ping $ip_wg_peer
 
 	latest_handshake=$($HIJACKING wgconfig wg0 show peer peer0 \
-	| awk -F : '/latest-handshake/ {print $2;}')
+	| awk -F ': ' '/latest-handshake/ {print $2;}')
 	$DEBUG && echo $latest_handshake
 
 	sleep 1
@@ -102,7 +102,7 @@ wg_rekey_body()
 	$HIJACKING wgconfig wg0 show peer peer0
 
 	latest_handshake=$($HIJACKING wgconfig wg0 show peer peer0 \
-	| awk -F : '/latest-handshake/ {print $2;}')
+	| awk -F ': ' '/latest-handshake/ {print $2;}')
 	$DEBUG && echo $latest_handshake
 
 	# Wait for a reinitiation to be performed again
@@ -142,7 +142,6 @@ wg_handshake_timeout_body()
 	local ip_wg_peer=10.0.0.2
 	local port=51820
 	local rekey_after_time=3
-	local latest_handshake=
 	local outfile=./out
 	local rekey_timeout=3
 	local rekey_attempt_time=8
@@ -278,7 +277,7 @@ wg_cookie_body()
 	cat $outfile
 
 	$DEBUG && $HIJACKING wgconfig wg0 show all
-	atf_check -s exit:0 -o match:"latest-handshake: 0" \
+	atf_check -s exit:0 -o match:"latest-handshake: \(never\)" \
 	$HIJACKING wgconfig wg0
 
 	# Wait for restarting a session
@@ -289,7 +288,7 @@ wg_cookie_body()
 	$ping $ip_wg_peer
 
 	$DEBUG && $HIJACKING wgconfig wg0 show all
-	atf_check -s exit:0 -o not-match:"latest-handshake: 0" \
+	atf_check -s exit:0 -o not-match:"latest-handshake: \(never\)" \
 	$HIJACKING wgconfig wg0
 
 	destroy_wg_interfaces

Index: src/tests/net/if_wg/t_tunnel.sh
diff -u src/tests/net/if_wg/t_tunnel.sh:1.1 src/tests/net/if_wg/t_tunnel.sh:1.2
--- src/tests/net/if_wg/t_tunnel.sh:1.1	Wed Aug 26 16:03:42 2020
+++ src/tests/net/if_wg/t_tunnel.sh	Sat Aug 29 07:22:49 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: t_tunnel.sh,v 1.1 2020/08/26 16:03:42 riastradh Exp $
+#	$NetBSD: t_tunnel.sh,v 1.2 2020/08/29 07:22:49 tih Exp $
 #
 # Copyright (c) 2018 Ryota Ozaki 
 # All rights reserved.
@@ -267,14 +267,14 @@ wg_tunnel_common()
 	$ip_wg_local/$inner_prefixall,$subnet_local
 
 	export RUMP_SERVER=$SOCK_TUN_LOCAL
-	atf_check -s exit:0 -o match:"latest-handshake: 0" \
+	atf_check -s exit:0 -o match:"latest-handshake: \(never\)" \
 	$HIJACKING wgconfig wg0 show peer peer0
 
 	export RUMP_SERVER=$SOCK_LOCAL
 	check_ping $inner_proto $ip_peer
 
 	export RUMP_SERVER=$SOCK_TUN_LOCAL
-	atf_check -s exit:0 -o not-match:"latest-handshake: 0" \
+	atf_check -s exit:0 -o not-match:"latest-handshake: \(never\)" \
 	$HIJACKING wgconfig wg0 show peer peer0
 
 	export RUMP_SERVER=$SOCK_LOCAL



CVS commit: src/usr.sbin/wgconfig

2020-08-28 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Fri Aug 28 17:17:53 UTC 2020

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

Log Message:
Show the time of the latest handshake properly formatted.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/wgconfig/wgconfig.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/wgconfig/wgconfig.c
diff -u src/usr.sbin/wgconfig/wgconfig.c:1.4 src/usr.sbin/wgconfig/wgconfig.c:1.5
--- src/usr.sbin/wgconfig/wgconfig.c:1.4	Fri Aug 21 17:51:31 2020
+++ src/usr.sbin/wgconfig/wgconfig.c	Fri Aug 28 17:17:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: wgconfig.c,v 1.4 2020/08/21 17:51:31 martin Exp $	*/
+/*	$NetBSD: wgconfig.c,v 1.5 2020/08/28 17:17:53 tih Exp $	*/
 
 /*
  * Copyright (C) Ryota Ozaki 
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: wgconfig.c,v 1.4 2020/08/21 17:51:31 martin Exp $");
+__RCSID("$NetBSD: wgconfig.c,v 1.5 2020/08/28 17:17:53 tih Exp $");
 
 #include 
 
@@ -241,7 +241,7 @@ static void
 show_peer(prop_dictionary_t peer, const char *prefix, bool show_psk)
 {
 	prop_object_t prop_obj;
-	uint64_t sec;
+	time_t sec;
 
 	prop_obj = prop_dictionary_get(peer, "public_key");
 	if (prop_obj == NULL) {
@@ -265,10 +265,14 @@ show_peer(prop_dictionary_t peer, const 
 
 	handle_allowed_ips(peer, prefix);
 
-	if (prop_dictionary_get_uint64(peer, "last_handshake_time_sec", ))
-		printf("%slatest-handshake: %"PRIu64"\n", prefix, sec);
-	else
+	if (prop_dictionary_get_int64(peer, "last_handshake_time_sec", )) {
+		if (sec > 0)
+			printf("%slatest-handshake: %s", prefix, ctime());
+		else
+			printf("%slatest-handshake: (never)\n", prefix);
+	} else {
 		printf("%slatest-handshake: (none)\n", prefix);
+	}
 }
 
 static int



CVS commit: src/sys/net

2020-08-27 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Thu Aug 27 19:21:14 UTC 2020

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

Log Message:
Summary: let wg interfaces carry multicast traffic

Once a wg interface is up and running, it is useful to be able to run
a routing protocol over it.  Marking the interface multicast capable
enables this.  (One must also use the wgconfig --allowed-ips option to
explicitly permit the group one needs, e.g. 224.0.0.5/32 for OSPF.)


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 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.30 src/sys/net/if_wg.c:1.31
--- src/sys/net/if_wg.c:1.30	Thu Aug 27 13:44:41 2020
+++ src/sys/net/if_wg.c	Thu Aug 27 19:21:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wg.c,v 1.30 2020/08/27 13:44:41 riastradh Exp $	*/
+/*	$NetBSD: if_wg.c,v 1.31 2020/08/27 19:21:14 tih Exp $	*/
 
 /*
  * Copyright (C) Ryota Ozaki 
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.30 2020/08/27 13:44:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.31 2020/08/27 19:21:14 tih Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3381,7 +3381,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_POINTOPOINT;
+	wg->wg_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
 	wg->wg_if.if_extflags = IFEF_NO_LINK_STATE_CHANGE;
 	wg->wg_if.if_extflags |= IFEF_MPSAFE;
 	wg->wg_if.if_ioctl = wg_ioctl;



CVS commit: src/sys/dev/usb

2020-03-29 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Sun Mar 29 10:46:10 UTC 2020

Modified Files:
src/sys/dev/usb: ukbd.c

Log Message:
Summary: Introduce a keyboard event ring buffer for USB console keyboards

For the console keyboard, events must be handled separately from the
interrupt handler, because of the possibility that the user chooses to
drop into DDB by use of the designated key combination.  This delayed
handling is tied to the HZ clock through the callout(9) mechanism,
meaning that another keyboard event arriving within 10ms of the
previous one might overwrite its predecessor before it's handled.
This causes dropped events for fast typists - and the situation gets
worse with modern, programmable, keyboards.

This patch introduces a ring buffer in the ukbd_softc data structure,
so that multiple pending events may be safely stored.


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/dev/usb/ukbd.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/dev/usb/ukbd.c
diff -u src/sys/dev/usb/ukbd.c:1.145 src/sys/dev/usb/ukbd.c:1.146
--- src/sys/dev/usb/ukbd.c:1.145	Sat Mar 14 02:35:33 2020
+++ src/sys/dev/usb/ukbd.c	Sun Mar 29 10:46:10 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: ukbd.c,v 1.145 2020/03/14 02:35:33 christos Exp $*/
+/*  $NetBSD: ukbd.c,v 1.146 2020/03/29 10:46:10 tih Exp $*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.145 2020/03/14 02:35:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.146 2020/03/29 10:46:10 tih Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -258,7 +258,9 @@ struct ukbd_softc {
 	int sc_console_keyboard;	/* we are the console keyboard */
 
 	struct callout sc_delay;	/* for quirk handling */
-	struct ukbd_data sc_data;	/* for quirk handling */
+#define MAXPENDING 32
+	struct ukbd_data sc_data[MAXPENDING];
+	size_t sc_data_w, sc_data_r;
 
 	struct hid_location sc_apple_fn;
 	struct hid_location sc_numloc;
@@ -475,6 +477,9 @@ ukbd_attach(device_t parent, device_t se
 
 	callout_init(>sc_delay, 0);
 
+	sc->sc_data_w = 0;
+	sc->sc_data_r = 0;
+
 	usb_init_task(>sc_ledtask, ukbd_set_leds_task, sc, 0);
 
 	/* Flash the leds; no real purpose, just shows we're alive. */
@@ -686,8 +691,14 @@ ukbd_intr(struct uhidev *addr, void *ibu
 		 * generate a key up followed by a key down for the same
 		 * key after about 10 ms.
 		 * We avoid this bug by holding off decoding for 20 ms.
+		 * Note that this comes at a cost: we deliberately overwrite
+		 * the data for any keyboard event that is followed by
+		 * another one within this time window.
 		 */
-		sc->sc_data = *ud;
+		if (sc->sc_data_w == sc->sc_data_r) {
+			sc->sc_data_w = (sc->sc_data_w + 1) % MAXPENDING;
+		}
+		sc->sc_data[sc->sc_data_w] = *ud;
 		callout_reset(>sc_delay, hz / 50, ukbd_delayed_decode, sc);
 #ifdef DDB
 	} else if (sc->sc_console_keyboard && !(sc->sc_flags & FLAG_POLLING)) {
@@ -697,8 +708,9 @@ ukbd_intr(struct uhidev *addr, void *ibu
 		 * polling from inside the interrupt routine and that
 		 * loses bigtime.
 		 */
-		sc->sc_data = *ud;
-		callout_reset(>sc_delay, 1, ukbd_delayed_decode, sc);
+		sc->sc_data_w = (sc->sc_data_w + 1) % MAXPENDING;
+		sc->sc_data[sc->sc_data_w] = *ud;
+		callout_reset(>sc_delay, 0, ukbd_delayed_decode, sc);
 #endif
 	} else {
 		ukbd_decode(sc, ud);
@@ -710,7 +722,10 @@ ukbd_delayed_decode(void *addr)
 {
 	struct ukbd_softc *sc = addr;
 
-	ukbd_decode(sc, >sc_data);
+	while (sc->sc_data_r != sc->sc_data_w) {
+		sc->sc_data_r = (sc->sc_data_r + 1) % MAXPENDING;
+		ukbd_decode(sc, >sc_data[sc->sc_data_r]);
+	}
 }
 
 void



CVS commit: src/lib/libedit

2020-01-04 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Sun Jan  5 00:03:28 UTC 2020

Modified Files:
src/lib/libedit: filecomplete.c

Log Message:
Summary: Remove over-simplified extraneous test

The file name matching code in libedit tries to adjust to the presence
of explicit " or ' characters in the input line, but tries too hard.
Remove a conditional that goes overboard, and causes the completion
code to fail if a quoted string is seen before the filename to be
expanded, as in

  grep 'foo' bar

Before this change, the above would not expand any possible
completions, even if they existed, because it would choose to look for
files whose names started with " bar".


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/lib/libedit/filecomplete.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/libedit/filecomplete.c
diff -u src/lib/libedit/filecomplete.c:1.62 src/lib/libedit/filecomplete.c:1.63
--- src/lib/libedit/filecomplete.c:1.62	Tue Dec 10 19:42:09 2019
+++ src/lib/libedit/filecomplete.c	Sun Jan  5 00:03:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: filecomplete.c,v 1.62 2019/12/10 19:42:09 christos Exp $	*/
+/*	$NetBSD: filecomplete.c,v 1.63 2020/01/05 00:03:27 tih Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.62 2019/12/10 19:42:09 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.63 2020/01/05 00:03:27 tih Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -611,12 +611,8 @@ find_word_to_complete(const wchar_t * cu
 			if (ctemp - buffer >= 2 && ctemp[-2] == '\\') {
 ctemp -= 2;
 continue;
-			} else if (ctemp - buffer >= 2 &&
-			(ctemp[-2] == '\'' || ctemp[-2] == '"')) {
-ctemp--;
-continue;
-			} else
-break;
+			}
+			break;
 		}
 		if (special_prefixes && wcschr(special_prefixes, ctemp[-1]))
 			break;



CVS commit: src/usr.sbin/npf/npfctl

2019-04-17 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Wed Apr 17 20:41:59 UTC 2019

Modified Files:
src/usr.sbin/npf/npfctl: npf_bpf_comp.c npf_build.c

Log Message:
Summary: Ensure default TCP flags are applied to rules like 'pass stateful all'

CVS: --
CVS: CVSROOT  cvs.NetBSD.org:/cvsroot
CVS: please use "PR category/123" to have the commitmsg appended to PR 123
CVS:
CVS: Please evaluate your changes and consider the following.
CVS: Abort checkin if you answer no.
CVS: => For all changes:
CVS: Do the changed files compile?
CVS: Has the change been tested?
CVS: => If you are not completely familiar with the changed components:
CVS: Has the change been posted for review?
CVS: Have you allowed enough time for feedback?
CVS: => If the change is major:
CVS: => If the change adds files to, or removes files from $DESTDIR:
CVS: => If you are changing a library or kernel interface:
CVS: Have you successfully run "./build.sh release"?

The documented default "flags S/SAFR" for stateful rules that affect
TCP packets but don't specify any flags, doesn't actually get applied
to a rule like "pass stateful out all". The big problem with this is
that when you then do a "block return-rst" for an incoming packet, the
generated RST packet will create state for the connection attempt it's
blocking, so that a second attempt from the same source will pass.

This change makes the default flags actually apply to such simple
rules.  It also fixes a related bug in the code generation for the
flag matching, where part of the action could erroneously be omitted.

Reviewed by 
Closes PR bin/54124
Pullup to NetBSD 8


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/npf/npfctl/npf_bpf_comp.c
cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/npf/npfctl/npf_build.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/npf/npfctl/npf_bpf_comp.c
diff -u src/usr.sbin/npf/npfctl/npf_bpf_comp.c:1.11 src/usr.sbin/npf/npfctl/npf_bpf_comp.c:1.12
--- src/usr.sbin/npf/npfctl/npf_bpf_comp.c:1.11	Sat Sep 29 14:41:36 2018
+++ src/usr.sbin/npf/npfctl/npf_bpf_comp.c	Wed Apr 17 20:41:58 2019
@@ -32,7 +32,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: npf_bpf_comp.c,v 1.11 2018/09/29 14:41:36 rmind Exp $");
+__RCSID("$NetBSD: npf_bpf_comp.c,v 1.12 2019/04/17 20:41:58 tih Exp $");
 
 #include 
 #include 
@@ -565,10 +565,8 @@ npfctl_bpf_tcpfl(npf_bpf_t *ctx, uint8_t
 	};
 	add_insns(ctx, insns_cmp, __arraycount(insns_cmp));
 
-	if (!checktcp) {
-		uint32_t mwords[] = { BM_TCPFL, 2, tf, tf_mask};
-		done_block(ctx, mwords, sizeof(mwords));
-	}
+	uint32_t mwords[] = { BM_TCPFL, 2, tf, tf_mask};
+	done_block(ctx, mwords, sizeof(mwords));
 }
 
 /*

Index: src/usr.sbin/npf/npfctl/npf_build.c
diff -u src/usr.sbin/npf/npfctl/npf_build.c:1.47 src/usr.sbin/npf/npfctl/npf_build.c:1.48
--- src/usr.sbin/npf/npfctl/npf_build.c:1.47	Sat Jan 19 21:19:32 2019
+++ src/usr.sbin/npf/npfctl/npf_build.c	Wed Apr 17 20:41:58 2019
@@ -32,7 +32,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: npf_build.c,v 1.47 2019/01/19 21:19:32 rmind Exp $");
+__RCSID("$NetBSD: npf_build.c,v 1.48 2019/04/17 20:41:58 tih Exp $");
 
 #include 
 #define	__FAVOR_BSD
@@ -363,7 +363,7 @@ static bool
 npfctl_build_code(nl_rule_t *rl, sa_family_t family, const opt_proto_t *op,
 const filt_opts_t *fopts)
 {
-	bool noproto, noaddrs, noports, need_tcpudp = false;
+	bool noproto, noaddrs, noports, nostate, need_tcpudp = false;
 	const addr_port_t *apfrom = >fo_from;
 	const addr_port_t *apto = >fo_to;
 	const int proto = op->op_proto;
@@ -375,7 +375,8 @@ npfctl_build_code(nl_rule_t *rl, sa_fami
 	noproto = family == AF_UNSPEC && proto == -1 && !op->op_opts;
 	noaddrs = !apfrom->ap_netaddr && !apto->ap_netaddr;
 	noports = !apfrom->ap_portrange && !apto->ap_portrange;
-	if (noproto && noaddrs && noports) {
+	nostate = !(npf_rule_getattr(rl) & NPF_RULE_STATEFUL);
+	if (noproto && noaddrs && noports && nostate) {
 		return false;
 	}
 



CVS commit: src/usr.bin/systat

2019-01-08 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Tue Jan  8 08:22:20 UTC 2019

Modified Files:
src/usr.bin/systat: vmstat.c

Log Message:
Remove a format character from a non-format string.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/usr.bin/systat/vmstat.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.bin/systat/vmstat.c
diff -u src/usr.bin/systat/vmstat.c:1.83 src/usr.bin/systat/vmstat.c:1.84
--- src/usr.bin/systat/vmstat.c:1.83	Wed Dec 26 01:47:37 2018
+++ src/usr.bin/systat/vmstat.c	Tue Jan  8 08:22:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmstat.c,v 1.83 2018/12/26 01:47:37 sevan Exp $	*/
+/*	$NetBSD: vmstat.c,v 1.84 2019/01/08 08:22:20 tih Exp $	*/
 
 /*-
  * Copyright (c) 1983, 1989, 1992, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)vmstat.c	8.2 (Berkeley) 1/12/94";
 #endif
-__RCSID("$NetBSD: vmstat.c,v 1.83 2018/12/26 01:47:37 sevan Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.84 2019/01/08 08:22:20 tih Exp $");
 #endif /* not lint */
 
 /*
@@ -365,7 +365,7 @@ labelvmstat(void)
 		mvprintw(DISKROW, DISKCOL + 1 * DISKCOLWIDTH, "%*s", DISKCOLWIDTH, "seeks");
 		mvprintw(DISKROW, DISKCOL + 2 * DISKCOLWIDTH, "%*s", DISKCOLWIDTH, "xfers");
 		mvprintw(DISKROW, DISKCOL + 3 * DISKCOLWIDTH, "%*s", DISKCOLWIDTH, "bytes");
-		mvprintw(DISKROW, DISKCOL + 4 * DISKCOLWIDTH, "%*s", DISKCOLWIDTH, "%%busy");
+		mvprintw(DISKROW, DISKCOL + 4 * DISKCOLWIDTH, "%*s", DISKCOLWIDTH, "%busy");
 	}
 
 	/* Middle column */



CVS commit: src/sys/dev/usb

2019-01-04 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Fri Jan  4 17:09:26 UTC 2019

Modified Files:
src/sys/dev/usb: umodem_common.c

Log Message:
The availability of status change notification messages for a umodem
device is not an error.  Report its presence if booting in verbose
mode (-v).


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/usb/umodem_common.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/dev/usb/umodem_common.c
diff -u src/sys/dev/usb/umodem_common.c:1.25 src/sys/dev/usb/umodem_common.c:1.26
--- src/sys/dev/usb/umodem_common.c:1.25	Fri Nov 25 12:56:29 2016
+++ src/sys/dev/usb/umodem_common.c	Fri Jan  4 17:09:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: umodem_common.c,v 1.25 2016/11/25 12:56:29 skrll Exp $	*/
+/*	$NetBSD: umodem_common.c,v 1.26 2019/01/04 17:09:26 tih Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umodem_common.c,v 1.25 2016/11/25 12:56:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umodem_common.c,v 1.26 2019/01/04 17:09:26 tih Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -230,7 +230,7 @@ umodem_common_attach(device_t self, stru
 
 		if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN &&
 		(ed->bmAttributes & UE_XFERTYPE) == UE_INTERRUPT) {
-			aprint_error_dev(self,
+			aprint_verbose_dev(self,
 			"status change notification available\n");
 			sc->sc_ctl_notify = ed->bEndpointAddress;
 		}



CVS commit: src/share/man/man4

2018-12-20 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Thu Dec 20 15:19:31 UTC 2018

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

Log Message:
Add D-Link DWA-131 to list of devices expected to work


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/share/man/man4/urtwn.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/urtwn.4
diff -u src/share/man/man4/urtwn.4:1.16 src/share/man/man4/urtwn.4:1.17
--- src/share/man/man4/urtwn.4:1.16	Mon Dec 17 04:11:34 2018
+++ src/share/man/man4/urtwn.4	Thu Dec 20 15:19:31 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: urtwn.4,v 1.16 2018/12/17 04:11:34 msaitoh Exp $
+.\" $NetBSD: urtwn.4,v 1.17 2018/12/20 15:19:31 tih Exp $
 .\" $OpenBSD: urtwn.4,v 1.15 2011/11/26 06:39:33 ckuethe Exp $
 .\"
 .\" Copyright (c) 2010 Damien Bergamini 
@@ -109,6 +109,7 @@ The following adapters should work:
 .It B-Link BL-LW05-5R
 .It Belkin F7D1102 Surf Wireless Micro
 .It D-Link DWA-121
+.It D-Link DWA-131
 .It D-Link DWA-133
 .It D-Link DWA-135
 .It Digitus DN-7042



CVS commit: src/sys/dev/usb

2018-12-20 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Thu Dec 20 15:16:07 UTC 2018

Modified Files:
src/sys/dev/usb: if_urtwn.c

Log Message:
Add D-Link DWA-131 rev E "Wireless N300 Nano USB Adapter"

OK: jmcneill


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/usb/if_urtwn.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/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.66 src/sys/dev/usb/if_urtwn.c:1.67
--- src/sys/dev/usb/if_urtwn.c:1.66	Sat Dec 15 10:30:58 2018
+++ src/sys/dev/usb/if_urtwn.c	Thu Dec 20 15:16:07 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.66 2018/12/15 10:30:58 msaitoh Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.67 2018/12/20 15:16:07 tih Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.66 2018/12/15 10:30:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.67 2018/12/20 15:16:07 tih Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -195,6 +195,7 @@ static const struct urtwn_dev {
 	URTWN_RTL8188E_DEV(TPLINK, RTL8188EU),
 
 	/* URTWN_RTL8192EU */
+	URTWN_RTL8192EU_DEV(DLINK,	DWA131E),
 	URTWN_RTL8192EU_DEV(REALTEK,	RTL8192EU),
 	URTWN_RTL8192EU_DEV(TPLINK,	RTL8192EU),
 };



CVS commit: src/sys/dev/usb

2018-12-20 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Thu Dec 20 15:13:07 UTC 2018

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.757 -r1.758 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.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/dev/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.757 src/sys/dev/usb/usbdevs.h:1.758
--- src/sys/dev/usb/usbdevs.h:1.757	Fri Dec 14 14:04:13 2018
+++ src/sys/dev/usb/usbdevs.h	Thu Dec 20 15:13:07 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.757 2018/12/14 14:04:13 tnn Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.758 2018/12/20 15:13:07 tih Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.764 2018/12/14 13:56:59 tnn Exp
+ *	NetBSD: usbdevs,v 1.765 2018/12/20 15:09:46 tih Exp
  */
 
 /*-
@@ -1398,6 +1398,7 @@
 #define	USB_PRODUCT_DLINK_RTL8192CU_4	0x330b		/* RTL8192CU */
 #define	USB_PRODUCT_DLINK_DWA131B	0x330d		/* DWA-131 rev B */
 #define	USB_PRODUCT_DLINK_DWA125D1	0x330f		/* DWA-125 rev D1 */
+#define	USB_PRODUCT_DLINK_DWA131E	0x3319		/* DWA-131 rev E */
 #define	USB_PRODUCT_DLINK_DWL122	0x3700		/* Wireless DWL122 */
 #define	USB_PRODUCT_DLINK_DWLG120	0x3701		/* DWL-G120 */
 #define	USB_PRODUCT_DLINK_DWL120F	0x3702		/* DWL-120 rev F */
Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.757 src/sys/dev/usb/usbdevs_data.h:1.758
--- src/sys/dev/usb/usbdevs_data.h:1.757	Fri Dec 14 14:04:13 2018
+++ src/sys/dev/usb/usbdevs_data.h	Thu Dec 20 15:13:07 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.757 2018/12/14 14:04:13 tnn Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.758 2018/12/20 15:13:07 tih Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.764 2018/12/14 13:56:59 tnn Exp
+ *	NetBSD: usbdevs,v 1.765 2018/12/20 15:09:46 tih Exp
  */
 
 /*-
@@ -1736,6 +1736,8 @@ static const uint16_t usb_products[] = {
 	9140, 8693, 9148, 0,
 	USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWA125D1, 
 	9150, 8693, 9158, 0,
+	USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWA131E, 
+	9140, 8693, 9128, 0,
 	USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWL122, 
 	651, 9161, 0,
 	USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWLG120, 
@@ -6091,7 +6093,7 @@ static const char usb_words[] = { "." 
 	"XH1153\0" /* 1 refs @ 8672 */
 	"C-Net\0" /* 1 refs @ 8679 */
 	"CWD-854\0" /* 1 refs @ 8685 */
-	"rev\0" /* 17 refs @ 8693 */
+	"rev\0" /* 18 refs @ 8693 */
 	"F\0" /* 2 refs @ 8697 */
 	"RTL8187\0" /* 4 refs @ 8699 */
 	"AccelePort\0" /* 3 refs @ 8707 */
@@ -6146,10 +6148,10 @@ static const char usb_words[] = { "." 
 	"DUB-E100\0" /* 3 refs @ 9107 */
 	"C1\0" /* 3 refs @ 9116 */
 	"DUB-1312\0" /* 1 refs @ 9119 */
-	"E\0" /* 1 refs @ 9128 */
+	"E\0" /* 2 refs @ 9128 */
 	"DWA-130\0" /* 3 refs @ 9130 */
 	"C\0" /* 1 refs @ 9138 */
-	"DWA-131\0" /* 2 refs @ 9140 */
+	"DWA-131\0" /* 3 refs @ 9140 */
 	"B\0" /* 3 refs @ 9148 */
 	"DWA-125\0" /* 1 refs @ 9150 */
 	"D1\0" /* 2 refs @ 9158 */



CVS commit: src/sys/dev/usb

2018-12-20 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Thu Dec 20 15:09:47 UTC 2018

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add D-Link DWA-131 rev E "Wireless N300 Nano USB Adapter"


To generate a diff of this commit:
cvs rdiff -u -r1.764 -r1.765 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.764 src/sys/dev/usb/usbdevs:1.765
--- src/sys/dev/usb/usbdevs:1.764	Fri Dec 14 13:56:59 2018
+++ src/sys/dev/usb/usbdevs	Thu Dec 20 15:09:46 2018
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.764 2018/12/14 13:56:59 tnn Exp $
+$NetBSD: usbdevs,v 1.765 2018/12/20 15:09:46 tih Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1391,6 +1391,7 @@ product DLINK RTL8192CU_3	0x330a	RTL8192
 product DLINK RTL8192CU_4	0x330b	RTL8192CU
 product DLINK DWA131B		0x330d	DWA-131 rev B
 product	DLINK DWA125D1		0x330f  DWA-125 rev D1
+product DLINK DWA131E		0x3319	DWA-131 rev E
 product DLINK DWL122		0x3700	Wireless DWL122
 product DLINK DWLG120		0x3701	DWL-G120
 product DLINK DWL120F		0x3702	DWL-120 rev F



CVS commit: src/lib/libc/arch/aarch64/softfloat

2018-12-06 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Thu Dec  6 19:17:13 UTC 2018

Modified Files:
src/lib/libc/arch/aarch64/softfloat: softfloat.h

Log Message:
Summary: Align softfloat float128 with libgcc.

While libgcc adapts its float128 data structure to the endianness of
the architecture, the softfloat code in libc didn't.  With both of
them handling the same values, softfloat must follow the toolchain.

OK: riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/aarch64/softfloat/softfloat.h

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

Modified files:

Index: src/lib/libc/arch/aarch64/softfloat/softfloat.h
diff -u src/lib/libc/arch/aarch64/softfloat/softfloat.h:1.1 src/lib/libc/arch/aarch64/softfloat/softfloat.h:1.2
--- src/lib/libc/arch/aarch64/softfloat/softfloat.h:1.1	Sun Aug 10 05:47:37 2014
+++ src/lib/libc/arch/aarch64/softfloat/softfloat.h	Thu Dec  6 19:17:13 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: softfloat.h,v 1.1 2014/08/10 05:47:37 matt Exp $ */
+/* $NetBSD: softfloat.h,v 1.2 2018/12/06 19:17:13 tih Exp $ */
 
 /* This is a derivative work. */
 
@@ -46,6 +46,7 @@ the `FLOAT128' macro and the quadruple-p
 
 #include "softfloat-qp.h"
 
+#include 
 #include 
 
 /*
@@ -63,7 +64,11 @@ typedef struct {
 #endif
 #ifdef FLOAT128
 typedef struct {
+#if _BYTE_ORDER == _BIG_ENDIAN
 unsigned long long high, low;
+#else
+unsigned long long low, high;
+#endif
 } float128;
 #endif
 



CVS commit: src/sys/net

2018-03-16 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Fri Mar 16 17:12:05 UTC 2018

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

Log Message:
Add packet filtering to tun(4) interfaces.

Calls to pfil_run_hooks() were missing in if_tun.c.  This meant that
filtering configuration could be added to e.g. /etc/npf.conf, but
would be ignored, because the filter never saw the packets.  This
change adds the required calls.

While here, correct the return value from tun_output(): it's been
returning 0 regardless of any error condition present, but will now
correctly propagate such information upward.

Thanks to maxv for guidance!

OK: christos, martin


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 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.142 src/sys/net/if_tun.c:1.143
--- src/sys/net/if_tun.c:1.142	Wed Dec  6 07:40:16 2017
+++ src/sys/net/if_tun.c	Fri Mar 16 17:12:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tun.c,v 1.142 2017/12/06 07:40:16 ozaki-r Exp $	*/
+/*	$NetBSD: if_tun.c,v 1.143 2018/03/16 17:12:04 tih Exp $	*/
 
 /*
  * Copyright (c) 1988, Julian Onions 
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.142 2017/12/06 07:40:16 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.143 2018/03/16 17:12:04 tih Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -555,6 +555,11 @@ tun_output(struct ifnet *ifp, struct mbu
 
 	bpf_mtap_af(ifp, dst->sa_family, m0);
 
+	if ((error = pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_OUT)) != 0)
+		goto out;
+	if (m0 == NULL)
+		goto out;
+
 	switch(dst->sa_family) {
 #ifdef INET6
 	case AF_INET6:
@@ -624,10 +629,10 @@ tun_output(struct ifnet *ifp, struct mbu
 
 	mutex_exit(>tun_lock);
 out:
-	if (error && m0) {
+	if (error && m0)
 		m_freem(m0);
-	}
-	return 0;
+
+	return error;
 }
 
 static void
@@ -941,6 +946,11 @@ tunwrite(dev_t dev, struct uio *uio, int
 
 	bpf_mtap_af(ifp, dst.sa_family, top);
 
+	if ((error = pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_IN)) != 0)
+		goto out0;
+	if (top == NULL)
+		goto out0;
+
 	mutex_enter(>tun_lock);
 	if ((tp->tun_flags & TUN_INITED) == 0) {
 		/* Interface was destroyed */



CVS commit: src/sys/net

2018-03-16 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Fri Mar 16 17:00:35 UTC 2018

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

Log Message:
Fix the handling of the state returned from pfil_run_hooks().

pfil_run_hooks() invokes any registered packet filters on the packet
being handled.  It may return a (non-zero) errno, indicating that a
filter has decided that the packet should be discarded, and has freed
the mbuf.  While a non-error (0) return usually means that the packet
should be processed normally, a filter may still free the mbuf if the
packet is a fragment, and the filter is holding it for reassembly and
future evaluation.  Therefore, there must be separate tests for the
return value and for a possible discarded packet.  (See pfil(9).)

OK: christos, martin


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/net/if_vlan.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_vlan.c
diff -u src/sys/net/if_vlan.c:1.124 src/sys/net/if_vlan.c:1.125
--- src/sys/net/if_vlan.c:1.124	Mon Jan 15 16:36:51 2018
+++ src/sys/net/if_vlan.c	Fri Mar 16 17:00:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.124 2018/01/15 16:36:51 maxv Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.125 2018/03/16 17:00:35 tih Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.124 2018/01/15 16:36:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.125 2018/03/16 17:00:35 tih Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1432,12 +1432,10 @@ vlan_transmit(struct ifnet *ifp, struct 
 
 	bpf_mtap(ifp, m);
 
-	if (pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_OUT) != 0) {
-		if (m != NULL)
-			m_freem(m);
-		error = 0;
+	if ((error = pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_OUT)) != 0)
+		goto out;
+	if (m == NULL)
 		goto out;
-	}
 
 	/*
 	 * If the parent can insert the tag itself, just mark
@@ -1609,11 +1607,10 @@ vlan_input(struct ifnet *ifp, struct mbu
 	m_set_rcvif(m, >ifv_if);
 	ifv->ifv_if.if_ipackets++;
 
-	if (pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_IN) != 0) {
-		if (m != NULL)
-			m_freem(m);
+	if (pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_IN) != 0)
+		goto out;
+	if (m == NULL)
 		goto out;
-	}
 
 	m->m_flags &= ~M_PROMISC;
 	if_input(>ifv_if, m);



CVS commit: src/distrib/notes/common

2018-03-11 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Sun Mar 11 11:48:39 UTC 2018

Modified Files:
src/distrib/notes/common: main

Log Message:
Add myself.


To generate a diff of this commit:
cvs rdiff -u -r1.543 -r1.544 src/distrib/notes/common/main

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

Modified files:

Index: src/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.543 src/distrib/notes/common/main:1.544
--- src/distrib/notes/common/main:1.543	Mon Mar  5 00:06:24 2018
+++ src/distrib/notes/common/main	Sun Mar 11 11:48:39 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: main,v 1.543 2018/03/05 00:06:24 eadler Exp $
+.\"	$NetBSD: main,v 1.544 2018/03/11 11:48:39 tih Exp $
 .\"
 .\" Copyright (c) 1999-2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -1186,6 +1186,7 @@ If you're one of them, and would like to
 .It Ta Emile Heitor Ta Mt i...@netbsd.org
 .It Ta John Heasley Ta Mt h...@netbsd.org
 .It Ta Lars Heidieker Ta Mt p...@netbsd.org
+.It Ta Tom Ivar Helbekkmo Ta Mt t...@netbsd.org
 .It Ta Geert Hendrickx Ta Mt g...@netbsd.org
 .It Ta Wen Heping Ta Mt w...@netbsd.org
 .It Ta Ren\('e Hexel Ta Mt r...@netbsd.org