Commit Graph

10648 Commits

Author SHA1 Message Date
Ed Maste
e2ad879d4c ifconfig: make interface address without mask an error
In commit d8237b9555, as part of the deprecation of IPv4 address
classes, Mike Karels introduced a warning in ifconfig for setting an
address without a width or mask.  The commit message says "This will
hopefully be an error in the future."

As the warning has been included in releases from FreeBSD 13.1 on, and
sufficient time has passed, turn this into an error.

Reviewed by:	allanjude, olce, grembo, philip, gordon
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45585
2024-06-17 20:21:06 -04:00
Gordon Bergling
d1e652bf04 camcontrol.8: Fix a typo in the manual page
- s/emtpy/empty/

MFC after:	3 days
2024-06-16 18:01:12 +02:00
Michael Gmelin
8a9f0fa42b ifconfig: Fix default netmask calculation
Reported by:	phk
Reviewed by:	emaste, kp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D45570
2024-06-12 20:10:13 +02:00
Kristof Provost
ba2a920786 pf: convert DIOCBEGINADDRS to netlink 2024-06-08 04:46:43 +02:00
Kristof Provost
d9ab899931 pf: migrate DIOCGETLIMIT/DIOCSETLIMIT to netlink
Event:		Kitchener-Waterloo Hackathon 202406
2024-06-07 20:59:02 +02:00
Pau Amma
21faf821a3 ifconfig(8): wordsmith -G and -g descriptions
Remove spurious ".Ar groupname".
Add missing full stops.
While there, tweak word order for better grammar.

MFC after: 3 days

Reviewed by:	Alexander Ziaee, Mina Galić, allanjude, imp
Differential Revision:	https://reviews.freebsd.org/D45092
2024-06-06 15:48:39 -06:00
Kristof Provost
30bad751e8 pf: convert DIOCGETTIMEOUT/DIOCSETTIMEOUT to netlink 2024-06-06 20:46:18 +02:00
Kristof Provost
dc3ee89c86 pfctl: fix possible out-of-bounds read
Tags in $10 (filter_opts) are not guaranteed to be the maximum possible
tag length, so memcpy() can end up reading outside of the allocated
buffer.

Use strlcpy() instead.

Reported by:	CheriBSD
Event:		Kitchener-Waterloo Hackathon 202406
2024-06-06 15:45:31 +02:00
Stefan Eßer
17e85f5990 newfs_msdos: align to multiple of cluster size by default
A previous commit aligned the start of the data area to a multiple of
the VM page size, in order to prevent extra buffers to be allocated
(which failed for 64 KB cluster size without this alignment).

Since a dependency on PAGE_SIZE caused compatibility issues, the
alignment was made conditional on this macro being defined, in the
previous commit. This lead to different behavior of this program
when built on FreeBSD vs. Linux (which does not define PAGE_SIZE).

This commit removes any use of PAGE_SIZE and instead always aligns
the start of the data area to a multiple of the cluster size.

The -A option is now implied, unless overridden by a specific number
of reserved sectors with the -r option.

Approved by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45436
2024-06-06 12:28:02 +02:00
Kristof Provost
c36c90a2cc pf: convert DIOCSETDEBUG to netlink
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-06-04 14:59:59 +02:00
Kristof Provost
9dbbe68bc5 pf: convert DIOCCLRSTATUS to netlink
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-06-04 14:59:58 +02:00
Stefan Eßer
41ee91c64f newfs_msdos: fix build on non-FreeBSD systems
Disable data area alignment if the build environment does not define
PAGE_SIZE (e.g., when building on Linux or macOS).

Reported by:	jrtc27
MFC after:	1 week
2024-06-04 08:26:09 +02:00
Gordon Tetlow
a68e4f7a06
Migrate from printb to print_bits for locally defined bit fields.
Reviewed by:	emaste
Event:		Kitchener-Waterloo Hackathon 202406
Differential Revision:	https://reviews.freebsd.org/D45441
2024-06-03 11:48:35 -04:00
Gordon Tetlow
c3e9423743
Move print_bits to ifconfig.c and make available to other src files.
Reviewed by:	emaste
Event:		Kitchener-Waterloo Hackathon 202406
Differential Revision:	https://reviews.freebsd.org/D45441
2024-06-03 11:48:35 -04:00
Stefan Eßer
077f757d72 newfs_msdos: align data area to VM page boundary by default
Without alignment, the data area will not be aligned with the buffer
cache, leading to overhead, higher write multiplication on SSD devices
and issues with very large cluster sizes (see PR 277414).

