Commit graph

9756 commits

Author SHA1 Message Date
Matteo Riondato 5567b132a4 pfctl: fix retrieving nested anchors
PR:		262622
MFC after:	1 week
Reviewed by:	kp

(cherry picked from commit cd8438e5a3)
2022-03-24 10:44:31 +01:00
Piotr Pawel Stefaniak c4e1fbfe56 mount: make libxo support more locale-aware
"special", "node", and "mounter" are not guaranteed to be encoded with
UTF-8. Use the appropriate modifier.

(cherry picked from commit 260f26f035)
2022-03-23 16:48:03 +01:00
Cameron Katri 3f8b52c910 mount: add libxo(3) support
Adds --libxo to mount(8).

(cherry picked from commit e725ee7eb6)
2022-03-23 16:47:33 +01:00
Warner Losh eeec49e0b3 devd: correct wifi regexp
Correct the wifi regexp to include iwlwifi and remove wi driver that was
has been retired.

Sponsored by:		Netflix

(cherry picked from commit e0ab0ff104)
2022-03-19 07:59:07 -06:00
Warner Losh cb95daaa91 devd: remove the scsi regexp
We don't really use the scsi regexp for anything. The rescan was a
workaround that was fixed a long time ago and has been disabled for
ages. And the regexp was incomplete.

Sponsored by:		Netflix

(cherry picked from commit 926e825ef8)
2022-03-19 07:59:07 -06:00
Wuyang Chung 4391c305e8 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
Sponsored by:	NVIDIA Networking

(cherry picked from commit c5f549c1e0)
2022-03-17 10:54:57 +01:00
Kirk McKusick 934ba51bc9 Ensure that fsck(8) / fsck_ffs(8) produces the correct exit code for missing devices.
PR:          262580
Approved by: re (gjb, early MFC)

(cherry picked from commit 2983ec0a87)
2022-03-16 15:56:52 -07:00
Kristof Provost d271eca03f 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

(cherry picked from commit 8c1400b0a1)
2022-03-15 04:24:25 +01:00
Kristof Provost e134e088c5 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

(cherry picked from commit f0c334e4de)
2022-03-15 04:24:25 +01:00
Kristof Provost 4da31fbe58 pfctl: support recursive printing of nat rules
PR:		252617
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D34455

(cherry picked from commit a20773c810)
2022-03-15 03:52:18 +01:00
Kristof Provost eb9784f245 pfctl: remove unused variable
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit c4e49c3a65)
2022-03-15 03:51:15 +01:00
Cy Schubert 1fc127c5e1 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.

(cherry picked from commit 93c1048a13)
2022-03-09 16:31:40 -08:00
Cy Schubert 9b1b1dca31 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.

(cherry picked from commit ec793543fe)
2022-03-09 16:31:40 -08:00
Cy Schubert 35ddf84138 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)".

(cherry picked from commit 915395a280)
2022-03-09 16:31:40 -08:00
Warner Losh 8f5c107656 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

(cherry picked from commit 78fbaa1fac)
2022-03-09 13:52:23 -07:00
Warner Losh 327da43602 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

(cherry picked from commit 9835900cb9)
2022-03-09 13:52:22 -07:00
Cy Schubert d1f3afc4a4 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.

(cherry picked from commit 9291d079d5)
2022-03-07 05:32:58 -08:00
Franco Fichtner 586827df60 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

(cherry picked from commit abf5bff71d)
2022-03-07 08:18:57 -05:00
Eric van Gyzen c14635226b 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

(cherry picked from commit 4e71258227)
2022-03-02 15:56:30 -06:00
Chuck Silvers a0c3799828 fsck_ffs: don't try to write in read-only mode
(cherry picked from commit ed1a156b03)

Sponsored by:	Netflix
2022-02-27 21:36:06 -08:00
Chuck Tuffli 7de3a3e919 nvme: fix spelling of Namespace
Fix spelling of a macro definition.

PR:		262141

(cherry picked from commit c2318cf80a)
2022-02-27 17:59:31 -08:00
Kirk McKusick 5f3cd10138 Update fsdb(8) to reflect new structure of fsck_ffs(8).
(cherry picked from commit c5d476c98c)
2022-02-26 13:38:48 -08:00
Kirk McKusick 5628a09019 Avoid unaligned writes by fsck_ffs(8).
(cherry picked from commit 7a1c1f6a03)
2022-02-26 13:34:11 -08:00
Robert Wing 0add00229d dumpfs(8): add option to only print superblock information
Add an option to dumpfs, `-s`, that only prints the super block information.

Reviewed by:	chs, imp
Differential Revision:	https://reviews.freebsd.org/D30881

