Commit graph

18927 commits

Author SHA1 Message Date
Robert Wing
942e69146e fstyp(8): define HAVE_ZFS macro when built with zfs
The HAVE_ZFS macro was dropped from the Makefile during the OpenZFS
merge, bring it back.

While here, drop unused WARNS setting.

PR:             255616
Reported by:    Michael Büker <freebsd@michael-bueker.de>
Submitted by:   Michael Büker <freebsd@michael-bueker.de>
Fixes:          9e5787d228
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D30221

(cherry picked from commit 91f251b2ab)
2021-05-21 07:21:00 -08:00
Daniel Austin
395bc3598b mpsutil: extend show adapter information, add NCQ control
'show adapter' now shows PCIe width and speed, IOC Speed, and the
temperature of the controller.

A new command, 'set ncq', is added.
It enables or disables SATA NCQ in the NVRAM of the card.
Its current setting is added to 'show adapter' as well.

PR:		254841
MFC after:	2 weeks
Relnotes:	perhaps

(cherry picked from commit e2ea6942ab)
2021-05-21 13:29:17 +03:00
Navdeep Parhar
98893d4953 cxgbetool(8): Add support for setting the hashfilter mode (filter mask).
Tighten up the validation of filter modes while here.  Unrecognized
keywords will be now be flagged as errors instead of being ignored.

(cherry picked from commit 038148c108)
2021-05-15 19:57:12 -07:00
Dmitry Wagin
55b6c85e0c syslogd: Increase message size limits
Add a -M option to control the maximum length of forwarded messages.
syslogd(8) used to truncate forwarded messages to 1024 bytes, but after
commit 1a874a126a ("Add RFC 5424 syslog message output to syslogd.")
applies a more conservative limit of 480 bytes for IPv4 per RFC 5426
section 3.2.  Restore the old default behaviour of truncating to 1024
bytes.  RFC 5424 specifies no upper limit on the length of forwarded
messages, while for RFC 3164 the limit is 1024 bytes.

Increase MAXLINE to 8192 bytes to correspond to commit 672ef817a192.

Replaced bootfile[] size for MAXPATHLEN used in getbootfile(3) as a
returned value. Using (MAXLINE+1) as a size for bootfile[] is excessive.

PR:		241937
Differential Revision:	https://reviews.freebsd.org/D27206

(cherry picked from commit 2d82b47a5b)
2021-05-14 09:56:17 -04:00
Kristof Provost
c505bdcc4e authpf: Start using libpfctl
Use pfctl_kill_states() rather than the DIOCKILLSTATES ioctl directly.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30057

(cherry picked from commit 2b2ed4a697)
2021-05-14 10:40:12 +02:00
Robert Wing
6fa8a15770 autofs: best effort to maintain mounttab and mountdtab
When an automounted filesystem is successfully unmounted, call
rpc.umntall(8) with the -k flag.

rpc.umntall(8) is used to clean up /var/db/mounttab on the client and
/var/db/mountdtab on the server. This is only useful for NFSv3.

PR:     251906
Reviewed by: trasz
Differential Revision:  https://reviews.freebsd.org/D27801

(cherry picked from commit 88e531f38c)
2021-05-11 15:48:44 -08:00
Kristof Provost
c93907df7b pf: Allow multiple labels to be set on a rule
Allow up to 5 labels to be set on each rule.
This offers more flexibility in using labels. For example, it replaces
the customer 'schedule' keyword used by pfSense to terminate states
according to a schedule.

Reviewed by:	glebius
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29936

(cherry picked from commit 6fcc8e042a)
2021-05-10 21:45:57 +02:00
Mark Johnston
b2c871b138 bhyve: Set SO_REUSEADDR on the gdb stub socket
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30037

(cherry picked from commit 02e7a6514e)
2021-05-10 09:35:04 -04:00
Kristof Provost
6fd48efd8d libpfctl: Switch to pfctl_rule
Stop using the kernel's struct pf_rule, switch to libpfctl's pfctl_rule.
Now that we use nvlists to communicate with the kernel these structures
can be fully decoupled.

Reviewed by:	glebius
MFC after:	4 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29644

(cherry picked from commit e9eb09414a)
2021-05-07 10:15:42 +02:00
Kristof Provost
5268c55fa5 bsnmp: Use libpfctl
Reviewed by:	glebius
MFC after:	4 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29642

(cherry picked from commit 956e7d2325)
2021-05-07 10:15:42 +02:00
Kristof Provost
3711a14493 (t)ftp-proxy: use libpfctl
Reviewed by:	glebius
MFC after:	4 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29641

