Commit Graph

9570 Commits

Author SHA1 Message Date
Ryan Moeller
64bacab177 sbin/ifconfig: Get groups with libifconfig
Reviewed by:	kp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D28965
2021-02-28 15:38:50 -05:00
Ryan Moeller
6f497e47e9 sbin/ifconfig: Get bridge status with libifconfig
Reviewed by:	kp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D28954
2021-02-28 15:29:23 -05:00
Ryan Moeller
9995455218 sbin/ifconfig: Drop local name var in sfp_status
There is already a globally defined name variable.

MFC after:	1 week
2021-02-27 21:20:38 -05:00
Ryan Moeller
a0ebb91504 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)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D28961
2021-02-27 21:20:38 -05:00
Ryan Moeller
da393346ac sbin/ifconfig: Get carp status with libifconfig
A trivial change now that ifconfig is already using libifconfig.
Reviewed by:	kp (earlier version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D28955
2021-02-27 21:20:38 -05:00
Edward Tomasz Napierala
22267215d6 camcontrol(8): remove unnecessary CCB zeroing
After 3e404b8c53, cam_getccb(3) clears the returned CCB, making
a number of calls to CCB_CLEAR_ALL_EXCEPT_HDR(3) unnecessary.

Reviewed By:	imp
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D27812
2021-02-25 18:45:21 +00:00
Edward Tomasz Napierala
f848d08e45 camcontrol: stop pretending cam_cmd is a bitmask
Cleanup only, no functional changes.

Reviewed By:	imp
Sponsored By:	NetApp, Inc.
Sponsored By:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D27813
2021-02-25 18:40:07 +00:00
Andrey V. Elsukov
13ad237a19 ipfw: make algo name argument optional for some table types
Most of table types currently supported by ipfw have only one
algorithm implementation. When user creates such tables, allow
to omit algo name in arguments. E.g. now it is possible:
	ipfw table T1 create type number
	ipfw table T2 create type iface
	ipfw table T3 create type flow

PR:		233072
MFC after:	1 week
Sponsored by:	Yandex LLC
2021-02-25 16:57:47 +03:00
Warner Losh
6b7580f7b1 camcontrol: change hueristic for I/O-less devtype
Some SATA drives have 'config' set to 0 in the identify block. Rather than rely
on it, use the strings windows uses to display the drive since they are supposed
to be space padded and will always be non-zero.
2021-02-23 12:56:15 -07:00
Konstantin Belousov
d485c77f20 Remove #define _KERNEL hacks from libprocstat
Make sys/buf.h, sys/pipe.h, sys/fs/devfs/devfs*.h headers usable in
userspace, assuming that the consumer has an idea what it is for.
Unhide more material from sys/mount.h and sys/ufs/ufs/inode.h,
sys/ufs/ufs/ufsmount.h for consumption of userspace tools, with the
same caveat.

Remove unacceptable hack from usr.sbin/makefs which relied on sys/buf.h
being unusable in userspace, where it override struct buf with its own
definition.  Instead, provide struct m_buf and struct m_vnode and adapt
code to use local variants.

Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D28679
2021-02-21 11:38:21 +02:00
Michael Chiu
be2003ccfa ifconfig: fix incorrect wg allowed-ips netmask
Currently when peer information is displayed with `ifconfig wgN peer ..`
or `ifconfig wgN peer-list`, the netmask of the first `allowed-ips` will
be used as the netmask of all CIDR in `allowed-ips`.  For example, if
the list is `192.168.1.0/24, 172.16.0.0/16`, it will display as
`192.168.1.0/24, 172.16.0.0/24`. While this does not affect the actual
functionality, it is very confusing.

Submitted by:   Michael Chiu <nyan -at- myuji.xyz>
Reviewed by:	grehan
Differential Revision: https://reviews.freebsd.org/D28655
MFC after:	1 day
2021-02-15 02:39:05 +00:00
Alan Somers
f540cb27a2 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.

MFC after:	6 weeks
Sponsored by:	Axcient
2021-02-12 11:30:52 -07:00
Daniel Ebdrup Jensen
2a7d4d9545 kldload(8): Improve phrasing
Mountroot isn't documented in the extant manual pages - so this
phrasing, while less absolute and concise, still conveys which
modules are recommended to be handled via loader.conf(5), and it also
does a better job of elucidating that the modules can include filesystem
drivers.

Submitted by:	kevans (earlier version)
Reported by:	imp, kevans, eugen
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D28542
2021-02-11 06:03:53 +01:00
Alexander V. Chernikov
924d1c9a05 Revert "SO_RERROR indicates that receive buffer overflows should be handled as errors."
Wrong version of the change was pushed inadvertenly.

This reverts commit 4a01b854ca.
2021-02-08 22:32:32 +00:00
Alexander V. Chernikov
4a01b854ca 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.
2021-02-08 21:42:20 +00:00
Daniel Ebdrup Jensen
866c8b8d5d kldload(8): Add note about using kld_list in rc.conf(5)
While here, also recommend that loader.conf(5) should only be used in
order to get to mountroot, as rc(8) is less fragile, faster, and is
easier to fix by booting to single-user mode instead of having to
blacklist modules in the loader.

MFH:		2 weeks
2021-02-08 07:57:36 +01:00
Alex Richardson
58de61b996 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
2021-02-04 17:56:26 +00:00
Alex Richardson
d6f4e1a897 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
2021-02-03 09:31:32 +00:00
Neel Chauhan
a08cdb6cfb Allow setting alias port ranges in libalias and ipfw. This will allow a system
to be a true RFC 6598 NAT444 setup, where each network segment (e.g. user,
subnet) can have their own dedicated port aliasing ranges.

Reviewed by:		donner, kp
Approved by:		0mp (mentor), donner, kp
Differential Revision:	https://reviews.freebsd.org/D23450
2021-02-02 13:24:17 -08:00
Poul-Henning Kamp
d21ce74dcc Register the bad read before bailing on terminal errors.
This way running recoverdisk in a loop will not get stuck on a bad
block which causes the disk or SD card detach.
2021-02-02 12:01:38 +00:00
Evgeniy Khramtsov
682c31db4e ipfw(8) crashes when ext6hdr option is omitted
Verify that the option is passed, error out if it's not.
The problem can be trivially triggered with `ipfw add allow ext6hdr`.

PR:		253169
Reviewed by:	kp@
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D28447
2021-02-01 21:25:11 +01:00
Gleb Smirnoff
3f43ada98c Catch up with 6edfd179c8: mechanically rename IFCAP_NOMAP to IFCAP_MEXTPG.
Originally IFCAP_NOMAP meant that the mbuf has external storage pointer
that points to unmapped address.  Then, this was extended to array of
such pointers.  Then, such mbufs were augmented with header/trailer.
Basically, extended mbufs are extended, and set of features is subject
to change.  The new name should be generic enough to avoid further
renaming.
2021-01-29 11:46:24 -08:00
Ryan Moeller
65efb73fbd sbin/sysctl: Fix CTLFLAG_SKIP for adjacent nodes
The OID is saved when we encounter CTLFLAG_SKIP so that descendants can
be skipped as well. We then must not update the skip OID until we are
out of the node. This was achieved by resetting the skip OID once the
prefix no longer matches, but the case where the OID we reset on has
CTLFLAG_SKIP was not accounted for.

Reported by:	mav
Reviewed by:	mav
MFC after:	2 days
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D28364
2021-01-27 14:27:46 -05:00
Kirk McKusick
8c22cf9b09 Fix fsck_ffs incorrectly reporting "CANNOT READ BLK: NNNN" errors.
A long-standing bug in Pass 1 of fsck_ffs in which it is reading in
blocks of inodes to check their block pointers. It failed to round
up the size of the read to a disk block size. When disks would
accept 512-byte aligned reads, the bug rarely manifested itself.
But many recent disks will no longer accept 512-byte aligned reads
but require 4096-byte aligned reads, so the failure to properly
round-up read sizes to multiples of 4096 bytes makes the error
much more likely to occur.

Reported by:  Peter Holm and others
Tested by:    Peter Holm and Rozhuk Ivan
MFC after:    3 days
Sponsored by: Netflix
2021-01-26 11:46:38 -08:00
Kristof Provost
dcd1e41f0c pfctl: FreeBSD now supports DIOCGIFSPEED
There's no need for a special case here to work around the lack of
DIOCGIFSPEED. That was introduced in FreeBSD in
c1aedfcbd9.

Reported by:	jmg@
Reviewed by:	donner@
Differential Revision:	https://reviews.freebsd.org/D28305
2021-01-25 19:58:22 +01:00
Alex Richardson
94ac312a71 ifconfig: fix UBSan signed shift error
Use 1u since UBSan complains about 1 << 31.
2021-01-25 15:09:50 +00:00
Kyle Evans
123ae3045d build: remove LIBPTHREAD/LIBTHR build options
WITHOUT_LIBTHR has been broken for a little over five years now, since the
xz 5.2.0 update introduced a hard liblzma dependency on libthr, and building
a useful system without threading support is becoming increasingly more
difficult.

Additionally, in the five plus years that it's been broken more reverse
dependencies have cropped up in libzstd, libsqlite3, and libcrypto (among
others) that make it more and more difficult to reconcile the effort needed
to fix these options.

Remove the broken options.

PR:		252760
Reviewed by:	brooks, emaste, kib
Differential Revision:	https://reviews.freebsd.org/D28263
2021-01-22 12:33:27 -06:00
Allan Jude
b84d0aaa4e ifconfig: add vlanproto "qiniq" as an alias for "802.1ad"
QinQ is better known by this name, so accept it as an alias

Reported-by:	Mike Geiger
Reviewed-by:	melifaro, hselasky, rpokala
MFC-with:	366917
Sponsored-by:	Klara Inc.
Differential-Revision:	https://reviews.freebsd.org/D28245
2021-01-20 15:50:45 +00:00
Rick Macklem
448de00de5 mount_nfs: update man page description for oneopenown
A recent email discussion indicated that a large
accumulation of NFSv4 Opens was occurring on
a mount. This appears to have been caused by a
shared library within the mount being used by
several processes, such that there is always at
least one of these processes running.
A new Open was created by each process and
were not closed, since all the Opens were never
closed. This is alleviated by using the
"oneopenown" mount option.

This man page update attempts to indicate the
use of "oneopenown" for this case.

This is a content change.

Reported by:	j.david.lists@gmail.com
Reviewed by:	0mp
MFC:	1 month
Differential Revision:	https://reviews.freebsd.org/D28215
2021-01-17 19:00:41 -08:00
Alexander V. Chernikov
d28210b2c2 Remove remnants of classful behavior in route(8).
Curently route(8) treats some addresses as network addresses:

 RTA_DST: inet 10.0.0.0; RTA_NETMASK: inet 255.0.0.0; RTA_IFP: link ;
 RTM_GET: Report Metrics: len 240, pid: 0, seq 1, errno 0, flags:<UP,GATEWAY,STATIC>
 locks:  inits:
 sockaddrs: <DST,NETMASK,IFP>
   10.0.0.0 255.0.0.0 link#0

Note added `RTA_NETMASK` in the request.

Host address from the same network is ok:

route -nv get 10.0.0.1
 RTA_DST: inet 10.0.0.1
 RTA_IFP: link
 RTM_GET: Report Metrics: len 224, pid: 0, seq 1, errno 0, flags:<UP,GATEWAY,HOST,STATIC>
...
   route to: 10.0.0.1
destination: 10.0.0.0
       mask: 255.255.255.0

This change eliminates network auto-guessing part AND reading network from /etc/networks.

Reviewed By: rgrimes

Differential Revision: https://reviews.freebsd.org/D24401
2021-01-16 23:45:30 +00:00
Kyle Evans
6dd869c22b bectl: remove spurious aok variable
This rode in with the OpenZFS import. It may have been necessary at some
point, but it is no longer and it breaks the WITHOUT_DYNAMICROOT build as
it collides with the definition in libspl.

Reported-by:	Michael Dexter
2021-01-16 00:07:50 -06:00
Kyle Evans
de661c9f86 bectl: tests: use -R <mount> instead of specifying altroot
-R is currently shorthand for cachefile=none, altroot=<mount>.  This is
functionally the same, but perhaps more resilient to future changes that
could be necessary that may be added when -R is specified.

MFC after:	 1 week
2021-01-16 00:07:50 -06:00
Charlie Root
292808246d ICMP checksum test: Fix for big endian
The in_cksum tests originally tried to simulate a BE environment by
swapping the byte order of the input.  But that's overcomplicated, and
didn't actually work on real BE hardware.  The correct testing strategy
is just to test on the native endianness, and run the tests in both BE
and LE environments.

Submitted by:		Renato Riolino <renato.riolino@eldorado.org.br>
Reviewed By:		asomers
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D23193
2021-01-11 19:03:46 -07:00
Kristof Provost
0c156a3c32 pfctl: Another set skip <group> fix
When retrieving the list of group members we cannot simply use
ifa_lookup(), because it expects the interface to have an IP (v4 or v6)
address. This means that interfaces with no address are not found.
This presents as interfacing being alternately marked as skip and not
whenever the rules are re-loaded.

Happily we only need to fix ifa_grouplookup(). Teach it to also accept
AF_LINK (i.e. interface) node_hosts.

PR:     	250994
MFC after:	3 days
2021-01-11 22:30:44 +01:00
Dimitry Andric
a82f07fc2e Fix 32-bit build post 6733401935
The general style in sbin/nvmecontrol apppears to print uint64_t types
using %j, so I'm using that instead of the more general (but admittedly
ugly) PRIu64.
2021-01-08 23:38:30 +01:00
Cy Schubert
c6951fac78 Fix 32-bit build post 5cc52631b3. 2021-01-08 11:28:30 -08:00
Chuck Tuffli
6733401935 nvmecontrol: add device self-test op and log page
Add decoding of the Device Self-test log page and the ability to start
or abort a test.