(cherry picked from commit dc35484536)
2022-02-23 09:27:27 -09:00
Kristof Provost 63220460d0 libpfctl: fix creatorid endianness
We provide the hostid (which is the state creatorid) to the kernel as a
big endian number (see pfctl/pfctl.c pfctl_set_hostid()), so convert it
back to system endianness when we get it from the kernel.

This avoids a confusing mismatch between the value the user configures
and the value displayed in the state.

MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33989

(cherry picked from commit 735748f30a)
2022-02-18 11:14:58 +01:00
Kristof Provost b5f6f687a2 pfctl: improve error reporting for routehost
If an invalid (i.e. overly long) interface name is specified error out
immediately, rather than in expand_rule() so we point at the incorrect
line.

PR:		260958
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D34008

(cherry picked from commit e68de66943)
2022-02-18 11:14:58 +01:00
Edward Tomasz Napierala b993d60f60 Cross-reference camcontrol(8) and zonectl(8) man pages.
(cherry picked from commit 28b475b018)
2022-02-14 00:04:44 +00:00
Alan Somers 2af3758a32 Various fixes for ggatec and ggated
Dynamically size buffers in ggatec. Instead of static size on the stack.
Add flush support.

Submitted by:	Johannes Totz <jo@bruelltuete.com>
Reviewed by:	asomers
Differential Revision: https://reviews.freebsd.org/D31722

(cherry picked from commit 6226477a46)

geom_gate: ensure readprov is null-terminated

With crafted input to the G_GATE_CMD_CREATE ioctl, geom_gate can be made
to print kernel memory to the system console, potentially revealing
sensitive data from whatever was previously in that memory page.

But but but: this is a case of the sys admin misconfiguring, and you'd
need root privileges to do this.

Submitted By:	Johannes Totz <jo@bruelltuete.com>
Reviewed By:	asomers
Differential Revision: https://reviews.freebsd.org/D31727

(cherry picked from commit f284bed200)
2022-02-16 21:07:15 -07:00
Kirk McKusick 166926a3de Have fsck_ffs(8) properly correct superblock check-hash failures.
cherry pick cleanups from commit c0bfa109b9

PR:           245916
2022-02-15 17:14:22 -08:00
Kirk McKusick efd949aaba Have fsck_ffs(8) properly correct superblock check-hash failures.
(cherry picked from commit c0bfa109b9)

PR:           245916
2022-02-15 17:14:22 -08:00
Cy Schubert d0695f8a40 ipfilter: Restore ipfsync
ipfsync is a WIP sync daemon designed to be used in a failover scenario.
It was removed by 5ee61c7daa. This commit
restores its three files. ipfsync is in my work queue.

(cherry picked from commit 08ab34a06a)
2022-02-07 05:51:18 -08:00
Cy Schubert 52f62a6983 ipfilter: Fix manpage typos
Reported by:	jrtc27
Fixes:		2582ae5740

(cherry picked from commit ad07e93fe1)
2022-02-07 05:51:17 -08:00
Cy Schubert f4d126ee1f ipfilter userland: Fix typos
Reported by:	netchild
Fixes:		2582ae5740

(cherry picked from commit cc3e5b372e)
2022-02-07 05:51:17 -08:00
Cy Schubert 189b9222f9 ipfilter userland: Fix branch mismerge
The work to ANSIfy and adjust returns to style(9) resulted in a mismerge
of a stash when ipfilter was moved from contrib to sbin. An older file
replaced WIP at the time, resulting in a regression.

The majority of this work was done in 2018 saved as git stashes within
a git-svn tree and migrated to the git tree. The regression occurred
when the various stashes were sequentially merged to create individual
commits, following the ipfilter move to netpfil and sbin.

Reported by:	jrtc27
Fixes:		2582ae5740
Pointy hat to:	cy

(cherry picked from commit a3522837b0)
2022-02-07 05:51:17 -08:00
Cy Schubert fcb8e92558 ipfilter userland: Style(9) requires a space after return
Reported by:    jrtc27
Fixes:          2582ae5740

(cherry picked from commit 44bc301921)
2022-02-07 05:51:17 -08:00
Cy Schubert d47287c437 ipfilter: Fix typos
Reported by:	jrtc27
Fixes:		2582ae5740

(cherry picked from commit d86f022e79)
2022-02-07 05:51:16 -08:00
Cy Schubert 7d98606953 ipfilter userland: Fix whitespace errors
Replace leading spaces with a tabs on affected lines.