(cherry picked from commit 95be9288f0)
2021-05-07 10:15:42 +02:00
Alfredo Dal'Ava Junior
7d45bf699d mprutil: add big endian support
This fix mprutil on big endian platforms, as follow up of D25785.

Flash operations are still not working, such as MPI2_FUNCTION_FW_UPLOAD
failing due to timeout.

Firmware version used during tests: 16.00.01.00

Submitted by:	Andre Fernando da Silva <andre.silva@eldorado.org.br>
Reviewed by:	luporl, Sreekanth Reddy <sreekanth.reddy@broadcom.com> (by e-mail)
Sponsored by:	Eldorado Research Institute (eldorado.org.br)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D26040

(cherry picked from commit fc9780fd41)
2021-05-07 02:34:19 -03:00
Zhenlei Huang
e183dd501c traceroute6: Properly calculate UDP checksum
The revision D25604 capsicumize traceroute6. For UDP the send socket was
changed from SOCK_DGRAM to SOCK_RAW and thus the UDP checksum need be
calculated by application itself other than the kernel.

outpacket is filled with zeros by line 707, thus the first round the UDP
checksum is correct. But subsequent rounds outudp->uh_sum will be left
with garbage.

PR:		255507
Reviewed by:	ae, markj, tuexen
Differential Revision:	https://reviews.freebsd.org/D30042

(cherry picked from commit 1d712c0537)
2021-05-06 08:59:19 -04:00
Alexander Motin
22efcea413 Introduce "soft" serseq variant.
With new ZFS prefetcher improvements it is no longer needed to fully
serialize reads to reach decent prediction hit rate.  Softer variant
only creates small time window to reduce races instead of completely
blocking following reads while previous is running.  It much less
hurts the performance in case of prediction miss.

MFC after:	1 month

(cherry picked from commit ac503c194c)
2021-05-05 23:18:38 -04:00
Baptiste Daroussin
63d098d8d8 pkg(7): replace usage of sbuf(9) with open_memstream(3)
open_memstream(3) is a standard way to obtain the same feature we do get
by using sbuf(9) (aka dynamic size buffer), switching to using it makes
pkg(7) more portable, and reduces its number of dependencies.

Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D30005

(cherry picked from commit cc9a8a116d)
2021-05-05 09:50:02 +02:00
Baptiste Daroussin
d39a1652d4 pkg(7): indentation fixes
Non functional changes

(cherry picked from commit f648d757b7)
2021-05-05 09:50:02 +02:00
Baptiste Daroussin
78ee2a028e pkg(7): when bootstrapping first search for pkg.pkg file then pkg.txz
The package extension is going to be changed to .pkg to be among other
things resilient to the change of compression format used and reduce
the impact of all third party tool of that change.

Ensure the bootstrap knows about it

Reviewed by:	manu
Differential revision:	https://reviews.freebsd.org/D29232

(cherry picked from commit a2aac2f5e5)
(cherry picked from commit c244b1d8a3)
2021-05-05 09:49:37 +02:00
Baptiste Daroussin
c801503336 pw(8): use open_memstream(3) instead of sbuf(9)
open_memstream(3) is a standard function that brings here the same
functionnality what we were doing with sbuf(9).

(cherry picked from commit 0cd4b781a6)
2021-05-05 09:37:01 +02:00
Moritz Schmitt
3c5d1c587c Make pkg(7) use environment variables specified in pkg.conf
Modify /usr/sbin/pkg to use environment variables specified in pkg.conf.
This allows control over underlying libraries like fetch(3), which can
be configured by setting HTTP_PROXY.

Differential Revision:	https://reviews.freebsd.org/D29820

(cherry picked from commit e869d3c601)
2021-05-05 09:17:14 +02:00
Tai-hwa Liang
c59b71fd54 arp(8): fixing the deletion failure of IEEE1394 associated addresses
Without this, 'arp -d ${IEEE1394_ADDRESS}' gives the following error:

	arp: delete: cannot locate 10.0.0.71

Reviewed by:	glebius
MFC after:	2 weeks

(cherry picked from commit a0d6d0d0b9)
2021-05-03 07:51:53 +00:00
Mitchell Horne
d87ee7b97f pmcstat: fix the usage message for -t
A slight mix-up of the flags means this case isn't triggered when it
should be. Now, `pmcstat -s event -t 1234` will print the correct
error message.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit c4473add1d)
2021-04-29 10:21:19 -03:00
Mitchell Horne
112e303018 pmcstat: set initial counter value to zero
For an infrequent event, pmcstat may report (u_long)-1 for CPUs where
the counter was never incremented. Just set this to zero, instead.

