CVS commit: src/sys

2018-05-24 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri May 25 04:40:27 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c
src/sys/net: if_bridge.c if_gif.c if_pppoe.c

Log Message:
Ensure to call if_register after interface initializations finish


To generate a diff of this commit:
cvs rdiff -u -r1.579 -r1.580 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.155 -r1.156 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/pci/ixgbe/ixv.c
cvs rdiff -u -r1.155 -r1.156 src/sys/net/if_bridge.c
cvs rdiff -u -r1.141 -r1.142 src/sys/net/if_gif.c
cvs rdiff -u -r1.137 -r1.138 src/sys/net/if_pppoe.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/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.579 src/sys/dev/pci/if_wm.c:1.580
--- src/sys/dev/pci/if_wm.c:1.579	Thu May 10 03:43:42 2018
+++ src/sys/dev/pci/if_wm.c	Fri May 25 04:40:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.579 2018/05/10 03:43:42 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.580 2018/05/25 04:40:26 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.579 2018/05/10 03:43:42 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.580 2018/05/25 04:40:26 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -2829,8 +2829,8 @@ alloc_retry:
 	}
 	sc->sc_ipq = if_percpuq_create(>sc_ethercom.ec_if);
 	ether_ifattach(ifp, enaddr);
-	if_register(ifp);
 	ether_set_ifflags_cb(>sc_ethercom, wm_ifflags_cb);
+	if_register(ifp);
 	rnd_attach_source(>rnd_source, xname, RND_TYPE_NET,
 			  RND_FLAG_DEFAULT);
 

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.155 src/sys/dev/pci/ixgbe/ixgbe.c:1.156
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.155	Wed May 23 10:11:07 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri May 25 04:40:27 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.155 2018/05/23 10:11:07 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.156 2018/05/25 04:40:27 ozaki-r Exp $ */
 
 /**
 
@@ -1316,7 +1316,6 @@ ixgbe_setup_interface(device_t dev, stru
 	 * We use per TX queue softint, so if_deferred_start_init() isn't
 	 * used.
 	 */
-	if_register(ifp);
 	ether_set_ifflags_cb(ec, ixgbe_ifflags_cb);
 
 	adapter->max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
@@ -1365,6 +1364,8 @@ ixgbe_setup_interface(device_t dev, stru
 	/* Set autoselect media by default */
 	ifmedia_set(>media, IFM_ETHER | IFM_AUTO);
 
+	if_register(ifp);
+
 	return (0);
 } /* ixgbe_setup_interface */
 

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.100 src/sys/dev/pci/ixgbe/ixv.c:1.101
--- src/sys/dev/pci/ixgbe/ixv.c:1.100	Wed May 23 10:11:07 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Fri May 25 04:40:27 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.100 2018/05/23 10:11:07 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.101 2018/05/25 04:40:27 ozaki-r Exp $*/
 
 /**
 
@@ -1519,7 +1519,6 @@ ixv_setup_interface(device_t dev, struct
 	 * We use per TX queue softint, so if_deferred_start_init() isn't
 	 * used.
 	 */
-	if_register(ifp);
 	ether_set_ifflags_cb(ec, ixv_ifflags_cb);
 
 	adapter->max_frame_size = ifp->if_mtu + IXGBE_MTU_HDR;
@@ -1558,6 +1557,8 @@ ixv_setup_interface(device_t dev, struct
 	ifmedia_add(>media, IFM_ETHER | IFM_AUTO, 0, NULL);
 	ifmedia_set(>media, IFM_ETHER | IFM_AUTO);
 
+	if_register(ifp);
+
 	return 0;
 } /* ixv_setup_interface */
 

Index: src/sys/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.155 src/sys/net/if_bridge.c:1.156
--- src/sys/net/if_bridge.c:1.155	Mon May 14 02:55:03 2018
+++ src/sys/net/if_bridge.c	Fri May 25 04:40:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.155 2018/05/14 02:55:03 ozaki-r Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.156 2018/05/25 04:40:27 ozaki-r Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.155 2018/05/14 02:55:03 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.156 2018/05/25 04:40:27 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -470,9 +470,8 @@ bridge_clone_create(struct if_clone *ifc
 
 		return error;
 	}
-	if_register(ifp);
-
 	if_alloc_sadl(ifp);
+	if_register(ifp);
 
 	return 0;
 }

Index: src/sys/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.141 src/sys/net/if_gif.c:1.142
--- src/sys/net/if_gif.c:1.141	Tue May  1 07:21:39 2018
+++ src/sys/net/if_gif.c	Fri May 25 04:40:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.141 2018/05/01 07:21:39 maxv Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.142 2018/05/25 04:40:27 ozaki-r Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 

CVS commit: src/share/misc

2018-05-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri May 25 00:31:07 UTC 2018

Modified Files:
src/share/misc: acronyms

Log Message:
Add a topical acronym for this week: GDPR.


To generate a diff of this commit:
cvs rdiff -u -r1.273 -r1.274 src/share/misc/acronyms

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

