Commit graph

10052 commits

Author SHA1 Message Date
Franco Fichtner 2e9bba5621 pf: stop resolving hosts as dns that use ":" modifier
When the interface does not exist avoid passing host with special pf
modifiers to DNS resolution as they come up empty anyway.

Reviewed by:	kp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D35429

(cherry picked from commit 28b64169ea)
2022-08-22 08:55:27 +02:00
Franco Fichtner 3c87f145d4 pfctl: fix FOM_ICMP/POM_STICKYADDRESS clash
pass inet proto icmp icmp-type {unreach}
	pass route-to (if0 127.0.0.1/8) sticky-address inet

The wrong struct was being tested. The parser tries to prevent
"sticky-address sticky-address" syntax but was actually cross-rule
enforcing that ICMP filter cannot be before the use of "sticky-address"
in next rule.

MFC after:	2 weeks
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D36050

(cherry picked from commit 1e73fbd8b2)
2022-08-20 09:14:27 +02:00
Eugene Grosbein e5861a2614 ifconfig.8: cleanup reminiscence about long gone ppp(4)
Replace ppp(4) removed since FreeBSD 8.0-RELEASE with vlan(4).
While here, remove commented out reference to non-existing "egress"
interface group hiding since initial import of interface groups
from OpenBSD in 2006.

(cherry picked from commit 3c9ad9398f)
2022-07-29 09:24:56 +07:00
Eric van Gyzen 1fd2752f6b 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
Sponsored by:	Dell EMC Isilon

(cherry picked from commit 9990450e17)
2022-07-27 09:50:52 -04:00
Zhenlei Huang 52832592bd ifconfig.8: Prefer consistent terminologies
Reviewed by:	pauamma_gundo.com, email_luiz.eng.br
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D35384

(cherry picked from commit ccc48995c2)
2022-07-22 01:56:25 +02:00
Gordon Bergling a101b1b7f2 pfctl(8): Fix a typo in a source code comment
- s/bufer/buffer/

(cherry picked from commit c9856c4ffb)
2022-07-19 18:01:08 +02:00
Andrew Turner a290c3d703 Remove PAGE_SIZE from hastd
It may not be known at compile time so we should detect it at run time.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35118

(cherry picked from commit ea578b34cb)
2022-07-19 08:03:30 +01:00
Rick Macklem 9fe17b520a mount_nfs.8: Update BUGS section for NFSv4.1/4.2
If the "intr" and/or "soft" mount options are used for
NFSv4 mounts, the protocol can be broken when the
operation returns without waiting for the RPC reply.
The likelyhood of failure increases for NFSv4.1/4.2
mounts, since the session slot will be broken when
an RPC reply is not processed.

This is mentioned in the BUGS section of "man mount_nfs",
but there was no specific mention of the session slot
problem.  This patch adds a sentence for this case.

PR: 260011

(cherry picked from commit aba7a81ab7)
2022-07-17 17:04:33 -07:00
Rick Macklem 02915e5ff9 mount_nfs: Warn that intr, soft are not safe for NFSv4
If the "intr" and/or "soft" mount options are used for
NFSv4 mounts, the protocol can be broken when the
operation returns without waiting for the RPC reply.
The likelyhood of failure increases for NFSv4.1/4.2
mounts, since the session slot will be broken when
an RPC reply is not processed.

This is mentioned in the BUGS section of "man mount_nfs",
but more needs to be done.  This patch adds code that
generates a warning message when the mount is done.

PR: 260011
(cherry picked from commit c0d14b0220)
2022-07-14 18:45:43 -07:00
Cy Schubert 831c6b8edd ipfilter: Support only jails in VNET
Jails without VNET have complete access to the ipfilter rules, NAT,
pools and logs. This is insecure. Only allow jails to manipulate
ipfilter rules, NAT tables and ippools if the jail has its own VNET.
Otherwise a jail can affect the global system.

This patch brings ipfilter in line with ipfw's support of VNET jails and
non-support of non-VNET jails.

(cherry picked from commit c47db49ba4)
2022-07-14 06:54:22 -07:00
Arseny Smalyuk c31f8b7bd8 ipfw: add support radix tables and table lookup for MAC addresses
By analogy with IP address matching, add a way to use ipfw radix
tables for MAC matching. This is implemented using new ipfw table
with mac:radix type. Also there are src-mac and dst-mac lookup
commands added.

Usage example:
  ipfw table 1 create type mac
  ipfw table 1 add 11:22:33:44:55:66/48
  ipfw add skipto tablearg src-mac 'table(1)'
  ipfw add deny src-mac 'table(1, 100)'
  ipfw add deny lookup dst-mac 1

Note: sysctl net.link.ether.ipfw=1 should be set to enable ipfw
filtering on L2.

Reviewed by:	melifaro
Obtained from:	Yandex LLC
Relnotes:	yes
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D35103

(cherry picked from commit 81cac3906e)
2022-07-14 16:04:22 +03:00
Kirk McKusick cb59f7dd22 Correctly update fs_dsize in growfs(8)
When growing a UFS/FFS filesystem, the size of the summary information
may expand into additional blocks. These blocks must be removed from
fs_dsize which records the number of blocks in the filesystem that can
be used to hold filesystem data.

While here also update the fs_old_dsize and fs_old_size fields for
compatibility with kernels that were compiled before the addition
of UFS2.

(cherry picked from commit 2049cc3218)
2022-07-08 14:46:16 -07:00
Kirk McKusick e349fcc80a Eliminate set but not used variable.
No functional change intended.

(cherry picked from commit 78dfcf256a)
2022-07-08 14:46:16 -07:00
Mateusz Piotrowski 76b06d5a1a sysctl.8: Reference sysctl(9)
MFC after:	1 week

(cherry picked from commit 0438e9beb5)
2022-07-07 11:56:18 +02:00
Juraj Lutter 7c500f98b8 kldload: Bring functionality in line with manual page
Honor -q parameter and do not display any warning messages when -q is
specified.

Approved by:		dfr
MFC after:		2 weeks
Sponsored by:		Resulta, s.r.o.
Differential Revision:	https://reviews.freebsd.org/D35511

(cherry picked from commit ad0a7ea650)
2022-07-01 17:16:22 +02:00
Mateusz Piotrowski 938f3df8cc ifconfig.8: Document -g all and -G all
The special group name "all" selects all the interfaces.

MFC after:	3 days

(cherry picked from commit 78d4bd8753)
2022-06-29 10:17:59 +02:00
Mateusz Piotrowski c154429082 ifconfig.8: Note that -l accepts -g in addition to -d and -u
Fixes:	5533c5046a ifconfig.8: Update -l synopsis
MFC after:	3 days

(cherry picked from commit 632ea8ea98)
2022-06-29 10:15:50 +02:00
Mateusz Piotrowski aff0be6e66 ifconfig.8: Update -l synopsis
The -g flag can be used together with the -l flag.

MFC after:	2 weeks

(cherry picked from commit 5533c5046a)
2022-06-29 10:15:15 +02:00
Mateusz Piotrowski b879d2b81a ifconfig.8: Document "ifconfig -g groupname"
"ifconfig -g groupname" prints a list of interface names,
which could be confusing, because it differs from
the behavior of "ifconfig -a -g groupname".

While here, add two examples showing the difference between
"ifconfig -a -g groupname" and "ifconfig -g groupname".

Fixes:	0dad3f0e15 Import interface groups from OpenBSD.
MFC after:	2 weeks

(cherry picked from commit 4d91c53a78)
2022-06-29 10:15:14 +02:00
Mateusz Piotrowski ab18258233 ifconfig.8: Remove commented-out Xr eon 5
This reference has been present in the manual page since the initial
import of BSD 4.4 Lite sbin Sources. It's time for it to be removed.

MFC after:	2 weeks

(cherry picked from commit e57f6630d9)
2022-06-29 10:15:14 +02:00
Mateusz Piotrowski 0c29dd8c58 ifconfig.8: Remove remaining Xerox Network Systems(tm) bits
Support for Xeros Network Systems seems to be long gone. There is no
reason to keep this in the manual page.

MFC after:	2 weeks

(cherry picked from commit 1969cc7bdc)
2022-06-29 10:15:13 +02:00
Mateusz Piotrowski a64829040f ifconfig.8: Simplify examples by using canonical parameters
Also, use Bd instead of Dl for multi line examples.

MFC after:	2 weeks