ev->ev_count is passed as the 'count' argument to pmc_allocate(3), but
this wasn't always the case.

Reviewed by:	gnn
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29887

(cherry picked from commit edcf9e59c3)
2021-04-29 10:19:20 -03:00
Nathan Whitehorn
3d9fd6ad1c Allocate extra inodes in makefs when leaving free space in UFS images.
By default, makefs(8) has very few spare inodes in its output images,
which is fine for static filesystems, but not so great for VM images
where many more files will be added. Make makefs(8) use the same
default settings as newfs(8) when creating images with free space --
there isn't much point to leaving free space on the image if you
can't put files there. If no free space is requested, use current
behavior of a minimal number of available inodes.

Reviewed by:	manu
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D29492

(cherry picked from commit afb6a168f8)
2021-04-26 21:08:48 -04:00
Xin LI
26f2ebfbd9 usr.sbin/services_mkdb: diff reduction against NetBSD.
(cherry picked from commit 57b9a062d1)
2021-04-19 18:00:09 -07:00
Xin LI
abc1489bcb usr.sbin/uefisign: prevent specifying certificate, key or output
multiple times.

(cherry picked from commit 6234a0bfc8)
2021-04-19 17:59:58 -07:00
Gordon Bergling
e981fc6177 config(8): Mention the authors of a paper in the SEE ALSO section
Obtained from:	OpenBSD

(cherry picked from commit 2b59392cb0)
2021-04-16 16:25:03 +02:00
Gordon Bergling
cd1729e8b6 lpd(8): Mention the author of a paper in the SEE ALSO section
Obtained from:	OpenBSD

(cherry picked from commit c07aa0a587)
2021-04-16 16:24:37 +02:00
Nathan Whitehorn
5ec4eb443e Add a new mode to the scripted partition editor for variant disk names.
If the disk parameter "DEFAULT" is set in place of an actual device name,
or no disk is specified for the PARTITIONS parameter, the installer will
follow the logic used in the automatic-partitioning mode, in which it
will either provide a selection dialog for one of several disks if
several are present or automatically select it if there is only one. This
simplifies the creation of fully-automatic installation media for
hardware or VMs with varying disk names.

Suggested by:	Egoitz Aurrekoetxea <egoitz@sarenet.es>
MFC after:	3 weeks
Relnotes:	yes

(cherry picked from commit 5140034cc0)
2021-04-15 23:18:02 -04:00
Rick Macklem
33c839b6f6 nfsd: silence rpcb_unset noise for NFSv4 only servers
An NFSv4 only configuration does not register with
rpcbind(). Without this patch a failure to rpcb_unset()
is reported when the daemon is terminated for this case.

This is harmless noise, but this patch avoids calling
rpcb_unset() for the NFSv4 only case, avoiding the noise.

When called with "-d", it still does the rpcb_unset(),
assuming that the configuration might have been
changed to NFSv4 only and unregistering with
rpcbind() might still be needed.

(cherry picked from commit b43fe9eb4b)
2021-04-15 14:34:24 -07:00
Ed Maste
81a1e3f1f7 freebsd-update: improve mandoc db generation
freebsd-update compares the dates on man pages with mandoc.db, and if
any newer pages are found it regenerates mandoc.db.

Previously, if mandoc.db did not already exist the check failed and
freebsd-update then failed to create one.  Now, check that mandoc.db
exists before performing the check for newer pages.

Reported by:	bdrewery (in D10482)
Reviewed by:	gordon
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29575

(cherry picked from commit 741223a65c)
2021-04-13 14:42:17 -04:00
Xin LI
5d02b30ebd usr.sbin/services_mkdb: plug memory leak when line was blank.
Reviewed by:	bapt
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D29370

(cherry picked from commit 18f3c5fe92)
2021-04-13 00:38:34 -07:00
Nathan Whitehorn
d6dfcb6b27 Tweak language involving ZFS installation; no content changes.
(cherry picked from commit b8639a1098)
2021-04-12 10:00:10 -04:00
Nathan Whitehorn
7bcb10d210 Add some general notes about scripted installations.
(cherry picked from commit 3b20b988e0)
2021-04-12 10:00:09 -04:00
Nathan Whitehorn
63a9b1641a Include examples of how to build script-install media.
(cherry picked from commit c8923d191d)
(cherry picked from commit 9f88bee146)
2021-04-12 10:00:02 -04:00
Nathan Whitehorn
c87050f027 Improve example install scripts, making them simpler and more robust.
In particular:
- There is no need to do anything with gpart (the installer does that
  for you).