The -A option used to align the start of the root directory to a
multiple of the cluster size, which happens to align the start of the
data area with a buffer page boundary in case of large clusters and
the default number of directory entries (512 entries requiring 16 KB
for FAT12 or FAT16, FAT32 puts the root directory into the data area).

This commit aligns the start of the data area with the page size, if
neither -A nor -r is used. It changes -A to align the start of the
data area (end of the root directory) to a multiple of the cluster
size, since this is the alignment that prevents write multiplication
due to clusters crossing erase block boundaries of a SSD device.
The -r option is unchanged and will prevent any automatic alignment
from occuring.

Approved by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45436
2024-06-02 14:07:52 +02:00
Alan Somers
e461c7bc7d mdconfig: remove the "cluster" option.
It's never had any effect.  The kernel ignores it.  Remove it from the
documentation.  But continue to parse it on the command line, for
backwards-compatibility.

Reviewed by:	imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1271
2024-06-01 17:31:04 -06:00
Alan Somers
4b72bab96e mdconfig: don't print NUL in the options list
Fixes:	b01988d5e5
Sponsored by: Axcient
Reviewed by: imp, Ricardo Branco
Pull Request: https://github.com/freebsd/freebsd-src/pull/1268
2024-06-01 08:08:16 -06:00
Alan Somers
d1bd097d52 mdconfig: fix cleanup in the attach_size_rounddown test
MFC after:	1 week
MFC with:	ed59446b47
Sponsored by:	Axcient
2024-05-31 15:20:13 -06:00
John Baldwin
ff7de3b4d3 nextboot: Permit ZFS boot filesystems mounted at the pool's root
This restores nextboot -k on ZFS setups where /boot is on the root
dataset of a pool.

Reviewed by:	jrtc27, glebius
Fixes:		0c3ade2cf1 nextboot: fix nextboot -k on ZFS
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D45306
2024-05-30 05:44:55 -07:00
Kristof Provost
8ddd0359bc pfctl: fix recursive printing of nat anchors
Similar to the preceding fix for rules, ensure that we
recursively list wildcard anchors for nat rules.

MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-05-28 22:29:28 +02:00
Kristof Provost
cd2054d48b libpfctl: add pfctl_get_rule_h()
Add a handle variant of pfctl_get_rule(). This converts us from using
the nvlist variant to the netlink variant, and also moves us closer to a
world where all libpfctl functions take the handle.

While here have pfctl use the new function.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-05-28 22:27:22 +02:00
Kristof Provost
76bc4a776f pfctl: use pfctl_add_rule_h() rather than pfctl_add_rule()
This ensures we use the handle opened with pfctl_open(), and also brings
us closer to the ideal state where everything uses the handle rather
than a file descriptor.
2024-05-26 23:06:43 +02:00
Franco Fichtner
0cc8506c51 dhclient: remove unused primary_address
Its last use was removed in 396c7521364.

Reviewed by:		imp
Pull Request:		https://github.com/freebsd/freebsd-src/pull/1257
Differential Revsiion:	https://reviews.freebsd.org/D42717
2024-05-24 22:17:08 -06:00
Zhenlei Huang
76df3c57a0 ifconfig: Redo fix vlan/vlanproto reconfiguration
When the if_vlan(4) interface has not been fully configured, i.e., a
bare interface without a physical interface associated with it,
retrieving the current settings of it and unconditionally overwriting
`params` will result in losing vlandev settings in `params`. That will
lead to failing to associate the if_vlan(4) interface with the requested
physical interface and the false report 'both vlan and vlandev must be
specified'.

Fix that by checking if the vlan interface has been fully configured.

The basic VLAN test is slightly modified to cover this case.