(cherry picked from commit 19ac0bc5c1)
2022-06-29 10:15:12 +02:00
Mateusz Piotrowski b6bcef4b77 ifconfig.8: Mark address_family as optional in synopsis
Commands like "ifconfig wlan0 up" are valid. There is no need to always
specify the address family.

MFC after:	2 weeks

(cherry picked from commit 2cd28d6f9b)
2022-06-29 10:15:12 +02:00
Mateusz Piotrowski fb40141d2b ifconfig.8: Improve description of the address argument
- Split paragraphs for clarity.
- Add an example of setting a random MAC address.

MFC after:	2 weeks

(cherry picked from commit 3049aac91b)
2022-06-29 10:15:11 +02:00
Mateusz Piotrowski 233f423174 ifconfig.8: Improve readability of address_family documentation
Also, move the description of the special case of "ifconfig -l ether" to
the description of the -l flag.

MFC after:	2 weeks

(cherry picked from commit ad8cac1229)
2022-06-29 10:15:10 +02:00
Jose Luis Duran c3bf44b542 ifconfig.8: Fix quoting
Obtained from:	67d77afb0d (r69907135)
Fixes:		67d77afb0d ifconfig.8: Do not use ``'' for quoting
MFC after:	2 weeks

(cherry picked from commit 607eed2f84)
2022-06-29 10:15:10 +02:00
Mateusz Piotrowski bff1b019e6 ifconfig.8: Clean up markup of "state" parameter
MFC after:	2 weeks

(cherry picked from commit 388c12e3f4)
2022-06-29 10:09:36 +02:00
Mateusz Piotrowski 13ac48d808 ifconfig.8: Make the -f flag description compact
- Remove extraneous examples
- Apply "-compact" to the list macros so that it is possible to fit the
  definitions of the types and formats in one terminal screen.

MFC after:	2 weeks

(cherry picked from commit 39da6db9bc)
2022-06-29 10:09:31 +02:00
Mateusz Piotrowski 58873b0b07 ifconfig.8: Do not use ``'' for quoting
MFC after:	2 weeks

(cherry picked from commit 67d77afb0d)
2022-06-29 10:09:26 +02:00
Mateusz Piotrowski 8bc09bfe17 ifconfig.8: Clean up the channel parameter description
MFC after:	2 weeks

(cherry picked from commit ce03846373)
2022-06-29 10:09:20 +02:00
Mateusz Piotrowski da24248e87 ifconfig.8: Add section headers to the parameters section
MFC after:	2 weeks

(cherry picked from commit 0e2045b294)
2022-06-29 10:09:17 +02:00
Mateusz Piotrowski b858b51f05 ifconfig.8: Clean up -n documentation
MFC after:	2 weeks

(cherry picked from commit 186a372f24)
2022-06-29 10:09:12 +02:00
Mateusz Piotrowski 9700451442 ifconfig.8: Clean up -k documentation
MFC after:	2 weeks

(cherry picked from commit 9076f99b9b)
2022-06-29 10:09:08 +02:00
Mateusz Piotrowski ac42ad49e3 ifconfig.8: Clean up -C and -v documentation
MFC after:	2 weeks

(cherry picked from commit 59cdaadcf6)
2022-06-29 10:09:00 +02:00
Mateusz Piotrowski de47f6ba4f ifconfig.8: Clean up -l documentation
MFC after: 2 weeks

(cherry picked from commit fe1e3b55f2)
2022-06-29 10:08:53 +02:00
Mateusz Piotrowski a079f92b19 ifconfig.8: Clean up -G & -g documentation
MFC after:	2 weeks

(cherry picked from commit 787599088b)
2022-06-29 10:08:32 +02:00
Mateusz Piotrowski 3087eb5222 ifconfig.8: Clean up documentation of -a, -d, and -u
MFC after:	2 weeks

(cherry picked from commit 0625c31391)
2022-06-29 10:06:20 +02:00
Mateusz Piotrowski e3c323d099 ifconfig.8: Clean up -L documentation
MFC after:	2 weeks

(cherry picked from commit 19c1b75f71)
2022-06-29 10:06:08 +02:00
Mateusz Piotrowski 68464cec25 ifconfig.8: Clean up -m documentation
MFC after: 2 weeks

(cherry picked from commit b56e4224e9)
2022-06-29 10:05:53 +02:00
Mateusz Piotrowski 5fa8bc5a5e ifconfig.8: Clean up formatting of -f documentation
This change is about moving the -f documentation into the right place in
the manual. Also, document the IFCONFIG_FORMAT variable in the
ENVIRONMENT section.

MFC after:	2 weeks

(cherry picked from commit f4f02fa1e3)
2022-06-29 10:05:45 +02:00
Mateusz Piotrowski 7a219d5cea ifconfig.8: Move options sections to the top
In order to clean up the layout of the manual page, let's keep
parameters in the end of the DESCRIPTION section. This patch does not
change any content, it's meant to only move the content around before
refactoring.

MFC after:	2 weeks

(cherry picked from commit f15eed7c2a)
2022-06-29 10:05:31 +02:00
Mateusz Piotrowski c58c22d2fb ifconfig.8: Deduplicate groupname documentation
-G and -g flags are already described somewhere else in the manual.

MFC after:	2 weeks

(cherry picked from commit 12a774649a)
2022-06-29 10:04:51 +02:00
Mitchell Horne a8f5d758c4 savecore: add an option to save a live minidump
The new '-L' flag will cause savecore to invoke the new mem(4) kernel
dump ioctl, taking a dump of the running system and writing the result
to a temporary file. Validation of the dump header is performed, similar
to regular crash dumps, and the final result is written to
livecore.X[.zst|.gz].

Also added is the '-Z' flag, which instructs the kernel to compress the
livedump compressed with zstd, akin to the existing -z flag. This option
has no effect in normal savecore(8) operation, but in theory could be
extended to perform such compression while reading the dump from the
dump device.

Encryption is unsupported for live dumps.

For example: 'savecore -Lz /var/crash' would create:
/var/crash/livecore.0.gz

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34347

(cherry picked from commit 0a5c04a892)
2022-06-27 16:32:06 -03:00
Zhenlei Huang f636f38bd7 ifconfig.8: reflect removal of FDDI and Token Ring
Reviewed By:	pauamma
Differential Revision: https://reviews.freebsd.org/D35409

(cherry picked from commit 030f3ee995)
2022-06-20 23:06:10 +01:00
Rick Macklem 667c782baa mount_nfs: Only create a mounttab file entry is nmount(2) succeeds
mount_nfs creates entries in the mounttab file and umount removes
them.  Entries in the mounttab file ae used by rpc.umntall to
notify the NFS server that NFSv3 entries need to be removed when
they have not been removed by umount.

Without this patch, an enty will be created in the mounttab file,
even if the nmount(2) syscall fails for the mount.  This patch
modifies the code so that the mounttab entry is only created
after nmount(2) succeeds.

This change only affects NFSv3 and only affects how showmount
displays NFSv3 mounts.

(cherry picked from commit 7cab630ba4)
2022-06-11 12:50:33 -07:00
Gordon Bergling d81e696d2a nvmecontrol(8): Fix a typo in an error message
- s/insufficent/insufficient/

(cherry picked from commit e2dfabb589)
2022-06-10 14:27:21 +02:00
Zhenlei Huang 02fe448437 devfs.rules: Do not expose "log" in the default devfs rules.
/etc/rc.d/jail no longer creates /dev/log as a symbolic link since
commit 84b354cb9a.

PR:		228351
Reviewed by:	jamie, markj

(cherry picked from commit 2670ea8a07)
2022-06-06 20:29:58 -04:00
Mitchell Horne 8fab6c4849 dumpon: warn if the configured netdump link is down
Previously we expected the DIOCSKERNELDUMP ioctl to return ENXIO if the
interface was down, but it does not actually do this. Grab the link
status using getifaddrs(3) instead, and downgrade this case from an
error to a warning; the user might bring the link back up at a later
time.

Reviewed by:	cem
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D35196

(cherry picked from commit 6543fa5a5c)
2022-05-27 13:22:48 -03:00
Mike Karels a1cd2f5d83 ping: add missing test files to Makefile
Should fix ATF tests after 5af718a592.

