svn commit: r359720 - head/sys/fs/nfsserver

2020-04-07 Thread Rick Macklem
Author: rmacklem
Date: Wed Apr  8 01:12:54 2020
New Revision: 359720
URL: https://svnweb.freebsd.org/changeset/base/359720

Log:
  Fix an interoperability issue w.r.t. the Linux client and the NFSv4 server.
  
  Luoqi Chen reported a problem on freebsd-fs@ where a Linux NFSv4 client
  was able to open and write to a file when the file's permissions were
  not set to allow the owner write access.
  
  Since NFS servers check file permissions on every write RPC, it is standard
  practice to allow the owner of the file to do writes, regardless of
  file permissions. This provides POSIX like behaviour, since POSIX only
  checks permissions upon open(2).
  The traditional way NFS clients handle this is to check access via the
  Access operation/RPC and use that to determine if an open(2) on the
  client is allowed.
  
  It appears that, for NFSv4, the Linux client expects the NFSv4 Open (not a
  POSIX open) operation to fail with NFSERR_ACCES if the file is not being
  created and file permissions do not allow owner access, unlike NFSv3.
  Since both the Linux and OpenSolaris NFSv4 servers seem to exhibit this
  behaviour, this patch changes the FreeBSD NFSv4 server to do the same.
  A sysctl called vfs.nfsd.v4openaccess can be set to 0 to return the
  NFSv4 server to its previous behaviour.
  
  Since both the Linux and FreeBSD NFSv4 clients seem to exhibit correct
  behaviour with the access check for file owner in Open enabled, it is enabled
  by default.
  
  Reported by:  luoqi.c...@gmail.com
  MFC after:2 weeks

Modified:
  head/sys/fs/nfsserver/nfs_nfsdserv.c

Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c
==
--- head/sys/fs/nfsserver/nfs_nfsdserv.cTue Apr  7 23:17:44 2020
(r359719)
+++ head/sys/fs/nfsserver/nfs_nfsdserv.cWed Apr  8 01:12:54 2020
(r359720)
@@ -81,6 +81,10 @@ static int   nfsrv_linux42server = 1;
 SYSCTL_INT(_vfs_nfsd, OID_AUTO, linux42server, CTLFLAG_RW,
 _linux42server, 0,
 "Enable Linux style NFSv4.2 server (non-RFC compliant)");
+static boolnfsrv_openaccess = true;
+SYSCTL_BOOL(_vfs_nfsd, OID_AUTO, v4openaccess, CTLFLAG_RW,
+_openaccess, 0,
+"Enable Linux style NFSv4 Open access check");
 
 /*
  * This list defines the GSS mechanisms supported.
@@ -2742,7 +2746,7 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int is
u_int32_t *tl;
int i, retext;
struct nfsstate *stp = NULL;
-   int error = 0, create, claim, exclusive_flag = 0;
+   int error = 0, create, claim, exclusive_flag = 0, override;
u_int32_t rflags = NFSV4OPEN_LOCKTYPEPOSIX, acemask;
int how = NFSCREATE_UNCHECKED;
int32_t cverf[2], tverf[2] = { 0, 0 };
@@ -3046,15 +3050,38 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int is
 */
nd->nd_repstat = (vp->v_type == VDIR) ? NFSERR_ISDIR : 
NFSERR_SYMLINK;
}
+
+   /*
+* If the Open is being done for a file that already exists, apply
+* normal permission checking including for the file owner, if
+* vfs.nfsd.v4openaccess is set.
+* Previously, the owner was always allowed to open the file to
+* be consistent with the NFS tradition of always allowing the
+* owner of the file to write to the file regardless of permissions.
+* It now appears that the Linux client expects the owner
+* permissions to be checked for opens that are not creating the
+* file.  I believe the correct approach is to use the Access
+* operation's results to be consistent with NFSv3, but that is
+* not what the current Linux client appears to be doing.
+* Since both the Linux and OpenSolaris NFSv4 servers do this check,
+* I have enabled it by default.
+* If this semantic change causes a problem, it can be disabled by
+* setting the sysctl vfs.nfsd.v4openaccess to 0 to re-enable the
+* previous semantics.
+*/
+   if (nfsrv_openaccess && create == NFSV4OPEN_NOCREATE)
+   override = NFSACCCHK_NOOVERRIDE;
+   else
+   override = NFSACCCHK_ALLOWOWNER;
if (!nd->nd_repstat && (stp->ls_flags & NFSLCK_WRITEACCESS))
nd->nd_repstat = nfsvno_accchk(vp, VWRITE, nd->nd_cred,
-   exp, p, NFSACCCHK_ALLOWOWNER, NFSACCCHK_VPISLOCKED, NULL);
+   exp, p, override, NFSACCCHK_VPISLOCKED, NULL);
if (!nd->nd_repstat && (stp->ls_flags & NFSLCK_READACCESS)) {
nd->nd_repstat = nfsvno_accchk(vp, VREAD, nd->nd_cred,
-   exp, p, NFSACCCHK_ALLOWOWNER, NFSACCCHK_VPISLOCKED, NULL);
+   exp, p, override, NFSACCCHK_VPISLOCKED, NULL);
if (nd->nd_repstat)
nd->nd_repstat = nfsvno_accchk(vp, VEXEC,
-   nd->nd_cred, exp, p, NFSACCCHK_ALLOWOWNER,
+   nd->nd_cred, exp, p, override,

svn commit: r359719 - head/usr.sbin/bhyve

2020-04-07 Thread Rodney W. Grimes
Author: rgrimes
Date: Tue Apr  7 23:17:44 2020
New Revision: 359719
URL: https://svnweb.freebsd.org/changeset/base/359719

Log:
  In the past changes have been made to smbios->minor without updating the
  smbios->bcdrev value.
  Correct that by calculating bcdrev from the major/minor values.
  
  Reported by:  bcran
  Reviewed by:  bcran, jhb
  Approved by:  jhb (maintainer)

Modified:
  head/usr.sbin/bhyve/smbiostbl.c

Modified: head/usr.sbin/bhyve/smbiostbl.c
==
--- head/usr.sbin/bhyve/smbiostbl.c Tue Apr  7 22:23:22 2020
(r359718)
+++ head/usr.sbin/bhyve/smbiostbl.c Tue Apr  7 23:17:44 2020
(r359719)
@@ -774,7 +774,7 @@ smbios_ep_initializer(struct smbios_entry_point *smbio
memcpy(smbios_ep->ianchor, SMBIOS_ENTRY_IANCHOR,
SMBIOS_ENTRY_IANCHORLEN);
smbios_ep->staddr = staddr;
-   smbios_ep->bcdrev = 0x24;
+   smbios_ep->bcdrev = (smbios_ep->major & 0xf) << 4 | (smbios_ep->minor & 
0xf);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359718 - in head/sys: cam cam/ata cam/mmc geom

2020-04-07 Thread Warner Losh
Author: imp
Date: Tue Apr  7 22:23:22 2020
New Revision: 359718
URL: https://svnweb.freebsd.org/changeset/base/359718

Log:
  Now that we don't have special-case geom hacking defined in md_var.h, stop
  including it. sparc64 was the last straggler here, but these weren't removed 
at
  the time.

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/cam_xpt.c
  head/sys/cam/mmc/mmc_da.c
  head/sys/geom/geom_disk.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Tue Apr  7 20:26:42 2020(r359717)
+++ head/sys/cam/ata/ata_da.c   Tue Apr  7 22:23:22 2020(r359718)
@@ -70,8 +70,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include /* geometry translation */
-
 #ifdef _KERNEL
 
 #define ATA_MAX_28BIT_LBA   268435455UL

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Tue Apr  7 20:26:42 2020(r359717)
+++ head/sys/cam/cam_xpt.c  Tue Apr  7 22:23:22 2020(r359718)
@@ -71,7 +71,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include /* geometry translation */
 #include /* for xpt_print below */
 
 #include "opt_cam.h"

Modified: head/sys/cam/mmc/mmc_da.c
==
--- head/sys/cam/mmc/mmc_da.c   Tue Apr  7 20:26:42 2020(r359717)
+++ head/sys/cam/mmc/mmc_da.c   Tue Apr  7 22:23:22 2020(r359718)
@@ -77,8 +77,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include /* geometry translation */
-
 #ifdef _KERNEL
 
 typedef enum {

Modified: head/sys/geom/geom_disk.c
==
--- head/sys/geom/geom_disk.c   Tue Apr  7 20:26:42 2020(r359717)
+++ head/sys/geom/geom_disk.c   Tue Apr  7 22:23:22 2020(r359718)
@@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r359705 - head/share/mk

2020-04-07 Thread Kyle Evans
On Tue, Apr 7, 2020 at 4:49 PM Simon J. Gerraty  wrote:
>
> Kyle Evans  wrote:
> > universe13a% make -C stand -V .OBJDIR
> > /scratch/tmp/kevans/obj/home/kevans/head/amd64.amd64/stand
> >
> > But in a buildenv:
> > universe13a% make TARGET_ARCH=armv7 buildenv
> > Entering world for armv7:arm
> > For ZSH you must run: export CPUTYPE=
> > universe13a% make -C stand -V .OBJDIR
> > [Creating objdir /scratch/tmp/kevans/obj/home/kevans/head/stand...]
> > /scratch/tmp/kevans/obj/home/kevans/head/stand
>
> What do you get for:
>
> env | grep MAKE
>

It turned out I had export MAKEOBJDIRPREFIX=... in my ~/.zshrc on this
particular machine that was polluting the buildenv- Bryan investigated
a bit (via IRC) and we came to the conclusion that I should not do
that, or at least not do that for BUILDENV. I'm happy with this
solution, as it's only in there to allow me to be lazy on universe
machines. =-)

Thanks,

Kyle Evans
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r359705 - head/share/mk

2020-04-07 Thread Simon J. Gerraty via svn-src-all
Kyle Evans  wrote:
> universe13a% make -C stand -V .OBJDIR
> /scratch/tmp/kevans/obj/home/kevans/head/amd64.amd64/stand
> 
> But in a buildenv:
> universe13a% make TARGET_ARCH=armv7 buildenv
> Entering world for armv7:arm
> For ZSH you must run: export CPUTYPE=
> universe13a% make -C stand -V .OBJDIR
> [Creating objdir /scratch/tmp/kevans/obj/home/kevans/head/stand...]
> /scratch/tmp/kevans/obj/home/kevans/head/stand

What do you get for:

env | grep MAKE


> Using buildenv with BUILDENV_SHELL="make -C stand -V .OBDJIR"
> *doesn't* reproduce it (objdir has arm.armv7 in it again).
> 
> I tried with both zsh (and export CPUTYPE=) and /bin/sh, but it seems
> to reproduce both ways.
> 
> Thanks,
> 
> Kyle Evans
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359717 - in head: etc/mtree sbin/nvmecontrol sbin/nvmecontrol/tests

2020-04-07 Thread David Bright
Author: dab
Date: Tue Apr  7 20:26:42 2020
New Revision: 359717
URL: https://svnweb.freebsd.org/changeset/base/359717

Log:
  Add a basic test for nvmecontrol
  
  I recently made some bug fixes in nvmecontrol. It occurred to me that
  since nvmecontrol lacks any kyua tests, I should convert the informal
  testing I did into a more formal automated test. The test in this
  change should be considered just a starting point; it is neither
  complete nor thorough. While converting the test to ATF/kyua, I
  discovered a small bug in nvmecontrol; the nvmecontrol devlist command
  would always exit with an unsuccessful status. So I included the fix
  for that, too, so that the test won't fail.
  
  Reviewed by:  imp@
  MFC after:3 days
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D24269

Added:
  head/sbin/nvmecontrol/tests/
  head/sbin/nvmecontrol/tests/Makefile   (contents, props changed)
  head/sbin/nvmecontrol/tests/basic.sh   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/sbin/nvmecontrol/Makefile
  head/sbin/nvmecontrol/devlist.c

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Tue Apr  7 19:46:00 2020
(r359716)
+++ head/etc/mtree/BSD.tests.dist   Tue Apr  7 20:26:42 2020
(r359717)
@@ -438,6 +438,8 @@
 ..
 mdconfig
 ..
+nvmecontrol
+..
 pfctl
 files
 ..

Modified: head/sbin/nvmecontrol/Makefile
==
--- head/sbin/nvmecontrol/Makefile  Tue Apr  7 19:46:00 2020
(r359716)
+++ head/sbin/nvmecontrol/Makefile  Tue Apr  7 20:26:42 2020
(r359717)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include 
+
 PACKAGE=runtime
 PROG=  nvmecontrol
 SRCS=  comnd.c nvmecontrol.c
@@ -11,6 +13,8 @@ MAN=  nvmecontrol.8
 LDFLAGS+= -rdynamic
 LIBADD+= util
 SUBDIR=modules
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
 
 .PATH: ${SRCTOP}/sys/dev/nvme
 

Modified: head/sbin/nvmecontrol/devlist.c
==
--- head/sbin/nvmecontrol/devlist.c Tue Apr  7 19:46:00 2020
(r359716)
+++ head/sbin/nvmecontrol/devlist.c Tue Apr  7 20:26:42 2020
(r359717)
@@ -122,8 +122,10 @@ devlist(const struct cmd *f, int argc, char *argv[])
close(fd);
}
 
-   if (found == 0)
+   if (found == 0) {
printf("No NVMe controllers found.\n");
+   exit(1);
+   }
 
-   exit(1);
+   exit(0);
 }

Added: head/sbin/nvmecontrol/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sbin/nvmecontrol/tests/MakefileTue Apr  7 20:26:42 2020
(r359717)
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+PACKAGE=   tests
+ATF_TESTS_SH+= basic
+
+.include 