Modified files:

Index: src/share/misc/acronyms
diff -u src/share/misc/acronyms:1.273 src/share/misc/acronyms:1.274
--- src/share/misc/acronyms:1.273	Tue May 22 02:54:32 2018
+++ src/share/misc/acronyms	Fri May 25 00:31:07 2018
@@ -1,4 +1,4 @@
-$NetBSD: acronyms,v 1.273 2018/05/22 02:54:32 ginsbach Exp $
+$NetBSD: acronyms,v 1.274 2018/05/25 00:31:07 riastradh Exp $
 10Q	thank you
 10X	thanks
 1337	elite ("leet")
@@ -178,6 +178,7 @@ GA	go ahead
 GAC	get a clue
 GAL	get a life
 GBTW	get back to work
+GDPR	General Data Protection Regulation
 GF	girlfriend
 GFU	good for you
 GFY	good for you



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

2018-05-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May 24 22:37:58 UTC 2018

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

Log Message:
obsolete DES_random_key


To generate a diff of this commit:
cvs rdiff -u -r1.2195 -r1.2196 src/distrib/sets/lists/comp/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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2195 src/distrib/sets/lists/comp/mi:1.2196
--- src/distrib/sets/lists/comp/mi:1.2195	Wed May 23 03:33:55 2018
+++ src/distrib/sets/lists/comp/mi	Thu May 24 18:37:58 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2195 2018/05/23 07:33:55 para Exp $
+#	$NetBSD: mi,v 1.2196 2018/05/24 22:37:58 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -4568,7 +4568,7 @@
 ./usr/share/man/cat3/CTLOG_new.0		comp-c-catman		.cat,openssl=11
 ./usr/share/man/cat3/CT_POLICY_EVAL_CTX_new.0	comp-c-catman		.cat,openssl=11
 ./usr/share/man/cat3/DEFINE_STACK_OF.0		comp-c-catman		.cat,openssl=11
-./usr/share/man/cat3/DES_random_key.0		comp-c-catman		.cat,openssl=11
+./usr/share/man/cat3/DES_random_key.0		comp-obsolete		obsolete
 ./usr/share/man/cat3/DH_generate_key.0		comp-c-catman		.cat
 ./usr/share/man/cat3/DH_generate_parameters.0	comp-c-catman		.cat
 ./usr/share/man/cat3/DH_get0_pqg.0		comp-c-catman		.cat,openssl=11
@@ -12386,7 +12386,7 @@
 ./usr/share/man/html3/CTLOG_new.html	comp-c-htmlman	html,openssl=11
 ./usr/share/man/html3/CT_POLICY_EVAL_CTX_new.html	comp-c-htmlman	html,openssl=11
 ./usr/share/man/html3/DEFINE_STACK_OF.html	comp-c-htmlman	html,openssl=11
-./usr/share/man/html3/DES_random_key.html	comp-c-htmlman	html,openssl=11
+./usr/share/man/html3/DES_random_key.html	comp-obsolete	obsolete
 ./usr/share/man/html3/DH_generate_key.html	comp-c-htmlman	html
 ./usr/share/man/html3/DH_generate_parameters.html	comp-c-htmlman	html
 ./usr/share/man/html3/DH_get0_pqg.html	comp-c-htmlman	html,openssl=11
@@ -20047,7 +20047,7 @@
 ./usr/share/man/man3/CTLOG_new.3	comp-c-man	.man,openssl=11
 ./usr/share/man/man3/CT_POLICY_EVAL_CTX_new.3	comp-c-man	.man,openssl=11
 ./usr/share/man/man3/DEFINE_STACK_OF.3	comp-c-man	.man,openssl=11
-./usr/share/man/man3/DES_random_key.3	comp-c-man	.man,openssl=11
+./usr/share/man/man3/DES_random_key.3		comp-obsolete		obsolete
 ./usr/share/man/man3/DH_generate_key.3		comp-c-man		.man
 ./usr/share/man/man3/DH_generate_parameters.3	comp-c-man		.man
 ./usr/share/man/man3/DH_get0_pqg.3	comp-c-man	.man,openssl=11



CVS commit: src/doc

2018-05-24 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu May 24 20:04:47 UTC 2018

Modified Files:
src/doc: CHANGES

Log Message:
Note libbozohttpd(3) & bozohttpd(3lua) from earlier in the month.


To generate a diff of this commit:
cvs rdiff -u -r1.2389 -r1.2390 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.2389 src/doc/CHANGES:1.2390
--- src/doc/CHANGES:1.2389	Sat May 19 22:57:54 2018
+++ src/doc/CHANGES	Thu May 24 20:04:46 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2389 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2390 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -150,6 +150,8 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	netpgp(3lua): Add Lua binding for libnetpgp(3). [sevan 20180429]
 	arm: Add support for Allwinner H6 SoC. [jmcneill 20180501]
 	dhcpcd: Import 7.0.4. [roy 20180502]