PR:		279181
Reviewed by:	kp
Tested by:	Mike Tancsa <mike@sentex.net>
Fixes:		b82b8055ad ifconfig: fix vlan/vlanproto reconfiguration
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D45283
2024-05-22 00:35:01 +08:00
Alexander Ziaee
1a720cbec5 man filesystems: fix xrefs after move to section 4
Reviewed by: des, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1077
2024-05-16 10:25:29 -06:00
Dag-Erling Smørgrav
42b28f8152 ifconfig: Markup nits.
MFC after:	3 days
Reviewed by:	imp, allanjude
Differential Revision:	https://reviews.freebsd.org/D45209
2024-05-15 15:38:53 +02:00
Kirk McKusick
61dece6d27 Enable soft updates by default for UFS2 filesystems.
Soft updates dramatically improve the performance of UFS filesystems.
The newfs(8) utility currently does not enable them by default. The
FreeBSD installer enables soft updates by default. However custom
built installations that do not specify the -U option to newfs(8)
and the prebuilt UFS system images get filesystems without soft
updates enabled.

There are several testing sites that run benchmarks comparing the
performance of Linux distributions versus BSD distributions. When
they run filesystem comparison benchmarks they use newfs(8) to
create the UFS filesystem. Because it does not have soft updates
enabled it runs poorly versus the Linux ext4 filesystem. When I
have suggested to them that they should enable soft updates on the
UFS filesystem in their testing their response is that they expect
the utility that creates the filesystem to use optimal defaults and
that they cannot be expected to fiddle with various option settings.

The purpose of this change is to give a filesystem created with
newfs(8) reasonably optimal settings. For UFS2 this means enabling
soft updates. For UFS1 which tends to be used on small systems with
minimal memory and CPU speed, the lower memory footprint of running
without soft updates is a more sensible default.

This change adds a note in the section of the newfs(8) manual page
that describes the -U option for enabling soft updates that they
are enabled by default for UFS2 filesystems and that they can be
disabled by using tunefs(8).

Reviewed-by: Warner Losh, kib
MFC after:   1 week
Differential Revision: https://reviews.freebsd.org/D45201
2024-05-14 22:40:01 -07:00
Dag-Erling Smørgrav
847ef59d4b ifconfig: Add format shortcuts.
MFC after:	1 week
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D45166
2024-05-14 08:51:50 +02:00
Warner Losh
3d966ae789 nvmecontrol: Appease a meaningless signed error warning thing
Consistently use the weird ssize_t type for things I know are unsigned,
but which none-the-less need to be compared to signed things to prevent
a bogus warning. Sigh, these aren't bugs, can't possibly be bugs and
a waste of time to fix.

Sponsored by:		Netflix
2024-05-11 13:03:29 -06:00
Warner Losh
c1fccf0f60 nvmecontrol: Implement telemetry-log command.
This produces the same data as the Linux nvme-cli 'nvme telemetry-log'
command. It extracts the telemetry log from drive. This is a variable
length log, so we read the first page and find out how much of the log
to grab. There's 3 levels of details available, and we grab the level of
detail specified on the command line.

Sponsored by:		Netflix
2024-05-11 12:09:51 -06:00
John Baldwin
1662e47d91 nvmecontrol: Free the addrinfo list when failing to open a TCP socket
Reported by:	Coverity Scan
CID:	 	1545048
Sponsored by:	Chelsio Communications
2024-05-10 09:13:40 -07:00
John Baldwin
0ac468c7b6 nvmecontrol: Free array of I/O queue pairs on failure to handoff
This is harmless but cleaner.

Reported by:	Coverity Scan
CID:	 	1545041,1545049
Sponsored by:	Chelsio Communications
2024-05-10 09:13:21 -07:00
John Baldwin
bf1820f187 nvmecontrol: Fix a sizeof mismatch
In this case it is harmless since it is an array of pointers so the
resulting length is identical.