Added: head/sbin/nvmecontrol/tests/basic.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sbin/nvmecontrol/tests/basic.shTue Apr  7 20:26:42 2020
(r359717)
@@ -0,0 +1,236 @@
+# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+#
+# Copyright (c) 2020 David A. Bright
+#
+# 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 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 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.
+#
+# $FreeBSD$
+
+#
+# A basic test for nvmecontrol. This isn't a thorough or complete test
+# of nvmecontrol functionality; it is more of a sanity check that
+# nvmecontrol basically works.
+#
+
+DANGEROUS=false # Set to true to run 

svn commit: r359716 - head/stand/powerpc/ofw

2020-04-07 Thread Leandro Lupori
Author: luporl
Date: Tue Apr  7 19:46:00 2020
New Revision: 359716
URL: https://svnweb.freebsd.org/changeset/base/359716

Log:
  Add support to MSDOS FS in PPC loader
  
  Although PPC OFW loader already had a LOADER_MSDOS_SUPPORT option, a few lines
  were missing in conf.c, in order to support FAT filesystems.
  
  This is useful when running FreeBSD under QEMU, to be able to easily change 
the
  kernel and modules when running on hosts without UFS read/write support.
  
  Reviewed by:  jhibbits
  Sponsored by: Eldorado Research Institute (eldorado.org.br)
  Differential Revision:https://reviews.freebsd.org/D24328

Modified:
  head/stand/powerpc/ofw/conf.c

Modified: head/stand/powerpc/ofw/conf.c
==
--- head/stand/powerpc/ofw/conf.c   Tue Apr  7 19:44:40 2020
(r359715)
+++ head/stand/powerpc/ofw/conf.c   Tue Apr  7 19:46:00 2020
(r359716)
@@ -69,6 +69,9 @@ struct fs_ops *file_system[] = {
 #if defined(LOADER_EXT2FS_SUPPORT)
 _fsops,
 #endif
+#if defined(LOADER_MSDOS_SUPPORT)
+_fsops,
+#endif
 #if defined(LOADER_NFS_SUPPORT)
 _fsops,
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359714 - stable/12/share/mk

2020-04-07 Thread Bryan Drewery
Author: bdrewery
Date: Tue Apr  7 19:44:37 2020
New Revision: 359714
URL: https://svnweb.freebsd.org/changeset/base/359714

Log:
  MFC r349729:
  
Consider *clean targets as non-build targets as well.

Modified:
  stable/12/share/mk/bsd.init.mk
  stable/12/share/mk/bsd.sys.mk
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/mk/bsd.init.mk
==
--- stable/12/share/mk/bsd.init.mk  Tue Apr  7 19:40:14 2020
(r359713)
+++ stable/12/share/mk/bsd.init.mk  Tue Apr  7 19:44:37 2020
(r359714)
@@ -58,11 +58,12 @@ $xGRP=  ${_gid}
 #   things like 'make all install' or 'make foo install'.
 # - non-build targets are called
 .if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL:U1} == 0 && \
-${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*)
+${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*) && !make(*clean)
 _SKIP_BUILD=   not building at level 0
 .elif !empty(.MAKEFLAGS:M-V${_V_DO_BUILD}) || \
 ${.TARGETS:M*install*} == ${.TARGETS} || \
 ${.TARGETS:Mclean*} == ${.TARGETS} || \
+${.TARGETS:M*clean} == ${.TARGETS} || \
 ${.TARGETS:Mdestroy*} == ${.TARGETS} || \
 ${.TARGETS:Mobj} == ${.TARGETS} || \
 make(analyze) || make(print-dir)

Modified: stable/12/share/mk/bsd.sys.mk
==
--- stable/12/share/mk/bsd.sys.mk   Tue Apr  7 19:40:14 2020
(r359713)
+++ stable/12/share/mk/bsd.sys.mk   Tue Apr  7 19:44:37 2020
(r359714)
@@ -284,7 +284,7 @@ PHONY_NOTMAIN = analyze afterdepend afterinstall all b
 .NOTMAIN: ${PHONY_NOTMAIN:Nall}
 
 .if ${MK_STAGING} != "no"
-.if defined(_SKIP_BUILD) || (!make(all) && !make(clean*))
+.if defined(_SKIP_BUILD) || (!make(all) && !make(clean*) && !make(*clean))
 _SKIP_STAGING?= yes
 .endif
 .if ${_SKIP_STAGING:Uno} == "yes"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359715 - stable/11/share/mk

2020-04-07 Thread Bryan Drewery
Author: bdrewery
Date: Tue Apr  7 19:44:40 2020
New Revision: 359715
URL: https://svnweb.freebsd.org/changeset/base/359715

Log:
  MFC r349729:
  
Consider *clean targets as non-build targets as well.

Modified:
  stable/11/share/mk/bsd.init.mk
  stable/11/share/mk/bsd.sys.mk
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/mk/bsd.init.mk
==
--- stable/11/share/mk/bsd.init.mk  Tue Apr  7 19:44:37 2020
(r359714)
+++ stable/11/share/mk/bsd.init.mk  Tue Apr  7 19:44:40 2020
(r359715)
@@ -46,11 +46,12 @@ $xGRP=  ${_gid}
 #   things like 'make all install' or 'make foo install'.
 # - non-build targets are called
 .if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL:U1} == 0 && \
-${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*)
+${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*) && !make(*clean)
 _SKIP_BUILD=   not building at level 0
 .elif !empty(.MAKEFLAGS:M-V${_V_DO_BUILD}) || \
 ${.TARGETS:M*install*} == ${.TARGETS} || \
 ${.TARGETS:Mclean*} == ${.TARGETS} || \
+${.TARGETS:M*clean} == ${.TARGETS} || \
 ${.TARGETS:Mdestroy*} == ${.TARGETS} || \
 make(obj) || make(analyze) || make(print-dir)
 # Skip building, but don't show a warning.

Modified: stable/11/share/mk/bsd.sys.mk
==
--- stable/11/share/mk/bsd.sys.mk   Tue Apr  7 19:44:37 2020
(r359714)
+++ stable/11/share/mk/bsd.sys.mk   Tue Apr  7 19:44:40 2020
(r359715)
@@ -244,7 +244,7 @@ PHONY_NOTMAIN = analyze afterdepend afterinstall all b
 .NOTMAIN: ${PHONY_NOTMAIN:Nall}
 
 .if ${MK_STAGING} != "no"
-.if defined(_SKIP_BUILD) || (!make(all) && !make(clean*))
+.if defined(_SKIP_BUILD) || (!make(all) && !make(clean*) && !make(*clean))
 _SKIP_STAGING?= yes
 .endif
 .if ${_SKIP_STAGING:Uno} == "yes"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359712 - stable/12/share/mk

2020-04-07 Thread Bryan Drewery
Author: bdrewery
Date: Tue Apr  7 19:40:11 2020
New Revision: 359712
URL: https://svnweb.freebsd.org/changeset/base/359712

Log:
  MFC r353771:
  
Fix spelling of DPSRCS.

Modified:
  stable/12/share/mk/bsd.dep.mk
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/mk/bsd.dep.mk
==
--- stable/12/share/mk/bsd.dep.mk   Tue Apr  7 19:39:41 2020
(r359711)
+++ stable/12/share/mk/bsd.dep.mk   Tue Apr  7 19:40:11 2020
(r359712)
@@ -182,7 +182,7 @@ DEPEND_MP?= -MP
 # avoid collisions.
 DEPEND_FILTER= C,/,_,g
 DEPENDSRCS+=   ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc}
-DEPENDSRCS+=   ${DPSRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc}
+DEPENDSRCS+=   ${DPSRCS:M*.[cSC]} ${DPSRCS:M*.cxx} ${DPSRCS:M*.cpp} 
${DPSRCS:M*.cc}
 .if !empty(DEPENDSRCS)
 DEPENDOBJS+=   ${DEPENDSRCS:${OBJS_SRCS_FILTER:ts:}:S,$,.o,}
 .endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359713 - stable/11/share/mk

2020-04-07 Thread Bryan Drewery
Author: bdrewery
Date: Tue Apr  7 19:40:14 2020
New Revision: 359713
URL: https://svnweb.freebsd.org/changeset/base/359713

Log:
  MFC r353771:
  
Fix spelling of DPSRCS.

Modified:
  stable/11/share/mk/bsd.dep.mk
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/mk/bsd.dep.mk
==
--- stable/11/share/mk/bsd.dep.mk   Tue Apr  7 19:40:11 2020
(r359712)
+++ stable/11/share/mk/bsd.dep.mk   Tue Apr  7 19:40:14 2020
(r359713)
@@ -177,7 +177,7 @@ DEPEND_MP?= -MP
 # avoid collisions.
 DEPEND_FILTER= C,/,_,g
 DEPENDSRCS=${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc}
-DEPENDSRCS+=   ${DPSRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc}
+DEPENDSRCS+=   ${DPSRCS:M*.[cSC]} ${DPSRCS:M*.cxx} ${DPSRCS:M*.cpp} 
${DPSRCS:M*.cc}
 .if !empty(DEPENDSRCS)
 DEPENDOBJS+=   ${DEPENDSRCS:R:S,$,.o,}
 .endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359711 - stable/11/sys/conf

2020-04-07 Thread Bryan Drewery
Author: bdrewery
Date: Tue Apr  7 19:39:41 2020
New Revision: 359711
URL: https://svnweb.freebsd.org/changeset/base/359711

Log:
  MFC r357353:
  
make all is needed to generate .depend.*

Modified:
  stable/11/sys/conf/kern.post.mk
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/conf/kern.post.mk
==
--- stable/11/sys/conf/kern.post.mk Tue Apr  7 19:39:08 2020
(r359710)
+++ stable/11/sys/conf/kern.post.mk Tue Apr  7 19:39:41 2020
(r359711)
@@ -313,7 +313,7 @@ kernel-cleandepend: .PHONY
 
 kernel-tags:
@ls .depend.* > /dev/null 2>&1 || \
-   { echo "you must make depend first"; exit 1; }
+   { echo "you must make all first"; exit 1; }
sh $S/conf/systags.sh
 
 kernel-install: .PHONY
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359710 - stable/12/sys/conf

2020-04-07 Thread Bryan Drewery
Author: bdrewery
Date: Tue Apr  7 19:39:08 2020
New Revision: 359710
URL: https://svnweb.freebsd.org/changeset/base/359710

Log:
  MFC r357353:
  
make all is needed to generate .depend.*

Modified:
  stable/12/sys/conf/kern.post.mk
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/conf/kern.post.mk
==
--- stable/12/sys/conf/kern.post.mk Tue Apr  7 18:41:52 2020
(r359709)
+++ stable/12/sys/conf/kern.post.mk Tue Apr  7 19:39:08 2020
(r359710)
@@ -356,7 +356,7 @@ kernel-cleandepend: .PHONY
 
 kernel-tags:
@ls .depend.* > /dev/null 2>&1 || \
-   { echo "you must make depend first"; exit 1; }
+   { echo "you must make all first"; exit 1; }
sh $S/conf/systags.sh
 
 kernel-install: .PHONY
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359709 - stable/12

2020-04-07 Thread Mitchell Horne
Author: mhorne
Date: Tue Apr  7 18:41:52 2020
New Revision: 359709
URL: https://svnweb.freebsd.org/changeset/base/359709

Log:
  MFC r359289:
  
  Makefile.inc1: override MACHINE for native-xtools

Modified:
  stable/12/Makefile.inc1
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/Makefile.inc1
==
--- stable/12/Makefile.inc1 Tue Apr  7 17:50:18 2020(r359708)
+++ stable/12/Makefile.inc1 Tue Apr  7 18:41:52 2020(r359709)
@@ -2474,6 +2474,7 @@ NXBMAKE+= XCC="${NXBOBJTOP}/tmp/usr/bin/cc" \
XCPP="${NXBOBJTOP}/tmp/usr/bin/cpp"
 .endif
 NXBMAKE+=  ${NXBMAKEENV} ${MAKE} -f Makefile.inc1 ${NXBMAKEARGS} \
+   MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} \
TARGET=${NXB_TARGET} TARGET_ARCH=${NXB_TARGET_ARCH} \
TARGET_TRIPLE=${MACHINE_TRIPLE:Q}
 # NXBDIRS is improperly based on MACHINE rather than NXB_TARGET.  Need to
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r359705 - head/share/mk

2020-04-07 Thread Bryan Drewery
On 4/7/2020 10:13 AM, Kyle Evans wrote:
> On Tue, Apr 7, 2020 at 12:07 PM Bryan Drewery  wrote:
>>
>> Author: bdrewery
>> Date: Tue Apr  7 17:07:04 2020
>> New Revision: 359705
>> URL: https://svnweb.freebsd.org/changeset/base/359705
>>
>> Log:
>>   NO_OBJ: Always fix .OBJDIR regardless of AUTO_OBJ.
>>
>>   Sponsored by: Dell EMC
>>   MFC after:2 weeks
>>
>> Modified:
>>   head/share/mk/bsd.init.mk
>>   head/share/mk/bsd.obj.mk
>>
> 
> Unrelated, but something else that's kinda funky:
> 
> universe13a% make -C stand -V .OBJDIR
> /scratch/tmp/kevans/obj/home/kevans/head/amd64.amd64/stand
> 
> But in a buildenv:
> universe13a% make TARGET_ARCH=armv7 buildenv
> Entering world for armv7:arm
> For ZSH you must run: export CPUTYPE=
> universe13a% make -C stand -V .OBJDIR
> [Creating objdir /scratch/tmp/kevans/obj/home/kevans/head/stand...]
> /scratch/tmp/kevans/obj/home/kevans/head/stand
> 
> Using buildenv with BUILDENV_SHELL="make -C stand -V .OBDJIR"
> *doesn't* reproduce it (objdir has arm.armv7 in it again).
> 
> I tried with both zsh (and export CPUTYPE=) and /bin/sh, but it seems
> to reproduce both ways.
> 
> Thanks,
> 
> Kyle Evans
> 

