Commit Graph

19149 Commits

Author SHA1 Message Date
Peter Grehan
eed1cc6cdf Support COM3 and COM4 serial ports.
Submitted by: Jan Poctavek <janci@binaryparadise.com>, otis
Reviewed by: grehan (bhyve), imp, 0mp (manpages)
Differential Revision: https://reviews.freebsd.org/D28207
2021-01-20 03:30:22 +10:00
Conrad Meyer
ddf6115613 fstyp(8): fix exfat detection
In the presence of high-level errors (spec violations, bad boot blocks
checksum), report non-detection instead of detection.

PR:	252787 (related, but does not fully address)
2021-01-17 11:55:06 -08:00
Daniel Ebdrup Jensen
bce5d6aa24 service.8: Use entire section of literally displayed text
.Dl indents literal display text for one line, but .Bd can do it for a
whole subsection.

Pointy hat to:	debdrup
Reported by:	0mp
Reviewed by:	0mp
Differential Revision:	https://reviews.freebsd.org/D28198
2021-01-16 23:21:05 +01:00
Daniel Ebdrup Jensen
c6a112cf84 service.8: Provide example for adding completions to (t)csh
service(8) has an example for bash completion, however bash is third
party and in /usr/share/examples/csh/dot.cshrc is a working example for
csh.

Since I use (t)csh, I've tested it, and it works for me.

PR:		179497
Submitted by:	ohauer@

Reviewed by:	kp (tentatively)
Differential Revision:	https://reviews.freebsd.org/D28197
2021-01-16 22:05:29 +01:00
Mateusz Piotrowski
54c743e5b2 Fix a typo
"and" is not a flag.

MFC after:	3 days
2021-01-14 19:12:55 +01:00
Adrian Chadd
7c5a624afa [wpa] Add support for hostapd/wpa_supplicant when WITHOUT_CRYPT=YES
is enabled.

This builds wpa_supplicant / hostpad using internal encryption routines
rather than using libcrypt.

This has been supported in wpa for years now, however since we use
local makefiles for this, we bitrotted dependencies and configuration
options.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D27958
2021-01-12 16:43:19 -08:00
Ed Maste
a5584ace96 bsdconfig: correct utilties typo 2021-01-11 19:57:23 -05:00
Alexander V. Chernikov
0da3f8c98d Bump amount of queued packets in for unresolved ARP/NDP entries to 16.
Currently default behaviour is to keep only 1 packet per unresolved entry.
Ability to queue more than one packet was added 10 years ago, in r215207,
 though the default value was kep intact.

Things have changed since that time. Systems tend to initiate multiple
 connections at once for a variety of reasons.
For example, recent kern/252278 bug report describe happy-eyeball DNS
 behaviour sending multiple requests to the DNS server.

The primary driver for upper value for the queue length determination is
 memory consumption. Remote actors should not be able to easily exhaust
 local memory by sending packets to unresolved arp/ND entries.

For now, bump value to 16 packets, to match Darwin implementation.

The proper approach would be to switch the limit to calculate memory
 consumption instead of packet count and limit based on memory.

We should MFC this with a variation of D22447.

Reviewers: #manpages, #network, bz, emaste

Reviewed By: emaste, gbe(doc), jilles(doc)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D28068
2021-01-11 19:51:11 +00:00
Kyle Evans
8c4094f38c certctl: factor out certname resolution
create_blacklisted() will identify a cert whether it's provided a path to
a cert or the hash.serial format that is shown by `certctl list`.

Factor this logic out into a resolve_certname() so that it may be reused
elsewhere.
2021-01-08 22:36:22 -06:00
Kyle Evans
b799d38a2a certctl: replace hardcoded uses of /usr/local
Use the new user.localbase sysctl here as well, to reduce the number of
hardcoded localbase by one (1).

MFC after:	3 days (note: just use a literal /usr/local default)
2021-01-08 22:06:42 -06:00
Warner Losh
23e124c78b pccard: Remove bt3c(4) driver
pccard is being removed, so remove bt3c driver since it only has PC
Card attachment. Also remove bt3cfw(8) since it's the firmware for this
driver.

Relnotes: Yes
2021-01-07 20:40:41 -07:00
Mateusz Piotrowski
0199cbf641 Fix a typo
MFC after:	3 days
2021-01-07 15:28:29 +01:00
Alex Richardson
7fa2f2a62f Rename NO_WERROR -> MK_WERROR=no
As suggested in D27598. This also supports MK_WERROR.clang=no and
MK_WERROR.gcc=no to support the existing NO_WERROR.<compiler> uses.

Reviewed By:	brooks
Differential Revision: https://reviews.freebsd.org/D27601
2021-01-07 09:31:03 +00:00
Alex Richardson
fe41c64b57 Fix -Wpointer-sign warnings in makefs and mkimg
Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D27175
2021-01-07 09:26:21 +00:00
Fernando Apesteguía
439862883f gstat(8): Bump .Dd
Forgotten in cfaa2958dc

PR: 251313
Differential Revision: https://reviews.freebsd.org/D27815
2021-01-06 19:04:09 +01:00
Fernando Apesteguía
cfaa2958dc gstat(8): Document interactive keyboard commands
gstat(8) allows for <, >, c, f, F and q while in interactive mode.

PR:	251313
Submitted by:	bojan_petrovic@fastmail.fm
Approved by:	manpages (0mp@)
Differential Revision:	https://reviews.freebsd.org/D27815
2021-01-06 18:55:03 +01:00
Baptiste Daroussin
ae994fdc5b pkg(7): rework the arguments handling
Rework the arguments handling around using getopt_long:
* add long option support
* add -4 and -6 support to enforce ipv4 or ipv6

While here fix a regression which occured between FreeBSD 12.1 and
FreeBSD 12.2 where pkg bootstrap -y stopped working

PR:		252270
MFC after:	2 weeks
Submitted by:	evilham <contact@evilham.com>
Differential Revision:	https://reviews.freebsd.org/D27860
2021-01-06 11:47:34 +01:00
Alexander Motin
4d86ab429e Fix devinfo typo.
Submitted by:	Nick Wolff <darkfiberiru@gmail.com>
MFC after: 	1 week
Differential Revision:	https://reviews.freebsd.org/D27981
2021-01-05 14:56:23 -05:00
Andrew Turner
9fd96b416c Add the missing pmcstat log entries
Sponsored by:	Innovate UK
2021-01-05 10:03:05 +00:00
Emmanuel Vadot
a22cde7c02 pkgbase: Put ppp in it's own package
ppp uses libalias modules which now belong in the natd package.
Avoid bringing a dependancy on natd for the utilities package.

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D27711
2021-01-04 16:19:36 +01:00
Mariusz Zaborski
845b273728 bhyve: fix build without casper/capsicum support
Fix typo introduced in 966026246e.

Pointed out by:	jbeich
2021-01-03 18:17:04 +01:00
Mariusz Zaborski
966026246e bhyve: fix build without casper/capsicum support
PR:		252353
2021-01-03 17:21:28 +01:00
Yoshihiro Takahashi
8c45fe5d8e bootparamd: Add missing __unused mark.
e03764d931 did not catch all unused
variables.

Submitted by:		otis
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D27894
2021-01-03 00:40:34 +09:00
Yoshihiro Takahashi
e03764d931 bootparamd: Fix several warnings and increase warn level to 6.
- Increase WARNS to 6.
- Except -Wcast-align and -Wincompatible-pointer-types-discards-qualifiers
  checks.
- Use ANSI C prototype.
- Statically variables and functions.
- Add extern declaration for global variables.
- Rename local variables to resolve shadow warnings.

PR:		71667
MFC after:	2 weeks
2021-01-02 12:36:09 +09:00
Xin LI
bfe90bb336 usr.sbin/rtadvctl: Remove support for FreeBSD 9.x. 2021-01-01 16:06:08 -08:00
Pedro F. Giffuni
978b10d8ef services: reinstate CouchDB and bring amqps
CouchDB was mistakenly removed in r368712
amqps is used by net/rabbitmp

Both are registered in IANA

Reported by:	dch
Differential Revision:	https://reviews.freebsd.org/D27691
2020-12-31 20:49:03 -05:00
Pedro F. Giffuni
302c387cd6 services: fiz bug introduced in r361898
Reported by:	deischen@
2020-12-31 19:38:29 -05:00
Adrian Chadd
697684325d [vale] Fix valectl to compile on a 32-bit platform
This shows up when compiling valectl on a 32 bit platform like i386 and mips32.
gcc-6.4 complains about this (-Wint-to-pointer-cast).

Reviewed by: vmaffione
Differential Revision: https://reviews.freebsd.org/D27814
2020-12-30 10:40:43 -08:00
Alexander Motin
bdbc2a6fc2 Fix typo in an_initator_name.
MFC after:	1 week
2020-12-30 13:05:41 -05:00
Xin LI
2edcc10cb1 Update leap-seconds to leap-seconds.3676924800.
Obtained from:	ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800
MFC after:	3 days
2020-12-29 22:01:46 -08:00
Alexander Motin
a3434cdc6b Fix typo in ap_initator_portal.
MFC after:	1 week
2020-12-29 13:32:05 -05:00
Edward Tomasz Napierala
a7972b4904 iscsid(8): fix memory leak by freeing the 'addr'
Reviewed By:	mav
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27328
2020-12-29 14:53:06 +00:00
Edward Tomasz Napierala
7db3d97e0f iscsid(8): free data allocated by getaddrinfo(3)
Reviewed By:	mav
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27329
2020-12-29 14:52:23 +00:00
Ed Maste
93900fc697 Fix daily_backup_gpart_exclude in periodic daily 221.backup-gpart
Since gpart_devs was not quoted (losing embedded newlines), if
daily_backup_gpart_exclude matched something, gpart_devs was empty.

PR:		251961
Submitted by:	Kan Sasaki
MFC after:	1 week
2020-12-26 19:27:12 -05:00
Xin LI
760dbe84ab Don't set more_data which is never used.
MFC after:	2 weeks
2020-12-24 18:49:12 -08:00
Robert Wing
c4df8cbfde Remove bvmconsole and bvmdebug.
Now that bhyve(8) supports UART, bvmconsole and bvmdebug are no longer needed.

This also removes the '-b' and '-g' flag from bhyve(8). These two flags were
marked deprecated in r368519.

Reviewed by:    grehan, kevans
Approved by:    kevans (mentor)
Differential Revision:  https://reviews.freebsd.org/D27490
2020-12-23 17:15:23 -09:00
Gordon Bergling
a652079615 trim(8): Fix a few issues reported by mandoc
- new sentence, new line
- unusual Xr order: ioctl(2) after da(4)
- unusual Xr order: sysexits(3) after nda(4)

MFC after:	1 week
2020-12-19 13:56:19 +00:00
Gordon Bergling
8ef235787b zonectl(8): Fix a few issues reported by mandoc
- Add missing quotation mark for a comment above the .Dd
- inserting missing end of block: Sh breaks Bd
- skipping paragraph macro: Pp before Bl
- skipping paragraph macro: Pp before Bd
- empty block: Bd

MFC after:	1 week
2020-12-19 13:51:46 +00:00
Gordon Bergling
749ddf491b nfsv4(4): Fix a few issues reported by mandoc
- new sentence, new line
- function name without markup: rtalloc()
- function name without markup: VOP_RECLAIM()

MFC after:	1 week
2020-12-19 13:45:39 +00:00
Gordon Bergling
60ee05db4b bluetooth: Fix a mandoc related issues
- new sentence, new line
- sections out of conventional order: Sh FILES
- unusual Xr order: bthost(1) after bthidd(8)
- no blank before trailing delimiter
- whitespace at end of input line
- sections out of conventional order: Sh EXIT STATUS

MFC after:	1 week
2020-12-19 13:36:59 +00:00
Gordon Bergling
84572415b4 mpsutil(8): Remove trailing whitespace
MFC after:	1 week
2020-12-19 13:23:26 +00:00
Gordon Bergling
1c77a78367 bhyvectl(8): Normalize the man page date
MFC after:	1 week
2020-12-19 13:21:40 +00:00
Gordon Bergling
cc984b0a5a camdd(8): Fix the man page date
The comment before the .Dd macro was missing a quotation mark, so that
the date of the man page was always today.

MFC after:	3 days
2020-12-19 13:17:25 +00:00
Gordon Bergling
aeb0c721f5 config: Fix a few mandoc related errors
- new sentence, new line
- no blank before trailing delimiter

MFC after:	1 week
2020-12-19 13:11:44 +00:00
Gordon Bergling
267d86e15d devctl(8): Correct "sections out of conventional order" error
MFC after:	1 week
2020-12-19 13:05:54 +00:00
Konstantin Belousov
1557543669 Remove redundand redefinion, fixing build.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2020-12-19 01:46:47 +00:00
Peter Grehan
2bb4be0f86 Fix issues with various VNC clients.
- support VNC version 3.3 (macos "Screen Sharing" builtin client)
- wait until client has requested an update prior to sending framebuffer data
- don't send an update if no framebuffer updates detected
- increase framebuffer poll frequency to 30Hz, and double that when
  kbd/mouse input detected
- zero uninitialized array elements in rfb_send_server_init_msg()
- fix overly large allocation in rfb_init()
- use atomics for flags shared between input and output threads
- use #defines for constants

 This work was contributed by Marko Kiiskila, with reuse of some earlier
work by Henrik Gulbrandsen.

Clients tested :
FreeBSD-current
 - tightvnc
 - tigervnc
 - krdc
 - vinagre

Linux (Ubuntu)
 - krdc
 - vinagre
 - tigervnc
 - xtightvncviewer
 - remmina

MacOS
 - VNC Viewer
 - TigerVNC
 - Screen Sharing (builtin client)

Windows 10
 - Tiger VNC
 - VNC Viewer (cursor lag)
 - UltraVNC (cursor lag)

o/s independent
 - noVNC (browser) using websockify relay

PR: 250795
Submitted by:	Marko Kiiskila <marko@apache.org>
Reviewed by:	jhb (bhyve)
MFC after:	3 weeks
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D27605
2020-12-18 00:38:48 +00:00
Cy Schubert
0ebcbcc0ef Update the unbound version number from r368478.
Updating the version number is an extra manual step.

Pointy hat to:	cy
Reported by:	Herbert J. Skuhra <herbert _ gojira.at>
MFC after:	3 days
2020-12-17 19:50:41 +00:00
Aleksandr Fedorov
ea57b2d7a8 [bhyve] virtio-net: Do not allow receiving packets until features have been negotiated.
Enforce the requirement that the RX callback cannot be called after a reset until the features have been negotiated.
This fixes a race condition where the receive callback is called during a device reset.

Reviewed by:	vmaffione, grehan
Approved by:	vmaffione (mentor)
Sponsored by:	vstack.com
Differential Revision:	https://reviews.freebsd.org/D27381
2020-12-17 16:52:40 +00:00
Mitchell Horne
10720ae4db bsdinstall: remove VTOC8 partition scheme option
Now that sparc64 has been removed, there are no kernels built with
support for the VTOC8 partitioning scheme by default. Remove the option
from the installer, as it is unsupported on all installer images
produced by re@.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D27641
2020-12-17 15:00:19 +00:00
Kyle Evans
ebebc41e4c freebsd-update: unconditionally regenerate passwd/login.conf files
The existing logic is nice in theory, but in practice freebsd-update will
not preserve the timestamps on these files. When doing a major upgrade, e.g.
from 12.1-RELEASE -> 12.2-RELEASE, pwd.mkdb et al. appear in the INDEX and
we clobber the timestamp several times in the process of packaging up the
existing system into /var/db/freebsd-update/files and extracting for
comparisons. This leads to these files not getting regenerated when they're
most likely to be needed.

Measures could be taken to preserve timestamps, but it's unclear whether
the complexity and overhead of doing so is really outweighed by the marginal
benefit.

I observed this issue when pkg subsequently failed to install a package that
wanted to add a user, claiming that the user was removed in the process.
bapt@ pointed to this pre-existing bug with freebsd-update as the cause.

PR:		234014, 232921
Reviewed by:	bapt, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D27635
2020-12-17 03:42:54 +00:00
Pedro F. Giffuni
228e2087a3 /etc/services: attempt to bring the database to this century 2/2.
This is the final half of splitting r358153 in two, in order to avoid a build
system bugs and being able to merge an earlier change to previous releases.