(cherry picked from commit a30eee517d)
2022-05-27 07:12:04 -05:00
Mike Karels e23a0f521f ping: if -S srcaddr uses a numeric address, use that protocol
The command "ping -S dotted.quad hostname" fails on dual-stack hosts
with the confusing message "ping: invalid source address: Name does
not resolve" because IPv6 is selected in preference.  If the argument
to -S is numeric (likely), select the corresponding address family,
as if -4 or -6 was specified.  Add tests that either IPv4 or IPv6 can
be forced via a -S parameter.

Reviewed by:	asomers
Differential Revision: https://reviews.freebsd.org/D35271

(cherry picked from commit 5af718a592)
2022-05-27 07:11:46 -05:00
Mark Johnston 9f093bf1e8 newfs_msdos: Fix warnings that arise when compiled for makefs
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f775c417fd)
2022-05-24 09:51:27 -04:00
Alan Somers 2737e6bca7 fusefs: use the fsname mount option if set
The daemon can specify fsname=XXX in its mount options.  If so, the file
system should report f_mntfromname as XXX during statfs.  This will show
up in the output of commands like mount and df.

Submitted by:	Ali Abdallah <ali.abdallah@suse.com>
Differential Revision:	https://reviews.freebsd.org/D35090

(cherry picked from commit 2f6362484c)
2022-05-23 13:11:11 -06:00
Eugene Grosbein 6af5ab1bb4 ipfw.8: MFC: spell "layer2" consistently throughout the manual page
(cherry picked from commit 9d7cefc278)
2022-05-21 09:10:04 +07:00
John Baldwin 6835ace580 setkey(8): Clarify language around AEAD ciphers.
AEAD ciphers for IPsec combine both encryption and authentication.  As
such, ESP configurations using an AEAD cipher should not use a
seperate authentication algorithm via -A.  However, this was not
apparent from the setkey manpage and 12.x and earlier did not perform
sufficient argument validation permitting users to pair an explicit -A
such as SHA256-HMAC with AES-GCM.  (The result was a non-standard
combination of AES-CTR with the specified MAC, but with the wrong
initial block counter (and thus different keystream) compared to using
AES-CTR as the cipher.)

Attempt to clarify this in the manpage by explicitly calling out AEAD
ciphers (currently only AES-GCM) and noting that AEAD ciphers should
not use -A.

While here, explicitly note which authentication algorithms can be
used with esp vs esp-old.  Also add subsection headings for the
different algorithm lists and tidy some language.

I did not convert the tables to column lists (Bl -column) though that
would probably be more correct than using literal blocks (Bd
-literal).

PR:		263379
Reviewed by:	Pau Amma <pauamma@gundo.com>, markj
Differential Revision:	https://reviews.freebsd.org/D34947

(cherry picked from commit e6dede1456)
2022-05-19 17:35:34 -07:00
Eugene Grosbein 9132c793cb setkey(8): MFC: load ipsec.ko automatically
If setkey(8) is used without ipsec.ko loaded beforehand,
its attempt to install SA/SPD into the kernel results in cryptic
EINVAL error code.

Let it be a bit more user-friendly and try to load ipsec.ko
automatically if it is not loaded, just like ifconfig(8) does it
for modules it needs.

PR:		263379

(cherry picked from commit 0aef862845)
2022-05-19 13:05:30 +07:00
Mina Galić c3c44de5f0 pkgbase: move devd's hyperv.conf to hyperv-tools package
This devd config file is useless without hyperv-tools, so we're moving
it into the hyperv-tools package. pr#263691

PR:		263691
MFC after:	3 days

(cherry picked from commit 7ac164dc8e)
2022-05-16 17:25:23 +02:00
Mitchell Horne 0decce4326 savecore: factor out info file handling
Move it to a separate function, allowing its reuse.

Reviewed by:	markj
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34822

(cherry picked from commit cf02cf8dbf)
2022-05-16 10:34:03 -03:00
Mitchell Horne 274e8fff31 savecore: decrease filename buffer sizes
All files are now created relative to savedirfd, e.g. with openat(2).
Therefore, we do not need character buffers to be PATH_MAX bytes long,
just long enough to hold the complete filename. 32 bytes is long enough
in all cases. These can be allocated on the stack.

While here, fix an error message that attempts to use an uninitialized
infoname.

Reviewed by:	markj
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34821

(cherry picked from commit fafeb5342b)
2022-05-16 10:34:03 -03:00
Mitchell Horne 1961b46059 savecore: fold maxdumps check into getbounds()
So that new callers of getbounds() don't need to duplicate it.

Reviewed by:	markj
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34783

(cherry picked from commit 4243d307d3)
2022-05-16 10:34:03 -03:00
Alexander Motin 5f6a3a81f6 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

(cherry picked from commit 7f16b501e2)
2022-05-10 21:20:25 -04:00
John Baldwin e6c88ad350 ggatec: Use ANSI C definition for init_initial_buffer_size.
This fixes -Wstrict-prototypes and -Wold-style-definition warnings
from GCC 9.

(cherry picked from commit 6c9ed42828)
2022-05-10 17:04:10 -07:00
John Baldwin a23f4ab7a1 mount: Don't pass a NULL format string to xo_err().
This fixes a -Wformat error from GCC 9.

Fixes:		e725ee7eb6 mount: add libxo(3) support
(cherry picked from commit 9d324b5ffc)
2022-05-10 15:51:49 -07:00
Matteo Riondato 407f7397d6 pfctl: fix recursive printing of rules
When asked to print rules recursively, correctly recurse for anchors
included in pf.conf with "anchorname/*".

PR:		262590
Reviewed by:	kp
MFC after:	3 weeks

(cherry picked from commit d86cf44350)
2022-05-04 08:20:58 +02:00
Gordon Bergling b6ab9fc601 fsck_ffs(8): Fix a typo in a source code comment
- s/it it/if it/

(cherry picked from commit 299fcf402d)
2022-04-14 08:16:23 +02:00
Gordon Bergling 6eef2e6425 ipnat(5): Fix a double word in the manual page
- s/be be/be/

(cherry picked from commit d7958fe1bc)
2022-04-14 08:14:37 +02:00
Gordon Bergling 6d14451326 hastd(8): Fix a typo in a source code comment
- s/proccesses/processes/

(cherry picked from commit b95a6ecffa)
2022-04-14 08:12:19 +02:00
Gordon Bergling 40ca30e71a dhclient(8): Fix a typo in a source code comment
- s/explicitely/explicitly/

(cherry picked from commit a06052d623)
2022-04-14 08:08:13 +02:00
Gordon Bergling dcf7f03b84 umount(8): Remove a double word in a source code comment
- s/this this/this/

(cherry picked from commit efb45ad024)
2022-04-14 08:06:55 +02:00
Gordon Bergling b631c429bb routed(8): Remove a double word in a source code comment
- s/it it/it/

(cherry picked from commit 009727ed57)
2022-04-14 07:58:53 +02:00
Robert Wing 7472cae2e0 mount.8: mention that the snapshot option is exclusive
When using the snapshot option, all other options are ignored. This
update reflects changes made in ab2dbd9b87.

Reviewed by:	0mp, mckusick
Differential Revision:	https://reviews.freebsd.org/D34584

(cherry picked from commit 8772a9117b)
2022-04-13 13:00:22 -08:00
Mateusz Piotrowski 0ae09fb966 ifconfig.8: Document that -k can be used with -a
MFC after:	2 weeks

(cherry picked from commit b710d4c85a)
2022-04-12 16:35:52 +02:00
Mateusz Piotrowski 1a5bc3f735 ifconfig.8: Improve -f synopsis
- There is no need to mention in the synopsis that -f can be a list of
  comma-separated type:format pairs. Let's keep it simple instead.
- Mention that -f can be supplied multiple times.
- Add -f to other entries in the synopsis where it can be used.

MFC after:	2 weeks

(cherry picked from commit 52ec8807d8)
2022-04-12 16:35:51 +02:00
Mateusz Piotrowski 1696f62771 ifconfig.8: Document the synopsis of -C
As documented, the -C flag can only be used on its own. Any other
command modifiers and flags are ignored when -C is used. Reflect that in
synopsis.

MFC after:	2 weeks

(cherry picked from commit efb4f7fd09)
2022-04-12 16:35:51 +02:00
Mateusz Piotrowski 624882f6b4 ifconfig.8: Show that -g groupname can be used on its own
MFC after:	2 weeks

(cherry picked from commit a9475cb389)
2022-04-12 16:35:50 +02:00
Mateusz Piotrowski 2506267cd6 ifconfig.8: Cluster together short flags
MFC after:	2 weeks