Discussed with Kyle on IRC. Turned out to be an 'export
MAKEOBJDIRPREFIX=/something' in ~/.profile.

I suggest something like this in the profile:

if [ -n "${BUILDENV}" ]; then
PS1="(buildenv) ${PS1}"
unset CPUTYPE
else
export MAKEOBJDIRPREFIX=/whatever
fi


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r359708 - in stable/11: share/man/man4 sys/netgraph

2020-04-07 Thread Eugene Grosbein
Author: eugen
Date: Tue Apr  7 17:50:18 2020
New Revision: 359708
URL: https://svnweb.freebsd.org/changeset/base/359708

Log:
  MFC r357053 by markj: ng_nat: Pass IPv6 packets through.
  
  ng_nat implements NAT for IPv4 traffic only.  When connected to an
  ng_ether node it erroneously handled IPv6 packets as well.
  
  This change is not sufficient: ng_nat does not do any validation of IP
  packets in this mode, even though they have not yet passed through
  ip_input().
  
  PR:   243096
  Reported by:  Robert James Hernandez 
  Reviewed by:  julian
  Differential Revision:https://reviews.freebsd.org/D23080

Modified:
  stable/11/share/man/man4/ng_nat.4
  stable/11/sys/netgraph/ng_nat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/ng_nat.4
==
--- stable/11/share/man/man4/ng_nat.4   Tue Apr  7 17:49:36 2020
(r359707)
+++ stable/11/share/man/man4/ng_nat.4   Tue Apr  7 17:50:18 2020
(r359708)
@@ -35,7 +35,7 @@
 .Sh DESCRIPTION
 An
 .Nm
-node performs network address translation (NAT) of packets
+node performs network address translation (NAT) of IPv4 packets
 passing through it.
 A
 .Nm nat

