Commit Graph

10312 Commits

Author SHA1 Message Date
Alexander V. Chernikov
a3930cd46c ifconfig: use default (more rigid) WARNS level.
It helps catch more errors at compile time.

Reviewed by:	kp
Differential Revision: https://reviews.freebsd.org/D40536
MFC after:	2 weeks
2023-06-16 07:19:22 +00:00
Alexander V. Chernikov
f414f37e38 ifconfig: remove global 'ifr' usage from ifmedia.c & remove 'ifr'.
Reviewed by:	kp
Differential Revision: https://reviews.freebsd.org/D40535
MFC after:	2 weeks
2023-06-16 07:19:21 +00:00
Alexander V. Chernikov
7fa282e616 ifconfig: remove (most of) the usages of global 'struct ifreq ifr'.
It is hard to reason about the contents of 'ifr' at any given time
as nearly every function sets random fields or pointers in this
structure.
Use local on-stack clean 'struct ifreq' for each function instead.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40534
MFC after:	2 weeks
2023-06-16 07:19:21 +00:00
Alexander V. Chernikov
2b5dd8b890 ipfw: use function return value to fetch insn argument.
This is a prerequsite for splitting compile_rule() into smaller
chunks.

MFC after:	2 weeks
2023-06-15 06:46:42 +00:00
Alexander V. Chernikov
84b41342da ipfw: add eaction tests
MFC after:	2 weeks
2023-06-15 06:36:16 +00:00
Marko Zec
32b28e3ae2 route.8: mention DXR in FIB_ALGO section
While here, add a sentence describing DPDK DIR24-8 principle of
operation.

MFC after:	2 weeks.
2023-06-15 07:21:51 +02:00
Alexander V. Chernikov
52ff888318 ifconfig: fix ifconfig crash when compiled w/WITHOUT_NETLINK.
Properly update the recently-introduced `ctx->ifname` when iterating
over interfaces.

Reported by:	Gary Jennejohn <garyj@gmx.de>
MFC after:	2 weeks
2023-06-14 10:37:07 +00:00
Alexander V. Chernikov
3927d0fb37 ifconfig: fix -Wunused warnings
MFC after:	2 weeks
2023-06-14 09:16:09 +00:00
Alexander V. Chernikov
a6094f844a ifconfig: remove 'newaddr' global variable
Differential Revision: https://reviews.freebsd.org/D40441
MFC after:	2 weeks
2023-06-14 09:16:09 +00:00
Alexander V. Chernikov
bbad5525fa ifconfig: start ifconfig context from main()
Differential Revision: https://reviews.freebsd.org/D40440
MFC after:	2 weeks
2023-06-14 09:15:58 +00:00
Alexander V. Chernikov
d61064229f ifconfig: fix comparison in printmimo().
Differential Revision: https://reviews.freebsd.org/D40301
MFC after:	2 weeks
2023-06-14 07:39:06 +00:00
Alexander V. Chernikov
6a9cfebaf1 ipfw: simplify action case parser
Remove "goto charg" from the action parser.
This is a prerequisite for the further split of the gigantic
compile_rule().

Differential Revision: https://reviews.freebsd.org/D40490
MFC after: 2 weeks
2023-06-13 11:55:37 +00:00
Alexander V. Chernikov
9f44a47fd0 ipfw(8): add ioctl/instruction generation tests
Differential Revision: https://reviews.freebsd.org/D40488
MFC after:	2 weeks
2023-06-13 11:55:37 +00:00
Trond Endrestol
d77ca41f77 ifconfig(8): add the dotted format for MAC addresses.
MFC after:	2 weeks
PR:	261572
2023-06-13 06:40:15 +00:00
Alexander V. Chernikov
ea73ff9752 ifconfig: remove global_args variable.
This variable was temporarily introduced in the beginning of the
code cleanup. Use on-stack instance in main() instead.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D40439
MFC after:	2 weeks
2023-06-13 06:25:16 +00:00
Alexander V. Chernikov
85e0016a97 ifconfig: remove global 'name' variable.
Consistenly use newly-added 'ctx->ifname' as the name of the current
target interface.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D40438
MFC after:	2 weeks
2023-06-13 06:22:41 +00:00
Alexander V. Chernikov
c6f0602f23 ifconfig: pass if_ctx instead of socket to the tunnel handlers.
This is a pre-requisite for the global 'name' variable removal.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D40432
MFC after:	2 weeks
2023-06-13 06:20:00 +00:00
Alexander V. Chernikov
4106282ec4 ifconfig: remove global 'printifname' variable.
This variable was used to print the created interface name in the
atexit(3) handler. The interface name was calculated in the
ifclonecreate() by matching old & new names.