(cherry picked from commit 2e053399fc)
2022-04-12 16:35:49 +02:00
Mateusz Piotrowski a197457157 ifconfig.8: Add capability codes descriptions from handbook
We document capability codes (the CAPS field of "ifconfig wlan0 scan")
in both ifconfig(8) and the handbook. The list is more complete in the
manual page, while the descriptions of individual capabilities are more
detailed in the handbook.

In order to reduce content duplication and bit rot, let's move
handbook's details to the manual page and reference the manual page
whenever necessary.

Reviewed by:	debdrup
Reviewed by:	Pau Amma
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D34662

(cherry picked from commit 05621e0b20)
2022-04-12 16:35:49 +02:00
Reid Linnemann 14c4c1d01e libpfctl: relocate implementations of pfr_add/get/set_addrs
Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D34740

(cherry picked from commit 4823489ab6)
2022-04-11 16:52:34 +02:00
Mitchell Horne 3a64c08ceb savecore: include '-u' flag in usage message
Reported by:	Pau Amma <pauamma@gundo.com>
Fixes		bc7ed46b63 ("Add '-u' switch that would...")
MFC after:	3 days

(cherry picked from commit 173fc6f456)
2022-04-11 11:04:08 -03:00
Ed Maste fbc0c2a21b 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

(cherry picked from commit 2b20327ec9)
2022-04-10 19:12:30 -04:00
Gordon Bergling 52adfd8e15 devd(8): Fix a typo in a configuration file
- s/coresponding/corresponding/

(cherry picked from commit e09d161bd9)
2022-04-09 08:18:46 +02:00
Gordon Bergling b2f08f92a0 ipf(5): Fix a typo in the manual page
- s/accomodate/accommodate/

(cherry picked from commit 8a3568b584)
2022-04-09 08:10:37 +02:00
Kyle Evans 227e52a9c0 bectl: push space-in-name check down into libbe
This check was previously in `create` only, not applying to renames.  It
should really be applied at the libbe level, so that we can avoid
writing about this restriction over and over again.

While we're here: `bectl rename` always succeeds, even when it doesn't.
Start returning the error.

Reported By:	Christian McDonald <cmcdonald netgate com>

(cherry picked from commit dadb9c7093)
2022-04-05 22:37:07 -05:00
Kyle Evans 0e90da6549 bectl: add some discussion about boot environment layouts
Discuss the standard type of layout, as well as the "deep" BE layout,
and some of the properties of both.  Point the various -r flags at this
new section, to help users understand which they're working with and
what the -r flag is actually doing. Note that we may just deprecate the
-r flag in future versions, but the flag will be recognized as a NOP at
that point.

(cherry picked from commit c0f846ff23)
2022-04-05 22:37:07 -05:00
Alexander Motin 59c15b83be 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

(cherry picked from commit 5678114cd8)
2022-04-05 22:07:40 -04:00
Alexander Motin 4340533721 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

(cherry picked from commit 2117cdd4b4)
2022-04-05 22:07:40 -04:00
Mateusz Piotrowski 39289f6127 Cross-reference nextboot(8) and freebsd-update(8)
MFC after:	1 week

(cherry picked from commit 075999d3f1)
2022-04-05 16:08:43 +02:00
Mateusz Piotrowski 69c70456e8 ifconfig.8: Simplify -G & -g synopsis
MFC after:	1 week

(cherry picked from commit d1d14f0428)
2022-04-05 16:08:43 +02:00
Colin Percival 7d160dc9a1 sysctl(8): Mention CTLFLAG_SKIP
`sysctl -a` does not print values with this flag.

Reviewed by:	debdrup
Differential Revision:	https://reviews.freebsd.org/D34615

(cherry picked from commit 1dee7c74d1)
2022-04-04 12:11:36 -07:00
Gordon Bergling 498b49fee3 pfctl(8): Fix a typo in a comment
- s/steping/stepping/

(cherry picked from commit 2fa6223aaa)
2022-04-02 15:34:36 +02:00
Gordon Bergling 9dcb2e62c8 geom(4): Fix a typo in a source code comment
- s/comand/command/

(cherry picked from commit 407a0eac79)
2022-04-02 15:32:00 +02:00
Gordon Bergling 8b67abf317 mount(8): Fix a typo in source code comments
- s/filesytem/filesystem/

(cherry picked from commit c09770b2cd)
2022-04-02 15:29:58 +02:00
Mateusz Piotrowski 30a1d38e6c *: Do not use the no-op -r flag for bsdlabel(8)
The -r flag is ignored by the FreeBSD implementation of bsdlabel(8)
(also called disklabel(8) in the past). Remove its use from examples
and tests in the tree.

This commit does not touch historical documentation under share/doc/smm
and files under contrib/netbsd-tests.

Reviewed by:	imp
MFC after:	2 weeks
Approved by:	imp (src)
Fixes:		57dfbec57b More axe-work:
Differential Revision:	https://reviews.freebsd.org/D34585

(cherry picked from commit fd06117525)
2022-03-31 09:37:03 +02:00
Warner Losh cba6eb5d31 devd: Add rtw to wireless list
rtw88 and rtw89 are coming soon, so add them here now

Sponsored by:		Netflix
MFC After:		1 day

(cherry picked from commit dea368bc5e)
2022-03-29 09:43:55 -06:00
Alexander V. Chernikov b5b97a95aa ifconfig: remove debug printf introduced in 779fd05344
Reported by:	jhb

(cherry picked from commit 656f5031c3)
2022-03-28 08:50:21 +00:00
Alexander V. Chernikov 157bf2c996 ifconfig: improve vlan options parsing
PR:	261136
Reported by:	Daniel O'Connor
MFC after:	2 weeks

(cherry picked from commit 779fd05344)
2022-03-28 08:50:12 +00:00
Kristof Provost 73b72d4a71 pfctl: fix retrieving nested nat-anchors
When retrieving nat rules in anchors we need to set the path just like
we do for regular rules.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit a632d9e360)
2022-03-24 10:44:48 +01:00
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
Stefan Eßer 379bfb2aa9 sys/bitset.h: reduce visibility of BIT_* macros
(cherry picked from commit 5e04571cf3)
2022-01-14 18:17:30 +02:00
Hans Petter Selasky d7c7e033da kldstat(8): style(9) fixes.
No functional change intended.

Differential revision:  https://reviews.freebsd.org/D32506
Submitted by:   christos@
Sponsored by:   NVIDIA Networking

(cherry picked from commit 83237efcdb)
2022-01-07 14:23:09 +01:00
Hans Petter Selasky 5620ab6c8e kldstat(8): Fix indentation, whitespace to tabs.
No functional change intended.

Differential revision:  https://reviews.freebsd.org/D32502
Submitted by:   christos@
Sponsored by:   NVIDIA Networking

(cherry picked from commit 337c814316)
2022-01-07 14:23:09 +01:00
Hans Petter Selasky a8aaed1417 ifconfig(8): Don't set network interface capabilities when there is no change.
A quick grep through the kernel code shows network drivers compute the
changed bits of network capabilities after a SIOCSIFCAP IOCTL(2) by
using the bitwise exclusive or operation. When the set capabilities
are equal to the already read capabilities, no action will be taken.

Let ifconfig(8) predict this case and skip the SIOCSIFCAP IOCTL(2)
system call.

Discussed with:	kib@ (revert change in case of issues)
Sponsored by:	NVIDIA Networking

(cherry picked from commit ad8f078f66)
2022-01-07 14:11:32 +01:00
Emmanuel Vadot b2d245a0b0 pkgbase: Put more binaries/lib in runtime
Move some needed binaries/libs from FreeBSD-utilities to FreeBSD_runtime.
This is everything needed to boot to multiuser with FreeBSD-rc installed.

MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33435

(cherry picked from commit 93c4369096)
2022-01-05 18:23:51 +01:00
Emmanuel Vadot f1176bdaab pkgbase: Put sconfig in FreeBSD-utilities
There is no need to have it in runtime as it's not essential.

MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 0855e37c72)
2022-01-05 18:23:51 +01:00
Emmanuel Vadot aef2d41f38 pkgbase: Move spppcontrol to FreeBSD-ppp
This program belong with the other ppp-related programs.

Differential Revision:	 https://reviews.freebsd.org/D31792
Reviewed by: emaste

