Commit graph

9828 commits

Author SHA1 Message Date
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
Lutz Donnerhacke 7200fdb9da sbin/ipfw: Fix parsing error in table based forward
The argument parser does not recognise the optional port for an
"tablearg" argument.  Fix simplifies the code by make the internal
representation expicit for the parser.  Includes the fix from D30208.

PR:		252744
Reported by:	<bugs.freebsd.org@mx.zzux.com>
Approved by:	nc
Tested by:	<bugs.freebsd.org@mx.zzux.com>
Differential Revision: https://reviews.freebsd.org/D30164

(cherry picked from commit 6cb13813ca)
(cherry picked from commit f6f297871d)
2021-05-18 08:10:00 +02:00
Kirk McKusick 2e762b0252 Clean up fsck_ffs error message output.
(cherry picked from commit 689724cb23)

Sponsored by: Netflix
2021-05-16 17:41:11 -07:00
Kirk McKusick 501b4fb50e Make fsck_ffs more persistent in creating a lost+found directory.
(cherry picked from commit 84a0e3f957)

Sponsored by: Netflix
2021-05-16 17:18:31 -07:00
Kristof Provost 8c610ccac6 pf: Support killing 'matching' states
Optionally also kill states that match (i.e. are the NATed state or
opposite direction state entry for) the state we're killing.

See also https://redmine.pfsense.org/issues/8555

Submitted by:	Steven Brown
Reviewed by:	bcr (man page)
Obtained from:	https://github.com/pfsense/FreeBSD-src/pull/11/
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30092

(cherry picked from commit 93abcf17e6)
2021-05-14 10:42:07 +02:00
Kristof Provost a9620e7c70 pf: Allow states to by killed per 'gateway'
This allows us to kill states created from a rule with route-to/reply-to
set.  This is particularly useful in multi-wan setups, where one of the
WAN links goes down.

Submitted by:	Steven Brown
Obtained from:	https://github.com/pfsense/FreeBSD-src/pull/11/
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30058

(cherry picked from commit abbcba9cf5)
2021-05-14 10:24:00 +02:00
Kristof Provost 714762dad4 pfctl: Optionally show gateway information for states
When showing the states, in very verbose mode, also display the gateway
(i.e. the target for route-to/reply-to).

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

(cherry picked from commit cc948296e6)
2021-05-14 10:21:37 +02:00
Kristof Provost 327310fcac pfctl: Start using DIOCKILLSTATESNV
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30055

(cherry picked from commit 2a00c4db93)
2021-05-14 10:21:15 +02:00
Kristof Provost 66cff482be pfctl: Start using DIOCCLRSTATESNV
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30053

(cherry picked from commit 53714a5861)
2021-05-14 10:20:36 +02:00
Kristof Provost 898407819d pf: Optionally attempt to preserve rule counter values across ruleset updates
Usually rule counters are reset to zero on every update of the ruleset.
With keepcounters set pf will attempt to find matching rules between old
and new rulesets and preserve the rule counters.

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

(cherry picked from commit 42ec75f83a)
2021-05-11 17:04:45 +02:00
Kurosawa Takahiro e49799dcf1 pf: Implement the NAT source port selection of MAP-E Customer Edge
MAP-E (RFC 7597) requires special care for selecting source ports
in NAT operation on the Customer Edge because a part of bits of the port
numbers are used by the Border Relay to distinguish another side of the
IPv4-over-IPv6 tunnel.

PR:		254577
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D29468

(cherry picked from commit 2aa21096c7)
2021-05-11 17:04:45 +02:00
Kristof Provost fbbcc07976 pfsync: Expose PFSYNCF_OK flag to userspace
Add 'syncok' field to ifconfig's pfsync interface output. This allows
userspace to figure out when pfsync has completed the initial bulk
import.

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