Reviewed by:	imp, mav
Tested by:	Muhammad Ahmad <muhammad.ahmad@seagate.com>
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D27517
2021-01-08 09:27:56 -08:00
Kirk McKusick
5cc52631b3 Rewrite the disk I/O management system in fsck_ffs(8). Other than
making fsck_ffs(8) run faster, there should be no functional change.

The original fsck_ffs(8) had its own disk I/O management system.
When gjournal(8) was added to FreeBSD 7, code was added to fsck_ffs(8)
to do the necessary gjournal rollback. Rather than use the existing
fsck_ffs(8) disk I/O system, it wrote its own from scratch. Similarly
when journalled soft updates were added in FreeBSD 9, code was added
to fsck_ffs(8) to do the necessary journal rollback. And once again,
rather than using either of the existing fsck_ffs(8) disk I/O
systems, it wrote its own from scratch. Lastly the fsdb(8) utility
uses the fsck_ffs(8) disk I/O management system. In preparation for
making the changes necessary to enable snapshots to be taken when
using journalled soft updates, it was necessary to have a single
disk I/O system used by all the various subsystems in fsck_ffs(8).

This commit merges the functionality required by all the different
subsystems into a single disk I/O system that supports all of their
needs. In so doing it picks up optimizations from each of them
with the results that each of the subsystems does fewer reads and
writes than it did with its own customized I/O system. It also
greatly simplifies making changes to fsck_ffs(8) since everything
goes through a single place. For example the ginode() function
fetches an inode from the disk. When inode check hashes were added,
they previously had to be checked in the code implementing inode
fetch in each of the three different disk I/O systems. Now they
need only be checked in ginode().