(cherry picked from commit 0818f499bc)
2022-01-05 18:23:49 +01:00
Emmanuel Vadot d5b2a32628 pkgbase: Create a FreeBSD-ggate package
Move ggate* to it.

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

(cherry picked from commit d22072a7d5)
2022-01-05 18:23:48 +01:00
Warner Losh 1cd848a314 fsutil: forward declare struct fstab
Fix the build by forward declaring struct fstab.

Sponsored by:		Netflix

(cherry picked from commit 7090cba410)
2022-01-02 14:23:57 -08:00
Kirk McKusick fe7121ec5b Update fsck(8) to ignore failures from a check program for a filesystem
when the fstab(5) entry for the filesystem has the "failok" attribute.

PR:           246201
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33424

(cherry picked from commit c72372c693)
2022-01-02 14:12:14 -08:00
Konstantin Belousov ed21083462 swapon(8): adapt to the new swapoff(2) interface
(cherry picked from commit b49b6e0f95)
2021-12-20 02:29:11 +02:00
Konstantin Belousov 79f9a41be0 swapoff(8): add -f flag
(cherry picked from commit 1aa249c935)
2021-12-20 02:29:11 +02:00
Elyes HAOUAS 2b788e4a71 sbin/mount_fusefs/mount_fusefs.8: Fix typos
"expicitly" --> "explicitly"
"uknown" --> "unknown"

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>

Pull Request:	https://github.com/freebsd/freebsd-src/pull/552

(cherry picked from commit c8a45820e0)
2021-12-14 14:48:35 -07:00
Kristof Provost 3836400a78 pfsync: fix incorrect enabling of defer mode
When we exposed the PFSYNCF_OK flag to userspace in 5f5bf88949 we
unintentionally caused defer mode to always be enabled.
The ioctl check only looked for nonzero, not for the PFSYNCF_DEFER flag.

Fix this check and ensure ifconfig sets the flag.

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

(cherry picked from commit 73fd0eaf59)
2021-12-13 14:49:27 +01:00
Ed Maste 0f0d52fd6a sbin: build ping if at least one of INET & INET6 is enabled
It does not build (and serves no purpose) if neither is true (i.e.,
building WITHOUT_INET and WITHOUT_INET6).  Also add an explicit error
in ping to make this case clear.

PR:		260082
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a4ef9e58bc)

OptionalObsoleteFiles: remove ping with INET & INET6 disabled

Reported by:	kevans
Fixes:		a4ef9e58bc ("sbin: build ping if at least one of...")
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 0179739a00)
2021-12-12 20:28:58 -05:00
Alan Somers c775b6ebab ping: fix parsing of options including '4' and '6'
ping uses a two-pass option parser.  The first pass determines whether
ipv4 or ipv6 is desired, and the second parses the rest of the options.
But the first pass wrongly detects a '4' or '6' in an option's value as
a request to use ipv6 or ipv6 respectively, for example in an invocation
like "ping -c6 1.2.3.4".

Fix this confusion by including all options in the first round of
parsing, but ignoring those unrelated to ipv4/ipv6 selection.

PR:		258048
Reported by:	ghuckriede@blackberry.com
Submitted by:	ghuckriede@blackberry.com
MFC after:	2 weeks
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D32344

(cherry picked from commit 9ce201f2ee)
2021-12-12 20:27:12 -05:00
Mike Karels 4dbba5ab60 ifconfig: warn if setting an Internet address without mask
Add a postproc function for af_inet, and add interface flags as a
parameter.  Check there if setting an address without a mask unless
the interface is loopback or point-to-point, where mask is not really
meaningful; warn if so.  This will hopefully be an error in the future.

(cherry picked from commit d8237b9555)
2021-12-10 10:24:51 -06:00
Ed Maste 42f1df6099 gvinum: add deprecation notice
Vinum is a Logical Volume Manager that was introduced in FreeBSD 3.0,
and for FreeBSD 5 was ported to geom(4) as gvinum. gvinum has had no
specific development at least as far back as 2010, and has a number of
known bugs which are unlikely to be resolved.

Add a deprecation notice to raise awareness but state that vinum "may
not be" available in FreeBSD 14.  Either it will be removed and the
notice will be updated to "is not" available, or someone will step up
to fix issues and maintain it and we will remove the notice.

Reviewed by:	imp (earlier version)
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29424

(cherry picked from commit b218441ac0)
2021-12-03 10:16:23 -05:00
Mark Johnston 6c5409c5d6 natd: Remove uneeded in_cksum.h includes
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 517373f723)
2021-12-01 07:42:13 -05:00
Konstantin Belousov 0619dbdfde ldconfig(8): check for no-args command line after options are parsed
(cherry picked from commit 3ede04c78c)
2021-12-01 03:07:19 +02:00
Konstantin Belousov a2a905f4d0 ldconfig: use libexec/rtld-elf/rtld_paths.h
(cherry picked from commit af91158706)
2021-12-01 03:07:19 +02:00
Konstantin Belousov 46e032b0b1 ldconfig(8): nostd/-s does nothing
(cherry picked from commit b828161d12)
2021-12-01 03:07:19 +02:00
Konstantin Belousov 00558493b7 ldconfig: start of cleanup
(cherry picked from commit 3f2c6f5598)
2021-12-01 03:07:19 +02:00
Konstantin Belousov 998529e594 ldconfig: remove a comment which is another remnant of a.out support
(cherry picked from commit 83511ce5c4)
2021-12-01 03:07:18 +02:00
Kristof Provost cfe9b890d5 pf: Introduce ridentifier
Allow users to set a number on rules which will be exposed as part of
the pflog header.
The intent behind this is to allow users to correlate rules across
updates (remember that pf rules continue to exist and match existing
states, even if they're removed from the active ruleset) and pflog.

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

(cherry picked from commit 76c5eecc34)
2021-11-26 04:39:05 +01:00
Zhenlei Huang eaab06d53d devfs.rules: Correctly unhide pf in vnet jails
Revision 9e9be081d8 introduced a new devfs rule devfsrules_jail_vnet. It
includes rule devfsrules_jail which include other rules. Unfortunately
devfs could not recursively parse the action include and thus
devfsrules_jail_vnet will expose all nodes.

PR:		255660
Reviewed by:	kp
Obtained from:	Gijs Peskens <gijs@peskens.net>
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D32814

(cherry picked from commit 7acd322ebe)
2021-11-24 17:45:51 +01:00
Kirk McKusick 8b495114ea Allow GEOM utilities to specify a -v option.
Follow up for 3c8192eb8267

(cherry picked from commit e38717c128)
2021-11-23 15:04:33 -08:00
Kirk McKusick 0fdc76eaab Allow GEOM utilities to specify a -v option.
(cherry picked from commit 68bff4a07e)
2021-11-23 15:04:33 -08:00
Ed Maste cf09094e39 growfs: do not error if filesystem is already requested size
For some cloud/virtualization use cases it can be convenient to grow the
filesystem on boot any time the disk/partition happens to be larger, but
not fail if it remains the same size.

Continue to emit a message if we have no action to take, but exit with
status 0 if the size remains the same.

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

(cherry picked from commit 3f9acedb02)
2021-11-21 19:30:18 -05:00
Andriy Gapon 128a6d31f2 camcontrol: dump received data for MMC command even if it is unknown
For example, EXT_CSD can be read like this:
    # camcontrol mmcsdcmd 2:0:0 -c 8 -a 0 -f 0x35 -l 512
    CMD 8 arg 0 flags 35
    MMCIO: error 0, 00000900 00000000 00000000 00000000
    No command-specific decoder for CMD 8
    0000   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
    0010   39 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |9...............|
    ...
    0100   00 00 00 00 00 00 00 00 01 08 00 01 02 02 00 00  |................|
    ...
    01e0   00 00 00 00 00 00 00 00 00 81 c7 00 00 01 03 07  |................|
    01f0   05 00 03 01 3f 3f 01 01 01 00 00 00 00 00 00 00  |....??..........|

(cherry picked from commit c01a46d4ac)
2021-11-21 12:00:42 +02:00
Warner Losh 706f4f705b vt: fix git mismerge
I made a mistaking in merging the final commits for the devctl changes. This
adds the 'hushed' variable and has the correct dates for the manuals.

Pointy hat to: imp

(cherry picked from commit 80f21bb039)
2021-11-18 22:10:07 -07:00
Warner Losh 1076b8d267 vt: fix typo
Notifcation -> Notification

(cherry picked from commit cc48eb70d1)
2021-11-18 22:10:07 -07:00
Warner Losh a82d7aeb3f vt: Add devctl message for bells
Generate VT events when the bell beeps. When coupled with disabling the
bell,this allows custom bells to be rung when we'd otherwise beep.

Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D32656

(cherry picked from commit 4ac3d08a96)
2021-11-18 21:52:22 -07:00
Ed Maste 8032812ac2 Update old iSCSI initiator man pages for removal from 14 and later
The old initiator was removed from main in 48cb3fee25 in advance of
FreeBSD 14.
2021-10-26 16:23:41 -04:00
Felix Johnson dcb7229460 camcontrol(8): Clean up references to removed symbols
Patch the manpage to remove references to devq_openings and devq_queued.
Document the allocated tag that has been added in the same commit. The
relevant code change was committed as r271588
(959ec2581b) by mav@.

PR:		223651
Reported by:	Bertrand Petit <bsdpr@phoe.frmug.org>

(cherry picked from commit d4cf7dc0df)
2021-10-25 11:58:27 -04:00
Kirk McKusick 010e3bc772 Avoid lost buffers in fsck_ffs.
Sponsored by: Netflix

(cherry picked from commit 4313e2ae44)
2021-10-23 21:24:08 -07:00
Gleb Smirnoff fba1554683 Mark sppp(4) as gone in FreeBSD 14. 2021-10-22 11:27:00 -07:00
Kristof Provost 35237559a6 pfctl: delay label macro expansion until after rule optimisation
We used to expand the $nr macro in labels into the rule number prior to
the optimisation step. This would occasionally produce incorrect rule
numbers in the labels.

Delay all macro expansion until after the optimisation step to ensure
that we expand the correct values.

MFC after:	1 week
Reported by:	Özkan KIRIK <ozkan.kirik@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D32488

(cherry picked from commit 09c7f23869)
2021-10-22 09:34:25 +02:00
Kristof Provost e089cda88b pfctl: Remove unused variable
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 90dedf0fef)
2021-10-22 09:32:24 +02:00
Felix Johnson d8359af5b6 devd(8): Note default config file search locations
PR:		197003
Reported by:	Harald Schmalzbauer <bugzilla.freebsd@omnilan.de>