Add a note to UPDATING to avoid people building from very old systems from
having issues with mergemaster

MFC after:	3 days (only 12-stable)

Differential Revision:	https://reviews.freebsd.org/D23621
2020-12-17 02:54:32 +00:00
Jamie Gritton
3050aced42 Bugfix to not hide jailparam flags, which for example changes the output
"vnet=2" to the less opaque "vnet=inherit"

Reported by:	kevans
MFC after:	5 days
2020-12-15 20:56:35 +00:00
Ian Lepore
ff3468ac94 Provide userland notification of gpio pin changes ("userland gpio interrupts").
This is an import of the Google Summer of Code 2018 project completed by
Christian Kramer (and, sadly, ignored by us for two years now).  The goals
stated for that project were:

    FreeBSD already has support for interrupts implemented in the GPIO
    controller drivers of several SoCs, but there are no interfaces to take
    advantage of them out of user space yet. The goal of this work is to
    implement such an interface by providing descriptors which integrate
    with the common I/O system calls and multiplexing mechanisms.

The initial imported code supports the following functionality:

 -  A kernel driver that provides an interface to the user space; the
    existing gpioc(4) driver was enhanced with this functionality.
 -  Implement support for the most common I/O system calls / multiplexing
    mechanisms:
     -  read() Places the pin number on which the interrupt occurred in the
        buffer. Blocking and non-blocking behaviour supported.
     -	poll()/select()
     -	kqueue()
     -	signal driven I/O. Posting SIGIO when the O_ASYNC was set.
 -  Many-to-many relationship between pins and file descriptors.
     -  A file descriptor can monitor several GPIO pins.
     -  A GPIO pin can be monitored by multiple file descriptors.
 -  Integration with gpioctl and libgpio.

I added some fixes (mostly to locking) and feature enhancements on top of
the original gsoc code.  The feature ehancements allow the user to choose
between detailed and summary event reporting.  Detailed reporting provides
a record describing each pin change event.  Summary reporting provides the
time of the first and last change of each pin, and a count of how many times
it changed state since the last read(2) call.  Another enhancement allows
the recording of multiple state change events on multiple pins between each
call to read(2) (the original code would track only a single event at a time).

The phabricator review for these changes timed out without approval, but I
cite it below anyway, because the review contains a series of diffs that
show how I evolved the code from its original state in Christian's github
repo for the gsoc project to what is being commited here.  (In effect,
the phab review extends the VC history back to the original code.)

Submitted by:	Christian Kramer
Obtained from:	https://github.com/ckraemer/freebsd/tree/gsoc2018
Differential Revision:	https://reviews.freebsd.org/D27398
2020-12-12 18:34:15 +00:00
John-Mark Gurney
37d8e9a326 fix up documentation/comments: processname is not defined, but programname
is..

a couple other minor documentation fixes that igor caught...

MFC after:	1 week
2020-12-10 23:23:42 +00:00
Robert Wing
92f7309929 Add deprecation notice for bvmconsole and bvmdebug
Now that bhyve(8) supports UART, bvmconsole and bvmdebug are no longer needed.

Mark the '-b' and '-g' flag as deprecated for bhyve(8).

These will be removed in 13.

Reviewed by:    jhb, grehan
Approved by:    kevans (mentor)
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D27519
2020-12-10 18:07:25 +00:00
Edward Tomasz Napierala
b7a4380dd4 Make "diskinfo -i" also test 1MB reads. 2020-12-10 10:23:18 +00:00
Stefan Eßer
7483b9e4dc Lift scope of buf[] to make it extend to a potential access via *basename
It can be assumed that the contents of the buffer was still allocated and
valid at the point of the out-of-scope access, so there was no security
issue in practice.

Reported by:	Coverity Scan CID 1437697
MFC after:	3 days
2020-12-10 09:31:05 +00:00
Bryan Drewery
2dfa4b66b3 fts_read: Handle error from a NULL return better.
This is addressing cases such as fts_read(3) encountering an [EIO]
from fchdir(2) when FTS_NOCHDIR is not set.  That would otherwise be
seen as a successful traversal in some of these cases while silently
discarding expected work.

As noted in r264201, fts_read() does not set errno to 0 on a successful
EOF so it needs to be set before calling it.  Otherwise we might see
a random error from one of the iterations.

gzip is ignoring most errors and could be improved separately.

Reviewed by:	vangyzen
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D27184
2020-12-08 23:38:26 +00:00
Alex Richardson
f7ff7baaf6 crunchgen: fix NULL-deref bug introduced in r364647
While porting over the local changes from CheriBSD for upstreaming, I
accidentally committed a broken version of find_entry_point(): we have to
return NULL if the value is not found instead of a value with
ep->name == NULL, since the checks in main were changed to check ep instead
of ep->name for NULL.

This only matters if the crunched tool cannot be found using normal lookup
and one of the fallback paths is used, so it's unlikely to be triggered
in rescue. However, I noticed that one of our CheriBSD test scripts was
failing to run commands under `su` on minimal disk images where all
binaries are hardlinks to a `cheribsdbox` tool generated with crunchgen.

This also updates the bootstrapping check in Makefile.inc1 to bootstrap
crunchgen up to the next version bump.

Reviewed By:	kevans
Differential Revision: https://reviews.freebsd.org/D27474
2020-12-04 15:53:37 +00:00
Ed Maste
55e6cbc4d0 crashinfo: Add references to the gdb port/package
We intend to remove the obsolete GDB 6.1.1 from FreeBSD before FreeBSD 13.

Reviewed by	jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27447
2020-12-02 19:58:50 +00:00
Mark Johnston
ecce515d54 rtsold: Fix bugs reported by Coverity
- Avoid leaking a socket if llflags_get() fails.
- Avoid leaking a file handle if rtsold_init_dumpfile() fails.
- Tighten the check in if_nametosdl() which determines whether we failed
  to find the specified interface.
- Fix errno handling in an error path in rtsock_open().

MFC after:	1 week
2020-12-02 16:46:45 +00:00
Mark Johnston
f2fb8af155 rtsold: Fix multiple buffer overflows
Approved by:	so
Security:	CVE-2020-25577
MFC after:	now
2020-12-01 19:34:44 +00:00
Mitchell Horne
2e085395e1 efibootmgr: fix an incorrect error handling check
efivar_device_path_to_unix_path() returns standard error codes on
failure and zero on success. Checking for a return value less than zero
means that the actual failure cases won't be handled. This could
manifest as a segfault during the subsequent call to printf().

Reviewed by:	imp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D27424
2020-11-30 22:16:11 +00:00
John Baldwin
1b9c78611d Suspend I/O on ahci-cd devices during a snapshot.
Submitted by:	Vitaliy Gusev <gusev.vitaliy@gmail.com>
2020-11-28 04:21:22 +00:00
John Baldwin
bb481f6718 bhyve: Add snapshot support for virtio-rnd.
This uses the same snapshot routine as other VirtIO devices.

Submitted by:	Vitaliy Gusev <gusev.vitaliy@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D26265
2020-11-28 04:06:09 +00:00
John Baldwin
57b0a3aaca bhyve: 'xhci,tablet' snapshot fixes
Permit suspend/resume of a XHCI device model that has not been
attached to by a driver in a guest OS.

Submitted by:	Vitaliy Gusev <gusev.vitaliy@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D26264
2020-11-28 03:54:48 +00:00
Hajimu UMEMOTO
1def0a6257 fix casper initialization for setting scripts.
MFC after:	1 week
2020-11-27 18:40:51 +00:00
Rebecca Cran
866db2fef0 Fix bhyve SMBIOS type 19 handling to avoid misreporting total RAM amount
This fixes the amount of memory displayed in the EDK2 UiApp to be the same
as passed on the bhyve command line. Otherwise, 8GB is displayed as 4GB,
32GB as 28GB etc.

Reviewed by:	jhb, kib, rgrimes
Differential Revision:	https://reviews.freebsd.org/D27348
2020-11-27 08:00:32 +00:00
Rebecca Cran
5285d5e8e1 bhyve: fix smbiostbl.c style issues and add comment about date format
Fix a couple of style issues introduced in my previous commit.
Add a comment explaining that the SMBIOS specification defines the date
format to be mm/dd/yyyy, which is why we don't use ISO 8601.
2020-11-27 07:53:15 +00:00
Alan Somers
01f3f35447 ping: fix some man pages and tests after r368045
MFC-with:	r368045
2020-11-26 04:55:02 +00:00
John Baldwin
1925586e03 Honor the disabled setting for MSI-X interrupts for passthrough devices.
Add a new ioctl to disable all MSI-X interrupts for a PCI passthrough
device and invoke it if a write to the MSI-X capability registers
disables MSI-X.  This avoids leaving MSI-X interrupts enabled on the
host if a guest device driver has disabled them (e.g. as part of
detaching a guest device driver).

This was found by Chelsio QA when testing that a Linux guest could
switch from MSI-X to MSI interrupts when using the cxgb4vf driver.

While here, explicitly fail requests to enable MSI on a passthrough
device if MSI-X is enabled and vice versa.

Reported by:	Sony Arpita Das @ Chelsio
Reviewed by:	grehan, markj
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D27212
2020-11-24 23:18:52 +00:00
Edward Tomasz Napierala
64cecc7a75 Replace paths in ctladm(8) examples with something sensible.
PR:		251181
Reviewed by:	0mp, rm, ygy
MFC after:	2 weeks
Sponsored by:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D27249
2020-11-23 14:30:27 +00:00
Vincenzo Maffione
9fd3f663da netmap: valectl: switch to libnetmap
Use the newer libnetmap (included in base) rather than the older
nm_open()/nm_close() defined in netmap_user.h

MFC after:      3 days
2020-11-22 10:02:56 +00:00
Rick Macklem
9acc400b6e Update man page for new TLS export options.
NFS over TLS uses three new export options, added by r364979.
This patch updates the exports.5 man page for these new options.
Once assigned by IETF, "NNNN" will be replaced with the RFC number.

This is a content change.

Reviewed by:	gbe
Differential Revision:	https://review.freebsd.org/D26241
2020-11-20 22:14:51 +00:00
Gordon Bergling
d84134ba1c hostapd.conf(5): Add missing 'l'
In r367901 I accidentally deleted the 'l' while fixing a few
mandoc erros.

Spotted by: Yuri Pankov
2020-11-20 17:13:13 +00:00
Gordon Bergling
35a521b6bc moused(8): Fix a few mandoc warnings
- new sentence, new line
2020-11-20 17:04:49 +00:00
Gordon Bergling
26762c66e4 crashinfo(8): Fix a few mandoc warnings
- new sentence, new line
2020-11-20 16:59:51 +00:00
Gordon Bergling
7424766d75 hostapd.conf(5): Fix a mandoc warning
- new sentence, new line
2020-11-20 16:57:06 +00:00
Gordon Bergling
cbf541311c syslog.conf(5): Fix a few mandoc warnings
- new sentence, new line
- skipping paragraph macro: Pp at the end of Sh
2020-11-20 16:50:52 +00:00
Gordon Bergling
dbac569b41 snmp_wlan(3): Fix mandoc warnings
- new sentence, new line
2020-11-20 16:46:51 +00:00
Peter Grehan
887d46ef5b Advance RIP after userspace instruction decode
Add update to RIP after a userspace instruction decode (as is done for
the in-kernel counterpart of this case).

Submitted by:	adam_fenn.io
Reviewed by:	cem, markj
Approved by:	grehan (bhyve)
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D27243
2020-11-19 07:23:39 +00:00
Mariusz Zaborski
05e1e482c7 jail: introduce per jail suser_enabled setting
The suser_enable sysctl allows to remove a privileged rights from uid 0.
This change introduce per jail setting which allow to make root a
normal user.

Reviewed by:	jamie
Previous version reviewed by:	kevans, emaste, markj, me_igalic.co
Discussed with:	pjd
Differential Revision:	https://reviews.freebsd.org/D27128
2020-11-18 21:07:08 +00:00
Stefan Eßer
56d11d4a37 Make use of the getlocalbase() function for run-time adjustment of the
local software base directory, as committed in SVN rev. 367813.

The pkg and mailwrapper programs used the LOCALBASE environment variable
for this purpose and this functionality is preserved by getlocalbase().

After this change, the value of the user.localbase sysctl variable is used
if present (and not overridden in the environment).

The nvmecontrol program gains support of a dynamic path to its plugin
directory with this update.

Differential Revision:	https://reviews.freebsd.org/D27237
2020-11-18 20:00:55 +00:00
Warner Losh
30a56f9ef7 mergemaster: handle symbolic links during update.
/etc/os-release is now a symbolic link to a generated file. Make
mergemaster cope with symbolic links generically. I'm no longer
a big mergemaster user, so this has only been lightly tested
by me, though Kimura-san has ran it through its paces.

Submitted by: Yasushiro KIMURA-san
PR: 242212
MFC After: 2 weeks
2020-11-18 19:22:24 +00:00
Peter Grehan
2f40fc6ff3 Add legacy debug/test interfaces for kvm unit tests.
Implement the legacy debug/test interfaces expected by KVM-unit-tests'
realmode, emulator, and ioapic tests.

Submitted by:	adam_fenn.io
Reviewed by:	markj, grehan
Approved by:	grehan (bhyve)
MFC after:	3 weeks
Relnotes:	Yes
Differential Revision:	https://reviews.freebsd.org/D27130
2020-11-17 13:14:04 +00:00
Brooks Davis
73734d6eb1 Add missing includes of src.opts.mk
Without this "SUBDIR.${MK_TESTS}=tests" would always expand to
"SUBDIR.=tests" resulting in the tests not being built.

Sponsored by:	DARPA
2020-11-16 17:20:35 +00:00
Scott Long
8e1031086d Revert the whole getlocalbase() set of changes while a different design is
hashed out.
2020-11-15 20:24:59 +00:00
Peter Grehan
cd5b6d16ca Fix regression in AHCI controller settings.
When the AHCI code was reworked to use FreeBSD struct
definitions, the valid element was mis-transcribed resulting
in the UMDA capability being hidden. This prevented Illumos
from using AHCI disk/cdrom drives.

Fix by using definitions that match the code pre-rework.

PR:	250924
Submitted by:	Rolf Stalder
Reported by:	Rolf Stalder
MFC after:	3 days
2020-11-15 12:59:24 +00:00
Scott Long
1b249101df Fix the previous revision, it suffered from an incomplete change to the
getlocalbase API.  Also don't erroneously subtract the lenth from the
buffer a second time.
2020-11-15 07:50:29 +00:00
Scott Long
7ca0d5403e Replace hardcoded references to _PATH_LOCALBASE with calls to getlocalbase.3
Reviewed by:	imp, se
2020-11-14 18:01:14 +00:00
Mateusz Piotrowski
32f4592764 Document the PAGER environment variable
Sometimes users want to use freebsd-update(8) in a non-interactive way and
what they often miss is that they have to set PAGER to cat(1) in order to
avoid interactive prompts from less(1).

MFC after:	4 weeks
2020-11-14 13:07:41 +00:00
Rebecca Cran
a2fe464c81 bhyve: update smbiostbl.c to bump the version and release date
Since lots of work has been done on bhyve since 2014, increase the version
to 13.0 to match 13-CURRENT, and update the release date.

Reviewed by:	grehan
Differential Revision:	https://reviews.freebsd.org/D27147
2020-11-13 19:47:16 +00:00
Brandon Bergren
26869ad14c [PowerPC] Allow traversal of oversize OF properties.
In standards such as LoPAPR, property names in excess of the usual 31
characters exist.

This breaks property traversal.

While in IEEE 1275-1994, nextprop is defined explicitly to work with a
32-byte region of memory, using a larger buffer should be fine. There is
actually no way to pass a buffer length to the nextprop call in the OF
client interface, so SLOF actually just blindly overflows the buffer.

So we have to defensively make the buffer larger, to avoid memory
corruption when reading out long properties on live OF systems.

Note also that on real-mode OF, things are pretty tight because we are
allocating against a static bounce buffer in low memory, so we can't just
use a huge buffer to work around this without it being wasteful of our
limited amount of 32-bit physical memory.

This allows a patched ofwdump to operate properly on SLOF (i.e. pseries)
systems, as well as any other PowerPC systems with overlength properties.