Tested by:    Peter Holm
Sponsored by: Netflix
2021-01-07 15:03:15 -08:00
Mateusz Piotrowski
74bd207697 Reference newfs_msdos(8) from the newfs(8) manual
PR:		252484
Reported by:	Graham Perrin <grahamperrin@gmail.com>
MFC after:	3 days
2021-01-07 10:24:07 +01:00
Kirk McKusick
c8a7a3ffe1 Fix bug in expanding lost+found direct blocks.
Reported by:  Peter Holm
Sponsored by: Netflix
2021-01-06 16:35:01 -08:00
Robert Wing
b1ea63e2e3 bectl(8): sync man page and help text
Sync man page with behavior of bectl(8).

Sync help text with man page.

PR:             246697
Reported by:	olgeni
Submitted by:   olgeni (with changes)
Reviewed by:    kevans, olgeni
Approved by:    kevans (mentor)
MFC after:      1 week
Differential Revision:	https://reviews.freebsd.org/D27482
2021-01-06 10:38:25 -09:00
Kristof Provost
fda7daf063 pfctl: Stop sharing pf_ruleset.c with the kernel
Now that we've split up the datastructures used by the kernel and
userspace there's essentually no more overlap between the pf_ruleset.c
code used by userspace and kernelspace.

Copy the userspace bits to the pfctl directory and stop using the kernel
file.

