Commit Graph

9853 Commits

Author SHA1 Message Date
Ed Maste
2b20327ec9 dumpon: proceed without compression if the kernel lacks support
PR:		252554
Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34520
2022-03-16 12:08:28 -04:00
Kristof Provost
8a42005d1e pf: support basic L3 filtering in the Ethernet rules
Allow filtering based on the source or destination IP/IPv6 address in
the Ethernet layer rules.

Reviewed by:	pauamma_gundo.com (man), debdrup (man)
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34482
2022-03-14 22:42:37 +01:00
Hans Petter Selasky
d5ad1713cc Chase mixer(8) command-line interface changes
Some more nits regarding mute feature.

Differential revision:	https://reviews.freebsd.org/D34545
Sponsored by:		NVIDIA Networking
2022-03-14 09:38:04 +01:00
Mateusz Piotrowski
e83a53abeb Chase mixer(8) command-line interface changes
FreeBSD 14.0 is going to ship with a new implementation of the mixer(8)
command. Unfortunately, in order to support new features like mute, the
command-line interface of the new implementation is not backwards
compatible.

Update all the remaining documentation and scripts in the src tree
to use the new syntax.

While here, document in usbhidaction.1 that the mute functionality is
now supported.

Reviewed by:	christos, debdrup, hselasky
Approved by:	hselasky (src)
Fixes:	903873ce15 Implement and use new mixer(3) library for FreeBSD.
Differential Revision:	https://reviews.freebsd.org/D34545
2022-03-13 17:43:49 +01:00
Alexander Motin
7f16b501e2 GEOM: Introduce partial confxml API
Traditionally the GEOM's primary channel of information from kernel to
user-space was confxml, fetched by libgeom through kern.geom.confxml
sysctl.  It is convenient and informative, representing full state of
GEOM in a single XML document.  But problems start to arise on systems
with hundreds of disks, where the full confxml size reaches many
megabytes, taking significant time to first write it and then parse.

This patch introduces alternative solution, allowing to fetch much
smaller XML document, subset of the full confxml, limited to 64KB and
representing only one specified geom and optionally its parents.  It
uses existing GEOM control interface, extended with new "getxml" verb.
In case of any error, such as the buffer overflow, it just transparently
falls back to traditional full confxml.  This patch uses the new API in
user-space GEOM tools where it is possible.

Reviewed by:	imp
MFC after:	2 month
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D34529
2022-03-12 11:55:52 -05:00
Wuyang Chung
c5f549c1e0 newfs(8): Fix a bug in initialization of sblock.fs_maxbsize .
Fixes:		1c85e6a35d (SVN r98542)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/587
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-03-11 10:17:06 +01:00
Alexander Motin
5678114cd8 geom: Allow "load" command for already loaded modules.
I see more user-friendly to do nothing if the module is already
loaded, rather than returning quite confusing error message.

As side effect it allows to avoid std_list_available() call, using
quite expensive on large systems geom_gettree().

MFC after:	1 month
2022-03-08 12:13:51 -05:00
Kristof Provost
c4e49c3a65 pfctl: remove unused variable
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-08 13:57:46 +01:00
Kristof Provost
8c1400b0a1 libpfct: factor out pfctl_get_rules_info()
Introduce pfctl_get_rules_info(), similar to pfctl_get_eth_rules_info()
to retrieve rules information (ticket and total number of rules).

Use the new function in pfctl.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34443
2022-03-08 13:57:45 +01:00
Kristof Provost
f0c334e4de libpfctl: support flushing rules/nat/eth
Move the code to flush regular rules, nat rules and Ethernet rules into
libpfctl for easier re-use.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34442
2022-03-08 13:57:45 +01:00
Kristof Provost
a20773c810 pfctl: support recursive printing of nat rules
PR:		252617
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D34455
2022-03-08 10:51:09 +01:00
Alexander Motin
2117cdd4b4 GEOM: Introduce gctl_add_param() API.
Make gctl_add_param() API public, allowing more precise control over
parameter flags.  Previously it was impossible to properly declare
write-only ASCII parameters, used for result reporting, they were
declared as read-write binary instead, that was not nice.

MFC after:	1 month
2022-03-07 11:12:25 -05:00
Kristof Provost
5bed7d2fa1 pfctl.8: Use the serial comma
Pointed out by:	Pau Amma.
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-03 18:32:27 +01:00
Cy Schubert
93c1048a13 ipfilter: Reliably print the interface name
When printing the interface name from the ipstate_t struct the interface
name in is_ifp may not always be avaiable when reading it from kmem
(tested on FreeBSD and NetBSD). However the is_ifname (the interface
name character string) is almost always available -- it is not available
when the source of the packet is a process running on the firewall
itself. Rather than print both interface name strings, print only the
one.