+	libbozohttpd(3): Add the embeddable version of bozohttpd [sevan 20180503]
+	bozohttpd(3lua): Add Lua binding for libbozohttpd(3lua) [sevan 20180503]
 	tzdata: updated to 2017e [kre 20180504]
 	libc: Update to tzcode2018e. [christos 20180504]
 	acpi(4): Updated ACPICA to 20180427. [christos 20180504]



CVS commit: src/sys/arch/usermode/dev

2018-05-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu May 24 19:39:04 UTC 2018

Modified Files:
src/sys/arch/usermode/dev: cpu.c

Log Message:
First try at TLS support and getcontext/setcontext/swapcontext support.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.75 src/sys/arch/usermode/dev/cpu.c:1.76
--- src/sys/arch/usermode/dev/cpu.c:1.75	Thu May 17 19:00:39 2018
+++ src/sys/arch/usermode/dev/cpu.c	Thu May 24 19:39:04 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.75 2018/05/17 19:00:39 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.76 2018/05/24 19:39:04 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #include "opt_hz.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.75 2018/05/17 19:00:39 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.76 2018/05/24 19:39:04 reinoud Exp $");
 
 #include 
 #include 
@@ -66,6 +66,11 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.75
 static int	cpu_match(device_t, cfdata_t, void *);
 static void	cpu_attach(device_t, device_t, void *);
 
+/* XXX */
+//extern void *_lwp_getprivate(void);
+//extern int _lwp_setprivate(void *);
+
+
 struct cpu_info cpu_info_primary = {
 	.ci_dev = 0,
 	.ci_self = _info_primary,
@@ -130,7 +135,6 @@ cpu_configure(void)
 	if (config_rootfound("mainbus", NULL) == NULL)
 		panic("configure: mainbus not configured");
 
-
 	spl0();
 }
 
@@ -189,6 +193,8 @@ cpu_need_proftick(struct lwp *l)
 {
 }
 
+
+/* XXX make sure this is atomic? */
 static
 void
 cpu_switchto_atomic(lwp_t *oldlwp, lwp_t *newlwp)
@@ -208,12 +214,22 @@ cpu_switchto_atomic(lwp_t *oldlwp, lwp_t
 
 	thunk_seterrno(newpcb->pcb_errno);
 
+	/* set both ucontexts up for TLS just in case */
+	newpcb->pcb_ucp.uc_mcontext._mc_tlsbase =
+		(uintptr_t) newlwp->l_private;
+	newpcb->pcb_ucp.uc_flags |= _UC_TLSBASE;
+
+	newpcb->pcb_userret_ucp.uc_mcontext._mc_tlsbase =
+		(uintptr_t) newlwp->l_private;
+	newpcb->pcb_userret_ucp.uc_flags |= _UC_TLSBASE;
+
 	curlwp = newlwp;
 	if (thunk_setcontext(>pcb_ucp))
 		panic("setcontext failed");
 	/* not reached */
 }
 
+
 lwp_t *
 cpu_switchto(lwp_t *oldlwp, lwp_t *newlwp, bool returning)
 {
@@ -232,17 +248,23 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlw
 	newlwp ? newlwp->l_lid : -1);
 	if (oldpcb) {
 		thunk_printf_debug("oldpcb uc_link=%p, uc_stack.ss_sp=%p, "
-		"uc_stack.ss_size=%d\n",
+		"uc_stack.ss_size=%d, l_private %p, uc_mcontext._mc_tlsbase=%p(%s)\n",
 		oldpcb->pcb_ucp.uc_link,
 		oldpcb->pcb_ucp.uc_stack.ss_sp,
-		(int)oldpcb->pcb_ucp.uc_stack.ss_size);
+		(int)oldpcb->pcb_ucp.uc_stack.ss_size,
+		(void *) oldlwp->l_private,
+		(void *) oldpcb->pcb_ucp.uc_mcontext._mc_tlsbase,
+		oldpcb->pcb_ucp.uc_flags & _UC_TLSBASE? "ON":"off");
 	}
 	if (newpcb) {
-		thunk_printf_debug("newpcb uc_link=%p, uc_stack.ss_sp=%p, "
-		"uc_stack.ss_size=%d\n",
+		thunk_printf_debug("newpewcb uc_link=%p, uc_stack.ss_sp=%p, "
+		"uc_stack.ss_size=%d, l_private %p, uc_mcontext._mc_tlsbase=%p(%s)\n",
 		newpcb->pcb_ucp.uc_link,
 		newpcb->pcb_ucp.uc_stack.ss_sp,
-		(int)newpcb->pcb_ucp.uc_stack.ss_size);
+		(int)newpcb->pcb_ucp.uc_stack.ss_size,
+		(void *) newlwp->l_private,
+		(void *) newpcb->pcb_ucp.uc_mcontext._mc_tlsbase,
+		newpcb->pcb_ucp.uc_flags & _UC_TLSBASE? "ON":"off");
 	}
 #endif /* !CPU_DEBUG */
 