(cherry picked from commit 5e13b104a4)
2022-02-07 05:51:16 -08:00
Cy Schubert fa66e74d3b ipfilter userland: Remove trailing whitespace
(cherry picked from commit 27fc223414)
2022-02-07 05:51:16 -08:00
Cy Schubert 9787fb28c9 ipfilter: Adjust userland returns to conform to style(9)
Adjust ipfilter's userland return statements to conform to style(9).

(cherry picked from commit 2582ae5740)
2022-02-07 05:51:15 -08:00
Cy Schubert c95ef272f1 ipfilter: INLINE --> inline
Replace the INLINE macro with inline. Some ancient compilers supported
__inline__ instead of inline. The INLINE hack compensated for it.
Ancient compilers are history.

Reported by:	glebius

(cherry picked from commit 9be9c1c084)
2022-02-07 05:51:15 -08:00
Cy Schubert 9ff592d868 ipflter: ANSIfy userland function declarations
Convert ipfilter userland function declarations from K&R to ANSI. This
syncs our function declarations with NetBSD hg commit 75edcd7552a0
(apply our changes). Though not copied from NetBSD, this change was
partially inspired by NetBSD's work and inspired by style(9).

Reviewed by:		glebius (for #network)
Differential Revision:	https://reviews.freebsd.org/D33595

(cherry picked from commit efeb8bffe3)
2022-02-07 05:51:15 -08:00
Cy Schubert dd68201611 ipfilter userland: Path fixup no longer required
Since the move of ipfilter from contrib to sbin adjusting the source path
is no longer required.

Fixes:		41edb306f0

(cherry picked from commit 7cb2d7c413)
2022-02-07 05:51:14 -08:00
Cy Schubert 95daf09d07 ipfilter: Move userland bits to sbin
Through fixes and improvements our ipfilter sources have diverged
enough to warrant move from contrib into sbin/ipf. Now that I'm
planning on implementing MSS clamping as in iptables it makes more
sense to move ipfilter to sbin.

This is the second of three commits of the ipfilter move.

Suggested by glebius on two occaions.

Suggested by and discussed with:	glebius
Reviewed by:				glebius, kp (for #network)
Differential Revision:		https://reviews.freebsd.org/D33510

(cherry picked from commit 41edb306f0)
2022-02-07 05:51:14 -08:00
Cy Schubert 5729ebba33 ipfilter: Move kernel bits to netpfil
Through fixes and improvements our ipfilter sources have diverged
enough to warrant move from contrib into sys/netpil. Now that I'm
planning on implementing MSS clamping as in iptables it makes more
sense to move ipfilter to netpfil.

This is the first of three commits the ipfilter move.

Suggested by glebius on two occaions.

Suggested by and discussed with:	glebius
Reviewed by:				glebius, kp (for #network)
Differential Revision:		https://reviews.freebsd.org/D33510

(cherry picked from commit 3b9b51fe46)
2022-02-07 05:51:14 -08:00
Kirk McKusick c16f699d79 Whitespace and capitalization cleanups.
(cherry picked from commit c82df0a0bf)
2022-02-04 11:59:30 -08:00
Ed Maste e5bcc6a856 route: remove write-only struct hostent from getaddr()
Under some INET/INET6 src.conf configurations sbin/route previously
failed to build due to an unused variable warning.  It was functionally
write-only anyway, so just remove it.

Reported by:	melifaro
Reviewed by:	melifaro
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33717

(cherry picked from commit c217390359)
(cherry picked from commit f567fcb2ff)
2022-01-26 19:35:40 -05:00
Rick Macklem 82dbca47a5 mount_nfs: Add a "bgnow" NFS mount option
The "bg" option does not go background until the initial mount
attempt fails, which can take 60+ seconds.

This new "bgnow" option goes background immediately, avoiding
the 60+ second delay, if the NFS server is not yet available.

The man page update is a content change.

PR:		260764

(cherry picked from commit 08a8d16cbb)
2022-01-25 15:25:06 -08:00
Andriy Gapon 82acfc0d78 add and use defintions for ATA power modes
Those can be returned by CHECK POWER MODE command (0xe5).
Note that some of the definitions duplicate definitions for Extended
Power Conditions.

(cherry picked from commit 75bc7150f4)
2022-01-25 09:43:11 +02:00
Li-Wen Hsu 7ce7a36db0
fsck(8): Fix typo
PR:		260949
Reported by:	Graham Perrin <grahamperrin@gmail.com>
MFC after:	3 days

(cherry picked from commit 6853ef66f1)
2022-01-15 20:34:18 +08:00
Konstantin Belousov e01bceba24 ldconfig: remove two symbols
(cherry picked from commit fcbb1441d0)
2022-01-15 02:51:14 +02:00