- There is no need to specify the network interface, since we have
  an option for defaults.

(cherry picked from commit f91026bf46)
2021-04-12 09:58:49 -04:00
Nathan Whitehorn
e37df024e0 Clarify that scripted installations don't require specification of boot
partitions, as there seems to be widespread confusion on this point.

MFC after:	1 day

(cherry picked from commit e8b4c5a622)
2021-04-12 09:58:43 -04:00
Jamie Gritton
bdb392c1d3 MFC jail: fix jail(8) synposis and usage message to match reality.
Reported by:	yuri
PR:		254741
MFC after:	5 days

(cherry picked from commit 8c1d956ffa)
2021-04-08 20:25:38 -07:00
Alan Somers
c835e54fdc mpsutil.8: fix typos in the man page
Sponsored by:	Axcient

(cherry picked from commit f073ab8712)
2021-04-08 02:15:50 +00:00
Mark Johnston
edda63ba97 makefs: Ignore the "tags" keyword in mtree manifests
An install using -DNO_ROOT emits mtree entries containing tags used by
pkgbase.  makefs(8) can safely ignore them, so do that rather than
emitting a warning for each entry.

Reviewed by:	brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29384

(cherry picked from commit ed42b22abc)
2021-04-06 09:07:24 -04:00
Mark Johnston
d3f2c31b43 traceroute6: Fix Capsicum rights for rcvsock
- Always use distinct sockets for send and recv
- Limit rights on the recv socket

For ICMP6 we were using the same socket for both send and receive, and
we limited rights on the socket such that it's impossible to receive
anything.

PR:		254623
Diagnosed by:	Zhenlei Huang <zlei.huang@gmail.com>
Reviewed by:	oshogbo
Differential Revision:	https://reviews.freebsd.org/D29523

(cherry picked from commit b8ae450f05)
2021-04-05 09:51:56 -04:00
Ryan Moeller
16443ffd41 bsdinstall: Drop vestigial bsdinstall-esps cleanup
This is not needed after 0b7472b3d8.

MFC after:	3 days
Sponsored by:	iXsystems, Inc.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D29325

(cherry picked from commit b07b7aec65)
2021-03-29 09:34:12 -04:00
Caleb St. John
af68f53806 rpc.lockd: Unconditionally close fds as daemon
When lockd is configured with a debug level of > 0 and foreground == 0,
the process is daemonized with a truth noclose argument to daemon().
This doesn't seem to be the desired behavior because that prevents
stdout and stderr from being closed, however, stdout and stderr aren't
used anywhere else. Furthermore, the man pages state that with a higher
debug level it will use the syslog facilities to do so.

Submitted by:	Caleb St. John
Discussed with:	rmacklem
MFC after:	3 days
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D29415

(cherry picked from commit badcfbacf3)
2021-03-29 09:33:35 -04:00
Caleb St. John
b92b2ffd12 align nfsdumpstate column output
There are scenarios where an NFS client will mount an NFSv4 export
without specifying a callback address.

When running nfsdumpstate under this circumstance, the column output is
shifted incorrectly which places the "ClientID" value underneath the
"Clientaddr" column.

This diff is a small cosmetic change that prints a blank in the
"Clientaddr" column and ensures the data for the columns are aligned
appropriately.

Submitted by:	Caleb St. John
Reviewed by:	sef (previous version)
MFC after:	3 days
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D18958

(cherry picked from commit efad9c8ba3)
2021-03-29 09:33:14 -04:00
Rick Macklem
85ad493677 mountd(8): generate a syslog message when the "V4:" line is missing
Daniel reported that NFSv4 mounts were not working despite having
set "nfsv4_server_enable=YES" in /etc/rc.conf.  Mountd was logging a
message that there was no /etc/exports file.
He noted that creating a /etc/exports file with a "V4:" line in it
was needed make NFSv4 mounts work.
At least one "V4:" line in one of the exports(5) file(s) is needed to
make NFSv4 mounts work. This patch fixes mountd.c so that it logs a
message indicting that there is no "V4:" line in any exports(5)
file when NFSv4 mounts are enabled.
To avoid this message being generated erroneously, /etc/rc.d/mountd
is updated to make sure vfs.nfsd.server_max_nfsvers is properly set
before mountd(8) is started.

PR:	253901