(cherry picked from commit bad324ace4)
2021-10-21 23:59:17 -04:00
Kristof Provost c5a340e864 pfctl: userspace adaptive syncookies configration
Hook up the userspace bits to configure syncookies in adaptive mode.

MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D32136

(cherry picked from commit 5062afff9d)
2021-10-06 10:46:54 +02:00
Kirk McKusick c926cf71d4 Eliminate an unnecessary rerun request in fsck_ffs.
(cherry picked from commit b31c5a2532)
2021-09-29 22:52:04 -07:00
Kristof Provost 34055dacee ipfw: Introduce dnctl
Introduce a link to the ipfw command, dnctl, for dummynet configuration.
dnctl only handles dummynet configuration, and is part of the effort to
support dummynet in pf.

/sbin/ipfw continues to accept pipe, queue and sched commands, but these can
now also be issued via the new dnctl command.

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

(cherry picked from commit 0b95680e07)
2021-09-14 22:00:24 +02:00
Kristof Provost c298e0a0c2 pfctl: print counters in decimal
795d78a467 pfctl: Don't use PRIu64 mistakenly changed these to be
printed as hexadecimal numbers.

Reported by:	Florian Smeets
MFC after:	4 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 846a6e8f9a)
2021-09-08 09:28:29 +02:00
Kristof Provost 0c976ab9c0 pfctl: Don't use PRIu64
Rather than PRIu64 we can just treat the data as uintmax_t, and use %jx
instead.

MFC after:	1 week
Suggested by:	kib
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 795d78a467)
2021-09-08 09:28:25 +02:00
Mark Johnston 9c82ba2473 mdconfig: Add a regression test for mediasize rounding
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit ed59446b47)
2021-09-07 09:36:18 -04:00
Dimitry Andric a80a3afc3b Fix -Wformat errors in pfctl on 32-bit architectures
Use PRIu64 to printf(3) uint64_t quantities, otherwise this will result
in "error: format specifies type 'unsigned long' but the argument has
type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]" on 32-bit
architectures.

Fixes:		80078d9d38
MFC after:	1 week

(cherry picked from commit 5b8f07b12f)
2021-09-06 15:42:53 +02:00
Kristof Provost 7c544989af pfctl: use libpfctl to retrieve pf status
Rather than call DIOCGETSTATUS ourselves use the new libpfctl functions.

MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D31697

(cherry picked from commit 80078d9d38)
2021-09-06 10:06:36 +02:00
Gordon Bergling aa9d47d9de Fix a common typo in man pages and src comments
- s/desciptor/descriptor/

(cherry picked from commit b1603638e3)
2021-09-02 08:13:48 +02:00
Kristof Provost d4c7ab9b1d pfctl: build fix
Fix the build issue introduced in e59eff9ad3 (pfctl: fix killing states by ID)

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 9ce320820e)
2021-08-31 09:47:47 +02:00
Kristof Provost b8110a4d73 pfctl: fix killing states by ID
Since the conversion to the new DIOCKILLSTATESNV the kernel no longer
exists the id and creatorid to be big-endian.
As a result killing states by id (i.e. `pfctl -k id -k 12345`) no longer
worked.

Reported by:	Özkan KIRIK
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit e59eff9ad3)
2021-08-31 09:47:20 +02:00
Luiz Otavio O Souza 09e25aff54 ipfw: use unsigned int for dummynet bandwidth
This allows the maximum value of 4294967295 (~4Gb/s) instead of previous
value of 2147483647 (~2Gb/s).

Reviewed by:	np, scottl
Obtained from:	pfSense
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31582

(cherry picked from commit 20ffd88ed5)
2021-08-26 14:05:26 +02:00
Franco Fichtner 75df39760c dhclient: remove patching of static values in BPF programs
Reviewed by:	markj

(cherry picked from commit 5851803f4b)
2021-08-26 07:46:11 -04:00
Franco Fichtner 3bcf919c4e dhclient: skip_to_semi() consumes semicolon already
When invalid statement is found the next statement is skipped even if it
is valid.

Reviewed by:	markj

(cherry picked from commit a313b5240a)
2021-08-26 07:46:01 -04:00
Kyle Evans 9ee8e86c0d init: execute /etc/rc.final after all user processes have terminated
This can be useful for, e.g., unmounting filesystems that were needed
for shutdown.

Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
X-NetApp-PR:	#63

(cherry picked from commit 4d15976919)
2021-08-26 01:42:00 -05:00
Fabian Kurtz 8751bff1a7 dhclient: support supersede statement for option 54
PR:		217978
Reported by:	Franco Fichtner <franco@opnsense.org>
Reviewed by:	markj
Obtained from:	OPNsense
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31503

(cherry picked from commit 0a539a0f00)
2021-08-25 16:54:05 -07:00
Gordon Tetlow 0729ba2f49 Fix remote code execution in ggatec(8).
Approved by:    so
Security:       SA-21:14.ggatec
Security:       CVE-2021-29630

(cherry picked from commit 515216929c40169cc72b62466ff9238682661613)
2021-08-24 10:50:50 -07:00
Gordon Bergling df82424970 md5(1): Fix a typo in the manual page
- s/compatibilty/compatibility/

(cherry picked from commit 0d71cea832)
2021-08-19 09:29:01 +02:00
Emmanuel Vadot e6a32ddf3f pkgbase: Add nfsiod to the FreeBSD-nfs package
Missed in 081fb64492

(cherry picked from commit e06b8f1128)
2021-08-16 18:15:47 +02:00
Gordon Bergling 71a74e2168 ipfw(8): Fix a typo in an error message
- s/suport/support/

(cherry picked from commit 809ad8170a)
2021-08-16 07:20:31 +02:00
Gordon Bergling bb15117761 iscontrol(8): Fix a typo in a struct
- s/suport/support/

(cherry picked from commit 1e1fbf3b47)
2021-08-16 07:20:00 +02:00
Roy Marples f452713408 socket: Implement SO_RERROR
SO_RERROR indicates that receive buffer overflows should be handled as
errors. Historically receive buffer overflows have been ignored and
programs could not tell if they missed messages or messages had been
truncated because of overflows. Since programs historically do not
expect to get receive overflow errors, this behavior is not the
default.