Modified: stable/11/sys/netgraph/ng_nat.c
==
--- stable/11/sys/netgraph/ng_nat.c Tue Apr  7 17:49:36 2020
(r359707)
+++ stable/11/sys/netgraph/ng_nat.c Tue Apr  7 17:50:18 2020
(r359708)
@@ -793,7 +793,6 @@ ng_nat_rcvdata(hook_p hook, item_p item )
eh = mtod(m, struct ether_header *);
switch (ntohs(eh->ether_type)) {
case ETHERTYPE_IP:
-   case ETHERTYPE_IPV6:
ipofs = sizeof(struct ether_header);
break;
default:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359707 - in stable/12: share/man/man4 sys/netgraph

2020-04-07 Thread Eugene Grosbein
Author: eugen
Date: Tue Apr  7 17:49:36 2020
New Revision: 359707
URL: https://svnweb.freebsd.org/changeset/base/359707

Log:
  MFC r357053 by markj: ng_nat: Pass IPv6 packets through.
  
  ng_nat implements NAT for IPv4 traffic only.  When connected to an
  ng_ether node it erroneously handled IPv6 packets as well.
  
  This change is not sufficient: ng_nat does not do any validation of IP
  packets in this mode, even though they have not yet passed through
  ip_input().
  
  PR:   243096
  Reported by:  Robert James Hernandez 
  Reviewed by:  julian
  Differential Revision:https://reviews.freebsd.org/D23080

Modified:
  stable/12/share/man/man4/ng_nat.4
  stable/12/sys/netgraph/ng_nat.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/ng_nat.4
==
--- stable/12/share/man/man4/ng_nat.4   Tue Apr  7 17:18:22 2020
(r359706)
+++ stable/12/share/man/man4/ng_nat.4   Tue Apr  7 17:49:36 2020
(r359707)
@@ -35,7 +35,7 @@
 .Sh DESCRIPTION
 An
 .Nm
-node performs network address translation (NAT) of packets
+node performs network address translation (NAT) of IPv4 packets
 passing through it.
 A
 .Nm nat

Modified: stable/12/sys/netgraph/ng_nat.c
==
--- stable/12/sys/netgraph/ng_nat.c Tue Apr  7 17:18:22 2020
(r359706)
+++ stable/12/sys/netgraph/ng_nat.c Tue Apr  7 17:49:36 2020
(r359707)
@@ -795,7 +795,6 @@ ng_nat_rcvdata(hook_p hook, item_p item )
eh = mtod(m, struct ether_header *);
switch (ntohs(eh->ether_type)) {
case ETHERTYPE_IP:
-   case ETHERTYPE_IPV6:
ipofs = sizeof(struct ether_header);
break;
default:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359706 - svnadmin/conf

2020-04-07 Thread Rodney W. Grimes
Author: rgrimes
Date: Tue Apr  7 17:18:22 2020
New Revision: 359706
URL: https://svnweb.freebsd.org/changeset/base/359706

Log:
  Add tuexen and myself (rgrimes) as rscheff's mentors.
  
  Reminded by:  gjb
  Approved by:  core

Modified:
  svnadmin/conf/mentors

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Tue Apr  7 17:07:04 2020(r359705)
+++ svnadmin/conf/mentors   Tue Apr  7 17:18:22 2020(r359706)
@@ -29,6 +29,7 @@ miwi  araujo
 mjoras rstone
 nick   philip  Co-mentor: kp
 ramken Co-mentor: mav
+rschefftuexen  Co-mentor: rgrimes
 scottphscottl  Co-mentor: emaste, jhb
 thjjtl Co-mentor: bz
 tmunro mjg Co-mentor: allanjude
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r359705 - head/share/mk

2020-04-07 Thread Kyle Evans
On Tue, Apr 7, 2020 at 12:07 PM Bryan Drewery  wrote:
>
> Author: bdrewery
> Date: Tue Apr  7 17:07:04 2020
> New Revision: 359705
> URL: https://svnweb.freebsd.org/changeset/base/359705
>
> Log:
>   NO_OBJ: Always fix .OBJDIR regardless of AUTO_OBJ.
>
>   Sponsored by: Dell EMC
>   MFC after:2 weeks
>
> Modified:
>   head/share/mk/bsd.init.mk
>   head/share/mk/bsd.obj.mk
>

Unrelated, but something else that's kinda funky:

universe13a% make -C stand -V .OBJDIR
/scratch/tmp/kevans/obj/home/kevans/head/amd64.amd64/stand

But in a buildenv:
universe13a% make TARGET_ARCH=armv7 buildenv
Entering world for armv7:arm
For ZSH you must run: export CPUTYPE=
universe13a% make -C stand -V .OBJDIR
[Creating objdir /scratch/tmp/kevans/obj/home/kevans/head/stand...]
/scratch/tmp/kevans/obj/home/kevans/head/stand

Using buildenv with BUILDENV_SHELL="make -C stand -V .OBDJIR"
*doesn't* reproduce it (objdir has arm.armv7 in it again).

I tried with both zsh (and export CPUTYPE=) and /bin/sh, but it seems
to reproduce both ways.

Thanks,

Kyle Evans
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359705 - head/share/mk

2020-04-07 Thread Bryan Drewery
Author: bdrewery
Date: Tue Apr  7 17:07:04 2020
New Revision: 359705
URL: https://svnweb.freebsd.org/changeset/base/359705

Log:
  NO_OBJ: Always fix .OBJDIR regardless of AUTO_OBJ.
  
  Sponsored by: Dell EMC
  MFC after:2 weeks

Modified:
  head/share/mk/bsd.init.mk
  head/share/mk/bsd.obj.mk

Modified: head/share/mk/bsd.init.mk
==
--- head/share/mk/bsd.init.mk   Tue Apr  7 17:06:33 2020(r359704)
+++ head/share/mk/bsd.init.mk   Tue Apr  7 17:07:04 2020(r359705)
@@ -11,11 +11,9 @@ :
 .include 
 .-include "local.init.mk"
 
-.if ${MK_AUTO_OBJ} == "yes"
 # This is also done in bsd.obj.mk
 .if defined(NO_OBJ) && ${.OBJDIR} != ${.CURDIR}
 .OBJDIR: ${.CURDIR}
-.endif
 .endif
 
 .if exists(${.CURDIR}/../Makefile.inc)

Modified: head/share/mk/bsd.obj.mk
==
--- head/share/mk/bsd.obj.mkTue Apr  7 17:06:33 2020(r359704)
+++ head/share/mk/bsd.obj.mkTue Apr  7 17:07:04 2020(r359705)
@@ -42,16 +42,16 @@
 :
 .include 
 
-.if ${MK_AUTO_OBJ} == "yes"
-# it is done by now
-objwarn: .PHONY
-obj: .PHONY
-CANONICALOBJDIR= ${.OBJDIR}
 # This is also done in bsd.init.mk
 .if defined(NO_OBJ) && ${.OBJDIR} != ${.CURDIR}
 # but this makefile does not want it!
 .OBJDIR: ${.CURDIR}
 .endif
+.if ${MK_AUTO_OBJ} == "yes"
+# it is done by now
+objwarn: .PHONY
+obj: .PHONY
+CANONICALOBJDIR= ${.OBJDIR}
 # Handle special case where SRCS is full-pathed and requires
 # nested objdirs.  This duplicates some auto.obj.mk logic.
 .if (!empty(SRCS:M*/*) || !empty(DPSRCS:M*/*)) && \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359704 - head/usr.sbin/bhyve

2020-04-07 Thread Aleksandr Fedorov
Author: afedorov
Date: Tue Apr  7 17:06:33 2020
New Revision: 359704
URL: https://svnweb.freebsd.org/changeset/base/359704

Log:
  Add VIRTIO_NET_F_MTU flag support for the bhyve virtio-net device.
  The flag can be enabled using the new 'mtu' option:
  bhyve -s X:Y:Z,virtio-net,[tapN|valeX:N],mtu=9000
  
  Reported by:  vmaffione, jhb
  Approved by:  vmaffione (mentor)
  Differential Revision:https://reviews.freebsd.org/D23971

Modified:
  head/usr.sbin/bhyve/net_backends.h
  head/usr.sbin/bhyve/net_utils.c
  head/usr.sbin/bhyve/net_utils.h
  head/usr.sbin/bhyve/pci_virtio_net.c

Modified: head/usr.sbin/bhyve/net_backends.h
==
--- head/usr.sbin/bhyve/net_backends.h  Tue Apr  7 17:05:05 2020
(r359703)
+++ head/usr.sbin/bhyve/net_backends.h  Tue Apr  7 17:06:33 2020
(r359704)
@@ -59,6 +59,7 @@ void  netbe_rx_enable(net_backend_t *be);
  */
 #defineVIRTIO_NET_F_CSUM   (1 <<  0) /* host handles partial cksum 
*/
 #defineVIRTIO_NET_F_GUEST_CSUM (1 <<  1) /* guest handles partial 
cksum */
+#defineVIRTIO_NET_F_MTU(1 <<  3) /* initial MTU advice */
 #defineVIRTIO_NET_F_MAC(1 <<  5) /* host supplies MAC */
 #defineVIRTIO_NET_F_GSO_DEPREC (1 <<  6) /* deprecated: host handles 
GSO */
 #defineVIRTIO_NET_F_GUEST_TSO4 (1 <<  7) /* guest can rcv TSOv4 */
@@ -76,6 +77,7 @@ void  netbe_rx_enable(net_backend_t *be);
 #defineVIRTIO_NET_F_CTRL_VLAN  (1 << 19) /* control channel VLAN 
filtering */
 #defineVIRTIO_NET_F_GUEST_ANNOUNCE \
(1 << 21) /* guest can send gratuitous pkts */
+#defineVIRTIO_NET_F_MQ (1 << 22) /* host supports multiple VQ 
pairs */
 
 /*
  * Fixed network header size

Modified: head/usr.sbin/bhyve/net_utils.c
==
--- head/usr.sbin/bhyve/net_utils.c Tue Apr  7 17:05:05 2020
(r359703)
+++ head/usr.sbin/bhyve/net_utils.c Tue Apr  7 17:06:33 2020
(r359704)
@@ -31,9 +31,12 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 
 #include "bhyverun.h"
@@ -59,6 +62,37 @@ net_parsemac(char *mac_str, uint8_t *mac_addr)
memcpy(mac_addr, ea->octet, ETHER_ADDR_LEN);
 
 return (0);
+}
+
+int
+net_parsemtu(const char *mtu_str, unsigned long *mtu)
+{
+   char *end;
+   unsigned long val;
+
+   assert(mtu_str != NULL);
+
+   if (*mtu_str == '-')
+   goto err;
+
+   val = strtoul(mtu_str, , 0);
+
+   if (*end != '\0')
+   goto err;
+
+   if (val == ULONG_MAX)
+   return (ERANGE);
+
+   if (val == 0 && errno == EINVAL)
+   return (EINVAL);
+
+   *mtu = val;
+
+   return (0);
+
+err:
+   errno = EINVAL;
+   return (EINVAL);
 }
 
 void

Modified: head/usr.sbin/bhyve/net_utils.h
==
--- head/usr.sbin/bhyve/net_utils.h Tue Apr  7 17:05:05 2020
(r359703)
+++ head/usr.sbin/bhyve/net_utils.h Tue Apr  7 17:06:33 2020
(r359704)
@@ -35,5 +35,6 @@
 
 void   net_genmac(struct pci_devinst *pi, uint8_t *macaddr);
 intnet_parsemac(char *mac_str, uint8_t *mac_addr);
+intnet_parsemtu(const char *mtu_str, unsigned long *mtu);
 
 #endif /* _NET_UTILS_H_ */

Modified: head/usr.sbin/bhyve/pci_virtio_net.c
==
--- head/usr.sbin/bhyve/pci_virtio_net.cTue Apr  7 17:05:05 2020
(r359703)
+++ head/usr.sbin/bhyve/pci_virtio_net.cTue Apr  7 17:06:33 2020
(r359704)
@@ -67,6 +67,9 @@ __FBSDID("$FreeBSD$");
 
 #define VTNET_MAX_PKT_LEN  (65536 + 64)
 
+#define VTNET_MIN_MTU  ETHERMIN
+#define VTNET_MAX_MTU  65535
+
 #define VTNET_S_HOSTCAPS  \
   ( VIRTIO_NET_F_MAC | VIRTIO_NET_F_STATUS | \
 VIRTIO_F_NOTIFY_ON_EMPTY | VIRTIO_RING_F_INDIRECT_DESC)
@@ -77,6 +80,8 @@ __FBSDID("$FreeBSD$");
 struct virtio_net_config {
uint8_t  mac[6];
uint16_t status;
+   uint16_t max_virtqueue_pairs;
+   uint16_t mtu;
 } __packed;
 
 /*
@@ -532,6 +537,8 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst *
struct pci_vtnet_softc *sc;
char tname[MAXCOMLEN + 1];
int mac_provided;
+   int mtu_provided;
+   unsigned long mtu = ETHERMTU;
 
/*
 * Allocate data structures for further virtio initializations.
@@ -557,6 +564,7 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst *
 * if specified.
 */
mac_provided = 0;
+   mtu_provided = 0;
if (opts != NULL) {
char *devname;
char *vtopts;
@@ -585,6 +593,17 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst *
if 

svn commit: r359703 - stable/11/etc/rc.d

2020-04-07 Thread Eugene Grosbein
Author: eugen
Date: Tue Apr  7 17:05:05 2020
New Revision: 359703
URL: https://svnweb.freebsd.org/changeset/base/359703

Log:
  Style fix for /etc/rc.d/ipfw: correct bad identation after r359701.

Modified:
  stable/11/etc/rc.d/ipfw

Modified: stable/11/etc/rc.d/ipfw
==
--- stable/11/etc/rc.d/ipfw Tue Apr  7 17:04:24 2020(r359702)
+++ stable/11/etc/rc.d/ipfw Tue Apr  7 17:05:05 2020(r359703)
@@ -126,18 +126,18 @@ ipfw_stop()
 
 ipfw_status()
 {
-status=$(sysctl -n net.inet.ip.fw.enable)
+   status=$(sysctl -n net.inet.ip.fw.enable)
: ${status:=0}
if afexists inet6; then
status=$((${status} + $(sysctl -i -n net.inet6.ip6.fw.enable)))
fi
if [ ${status} -eq 0 ]; then
-   echo "ipfw is not enabled"
-   exit 1
-else
-   echo "ipfw is enabled"
-   exit 0
-fi
+   echo "ipfw is not enabled"
+   exit 1
+   else
+   echo "ipfw is enabled"
+   exit 0
+   fi
 }
 
 load_rc_config $name
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359702 - in head: share/mk sys/conf

2020-04-07 Thread Kyle Evans
Author: kevans
Date: Tue Apr  7 17:04:24 2020
New Revision: 359702
URL: https://svnweb.freebsd.org/changeset/base/359702

Log:
  Add -fno-common to all userland/kernel src builds
  
  -fno-common will become the default in GCC10/LLVM11. Plenty of work has been
  put in to make sure our world builds are no -fno-common clean, so let's slap
  the build with this until it becomes the compiler default to ensure we don't
  regress.
  
  At this time, we will not be enforcing -fno-common on ports builds. I
  suspect most ports will be or quickly become -fno-common clean as they're
  naturally built against compilers that default to it, so this will hopefully
  become a non-issue in due time. The exception to this, which is actually the
  status quo, is that kmods built from ports will continue to build with
  -fno-common.
  
  As of the time of writing, I intend to also make stable/12 -fno-common
  clean. What's been done will be MFC'd to stable/11 if it's easily applicable
  and/or not much work to massage it into being functional, but I anticipate
  adding -fcommon to stable/11 builds to maintain its ability to be built with
  newer compilers for the rest of its lifetime instead of putting in a third
  branch's worth of effort.

Modified:
  head/share/mk/src.sys.mk
  head/sys/conf/kern.pre.mk
  head/sys/conf/kmod.mk

Modified: head/share/mk/src.sys.mk
==
--- head/share/mk/src.sys.mkTue Apr  7 16:57:23 2020(r359701)
+++ head/share/mk/src.sys.mkTue Apr  7 17:04:24 2020(r359702)
@@ -34,6 +34,11 @@ __postrcconf_${var}:=${MK_${var}:U-}${WITHOUT_${var}:
 .endif # SRCCONF
 .endif
 
+# The following should be removed no earlier than LLVM11 being imported into 
the
+# tree, to ensure we don't regress the build.  LLVM11 and GCC10 will switch the
+# default over to -fno-common, making this redundant.
+CFLAGS+=   -fno-common
+
 # tempting, but bsd.compiler.mk causes problems this early
 # probably need to remove dependence on bsd.own.mk 
 #.include "src.opts.mk"

Modified: head/sys/conf/kern.pre.mk
==
--- head/sys/conf/kern.pre.mk   Tue Apr  7 16:57:23 2020(r359701)
+++ head/sys/conf/kern.pre.mk   Tue Apr  7 17:04:24 2020(r359702)
@@ -86,7 +86,7 @@ CFLAGS_PARAM_LARGE_FUNCTION_GROWTH?=1000
 .if ${MACHINE_CPUARCH} == "mips"
 CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000 
-DMACHINE_ARCH='"${MACHINE_ARCH}"'
 .endif
-CFLAGS.gcc+= -fno-common -fms-extensions -finline-limit=${INLINE_LIMIT}
+CFLAGS.gcc+= -fms-extensions -finline-limit=${INLINE_LIMIT}
 CFLAGS.gcc+= --param inline-unit-growth=${CFLAGS_PARAM_INLINE_UNIT_GROWTH}
 CFLAGS.gcc+= --param 
large-function-growth=${CFLAGS_PARAM_LARGE_FUNCTION_GROWTH}
 CFLAGS.gcc+= -fms-extensions
@@ -98,6 +98,10 @@ WERROR?= -Wno-error
 .else
 WERROR?=   -Werror
 .endif
+# The following should be removed no earlier than LLVM11 being imported into 
the
+# tree, to ensure we don't regress the build.  LLVM11 and GCC10 will switch the
+# default over to -fno-common, making this redundant.
+CFLAGS+=   -fno-common
 
 # XXX LOCORE means "don't declare C stuff" not "for locore.s".
 ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} 
${ASM_CFLAGS.${.IMPSRC:T}} 

Modified: head/sys/conf/kmod.mk
==
--- head/sys/conf/kmod.mk   Tue Apr  7 16:57:23 2020(r359701)
+++ head/sys/conf/kmod.mk   Tue Apr  7 17:04:24 2020(r359702)
@@ -133,6 +133,13 @@ CFLAGS.gcc+= --param large-function-growth=1000
 
 # Disallow common variables, and if we end up with commons from
 # somewhere unexpected, allocate storage for them in the module itself.
+#
+# -fno-common is the default for src builds, but this should be left in place
+# until at least we catch up to GCC10/LLVM11 or otherwise enable -fno-common
+# in  instead.  For now, we will have duplicate -fno-common in
+# CFLAGS for in-tree module builds as they will also pick it up from
+# share/mk/src.sys.mk, but the following is important for out-of-tree modules
+# (e.g. ports).
 CFLAGS+=   -fno-common
 LDFLAGS+=  -d -warn-common
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359701 - stable/11/etc/rc.d

2020-04-07 Thread Eugene Grosbein
Author: eugen
Date: Tue Apr  7 16:57:23 2020
New Revision: 359701
URL: https://svnweb.freebsd.org/changeset/base/359701

Log:
  MFC r356943,356944: Correct "service ipfw status" for INET6-only systems.

Modified:
  stable/11/etc/rc.d/ipfw
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/etc/rc.d/ipfw
==
--- stable/11/etc/rc.d/ipfw Tue Apr  7 16:56:34 2020(r359700)
+++ stable/11/etc/rc.d/ipfw Tue Apr  7 16:57:23 2020(r359701)
@@ -127,7 +127,11 @@ ipfw_stop()
 ipfw_status()
 {
 status=$(sysctl -n net.inet.ip.fw.enable)
-if [ ${status} -eq 0 ]; then
+   : ${status:=0}
+   if afexists inet6; then
+   status=$((${status} + $(sysctl -i -n net.inet6.ip6.fw.enable)))
+   fi
+   if [ ${status} -eq 0 ]; then
echo "ipfw is not enabled"
exit 1
 else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359700 - in head: lib/libsecureboot stand/libsa

2020-04-07 Thread Simon J. Gerraty
Author: sjg
Date: Tue Apr  7 16:56:34 2020
New Revision: 359700
URL: https://svnweb.freebsd.org/changeset/base/359700

Log:
  Improve interaction of vectx and tftp
  
  On slow platforms, it helps to spread the hashing load
  over time so that tftp does not timeout.
  
  Also, some .4th files are too big to fit in cache of pkgfs,
  so increase cache size and ensure fully populated.
  
  Reviewed by:  stevek
  MFC after:1 week
  Differential Revision: https://reviews.freebsd.org/D24287

Modified:
  head/lib/libsecureboot/vectx.c
  head/stand/libsa/pkgfs.c
  head/stand/libsa/tftp.c

Modified: head/lib/libsecureboot/vectx.c
==
--- head/lib/libsecureboot/vectx.c  Tue Apr  7 16:52:45 2020
(r359699)
+++ head/lib/libsecureboot/vectx.c  Tue Apr  7 16:56:34 2020
(r359700)
@@ -211,6 +211,7 @@ ssize_t
 vectx_read(struct vectx *ctx, void *buf, size_t nbytes)
 {
unsigned char *bp = buf;
+   int d;
int n;
int delta;
int x;
@@ -221,23 +222,30 @@ vectx_read(struct vectx *ctx, void *buf, size_t nbytes
 
off = 0;
do {
-   n = read(ctx->vec_fd, [off], nbytes - off);
-   if (n < 0)
+   /*
+* Do this in reasonable chunks so
+* we don't timeout if doing tftp
+*/
+   x = nbytes - off;
+   x = MIN(PAGE_SIZE, x);
+   d = n = read(ctx->vec_fd, [off], x);
+   if (n < 0) {
return (n);
-   if (n > 0) {
+   }
+   if (d > 0) {
/* we may have seeked backwards! */
delta = ctx->vec_hashed - ctx->vec_off;
if (delta > 0) {
-   x = MIN(delta, n);
+   x = MIN(delta, d);
off += x;
-   n -= x;
+   d -= x;
ctx->vec_off += x;
}
-   if (n > 0) {
-   ctx->vec_md->update(>vec_ctx.vtable, 
[off], n);
-   off += n;
-   ctx->vec_off += n;
-   ctx->vec_hashed += n;
+   if (d > 0) {
+   ctx->vec_md->update(>vec_ctx.vtable, 
[off], d);
+   off += d;
+   ctx->vec_off += d;
+   ctx->vec_hashed += d;
}
}
} while (n > 0 && off < nbytes);

Modified: head/stand/libsa/pkgfs.c
==
--- head/stand/libsa/pkgfs.cTue Apr  7 16:52:45 2020(r359699)
+++ head/stand/libsa/pkgfs.cTue Apr  7 16:56:34 2020(r359700)
@@ -60,7 +60,7 @@ struct fs_ops pkgfs_fsops = {
 };
 
 #define PKG_BUFSIZE512
-#definePKG_MAXCACHESZ  16384
+#definePKG_MAXCACHESZ  (16384 * 3)
 
 #definePKG_FILEEXT ".tgz"
 
@@ -132,6 +132,7 @@ struct package
 static struct package *package = NULL;
 
 static int new_package(int, struct package **);
+static int cache_data(struct tarfile *tf, int);
 
 void
 pkgfs_cleanup(void)
@@ -282,6 +283,9 @@ pkg_read(struct open_file *f, void *buf, size_t size, 
return (EBADF);
}
 
+   if (tf->tf_cachesz == 0)
+   cache_data(tf, 1);
+
fp = tf->tf_fp;
p = buf;
sz = 0;
@@ -311,16 +315,6 @@ pkg_read(struct open_file *f, void *buf, size_t size, 
fp += sz;
p += sz;
size -= sz;
-
-   if (tf->tf_cachesz != 0)
-   continue;
-
-   tf->tf_cachesz = (sz <= PKG_MAXCACHESZ) ? sz : PKG_MAXCACHESZ;
-   tf->tf_cache = malloc(tf->tf_cachesz);
-   if (tf->tf_cache != NULL)
-   memcpy(tf->tf_cache, buf, tf->tf_cachesz);
-   else
-   tf->tf_cachesz = 0;
}
 
tf->tf_fp = fp;
@@ -484,8 +478,20 @@ get_zipped(struct package *pkg, void *buf, size_t bufs
return (0);
 }
 
+/**
+ * @brief
+ * cache data of a tarfile
+ *
+ * @param[in] tf
+ * tarfile pointer
+ *
+ * @param[in] force
+ * If file size > PKG_MAXCACHESZ, cache that much
+ *
+ * @return 0, -1 (errno set to error value)
+ */
 static int
-cache_data(struct tarfile *tf)
+cache_data(struct tarfile *tf, int force)
 {
struct package *pkg;
size_t sz;
@@ -503,21 +509,28 @@ cache_data(struct tarfile *tf)
return (-1);
}
 
+   if (tf->tf_cachesz > 0) {
+   DBG(("%s: data already cached\n", __func__));
+   errno = EINVAL;
+   return (-1);
+   }
+
if (tf->tf_ofs != 

svn commit: r359699 - stable/12/libexec/rc/rc.d

2020-04-07 Thread Eugene Grosbein
Author: eugen
Date: Tue Apr  7 16:52:45 2020
New Revision: 359699
URL: https://svnweb.freebsd.org/changeset/base/359699

Log:
  MFC r356943,356944: Correct "service ipfw status" for INET6-only systems.

Modified:
  stable/12/libexec/rc/rc.d/ipfw
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/libexec/rc/rc.d/ipfw
==
--- stable/12/libexec/rc/rc.d/ipfw  Tue Apr  7 16:47:35 2020
(r359698)
+++ stable/12/libexec/rc/rc.d/ipfw  Tue Apr  7 16:52:45 2020
(r359699)
@@ -127,7 +127,11 @@ ipfw_stop()
 ipfw_status()
 {
status=$(sysctl -i -n net.inet.ip.fw.enable)
-   if [ ${status:-0} -eq 0 ]; then
+   : ${status:=0}
+   if afexists inet6; then
+   status=$((${status} + $(sysctl -i -n net.inet6.ip6.fw.enable)))
+   fi
+   if [ ${status} -eq 0 ]; then
echo "ipfw is not enabled"
exit 1
else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359698 - in stable/11: share/man/man4 sys/netgraph

2020-04-07 Thread Eugene Grosbein
Author: eugen
Date: Tue Apr  7 16:47:35 2020
New Revision: 359698
URL: https://svnweb.freebsd.org/changeset/base/359698

Log:
  MFC r342168,357786: Allow ng_nat to be attached to a ethernet interface
  
  Allow ng_nat to be attached to a ethernet interface directly via ng_ether(4)
  or the likes. Add new control message types: setdlt and getdlt to switch
  from default DLT_RAW (no encapsulation) to DLT_EN10MB (ethernet).
  
  Submitted by: sobomax
  Reviewed by:  glebius
  Differential Revision:https://reviews.freebsd.org/D18535
  Relnotes: yes

Modified:
  stable/11/share/man/man4/ng_nat.4
  stable/11/sys/netgraph/ng_nat.c
  stable/11/sys/netgraph/ng_nat.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/ng_nat.4
==
--- stable/11/share/man/man4/ng_nat.4   Tue Apr  7 16:44:14 2020
(r359697)
+++ stable/11/share/man/man4/ng_nat.4   Tue Apr  7 16:47:35 2020
(r359698)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 21, 2013
+.Dd December 12, 2018
 .Dt NG_NAT 4
 .Os
 .Sh NAME
@@ -264,6 +264,38 @@ from its
 .Xr libalias
 instance, the corresponding field is returned as
 .Va UINT32_MAX .
+.It Dv NGM_NAT_SET_DLT Pq Ic setdlt
+Sets the data link type on the
+.Va in
+and
+.Va out
+hooks.
+Currently, supported types are
+.Cm DLT_RAW
+(raw IP datagrams , no offset applied, the default) and
+.Cm DLT_EN10MB
+(Ethernet). DLT_ definitions can be found in
+.In net/bpf.h .
+If you want to work on the
+.Xr ipfw 8
+level you must use no additional offset by specifying
+.Cm DLT_RAW .
+If, however, you attach
+.Nm
+to a network interface directly and
+.Cm EN10MB
+is specified, then the extra offset will be applied to take into account
+link-level header.
+In this mode the
+.Nm
+would also inspect appropriate type field in the Ethernet header and
+pass-through any datagrams that are not IP packets.
+.It Dv NGM_NAT_GET_DLT Pq Ic getdlt
+This control message returns the current data link type of the
+.Va in
+and
+.Va out
+hooks.
 .El
 .Pp
 In all redirection messages
@@ -336,11 +368,31 @@ serial line with HDLC encapsulation.
 SEQ
 ifconfig ng0 x.y.8.35 x.y.8.1
 .Ed
+.Pp
+The
+.Nm
+node can also be attached directly to the physical interface
+via
+.Xr ng_ether 4
+node in the graph.
+In the following example, we perform masquerading on a
+Ethernet interface connected to a public network.
+.Bd -literal -offset indent
+ifconfig igb0 inet x.y.8.35 netmask 0xf000
+route add default x.y.0.1
+/usr/sbin/ngctl -f- <<-SEQ
+mkpeer igb0: nat lower in
+name igb0:lower igb0_NAT
+connect igb0: igb0_NAT: upper out
+msg igb0_NAT: setdlt 1
+msg igb0_NAT: setaliasaddr x.y.8.35
+SEQ
 .Sh SEE ALSO
 .Xr libalias 3 ,
 .Xr ng_ipfw 4 ,
 .Xr natd 8 ,
-.Xr ngctl 8
+.Xr ngctl 8 ,
+.Xr ng_ether 8
 .Sh HISTORY
 The
 .Nm

Modified: stable/11/sys/netgraph/ng_nat.c
==
--- stable/11/sys/netgraph/ng_nat.c Tue Apr  7 16:44:14 2020
(r359697)
+++ stable/11/sys/netgraph/ng_nat.c Tue Apr  7 16:47:35 2020
(r359698)
@@ -42,6 +42,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 
@@ -239,6 +242,20 @@ static const struct ng_cmdlist ng_nat_cmdlist[] = {
  NULL,
  _nat_libalias_info_type
},
+   {
+ NGM_NAT_COOKIE,
+ NGM_NAT_SET_DLT,
+ "setdlt",
+ _parse_uint8_type,
+ NULL
+   },
+   {
+ NGM_NAT_COOKIE,
+ NGM_NAT_GET_DLT,
+ "getdlt",
+ NULL,
+ _parse_uint8_type
+   },
{ 0 }
 };
 
@@ -275,6 +292,7 @@ struct ng_nat_priv {
uint32_trdrcount;   /* number or redirects in list */
uint32_tnextid; /* for next in turn in list */
struct rdrhead  redirhead;  /* redirect list header */
+   uint8_t dlt;/* DLT_XXX from bpf.h */
 };
 typedef struct ng_nat_priv *priv_p;
 
@@ -300,6 +318,7 @@ ng_nat_constructor(node_p node)
/* Init redirects housekeeping. */
priv->rdrcount = 0;
priv->nextid = 1;
+   priv->dlt = DLT_RAW;
STAILQ_INIT(>redirhead);
 
/* Link structs together. */
@@ -692,11 +711,34 @@ ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthoo
 #undef COPY
}
break;
+   case NGM_NAT_SET_DLT:
+   if (msg->header.arglen != sizeof(uint8_t)) {
+   error = EINVAL;
+   break;
+   }
+   switch (*(uint8_t *) msg->data) {
+   case DLT_EN10MB:
+   case DLT_RAW:
+   priv->dlt = *(uint8_t *) msg->data;
+   break;
+   default:
+   

svn commit: r359697 - in stable/12: share/man/man4 sys/netgraph

2020-04-07 Thread Eugene Grosbein
Author: eugen
Date: Tue Apr  7 16:44:14 2020
New Revision: 359697
URL: https://svnweb.freebsd.org/changeset/base/359697

Log:
  MFC r342168,357786: Allow ng_nat to be attached to a ethernet interface
  
  Allow ng_nat to be attached to a ethernet interface directly via ng_ether(4)
  or the likes. Add new control message types: setdlt and getdlt to switch
  from default DLT_RAW (no encapsulation) to DLT_EN10MB (ethernet).
  
  Submitted by: sobomax
  Reviewed by:  glebius
  Differential Revision:https://reviews.freebsd.org/D18535
  Relnotes: yes

Modified:
  stable/12/share/man/man4/ng_nat.4
  stable/12/sys/netgraph/ng_nat.c
  stable/12/sys/netgraph/ng_nat.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/ng_nat.4
==
--- stable/12/share/man/man4/ng_nat.4   Tue Apr  7 16:40:41 2020
(r359696)
+++ stable/12/share/man/man4/ng_nat.4   Tue Apr  7 16:44:14 2020
(r359697)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 21, 2013
+.Dd December 12, 2018
 .Dt NG_NAT 4
 .Os
 .Sh NAME
@@ -264,6 +264,38 @@ from its
 .Xr libalias
 instance, the corresponding field is returned as
 .Va UINT32_MAX .
+.It Dv NGM_NAT_SET_DLT Pq Ic setdlt
+Sets the data link type on the
+.Va in
+and
+.Va out
+hooks.
+Currently, supported types are
+.Cm DLT_RAW
+(raw IP datagrams , no offset applied, the default) and
+.Cm DLT_EN10MB
+(Ethernet). DLT_ definitions can be found in
+.In net/bpf.h .
+If you want to work on the
+.Xr ipfw 8
+level you must use no additional offset by specifying
+.Cm DLT_RAW .
+If, however, you attach
+.Nm
+to a network interface directly and
+.Cm EN10MB
+is specified, then the extra offset will be applied to take into account
+link-level header.
+In this mode the
+.Nm
+would also inspect appropriate type field in the Ethernet header and
+pass-through any datagrams that are not IP packets.
+.It Dv NGM_NAT_GET_DLT Pq Ic getdlt
+This control message returns the current data link type of the
+.Va in
+and
+.Va out
+hooks.
 .El
 .Pp
 In all redirection messages
@@ -336,11 +368,31 @@ serial line with HDLC encapsulation.
 SEQ
 ifconfig ng0 x.y.8.35 x.y.8.1
 .Ed
+.Pp
+The
+.Nm
+node can also be attached directly to the physical interface
+via
+.Xr ng_ether 4
+node in the graph.
+In the following example, we perform masquerading on a
+Ethernet interface connected to a public network.
+.Bd -literal -offset indent
+ifconfig igb0 inet x.y.8.35 netmask 0xf000
+route add default x.y.0.1
+/usr/sbin/ngctl -f- <<-SEQ
+mkpeer igb0: nat lower in
+name igb0:lower igb0_NAT
+connect igb0: igb0_NAT: upper out
+msg igb0_NAT: setdlt 1
+msg igb0_NAT: setaliasaddr x.y.8.35
+SEQ
 .Sh SEE ALSO
 .Xr libalias 3 ,
 .Xr ng_ipfw 4 ,
 .Xr natd 8 ,
-.Xr ngctl 8
+.Xr ngctl 8 ,
+.Xr ng_ether 8
 .Sh HISTORY
 The
 .Nm

Modified: stable/12/sys/netgraph/ng_nat.c
==
--- stable/12/sys/netgraph/ng_nat.c Tue Apr  7 16:40:41 2020
(r359696)
+++ stable/12/sys/netgraph/ng_nat.c Tue Apr  7 16:44:14 2020
(r359697)
@@ -44,6 +44,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 
@@ -241,6 +244,20 @@ static const struct ng_cmdlist ng_nat_cmdlist[] = {
  NULL,
  _nat_libalias_info_type
},
+   {
+ NGM_NAT_COOKIE,
+ NGM_NAT_SET_DLT,
+ "setdlt",
+ _parse_uint8_type,
+ NULL
+   },
+   {
+ NGM_NAT_COOKIE,
+ NGM_NAT_GET_DLT,
+ "getdlt",
+ NULL,
+ _parse_uint8_type
+   },
{ 0 }
 };
 
@@ -277,6 +294,7 @@ struct ng_nat_priv {
uint32_trdrcount;   /* number or redirects in list */
uint32_tnextid; /* for next in turn in list */
struct rdrhead  redirhead;  /* redirect list header */
+   uint8_t dlt;/* DLT_XXX from bpf.h */
 };
 typedef struct ng_nat_priv *priv_p;
 
@@ -302,6 +320,7 @@ ng_nat_constructor(node_p node)
/* Init redirects housekeeping. */
priv->rdrcount = 0;
priv->nextid = 1;
+   priv->dlt = DLT_RAW;
STAILQ_INIT(>redirhead);
 
/* Link structs together. */
@@ -694,11 +713,34 @@ ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthoo
 #undef COPY
}
break;
+   case NGM_NAT_SET_DLT:
+   if (msg->header.arglen != sizeof(uint8_t)) {
+   error = EINVAL;
+   break;
+   }
+   switch (*(uint8_t *) msg->data) {
+   case DLT_EN10MB:
+   case DLT_RAW:
+   priv->dlt = *(uint8_t *) msg->data;
+   break;
+   default:
+   

svn commit: r359696 - in head/lib/libcasper/services: cap_dns cap_fileargs cap_grp cap_pwd cap_sysctl cap_syslog

2020-04-07 Thread Conrad Meyer
Author: cem
Date: Tue Apr  7 16:40:41 2020
New Revision: 359696
URL: https://svnweb.freebsd.org/changeset/base/359696

Log:
  libcasper(3): Export functions to C++
  
  We must wrap C declarations in __BEGIN / __END_DECLS to avoid C++ 
name-mangling
  of the declaration when including the C header; name-mangling causes the 
linker
  to attempt to locate the wrong (C++ ABI) symbol name.
  
  Reviewed by:  markj, oshogbo (earlier version both)
  Differential Revision:https://reviews.freebsd.org/D24323

Modified:
  head/lib/libcasper/services/cap_dns/cap_dns.h
  head/lib/libcasper/services/cap_fileargs/cap_fileargs.h
  head/lib/libcasper/services/cap_grp/cap_grp.h
  head/lib/libcasper/services/cap_pwd/cap_pwd.h
  head/lib/libcasper/services/cap_sysctl/cap_sysctl.h
  head/lib/libcasper/services/cap_syslog/cap_syslog.h

Modified: head/lib/libcasper/services/cap_dns/cap_dns.h
==
--- head/lib/libcasper/services/cap_dns/cap_dns.h   Tue Apr  7 16:29:11 
2020(r359695)
+++ head/lib/libcasper/services/cap_dns/cap_dns.h   Tue Apr  7 16:40:41 
2020(r359696)
@@ -36,12 +36,15 @@
 #define WITH_CASPER
 #endif
 
+#include 
 #include /* socklen_t */
 
 struct addrinfo;
 struct hostent;
 
 #ifdef WITH_CASPER
+__BEGIN_DECLS
+
 struct hostent *cap_gethostbyname(cap_channel_t *chan, const char *name);
 struct hostent *cap_gethostbyname2(cap_channel_t *chan, const char *name,
 int type);
@@ -58,6 +61,8 @@ int cap_dns_type_limit(cap_channel_t *chan, const char
 size_t ntypes);
 int cap_dns_family_limit(cap_channel_t *chan, const int *families,
 size_t nfamilies);
+
+__END_DECLS
 #else
 #definecap_gethostbyname(chan, name)gethostbyname(name)
 #define cap_gethostbyname2(chan, name, type)gethostbyname2(name, type)

Modified: head/lib/libcasper/services/cap_fileargs/cap_fileargs.h
==
--- head/lib/libcasper/services/cap_fileargs/cap_fileargs.h Tue Apr  7 
16:29:11 2020(r359695)
+++ head/lib/libcasper/services/cap_fileargs/cap_fileargs.h Tue Apr  7 
16:40:41 2020(r359696)
@@ -31,6 +31,7 @@
 #ifndef _FILEARGS_H_
 #define_FILEARGS_H_
 
+#include 
 #include 
 #include 
 
@@ -44,6 +45,8 @@ struct fileargs;
 typedef struct fileargs fileargs_t;
 struct stat;
 
+__BEGIN_DECLS
+
 fileargs_t *fileargs_init(int argc, char *argv[], int flags, mode_t mode,
 cap_rights_t *rightsp, int operations);
 fileargs_t *fileargs_cinit(cap_channel_t *cas, int argc, char *argv[],
@@ -57,6 +60,9 @@ FILE *fileargs_fopen(fileargs_t *fa, const char *name,
 
 fileargs_t *fileargs_wrap(cap_channel_t *chan, int fdflags);
 cap_channel_t *fileargs_unwrap(fileargs_t *fa, int *fdflags);
+
+__END_DECLS
+
 #else
 typedef struct fileargs {
int fa_flags;

Modified: head/lib/libcasper/services/cap_grp/cap_grp.h
==
--- head/lib/libcasper/services/cap_grp/cap_grp.h   Tue Apr  7 16:29:11 
2020(r359695)
+++ head/lib/libcasper/services/cap_grp/cap_grp.h   Tue Apr  7 16:40:41 
2020(r359696)
@@ -36,7 +36,11 @@
 #define WITH_CASPER
 #endif
 
+#include 
+
 #ifdef WITH_CASPER
+__BEGIN_DECLS
+
 struct group *cap_getgrent(cap_channel_t *chan);
 struct group *cap_getgrnam(cap_channel_t *chan, const char *name);
 struct group *cap_getgrgid(cap_channel_t *chan, gid_t gid);
@@ -58,6 +62,9 @@ int cap_grp_limit_fields(cap_channel_t *chan, const ch
 size_t nfields);
 int cap_grp_limit_groups(cap_channel_t *chan, const char * const *names,
 size_t nnames, const gid_t *gids, size_t ngids);
+
+__END_DECLS
+
 #else
 #definecap_getgrent(chan)  getgrent()
 #definecap_getgrnam(chan, name)getgrnam(name)

Modified: head/lib/libcasper/services/cap_pwd/cap_pwd.h
==
--- head/lib/libcasper/services/cap_pwd/cap_pwd.h   Tue Apr  7 16:29:11 
2020(r359695)
+++ head/lib/libcasper/services/cap_pwd/cap_pwd.h   Tue Apr  7 16:40:41 
2020(r359696)
@@ -36,7 +36,11 @@
 #define WITH_CASPER
 #endif
 
+#include 
+
 #ifdef WITH_CASPER
+__BEGIN_DECLS
+
 struct passwd *cap_getpwent(cap_channel_t *chan);
 struct passwd *cap_getpwnam(cap_channel_t *chan, const char *login);
 struct passwd *cap_getpwuid(cap_channel_t *chan, uid_t uid);
@@ -58,6 +62,9 @@ int cap_pwd_limit_fields(cap_channel_t *chan, const ch
 size_t nfields);
 int cap_pwd_limit_users(cap_channel_t *chan, const char * const *names,
 size_t nnames, uid_t *uids, size_t nuids);
+
+__END_DECLS
+
 #else
 #definecap_getpwent(chan)  getpwent()
 #definecap_getpwnam(chan, login)   getpwnam(login)

Modified: head/lib/libcasper/services/cap_sysctl/cap_sysctl.h

svn commit: r359695 - in stable/11: sbin/ipfw sys/netinet/libalias

2020-04-07 Thread Eugene Grosbein
Author: eugen
Date: Tue Apr  7 16:29:11 2020
New Revision: 359695
URL: https://svnweb.freebsd.org/changeset/base/359695

Log:
  MFC r357092,357787: Add support for RFC 6598/Carrier Grade NAT subnets
  to libalias and ipfw.
  
  In libalias, a new flag PKT_ALIAS_UNREGISTERED_RFC6598 is added.
  This is like PKT_ALIAS_UNREGISTERED_ONLY, but also is RFC 6598 aware.
  Also, we add a new NAT option to ipfw called unreg_cgn, which is like
  unreg_only, but also is RFC 6598-aware.  The reason for the new
  flags/options is to avoid breaking existing networks, especially those
  which rely on RFC 6598 as an external address.
  
  Submitted by: Neel Chauhan 
  Reviewed by:  melifaro, rgrimes, Lutz Donnerhacke
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D22877
  Differential Revision:https://reviews.freebsd.org/D23448

Modified:
  stable/11/sbin/ipfw/ipfw.8
  stable/11/sbin/ipfw/ipfw2.h
  stable/11/sbin/ipfw/main.c
  stable/11/sbin/ipfw/nat.c
  stable/11/sys/netinet/libalias/alias.c
  stable/11/sys/netinet/libalias/alias.h
  stable/11/sys/netinet/libalias/libalias.3
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/ipfw/ipfw.8
==
--- stable/11/sbin/ipfw/ipfw.8  Tue Apr  7 16:27:58 2020(r359694)
+++ stable/11/sbin/ipfw/ipfw.8  Tue Apr  7 16:29:11 2020(r359695)
@@ -3228,8 +3228,11 @@ Deny any incoming connection from outside world.
 Try to leave the alias port numbers unchanged from
 the actual local port numbers.
 .It Cm unreg_only
-Traffic on the local network not originating from an
+Traffic on the local network not originating from a RFC 1918
 unregistered address spaces will be ignored.
+.It Cm unreg_cgn
+Like unreg_only, but includes the RFC 6598 (Carrier Grade NAT)
+address range.
 .It Cm reset
 Reset table of the packet aliasing engine on address change.
 .It Cm reverse

Modified: stable/11/sbin/ipfw/ipfw2.h
==
--- stable/11/sbin/ipfw/ipfw2.h Tue Apr  7 16:27:58 2020(r359694)
+++ stable/11/sbin/ipfw/ipfw2.h Tue Apr  7 16:29:11 2020(r359695)
@@ -220,6 +220,7 @@ enum tokens {
TOK_DENY_INC,
TOK_SAME_PORTS,
TOK_UNREG_ONLY,
+   TOK_UNREG_CGN,
TOK_SKIP_GLOBAL,
TOK_RESET_ADDR,
TOK_ALIAS_REV,

Modified: stable/11/sbin/ipfw/main.c
==
--- stable/11/sbin/ipfw/main.c  Tue Apr  7 16:27:58 2020(r359694)
+++ stable/11/sbin/ipfw/main.c  Tue Apr  7 16:29:11 2020(r359695)
@@ -43,8 +43,8 @@ help(void)
 "add [num] [set N] [prob x] RULE-BODY\n"
 "{pipe|queue} N config PIPE-BODY\n"
 "[pipe|queue] {zero|delete|show} [N{,N}]\n"
-"nat N config {ip IPADDR|if IFNAME|log|deny_in|same_ports|unreg_only|reset|\n"
-"  reverse|proxy_only|redirect_addr linkspec|\n"
+"nat N config {ip IPADDR|if 
IFNAME|log|deny_in|same_ports|unreg_only|unreg_cgn|\n"
+"  reset|reverse|proxy_only|redirect_addr linkspec|\n"
 "  redirect_port linkspec|redirect_proto linkspec}\n"
 "set [disable N... enable N...] | move [rule] X to Y | swap X Y | show\n"
 "set N {show|list|zero|resetlog|delete} [N{,N}] | flush\n"

Modified: stable/11/sbin/ipfw/nat.c
==
--- stable/11/sbin/ipfw/nat.c   Tue Apr  7 16:27:58 2020(r359694)
+++ stable/11/sbin/ipfw/nat.c   Tue Apr  7 16:29:11 2020(r359695)
@@ -60,6 +60,7 @@ static struct _s_x nat_params[] = {
{ "deny_in",TOK_DENY_INC },
{ "same_ports", TOK_SAME_PORTS },
{ "unreg_only", TOK_UNREG_ONLY },
+   { "unreg_cgn",  TOK_UNREG_CGN },
{ "skip_global",TOK_SKIP_GLOBAL },
{ "reset",  TOK_RESET_ADDR },
{ "reverse",TOK_ALIAS_REV },
@@ -663,6 +664,9 @@ nat_show_cfg(struct nat44_cfg_nat *n, void *arg)
} else if (n->mode & PKT_ALIAS_UNREGISTERED_ONLY) {
printf(" unreg_only");
n->mode &= ~PKT_ALIAS_UNREGISTERED_ONLY;
+   } else if (n->mode & PKT_ALIAS_UNREGISTERED_CGN) {
+   printf(" unreg_cgn");
+   n->mode &= ~PKT_ALIAS_UNREGISTERED_CGN;
} else if (n->mode & PKT_ALIAS_RESET_ON_ADDR_CHANGE) {
printf(" reset");
n->mode &= ~PKT_ALIAS_RESET_ON_ADDR_CHANGE;
@@ -789,6 +793,7 @@ ipfw_config_nat(int ac, char **av)
case TOK_SAME_PORTS:
case TOK_SKIP_GLOBAL:
case TOK_UNREG_ONLY:
+   case TOK_UNREG_CGN:
case TOK_RESET_ADDR:
case TOK_ALIAS_REV:
case TOK_PROXY_ONLY:
@@ -882,6 +887,9 @@ ipfw_config_nat(int ac, char **av)
 

svn commit: r359694 - in stable/12: sbin/ipfw sys/netinet/libalias

2020-04-07 Thread Eugene Grosbein
Author: eugen
Date: Tue Apr  7 16:27:58 2020
New Revision: 359694
URL: https://svnweb.freebsd.org/changeset/base/359694

Log:
  MFC r357092,357787: Add support for RFC 6598/Carrier Grade NAT subnets
  to libalias and ipfw.
  
  In libalias, a new flag PKT_ALIAS_UNREGISTERED_RFC6598 is added.
  This is like PKT_ALIAS_UNREGISTERED_ONLY, but also is RFC 6598 aware.
  Also, we add a new NAT option to ipfw called unreg_cgn, which is like
  unreg_only, but also is RFC 6598-aware.  The reason for the new
  flags/options is to avoid breaking existing networks, especially those
  which rely on RFC 6598 as an external address.
  
  Submitted by: Neel Chauhan 
  Reviewed by:  melifaro, rgrimes, Lutz Donnerhacke
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D22877
  Differential Revision:https://reviews.freebsd.org/D23448

Modified:
  stable/12/sbin/ipfw/ipfw.8
  stable/12/sbin/ipfw/ipfw2.h
  stable/12/sbin/ipfw/main.c
  stable/12/sbin/ipfw/nat.c
  stable/12/sys/netinet/libalias/alias.c
  stable/12/sys/netinet/libalias/alias.h
  stable/12/sys/netinet/libalias/libalias.3
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ipfw/ipfw.8
==
--- stable/12/sbin/ipfw/ipfw.8  Tue Apr  7 16:15:53 2020(r359693)
+++ stable/12/sbin/ipfw/ipfw.8  Tue Apr  7 16:27:58 2020(r359694)
@@ -3233,8 +3233,11 @@ Deny any incoming connection from outside world.
 Try to leave the alias port numbers unchanged from
 the actual local port numbers.
 .It Cm unreg_only
-Traffic on the local network not originating from an
+Traffic on the local network not originating from a RFC 1918
 unregistered address spaces will be ignored.
+.It Cm unreg_cgn
+Like unreg_only, but includes the RFC 6598 (Carrier Grade NAT)
+address range.
 .It Cm reset
 Reset table of the packet aliasing engine on address change.
 .It Cm reverse

Modified: stable/12/sbin/ipfw/ipfw2.h
==
--- stable/12/sbin/ipfw/ipfw2.h Tue Apr  7 16:15:53 2020(r359693)
+++ stable/12/sbin/ipfw/ipfw2.h Tue Apr  7 16:27:58 2020(r359694)
@@ -220,6 +220,7 @@ enum tokens {
TOK_DENY_INC,
TOK_SAME_PORTS,
TOK_UNREG_ONLY,
+   TOK_UNREG_CGN,
TOK_SKIP_GLOBAL,
TOK_RESET_ADDR,
TOK_ALIAS_REV,

Modified: stable/12/sbin/ipfw/main.c
==
--- stable/12/sbin/ipfw/main.c  Tue Apr  7 16:15:53 2020(r359693)
+++ stable/12/sbin/ipfw/main.c  Tue Apr  7 16:27:58 2020(r359694)
@@ -43,8 +43,8 @@ help(void)
 "add [num] [set N] [prob x] RULE-BODY\n"
 "{pipe|queue} N config PIPE-BODY\n"
 "[pipe|queue] {zero|delete|show} [N{,N}]\n"
-"nat N config {ip IPADDR|if IFNAME|log|deny_in|same_ports|unreg_only|reset|\n"
-"  reverse|proxy_only|redirect_addr linkspec|\n"
+"nat N config {ip IPADDR|if 
IFNAME|log|deny_in|same_ports|unreg_only|unreg_cgn|\n"
+"  reset|reverse|proxy_only|redirect_addr linkspec|\n"
 "  redirect_port linkspec|redirect_proto linkspec}\n"
 "set [disable N... enable N...] | move [rule] X to Y | swap X Y | show\n"
 "set N {show|list|zero|resetlog|delete} [N{,N}] | flush\n"

Modified: stable/12/sbin/ipfw/nat.c
==
--- stable/12/sbin/ipfw/nat.c   Tue Apr  7 16:15:53 2020(r359693)
+++ stable/12/sbin/ipfw/nat.c   Tue Apr  7 16:27:58 2020(r359694)
@@ -60,6 +60,7 @@ static struct _s_x nat_params[] = {
{ "deny_in",TOK_DENY_INC },
{ "same_ports", TOK_SAME_PORTS },
{ "unreg_only", TOK_UNREG_ONLY },
+   { "unreg_cgn",  TOK_UNREG_CGN },
{ "skip_global",TOK_SKIP_GLOBAL },
{ "reset",  TOK_RESET_ADDR },
{ "reverse",TOK_ALIAS_REV },
@@ -663,6 +664,9 @@ nat_show_cfg(struct nat44_cfg_nat *n, void *arg)
} else if (n->mode & PKT_ALIAS_UNREGISTERED_ONLY) {
printf(" unreg_only");
n->mode &= ~PKT_ALIAS_UNREGISTERED_ONLY;
+   } else if (n->mode & PKT_ALIAS_UNREGISTERED_CGN) {
+   printf(" unreg_cgn");
+   n->mode &= ~PKT_ALIAS_UNREGISTERED_CGN;
} else if (n->mode & PKT_ALIAS_RESET_ON_ADDR_CHANGE) {
printf(" reset");
n->mode &= ~PKT_ALIAS_RESET_ON_ADDR_CHANGE;
@@ -789,6 +793,7 @@ ipfw_config_nat(int ac, char **av)
case TOK_SAME_PORTS:
case TOK_SKIP_GLOBAL:
case TOK_UNREG_ONLY:
+   case TOK_UNREG_CGN:
case TOK_RESET_ADDR:
case TOK_ALIAS_REV:
case TOK_PROXY_ONLY:
@@ -882,6 +887,9 @@ ipfw_config_nat(int ac, char **av)
 

svn commit: r359692 - stable/12/usr.sbin/newsyslog

2020-04-07 Thread Mark Johnston
Author: markj
Date: Tue Apr  7 16:15:35 2020
New Revision: 359692
URL: https://svnweb.freebsd.org/changeset/base/359692

Log:
  MFC r359276:
  newsyslog: Fix stack corruption when initializing a zipwork structure.

Modified:
  stable/12/usr.sbin/newsyslog/newsyslog.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/newsyslog/newsyslog.c
==
--- stable/12/usr.sbin/newsyslog/newsyslog.cTue Apr  7 15:32:08 2020
(r359691)
+++ stable/12/usr.sbin/newsyslog/newsyslog.cTue Apr  7 16:15:35 2020
(r359692)
@@ -1829,17 +1829,23 @@ do_rotate(const struct conf_entry *ent)
else {
/* XXX - Ought to be checking for failure! */
(void)rename(zfile1, zfile2);
-   change_attrs(zfile2, ent);
-   if (ent->compress && !strlen(logfile_suffix)) {
-   /* compress old rotation */
-   struct zipwork_entry zwork;
+   }
+   change_attrs(zfile2, ent);
+   if (ent->compress && strlen(logfile_suffix) == 0) {
+   /* compress old rotation */
+   struct zipwork_entry *zwork;
+   size_t sz;
 
-   memset(, 0, sizeof(zwork));
-   zwork.zw_conf = ent;
-   zwork.zw_fsize = sizefile(zfile2);
-   strcpy(zwork.zw_fname, zfile2);
-   do_zipwork();
-   }
+   sz = sizeof(*zwork) + strlen(zfile2) + 1;
+   zwork = calloc(1, sz);
+   if (zwork == NULL)
+   err(1, "calloc");
+
+   zwork->zw_conf = ent;
+   zwork->zw_fsize = sizefile(zfile2);
+   strcpy(zwork->zw_fname, zfile2);
+   do_zipwork(zwork);
+   free(zwork);
}
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359693 - stable/12/usr.sbin/newsyslog/tests

2020-04-07 Thread Mark Johnston
Author: markj
Date: Tue Apr  7 16:15:53 2020
New Revision: 359693
URL: https://svnweb.freebsd.org/changeset/base/359693

Log:
  MFC r359277:
  Add regression tests for newsyslog.conf's p flag.

Modified:
  stable/12/usr.sbin/newsyslog/tests/legacy_test.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/newsyslog/tests/legacy_test.sh
==
--- stable/12/usr.sbin/newsyslog/tests/legacy_test.sh   Tue Apr  7 16:15:35 
2020(r359692)
+++ stable/12/usr.sbin/newsyslog/tests/legacy_test.sh   Tue Apr  7 16:15:53 
2020(r359693)
@@ -194,7 +194,8 @@ ckstr()
 
 tmpdir_create()
 {
-   mkdir -p ${TMPDIR}/log ${TMPDIR}/alog
+   rm -rf ${TMPDIR}/log ${TMPDIR}/alog
+   mkdir ${TMPDIR}/log ${TMPDIR}/alog
cd ${TMPDIR}/log
 }
 
@@ -211,6 +212,8 @@ run_newsyslog()
 }
 
 tests_normal_rotate() {
+   local dir ext name_postfix newsyslog_args
+
ext="$1"
dir="$2"
 
@@ -286,6 +289,8 @@ tests_normal_rotate() {
 }
 
 tests_normal_rotate_keepn() {
+   local cnt dir ext name_postfix newsyslog_args
+
cnt="$1"
ext="$2"
dir="$3"
@@ -354,6 +359,8 @@ tests_normal_rotate_keepn() {
 }
 
 tests_time_rotate() {
+   local dir ext name_postfix newsyslog_args
+
ext="$1"
dir="$2"
 
@@ -413,6 +420,8 @@ tests_time_rotate() {
 }
 
 tests_rfc5424() {
+   local dir ext name_postfix newsyslog_args
+
ext="$1"
dir="$2"
 
@@ -451,7 +460,73 @@ tests_rfc5424() {
tmpdir_clean
 }
 
-echo 1..180
+tests_p_flag_rotate() {
+   local ext
+
+   ext="$1"
+
+   tmpdir_create
+
+   begin "create file"
+   run_newsyslog -C
+   ckfe $LOGFNAME
+   cknt ${LOGFNAME}.0
+   cknt ${LOGFNAME}.0${ext}
+   end
+
+   begin "rotate p flag 1 ${ext}"
+   run_newsyslog
+   ckfe $LOGFNAME
+   ckfe ${LOGFNAME}.0
+   cknt ${LOGFNAME}.0${ext}
+   run_newsyslog
+   ckfe $LOGFNAME
+   ckfe ${LOGFNAME}.0
+   cknt ${LOGFNAME}.0${ext}
+   ckfe ${LOGFNAME}.1${ext}
+   run_newsyslog
+   ckfe $LOGFNAME
+   ckfe ${LOGFNAME}.0
+   cknt ${LOGFNAME}.0${ext}
+   ckfe ${LOGFNAME}.1${ext}
+   ckfe ${LOGFNAME}.2${ext}
+   end
+
+   tmpdir_clean
+}
+
+tests_normal_rotate_recompress() {
+   local ext
+
+   ext=".gz"
+
+   tmpdir_create
+
+   begin "create file recompress"
+   run_newsyslog -C
+   ckfe $LOGFNAME
+   cknt ${LOGFNAME}.0${ext}
+   end
+
+   begin "rotate normal 1"
+   run_newsyslog
+   ckfe $LOGFNAME
+   ckfe ${LOGFNAME}.0${ext}
+   cknt ${LOGFNAME}.1${ext}
+   end
+
+   begin "rotate recompress 1"
+   gunzip ${LOGFNAME}.0${ext}
+   ckfe ${LOGFNAME}.0
+   cknt ${LOGFNAME}.0${ext}
+   run_newsyslog
+   ckfe $LOGFNAME
+   ckfe ${LOGFNAME}.0${ext}
+   ckfe ${LOGFNAME}.1${ext}
+   end
+}
+
+echo 1..185
 mkdir -p ${TMPDIR}
 cd ${TMPDIR}
 
@@ -556,5 +631,11 @@ tests_time_rotate "zst" "${TMPDIR}/alog/"
 echo "$LOGFPATH5424640  3 *@T00  NCT" > newsyslog.conf
 echo "$LOGFPATH640  3 *@T00  NC" >> newsyslog.conf
 tests_rfc5424
+
+echo "$LOGFPATH 640  3 *@T00  NCpZ" > newsyslog.conf
+tests_p_flag_rotate ".gz"
+
+echo "$LOGFPATH 640  3 *@T00  NCZ" > newsyslog.conf
+tests_normal_rotate_recompress
 
 rm -rf "${TMPDIR}"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r359690 - head/share/mk

2020-04-07 Thread Brooks Davis
On Tue, Apr 07, 2020 at 03:10:04PM +, Kyle Evans wrote:
> Author: kevans
> Date: Tue Apr  7 15:10:04 2020
> New Revision: 359690
> URL: https://svnweb.freebsd.org/changeset/base/359690
> 
> Log:
>   Fix port/kernel builds after r359681
>   
>   Submitted by:   bdrewery
>   Reported by:bdrewery, sobomax, antoine
> 
> Modified:
>   head/share/mk/bsd.sys.mk

Thanks!

-- Brooks


signature.asc
Description: PGP signature


svn commit: r359691 - head/sys/conf

2020-04-07 Thread Brooks Davis
Author: brooks
Date: Tue Apr  7 15:32:08 2020
New Revision: 359691
URL: https://svnweb.freebsd.org/changeset/base/359691

Log:
  Allow the kernel to build with a compiler that sets -fno-common.
  
  The mechanism that generates assym.inc and offset.inc depends on the
  symbols in question being common. For now, simply force the object files
  to be created with -fcommon.
  
  -fno-common will be the default in GCC10/LLVM11.
  
  Submitted by: arichardson
  Reviewed by:  kevans
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24322

Modified:
  head/sys/conf/kern.post.mk

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Tue Apr  7 15:10:04 2020(r359690)
+++ head/sys/conf/kern.post.mk  Tue Apr  7 15:32:08 2020(r359691)
@@ -235,20 +235,20 @@ offset.inc: $S/kern/genoffset.sh genoffset.o
NM='${NM}' NMFLAGS='${NMFLAGS}' sh $S/kern/genoffset.sh genoffset.o > 
${.TARGET}
 
 genoffset.o: $S/kern/genoffset.c
-   ${CC} -c ${CFLAGS:N-flto:N-fno-common} $S/kern/genoffset.c
+   ${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon $S/kern/genoffset.c
 
 # genoffset_test.o is not actually used for anything - the point of compiling 
it
 # is to exercise the CTASSERT that checks that the offsets in the offset.inc
 # _lite struct(s) match those in the original(s). 
 genoffset_test.o: $S/kern/genoffset.c offset.inc
-   ${CC} -c ${CFLAGS:N-flto:N-fno-common} -DOFFSET_TEST \
+   ${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon -DOFFSET_TEST \
$S/kern/genoffset.c -o ${.TARGET}
 
 assym.inc: $S/kern/genassym.sh genassym.o genoffset_test.o
NM='${NM}' NMFLAGS='${NMFLAGS}' sh $S/kern/genassym.sh genassym.o > 
${.TARGET}
 
 genassym.o: $S/$M/$M/genassym.c  offset.inc
-   ${CC} -c ${CFLAGS:N-flto:N-fno-common} $S/$M/$M/genassym.c
+   ${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon $S/$M/$M/genassym.c
 
 OBJS_DEPEND_GUESS+= opt_global.h
 genoffset.o genassym.o vers.o: opt_global.h
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359690 - head/share/mk

2020-04-07 Thread Kyle Evans
Author: kevans
Date: Tue Apr  7 15:10:04 2020
New Revision: 359690
URL: https://svnweb.freebsd.org/changeset/base/359690

Log:
  Fix port/kernel builds after r359681
  
  Submitted by: bdrewery
  Reported by:  bdrewery, sobomax, antoine

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkTue Apr  7 14:14:59 2020(r359689)
+++ head/share/mk/bsd.sys.mkTue Apr  7 15:10:04 2020(r359690)
@@ -215,8 +215,8 @@ CFLAGS+=-Wno-format-zero-length
 #
 # XXX: This is a hack to support complete external installs of clang while
 # we work to synchronize our decleration guards with those in the clang tree.
-.if ${MK_CLANG_BOOTSTRAP} == "no" && ${COMPILER_RESOURCE_DIR} != "unknown" && \
-!defined(BOOTSTRAPPING)
+.if ${MK_CLANG_BOOTSTRAP:Uno} == "no" && \
+${COMPILER_RESOURCE_DIR} != "unknown" && !defined(BOOTSTRAPPING)
 CFLAGS+=-nobuiltininc -idirafter ${COMPILER_RESOURCE_DIR}/include
 .endif
 .endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359689 - head/usr.sbin/config

2020-04-07 Thread Kyle Evans
Author: kevans
Date: Tue Apr  7 14:14:59 2020
New Revision: 359689
URL: https://svnweb.freebsd.org/changeset/base/359689

Log:
  config(8): "fix" a couple of buffer overflows
  
  Recently added/changed lines in various kernel configs have caused some
  buffer overflows that went undetected. These were detected with a config
  built using -fno-common as these line buffers smashed one of our arrays,
  then further triaged with ASAN.
  
  Double the sizes; this is really not a great fix, but addresses the
  immediate need until someone rewrites config. While here, add some bounds
  checking so that we don't need to detect this by random bus errors or other
  weird failures.
  
  MFC after:3 days

Modified:
  head/usr.sbin/config/main.c

Modified: head/usr.sbin/config/main.c
==
--- head/usr.sbin/config/main.c Tue Apr  7 12:57:50 2020(r359688)
+++ head/usr.sbin/config/main.c Tue Apr  7 14:14:59 2020(r359689)
@@ -322,7 +322,7 @@ usage(void)
 char *
 get_word(FILE *fp)
 {
-   static char line[80];
+   static char line[160];
int ch;
char *cp;
int escaped_nl = 0;
@@ -352,11 +352,17 @@ begin:
*cp = 0;
return (line);
}
-   while ((ch = getc(fp)) != EOF) {
+   while ((ch = getc(fp)) != EOF && cp < line + sizeof(line)) {
if (isspace(ch))
break;
*cp++ = ch;
}
+   if (cp >= line + sizeof(line)) {
+   line[sizeof(line) - 1] = '\0';
+   fprintf(stderr, "config: attempted overflow, partial line: 
`%s'",
+   line);
+   exit(2);
+   }
*cp = 0;
if (ch == EOF)
return ((char *)EOF);
@@ -372,7 +378,7 @@ begin:
 char *
 get_quoted_word(FILE *fp)
 {
-   static char line[256];
+   static char line[512];
int ch;
char *cp;
int escaped_nl = 0;
@@ -415,15 +421,29 @@ begin:
}
if (ch != quote && escaped_nl)
*cp++ = '\\';
+   if (cp >= line + sizeof(line)) {
+   line[sizeof(line) - 1] = '\0';
+   printf(
+   "config: line buffer overflow reading 
partial line `%s'\n",
+   line);
+   exit(2);
+   }
*cp++ = ch;
escaped_nl = 0;
}
} else {
*cp++ = ch;
-   while ((ch = getc(fp)) != EOF) {
+   while ((ch = getc(fp)) != EOF && cp < line + sizeof(line)) {
if (isspace(ch))
break;
*cp++ = ch;
+   }
+   if (cp >= line + sizeof(line)) {
+   line[sizeof(line) - 1] = '\0';
+   printf(
+   "config: line buffer overflow reading partial line 
`%s'\n",
+   line);
+   exit(2);
}
if (ch != EOF)
(void) ungetc(ch, fp);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359688 - in head/stand: mips/beri/loader powerpc/ofw uboot/lib

2020-04-07 Thread Kyle Evans
Author: kevans
Date: Tue Apr  7 12:57:50 2020
New Revision: 359688
URL: https://svnweb.freebsd.org/changeset/base/359688

Log:
  stand: -fno-common fixes for !x86 loaders
  
  - beriloader: archsw is declared extern and defined elsewhere
  - ofwloader: ofw_elf{,64} are defined in elf_freebsd.c and
ppc64_elf_freebsd.c respectively
  - ubldr: syscall_ptr is defined in start.S for whichever ubldr platform is
building
  
  -fno-common will become the default in GCC10/LLVM11.
  
  MFC after:3 days

Modified:
  head/stand/mips/beri/loader/main.c
  head/stand/powerpc/ofw/conf.c
  head/stand/uboot/lib/glue.h

Modified: head/stand/mips/beri/loader/main.c
==
--- head/stand/mips/beri/loader/main.c  Tue Apr  7 12:46:26 2020
(r359687)
+++ head/stand/mips/beri/loader/main.c  Tue Apr  7 12:57:50 2020
(r359688)
@@ -59,8 +59,6 @@ struct devsw *devsw[] = {
NULL
 };
 
-struct arch_switch archsw;
-
 struct file_format *file_formats[] = {
_elf,
NULL

Modified: head/stand/powerpc/ofw/conf.c
==
--- head/stand/powerpc/ofw/conf.c   Tue Apr  7 12:46:26 2020
(r359687)
+++ head/stand/powerpc/ofw/conf.c   Tue Apr  7 12:57:50 2020
(r359688)
@@ -97,8 +97,8 @@ struct netif_driver *netif_drivers[] = {
  * rather than reading the file go first.
  */
 
-struct file_format ofw_elf;
-struct file_format ofw_elf64;
+extern struct file_format ofw_elf;
+extern struct file_format ofw_elf64;
 
 struct file_format *file_formats[] = {
 _elf,

Modified: head/stand/uboot/lib/glue.h
==
--- head/stand/uboot/lib/glue.h Tue Apr  7 12:46:26 2020(r359687)
+++ head/stand/uboot/lib/glue.h Tue Apr  7 12:57:50 2020(r359688)
@@ -56,7 +56,7 @@
 #endif
 
 int syscall(int, int *, ...);
-void *syscall_ptr;
+extern void *syscall_ptr;
 
 int api_parse_cmdline_sig(int argc, char **argv, struct api_signature **sig);
 int api_search_sig(struct api_signature **sig);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359687 - head/stand/powerpc/ofw

2020-04-07 Thread Leandro Lupori
Author: luporl
Date: Tue Apr  7 12:46:26 2020
New Revision: 359687
URL: https://svnweb.freebsd.org/changeset/base/359687

Log:
  [PPC] Fix loader call to instantiate-rtas
  
  OpenFirmware (OF) method instantiate-rtas was being called with a wrong
  rtas-base-address argument. It must use the memory that is already being
  allocated to this end instead. This issue was causing QEMU netboot to hang
  when building the FDT from OF DT.
  
  Reviewed by:  jhibbits
  Sponsored by: Eldorado Research Institute (eldorado.org.br)
  Differential Revision:https://reviews.freebsd.org/D24313

Modified:
  head/stand/powerpc/ofw/ofwfdt.c

Modified: head/stand/powerpc/ofw/ofwfdt.c
==
--- head/stand/powerpc/ofw/ofwfdt.c Tue Apr  7 03:19:00 2020
(r359686)
+++ head/stand/powerpc/ofw/ofwfdt.c Tue Apr  7 12:46:26 2020
(r359687)
@@ -120,7 +120,7 @@ ofwfdt_fixups(void *fdtp)
/* Instantiate RTAS */
rtas = OF_open(path);
base = 0;
-   OF_call_method("instantiate-rtas", rtas, 1, 1, (cell_t)rtas,
+   OF_call_method("instantiate-rtas", rtas, 1, 1, (cell_t)rtasmem,
);
 
/* Store info to FDT using Linux convention */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r359685 - in head: . etc lib/libc/gen share/mk share/termcap usr.bin/login usr.bin/vgrind usr.sbin/services_mkdb

2020-04-07 Thread Rodney W. Grimes
> Author: sobomax
> Date: Tue Apr  7 02:46:22 2020
> New Revision: 359685
> URL: https://svnweb.freebsd.org/changeset/base/359685
> 
> Log:
>   Normalize deployment tools usage and definitions by putting into one place
>   instead of sprinkling them out over many disjoint files. This is a follow-up
>   to achieve the same goal in an incomplete rev.348521.

I have concerns that this factoring out of 5 values that have not changed
in 25 years is a pessimization, it is one more file that make has to
open on each invocation.


>   Approved by:imp
>   MFC after:  1 month
>   Differential Revision:  https://reviews.freebsd.org/D20520
> 
> Added:
>   head/share/mk/src.tools.mk   (contents, props changed)
> Modified:
>   head/Makefile.inc1
>   head/etc/Makefile
>   head/lib/libc/gen/Makefile.inc
>   head/share/mk/sys.mk
>   head/share/termcap/Makefile
>   head/usr.bin/login/Makefile
>   head/usr.bin/vgrind/Makefile
>   head/usr.sbin/services_mkdb/Makefile
> 
> Modified: head/Makefile.inc1
> ==
> --- head/Makefile.inc1Tue Apr  7 02:45:24 2020(r359684)
> +++ head/Makefile.inc1Tue Apr  7 02:46:22 2020(r359685)
> @@ -57,6 +57,8 @@ _MKSHOWCONFIG=  t
>  SRCDIR?= ${.CURDIR}
>  LOCALBASE?=  /usr/local
>  
> +.include "share/mk/src.tools.mk"
> +
>  # Cross toolchain changes must be in effect before bsd.compiler.mk
>  # so that gets the right CC, and pass CROSS_TOOLCHAIN to submakes.
>  .if defined(CROSS_TOOLCHAIN)
> @@ -874,8 +876,8 @@ MTREEFLAGS+=  -W
>  INSTALLFLAGS+=   -h sha256
>  .endif
>  .if defined(DB_FROM_SRC) || defined(NO_ROOT)
> -IMAKE_INSTALL=   INSTALL="install ${INSTALLFLAGS}"
> -IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
> +IMAKE_INSTALL=   INSTALL="${INSTALL_CMD} ${INSTALLFLAGS}"
> +IMAKE_MTREE= MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}"
>  .endif
>  
>  DESTDIR_MTREEFLAGS=  -deU
> @@ -887,12 +889,12 @@ WORLDTMP_MTREEFLAGS=-deUW
>  # that are created by mtree to be owned by root/wheel.
>  DESTDIR_MTREEFLAGS+= -W
>  .endif
> -MTREE?=  mtree
> +DISTR_MTREE= ${MTREE_CMD}
>  .if ${BUILD_WITH_STRICT_TMPPATH} != 0
> -MTREE=   ${WORLDTMP}/legacy/usr/sbin/mtree
> +DISTR_MTREE= ${WORLDTMP}/legacy/usr/sbin/mtree
>  .endif
> -WORLDTMP_MTREE=  ${MTREE} ${WORLDTMP_MTREEFLAGS}
> -DESTDIR_MTREE=   ${MTREE} ${DESTDIR_MTREEFLAGS}
> +WORLDTMP_MTREE=  ${DISTR_MTREE} ${WORLDTMP_MTREEFLAGS}
> +DESTDIR_MTREE=   ${DISTR_MTREE} ${DESTDIR_MTREEFLAGS}
>  
>  # kernel stage
>  KMAKEENV=${WMAKEENV:NSYSROOT=*}
> @@ -1363,14 +1365,14 @@ distributeworld installworld stageworld: _installcheck
>  .endif
>  .endif
>  .if defined(NO_ROOT)
> - ${IMAKEENV} ${MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
> + ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
>   sed -e 's#^\./#./${dist}/#' >> ${METALOG}
> - ${IMAKEENV} ${MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
> + ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
>   sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
> - ${IMAKEENV} ${MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
> + ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.include.dist 
> | \
>   sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
>  .if defined(_LIBCOMPAT)
> - ${IMAKEENV} ${MTREE} -C -f 
> ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \
> + ${IMAKEENV} ${DISTR_MTREE} -C -f 
> ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \
>   sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
>  .endif
>  .endif
> 
> Modified: head/etc/Makefile
> ==
> --- head/etc/Makefile Tue Apr  7 02:45:24 2020(r359684)
> +++ head/etc/Makefile Tue Apr  7 02:46:22 2020(r359685)
> @@ -2,11 +2,11 @@
>  # $FreeBSD$
>  
>  .include 
> +.include 
>  
>  FILESGROUPS= FILES
>  NLS_ALIASES= POSIX C \
>   en_US.US_ASCII C
> -PWD_MKDB_CMD?=   pwd_mkdb
>  
>  # No need as it is empty and just causes rebuilds since this file does so 
> much.
>  UPDATE_DEPENDFILE=   no
> @@ -98,8 +98,6 @@ distribution:
>   ${DESTDIR}/boot/device.hints
>  .endif
>  .endif
> -
> -MTREE_CMD?=  mtree
>  
>  MTREES=  mtree/BSD.root.dist /   \
>   mtree/BSD.var.dist  /var\
> 
> Modified: head/lib/libc/gen/Makefile.inc
> ==
> --- head/lib/libc/gen/Makefile.incTue Apr  7 02:45:24 2020
> (r359684)
> +++ head/lib/libc/gen/Makefile.incTue Apr  7 02:46:22 2020
> (r359685)
> @@ -550,11 +550,13 @@ MLINKS+=vis.3 nvis.3 \
>  
>  MLINKS+=wordexp.3 wordfree.3
>  
> +.include 
> +
>  afterinstallconfig:
>  .if ${MK_TCSH} == "no"
>   sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
>  

Re: svn commit: r359647 - in head/sys: arm64/broadcom arm64/broadcom/brcmmdio conf dev/mdio

2020-04-07 Thread Peter Jeremy
On 2020-Apr-06 05:48:58 +, Wojciech Macek  wrote:
>Log:
>  Add MDIO PHY driver for NS2 ARM64 platform.
...
>Modified: head/sys/conf/files.arm64
>==
>--- head/sys/conf/files.arm64  Mon Apr  6 04:06:15 2020(r359646)
>+++ head/sys/conf/files.arm64  Mon Apr  6 05:48:58 2020(r359647)
>@@ -176,6 +176,9 @@ arm64/arm64/undefined.cstandard
> arm64/arm64/unwind.c  optionalddb | kdtrace_hooks | stack
> arm64/arm64/vfp.c standard
> arm64/arm64/vm_machdep.c  standard
>+arm64/broadcom/brcmmdio/mdio_mux_iproc.c  optionalfdt
>+arm64/broadcom/brcmmdio/mdio_nexus_iproc.coptionalfdt
>+arm64/broadcom/brcmmdio/mdio_ns2_pcie_phy.c   optionalfdt pci

I don't believe this is correct.  These files are only relevant to a subset
of Broadcom SoCs and (IMO) should not be included merely with "options FDT",
rather they should be conditional on the relevant Broadcom SoCs.

-- 
Peter Jeremy


signature.asc
Description: PGP signature