Reviewed by:	jhibbits
MFC after:	2 weeks
Sponsored by:	Tag1 Consulting, Inc.
Differential Revision:	https://reviews.freebsd.org/D26669
2020-11-13 16:49:41 +00:00
Konstantin Belousov
038f5c7bfe bhyve: remove a hack to map all 8G BARs 1:1
Suggested and reviewed by:	grehan
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D27186
2020-11-12 02:52:01 +00:00
Konstantin Belousov
670b364b76 bhyve: increase allowed size for 64bit BAR allocation below 4G from 32 to 128 MB.
Reviewed by:	grehan
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D27095
2020-11-12 00:51:53 +00:00
Konstantin Belousov
9922872ba2 bhyve: avoid allocating BARs above the end of supported physical addresses.
Read CPUID leaf 0x8000008 to determine max supported phys address and
create BAR region right below it, reserving 1/4 of the supported guest
physical address space to the 64bit BARs mappings.

PR:    250802 (although the issue from PR is not fixed by the change)
Noted and reviewed by:	grehan
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D27095
2020-11-12 00:46:53 +00:00
Olivier Cochard
c4fd0cc9ee Return the same value for smbios.chassis.maker as smbios.system.maker (and prevents returning a space character).
Reviewed by:	grehan
Approved by:	grehan
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D27123
2020-11-08 07:49:39 +00:00
Cy Schubert
ce558a3f33 Fix build post-r367455.
MFC after:	2 weeks
X-MFC with:	r367455
2020-11-07 19:17:37 +00:00
Bryan Drewery
9470af395f syslogd: Stop trying to send remote messages through special sockets
Specifically this was causing the /dev/klog fd and the signal pipe
handling fd to get a sendmsg(2) called on them and always returned
[ENOTSOCK].

r310350 combined these sockets into the main socket list and properly
skipped AF_UNSPEC at the sendmsg(2) call but later in r344739 it was
broken such that these special sockets were no longer excluded since
the AF_UNSPEC check specifically excluded these special sockets. Only
these special sockets have sl_sa = NULL. The sl_family checks should
be redundant now but are left in case of future changes so the intent
is clearer.

MFC after:	2 weeks
2020-11-07 17:18:44 +00:00
Robert Wing
3701068b5d Add a periodic script to backup output generated from gmirror list.
Disabled by default.

PR:             86388
Submitted by:   Miroslav Lachman <000.fbsd@quip.cz>
Reviewed by:    allanjude, gbe
Approved by:    allanjude (mentor)
MFC after:      4 weeks
Event:          July 2020 Bugathon
Differential Revision:  https://reviews.freebsd.org/D25631
2020-11-07 04:15:24 +00:00
Kyle Evans
2c5e865059 binmiscctl(8): miscellaneous cleanup
- Bad whitespace in Makefile.
- Reordered headers, sys/ first.
- Annotated fatal/usage __dead2 to help `make analyze` out a little bit.
- Spell a couple of sizeof constructs as "nitems" and "howmany" instead.

MFC after:	1 week
2020-11-07 03:43:45 +00:00
Robert Wing
eefe831eaf Add a periodic script to backup output generated from zfs list, zfs get,
`zpool list`, and `zpool get` commands.

Disabled by default.

PR:             86388
Submitted by:   Miroslav Lachman <000.fbsd@quip.cz>
Reviewed by:    allanjude, 0mp
Approved by:    allanjude (mentor)
MFC after:      4 weeks
Event:          July 2020 Bugathon
Differential Revision:  https://reviews.freebsd.org/D25638
2020-11-06 22:58:31 +00:00
John-Mark Gurney
e771d59074 fix up docs, if signature checking is enabled, the file MUST exist... 2020-11-06 22:11:05 +00:00
Allan Jude
cc3568c1d0 VirtIO: Make sure the guest knows the TRIM alignment requirements
If bhyve is used to emulate 512e access in guest OS, then discard addresses should be properly aligned.
Otherwise ioctl DIOCGDELETE fails for 512b requires on devices with 4K sector size.
see g_dev_ioctl() in sys/geom/geom_dev.c

Submitted by:	Vitaliy Gusev <gusev.vitaliy@gmail.com>
MFC after:	1 week
Sponsored by:	vStack.com
Differential Revision:	https://reviews.freebsd.org/D27075
2020-11-05 17:10:14 +00:00
Mateusz Piotrowski
d3231fbdd2 pmcstat: Fix a typo in the usage message
Reviewed by:	emaste
Approved by:	emaste
Differential Revision:	https://reviews.freebsd.org/D26082
2020-11-04 15:44:59 +00:00
Alex Richardson
d24f17df96 Fix bad libbxo format strings in jls
The existing format string for the empty case was trying to read varargs
values that weren't passed to xo_emit. This appears to work on x86 (since
the next argument is probably a pointer an empty string), but for CHERI
we can bound variadic arguments and detect a read past the end.

While touching these lines also use the libxo 'a' modifier to avoid having to
construct the libxo format string using asprintf.

Found by:	CHERI
Reviewed By:	allanjude
Differential Revision: https://reviews.freebsd.org/D26885
2020-11-04 14:31:52 +00:00
Adrian Chadd
e72a100b79 [ctld] Fix compilation under gcc-6.4
* remove dup yylex symbol; already defined in a header file
* uint64_t is always >= 0

Reviewed by:	cem, imp
Differential Revision:	https://reviews.freebsd.org/D27046
2020-11-01 21:18:21 +00:00
Olivier Cochard
ac8f506b85 bhyve currently reports each of "smbios.system.maker" and
"smbios.system.family" as " ".
This presents challenges for both humans and tools when trying to parse output
that uses those results.
The new values reported are now:
smbios.system.family="Virtual Machine"
smbios.system.maker="FreeBSD"

PR:		250728
Approved by:	grehan@FreeBSD.org
Sponsored by:	Netflix
2020-10-30 00:03:59 +00:00
Edward Tomasz Napierala
bce7ee9d41 Drop "All rights reserved" from all my stuff. This includes
Foundation copyrights, approved by emaste@.  It does not include
files which carry other people's copyrights; if you're one
of those people, feel free to make similar change.

Reviewed by:	emaste, imp, gbe (manpages)
Differential Revision:	https://reviews.freebsd.org/D26980
2020-10-28 13:46:11 +00:00
Cy Schubert
c0caa2e24e MFV r367082:
Update unbound 1.11.0 --> 1.12.0.

MFC after:	1 month.
2020-10-27 23:03:15 +00:00
Stefan Eßer
1f474190fc Replace literal uses of /usr/local in C sources with _PATH_LOCALBASE
Literal references to /usr/local exist in a large number of files in
the FreeBSD base system. Many are in contributed software, in configuration
files, or in the documentation, but 19 uses have been identified in C
source files or headers outside the contrib and sys/contrib directories.

This commit makes it possible to set _PATH_LOCALBASE in paths.h to use
a different prefix for locally installed software.

In order to avoid changes to openssh source files, LOCALBASE is passed to
the build via Makefiles under src/secure. While _PATH_LOCALBASE could have
been used here, there is precedent in the construction of the path used to
a xauth program which depends on the LOCALBASE value passed on the compiler
command line to select a non-default directory.

This could be changed in a later commit to make the openssh build
consistently use _PATH_LOCALBASE. It is considered out-of-scope for this
commit.

Reviewed by:	imp
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D26942
2020-10-27 11:29:11 +00:00
Ed Maste
f98cf03166 mergemaster: Clarify installed and updated versions
Describe "diff installed new" as "Displaying differences between
installed and new."  Previously mergemaster described them in the
opposite order.

PR:		249214
Reported by:	Yuri Victorovich
MFC after:	2 weeks
2020-10-25 18:06:45 +00:00
Rick Macklem
f93c028ac9 Update man page for -R option added by r376026.
This is a content change.

Reviewed by:	bcr
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D26746
2020-10-24 22:52:29 +00:00
Rick Macklem
bde6f938bf Add "-R" option to tell mountd to not register with rpcbind.
rpcbind is now considered a security risk for some sites.
Since an NFSv4 only NFS server does not need rpcbind,
it makes sense to have an option that implements this.

This patch adds a "-R" option that disables the Mount
protocol (not used by NFSv4) and does not register
with rpcbind.

Changes are required to /etc/rc.d/mountd and /etc/rc.d/nfsd.
Those will be in a separate commit.

Reviewed by:	freqlabs, asomers
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D26746
2020-10-24 22:48:28 +00:00
Richard Scheffenegger
ea8f1280a2 Add network QoS support for PCP to iscsi target.
Mak the Ethernet PCP codepoint configurable
for L2 local traffic, to allow lower latency for
iSCSI block IO. This addresses the target
side only.

Reviewed by:	mav, trasz, bcr
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26740
2020-10-24 21:10:53 +00:00
Richard Scheffenegger
4dfbcffbb9 Add network QoS support for PCP to iscsi initiator.
Make the Ethernet PCP codepoint configurable
for L2 local traffic, to allow lower latency for
iSCSI block IO. This addresses the initiator
side only.

Reviewed by:	mav, trasz, bcr
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26739
2020-10-24 21:07:13 +00:00
Mark Johnston
a792802f2b rtsold: Remove an incorrect __unused annotation
MFC after:	1 week
2020-10-23 14:56:17 +00:00
Alexander Motin
7dbbd1aeae Negotiate iSCSIProtocolLevel of 2 (RFC 7144) in initiator.
It does not change anything immediately, but allows further support of
Command Priority, Status Qualifier and new task management functions.

MFC after:	1 month
Sponsored by:	iXsystems, Inc.
2020-10-22 20:26:27 +00:00
Gordon Bergling
ad5e10ec0c stablerestart(5): Fix some issues reported by mandoc
- New sentence, new line
2020-10-22 19:25:01 +00:00
Gordon Bergling
1f57220934 pnfsserver(4): Fix some issues reported by mandoc
- new sentence, new line
2020-10-22 19:19:42 +00:00
Ryan Moeller
b8adbe1c15 efibootmgr: Use returned error code for error message, not errno
efivar_unix_path_to_device_path returns the error code, it does not set errno.

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D26852
2020-10-19 10:38:40 +00:00
Baptiste Daroussin
ae659caa0a Use asprintf instead of sbuf 2020-10-19 07:26:42 +00:00
Ryan Moeller
60dc6bee1f bhyve: Update TX descriptor base address and host mapping on change
bhyve sometimes segfaults when using an e1000 NIC with a Windows guest.

We are only updating our tdba and cached host mapping when the low address
register is written and when tx is set enabled, but not when the high address
or length registers are written. It is observed that Windows 10 is occasionally
enabling tx first then writing the registers in the order low, high, len. This
leaves us with a bogus base address and mapping, which causes a segfault later
when we try to copy from a descriptor that has unpredictable garbage in a
pointer.

Updating the address and mapping when any of those registers change seems to fix
that particular issue.

Reviewed by:	mav, grehan (bhyve)
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D26798
2020-10-16 20:27:20 +00:00
Jessica Clarke
a98fa52ec6 kldxref: Avoid buffer overflows in parse_pnp_list
We convert a string like "W32:vendor/device" into "I:vendor;I:device",
where the output is longer than the input, but only allocate space equal
to the length of the input, leading to a buffer overflow.

Instead use open_memstream so we get a safe dynamically-grown buffer.

Found by:	CHERI
Reviewed by:	imp, jhb (mentor)
Approved by:	imp, jhb (mentor)
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D26637
2020-10-15 18:03:14 +00:00
Adrian Chadd
5c3bf25fee [traceroute6] Don't do the casper bits when we're not doing casper
This with the previous patch I committed makes traceroute6/traceroute
compile fine when libcasper isn't enabled.

This complains strongly with unused variables and such when compiled
with gcc-6 on mips32.

Tested:

* compiled/run on mips32 hardware (AR9344)

Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D26773
2020-10-14 00:01:17 +00:00
Robert Wing
915dcdb7ac ctl.conf(5): fix LUN size in UCL format example.
Remove quotes around size in the LUN section and change the suffix to 'GB'. The
UCL format does recognize 'G' on its own, which uses a base 10 multiplier where
'GB' uses a 2 power multiplier.

Document the difference between valid suffixes when using ctl.conf(5) in the
general syntax form or in UCL format.

Reviewed by:    kevans, mav
Approved by:    kevans (mentor)
Differential Revision: https://reviews.freebsd.org/D26716
2020-10-13 18:00:23 +00:00
Gordon Bergling
7f78912159 pnfsdsfile(8): Remove dublicate word 'the'
MFC after:	1 week
2020-10-10 14:38:01 +00:00
Gordon Bergling
2911dc6cea cxgbetool(8): Remove dublicate word 'whether'
MFC after:	1 week
2020-10-10 14:36:16 +00:00
Rick Macklem
2ffad162f3 Modify mountd.c so that it does not always malloc 4K for the map credentials.
r362163 upgraded mountd so that it could handle MAX_NGROUPS
groups for the anonymous user credentials (the ones provided by
-maproot and -mapall exports options).
The problem is that this resulted in every export structure growing by
about 4Kbytes, because the cr_groups field went from 16->MAX_NGROUPS.

This patch fixes this by only including a small 32 element cr_groups in the
structure and then malloc()'ng cr_groups when a larger one is needed.
The value of SMALLNGROUPS is arbitrarily set to 32, assuming most users
used by -maproot or -mapall will be in <= 32 groups.

Reviewed by:	kib, freqlabs
Differential Revision:	https://reviews.freebsd.org/D26521
2020-10-10 00:01:40 +00:00
Gordon Bergling
3d265fce43 Fix a few mandoc issues
- skipping paragraph macro: Pp after Sh
- sections out of conventional order: Sh EXAMPLES
- whitespace at end of input line
- normalizing date format
2020-10-09 19:12:44 +00:00
Mark Johnston
b0eefff78b syslogd: Avoid trimming host names in RFC 5424 mode
RFC 5424 says that implementations should log hostnames in FQDN
format.  Only trim host names in RFC 3164 mode.

PR:		250014
Submitted by:	Dmitry Wagin <dmitry.wagin@ya.ru>
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D26644
2020-10-09 15:19:29 +00:00
Richard Scheffenegger
bfabdade5c Add DSCP support for network QoS to iscsi initiator.
Allow the DSCP codepoint also to be configurable
for the traffic in the direction from the initiator
to the target, such that writes and any requests
are also treated in the appropriate QoS class.

Reviewed by:	mav
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26714
2020-10-09 14:33:09 +00:00
Gordon Bergling
6d6d6c3603 Fix a few mandoc issues
- no blank before trailing delimiter
- whitespace at end of input line
- sections out of conventional order
- normalizing date format
- AUTHORS section without An macro
2020-10-09 14:03:45 +00:00
Warner Losh
c6d56081c9 Initial support for implementing the bootXXX.efi workaround
Too many version of UEFI firmware (so far only confirmed on amd64)
don't really support efibootmgr selection of boot. That's the most
reliable, when it works, since there's no guesswork. However, many do
not save, unmolested, the variables that efibootmgr sets, so as a
fallback we also install loader.efi as bootXXX.efi (where XXX is
either aa64 or x64) if it doesn't already exist in /efi/boot on the
ESP. The standard only defines this for removable devices, but it's
almost ubiquitously used as a fallback. Many BIOSes implement a drive
selection feature that takes over the efibootmgr protocol, rendinering
it useless (either generally, or for those vendors not on the short
list). bootxxx.efi works around this. However, we don't install it
unconditionally there, as that breaks some popular multi-boot setups.

MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D26428
2020-10-09 00:16:26 +00:00
Conrad Meyer
cc71ff7234 bhyveload(8): Implement loader_callbacks::diskwrite
The method was optional prior to r365938, which made it mandatory but did add
any test that an implementation provides the method nor implement it for
bhyveload.  The code path might not be hit unless the user's loader was
configured to write to a file on disk, such as with nextboot(8).

Reviewed by:	grehan, tsoome
Approved by:	bhyve
X-MFC-With:	r365938
Differential Revision:	https://reviews.freebsd.org/D26710
2020-10-07 20:31:13 +00:00
Kyle Evans
9c7bd4f198 crunchgen: fix MK_AUTO_OBJ logic after r364166
r364166 converted echo -n `/bin/pwd` to a raw pwd invocation, leaving a
trailing newline at the end of path.  This caused a later stat() of it to
erroneously fail and the fallback to MK_AUTO_OBJ=no logic proceeded as
unexpected.