MFC after:	1 week
2022-03-03 06:43:12 -08:00
Cy Schubert
ec793543fe ipfilter: Obtain the interface name more efficiently
Rather than use a kmem read to determine the interface name used by a
nat_t structure through a pointer, nat_ipfs->netif->if_xname, obtain it
directly from nat_ifnames in the nat_t structure itself using the new
FORMAT_IF macro.

MFC after:	1 week
2022-03-03 06:43:11 -08:00
Cy Schubert
915395a280 ipfilter: Introduce the new FORMAT_IF macro
Interface names stored in the ipstate_t and ipnat_t structures can be
NULL. This occurs when an application, such as named, is running on the
firewall machine itself. For example an application, i.e. named, running
on the firewall itself will cause a state table display and NAT mapping
display to show a null ingress interface and its egress interface. This
is perfectly valid but confusing to human eyes. Rather than print
nothing, print "(null)".

MFC after:	1 week
2022-03-03 06:43:11 -08:00
Kristof Provost
e5349a2909 pfctl tests: Ethernet rule parsing tests
A few basic test cases for Ethernet rule parsing.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-02 17:00:08 +01:00
Kristof Provost
c32cd18055 pfctl: print ethernet rules when called with '-n'
Just as pfctl already does for other rules we print the ethernet rules
we would have loaded if '-n' is specified.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-02 17:00:08 +01:00
Kristof Provost
b590f17a11 pf: support masking mac addresses
When filtering Ethernet packets allow rules to specify a mac address
with a mask. This indicates which bits of the specified address are
significant. This allows users to do things like filter based on device
manufacturer.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-02 17:00:08 +01:00
Kristof Provost
6ea1c3cfc8 pfctl: support flushing ethernet rules
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-02 17:00:07 +01:00
Kristof Provost
c5131afee3 pf: add anchor support for ether rules
Support anchors in ether rules.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32482
2022-03-02 17:00:07 +01:00
Kristof Provost
87a89d6e14 pfctl: support lists of mac addresses
Teach the 'ether' rules to accept { mac1, mac2, ... } lists, similar to
the lists of interfaces or IP addresses we already supported for layer 3
filtering.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32481
2022-03-02 17:00:07 +01:00
Kristof Provost
fb330f3931 pf: support dummynet on L2 rules
Allow packets to be tagged with dummynet information. Note that we do
not apply dummynet shaping on the L2 traffic, but instead mark it for
dummynet processing in the L3 code. This is the same approach as we take
for ALTQ.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32222
2022-03-02 17:00:06 +01:00
Kristof Provost
77207b6022 pfctl: Document displaying Ethernet rules
Document the new 'pfctl -s ether' functionality.

Reviewed by:	bcr
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31750
2022-03-02 17:00:06 +01:00
Kristof Provost
c696d5c72f pfctl: Don't print (ether) to / from if they're not set
If we're not filtering on a specific MAC address don't print it at all,
rather than showing an all-zero address.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31749
2022-03-02 17:00:05 +01:00
Kristof Provost
30087aa2e0 pf: Support clearing ether counters
Allow the evaluations/packets/bytes counters on Ethernet rules to be
cleared.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31748
2022-03-02 17:00:05 +01:00
Kristof Provost
2b29ceb86f pfctl: Print Ethernet rules
Extent pfctl to be able to read configured Ethernet filtering rules from
the kernel and print them.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31738
2022-03-02 17:00:03 +01:00
Kirk McKusick
c7996ddf80 Create a new GEOM utility, gunion(8).
The gunion(8) utility is used to track changes to a read-only disk on
a writable disk. Logically, a writable disk is placed over a read-only
disk. Write requests are intercepted and stored on the writable
disk. Read requests are first checked to see if they have been
written on the top (writable disk) and if found are returned. If
they have not been written on the top disk, then they are read from
the lower disk.

The gunion(8) utility can be especially useful if you have a large
disk with a corrupted filesystem that you are unsure of how to
repair. You can use gunion(8) to place another disk over the corrupted
disk and then attempt to repair the filesystem. If the repair fails,
you can revert all the changes in the upper disk and be back to the
unchanged state of the lower disk thus allowing you to try another
approach to repairing it. If the repair is successful you can commit
all the writes recorded on the top disk to the lower disk.