(cherry picked from commit 09673fc0f3)
2021-03-27 12:52:15 -07:00
D Scott Phillips
7590d7800c bhyve: support relocating fbuf and passthru data BARs
We want to allow the UEFI firmware to enumerate and assign
addresses to PCI devices so we can boot from NVMe[1]. Address
assignment of PCI BARs is properly handled by the PCI emulation
code in general, but a few specific cases need additional support.
fbuf and passthru map additional objects into the guest physical
address space and so need to handle address updates. Here we add a
callback to emulated PCI devices to inform them of a BAR
configuration change. fbuf and passthru then watch for these BAR
changes and relocate the frame buffer memory segment and passthru
device mmio area respectively.

We also add new VM_MUNMAP_MEMSEG and VM_UNMAP_PPTDEV_MMIO ioctls
to vmm(4) to facilitate the unmapping needed for addres updates.

[1]: https://github.com/freebsd/uefi-edk2/pull/9/

Originally by:	scottph
Sponsored by:	Intel Corporation
Reviewed by:	grehan
Approved by:	philip (mentor)
Differential Revision:	https://reviews.freebsd.org/D24066

(cherry picked from commit f8a6ec2d57)
2021-03-26 21:50:41 +08:00
Mark Johnston
e4bdf7ac2a rtsold: Fix validation of RDNSS options
The header specifies the size of the option in multiples of eight bytes.
The option consists of an eight-byte header followed by one or more IPv6
addresses, so the option is invalid if the size is not equal to 1+2n for
some n>0.  Check this.

The bug can cause random stack data to be formatted as an IPv6 address
and passed to resolvconf(8), but a host able to trigger the bug may also
specify arbitrary addresses this way.

Reported by:	Q C <cq674350529@gmail.com>
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 1af332a7d8)
2021-03-24 09:27:59 -04:00
Dag-Erling Smørgrav
34e12e9a17 MFC: Fix local-unbound setup for some IPv6 deployments.
On behalf of:	des
PR:		250984

(cherry picked from commit e5f02c140b)
2021-03-23 20:53:35 -04:00
Nathan Whitehorn
4601382e13 Fix scripted installs on EFI systems after default mounting of the ESP.
Because the ESP mount point (/boot/efi) is in mtree, tar will attempt to
extract a directory at that point post-mount when the system is installed.
Normally, this is fine, since tar can happily set whatever properties it
wants. For FAT32 file systems, however, like the ESP, tar will attempt to
set mtime on the root directory, which FAT does not support, and tar will
interpret this as a fatal error, breaking the install (see
https://github.com/libarchive/libarchive/issues/1516). This issue would
also break scripted installs on bare-metal POWER8, POWER9, and PS3
systems, as well as some ARM systems.

This patch solves the problem in two ways:
- If stdout is a TTY, use the distextract stage instead of tar, as in
  interactive installs. distextract solves this problem internally and
  provides a nicer UI to boot, but requires a TTY.
- If stdout is not a TTY, use tar but, as a stopgap for 13.0, exclude
  boot/efi from tarball extraction and then add it by hand. This is a
  hack, and better solutions (as in the libarchive ticket above) will
  obsolete it, but it solves the most common case, leaving only
  unattended TTY-less installs on a few tier-2 platforms broken.

In addition, fix a bug with fstab generation uncovered once the tar issue
is fixed that umount(8) can depend on the ordering of lines in fstab in a
way that mount(8) does not. The partition editor now writes out fstab in
mount order, making sure umount (run at the end of scripted, but not
interactive, installs) succeeds.

PR:		254395
Approved by:	re (gjb)
Reviewed by:	gjb, imp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D29380

(cherry picked from commit c2f16c595e)
2021-03-23 15:21:33 -04:00
Alex Richardson
2f0161f405 usr.bin/jail: Fix tests when using kyua -v parallelism=N
These tests create jails with the same name, so they cannot be run in
parallel.

Reviewed By:	lwhsu
Differential Revision: https://reviews.freebsd.org/D28482

(cherry picked from commit 72692dfdfe)
2021-03-17 09:56:40 +00:00
Alex Richardson
30cf33cdfb usr.sbin/praudit: Fix tests after 5619d49e07
Commit 5619d49e07 made the getgrgid() call inside bsm work as
intended so we now print "wheel" instead of a numeric 0 in the rgid field.

Reviewed By:	markj
Differential Revision: https://reviews.freebsd.org/D28462

(cherry picked from commit 7791ecf04b)
2021-03-17 09:55:40 +00:00