Commit graph

9604 commits

Author SHA1 Message Date
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
Kristof Provost 487633009f pfctl: Revert "pfctl: Another set skip <group> fix"
This reverts commit 0c156a3c32.
This fix broke using '<ifgroup>:network' in tables.

MFC after:	1 week

(cherry picked from commit d5b08e13dd)
2021-05-04 09:50:34 +02:00
Alex Richardson c2ce92c396 sbin/bectl: Skip tests if sparse files are not supported
The tests create a 1GB test file and this causes the tests to fail in the
CheriBSD CI setup where we run tests with a tmpfs mount on /tmp. Tmpfs
does not support sparse files and it appears that tmpfs default to creating
a 1GB mount, so there is not enough space to run these tests.

Instead of checking for at least 1GB of free space, this commit skips the
tests on file systems that do not support sparse files.

Reviewed By:	kevans
Differential Revision: https://reviews.freebsd.org/D28463

(cherry picked from commit d6f4e1a897)
2021-04-22 10:41:29 +01:00
Mateusz Piotrowski 643758d2c2 Explain the newfs naming convention
It might be unclear why newfs and newfs_msdos should cross-reference
each other. Add a note explaining it.

This is a follow-up to 74bd207697.

Reported by:	kib
Reviewed by:    imp, kib, rpokala
MFC after:	3 days

(cherry picked from commit 5b9b65e92f)
2021-04-20 10:07:25 +02:00
Ryan Moeller 1310ff46bf ifconfig: Reuse media state in ifmedia_getstate
This restores behavior lost in code cleanup, fixing a regression after
2803fa471e where changing media options
only applies some of the changes, not all.

Reported by:	np
Reviewed by:	donner
Differential Revision:	https://reviews.freebsd.org/D29741

(cherry picked from commit 407fb44c92)
2021-04-15 22:42:45 -04:00
Alex Richardson 7755e8ae32 ifconfig: fix UBSan signed shift error
Use 1u since UBSan complains about 1 << 31.

(cherry picked from commit 94ac312a71)
2021-04-10 14:01:56 +01:00
Ed Maste 484cec486d ffsinfo: Update example to avoid to-be-deprecated vinum
Reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29478

(cherry picked from commit a64096aa63)
2021-04-09 21:26:23 -04:00
Kirk McKusick 27aa4fcbbc Ensure that all allocated data structures in fsck_ffs are freed.
(cherry picked from commit fc56fd262d)
2021-04-08 17:49:00 -07:00
Alan Somers 438e52f814 [skip ci] fix a typo in a comment in mdconfig.c
Sponsored by:	Axcient
Reviewed by:    mav, imp
Differential Revision:  https://reviews.freebsd.org/D28968

(cherry picked from commit d977417d74)
2021-04-08 02:15:35 +00:00
Alan Somers 94db41ccdb mount_nullfs: rename a local variable
The "source" variable was introduced in r26072, probably as the
traditional counterpart to "target".  But the "source"/"target" names
suggest the opposite of their actual meaning.  With ln, for example, the
source is the real file and the target is the newly created link.  In
mount_nullfs the meaning is the opposite: the target is the existing
file system and the source is the newly created mountpoint.  Better to
use "target"/"mountpoint" terminology, which matches the man page.

Sponsored by:	Axcient

(cherry picked from commit f540cb27a2)
2021-04-08 02:15:00 +00:00
Kirk McKusick 343b9e6219 Fix fsck_ffs -R finds unfixed duplicate block errors when rerunning.
(cherry picked from commit 7848b25edd)
2021-04-02 14:55:58 -07:00
Kirk McKusick fab7c18ce3 Fix fsck_ffs Pass 1b error exit "bad inode number 2 to nextinode".
(cherry picked from commit bc444e2ec6)
2021-04-02 14:52:49 -07:00
Kyle Evans 223d6caabd init: use explicit_bzero() for clearing passwords
This is a nop in practice, because it cannot be proven that this
particular bzero() is not significant.  Make it explicit anyways, rather
than relying on an implementation detail of how the password is
collected.

Discussed with:	Andrew Gierth <andrew tao146 riddles org uk>

(cherry picked from commit 852f70b240)
2021-04-01 12:29:06 -05:00
Kristof Provost 305b1903c8 pfctl: Add missing 'va' code point name
Add the 'va' (voice-admit, RFC5865) symbolic name.

Reviewed by:	rgrimes, gbe (man page)
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29069

(cherry picked from commit b4e3f3c2de)
2021-03-20 15:45:48 +01:00
Ryan Moeller ebee42edc8 sbin/ifconfig: Get media status with libifconfig
Code deduplication.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D29030

(cherry picked from commit 2803fa471e)
2021-03-19 09:00:40 -04:00
Scott Long b65d2c31b1 base: remove if_wg(4) and associated utilities, manpage
After length decisions, we've decided that the if_wg(4) driver and
   related work is not yet ready to live in the tree.  This driver has
   larger security implications than many, and thus will be held to
   more scrutiny than other drivers.

Requested by: secteam
Approved by: re
2021-03-18 07:07:56 +00:00
Ryan Moeller 3b71af08bb sbin/ifconfig: Use a global libifconfig handle
This should eventually replace the socket passed to the various
handlers. In the meantime, making it global avoids repeatedly opening
and closing handles.

Reported by:	kp
Reviewed by:	kp (earlier version)
Differential Revision:	https://reviews.freebsd.org/D28990

(cherry picked from commit 8b22242550)
2021-03-17 18:24:49 -04:00
Alex Richardson da80e76821 sbin/pfctl: fix tests after recent output changes
The output now contains http-alt instead of 8080 and personal-agent
instead of 5555.
This was probably caused by 228e2087a3.

Reviewed By:	kp
Differential Revision: https://reviews.freebsd.org/D28481

(cherry picked from commit 58de61b996)
2021-03-17 09:56:28 +00:00
Mark Johnston 763fb2fda0 dumpon.8: Ask DDB to call doadump() rather than calling it directly
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit af06ff5553)
2021-03-15 11:40:16 -04:00
Kirk McKusick 7dd29d256f Do not complain about incorrect cylinder group check-hashes when
asked to add them to a filesystem.

Sponsored by: Netflix

(cherry picked from commit 6385cabd5b)
2021-03-14 15:18:02 -07:00
Ryan Moeller 137544502b sbin/ifconfig: Get lagg status with libifconfig
Also trimmed an unused block of code that never prints out LAGG_PROTOS.
Reviewed by:	kp (earlier version)
Differential Revision:	https://reviews.freebsd.org/D28961

(cherry picked from commit a0ebb91504)
2021-03-14 04:08:51 -04:00
Ryan Moeller 3dfbda3401 sbin/ifconfig: Get bridge status with libifconfig
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D28954

(cherry picked from commit 6f497e47e9)
2021-03-14 04:08:13 -04:00
Ryan Moeller 8eb38ceffe sbin/ifconfig: Get groups with libifconfig
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D28965

(cherry picked from commit 64bacab177)
2021-03-14 04:07:55 -04:00
Ryan Moeller f42188552c sbin/ifconfig: Get carp status with libifconfig
A trivial change now that ifconfig is already using libifconfig.
Reviewed by:	kp (earlier version)
Differential Revision:	https://reviews.freebsd.org/D28955

(cherry picked from commit da393346ac)
2021-03-14 04:07:35 -04:00
Ryan Moeller caab2f4c89 sbin/ifconfig: Minor housekeeping
Coalesce adjacent lint ifdefs.
Fix spelling of nitems.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D29022

(cherry picked from commit 88832d59de)
2021-03-14 04:07:06 -04:00