Another use of the gunion(8) utility is to try out upgrades to your
system. Place the upper disk over the disk holding your filesystem
that is to be upgraded and then run the upgrade on it. If it works,
commit it; if it fails, revert the upgrade.

Further details can be found in the gunion(8) manual page.

Reviewed by: Chuck Silvers, kib (earlier version)
tested by:   Peter Holm
Differential Revision: https://reviews.freebsd.org/D32697
2022-02-28 16:36:08 -08:00
Cy Schubert
9291d079d5 ipfilter: Print protocol when listing NAT table mappings
NAT table mappings list only the source and destination IP, the source
and destinaion port numbers, and their mappings. But the protocol is not
listed. Now that Facebook and Google use QUIC, seeing port 443 in in a
list of active NAT sessions could mean 443/tcp or 443/udp. This patch
adds the protocol to the listing to aid in determining whether HTTPS is
TCP or QUIC in a NAT mapping listing. This also helps differentiatinete
between other protocols such as ICMP, ESP, and AH in ipnat list of active
sessions.

MFC after:	1 week
2022-02-28 12:11:39 -08:00
Kirk McKusick
c5d476c98c Update fsdb(8) to reflect new structure of fsck_ffs(8).
The cleanup of fsck_ffs(8) in commit c0bfa109b9 broke fsdb(8).
This commit adds the one-line update needed in fsdb(8) to make it
work with the new fsck_ffs(8) structure.

Reported by: Chuck Silvers
Tested by:   Chuck Silvers
MFC after:   3 days
2022-02-23 15:40:58 -08:00
Warner Losh
78fbaa1fac camcontrol fwdownload minor improvements
Minor improvements to the fwdownload code suggested by chs@:
o Print the path_id/target we're rescanning so it's not invisible
o No need for XPT_GDEVLIST, all the info is filled in. Remove sending it
  as well as a comment related to it from a mistaken observation. libcam
  always fills these in properly, so use those for the ccb path/target.
o Don't leak /dev/xpt fd in success cases.
o Rename fw_rescan_lun to fw_rescan_target and pass sim_mode to
  only print path_id and target_id info.

Reviewed by:		chs@
Fixes:			9835900cb9
Sponsored by:		Netflix
MFC After:		1 week
Differential Revision:	https://reviews.freebsd.org/D34348
2022-02-22 14:38:38 -07:00
Warner Losh
9835900cb9 camcontrol: Force a rescan of the lun after firmware download.
After downloading the firmware to a device, it's inquiry data likely
will change. Force a rescan of the target with the CAM_EXPECT_INQ_CHANGE
flag to get it to record the new inqury data as being expected. This
avoids the need for a 'camcontrol rescan' on the device which detaches
and re-attaches the disk (da, ada) device. This brings fwdownload up to
nvmecontrol's ability to do the same thing w/o changing the exposed
nvme/nvd/nda device. We scan the target and not the LUN because dual
actuator drives have multiple LUNs, but the firmware is global across
many vendors' drives (and the so far theoretical ones that aren't won't
be harmed by the rescan).

Since the underlying struct disk is now preserved accross this
operation, it's now possible to upgrade firmware of a root device w/o
crashing the system.  On systems that are quite busy, the worst that
happens is that certain operaions are reported cancelled when the new
firmware is activated. These operations are retried with the normal CAM
recovery mechanisms and will work on the retry. The only visible hiccup
is the time that new firmware is flashing / initializing. One should not
consider this operation completely risk free, however, since not all
drives are well behaved after a firmware download.

MFC After:		1 week
Relnotes:		yes
Sponsored by:		Netflix
Feedback by:		mav
Differential Revision:	https://reviews.freebsd.org/D34325
2022-02-22 10:43:26 -07:00
Mitchell Horne
de08b5167b init(8): use proper boolean type for globals
Now that stdbool.h is included, prefer this. No functional change
intended.
2022-02-21 20:16:13 -04:00
Mitchell Horne
7b0a665d72 boottrace: annotate init and shutdown utilities
Add boottrace annotations to record events in init(8), shutdown(8), and
reboot(8).

Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
X-NetApp-PR:	#23
Differential Revision:	https://reviews.freebsd.org/D31928
2022-02-21 20:16:07 -04:00
Chuck Tuffli
c2318cf80a nvme: fix spelling of Namespace
Fix spelling of a macro definition.

Reviewed by:	mav, imp
Differential Revision:	https://reviews.freebsd.org/D34330
2022-02-21 10:34:46 -08:00
Kirk McKusick
7a1c1f6a03 Avoid unaligned writes by fsck_ffs(8).
Normally fsck_ffs never does reads or writes that are not aligned
to the size of one of the checked filesystems fragments. The one
exception is when it finds that it needs to write the superblock
recovery information. Here it will write with the alignment reported
by the underlying disk as its sector size as reported by an
ioctl(diskfd, DIOCGSECTORSIZE, &secsize).