This is really really important for programs that use route(4) to keep
in sync with the system. If we loose a message then we need to reload
the full system state, otherwise the behaviour from that point is
undefined and can lead to chasing bogus bug reports.

Reviewed by:	philip (network), kbowling (transport), gbe (manpages)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D26652

(cherry picked from commit 7045b1603b)
2021-08-10 18:54:00 -07:00
Rick Macklem 46b4c26b5b mount_nfs.8: Add information for "nconnect" to man page
Commit 1e0a518d65 added a new NFS mount option "nconnect".
This patch adds information on this option to the man page.

It also adds an IMPLEMENTATION section that explains how
the default I/O size is determined and that "nfsstat -m" can
be used to find out what option settings are actually in use.

This is a content change.

(cherry picked from commit 4488c8c34b)
2021-08-03 16:49:28 -07:00
Luiz Otavio O Souza 50ecd99be5 bpf: Add an ioctl to set the VLAN Priority on packets sent by bpf
This allows the use of VLAN PCP in dhclient, which is required for
certain ISPs (such as Orange.fr).

Reviewed by:	bcr (man page)
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31263

(cherry picked from commit 1e7fe2fbb9)
2021-08-02 16:50:32 +02:00
Kristof Provost 70d4a7a966 pf: match keyword support
Support the 'match' keyword.
Note that support is limited to adding queuing information, so without
ALTQ support in the kernel setting match rules is pointless.

For the avoidance of doubt: this is NOT full support for the match
keyword as found in OpenBSD's pf. That could potentially be built on top
of this, but this commit is NOT that.

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

(cherry picked from commit ef950daa35)
2021-07-31 10:12:02 +02:00
Alan Somers 1b58943ef8 [skip ci] correct a few SPDX license tags
These were all incorrectly labeled as 2-clause BSD licenses by a
semi-automated process, when in fact they are 3-clause.

Discussed with:	pfg, imp
Sponsored by:	Axcient

(cherry picked from commit 3874c0abb0)
2021-07-27 11:57:17 -06:00
Kristof Provost 720b82f821 pfctl: syncookie configuration
pfctl and libpfctl code required to enable/disable the syncookie
feature.

MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D31140

(cherry picked from commit c69121c473)
2021-07-27 09:43:52 +02:00
Warner Losh 5b194853b9 devd: remove pccard entries
The pccard entries are now obsolete, remove them.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31184

(cherry picked from commit a535413556)
2021-07-21 10:13:12 -06:00
Julien Grall 7ca3061f84 etc/ttys: add xen console
Xen VMs get a simulated serial device meant for use as a console.  Often
an xterm or other advanced terminal is used, so use xterm as the type.

Depending on configuration, FreeBSD on Xen for amd64 may instead use an
emulated serial port, but the virtual console may also be available.

Submitted by:	Elliott Mitchell <ehem+freebsd@m5p.com>
Reviewed by:	imp (slightly earlier version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D29873

(cherry picked from commit 2b2c460d7b)
2021-07-21 13:07:34 -03:00
Elliott Mitchell ddefb003ee etc/ttys: merge ttys file down to single file
The tty lists were already pretty similar and there hadn't been any real
need for them to remain distinct for some time. As such, merge to a
single file.

The RISC-V console is preserved. For systems where it doesn't exist, its
presence in /etc/ttys is harmless. The uncommented version of the
ttyv8/XDM line from ttys.amd64 was the one chosen.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30256

(cherry picked from commit c76616f496)
2021-07-21 13:05:01 -03:00
Warner Losh ad0c23cdcd ttys: diff reduction
Back in the day, we used to have a number of entries that were either
'on' or 'off' directly, rather than conditionally on 'onifexists'
etc. Back then, we tried to line up the 'secure' columns by using the
construct 'on secure' or 'off secure' (one space or two). Now that these
have all moved to a conditional construct, remove the second space on
the ttys that still have it. This reduces diffs between the different
ttys and is no functional change. i386 and amd64 did this a long time
ago, and those are the only ones that affected external users (who used
to sed 's/on /off /' the entires as part of the automation).

MFC After:		3 days
Sponsored by:		Netflix

(cherry picked from commit 36be84b966)
2021-07-21 13:04:43 -03:00
Alexander Motin 7de125a406 Partially revert previous commit.
ns identify does not allow nsid of 0xffffffff.  Only general identify
allows it.

MFC after:	1 week

(cherry picked from commit d1a0eab9fb)
2021-07-20 21:56:36 -04:00
Alexander Motin d92453e8b0 For ns identify/delete allow nsid of 0xffffffff.
The first should report common parameters, the second should delete
all namespaces.

MFC after:	1 week

(cherry picked from commit dbf1dce8d6)
2021-07-20 21:56:36 -04:00
Alexander Motin 0b1b2d6882 Filter out LBA formats with LBA Data Size of 0.
According to the spec: "If the value reported is 0h, then LBA format
is not supported / used or is not currently available".

MFC after:	1 week

(cherry picked from commit d379886a41)
2021-07-20 21:54:38 -04:00
Robert Wing fb2feceac3 fsck_ffs: fix background fsck in preen mode
Background checks are only allowed for mounted filesystems - don't try
to open the device for writing when performing a background check.

While here, remove a debugging printf that's commented out.

PR:             256746
Fixes:          5cc52631b3
Reviewed by:	mckusick
Differential Revision:	https://reviews.freebsd.org/D30880

(cherry picked from commit 0c5a59252c)
2021-07-19 10:06:53 -08:00
Bjoern A. Zeeb 05490438f2 ifconfig: 80211, add line break after key info
Beauty correction for verbose mode or in case we print multiple key
information to not continue with the next options directly after
as we did so far, e.g.:
	AES-CCM 2:128-bit
	AES-CCM 3:128-bit powersavemode ...

Sponsored by:	The FreeBSD Foundation
Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D29393

(cherry picked from commit 5ba4c8de15)
2021-07-18 00:34:57 +00:00
Edward Tomasz Napierala 5a604e56d4 nvmecontrol: fix typo (s/Managment/Management/)
Reported By:	pstef

(cherry picked from commit 95a74ab4fb)
2021-07-12 14:37:07 -06:00
Warner Losh 99ff43c0c7 nvmecontrol: update copyright on passthru command
I wrote this code, not Intel, so put my copyright on this. I mistakenly
copied it for the initial commit.

Sponsored by:		Netflix

(cherry picked from commit 6d6cca3633)
2021-07-12 14:37:07 -06:00
Warner Losh d2299b7159 nvmecontrol: Report status from passthru commands
Report status from dword0 for passthru commands. Many commands report
some status or information here, so reporting it can help know what's
going on.

Sponsored by:		Netflix

(cherry picked from commit 510a3da147)
2021-07-12 14:37:07 -06:00
Warner Losh 39d7a1f479 nvmecontrol: document power command
The description of the power command is missing. While the synopsis is
present, there's no explanation. Add one.

Reviewed by:		mav, chuck
PR:			237866
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31122

(cherry picked from commit 445b5554bf)
2021-07-12 13:42:59 -06:00
Rick Macklem 50f2705d26 mount_nfs.8: Update the man page for commit a145cf3f73
The NFSv4 client now uses the highest minor version of NFSv4
by default instead of minor version 0, for NFSv4 mounts.
The "minorversion" mount option may be used to override this default.

This patch updates the man page to reflect this change.  While here,
fix nfsstat(8) to be nfsstat(1).

(cherry picked from commit b413b03597)
2021-07-11 15:30:01 -07:00
Stefan Eßer 185dcb1072 md5: Improve compatibility with coreutils and format fix
The previous changes that added support for the coreutils -c option
modified the output generated by passing -r to match that of the
coreutils versions. The difference is that coreutils separates the
hash from the file name by two blanks "  " (or a blank followed by
an asterisk " *" with the -b option denoting).

While most scripts or users will not notice the difference, it might
be considered a violation of POLA and this commit reverts the change
for the non-sum programs. These will print a single blank " " as the
separator, as they die before the previous commit.

In order to still generate output that is identical to that of the
coreutils programs, this commit generates the "  " or " *" separator
used by them for the -sum versions, depending on the presence of the
-b option.

(cherry picked from commit b33d1898c1)
2021-07-06 16:56:06 +02:00
Mateusz Guzik d5fe617b09 pfctl: cache getprotobynumber results
As for example pfctl -ss keeps calling it, it saves a lot of overhead
from elided parsing of /etc/nsswitch.conf and /etc/protocols.

Sample result when running a pre-nvlist binary with nfs root and dumping
7 mln states:
before: 24.817u 62.993s 1:28.52 99.1%
after:	8.064u 1.117s 0:18.87 48.5%

Idea by Jim Thompson

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 858937bea4)
2021-07-05 11:32:14 +00:00
Mark Johnston 2d4eba7f8e mdconfig tests: Correct a copy-pasted test description
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 4420bb6a86)
2021-06-30 08:18:00 -04:00
Jessica Clarke a4f9c6a9e6 md5: Fix cross-build after c2870e576b
On macOS and Linux the current set of headers do not end up pulling in
sys/param.h, causing MAXPATHLEN to not be defined and the build to fail.