Reported by:	Coverity Scan
CID:		1545055
Sponsored by:	Chelsio Communications
2024-05-10 08:54:02 -07:00
Ricardo Branco
b01988d5e5 mdconfig: Print options when listing devices
PR: 278624
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1210
2024-05-09 22:43:09 -06:00
Ben Wilber
09025a7147 ipfw: correctly report table manipulation errors
Let ipfw(8) report the actual error instead of the error that
may have come from calling printf().

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1221
2024-05-09 20:08:18 -06:00
Kristof Provost
f1612e7087 libpfctl: fix file descriptor leak
pfctl_get_rules_info() opened a netlink socket, but failed to close it again.
Fix this by factoring out the netlink-based function into a _h variant that
takes struct pfctl_handle, and implement pfctl_get_rules_info() based on that,
remembering to close the fd.

While here migrate all in-tree consumers to the _h variant.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-05-09 14:07:07 +02:00
Kristof Provost
0d446a4303 carp: document the new VRRPv3 support
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D44776
2024-05-08 13:19:04 +02:00
Kristof Provost
3711515467 carp: support VRRPv3
Allow carp(4) to use the VRRPv3 protocol (RFC 5798). We can distinguish carp and
VRRP based on the protocol version number (carp is 2, VRRPv3 is 3), and support
both from the carp(4) code.

Reviewed by:	glebius
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D44774
2024-05-08 13:19:03 +02:00
John Baldwin
c8703409ed nvmecontrol: Fix a sign compare mismatch
Even though mqes (uint16_t) and queue_size (u_int) are both unsigned,
the expression 'mqes + 1' gets promoted to int which is signed.  Keep
the value unsigned by explicitly promoting mqes to u_int before
incrementing the value.

Reported by:	GCC
2024-05-07 13:54:00 -07:00
Poul-Henning Kamp
66bee50af7 Remove cross-references to GBDE 2024-05-07 07:35:33 +00:00
Poul-Henning Kamp
8d2d1d6516 Remove GBDE source files 2024-05-07 07:31:09 +00:00
Poul-Henning Kamp
14b475c479 Remove gbde support from swapon(8) 2024-05-07 07:21:46 +00:00
Poul-Henning Kamp
74be648512 Disconnect GBDE from the build. (Per earlier announcements of retirement.) 2024-05-07 05:19:03 +00:00
John Baldwin
1058c12197 nvmecontrol: New commands to support Fabrics hosts
- discover: Connects to a remote Discovery controller, fetches its
  Discovery Log Page, and enumerates the remote controllers described
  in the log page.

  The -v option can be used to display the Identify Controller data
  structure for the Discovery controller.  This is only really useful
  for debugging.

- connect: Connects to a remote I/O controller and establishes an
  association of an admin queue and a single I/O queue.  The
  association is handed off to the in-kernel host to create a new
  nvmeX device.

- connect-all: Connects to a Discovery controller and attempts to
  create an association with each I/O controller enumerated in the
  Discovery controller's Discovery Log Page.

- reconnect: Establishes a new association with a remote I/O
  controller for an existing nvmeX device.  This can be used to
  restore access to a remote I/O controller after the loss of a prior
  association due to a transport error, controller reboot, etc.

- disconnect: Deletes one or more nvmeX devices after detaching its
  namespaces and terminating any active associations.  The devices to
  delete can be identified by either a nvmeX device name or the NQN of
  the remote controller.

- disconnect-all: Deletes all active associations with remote
  controllers.

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D44715
2024-05-02 16:30:10 -07:00
John Baldwin
07c6a62bab cam: Add a XPORT_NVMF for NVMe over Fabrics sims
Reviewed by:	ken, imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D44713
2024-05-02 16:29:26 -07:00
Warner Losh
b12cae88cf nvmecontrol: Allow optional /dev/ for device names
nvmecontrol operates on devices. Allow a user to specify the /dev/ if
they want. Any device that starts with / will be treated as if it was a
full path for maximum flexbility.

Sponsored by:		Netflix
2024-05-02 15:52:20 -06:00
Kristof Provost
5824df8d99 pf: convert DIOCGETSTATUS to netlink
Introduce pfctl_get_status_h() because we need the pfctl_handle. In this variant
use netlink to obtain the information.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-04-29 16:32:23 +02:00
Elyes Haouas
d94c991f3b setkey: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 22:21:09 -06:00
Elyes Haouas
70fad8acae ipf: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 22:21:09 -06:00
Elyes Haouas
7028e630d6 camcontrol: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 22:21:09 -06:00