Modern disks have a sector size of 4096, but for backward compatibility
with older disks will report that they have a sector size of 512.
When presented with a 512 byte write, they have to read the associated
4096 byte sector, replace the 512 bytes to be written, and write
the updated 4096 byte sector back to the disk. Unfortunately, some
disks report that they have 512 sectors, but fail writes that are not
aligned to 4096 boundaries and are a multiple of 4096 bytes in size.

This commit updates fsck_ffs(8) so that it uses the filesystem fragment
size as the smallest size and alignment for doing writes rather than
the disk's reported sector size.

Reported by:  Andriy Gapon
MFC after:    1 week
2022-02-20 13:21:12 -08:00
Eric van Gyzen
4e71258227 newfs_msdos: connect the ATF test from NetBSD
NetBSD has an ATF test for newfs_msdos.  Connect it to the build.
Adapt it for FreeBSD.  This would have caught the bug fixed by my
previous commit.

Reviewed by:	delphij, emaste
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D34116
2022-02-16 09:56:16 -06:00
Eric van Gyzen
9990450e17 newfs_msdos: fix type of kern.maxphys
The type of the kern.maxphys sysctl OID is now ulong.  Change the
local variable type to match.

Reviewed by:	delphij, emaste
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D34116
2022-02-16 09:56:16 -06:00
Simon J. Gerraty
a8189e9bd4 veriexec(8): explain that only a unique prefix is required
When setting or querying state it is sufficient to
provide only enough of the state name to be unambiguous.
2022-02-14 13:54:22 -08:00
Franco Fichtner
abf5bff71d dhclient: support VID 0 (no vlan) decapsulation
VLAN ID 0 is supposed to be interpreted as having no VLAN with a bit of
priority on the side, but the kernel is not able to decapsulate this on
the fly so dhclient needs to take care of it.

Reviewed by:	markj
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D31515
2022-02-14 10:06:47 -05:00
Gleb Smirnoff
c999e3481d dmesg: detect wrapped msgbuf on the kernel side and if so, skip first line
Since 59f256ec35 dmesg(8) will always skip first line of the message
buffer, cause it might be incomplete.  The problem is that in most cases
it is complete, valid and contains the "---<<BOOT>>---" marker.  This
skip can be disabled with '-a', but that would also unhide all non-kernel
messages.  Move this functionality from dmesg(8) to kernel, since kernel
actually knows if wrap has happened or not.

The main motivation for the change is not actually the value of the
"---<<BOOT>>---" marker.  The problem breaks unit tests, that clear
message buffer, perform a test and then check the message buffer for
a result.  Example of such test is sys/kern/sonewconn_overflow.
2022-02-05 13:35:31 -08:00
Wolfram Schneider
179a53bb91 update external URL 2022-02-05 17:14:27 +00:00
Wolfram Schneider
83e6667726 update external URL 2022-02-05 17:11:18 +00:00
Wolfram Schneider
c918f50f8b update external URL 2022-02-05 17:09:48 +00:00
Wolfram Schneider
6981ec8bdf update external URLs 2022-02-05 08:19:56 +00:00
Kirk McKusick
9583be047b Properly fix parameter to sysctlnametomib(). 2022-02-04 14:04:12 -08:00
Kirk McKusick
504cb544e2 Fix parameter to sysctlnametomib(); 2022-02-04 14:00:38 -08:00
Kirk McKusick
c0bfa109b9 Have fsck_ffs(8) properly correct superblock check-hash failures.
Part of the problem was that fsck_ffs would read the superblock
multiple times complaining and repairing the superblock check hash
each time and then at the end failing to write out the superblock
with the corrected check hash. This fix reads the superblock just
once and if the check hash is corrected ensures that the fixed
superblock gets written.

Tested by:    Peter Holm
PR:           245916
MFC after:    1 week
Sponsored by: Netflix
2022-02-04 11:47:48 -08:00
John Baldwin
6c9ed42828 ggatec: Use ANSI C definition for init_initial_buffer_size.
This fixes -Wstrict-prototypes and -Wold-style-definition warnings
from GCC 9.
2022-01-31 17:12:04 -08:00
Alexander V. Chernikov
656f5031c3 ifconfig: remove debug printf introduced in 779fd05344
Reported by:	jhb
2022-01-29 11:19:01 +00:00