Reviewed by:	philip
MFC after:	2 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D27764
2021-01-05 23:35:37 +01:00
Emmanuel Vadot
2d486ba15f pkgbase: Move bectl to the runtime package
runtime contain what is needed to boot in single user and repair a
system, bectl could be handy to have in this situation.

Differential Revision:	https://reviews.freebsd.org/D27708
2021-01-04 16:17:12 +01:00
Xin LI
fd340a1222 sbin/camcontrol: use calloc/strlcpy where appropriate.
MFC after:	2 weeks
2021-01-03 22:52:28 -08:00
Kirk McKusick
997f81af43 The fsck_ffs program had previously only been able to expand the size
of its lost+found directory by allocating direct block pointers. The
effect was that it was limited to about 19,000 files. One of Peter Holm's
tests produced a filesystem with about 23,000 lost files which meant
that fsck_ffs was unable to recover it. This update allows lost+found
to be expanded into a single indirect block which allows it to store
up to about 6,573,000 lost files.

Reported by:  Peter Holm
Sponsored by: Netflix
2021-01-02 22:31:55 -08:00
Alan Somers
b586c66baf ping: fix ping when the kernel was built without INET6
If the kernel was built without INET6, default to ICMP.  Or, if it was
built without INET, default to ICMPv6.

PR:		251725
Reported by:	jbeich
Reviewed by:	jbeich
Tested by:	jbeich
MFC with:	368045
2021-01-01 10:25:49 -07:00
Kirk McKusick
68dc94c7d3 Correct and add some comments.
Sponsored by: Netflix
2020-12-31 15:36:33 -08:00
Ed Maste
50a40d0911 ldconfig: Retire a.out support
aout support in ldconfig hasn't been required since FreeBSD 2.x.
If someone needs to use FreeBSD 2 shared libraries they will be best
served by using a FreeBSD 2 ldconfig as well.

In aa5e1b42e6 we removed the ldconfig a.out invocation from rc.d but
left the support in ldconfig itself.  Remove it now.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27481
2020-12-31 10:29:08 -05:00
Guangyuan Yang
70a2e109bd dump(8): clarify the recommended use of cache and snapshots
PR:		131626
MFC after:	1 week
Submitted by:	Andrew Hamilton-Wright <andrew@qemg.org>
Reviewed by:	bcr
Differential Revision:	https://reviews.freebsd.org/D27775
2020-12-28 21:56:58 +00:00
Gordon Bergling
e5a84dc8a7 dumpon(8): Add missing section arguments
MFC after:	3 days
2020-12-28 16:48:58 +01:00