This change alter the implementation the following way:
1) the function responsible for the interface creation (ifcreate_ioctl)
 updates all necessary state internally. This removes the need for the
 name manipulation hack in wlan_create().
2) As atexit(3) handler does not accept any parameters, explicitly store
 the name to print in the ifname_to_print variable read by the atexit(3)
 handler.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D40431
MFC after:	2 weeks
2023-06-13 06:18:10 +00:00
Alexander V. Chernikov
c6885dbda7 ifconfig: eliminate global 'verbose' and 'printkey' variables
Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D40427
MFC after:	2 weeks
2023-06-13 06:16:14 +00:00
Alexander V. Chernikov
74b4261161 ifconfig: add if_ctx argument to the generic and ifclone callbacks.
This is the continuation of the ifconfig cleanup work. This change is
a pre-requsite for the next changes removing some of the global variables.
It will also help in implementing functionality via Netlink instead of ioctl.
No functional changes intended.
* vxlan_cb() was removed as it contained no code
* ioctl_ifcreate() was renamed to ifcreate_ioctl() to follow the other
netlink/ioctl function naming. Netlink and ioctl provide _different_
interfaces and it's not possible to have a unified interface object
that can be filled by either netlink or ioctl implementations. With that
in mind, I'm leaning more to the function_<nl|ioctl> postfix pattern,
than doing ioctl_ or netlink_ prefix.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D40426
MFC after:	2 weeks
2023-06-13 06:10:56 +00:00
Yan Ka, Chiu
ab4d1b73cb route(8): teach route to attach to jails
Add -j <jail> flag to route(8) to allow route to perform actions in
a Jail.

Differential Revision: https://reviews.freebsd.org/D40377
MFC after:	2 weeks
2023-06-13 06:06:27 +00:00
Tom Hukins
c9a1abe79b mount_nullfs(8): refer to nullfs(5)
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/772
2023-06-12 08:35:36 -06:00
John Baldwin
553022aba5 ipf: Remove no-longer-needed NO_WARRAY_BOUNDS. 2023-06-09 15:35:32 -07:00
Pierre Pronchery
e730066a64 decryptcore: Request the OpenSSL 1.1 API
OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future update may migrate to use the OpenSSL 3.0 APIs.

PR:		271615
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
2023-06-05 13:48:05 -04:00
Pierre Pronchery
caf98b9d13 dumpon: Request the OpenSSL 1.1 API
OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future update may migrate to use the OpenSSL 3.0 APIs.

PR:		271615
Pull request:	https://github.com/freebsd/freebsd-src/pull/757
Sponsored by:	The FreeBSD Foundation
2023-06-02 10:00:48 -04:00
Tom Hukins
409594ef34 gpart(8): Improve manual page syntax
Fix various warnings from `mandoc -Tlint lib/geom/part/gpart.8`.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/702
2023-06-01 20:43:04 -06:00
Tom Hukins
2bcbf4d831 camcontrol(8): Use simpler language
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/702
2023-06-01 20:41:33 -06:00
Tom Hukins
2675b8bd3d camcontrol(8): Add manual page cross references
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/702
2023-06-01 20:41:32 -06:00
Elyes Haouas
e5263025de fsck_ffs: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/653
2023-06-01 20:33:41 -06:00
Elyes Haouas
e4861dc857 ipfw/ipfw2: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/653
2023-06-01 20:33:40 -06:00
Elyes Haouas
843fe4892e ipf: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/653
2023-06-01 20:33:40 -06:00
Elyes Haouas
b66b2c4d9b ifconfig: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/653
2023-06-01 20:33:40 -06:00
Elyes Haouas
d15f57a29d camcontrol: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/653
2023-06-01 20:33:40 -06:00
Elyes Haouas
589fe499b7 nvmecontrol: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/653
2023-06-01 20:33:39 -06:00
Elyes Haouas
e095cbab2f ipf/ipfstat: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/653
2023-06-01 20:33:39 -06:00
Elyes Haouas
136a9bb4e3 hastd: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/653
2023-06-01 20:33:39 -06:00
Elyes Haouas
0939cf32c0 ipf/libipf: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/653
2023-06-01 20:33:38 -06:00
Ed Maste
79d4d7133f dumpon: update OpenSSL initialization call
ERR_load_crypto_strings() was deprecated in OpenSSL 1.1.0, and explicit
initialization is generally not reqiured.  In the case of dumpon however
we initialize prior to entering capability mode, so replace with an
OPENSSL_init_crypto call.