(cherry picked from commit cab31e0e21)
2021-06-28 18:14:02 +02:00
Stefan Eßer 4048460078 sbin/md5: improve compatibility with coreutils -c option
The -c option expects a digest file in either BSD or coreutils format.

The output for matched and mismatched files is identical to that
of the coreutils version.

The review of these changes included test cases that have already
been committed for the functionality that existed before.
Another test script is added to cover the coreutils compatible
extension implemented by this patch.

This commit contains a tests/Makefile that has been cleaned up
compared to the review version, using an implicit rule to apply the
TESTBASE path at build time (and the scripts have been renamed to
have an extension of .SH instead of .sh to trigger this rule).

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D30812

(cherry picked from commit 84f35b6f86)
(cherry picked from commit c2870e576b)
2021-06-28 18:13:09 +02:00
Warner Losh 9ecf4bd8e9 md5: portability fix -- include stdbool.h explicitly
stdbool.h needs to be included to use type bool variables. Due to
namespace pollution, this gets brought in on FreeBSD, but not on
other systems. Include it explicilty.

Noticed by:		arichards@
Sponsored by:		Netflix

(cherry picked from commit d0ea5e467f)
2021-06-28 18:03:38 +02:00
Warner Losh c0d5665be0 md5: Create md5sum, etc compatible programs
On Linux, there's a similar set of programs to ours, but that end in the
letters 'sum'. These act basically like FreeBSD versions run with the -r
option. Add code so that when the program ends in 'sum' you get the
linux -r behavior. This is enough to make most things that use sha*sum
work correctly (the -c / --check options, as well as the long args are
not implemented). When running with the -sum programs, ignore -t instead
of running internal speed tests and make -c an error.

Reviewed by:		sef, and kp and allanjude (earlier version)
Relnotes:		yes
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30309

(cherry picked from commit 086feed850)
2021-06-28 18:03:38 +02:00
Stefan Eßer cb6ebbaa48 sbin/md5: add tests
While the correctness of the supported hash algorithms can be tested
with the built-in self-test feature, these test cases are meant to
detect changes in the output format.

A follow-up commit will	improve	the compatibility with the coreutils
versions of the hash programs, and these tests should detect any
unintended side-effects	of such	a change on existing functionality.

(cherry picked from commit 884fc5527a)

sbin/md5: Create /usr/tests/sbin/md5 directory for placing tests

(Fix by lwhsu (Li-Wen Hsu) to un-break "make distribute".)

(cherry picked from commit cb194afef5)

sbin/md5: fix test case to not write outside temp directory

The bsd-p-test did create files 1.out .. 8.out in the test directory.
This has been fixed and the temporary output files are now written
to the temporary directory.

(cherry picked from commit 95d3044bbd)

Sponsored by:	The FreeBSD Foundation (commit cb194afef5 only)
2021-06-28 11:05:30 +02:00
Lutz Donnerhacke ef84d16e68 ipfw.8: synopsis misses nat show form
Document the existing behavior, which is currently only available by
reading third party documentation or the source code itself.

PR:		254617
Submitted by:	Oliver Kiddle
Differential Revision: https://reviews.freebsd.org/D30189

(cherry picked from commit c8250c5ada)
2021-06-18 11:53:26 +02:00
Robert Wing 01cf73198d bectl(8): don't allow creation of boot environments with spaces
Boot environment datasets that contain spaces are not bootable.

When a user attempts to create a boot environment with a space, abort
the creation and print an error message.

PR:             254441
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D30194

(cherry picked from commit 0e6549c874)
2021-06-11 09:28:41 -08:00
Robert Wing 47ec64b3e8 fsck_ufs: fix segfault with gjournal
The segfault was being hit in ckfini() (sbin/fsck_ffs/fsutil.c) while
attempting to traverse the buffer cache. The tail queue used for the
buffer cache was not initialized before dropping into gjournal_check().

Initialize the buffer cache before calling gjournal_check().

PR:             245907
Reviewed by:    jhb, mckusick
Differential Revision:  https://reviews.freebsd.org/D30537

(cherry picked from commit 441e69e419)
2021-06-11 08:56:00 -08:00
Robert Wing 157a960058 fsck_ffs(8): fix divide by zero when debug messages are enabled
Only print buffer cache debug message when a cache lookup has been done.

When running `fsck_ffs -d` on a gjournal'ed filesystem, it's possible
that totalreads is greater than zero when no cache lookup has been
done - causing a divide by zero. This commit fixes the following error:

    Floating point exception (core dumped)

Reviewed by:    mckusick
Differential Revision:  https://reviews.freebsd.org/D30370

(cherry picked from commit 20123b25ee)
2021-06-11 08:44:29 -08:00
Kirk McKusick 02966cbdf0 Fix fsck_ufs segfault when it needs to rerun.
Sponsored by: Netflix

(cherry picked from commit 5c9e9eb7a2)
2021-06-02 12:41:38 -07:00
Konstantin Belousov 4f2efb2ff4 ldconfig(8): update manpage to reality
(cherry picked from commit a19e14ca2d)
2021-05-28 15:04:52 +03:00
Kristof Provost 2f0a807948 pfctl tests: Test fairq configuration
We used to have a bug where pfctl could crash setting fairq queues. Test
this case and ensure it does not crash pfctl.

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

(cherry picked from commit 9938fcaa65)
2021-05-27 09:10:53 +02:00
Kristof Provost a4ceb1e192 pfctl: Fix crash on ALTQ configuration
The following config could crash pfctl:
	altq on igb0 fairq bandwidth 1Gb queue { qLink }
	queue qLink fairq(default)

That happens because when we're parsing the parent queue (on igb0) it
doesn't have a parent, and the check in eval_pfqueue_fairq() checks
pa->parent rather than parent.

This was changed in eval_pfqueue_hfsc() in
1d34c9dac8, but not for fairq.

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

(cherry picked from commit 26705a39e5)
2021-05-27 09:09:55 +02:00
Kristof Provost 48d771e579 pf: Track the original kif for floating states
Track (and display) the interface that created a state, even if it's a
floating state (and thus uses virtual interface 'all').

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

(cherry picked from commit d0fdf2b28f)
2021-05-27 09:06:14 +02:00
Kristof Provost 59f8fc3fbf pfctl: Use DIOCGETSTATESNV
Migrate to using the new nvlist-based DIOCGETSTATESNV call to obtain the
states list.

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

(cherry picked from commit bc94129147)
2021-05-27 09:06:00 +02:00
Kristof Provost 47a3d57efd pfctl: Ensure parent queue is configured for FAIRQ
We failed to account for the FAIRQ scheduler in expand_altq(), which led
it to be set up without its parent queue.

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

(cherry picked from commit dc78428796)
2021-05-27 09:03:42 +02:00
Lutz Donnerhacke 72fe4684e0 ipfw.8: Fix table example
Fix some erronous lines in the example section.

PR:		248943
Submitted by:	Jose Luis Duran
Reviewers:	ae, manpages (gbe)
Differential Revision: https://reviews.freebsd.org/D30191

(cherry picked from commit 802637be06)
2021-05-25 07:41:37 +02:00
Kirk McKusick e198c1dc8f Fix fsck_ffs Pass 1b error exit "bad inode number 256 to nextinode".
(cherry picked from commit fe815b88b5)

PR:           255979
Sponsored by: Netflix
2021-05-22 14:03:37 -07:00
Kirk McKusick c910e015ba Correct assert added to dump program.
(cherry picked from commit efe145a745)
2021-05-20 15:57:37 -07:00
Kirk McKusick e2a49768a4 Ensure that files with no allocated blocks are trimmed to zero length.
(cherry picked from commit a3628327e7)
2021-05-18 13:26:00 -07:00