Harry Schmalzbauer bissected the resulting build failure he experienced
(stable/12 host, -HEAD build) down to r365887. This change is mostly
unrelated, except it switches the build to bootstrapped crunchgen - clue!

I then bissected recent crunchgen changes going back a bit since we wouldn't
observe the failure immediately with -CURRENT in most configurations, which
landed me on r364166. After many intense head-scratching minutes and printf
debugging, I realized that the newline was the difference. This is where our
tale ends.

Reported by:	Harry Schmalzbauer, O. Hartmann, Mike Tancsa, kevans
MFC after:	3 days
2020-10-05 20:57:44 +00:00
Kyle Evans
8073c947c7 ngctl: add -c (compact output) for the dot command
The output of "ngctl dot" is suitable for small netgraph networks. Even
moderate complex netgraph setups (about a dozen nodes) are hard to
understand from the .dot output, because each node and each hook are shown
as a full blown structure.

This patch allows to generate much more compact output and graphs by
omitting the extra structures for the individual hooks. Instead the names of
the hooks are labels to the edges.

Submitted by:	Lutz Donnerhacke <lutz_donnerhacke.de>
Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21965
2020-10-04 17:07:13 +00:00
Jakub Wojciech Klama
100353cfbf Add virtio-9p (aka VirtFS) filesystem sharing to bhyve.
VirtFS allows sharing an arbitrary directory tree between bhyve virtual
machine and the host. Current implementation has a fairly complete support
for 9P2000.L protocol, except for the extended attribute support. It has
been verified to work with the qemu-kvm hypervisor.

Reviewed by:	rgrimes, emaste, jhb, trasz
Approved by:	trasz (mentor)
MFC after:	1 month
Relnotes:	yes
Sponsored by:	Conclusive Engineering (development), vStack.com (funding)
Differential Revision:	https://reviews.freebsd.org/D10335
2020-10-03 19:05:13 +00:00
Edward Tomasz Napierala
ba2548b7bf Don't ignore the return value from gethostname(3). It probably
cannot happen, but it silences Coverity.

Reviewed by:	mav
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26606
2020-10-01 18:56:44 +00:00
John Baldwin
6f64e4f361 bhyve: Fix build with option BHYVE_SNAPSHOT
'ident' was replaced with 'ata_ident' in revision r363596.

Submitted by:	Vitaliy Gusev <gusev.vitaliy_gmail.com>
Reviewed by:	Darius Mihai
Differential Revision:	 https://reviews.freebsd.org/D26263
2020-10-01 17:16:05 +00:00
Alexander Leidinger
32fd57a8e1 Remove nfsstat. Running nfsstat in crashinfo will give the stats of the
running kernel instead of the stats of the crashed kernel. The current
version uses sysctls to query the stats and does not work at all (anymore)
on crash dumps.
2020-10-01 08:57:36 +00:00
Kyle Evans
7cc42f6d25 Do a sweep and remove most WARNS=6 settings
Repeating the default WARNS here makes it slightly more difficult to
experiment with default WARNS changes, e.g. if we did something absolutely
bananas and introduced a WARNS=7 and wanted to try lifting the default to
that.

Drop most of them; there is one in the blake2 kernel module, but I suspect
it should be dropped -- the default WARNS in the rest of the build doesn't
currently apply to kernel modules, and I haven't put too much thought into
whether it makes sense to make it so.
2020-10-01 01:10:51 +00:00
Konstantin Belousov
96128185f6 pciconf: print PCIe CTL max read request.
To not complicate existing parsers, the value is printed on a new
output line.

Sponsored by:	Mellanox Technologies/NVIDIA Networking
MFC after:	1 week
2020-09-30 21:12:14 +00:00
Richard Scheffenegger
64ffe6d440 Add DSCP support for network QoS to iscsi target.
In order to prioritize iSCSI traffic across a network,
DSCP can be used. In order not to rely on "ipfw setdscp"
or in-network reclassification, this adds the dscp value
directly to the portal group (where TCP sessions are accepted).

The incoming iSCSI session is first handled by ctld for any
CHAP authentication and the socket is then handed off to the
in-kernel iscsi driver without modification of the socket
parameters. Simply setting up the socket in ctld is sufficient
to keep sending outgoing iSCSI related traffic with the
configured DSCP value.

Reviewed by:	mav, trasz
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26385
2020-09-27 21:43:19 +00:00
Niclas Zeising
ce5ab9661f bsdconfig, bsdinstall: Prune dead mirrors
Prune dead mirrors from the list of mirrors in bsdconfig and bsdinstall.
All these return NXDOMAIN when trying to resolve them.

Reviewed by:	emaste
Approved by:	emaste
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D26535
2020-09-26 16:27:09 +00:00
Warner Losh
f9f298a2f4 Comment out bogus command line entry
Linux implements -d to mean --print-decimal. We don't implement that
and use -d for --device-path. Note that.
2020-09-25 18:20:45 +00:00
Warner Losh
66c613905f Tweak output of the loader variable
When the DEVICE_PATH is <= 4 that means it's effectively empty. I have
a laptop that has a BIOS that likes to generate these:

8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot2001
0000: 01 00 00 00 04 00 45 00 46 00 49 00 20 00 55 00
0010: 53 00 42 00 20 00 44 00 65 00 76 00 69 00 63 00
0020: 65 00 00 00 7f ff 04 00 52 43

which now decodes as
8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot2001
* EFI USB Device
Empty path
Option:
0000: 52 43

which matches my hand-decode.

Add an extra newline after Option: to make it look nice.

I suspect that these entries really should be VenHw entries instead,
but my ability to change that is NIL, so cope with them as best we can.

efibootmgr(8)'s output is fine and doesn't need adjusting.
2020-09-25 18:20:41 +00:00
Andriy Gapon
a4f28d4296 pwm(8): fix potential duty overflow, use unsigneds for period and duty
For a long period value and the duty specified as a percentage,
there could be an overflow.
Using unsigned integers aligns the code with struct pwm_state and allows
to safely use periods up to 4 seconds where supported by drivers.

MFC after:	2 weeks
2020-09-25 07:55:08 +00:00
Andriy Gapon
31b0753da3 pwm(8): do not exit with failure after successfully reading configuration
MFC after:	1 week
2020-09-25 07:54:38 +00:00
Maxim Sobolev
dffc6929bf Fix a typo in the 366098.
Reported by:	0mp
MFC after:	2 weeks
		(along with 366098)
2020-09-24 19:12:03 +00:00
Maxim Sobolev
4cd407ec93 dd a new option (-H) to daemon(8) to catch SIGHUP and re-open output_file file when
received.

The default system log rotation mechanism (newsyslog(8)) requires ability to send
signal to a daemon in order to properly complete rotation of the logs in an "atomic"
manner without having to making a copy and truncating original file. Unfortunately
our built-in mechanism to convert "dumb" programs into daemons has no way to handle
this rotation properly. This change adds this ability, to be enabled by supplying -H
option in addition to the -o option.

Reviewed by:	markj, rpokala (manpages)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D26526
2020-09-24 02:44:58 +00:00
Brandon Bergren
ab2032371e [PowerPC] Fix multiple ntp configuration issues
* powerpc time_t is 64 bit, not 32 bit.

* Add definition for powerpc64le.

With this, powerpc64le ntpd and ntpdate operate correctly instead of
corrupting the clock and exiting.

Tested on powerpc64, powerpc64le, and powerpc.

No feedback from cy@.

I am a bit confused as to how SIZEOF_TIME_T being wrong ever worked on
powerpc, it being big endian and all.

Sponsored by:	Tag1 Consulting, Inc.
Differential Revision:	https://reviews.freebsd.org/D26379
2020-09-23 02:37:27 +00:00
Adrian Chadd
0dcdda0984 [rcorder] [crunch] Fix C function declarations to include void
This fixes a compile issue under gcc6 which complains about
legacy style C function declarations.

Differential Revision:	https://reviews.freebsd.org/D26504
2020-09-21 17:59:45 +00:00
Colin Percival
9a63bbc93e Move finalize_components_config from get_params to cmd_*.
This allows us to redirect its output in cmd_cron, so that the
"src component not installed, skipped" message will be treated
the same way as other output from freebsd-update cron: Sent
in an email to root (or other address specified) if there are
updates to install, and silenced otherwise.

PR:		202492
MFC After:	1 week
Differential Revision:	https://reviews.freebsd.org/D26432
2020-09-19 02:15:56 +00:00
Kyle Evans
fe815331bb build: provide a default WARNS for all in-tree builds
The current default is provided in various Makefile.inc in some top-level
directories and covers a good portion of the tree, but doesn't cover parts
of the build a little deeper (e.g. libcasper).

Provide a default in src.sys.mk and set WARNS to it in bsd.sys.mk if that
variable is defined. This lets us relatively cleanly provide a default WARNS
no matter where you're building in the src tree without breaking things
outside of the tree.

Crunchgen has been updated as a bootstrap tool to work on this change
because it needs r365605 at a minimum to succeed. The cleanup necessary to
successfully walk over this change on WITHOUT_CLEAN builds has been added.

There is a supplemental project to this to list all of the warnings that are
encountered when the environment has WARNS=6 NO_WERROR=yes:
https://warns.kevans.dev -- this project will hopefully eventually go away
in favor of CI doing a much better job than it.

Reviewed by:	emaste, brooks, ngie (all earlier version)
Reviewed by:	emaste, arichardson (depend-cleanup.sh change)
Differential Revision:	https://reviews.freebsd.org/D26455
2020-09-18 17:17:46 +00:00
Peter Grehan
285e35e6f1 Fix byte-reversal of language ID in string descriptor.
The language id of String Descriptors in usb mouse is
0x0904, while the spec require 0x0409 (English - United States)