Reviewed by:	def, Pierre Pronchery
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40353
2023-06-01 21:21:23 -04:00
Alexander V. Chernikov
0c2beef72d ifconfig: fix warnings #2
Fix all -Wparameter-unused and cast alignment

Differential Revision: https://reviews.freebsd.org/D40303
MFC after:	2 weeks
2023-06-01 11:54:25 +00:00
Ed Maste
eb2b00da56 decryptcore: add OPENSSL_INIT_LOAD_CONFIG to init call
Reported by:	def
Reviewed by:	Pierre Pronchery
Sponsored by:	The FreeBSD Foundation
2023-05-31 13:00:57 -04:00
Ed Maste
8e7a31b65f decryptcore: update for OpenSSL 1.1 API
ERR_load_crypto_strings is deprecated in OpenSSL 1.1, and OpenSSL 1.1
generally does not require explicit initialization.  However, we do need
to ensure that initialization is done before entering capability mode so
call OPENSSL_init_crypto instead.  Also include header needed for
ERR_error_string.

Reviewed by:	vangyzen
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40343
2023-05-31 12:20:34 -04:00
Kajetan Staszkiewicz
c45d6b0ec0 pfctl: Add missing state parameters in DIOCGETSTATESV2
Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Different Revision:	https://reviews.freebsd.org/D40259
2023-05-30 14:28:57 +02:00
Kajetan Staszkiewicz
4bf98559d9 pf: make contents of struct pfsync_state configurable
Make struct pfsync_state contents configurable by sending out new
versions of the structure in separate subheader actions. Both old and
new version of struct pfsync_state can be understood, so replication of
states from a system running an older kernel is possible. The version
being sent out is configured using ifconfig pfsync0 … version XXXX. The
version is an user-friendly string - 1301 stands for FreeBSD 13.1 (I
have checked synchronization against a host running 13.1), 1400 stands
for 14.0.

A host running an older kernel will just ignore the messages and count
them as "packets discarded for bad action".

Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D39392
2023-05-30 14:28:56 +02:00
Chuck Silvers
d464a7698d ffs: restore backward compatibility of newfs and makefs with older binaries
The previous change to CGSIZE had the unintended side-effect of allowing
newfs and makefs to create file systems that would fail validation when
examined by older commands and kernels, by allowing newfs/makefs to pack
slightly more blocks into a CG than those older binaries think is valid.
Fix this by having newfs/makefs artificially restrict the number of blocks
in a CG to the slightly smaller value that those older binaries will accept.
The validation code will continue to accept the slightly larger value
that the current newfs/makefs (before this change) could create.

Fixes:		0a6e34e950
Reviewed by:	mckusick
MFC after:	3 days
Sponsored by:	Netflix
2023-05-29 19:26:28 -07:00
Konstantin Belousov
cf85818e05 setkey(8): document NAT-T and NAT-T MTU extensions syntax
Reviewed by:	ae
Discussed with:	bz
Sponsored by:	NVidia networking
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40300
2023-05-30 01:10:02 +03:00
Konstantin Belousov
2fa1b8617f setkey(8): NAT-T manual configuration support
This is needed for testing of offload capabilities.

Reviewed by:	ae
Discussed with:	bz
Sponsored by:	NVidia networking
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40300
2023-05-30 01:10:02 +03:00
Konstantin Belousov
2c1296a3c5 setkey(8): extract prefixlen calculation info helper
While there, hide AF_INET case under #ifdef INET.

Reviewed by:	ae
Discussed with:	bz
Sponsored by:	NVidia networking
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40300
2023-05-30 01:10:02 +03:00
Kirk McKusick
6a71277c30 Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.
When loading the root directory ensure that it is a directory
and has a size greater than the minimum directory size. If an
invalid root directory is found, fall back to full fsck.

Reported-by:  Robert Morris
PR:           271414
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-05-29 14:58:20 -07:00
Kirk McKusick
5267120645 Cleanups to fsck_ffs(8).
When checking an inode ensure that it does not have a negative size.
Stop scaning a directory when an unallocated block is found.
Fully clear an inode when it is first allocated.
Ensure that an inode is marked dirty whenever it is updated and that
it has a correct check hash when it is released.

MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-05-29 14:55:54 -07:00
Kirk McKusick
b796bfce48 Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.
Check for valid block numbers while loading journal entries that
contain block numbers. If an invalid block number is found, fall
back to full fsck.

Reported-by:  Robert Morris
PR:           271383
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-05-28 15:23:37 -07:00