(cherry picked from commit 5f5bf88949)
2021-05-10 21:45:57 +02:00
Kristof Provost c93907df7b pf: Allow multiple labels to be set on a rule
Allow up to 5 labels to be set on each rule.
This offers more flexibility in using labels. For example, it replaces
the customer 'schedule' keyword used by pfSense to terminate states
according to a schedule.

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

(cherry picked from commit 6fcc8e042a)
2021-05-10 21:45:57 +02:00
Ceri Davies 0f19be5f97 devd.conf: Remove support for coldsync
The coldsync port was removed in 2012.  The last stable release of
coldsync was issued in 2002.  Let's get rid of it.

PR:		255051
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D30100

(cherry picked from commit 1a212abd54)
2021-05-10 09:34:49 -04:00
Ceri Davies 990d0523c9 devd.conf: Typo
PR:		255051

(cherry picked from commit 6a8ed85f48)
2021-05-10 09:34:46 -04:00
Jose Luis Duran e0c2f8156c ifconfig: Minor documentation fix
PR:	255557

(cherry picked from commit 0ea8a7f36d)
2021-05-10 03:48:05 +03:00
Lutz Donnerhacke 80b22e6315 sbin/ipfw: Fix null pointer deference when printing counters
ipfw -[tT] prints statistics of the last access. If the rule was never
used, the counter might be not exist.  This happens unconditionally on
inserting a new rule.  Avoid printing statistics in this case.

PR:	255491
Reported by:	Haisheng Zhouz
Reviewed by:	ae
Differential Revision:	https://reviews.freebsd.org/D30046

(cherry picked from commit bf7cc0f9cb)
2021-05-09 14:33:28 +02:00
Kristof Provost 65dd1a98de pfctl: Fix clearing rules counters
After the migration to libpfctl for rule retrieval we accidentally lost
support for clearing the rules counters.

Introduce a get_clear variant of pfctl_get_rule() which allows rules
counters to be cleared.

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

(cherry picked from commit 4eabfe468b)
2021-05-07 10:15:43 +02:00
Kurosawa Takahiro 55059f9075 pfctl, libpfctl: introduce pfctl_pool
Introduce pfctl_pool to be able to extend the pool part of the pf rule
without breaking the ABI.

Reviewed by:	kp
MFC after:	4 weeks
Differential Revision:	https://reviews.freebsd.org/D29721

(cherry picked from commit 600bd6ce06)
2021-05-07 10:15:42 +02:00
Kristof Provost 1398367b3a libpfctl: Fix u_* counters
struct pf_rule had a few counter_u64_t counters. Those couldn't be
usefully comminicated with userspace, so the fields were doubled up in
uint64_t u_* versions.

Now that we use struct pfctl_rule (i.e. a fully userspace version) we
can safely change the structure and remove this wart.

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

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

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

(cherry picked from commit e9eb09414a)
2021-05-07 10:15:42 +02:00
Kristof Provost c3f3f53771 pf: Move prototypes for userspace functions to userspace header
These functions no longer exist in the kernel, so there's no reason to
keep the prototypes in a kernel header. Move them to pfctl where they're
actually implemented.

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

(cherry picked from commit a9b338b260)
2021-05-07 10:15:42 +02:00
Kristof Provost 0da554e4b6 pfctl: Move ioctl abstraction functions into libpfctl
Introduce a library to wrap the pf ioctl interface.

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

(cherry picked from commit 0d71f9f36e)
2021-05-07 10:15:42 +02:00
Kristof Provost ad208b0771 pfctl: Use the new DIOCGETRULENV ioctl
Create wrapper functions to handle the parsing of the nvlist and move
that code into pfctl_ioctl.c.
At some point this should be moved into a libpfctl.

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

(cherry picked from commit 0d6c8174ef)
2021-05-07 10:15:41 +02:00
Kristof Provost 9a8b570812 pfctl: Move to DIOCADDRULENV
Start using the new nvlist based ioctl to add rules.

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

(cherry picked from commit 5c11c5a365)
2021-05-07 10:15:41 +02:00