@@ -250,7 +272,6 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlw
 	KASSERT(newlwp);
 	thunk_makecontext(>sc_ucp, (void (*)(void)) cpu_switchto_atomic,
 			2, oldlwp, newlwp, NULL, NULL);
-
 	KASSERT(sc);
 	if (oldpcb) {
 		thunk_swapcontext(>pcb_ucp, >sc_ucp);
@@ -284,11 +305,16 @@ cpu_getmcontext(struct lwp *l, mcontext_
 {
 	struct pcb *pcb = lwp_getpcb(l);
 	ucontext_t *ucp = >pcb_userret_ucp;
-	
+
 #ifdef CPU_DEBUG
 	thunk_printf_debug("cpu_getmcontext\n");
 #endif
 	memcpy(mcp, >uc_mcontext, sizeof(mcontext_t));
+
+	/* XXX be overzealous and provide all */
+	mcp->_mc_tlsbase = (uintptr_t) l->l_private;
+	*flags = _UC_CPU | _UC_STACK | _UC_SIGMASK | _UC_FPU | _UC_TLSBASE;
+
 	return;
 }
 
@@ -299,6 +325,10 @@ cpu_mcontext_validate(struct lwp *l, con
 	 * can we check here? or should that be done in the target
 	 * specific places?
 	 */
+	/* XXX NO CHECKING! XXX */
+#ifdef CPU_DEBUG
+	thunk_printf("cpu_mcontext_validate\n");
+#endif
 	return 0;
 }
 
@@ -311,7 +341,12 @@ cpu_setmcontext(struct lwp *l, const mco
 #ifdef CPU_DEBUG
 	thunk_printf_debug("cpu_setmcontext\n");
 #endif
+	ucp->uc_flags = flags;
 	memcpy(>uc_mcontext, mcp, sizeof(mcontext_t));
+
+	/* update our private, it might be altered in userland */
+	l->l_private = (void *) ucp->uc_mcontext._mc_tlsbase;
+
 	return 0;
 }
 
@@ -382,10 +417,14 @@ cpu_lwp_fork(struct lwp *l1, struct 

CVS commit: src/external/bsd/blacklist/bin

2018-05-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May 24 19:21:01 UTC 2018

Modified Files:
src/external/bsd/blacklist/bin: blacklistctl.c

Log Message:
One more possible star.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/external/bsd/blacklist/bin/blacklistctl.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/blacklist/bin/blacklistctl.c
diff -u src/external/bsd/blacklist/bin/blacklistctl.c:1.22 src/external/bsd/blacklist/bin/blacklistctl.c:1.23
--- src/external/bsd/blacklist/bin/blacklistctl.c:1.22	Thu May 24 15:19:37 2018
+++ src/external/bsd/blacklist/bin/blacklistctl.c	Thu May 24 15:21:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: blacklistctl.c,v 1.22 2018/05/24 19:19:37 christos Exp $	*/
+/*	$NetBSD: blacklistctl.c,v 1.23 2018/05/24 19:21:01 christos Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: blacklistctl.c,v 1.22 2018/05/24 19:19:37 christos Exp $");
+__RCSID("$NetBSD: blacklistctl.c,v 1.23 2018/05/24 19:21:01 christos Exp $");
 
 #include 
 #include 
@@ -160,7 +160,8 @@ main(int argc, char *argv[])
 			else
 fmttime(buf, sizeof(buf), dbi.last);
 		}
-		printf("%s\t%d/%d\t%-s\n", dbi.id, dbi.count, c.c_nfail, buf);
+		printf("%s\t%d/%s\t%-s\n", dbi.id, dbi.count,
+		star(mbuf, sizeof(mbuf), c.c_nfail), buf);
 	}
 	state_close(db);
 	return EXIT_SUCCESS;



CVS commit: src/external/bsd/blacklist/bin

2018-05-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May 24 19:19:37 UTC 2018

Modified Files:
src/external/bsd/blacklist/bin: blacklistctl.c

Log Message:
handle '*' entries in rules.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/external/bsd/blacklist/bin/blacklistctl.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/blacklist/bin/blacklistctl.c
diff -u src/external/bsd/blacklist/bin/blacklistctl.c:1.21 src/external/bsd/blacklist/bin/blacklistctl.c:1.22
--- src/external/bsd/blacklist/bin/blacklistctl.c:1.21	Tue Nov  1 23:15:07 2016
+++ src/external/bsd/blacklist/bin/blacklistctl.c	Thu May 24 15:19:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: blacklistctl.c,v 1.21 2016/11/02 03:15:07 jnemeth Exp $	*/
+/*	$NetBSD: blacklistctl.c,v 1.22 2018/05/24 19:19:37 christos Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: blacklistctl.c,v 1.21 2016/11/02 03:15:07 jnemeth Exp $");
+__RCSID("$NetBSD: blacklistctl.c,v 1.22 2018/05/24 19:19:37 christos Exp $");
 
 #include 
 #include 
@@ -67,6 +67,15 @@ usage(int c)
 	exit(EXIT_FAILURE);
 }
 
+static const char *
+star(char *buf, size_t len, int val)
+{
+	if (val == -1)
+		return "*";
+	snprintf(buf, len, "%d", val);
+	return buf;
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -128,9 +137,10 @@ main(int argc, char *argv[])
 		"address", remain ? "remaining time" : "last access");
 	for (i = 1; state_iterate(db, , , i) != 0; i = 0) {
 		char buf[BUFSIZ];
+		char mbuf[64], pbuf[64];
 		if (!all) {
 			if (blocked) {
-if (dbi.count < c.c_nfail)
+if (c.c_nfail == -1 || dbi.count < c.c_nfail)
 	continue;
 			} else {
 if (dbi.count >= c.c_nfail)
@@ -138,12 +148,18 @@ main(int argc, char *argv[])
 			}
 		}
 		sockaddr_snprintf(buf, sizeof(buf), "%a", (void *)_ss);
-		printf("%*.*s/%d:%d\t", wide, wide, buf, c.c_lmask, c.c_port);
-		if (remain)
-			fmtydhms(buf, sizeof(buf),
-			c.c_duration - (ts.tv_sec - dbi.last));
-		else
-			fmttime(buf, sizeof(buf), dbi.last);
+		printf("%*.*s/%s:%s\t", wide, wide, buf,
+		star(mbuf, sizeof(mbuf), c.c_lmask),
+		star(pbuf, sizeof(pbuf), c.c_port));
+		if (c.c_duration == -1) {
+			strlcpy(buf, "never", sizeof(buf));
+		} else {
+			if (remain)
+fmtydhms(buf, sizeof(buf),
+c.c_duration - (ts.tv_sec - dbi.last));
+			else
+fmttime(buf, sizeof(buf), dbi.last);
+		}
 		printf("%s\t%d/%d\t%-s\n", dbi.id, dbi.count, c.c_nfail, buf);
 	}
 	state_close(db);



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto

2018-05-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May 24 19:03:47 UTC 2018

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto: man.inc

Log Message:
remove DES_random_key.3 since it is in libdes.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/crypto/external/bsd/openssl/lib/libcrypto/man.inc

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/man.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/man.inc:1.9 src/crypto/external/bsd/openssl/lib/libcrypto/man.inc:1.10
--- src/crypto/external/bsd/openssl/lib/libcrypto/man.inc:1.9	Tue May 22 21:58:40 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/man.inc	Thu May 24 15:03:47 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: man.inc,v 1.9 2018/05/23 01:58:40 christos Exp $
+#	$NetBSD: man.inc,v 1.10 2018/05/24 19:03:47 christos Exp $
 
 .PATH:	${.CURDIR}/man
 
@@ -88,7 +88,6 @@ CTLOG_STORE_new.3 \
 CTLOG_new.3 \
 CT_POLICY_EVAL_CTX_new.3 \
 DEFINE_STACK_OF.3 \
-DES_random_key.3 \
 DH_generate_key.3 \
 DH_generate_parameters.3 \
 DH_get0_pqg.3 \



CVS commit: src/sys/arch/epoc32/stand/e32boot/include

2018-05-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May 24 17:07:51 UTC 2018

Modified Files:
src/sys/arch/epoc32/stand/e32boot/include: elf.h

Log Message:
sync with HEAD.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/epoc32/stand/e32boot/include/elf.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/arch/epoc32/stand/e32boot/include/elf.h
diff -u src/sys/arch/epoc32/stand/e32boot/include/elf.h:1.3 src/sys/arch/epoc32/stand/e32boot/include/elf.h:1.4
--- src/sys/arch/epoc32/stand/e32boot/include/elf.h:1.3	Fri Jan  3 11:40:58 2014
+++ src/sys/arch/epoc32/stand/e32boot/include/elf.h	Thu May 24 13:07:51 2018
@@ -1,5 +1,4 @@
-/*	$NetBSD: elf.h,v 1.3 2014/01/03 16:40:58 dsl Exp $	*/
-@@
+/*	$NetBSD: elf.h,v 1.4 2018/05/24 17:07:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -41,14 +40,18 @@
  *	http://www.sco.com/developers/gabi/latest/ch4.eheader.html
  */
 
-typedef unsigned char		uint8_t;
-typedef unsigned short int	uint16_t;
-typedef unsigned int		uint32_t;
-typedef unsigned long long int	uint64_t;
-typedef signed char		int8_t;
-typedef int			int32_t;
-typedef long long int		int64_t;
-
+#if defined(_KERNEL) || defined(_STANDALONE)
+#include 
+#else
+#include 
+#include 
+#endif /* _KERNEL || _STANDALONE */
+
+#if HAVE_NBTOOL_CONFIG_H
+#include 
+#else
+#include 
+#endif
 
 typedef uint8_t		Elf_Byte;
 
@@ -206,7 +209,8 @@ typedef struct {
 #define EM_386		3	/* Intel 80386 */
 #define EM_68K		4	/* Motorola 68000 */
 #define EM_88K		5	/* Motorola 88000 */
-#define EM_486		6	/* Intel 80486 */
+#define EM_486		6	/* Intel 80486 [old] */
+#define EM_IAMCU	6	/* Intel MCU. */
 #define EM_860		7	/* Intel 80860 */
 #define EM_MIPS		8	/* MIPS I Architecture */
 #define EM_S370		9	/* Amdahl UTS on System/370 */
@@ -278,7 +282,8 @@ typedef struct {
 #define EM_MN10300	89	/* Matsushita MN10300 */
 #define EM_MN10200	90	/* Matsushita MN10200 */
 #define EM_PJ		91	/* picoJava */
-#define EM_OPENRISC	92	/* OpenRISC 32-bit embedded processor */
+#define EM_OR1K		92	/* OpenRISC 32-bit embedded processor */
+#define EM_OPENRISC	EM_OR1K
 #define EM_ARC_A5	93	/* ARC Cores Tangent-A5 */
 #define EM_XTENSA	94	/* Tensilica Xtensa Architecture */
 #define EM_VIDEOCORE	95	/* Alphamosaic VideoCore processor */
@@ -297,9 +302,17 @@ typedef struct {
 #define EM_SEP		108	/* Sharp embedded microprocessor */
 #define EM_ARCA		109	/* Arca RISC microprocessor */
 #define EM_UNICORE	110	/* UNICORE from PKU-Unity Ltd. and MPRC Peking University */
+#define EM_ALTERA_NIOS2	113	/* Altera Nios II soft-core processor */
+#define EM_AARCH64	183	/* AArch64 64-bit ARM microprocessor */
+#define EM_AVR32	185	/* Atmel Corporation 32-bit microprocessor family*/
+#define EM_TILE64	187	/* Tilera TILE64 multicore architecture family */
+#define EM_TILEPRO	188	/* Tilera TILEPro multicore architecture family */
+#define EM_MICROBLAZE	189	/* Xilinx MicroBlaze 32-bit RISC soft processor core */
+#define EM_TILEGX	192	/* Tilera TILE-GX multicore architecture family */
+#define EM_Z80		220	/* Zilog Z80 */
+#define EM_RISCV	243	/* RISC-V */
 
 /* Unofficial machine types follow */
-#define EM_AVR32	6317	/* used by NetBSD/avr32 */
 #define EM_ALPHA_EXP	36902	/* used by NetBSD/alpha; obsolete */
 #define EM_NUM		36903
 
@@ -351,6 +364,7 @@ typedef struct {
 #define PT_HIPROC	0x7fff
 
 #define PT_MIPS_REGINFO 0x7000
+#define PT_MIPS_ABIFLAGS 0x7003
 
 /* p_flags */
 #define PF_R		0x4		/* Segment is readable */
@@ -413,8 +427,16 @@ typedef struct {
 #define SHT_NUM		 19
 
 #define SHT_LOOS	 0x6000 /* Operating system specific range */
+#define SHT_GNU_INCREMENTAL_INPUTS 0x6fff4700   /* GNU incremental build data */
+#define	SHT_LOSUNW	 0x6ff4
+#define	SHT_SUNW_dof	 0x6ff4
+#define	SHT_GNU_ATTRIBUTES   0x6ff5	/* GNU object attributes */
+#define	SHT_SUNW_cap	 0x6ff5
+#define	SHT_SUNW_SIGNATURE   0x6ff6
 #define SHT_GNU_HASH	 0x6ff6 /* GNU style symbol hash table */
+#define SHT_GNU_LIBLIST	 0x6ff7 /* GNU list of prelink dependencies */
 #define SHT_SUNW_move	 0x6ffa
+#define	SHT_SUNW_COMDAT	 0x6ffb
 #define SHT_SUNW_syminfo 0x6ffc
 #define SHT_SUNW_verdef	 0x6ffd /* Versions defined by file */
 #define SHT_GNU_verdef	 SHT_SUNW_verdef
@@ -422,9 +444,20 @@ typedef struct {
 #define SHT_GNU_verneed	 SHT_SUNW_verneed
 #define SHT_SUNW_versym	 0x6fff /* Symbol versions */
 #define SHT_GNU_versym	 SHT_SUNW_versym
+#define	SHT_HISUNW	 0x6fff
 #define SHT_HIOS	 0x6fff
 #define SHT_LOPROC	 0x7000 /* Processor-specific range */
 #define SHT_AMD64_UNWIND 0x7001 /* unwind information */
+#define SHT_ARM_EXIDX	 0x7001	/* exception index table */
+#define SHT_ARM_PREEMPTMAP   0x7002 /* BPABI DLL dynamic linking 
+	 * pre-emption map */

CVS commit: src/libexec/ld.elf_so

2018-05-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May 24 17:05:54 UTC 2018

Modified Files:
src/libexec/ld.elf_so: headers.c

Log Message:
rename flag to the official name.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/libexec/ld.elf_so/headers.c

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

Modified files:

Index: src/libexec/ld.elf_so/headers.c
diff -u src/libexec/ld.elf_so/headers.c:1.62 src/libexec/ld.elf_so/headers.c:1.63
--- src/libexec/ld.elf_so/headers.c:1.62	Fri Jun 23 11:29:21 2017
+++ src/libexec/ld.elf_so/headers.c	Thu May 24 13:05:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: headers.c,v 1.62 2017/06/23 15:29:21 joerg Exp $	 */
+/*	$NetBSD: headers.c,v 1.63 2018/05/24 17:05:54 christos Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: headers.c,v 1.62 2017/06/23 15:29:21 joerg Exp $");
+__RCSID("$NetBSD: headers.c,v 1.63 2018/05/24 17:05:54 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -316,7 +316,7 @@ _rtld_digest_dynamic(const char *execnam
 #endif
 		case DT_FLAGS_1:
 			obj->z_now =
-			((dynp->d_un.d_val & DF_1_BIND_NOW) != 0);
+			((dynp->d_un.d_val & DF_1_NOW) != 0);
 			obj->z_nodelete =
 			((dynp->d_un.d_val & DF_1_NODELETE) != 0);
 			obj->z_initfirst =



CVS commit: src/sys/sys

2018-05-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May 24 17:05:18 UTC 2018

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

Log Message:
Complete the list of DF_1 flags.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/sys/exec_elf.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/exec_elf.h
diff -u src/sys/sys/exec_elf.h:1.159 src/sys/sys/exec_elf.h:1.160
--- src/sys/sys/exec_elf.h:1.159	Thu Apr 12 16:48:41 2018
+++ src/sys/sys/exec_elf.h	Thu May 24 13:05:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.h,v 1.159 2018/04/12 20:48:41 christos Exp $	*/
+/*	$NetBSD: exec_elf.h,v 1.160 2018/05/24 17:05:18 christos Exp $	*/
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -723,11 +723,34 @@ typedef struct {
 #define DF_BIND_NOW	0x0008	/* */
 #define DF_STATIC_TLS	0x0010	/* */
 
-/* Flag values for DT_FLAGS_1 (incomplete) */
-#define DF_1_BIND_NOW	0x0001	/* Same as DF_BIND_NOW */
-#define DF_1_NODELETE	0x0008	/* Set the RTLD_NODELETE for object */
-#define DF_1_INITFIRST	0x0020	/* Object's init/fini take priority */
-#define DF_1_NOOPEN	0x0040	/* Do not allow loading on dlopen() */
+/* Flag values for DT_FLAGS_1 */
+#define	DF_1_NOW	0x0001	/* Same as DF_BIND_NOW */
+#define	DF_1_GLOBAL	0x0002	/* Unused */
+#define	DF_1_GROUP	0x0004	/* Is member of group */
+#define	DF_1_NODELETE	0x0008	/* Cannot be deleted from process */
+#define	DF_1_LOADFLTR	0x0010	/* Immediate loading of filters */
+#define	DF_1_INITFIRST	0x0020	/* init/fini takes priority */
+#define	DF_1_NOOPEN	0x0040	/* Do not allow loading on dlopen() */
+#define	DF_1_ORIGIN	0x0080 	/* Require $ORIGIN processing */
+#define	DF_1_DIRECT	0x0100	/* Enable direct bindings */
+#define	DF_1_INTERPOSE 	0x0400	/* Is an interposer */
+#define	DF_1_NODEFLIB	0x0800 	/* Ignore default library search path */
+#define	DF_1_NODUMP	0x1000 	/* Cannot be dumped with dldump(3C) */
+#define	DF_1_CONFALT	0x2000 	/* Configuration alternative */
+#define	DF_1_ENDFILTEE	0x4000	/* Filtee ends filter's search */
+#define	DF_1_DISPRELDNE	0x8000	/* Did displacement relocation */
+#define	DF_1_DISPRELPND 0x0001	/* Pending displacement relocation */
+#define	DF_1_NODIRECT	0x0002 	/* Has non-direct bindings */
+#define	DF_1_IGNMULDEF	0x0004	/* Used internally */
+#define	DF_1_NOKSYMS	0x0008	/* Used internally */
+#define	DF_1_NOHDR	0x0010	/* Used internally */
+#define	DF_1_EDITED	0x0020	/* Has been modified since build */
+#define	DF_1_NORELOC	0x0040 	/* Used internally */
+#define	DF_1_SYMINTPOSE 0x0080 	/* Has individual symbol interposers */
+#define	DF_1_GLOBAUDIT	0x0100	/* Require global auditing */
+#define	DF_1_SINGLETON	0x0200	/* Has singleton symbols */
+#define	DF_1_STUB	0x0400	/* Stub */
+#define	DF_1_PIE	0x0800	/* Position Independent Executable */
 
 /*
  * Auxiliary Vectors



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

2018-05-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May 24 14:54:36 UTC 2018

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

Log Message:
add new tests


To generate a diff of this commit:
cvs rdiff -u -r1.783 -r1.784 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.783 src/distrib/sets/lists/tests/mi:1.784
--- src/distrib/sets/lists/tests/mi:1.783	Fri May 18 02:39:59 2018
+++ src/distrib/sets/lists/tests/mi	Thu May 24 10:54:36 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.783 2018/05/18 06:39:59 kamil Exp $
+# $NetBSD: mi,v 1.784 2018/05/24 14:54:36 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3900,6 +3900,8 @@
 ./usr/tests/usr.bin/make/unit-tests/varcmd.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varmisc.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varmisc.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varquote.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varquote.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varshell.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varshell.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/mixerctl			tests-usr.bin-tests	compattestfile,atf



CVS commit: src/tests/lib/libc/sys

2018-05-24 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu May 24 08:28:40 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.h

Log Message:
Try to fix 32-bit build

Cast pointer to uintptr_t rather than uintmax_t.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/sys/t_ptrace_wait.h

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/libc/sys/t_ptrace_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_wait.h:1.6 src/tests/lib/libc/sys/t_ptrace_wait.h:1.7
--- src/tests/lib/libc/sys/t_ptrace_wait.h:1.6	Wed May 23 13:18:09 2018
+++ src/tests/lib/libc/sys/t_ptrace_wait.h	Thu May 24 08:28:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.h,v 1.6 2018/05/23 13:18:09 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.h,v 1.7 2018/05/24 08:28:40 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -558,11 +558,11 @@ trigger_bus(void)
 
 	/* Open an empty file for writing. */
 	fp = tmpfile();
-	FORKEE_ASSERT_NEQ((uintmax_t)fp, (uintmax_t)NULL);
+	FORKEE_ASSERT_NEQ((uintptr_t)fp, (uintptr_t)NULL);
 
 	/* Map an empty file with mmap(2) to a pointer. */
 	p = mmap(0, 1, PROT_WRITE, MAP_PRIVATE, fileno(fp), 0);
-	FORKEE_ASSERT_NEQ((uintmax_t)p, (uintmax_t)MAP_FAILED);
+	FORKEE_ASSERT_NEQ((uintptr_t)p, (uintptr_t)MAP_FAILED);
 
 	/* Invalid memory access causes CPU trap, translated to SIGBUS */
 	*p = 'a';



CVS commit: src/sys/net

2018-05-24 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu May 24 07:00:28 UTC 2018

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

Log Message:
ipsecif(4) must not set port number to spidx even if NAT-T. Pointed out by 
ohishi@IIJ, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 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.13 src/sys/net/if_ipsec.c:1.14
--- src/sys/net/if_ipsec.c:1.13	Fri Apr 27 09:55:27 2018
+++ src/sys/net/if_ipsec.c	Thu May 24 07:00:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.13 2018/04/27 09:55:27 knakahara Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.14 2018/05/24 07:00:28 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.13 2018/04/27 09:55:27 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.14 2018/05/24 07:00:28 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1574,13 +1574,18 @@ if_ipsec_add_sp0(struct sockaddr *src, i
 	m_copyback(m, 0, sizeof(msg), );
 
 	if_ipsec_add_mbuf(m, , sizeof(xsrc));
-	if_ipsec_add_mbuf_addr_port(m, src, sport, true);
+	/*
+	 * secpolicy.spidx.{src, dst} must not be set port number,
+	 * even if it is used for NAT-T.
+	 */
+	if_ipsec_add_mbuf_addr_port(m, src, 0, true);
 	padlen = PFKEY_UNUNIT64(xsrc.sadb_address_len)
 		- (sizeof(xsrc) + PFKEY_ALIGN8(src->sa_len));
 	if_ipsec_add_pad(m, padlen);
 
 	if_ipsec_add_mbuf(m, , sizeof(xdst));
-	if_ipsec_add_mbuf_addr_port(m, dst, dport, true);
+	/* ditto */
+	if_ipsec_add_mbuf_addr_port(m, dst, 0, true);
 	padlen = PFKEY_UNUNIT64(xdst.sadb_address_len)
 		- (sizeof(xdst) + PFKEY_ALIGN8(dst->sa_len));
 	if_ipsec_add_pad(m, padlen);
@@ -1588,6 +1593,10 @@ if_ipsec_add_sp0(struct sockaddr *src, i
 	if_ipsec_add_mbuf(m, , sizeof(xpl));
 	if (policy == IPSEC_POLICY_IPSEC) {
 		if_ipsec_add_mbuf(m, , sizeof(xisr));
+		/*
+		 * secpolicy.req->saidx.{src, dst} must be set port number,
+		 * when it is used for NAT-T.
+		 */
 		if_ipsec_add_mbuf_addr_port(m, src, sport, false);
 		if_ipsec_add_mbuf_addr_port(m, dst, dport, false);
 	}