Submitted by:	Wanpeng Qian
Reviewed by:	grehan
Approved by:	grehan (#bhyve)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D26472
2020-09-18 05:54:59 +00:00
Kyle Evans
9ed054096d Revert r361257: bsdinstall: do a certctl rehash upon installation [...]
As of r365829, any given base distribution set will now include the /etc/ssl
symlinks that this rehash would've otherwise installed. This extra step is
no longer required.

MFC after:	1 week
X-MFC-With:	r365837
2020-09-17 20:35:45 +00:00
Ed Maste
53d8e037b1 makefs: connect cd9660 El Torito EFI boot image system type
Sponsored by:	The FreeBSD Foundation
2020-09-17 19:41:10 +00:00
John Baldwin
edd1bf93b3 Remove no longer used variable.
Pointy hat to:	jhb
Reported by:	kevans
MFC after:	1 week
2020-09-17 18:06:57 +00:00
John Baldwin
ff2cf94674 Remove support for setting some obscure fields.
Don't permit setting the exception bitmap or VMCS entry interrupt
information.  These are not generally useful to set.  If it is needed
in the future, dedicated pseudo registers can be added for these that
would be used with vm_set_register().

Discussed with:	grehan
MFC after:	1 week
2020-09-17 17:07:04 +00:00
Kyle Evans
9e9d3e134b certctl: fix unprivileged mode
The first issue was lack of quoting around INSTALLFLAGS, which set it
incorrectly and produced an error on -M.

The second issue was that we weren't actually doing the install in
unprivileged mode, making it effectively useless. This was designed to pass
through the proper metalog/unpriv flags to install(1), so just let it
happen.

MFC after:	3 days
2020-09-15 17:13:29 +00:00
Michael Tuexen
c70906519a Add a -t option to traceroute6 to control the traffic class used when
sending probe packets.

Reviewed by:		rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D26410
2020-09-13 09:00:00 +00:00
Michael Tuexen
3303e9bc22 Fix the length of probe packets when using UDP.
Since https://svnweb.freebsd.org/changeset/base/365378 a raw socket is
used for sending UDP probe packets instead of a UDP socket. So don't
compensate for the UDP header anymore.
2020-09-12 11:24:36 +00:00
Michael Tuexen
2d0fb1b3c1 Simplify code, no functional change.
Since https://svnweb.freebsd.org/base?view=revision&revision=365378
UDP is handled the same way as SCTP and TCP (using a raw socket).
Therefore use the same code path.
2020-09-12 11:19:54 +00:00
Kyle Evans
ecebb3cc1d Only set WARNS if not defined
This would allow interested parties to do experimental runs with an
environment set appropriately to raise all the warnings throughout the
build; e.g. env WARNS=6 NO_WERROR=yes buildworld.

Not currently touching the numerous instances in ^/tools.

MFC after:	1 week
2020-09-11 13:28:37 +00:00
Kyle Evans
fc90521002 crunchgen(8): fix crunched application build with WARNS=6
This was revealed by the rescue build with a patch I'm working on to default
WARNS=6 everywhere. The issues resolved were:

- Missing prototype for _crunched_${ident}_stub in the *_stub.c generated
  bits
- Missing prototype for crunched_main
- Incomplete prototype for _crunched_${ident}_stub in the generated parts of
  crunched_main
- Literal strings in the stub table must drop const qualifier, unless we
  const'ify name
- f field in struct stub didn't have a proper prototype

Most of these issues are minor formalities and easily addressed.

I note that if my patch to eventually raise WARNS for the rescue build
lands, we'll need to bump the __FreeBSD_version requirement for
bootstrapping crunchgen and wipe out the rescue .OBJDIR if it's stale, which
we should be able to detect pretty easily from a couple of the issues that
have been fixed here.

Reviewed by:	arichardson
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D26363
2020-09-10 18:19:45 +00:00
Robert Wing
37d72a9177 periodic.conf(5): don't truncate interface names reported by 420.status-network.
The daily periodic script, 420.status-network uses netstat(1) to report
interface status. By default, netstat(1) truncates interface names.

Add the '-W' flag (avoid truncating interface names) as the default for
'daily_status_network_netstat_flags' in periodic.conf(5).

The default 420.status-network command is now 'netstat -i -d -W -n'.

PR:     163572
Reported by: kes-kes@yandex.ru
Reviewed by: allanjude (mentor) bcr (manpages)
Approved by: allanjude (mentor)
MFC after:  1 week
Differential Revision:  https://reviews.freebsd.org/D26023
2020-09-09 19:07:34 +00:00
Kyle Evans
05a16147fb certctl: fix hashed link generation with duplicate subjects
Currently, certctl rehash will just keep clobbering .0 rather than
incrementing the suffix upon encountering a duplicate. Do this, and do it
for blacklisted certs as well.

This also improves the situation with the blacklist to be a little less
flakey, comparing cert fingerprints for all certs with a matching subject
hash in the blacklist to determine if the cert we're looking at can be
installed.

Future work needs to completely revamp the blacklist to align more with how
it's described in PR 246614. In particular, /etc/ssl/blacklisted should go
away to avoid potential confusion -- OpenSSL will not read it, it's
basically certctl internal.

PR:		246614
Reviewed by:	Michael Osipov <michael.osipov siemens com>
Tested by:	Michael Osipov
With suggestions from:	Michael Osipov
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D26167
2020-09-09 09:08:09 +00:00
Kyle Evans
6703731d6e phttpget: move out of portsnap
Currently, WITHOUT_PORTSNAP forces WITHOUT_FREEBSD_UPDATE because the
latter relies on phttpget, which lives inside the portsnap build bits.

Remove the dependency between these two options by moving phttpget out into
^/libexec and building/installing it if either WITH_PORTSNAP or
WITH_FREEBSD_UPDATE.

Future work could remove the conditional if it's decided that users will use
it independently of either the current in-base consumers.

Reported by:	swills
Reviewed by:	jilles, emaste
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D26255
2020-09-09 00:39:47 +00:00
Ed Maste
7cccb910b2 ntp: whitespace and typo fix in conf file
PR:		248942
Submitted by:	Jose Luis Duran (whitespace), igor (typo)
MFC after:	1 week
2020-09-07 17:19:31 +00:00
Mariusz Zaborski
35f8045f55 Remove duplicated line.
Reported by:	lwhsu
2020-09-06 15:44:09 +00:00
Mariusz Zaborski
cc432e237c traceroute6: capsicumize it
Submitted by:	Shubh Gupta <shubh@freebsd.org>
Sponsored by: Google (GSOC 2020)
Differential Revision:	https://reviews.freebsd.org/D25604
2020-09-06 14:04:02 +00:00
Stephen J. Kiernan
291124e3c0 Avoid collisions with function names in openssl headers.
Just using MD5, SHA1, RMD160 and SHA256 for defines collides with
functions of the same name in OpenSSL. This can cause compilation
issues in downstream consumers if they use OpenSSL for the hash
functions instead of libmd.

Reviewed by:	sjg
Obtained from:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D26321
2020-09-04 04:31:56 +00:00
Eric van Gyzen
2e47aedf86 pmc: Fix freed internal location read
Coverity detected this error.  The fix duplicates the assignment on line 171.

Submitted by:	bret_ketchum@dell.com
Reported by:	Coverity
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D26227
2020-09-01 15:52:18 +00:00
Mark Johnston
645c2851e2 pw: Handle errors from ftell() when removing records from /etc/opiekeys.
Reported by:	Coverity
MFC after:	1 week
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
2020-09-01 15:15:09 +00:00
Mark Johnston
7a82cf511d pw: Fix a resource leak.
Reported by:	Coverity
MFC after:	1 week
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
2020-09-01 15:14:51 +00:00
Mark Johnston
45bfd3158c pw: Remove unnecessary errp checks.
The caller-supplied pointer is unconditionally dereferenced at the
beginning of the function, so there is no point in comparing it with
NULL thereafter.

Reported by:	Coverity
MFC after:	1 week
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
2020-09-01 15:14:26 +00:00
Mark Johnston
79c8ad8368 pw: Fix terminal handling when setting a group password.
Reported by:	Coverity
MFC after:	1 week
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
2020-09-01 15:14:13 +00:00
Edward Tomasz Napierala
e352957180 Make sure not to pass NULL to strtoul(3). The values come
from the kernel, but let's try to be on the safe side.

Reviewed by:	mav
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26246
2020-09-01 14:58:57 +00:00
Edward Tomasz Napierala
5d9b05ac30 Fix string overflow that could occur during redirection due to passing
the wrong length to strlcpy(3). It looks like it could overflow into
the next field, isc_user, which is properly long to accomodate for it;
I don't think it could cause any harm other than breaking the connection.

Reviewed by:	mav
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26247
2020-09-01 14:52:35 +00:00
Rick Macklem
813837bade Add support for the NFS over TLS exports to mountd.
Three new export flags are added to mountd that will restrict exported
file system mounts to use TLS.  Without these flags, TLS is allowed, but not
required.

The exports(5) man page will be updated in a future commit.
2020-08-30 21:21:58 +00:00
Jamie Gritton
0eb6603f6b Disregard jails in jail.conf that have bad parameters (parameter/variable
clash, or redefining name/jid).  The current behvaior, of merely warning
and moving on, can lead to unexpected behavior when a jail is created
without the offending parameter defined at all.
2020-08-27 17:04:55 +00:00
Jamie Gritton
bb4ec28922 Don't allow jail.conf variables to have the same names as jail parameters.
It was already not allowed in many cases, but crashed instead of giving an
error.

PR:		248444
2020-08-27 00:17:17 +00:00
Jamie Gritton
48c376a6f1 Back out r364791 to unbreak jails. Lesson learned: "compile and test" means
running the test on the same executable that you just compiled.

PR:		248444
Pointy hat to:	jamie
2020-08-26 18:35:32 +00:00
Toomas Soome
b95807751a efibootmgr: wrong check for opts.order
opts.order && !(opts.order) does not really make sense.

Reported by:	swildner
2020-08-26 14:02:38 +00:00
D Scott Phillips
83c4237258 efibootmgr: Add option to request booting to the firmware user interface
The OsIndications UEFI variable can request the firware to stop at
its UI instead of continuing with boot. Add flags for setting and
clearing this request.

Reviewed by:	manu, bcr (manpages)
Approved by:	scottl (implicit)
MFC after:	1 week
Sponsored by:	Ampere Computing, Inc.
Differential Revision:	https://reviews.freebsd.org/D25839
2020-08-26 02:05:58 +00:00
Jamie Gritton
177b077e57 Handle jail.conf variables that have the same names as parameters.
PR:		248444
Submitted by:	Akos Somfai
Reported by:	Markus Stoff
2020-08-26 00:42:59 +00:00
Ryan Moeller
60403b98b9 bsdinstall: Update loader.conf for new OpenZFS deps
zfs.ko now includes the SPL but relies on cryptodev instead.

Reported by:	D Scott Phillips
Sponsored by:	iXsystems, Inc.
2020-08-25 21:07:27 +00:00
Bjoern A. Zeeb
60e7f66931 rtsol(d): add script for "M bit"
While we do support the "O bit" running a script (usually to start a
dhcpv6 client) we have no options for setups which set the "M bit" for,
e.g., static address assignment as in EC2.

Duplicate most of the "O bit" logic to also start a script for the
"M bit" with the one difference: if the "M bit" is set we will not
start the script for the "O bit" as well (per RFC 4861, Section 4.2).

Reviewed by:	hrs, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D26099
2020-08-25 16:09:23 +00:00
Alex Richardson
6424881cc8 Fix makefs bootstrap on macOS after D25563
The macOS assert.h header does not define static_assert when compiling in
C99 mode. To fix this compile with -std=c11.

Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D25928
2020-08-25 13:30:24 +00:00
Matt Macy
9e5787d228 Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.

I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.

Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.

Improvements include:
  project quotas, encrypted datasets,
  allocation classes, vectorized raidz,
  vectorized checksums, various command line
  improvements, zstd compression.

Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.

Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
Cy Schubert
d709c07b34 Update unbound version number.
MFC after:	1 month
X-MFC with:	r364721
2020-08-24 18:17:13 +00:00
Maxim Sobolev
d065b3eb9e In the endless batch mode (-B), terminate if and when stdout is closed.
That mode is useful to call gstat from other app, however kinda useless
since gstat won't exit and stay running forever when its parent process
has long gone.

MFC after:	2 weeks
2020-08-24 16:45:23 +00:00
Marc Fonvieille
e0e236ba88 s/redundacy/redundancy
MFC after:	1 week
2020-08-24 14:04:59 +00:00
Marc Fonvieille
633963a352 Add missing Korean doc package entry, remove non-existent Serbian doc
package entry.

Approved by:	re (gjb)
MFC after:	1 week
2020-08-24 14:00:12 +00:00
Alex Richardson
06e20d1bab makefs (msdosfs): Use fprintf instead of debug print for errors
The added print was very helpful for debugging failed disk image creation.

Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D23200
2020-08-24 09:20:27 +00:00
Alex Richardson
50e525e40b Correctly determine the real executable in crunched binaries
This should fix cases like su setting argv[0] to _su for /bin/sh.
Previously cheribsdbox (a crunched tool we use in CheriBSD to reduce the
size of our minimal disk images to allow loading them onto FPGAs without
waiting forever for the transfer) would complain about _su not being
compiled in, but now that we also look at AT_EXECPATH it correctly
invokes the sh tool.

Note: we use use AT_EXECPATH instead of the KERN_PROC_PATHNAME sysctl to get
the crunchgen binary name since it seems like KERN_PROC_PATHNAME just
returns the last cached path for a given hardlink.
When using `su`, instead of invoking /bin/csh this would invoke the last
used hardlink to cheribsdbox. This caused weird test failures when running
tests due to `id` being executed instead of `echo`:

$ id  # id is a hardlink to /bin/cheribsdbox
$ su postgres -c 'echo 1' # su is also a hardlink
uid=1001(postgres) gid=1001(postgres) groups=1001(postgres)

Obtained from: CheriBSD

Reviewed By:	emaste, brooks
Differential Revision: https://reviews.freebsd.org/D25998
2020-08-24 09:20:23 +00:00
Alex Richardson
b0f558df9f Re-indent crunched_main.c in preparation for D25998 2020-08-24 09:20:18 +00:00
Chuck Tuffli
71a51f69a4 bhyve: NVMe queue create must init head/tail
The NVMe emulation code did not explicitly initialize queue head and
tail pointers on queue creation. As these pointers are part of
calloc()'ed memory, this only becomes a problem if the queues are
deleted and then recreated.

This error can manifest with messages about completions not matching a
command.
2020-08-24 01:51:21 +00:00
Chuck Tuffli
c4a86c1fc0 bhyve: NVMe set nominal health values
Some operating systems believe bhyve's emulated NVMe drive is failing
based on certain values in the SMART / Health Information log page being
zero. Fix is to set the reported temperature and available spare values
to reasonable defaults.

Submitted by:	wanpengqian@gmail.com
Reviewed by:    grehan
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D24202
2020-08-24 01:51:17 +00:00
Konstantin Belousov
f3eb12e4a6 Add bhyve support for LA57 guest mode.
Noted and reviewed by:	grehan
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D25273
2020-08-23 20:37:21 +00:00
Mateusz Piotrowski
4863a70395 Clean up spi.8
- Remove trailing whitespace
- Address igor and mandoc warnings
- Sort options
- Use macros consistently (e.g., Fl for flags, Dq for quoting, Bd for code
  blocks)
- Add a history section
- Fix incorrect use of macros in various places

MFC after:	2 weeks
2020-08-21 09:48:00 +00:00
Dimitry Andric
05c312a339 Bump kldxref's MAXSEGS to 16, to stop complaints about the kernel
supposedly having too many segments, when lld 11 links it. Such kernels
should load just fine.

Note that we may still do some tweaking of our kernel linker scripts, to
lower the number of segments, although the exact benefit is not entirely
clear.
2020-08-20 18:50:46 +00:00
Pedro F. Giffuni
0d2913adc3 usr.sbin/fstyp: Fix incorrect pfs_type test in ondisk inode
"ipdata.meta.pfs_type & HAMMER2_PFSTYPE_SUPROOT" happened to have
the same result (except HAMMER2_PFSTYPE_DUMMY could also match).

Obtained from: Dragonfly (git 29e6489bbd4f8e237c9c17b300ac8b711f36770)
2020-08-20 05:18:08 +00:00
Michael Gmelin
101d33b8fb Unbreak `freebsd-update updatesready'.
The command would only work if PWD happened to be WORKDIR.
Also, exit 1 in case WORKDIR exists, but isn't accessible
by the current user.

PR:		242709
Reported by:	Max Fiedler
MFC after:	1 week
2020-08-19 15:11:27 +00:00
Mateusz Piotrowski
51ae4071cb pmcstat.8: Improve description of -T 2020-08-17 10:51:03 +00:00
Mateusz Piotrowski
57b9e06a3a Revert 363598
The original wording was better.

Reported by:	rgrimes
2020-08-17 10:25:02 +00:00
Xin LI
b651906972 edquota(8): Cleanup to make it WARNS=6 clean.
Tested with:	make tinderbox
MFC after:	2 weeks
2020-08-17 05:57:22 +00:00
Alex Richardson
0d5e651861 crunchgen: use pwd -P without env
The -P flag is required by POSIX so we don't have to care whether pwd is
a shell builtin or not. This also allows removing pwd from the list of
bootstrap tools since all shells we care about for building have a
builtin pwd command. This effectively reverts r364190.

Suggested By:	rgrimes, jrtc27
2020-08-14 09:45:41 +00:00
Alex Richardson
d5c62a6f03 Use env pwd instead of pwd in crunchgen.c
In r364166 I changed /bin/pwd to pwd, but pwd can be shell builtin that
may not correctly return a real path. To ensure that all symlinks are
resolved use `env pwd -P` instead (the -P flag is part of POSIX so
should be supported everywhere).

Reported By:	rgrimes
Suggested By:	jrtc27
2020-08-12 17:27:24 +00:00
Alex Richardson
188d6f4bc6 Fix crunchgen usage of mkstemp()
On Glibc systems mkstemp can only be used once with the same template
string since it will be modified in-place and no longer contain any 'X' chars.
It is fine to reuse the same file here but we need to be explicit and use
open() instead of mkstemp() on the second use.

While touching this file also avoid a hardcoded /bin/pwd since that may not
work when building on non-FreeBSD systems.

Reviewed By:	brooks
Differential Revision: https://reviews.freebsd.org/D25990
2020-08-12 15:49:06 +00:00
Alex Richardson
b05fc77a36 Fix bootstrapping of pwd_mkdb after r364049
I moved the bootstrap pwd.h to a subdirectory in r364049 but forgot to
adjust the #include path.
2020-08-11 16:46:38 +00:00
Alex Richardson
dfb98e350c Fix i386 build of chpass after r363992
My change to allow bootstrapping pwd_mkdb (r363992) resulted in i386 build
failures because the bootstrap header was being included in non-bootstrap chpass.
Dropping the no longer required pwd_mkdb include path from chpass fixes
the build, but to be certain that the failure doesn't get re-introduced,
I've also moved the bootstrap pwd.h into a subdirectory so that adding
-I${SRCTOP}/usr.sbin/pwd_mkdb doesn't pull it in.

Reported by:	mjg
2020-08-08 10:05:27 +00:00
Alex Richardson
03266a2f08 Don't link against libdialog/ncurses when bootstrapping tzsetup 2020-08-07 16:04:10 +00:00
Alex Richardson
b4e38a41f5 makefs: Drop unnecessary sys/clock.h include
This breaks the build on macOS where this header doesn't exist. I could
also add a compat header to tools/build/cross-build but since it's not
needed removing it seems like the better solution.
2020-08-07 16:04:06 +00:00
Alex Richardson
a583962d61 Allow bootstrapping pwd_mkdb on Linux/macOS
We need to provide a struct passwd that is compatible with the target
system and this is not the case when cross-building from macOS/Linux.
It should also be a problem when bootstrapping for an i386 target from a
FreeBSD amd64 host since time_t does not match across those systems.
However, pwd_mkdb always truncates integer values to 32-bit so this
difference does not result in different databases.

Reviewed By:	brooks
Differential Revision: https://reviews.freebsd.org/D25931
2020-08-06 20:46:13 +00:00
Dimitry Andric
dd7660e5bd Fix clang 11 -Wformat warnings in yp_mkdb:
usr.sbin/yp_mkdb/yp_mkdb.c:91:40: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat]
                printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size,
                        ~~~~                         ^~~~~~~~
usr.sbin/yp_mkdb/yp_mkdb.c:92:7: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat]
                    data.data);
                    ^~~~~~~~~

MFC after:	3 days
2020-08-06 20:31:50 +00:00
Alexander Motin
8bdf81e4d1 Add CTL support for REPORT IDENTIFYING INFORMATION command.
It allows to report to initiator LU identifying information, preset via
"ident_info" and "text_ident_info" options.

Unfortunately it is impossible to implement SET IDENTIFYING INFORMATION,
since we have no persistent storage it requires, so the information is
read-only for initiator and has to be set out-of-band.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2020-08-06 19:16:11 +00:00
Mateusz Guzik
ec3b2a79b5 pmcstat: fix build on non-64 bit platforms 2020-08-05 20:42:08 +00:00
Mateusz Guzik
94e9ef85c5 pmcstat: implement showing offsets into symbols in top mode
The -I option (and hotkey) is reused for this. Skipping symbol resolution is
moved to the new -A option (and hotkey).

While arguably this violates POLA I think it's a change for the better.
ALso note the -I option was added in head.

Differential Revision:	https://reviews.freebsd.org/D21658
2020-08-05 19:05:49 +00:00
Eugene Grosbein
dca51295b2 bsnmptools: make it print protocol errors to stderr instead of stdout
Reviewed by:		syrinx, bz
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D25911
2020-08-05 09:19:41 +00:00
Gordon Bergling
3422ca83ba iovctl.conf(5): Use Lk macro for the URL of the UCL website
PR:		248334
Reported by:	chuck at tuffli dot net
Reviewed by:	bcr, 0mp
Approved by:	bcr, 0mp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25891
2020-08-04 11:13:13 +00:00
Alex Richardson
c4bd82d701 Allow bootstrapping mtree on Linux systems
Linux glibc has a dummy lchmod that always fails and emitting a linker
warning when used. Don't fail the build due to that warning when
bootstrapping by setting LD_FATAL_WARNINGS=no.

Reviewed By:	brooks, emaste
Differential Revision: https://reviews.freebsd.org/D25930
2020-08-03 18:08:10 +00:00
Peter Grehan
f1c3dac414 Replace magic numbers in Identify page register 0 with ATA definitions.
No functional change. Verified with objdump output before/after.

Requested by:	rpokala
Reviewed by:	rpokala
MFC after:	3 weeks
2020-07-31 12:10:28 +00:00
Alexander Motin
3b11655c7e When modifying LUN pass "special" options too.
Before switching to nvlists CTL merged previous and new options, so
any options not passed just kept previous value.  Now CTL completely
replaces them, so we must pass everything still relevant.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2020-07-28 22:32:50 +00:00
Yoshihiro Takahashi
8f11c99715 - Cleanups related to sparc64 removal.
- Remove remains of sparc64 files.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D25831
2020-07-28 10:58:37 +00:00
Mateusz Piotrowski
d421b01028 nologin.8: Improve wording
Reported by:	yuripv
Reviewed by:	bcr, yuripv
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D25814
2020-07-27 10:45:47 +00:00
Peter Grehan
9af3bcd7c9 Support the setting of additional AHCI controller parameters.
Allow the serial number, firmware revision, model number and nominal media
rotation rate (nmrr) parameters to be set from the command line.

Note that setting the nmrr value can be	used to	indicate the AHCI
device is an SSD.

Submitted by:	Wanpeng Qian
Reviewed by:	jhb, grehan (#bhyve)
Approved by:	jhb, grehan
MFC after:	3 weeks
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D24174
2020-07-27 07:56:55 +00:00
Juli Mallett
ce219ecd93 Remove reference to nlist(3) missed in SCCS revision 5.26 by mckusick
when converting rwhod(8) to using kern.boottime ather than extracting
the boot time from kernel memory directly.

Reviewed by:	imp
2020-07-24 16:58:13 +00:00
John-Mark Gurney
98b765e5c2 update example to make it active when creating a new boot method...
Clean up some of the sentences and grammar...

make igor happy..
2020-07-23 22:28:35 +00:00
Brooks Davis
e9b21d432b Correct a type-mismatch between xdr_long and the variable "bad".
Way back in r28911 (August 1997, CVS rev 1.22) we imported a NetBSD
information leak fix via OpenBSD.  Unfortunatly we failed to track the
followup commit that fixed the type of the error code.  Apply the change
from int to long now.

Reviewed by:	emaste
Found by:	CHERI
Obtained from:	CheriBSD
MFC after:	3 days
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D25779
2020-07-22 23:39:58 +00:00
Brooks Davis
d90b364147 Avoid reading one byte before the path buffer.
This happens when there's only one component (e.g. "/foo"). This
(mostly-harmless) bug has been present since June 1990 when it was
commited to mountd.c SCCS version 5.9.

Note: the bug is on the second changed line, the first line is changed
for visual consistency.

Reviewed by:	cem, emaste, mckusick, rmacklem
Found with:	CHERI
Obtained from:	CheriBSD
MFC after:	1 week
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D25759
2020-07-22 21:44:51 +00:00
Kyle Evans
ca7f7593ba pkg-bootstrap: complain on improper pkg bootstrap usage
Right now, the bootstrap will gloss over things like pkg bootstrap -x or
pkg bootstrap -f pkg. Make it more clear that this is incorrect, and hint
at the correct formatting.

Reported by:	jhb (IIRC via IRC)
Approved by:	bapt, jhb, manu
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24750
2020-07-22 17:33:35 +00:00
Mark Johnston
ca19d0d78f traceroute6: Fix most warnings at the default WARNS level.
Fix some style issues as well.  Leave -Wno-cast-aligned set for now, as
most of the warnings come casts of CMSG_DATA(), which does provide
sufficient alignment in practice.

Submitted by:	Shubh Gupta <shubh@freebsd.org>
Sponsored by:	Google (GSOC 2020)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25603
2020-07-21 15:03:36 +00:00
Toomas Soome
6b8b1bfef0 efibootmgr: typo in long option name
del-timout should be del-timeout

Reported by:	mjg
MFC after:	1 week
2020-07-16 10:20:35 +00:00
Gregory Neil Shapiro
5b0945b570 Merge sendmail 8.16.1 to HEAD: See contrib/sendmail/RELEASE_NOTES for details
Includes build infrastructure & config updates required for changes in 8.16.1

MFC after:	5 days
2020-07-15 18:28:54 +00:00
Adrian Chadd
420306c3b7 [pmc] whoops, remove spurious #'s
pointed out by gonzo@, thanks!
2020-07-14 05:33:23 +00:00
Adrian Chadd
f8e66eb160 [hwpmc] Compile 'pmc' only if we have C++11.
I noticed when compiling with ye olde gcc-6.3.0 on mips that it tripped over
a lack of C++11 bits.  This allows it to compile fine.
2020-07-14 05:10:50 +00:00
Allan Jude
4cf6caac2f Actually install the new 221.backup-gpart periodic script
Submitted by:	Rob Fairbanks <rob.fx907@gmail.com>
Reported by:	Michael Butler <imb@protected-networks.net>
MFC with:	r363110
Sponsored by:	Klara Inc.
2020-07-14 00:46:20 +00:00
Gordon Bergling
aeeff830b9 arp(8) clarify the use of the '-a flag'
PR:		238146
Submitted by:	Andrew Stevenson <andrew at ugh dot net dot au>
Reported by:	Andrew Stevenson <andrew at ugh dot net dot au>
Reviewed by:	bcr (mentor)
Approved by:	bcr (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25645
2020-07-13 15:06:29 +00:00
Allan Jude
ce2fe5b109 Add a periodic script to backup the partition table and boot code
Optionally, alert you if the contents change from the previous backup

PR:		86388
Submitted by:	Rob Fairbanks <rob.fx907@gmail.com>, Miroslav Lachman <000.fbsd@quip.cz> (Original Version)
MFC after:	4 weeks
Relnotes:	yes
Sponsored by:	Klara Inc.
Event:		July 2020 Bugathon
Differential Revision:	https://reviews.freebsd.org/D25628
2020-07-11 20:53:31 +00:00
Allan Jude
86e88c4f54 nscd: does not warn about invalid values what parsing config file
PR:		202135
Submitted by:	amutu@amutu.com
Reported By:	Trond.Endrestol@ximalas.info
Reviewed by:	markj, freqlabs
MFC after:	4 weeks
Sponsored by:	Klara Inc.
Event:		July 2020 Bugathon
Differential Revision:	https://reviews.freebsd.org/D25627
2020-07-11 19:44:12 +00:00
Allan Jude
9d4c84dea4 ppp: Document the fact that ppp_nat is enabled by default
No functional change.

PR:		243062
Submitted by:	Evilham <contact@evilham.com> (original version)
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Event:		July 2020 Bugathon
Differential Revision:	https://reviews.freebsd.org/D25623
2020-07-11 18:24:16 +00:00
Allan Jude
c5acd3a091 bsdinstall: only kill the dhclient for the interface we are restarting
PR:		205821
Reported by:	mjg
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Event:		July 2020 Bugathon
2020-07-11 17:20:17 +00:00
Allan Jude
5b8d2467eb bsdinstall: don't fail if fstab is empty
PR:		210865
Submitted by:	Tim Lukasiewicz <eclipzetech08@gmail.com>, h-fujishima@sakura.ad.jp (original version)
Reported by:	h-fujishima@sakura.ad.jp
Reviewed by:	sef
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Event:		July 2020 Bugathon
2020-07-11 17:06:48 +00:00
Allan Jude
9a55656956 bsdinstall: kill dhclient before starting a new instance
PR:		205821
Submitted by:	William Orr <will@worrbase.com>
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Event:		July 2020 Bugathon
Differential Revision:	https://reviews.freebsd.org/D14572
2020-07-11 15:32:53 +00:00
Peter Grehan
fb5f5a17ef Advertise 64-bit physical-address capability.
This fixes a coredump with NetBSD guests when XHCI is configured.
On seeing the AC64 flag clear, the NetBSD XHCI driver was only writing
to the lower 32-bits of 64-bit physical address registers. The emulation
relies on a write to the hi 32-bits to calculate a host virtual address
for internal use, and has always supported 64-bit addressing.

All other guests were seen to write to both the lo- and hi- address
registers, regardless of the AC64 setting.

Discussed with:  Leon Dang (author)
Tested with:  Ubuntu 16/18/20, Windows10, OpenBSD UEFI guests.

MFC after:	2 weeks.
2020-07-10 07:26:50 +00:00
Cy Schubert
f329ac7dfb Enable support for IEEE 802.11N, 802.11W, 802.11AC and 802.11.AX to
hostapd and wpa_supplicant.

Submitted by:	bz
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
2020-07-09 23:01:36 +00:00
Takanori Watanabe
2105611236 Add le_rand command.
PR: 247808
Submitted by: Marc Veldman
2020-07-08 03:57:47 +00:00
Peter Grehan
6a7ff0600b Silence ACPI RTC error/warning in Linux guests.
Allow guests to	set the	RTC bit	in the ACPI PM control register.
This eliminates an annoying	(and harmless) Linux kernel boot message.

PR:	244721
Submitted by:	Jose Luis Duran
MFC after:	1 week
2020-07-06 08:36:14 +00:00
Alexander Motin
ebc22d0495 Decode APEI tables (BERT, EINJ, ERST, HEST).
MFC after:	2 weeks
2020-06-30 21:40:34 +00:00
Gordon Bergling
32100375a6 iovctl(8): Correct a typo in the manpage and correct the SYNOPSIS
PR:	246831
Submitted by:	Jose Luis Duran <jlduran at gmail dot com>
Reviewed by:	bcr (mentor)
Approved by:	bcr (mentor)
MFC after:	7 days
2020-06-30 17:21:28 +00:00
Edward Tomasz Napierala
3d10bf72ef Fix misplaced voltages/temperatures labels in 'sesutil show'.
PR:		bin/247384
Reported by:	brd
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D25353
2020-06-30 16:49:43 +00:00
Kyle Evans
70448a5414 mailwrapper: switch mailer.conf to CONFS
This matches what was already being done in dma(8), and should again make
this merge with etcupdate/mergemaster.

Reported by:	jhb
2020-06-29 18:06:00 +00:00
Chuck Tuffli
0ed1d2e484 bhyve: fix NVMe Active Namespace list
The NVMe specification requires unused entries in the Identify, Active
Namespace ID data to be zero. Fix is bzero the provided page, similar to
what is done for the Namespace Descriptors list.

Fixes UNH Tests 2.6 and 2.9

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24901
2020-06-29 00:32:24 +00:00
Chuck Tuffli
a104b18c52 bhyve: NVMe handle zero length DSM ranges
Dataset Management range specifications may have a zero length (a.k.a.
an empty range definition). Handle the case of all ranges being empty by
completing with Success (DSM commands are advisory only). For
Deallocate, skip empty range definitions when sending TRIM's to the
backing storage.

Fixes UNH Test 2.2.4

Reviewed by:	imp
Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24900
2020-06-29 00:32:21 +00:00
Chuck Tuffli
7669ea7bb0 bhyve: fix NVMe Get Features, Predictable Latency
If the Predictable Latency Mode is not supported, NVMe Controllers must
return Invalid Field in Command status for the Get Features command
with IDs:
 - Predictable Latency Mode Config
 - Predictable Latency Mode Window

Fixes UNH Tests 3.6

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24899
2020-06-29 00:32:18 +00:00
Chuck Tuffli
f97ed15123 bhyve: add NVMe Feature Interrupt Vector Config
This adds support for NVMe Get Features, Interrupt Vector Config
parameter error checking done by the UNH compliance tests.

Fixes UNH Tests 1.6.8 and 5.5.6

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24898
2020-06-29 00:32:15 +00:00
Chuck Tuffli
46ea627374 bhyve: add basic NVMe Firmware Commit support
This commit updates the Identify Controller data to advertise the
Controller supports a single firmware slot and that firmware slot 1 is
read-only. Additionally, it returns an "Invalid Firmware Slot" error
when the host issues any Firmware Commit command (a.k.a. Firmware
Activate).

Fixes UNH Test 5.5.3

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24897
2020-06-29 00:32:11 +00:00
Chuck Tuffli
106329ef33 bhyve: Add AER support to NVMe emulation
This adds support to bhyve's NVMe device emulation for processing Async
Event Requests but not returning them (i.e. Async Event Notifications).

Fixes UNH Test 5.5.2

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24896
2020-06-29 00:32:08 +00:00
Chuck Tuffli
8bba8666e2 bhyve: validate the NVMe LBA start and count
Add checks that the combination of Starting LBA and Number of Logical
Blocks in a command will not exceed the range of the underlying storage.

Note that because NVMe specifices the Starting LBA as a uint64_t, care
must be taken when converting it and the block count to avoid an integer
overflow.

Fixes UNH Tests 2.2.3, 2.3.2, and 2.4.2

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24895
2020-06-29 00:32:04 +00:00
Chuck Tuffli
7d248cffd9 bhyve: implement NVMe SMART data I/O statistics
SMART data in NVMe includes statistics for number of read and write
commands issued as well as the number of "data units" read and written.
NVMe defines "data unit" as thousands of 512 byte blocks (e.g. 1 data
unit is 1-1,000 512 byte blocks, 3 data units are 2,001-3,000 512 byte
blocks).

This patch implements counters for:
 - Data Units Read
 - Data Units Written
 - Host Read Commands
 - Host Write Commands
and exposes the values when the guest reads the SMART/Health Log Page.

Fixes UNH Test 1.3.8

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24894
2020-06-29 00:32:01 +00:00
Chuck Tuffli
ae638f2bd5 bhyve: validate NVMe deallocate range values
For NVMe emulation, validate the Data Set Management LBA ranges do not
exceed the capacity of the backing storage. If they do, return an "LBA
Out of Range" error.

Fixes UNH Test 2.2.3

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24893
2020-06-29 00:31:58 +00:00
Chuck Tuffli
73cd73c0b8 bhyve: base pci_nvme_ioreq size on advertised MDTS
NVMe controllers advertise their Max Data Transfer Size (MDTS) to limit
the number of page descriptors in an I/O request. Take advantage of this
and size the struct pci_nvme_ioreq accordingly.

Ensuring these values match both future-proofs the code and allows
removing some complexity which only exists to handle this possibility.

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24891
2020-06-29 00:31:54 +00:00
Chuck Tuffli
206edceb73 bhyve: refactor NVMe I/O read/write
Split the NVM I/O function (i.e. nvme_opc_write_read) into separate
functions - one for RAM based backing-store and another for disk based
backing-store for easier maintenance. No functional changes.

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24890
2020-06-29 00:31:51 +00:00
Chuck Tuffli
a0900f46d1 bhyve: implement NVMe Format NVM command
The Format NVM command mainly allows the host to specify the block size
and protection information used for the Namespace. As the bhyve
implementation simply maps the capabilities of the backing storage
through to the guest, there isn't anything to implement. But a side
effect of the format is the NVMe Controller shall not return any data
previously written (i.e. erase previously written data). This patch
implements this later behavior to provide a compliant implementation.

Fixes UNH Test 1.6

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24889
2020-06-29 00:31:47 +00:00
Chuck Tuffli
45cf82682c bhyve: make unsupported NVMe commands a debug message
Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24888
2020-06-29 00:31:44 +00:00
Chuck Tuffli
e3ebd4210a bhyve: add more compliant NVMe Get/Set Features
Create a generic Get/Set Features by saving off the contents of CDW11
from the Set command and returning the saved value in the completion of
the Get command. Implementation allows providing optional implementation
for both Set and Get.

Add infrastructure to determine which feature ID's are namespace
specific and flag violations of this category of error.

Also adds the feature specific behavior of Set Features, Number of
Queues to only allow this command once per Controller reset.

Fixes UNH Tests 1.2, 5.4, and 5.5.6

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24887
2020-06-29 00:31:41 +00:00
Chuck Tuffli
d708ced617 bhyve: fix NVMe queue creation and deletion
Add checks for various types of invalid I/O Queue Create and Delete
command parameters, including:
 - QID=0
 - QID>MAX
 - QID already in use
 - Delete an Active CQ
 - Invalid QSIZE
 - Invalid CQID (SQ creation)
 - Invalid interrupt vector (CQ creation)

Fixes UNH Tests 1.4.2-5,7-8

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24886
2020-06-29 00:31:37 +00:00
Chuck Tuffli
f6f02911b6 bhyve: fix NVMe Get Log Page command
Fix the logic in nvme_opc_get_log_page to calculate the number of DWORDS
(uint32_t) instead of WORDS (uint16_t) for the byte length. And only
return the allowed number of Log Page bytes as determined by the user
request and actual size of the requested log page.

Fixes UNH Test 1.3

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24885
2020-06-29 00:31:34 +00:00
Chuck Tuffli
f8fa74679c bhyve: implement NVMe Namespace Identification Descriptor
NVMe 1.3 compliant controllers must implement the Namespace
Identification Descriptor structure (i.e. CNS=3). Previously this was
unimplemented.

Fixes UNH Test 1.1.4-0

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24884
2020-06-29 00:31:30 +00:00
Chuck Tuffli
064ca48f57 bhyve: Consolidate NVMe CQ update
Consolidate the code which writes Completion Queue entries and updates
the CQ doorbell value. While in the neighborhood, convert the "toggle CQ
phase bit" code to use an XOR operation instead of an "if/else" branch.

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24882
2020-06-29 00:31:27 +00:00
Chuck Tuffli
d7e180feb7 bhyve: add locks around NVMe queue accesses
The NVMe code attempted to ensure thread safety through a combination of
using atomics and a "busy" flag. But this approach leads to unavoidable
race conditions.

Fix is to use per-queue mutex locks to ensure thread safety within the
queue processing code. While in the neighborhood, move all the queue
initialization code to a common function.

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D19841
2020-06-29 00:31:24 +00:00
Chuck Tuffli
cf20131a15 bhyve: add a comment explaining NVME dsm option
Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24881
2020-06-29 00:31:20 +00:00
Chuck Tuffli
9963f1805c bhyve: implement NVMe Flush command
This adds support for the NVMe I/O command Flush. For block-based
devices, submit a DIOCGFLUSH to the backing storage. Otherwise, command
is treated like a NOP and completes with a Successful status.

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24880
2020-06-29 00:31:17 +00:00
Chuck Tuffli
a43ab8d253 bhyve: refactor NVMe IO command handling
This refactors the NVMe I/O command processing function to make adding
new commands easier. The main change is to move command specific
processing (i.e. Read/Write) to separate functions for each NVMe I/O
command and leave the common per-command processing in the existing
pci_nvme_handle_io_cmd() function.

While here, add checks for some common errors (invalid Namespace ID,
invalid opcode, LBA out of range).

Add myself to the Copyright holders

Reviewed by:	imp
Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24879
2020-06-29 00:31:14 +00:00
Chuck Tuffli
0220a2aeed bhyve: convert NVMe logging statements
Convert the debug and warning logging macros to be parameterized and
correctly use bhyve's PRINTLN macro.

Reviewed by:	imp
Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24878
2020-06-29 00:31:11 +00:00
Mateusz Piotrowski
f36e950b9b Do not use macros in the argument to -width
This patch improves the presentation of the FILES section dramatically.

MFC after:	2 weeks
2020-06-28 22:04:52 +00:00
Adrian Chadd
016bac89db [fifolog] wrap the recno when we hit the end of the provided file size.
Without this the log just keeps growing to infinity.

Reviewed by:	phk
Differential Revision:	https://reviews.freebsd.org/D25478
2020-06-28 06:52:39 +00:00
Warner Losh
643d5ca3d6 Chroot first appeared in 4.3-Reno, not in 4.4 in the BSD world,
but in System III in the AT&T world.

Examination of the TUHS archives shows this was present in 4.3-Reno
and System III.

Reviewed by: 0mp@, allanjude@
MFC After: 3 days
Differential Revision: https://reviews.freebsd.org/D25479
2020-06-26 22:23:15 +00:00
Cy Schubert
1264cc08ff Add MATCH option for CONFIG_MATCH_IFACE.
If the interfaces on which wpa_supplicant is to run are not known or do
not exist, wpa_supplicant can match an interface when it arrives. Each
matched interface is separated with -M argument and the -i argument now
allows for pattern matching.

As an example, the following command would start wpa_supplicant for a
specific wired interface called lan0, any interface starting with wlan
and lastly any other interface. Each match has its own configuration
file, and for the wired interface a specific driver has also been given.

wpa_supplicant \
	-M -c wpa_wired.conf -ilan0 -D wired \
	-M -c wpa1.conf -iwlan* \
	-M -c wpa2.conf

PR:		247177
Reported by:	greg@unrelenting.technology
MFC after:	1 month
Related to:	ports r540412
2020-06-26 14:18:08 +00:00
Peter Grehan
71ab6f9708 Prevent calling USB backends multiple times.
The TRB processing loop could potentially call a back-end twice
with the same status transaction. While this was generally benign,
some code paths in the tablet backend weren't set up to handle
this case, resulting in a NULL dereference.

Fix by
 - returning a STALL error when an invalid request was seen in the backend
 - skipping a call to the backend if the number of packets in a status
   transaction was zero (this code fragment was taken from the Intel ACRN
   xhci backend)

PR:	246964
Reported by:  Ali Abdallah
Discussed with: Leon Dang (author)
Reviewed by: jhb (#bhyve), Leon Dang
Approved by: jhb
Obtained from:  Intel ACRN (partially)
MFC after: 2 weeks
Differential Revision:	https://reviews.freebsd.org/D25228
2020-06-26 08:20:38 +00:00
Pawel Biernacki
0a1016f9e8 bhyve: allow for automatic destruction on power-off
Introduce -D flag that allows for the VM to be destroyed on guest initiated
power-off by the bhyve(8) process itself.
This is quality of life change that allows for simpler deployments without
the need for bhyvectl --destroy.

Requested by:	swills
Reviewed by:	0mp (manpages), grehan, kib, swills
Approved by:	kib (mentor)
MFC after:	2 weeks
Sponsored by:	Mysterious Code Ltd.
Differential Revision:	https://reviews.freebsd.org/D25414
2020-06-25 12:35:20 +00:00
Conrad Meyer
4daa95f85d bhyve(8): For prototyping, reattempt decode in userspace
If userspace has a newer bhyve than the kernel, it may be able to decode
and emulate some instructions vmm.ko is unaware of.  In this scenario,
reset decoder state and try again.

Reviewed by:	grehan
Differential Revision:	https://reviews.freebsd.org/D24464
2020-06-25 00:18:42 +00:00
Jung-uk Kim
d836a9dbe3 Fix build with recent byacc. 2020-06-24 02:08:08 +00:00
Cy Schubert
767173cec2 MFV r362565:
Update 4.2.8p14 --> 4.2.8p15

Summary: Systems that use a CMAC algorithm in ntp.keys will not release
a bit of memory on each packet that uses a CMAC keyid, eventually causing
ntpd to run out of memory and fail. The CMAC cleanup from
https://bugs.ntp.org/3447, part of ntp-4.2.8p11, introduced a bug whereby
the CMAC data structure was no longer completely removed.

MFC after:	3 days
Security:	NTP Bug 3661
2020-06-24 01:51:05 +00:00
Li-Wen Hsu
bfd735d96e Revert r362390, those tests are fixed by r362418
PR:		247425
Sponsored by:	The FreeBSD Foundation
2020-06-23 19:14:38 +00:00
Piotr Pawel Stefaniak
3cbfd5815b pstat(8): improve the Size header width after r358181
All size values use fields of width 8. Also, all other headers use fields of
width 8. Make the Size header added in r358181 use 8 characters as well.
2020-06-23 18:19:22 +00:00
Tom Jones
a10f71c53a pkg: Provide a friendlier message when bootstrap fails due to address resolution
The current message when bootstapping pkg fails for any reason implies that pkg
is not available. We have the error code from fetch so if bootstrap failed due
to address resolution say so.

Reviewed by:    bapt, bz
Approved by:    bz (co-mentor)
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D25323
2020-06-23 15:14:54 +00:00
Mateusz Piotrowski
a97dcd5966 Fix a typo and sort options
MFC after:	1 week
2020-06-23 10:56:15 +00:00
Baptiste Daroussin
5b990a9463 Revert r362466
Such change should not have happen without prior discussion and review.

With hat:	transitioning core
2020-06-22 07:46:24 +00:00
Hans Petter Selasky
7747001b12 Improve wording to be more precise and clear.
No functional change intended.

s/Master Boot/Main Boot/ (also called MBR)

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-06-21 13:34:08 +00:00
Kirk McKusick
972670e132 Allocate an fs_summary_info structure when creating a UFS filesystem
needed since introduced in -r362358.

PR:           247425
Sponsored by: Netflix
2020-06-19 23:32:40 +00:00
Brandon Bergren
37f530582d [PowerPC] De-giant powermac_nvram, update documentation
* Remove the giant lock requirement from powermac_nvram.
* Update manual pages to reflect current state.

Reviewed by:	bcr (manpages), jhibbits
Sponsored by:	Tag1 Consulting, Inc.
Differential Revision:	https://reviews.freebsd.org/D24812
2020-06-19 18:36:10 +00:00
Li-Wen Hsu
865c7b713c Skip ufs related tests in fstyp(8) and makefs(8) temporarily
They are failing after r362358 and r362359.

PR:		247425
Sponsored by:	The FreeBSD Foundation
2020-06-19 17:32:30 +00:00
Kirk McKusick
34816cb9ae Move the pointers stored in the superblock into a separate
fs_summary_info structure. This change was originally done
by the CheriBSD project as they need larger pointers that
do not fit in the existing superblock.

This cleanup of the superblock eases the task of the commit
that immediately follows this one.

Suggested by: brooks
Reviewed by:  kib
PR:           246983
Sponsored by: Netflix
2020-06-19 01:02:53 +00:00
Mateusz Piotrowski
377d7c417a Fix the --guid flag description
MFC after:	2 weeks
2020-06-18 12:29:24 +00:00
Mateusz Piotrowski
aa1f87cb62 Improve periodic(8) manual page presentation
- Update synopsis to present all available arguments.
- Consistently call the argument specifying an arbitrary directory a
  "directory".
- Do not put macros into -width argument to Bl. They do not expand there.
- Stylize command modifiers like "daily" with Cm instead of Pa. While
  technically periodic(8) operates on directories with such names, it is
  confusing from the perspective of the manual page reader as Pa and Ar are
  stylized the same way. Also, I cannot recall a single manual page where
  Pa would be used to describe the syntax of command-line arguments.

MFC after:	2 weeks
2020-06-18 10:52:51 +00:00
Juli Mallett
e9de7669c3 Improve unit parsing of mpsutil.
Previously, it used atoi(3) to parse the unit parameter, which would silently
yield a unit of 0 in the presence of an invalid unit number.  As most users of
mpsutil(8) are likely to have at least a unit 0, this is could have confusing
results.

This behaviour was particularly unintuitive if one incorrectly passed an
adapter device name, or a device path, instead of a unit number.  In addition
to using strtoumax(3) instead of atoi(3) to parse unit numbers, support
stripping a device name (e.g. mps1) or path (e.g. /dev/mps2) to just its unit
number.

Reviewed by:	scottl (earlier version)
2020-06-16 19:21:28 +00:00
Eugene Grosbein
01cf0a1724 newsyslog(8): make configuration parser more robust.
Currently newsyslog supports <include> directive that is used
in our default /etc/newsyslog.conf in the following form:

<include> /usr/local/etc/newsyslog.conf.d/*

While this is suitable for ports installing their own rules
for logs rotation, this also makes newsyslog break entire
processing of all files if it encounters single line it cannot parse.
This includes lines referring to nonexistent username/group for log
ownership, so newsyslog stops calling errx() function in the parser.

With this fix, newsyslog uses warnx() instead of errx() in such cases
to print a warning, recover gracefully and continue with execution.

Among other cases, this unbreaks initial creation of log files
having flag "C" at boot time (newsyslog -CN). This is most important
for systems having RAM-based /var file system like nanobsd(8)-based
that rely on newsyslog to bring system log files into existence.

MFC after:	1 month
2020-06-16 17:45:23 +00:00
Rick Macklem
3e2d36ffa6 Make use of the UID_NOBODY and GID_NOGROUP definitions in sys/conf.h.
r362214 exposed UID_NOBODY and GID_NOGROUP to userspace, so use them
instead of the numbers.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D25281
2020-06-16 02:35:30 +00:00
Toomas Soome
e7fd9688ea Move font related data structured to sys/font.c and update vtfontcvt
Prepare support to be able to handle font data in loader, consolidate
data structures to sys/font.h and update vtfontcvt.

vtfontcvt update is about to output set of glyphs in form of C source,
the implementation does allow to output compressed or uncompressed font
bitmaps.

Reviewed by:	bcr
Differential Revision:	https://reviews.freebsd.org/D24189
2020-06-14 06:58:58 +00:00
Rick Macklem
cc5efdde94 Modify mountd to use the new struct export_args committed by r362158.
r362158 modified struct export_args for make the ex_flags field 64bits
and also changed the anonymous credentials to allow more than 16 groups.
This patch fixes mountd.c to use the new structure.
It does allocate larger exportlist and grouplist structures now.
That will be fixed in a future commit.
The only visible change will be that the credentials provided for the
-maproot and -mapall exports options can now have more than 16 groups.

Reviewed by:	kib, freqlabs
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D25088
2020-06-14 00:40:00 +00:00
Takanori Watanabe
2b2c6d6919 Add le_read_channel_map and le_read_remote_features command
PR: 247051
Submitted by:	  Marc Veldman marc at bumblingdork.com
2020-06-10 05:01:00 +00:00
Rick Macklem
38b45b65cd Fix a bug where XU_NGROUPS + 1 groups might be copied.
r361780 fixed the code so that it would only remove the duplicate when
it actually existed. However, that might have resulted in XU_NGROUPS + 1
groups being copied, running off the end of the array. This patch fixes
the problem.

Spotted during code inspection for other mountd changes.

MFC after:	2 weeks
2020-06-09 05:01:23 +00:00
Ed Maste
33bb3dbe38 crashinfo: stop looking for gdb in /usr/bin/gdb
As of r359457 we removed the GDB_LIBEXEC option, always installing in-tree
gdb into /usr/libexec/.  Thus, there is now no need for crashinfo to include
/usr/bin/gdb in the list of pathnames to check when looking for gdb.
2020-06-08 16:11:44 +00:00
Pedro F. Giffuni
15824a4c06 services: Add SSDP to service database
This is used for UPnP and is registered in the IANA database.

MFC after:	2 weeks
PR:		241573
2020-06-07 19:56:17 +00:00
Rick Macklem
7674d489fc Fix mountd so that it will not lose SIGHUPs that indicate "reload exports".
Without this patch, if a SIGHUP is handled while the process is executing
get_exportlist(), that SIGHUP is essentially ignored because the got_sighup
variable is reset to 0 after get_exportlist().
This results in the exports file(s) not being reloaded until another SIGHUP
signal is sent to mountd.
This patch fixes this by resetting got_sighup to zero before the
get_exportlist() call while SIGHUP is blocked.
It also defines a delay time of 250msec before doing another exports reload
if there are RPC request(s) to process. This prevents repeated exports reloads
from delaying handling of RPC requests significantly.

PR:		246597
Reported by:	patrykkotlowski@gmail.com
Tested by:	patrykkotlowski@gmail.com
Reviewed by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D25127
2020-06-06 00:40:02 +00:00
Rick Macklem
01f13218a3 Fix mountd to handle getgrouplist() not returning groups[0] == groups[1].
Prior to r174547, getgrouplist(3) always returned a groups list with
element 0 and 1 set to the basegid argument, so long as ngroups was > 1.
Post-r174547 this is not the case. r328304 disabled the deduplication that
removed the duplicate, but the duplicate still does not occur unless the
group for a user in the password database is also entered in the group
database.
This patch fixes mountd so that it handles the case where a user specified
with the -maproot or -mapall exports option has a getgrouplist(3) groups
list where groups[0] != groups[1].
Found while testing another mountd patch.

MFC after:	2 weeks
2020-06-04 00:28:20 +00:00
Kyle Evans
cb99e93575 pkgbase: resolve mailer.conf conflict WITHOUT_SENDMAIL
When WITHOUT_SENDMAIL is set, we end up with two different mailer.conf that
conflict, and hilarity ensues. There's currently three different places that
we might install mailer.conf:

- ^/etc/Makefile (package=runtime, contingent on MK_MAIL != no)
- ^/libexec/dma/dmagent/Makefile (package=dma, contingent on MK_SENDMAIL !=
no)
- ^/usr.sbin/mailwrapper/Makefile (package=utilities, contingent on
not-installed)

The mailwrapper installation will effectively never happen because the ^/etc
one will first.

This patch simplifies the whole situation; remove the ^/etc/Makefile version
and install it primarily in mailwrapper if MK_MAILWRAPPER != "no". The
scenarios covered in mailwrapper are:

- sendmail(8) is installed, dma(8) may or may not be installed
- neither sendmail(8) nor dma(8) is installed

In the first scenario, sendmail(8) is dominant so we can go ahead and
install the version in ^/etc/mail. In the unlisted scenario, sendmail(8) is
not installed but dma(8) is, we'll let ^/libexec/dma/dmagent do the
installation. In the second listed scenario, we still want to install an
example mailer.conf so just install the base sendmail(8) version.

Reviewed by:	bapt
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24924
2020-06-02 02:38:54 +00:00
Kyle Evans
7e7655d7d7 certctl: fix test syntax
test doesn't understand &&, but it does understand -a.

MFC after:	1 week
2020-06-01 01:25:19 +00:00
Mark Johnston
b0763b5ddd certctl.8: Correct the HISTORY section.
certctl was merged to stable/12 after 12.1 was branched.

PR:		246190
Reported by:	Michael Osipov <michael.osipov@siemens.com>
MFC after:	3 days
2020-05-30 19:15:29 +00:00
Mark Johnston
dd8b877e6a ctld: Fix a memory leak in uclparse_conf().
PR:		246596
Submitted by:	Patryk <patrykkotlowski@gmail.com>
MFC after:	1 week
2020-05-30 19:11:41 +00:00
Alexander Motin
dbcf7598b0 Report STATUS_QUEUED/SENT in ctladm dumpooa output.
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2020-05-29 13:07:52 +00:00
Ed Maste
c5ea81f7a6 rename in-tree libevent v1 to libevent1
r316063 installed pf's embedded libevent as a private lib, with headers
in /usr/include/private/event.  Unfortunately we also have a copy of
libevent v2 included in ntp, which needed to be updated for compatibility
with OpenSSL 1.1.

As unadorned 'libevent' generally refers to libevent v2, be explicit that
this one is libevent v1.

Reviewed by:	vangyzen (earlier)
Differential Revision:	https://reviews.freebsd.org/D17275
2020-05-28 22:05:50 +00:00
Takanori Watanabe
f8143ed773 Fix connection event message string (n->\n)
PR: 246664
Submitted by: Marc Veldman (marc@bumblngdork.com)
Reported by:	Jose Luis Duran (jlduran@gmail.com)
2020-05-28 13:48:33 +00:00
Takanori Watanabe
3ac41cce63 Add le_connect command to connect to an LE device.
PR:246664
Submitted by:MarcVeldman
2020-05-26 15:46:18 +00:00
Murray Stokely
e05247460a Add example usage for formatting a floppy disk. Adding a more self
contained example here in the fdformat man page will allow us to
modernize and streamline the FreeBSD Handbook by cutting out some of
this legacy material.

While here, address some other minor grammatical nits in this man page.

Reviewed by:	bcr (mentor)
Approved by:	bcr (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D24971
2020-05-25 07:18:47 +00:00
Peter Grehan
2136849868 Fix pci-passthru MSI issues with OpenBSD guests
- Return 2 x 16-bit registers in the correct byte order
 for a 4-byte read that spans the CMD/STATUS register.
  This reversal was hiding the capabilities-list, which prevented
 the MSI capability from being found for XHCI passthru.

- Reorganize MSI/MSI-x config writes so that a 4-byte write at the
 capability offset would have the read-only portion skipped.
  This prevented MSI interrupts from being enabled.

 Reported and extensively tested by Anatoli (me at anatoli dot ws)

PR:	245392
Reported by:	Anatoli (me at anatoli dot ws)
Reviewed by:	jhb (bhyve)
Approved by:	jhb, bz (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24951
2020-05-25 06:25:31 +00:00
Cy Schubert
9d8dfbc3f3 Chase r361344. Update unbound version strings.
Reported by:	mike tancsa <mike@sentex.net>
MFC after:	1 day
2020-05-24 21:42:47 +00:00
Brooks Davis
48e9fb855b Add an unprivileged mode where calls to install are passed appropriate
flags.  For ease of integration, use the same flags as install:

 -U		unprivileged mode
 -D <destdir>	Specify DESTDIR (overrides the environment)
 -M <metalog>	Full path to METALOG file

Reviewed by:	kevans
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24932
2020-05-22 17:45:07 +00:00
Ryan Moeller
245bfd34da Deduplicate fsid comparisons
Comparing fsid_t objects requires internal knowledge of the fsid structure
and yet this is duplicated across a number of places in the code.

Simplify by creating a fsidcmp function (macro).

Reviewed by:	mjg, rmacklem
Approved by:	mav (mentor)
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D24749
2020-05-21 01:55:35 +00:00
Devin Teske
63939df8bc Fix indentation in bsdinstall-created wpa_supplicant.conf
PR:		base/221982
Reported by:	emaste
Reviewed by:	emaste, allanjude
MFC after:	0 days
X-MFC-to:	stable/11
Differential Revision:	https://reviews.freebsd.org/D23641
2020-05-20 21:39:19 +00:00
Xin LI
a918433b8a Update leap-seconds to leap-seconds.3676924800.
Obtained from:	ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800
MFC after:	3 days
2020-05-19 16:06:03 +00:00
Kyle Evans
1840a4fa01 bsdinstall: do a certctl rehash upon installation of configuration
If certctl is installed on the system we're configuring, do a certctl
rehash.

Note that certctl may not be present if the world we've installed was built
either WITHOUT_OPENSSL or WITHOUT_CAROOT. In this scenario, we don't
currently see if the host has a certctl as this may be an indication that
the system *shouldn't* have certs installed into /etc/ssl.

Reviewed by:	allanjude, dteske
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D24640
2020-05-19 15:19:39 +00:00
Takanori Watanabe
11fb4bdb4d Add LE Whitelist commands to hccontrol
PR: 214555
Submitted by Marc Veldman
2020-05-19 13:44:32 +00:00
Andrew Turner
bc71118183 Allow the FACS and XFACS to be zero in acpidump.
These are allowed to be zero when the hardware reduced APCI flag is set

Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D23207
2020-05-18 15:05:59 +00:00
Aleksandr Fedorov
e90337e48f bhyve(8): Add the netgraph network backend decription to the manpage.
Reviewed by:	vmaffione, bcr
Approved by:	vmaffione (mentor)
Sponsored by:	vstack.com
Differential Revision:	https://reviews.freebsd.org/D24846
2020-05-18 15:03:52 +00:00
Kyle Evans
09841aabfa certctl: don't fall over flat with relative DESTDIR
Up until now, all of our DESTDIR use has been with absolute paths. It turned
out that the cd in/out dance we do here breaks us down later on, as the
relative path no longer resolves.

Convert EXTENSIONS to an ERE that we'll use to grep ls -1 of the dir we're
inspecting, rather than cd'ing into it and globbing it up.

MFC after:	3 days
2020-05-18 01:35:44 +00:00
Conrad Meyer
8a68ae80f6 vmm(4), bhyve(8): Expose kernel-emulated special devices to userspace
Expose the special kernel LAPIC, IOAPIC, and HPET devices to userspace
for use in, e.g., fallback instruction emulation (when userspace has a
newer instruction decode/emulation layer than the kernel vmm(4)).

Plumb the ioctl through libvmmapi and register the memory ranges in
bhyve(8).

Reviewed by:	grehan
Differential Revision:	https://reviews.freebsd.org/D24525
2020-05-15 15:54:22 +00:00
Aleksandr Fedorov
8ffb1c8ce1 bhyve: Fix processing of netgraph backend options.
After r360820, additional parameters are passed through the argument 'opts', and the name of the backend through the argument 'devname'. So, there is no need to skip the backend name from the 'opts' argument.
2020-05-15 11:03:27 +00:00
Ryan Moeller
66005c453d jail: Add exec.prepare and exec.release command hooks
This change introduces new jail command hooks that run before and after any
other actions.

The exec.prepare hook can be used for example to invoke a script that checks
if the jail's root exists, creating it if it does not. Since arbitrary
variables in jail.conf can be passed to the command, it can be pretty useful
for templating jails.

An example use case for exec.release would be to remove the filesystem of an
ephemeral jail.

The names "prepare" and "release" are borrowed from the names of similar hooks
in libvirt.

Reviewed by:	jamie, manpages, mmacy
Approved by:	mmacy (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24829
2020-05-14 23:38:11 +00:00
Kyle Evans
26a4a61a28 inetd(8): Add comments to all examples
Submitted by:	debdrup (with some minor changes by kevans)
Reviewed by:	bcr (manpages)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D24818
2020-05-14 17:52:29 +00:00
Kyle Evans
5e6c628e4f certctl: follow-up to r361022, prune blacklist as well
Otherwise, removals from the blacklist may not get processed as they should.

While we're here, restructure these to not bother with mkdir(1) if we've
already tested them to exist.

MFC after:	3 days
2020-05-14 03:30:27 +00:00
Kyle Evans
bb33c91077 certctl(8): don't completely nuke $CERTDESTDIR
It's been reported/noted that a well-timed `certctl rehash` will completely
obliterate $CERTDESTDIR, which may get used by ports or system
administrators. While we can't guarantee the certctl semantics when other
non-certctl-controlled bits live here, we should make some amount of effort
to play nice.

Pruning all existing links, which we'll subsequently rebuild as needed, is
sufficient for our needs. This can still be destructive, but it's perhaps
less likely to cause issues.

I also note that we should probably be pruning /etc/ssl/blacklisted upon
rehash as well.

Reported by:	cem's dovecot server
MFC after:	3 days
2020-05-14 03:25:12 +00:00
Conrad Meyer
b21ae0ff6f vfs_extattr: Allow extattr names up to the full max
Extattr names are allowed to be 255 bytes -- not 254 bytes plus trailing
NUL.  Provide a 256 buffer so that copyinstr() has room for the trailing
NUL.

Re-enable test for maximal name lengths.

PR:		208965
Reported by:	asomers
Reviewed by:	asomers
Differential Revision:	https://reviews.freebsd.org/D24584
2020-05-14 03:01:23 +00:00
Kyle Evans
a58fc86151 inetd(8): Provide HTTP proxy example using netcat
One of the fortunes that are included in freebsd-tips talks about how
the superserver can be used to proxy connections with netcat, but there are
no examples provided. This commit adds an example with comment explaining
what it does.

Submitted by:	debdrup
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24800
2020-05-13 02:17:27 +00:00
Eric van Gyzen
fac6dee9eb Remove tests for obsolete compilers in the build system
Assume gcc is at least 6.4, the oldest xtoolchain in the ports tree.
Assume clang is at least 6, which was in 11.2-RELEASE.  Drop conditions
for older compilers.

Reviewed by:	imp (earlier version), emaste, jhb
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D24802
2020-05-12 15:22:40 +00:00
Aleksandr Fedorov
2cd7735d92 Add a new bhyve network backend that allow to connect the VM to the netgraph(4) network.
The backend uses the socket API with the PF_NETGRAPH protocol family, which is provided by the ng_socket(4).

To use the new backend, provide the following bhyve option:
-s X:Y:Z,[virtio-net|e1000],netgraph,socket=[ng_socket name],path=[destination node],hook=[our socket src hook],peerhook=[dst node hook]

Reviewed by:	vmaffione, lutz_donnerhacke.de
Approved by:	vmaffione (mentor)
Sponsored by:	vstack.com
Differential Revision:	https://reviews.freebsd.org/D24620
2020-05-12 11:18:14 +00:00
Takanori Watanabe
9287f06d08 Add le_scan subcommand to hccontrol.
PR: 246141
Submitted by:	Marc Veldman
2020-05-11 15:32:32 +00:00
Vincenzo Maffione
692dbfe930 bhyve: update man page to describe the virtio-net mtu option
r359704 introduced an 'mtu' option for the virtio-net device emulation.
Update the man page to describe the new option.

Reviewed by:	bcr
Differential Revision:	https://reviews.freebsd.org/D24723
2020-05-09 07:57:41 +00:00
Aleksandr Fedorov
5bebe92327 bhyve: Pass the full string of options to the network backends.
Reviewed by:	vmaffione
Approved by:	vmaffione (mentor)
Sponsored by:	vstack.com
Differential Revision:	https://reviews.freebsd.org/D24735
2020-05-08 17:15:54 +00:00
Takanori Watanabe
e961db83e5 Document le_enable subcommand 2020-05-08 01:19:29 +00:00
John Baldwin
483d953a86 Initial support for bhyve save and restore.
Save and restore (also known as suspend and resume) permits a snapshot
to be taken of a guest's state that can later be resumed.  In the
current implementation, bhyve(8) creates a UNIX domain socket that is
used by bhyvectl(8) to send a request to save a snapshot (and
optionally exit after the snapshot has been taken).  A snapshot
currently consists of two files: the first holds a copy of guest RAM,
and the second file holds other guest state such as vCPU register
values and device model state.

To resume a guest, bhyve(8) must be started with a matching pair of
command line arguments to instantiate the same set of device models as
well as a pointer to the saved snapshot.

While the current implementation is useful for several uses cases, it
has a few limitations.  The file format for saving the guest state is
tied to the ABI of internal bhyve structures and is not
self-describing (in that it does not communicate the set of device
models present in the system).  In addition, the state saved for some
device models closely matches the internal data structures which might
prove a challenge for compatibility of snapshot files across a range
of bhyve versions.  The file format also does not currently support
versioning of individual chunks of state.  As a result, the current
file format is not a fixed binary format and future revisions to save
and restore will break binary compatiblity of snapshot files.  The
goal is to move to a more flexible format that adds versioning,
etc. and at that point to commit to providing a reasonable level of
compatibility.  As a result, the current implementation is not enabled
by default.  It can be enabled via the WITH_BHYVE_SNAPSHOT=yes option
for userland builds, and the kernel option BHYVE_SHAPSHOT.

Submitted by:	Mihai Tiganus, Flavius Anton, Darius Mihai
Submitted by:	Elena Mihailescu, Mihai Carabas, Sergiu Weisz
Relnotes:	yes
Sponsored by:	University Politehnica of Bucharest
Sponsored by:	Matthew Grooms (student scholarships)
Sponsored by:	iXsystems
Differential Revision:	https://reviews.freebsd.org/D19495
2020-05-05 00:02:04 +00:00
Mitchell Horne
d0adbca274 Add RISC-V interpreter example
Now that RISC-V support has landed in qemu-user-static, add to the list
of examples in the binmiscctl(8) manpage.

Reviewed by:	kevans
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D24646
2020-05-01 01:31:19 +00:00
Bryan Drewery
5dda1d0b82 config: Add no-ctfconvert support.
Bump CONFIGVERS to 600018 for this support.

Some files may purposely have debug info disabled or are *source files*
that attempt to run ctfconvert on them. Currently ctfconvert ignores
these errors but I have a change to make the errors real so we can
catch real problems like exceeding type limits.

Sponsored by:		Dell EMC
Reviewed by:		imp, cem, kevans
Differential Revision:	https://reviews.freebsd.org/D24535
2020-04-28 16:09:22 +00:00
Bryan Drewery
18bcf5a07d Restore local kernel "prog" filtering lost in r332099.
This behavior is most relevant for ipfw(4) as documented in syslog.conf(5).
The recent addition of property-based regex filters in r359327 is a
fine workaround for this but the behavior was present since 1997 and
documented.

This only fixes local matching of the "kernel program". It does not
change the forwarded format at all. On the remote side it will still
be "kernel: ipfw:" and not be parsed as a kernel message. This matches
old behavior.

MFC after:	2 weeks
Reviewed by:	markj
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D24286
2020-04-28 16:07:15 +00:00
Takanori Watanabe
1f5d883dd7 Add le_read_buffer_size command and manpage.
It supports both v1 and v2 command.

PR:245964
Submitted by:	Marc Veldman <marc@bumblingdork.com>
2020-04-28 16:00:34 +00:00
Takanori Watanabe
eb2aebeafd Improve error handling
Check return values from hci_request()
Check rp.status
Print error messages with hci_status2str()

PR:	245769
Submitted by:	Marc Veldman
2020-04-28 13:28:58 +00:00