Commit Graph

9541 Commits

Author SHA1 Message Date
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
Gordon Bergling
e13534d54a newfs(8): Fix unusual Xr order
- unusual Xr order: gjournal after gpart

MFC after:	3 days
2020-12-28 16:46:28 +01:00
Xin LI
804b4afb9c sbin/init: Reduce code duplication by using %m for error message
instead of passing %s with return value from strerror().

MFC after:	2 weeks
2020-12-25 17:49:33 -08:00
Xin LI
7e75718295 sbin/routed: Remove unused code for sgi and NetBSD.
MFC after:	2 weeks
2020-12-25 17:42:47 -08:00
Rick Macklem
79302a6304 mount_nfs(8): add a description for the new "tlscertname" option
commit 665b1365fe added a new NFS mount option that is used to set a
non-default X.509 certificate, that can be used for nfs-over-tls NFS
mounts.
This patch adds a description for it to the man page.

Reviewed by:		0mp
Differential Revision:	https://reviews.freebsd.org/D27733
2020-12-24 14:20:06 -08:00
Ryan Moeller
401f82df48 sbin/sysctl: Style fix
Remove parameter names from function prototype to match other
prototypes in the file.

Sponsored by:	iXsystems, Inc.
2020-12-23 12:45:11 -05:00
Ryan Moeller
a5ec1dd453 sbin/sysctl: Always honor skip in sysctl_all
Fix broken CTLFLAG_SKIP when present on the first child of the requested
node.

We don't need to ignore skip for the first node because in sysctl_all()
we've implicitly visited the first node already when oid is specified.
The first call to show_var() in here is after we have iterated to the
next node. When the command line specifically requests a non-node sysctl
we go straight into show_var() without calling sysctl_all().

Reported by:	jhb
Reviewed by:	jhb
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D27674
2020-12-23 12:42:38 -05:00
Gordon Bergling
bae74ca922 ipfw(8): Fix a few mandoc related issues
- no blank before trailing delimiter
- missing section argument: Xr inet_pton
- skipping paragraph macro: Pp before Ss
- unusual Xr order: syslogd after sysrc
- tab in filled text

There were a few multiline NAT examples which used the .Dl macro with
tabs. I converted them to .Bd, which is a more suitable macro for that case.

MFC after:	1 week
2020-12-19 12:47:40 +00:00
Gordon Bergling
ea0dd3ca44 ping(8): Fix a mandoc related issue
- unusual Xr punctuation: none before traceroute6(8)
2020-12-19 11:57:47 +00:00
Gordon Bergling
9bca273d84 nvmecontrol(8): Fix a few mandoc related issues and add a SEE ALSO section
- inserting missing end of block: Ss breaks Bl
- skipping paragraph macro: Pp before Ss
- referenced manual not found: Xr nvme 4 (2 times)
- unknown standard specifier: St The

The macro .St can only be used for standards known by mdoc(7). So add a
SEE ALSO section and add a reference to the NVM Express Base Specification.

MFC after:	2 weeks
2020-12-19 11:47:38 +00:00
Gordon Bergling
226f43e757 devd.conf(5): Fix a mandoc related issue
- sections out of conventional order: Sh SEE ALSO

MFC after:	1 week
2020-12-19 11:03:04 +00:00
Kirk McKusick
7180f1ab40 Rename pass4check() to freeblock() and move from pass4.c to inode.c.
The new name more accurately describes what it does and the file move
puts it with other similar functions. Done in preparation for future
cleanups. No functional differences intended.

Sponsored by: Netflix
Historic Footnote: my last FreeBSD svn commit
2020-12-18 23:28:27 +00:00
Robert Wing
f200cc255f geom(8): list geoms with /dev/ prefix
Allow geom(8) to list geoms with the '/dev/' prefix.

`geom part show` accepts the '/dev/' prefix but `geom part list` does not.

Modify find_geom() in sbin/geom/core/geom.c to be consistent with the behavior
of find_geom() in lib/geom/part/geom_part.c.

PR:             188213
Reported by:    Ronald F. Guilmette <rfg@tristatelogic.com>
Reviewed by:    imp, kevans
Approved by:    kevans (mentor)
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D27556
2020-12-12 07:22:38 +00:00
Ryan Libby
61261ef589 savecore: bail on write error even when decompressing
Reviewed by:	markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D27560
2020-12-11 22:52:12 +00:00
Eric van Gyzen
4617b1f62b decryptcore: preload OpenSSL error strings; seed PRNG
As in r360226, preload OpenSSL error strings and seed the PRNG
before entering capability mode.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2020-12-11 14:32:42 +00:00
Hans Petter Selasky
21f5dc86d3 Fix bug in ifconfig preventing proper VLAN creation.
Detection of interface type by filter must happen before detection of
interface type by prefix. Else the following sequence of commands will
try to create a LAGG interface instead of a VLAN interface, which
accidentially worked previously, because the date pointed to by the
ifr_data pointer was not parsed by VLAN create ioctl(2). This is a
regression after r368229, because the VLAN creation now parses the
ifr_data field.

How to reproduce:
# ifconfig lagg0 create
# ifconfig lagg0.256 create

Differential Revision:	https://reviews.freebsd.org/D27521
Reviewed by:		kib@ and kevans@
Reported by:		raul.munoz@custos.es
Sponsored by:		Mellanox Technologies // NVIDIA Networking
2020-12-09 20:13:12 +00:00
Kyle Evans
b8f71f9750 bectl: simplify the tail end of the jail cmd
This has already confused me once (and I'm pretty sure I wrote it), so let's
clarify: unjailing after the command has completed will only happen if we're
interactive and -U has not been specified.

This just folds two conditionals together to make it obvious how -b/-U
interact with each other.

MFC after:	3 days
2020-12-06 15:58:50 +00:00
Gordon Bergling
4ddfc27e14 ping(8): Fix a few mandoc related issues
- new sentence, new line
2020-12-04 20:47:56 +00:00
Gleb Smirnoff
3921dc1304 Fix r368197: suppress error printing for the "check" command.
Reviewed by:	kevans
2020-12-02 21:53:28 +00:00
Rick Macklem
00c8b28c1a Improve man page for AmazonEFS mounts.
PR#250770 was actually just a misunderstanding of what
NFS mount options are needed for AmazonEFS mounts.
This patch attempts to clarify the manpage to clarify this.

This is a content change.

PR:		250770
Reviewed by:	bcr
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D27430
2020-12-01 23:33:10 +00:00
John-Mark Gurney
4102e8385f add documentation that the rules need to be reloaded, and how to do it...
MFC after:	1 week
2020-12-01 23:25:21 +00:00
Gleb Smirnoff
4c91d6bc44 Print at least something when failing. 2020-11-30 21:05:31 +00:00
Matt Macy
2338da0373 Import kernel WireGuard support
Data path largely shared with the OpenBSD implementation by
Matt Dunwoodie <ncon@nconroy.net>

Reviewed by:	grehan@freebsd.org
MFC after:	1 month
Sponsored by:	Rubicon LLC, (Netgate)
Differential Revision:	https://reviews.freebsd.org/D26137
2020-11-29 19:38:03 +00:00
Eugene Grosbein
1c86e81196 hastd(8) assumes it has no extra file descriptors opened
and aborts otherwise, so call closefrom() early.

PR:		227461
MFC after:	2 weeks
2020-11-29 13:45:53 +00:00
Alan Somers
fd26389be7 ping: allow building without INET support
Building without INET6 support was already possible. Now it's possible to
build ping with only INET6, or even with neither INET nor INET6.

Reported by:	bz
Reviewed by:	bz
MFC-With:	368045
Differential Revision:	https://reviews.freebsd.org/D27394
2020-11-28 23:24:19 +00:00
Alan Somers
d262451715 ping: add a ping6 hard link for backwards compatibility
When invoked as "ping6", ping will now attempt to use ICMPv6 for hostnames
that resolve both IPv4 and IPv6 addresses.

Reviewed by:	bz, manu
MFC-With:	r368045
Differential Revision:	https://reviews.freebsd.org/D27384
2020-11-26 18:33:04 +00:00
Hans Petter Selasky
05952067bb Ensure consistent error messages from ifconfig(8).
If multiple threads are invoking "ifconfig XXX create" a race may occur
which can lead to two different error messages for the same error.

a) ifconfig: SIOCIFCREATE2: File exists
b) ifconfig: interface XXX already exists

This patch ensures ifconfig prints the same error code
for the same case.

Reviewed by:	imp@ and kib@
Differential Revision:	https://reviews.freebsd.org/D27380
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-11-26 16:36:50 +00:00
Alan Somers
3cde9171d2 Merge ping6 to ping
There is now a single ping binary, which chooses to use ICMP or ICMPv4
based on the -4 and -6 options, and the format of the address.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
Sponsored by:	Google LLC (Google Summer of Code 2019)
MFC after:	Never
Differential Revision:	https://reviews.freebsd.org/D21377
2020-11-26 04:29:30 +00:00
Mark Johnston
78e1f68ee1 ping(8): Improve parameter validation
- Use strtonum(3) to simplify bounds checking of numeric parameters.
- Fix bounds checking when filling out packet data in "sweep" mode.

PR:		239974, 239977, 239978
Reported by:	Neeraj <neerajpal09@gmail.com>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25622
2020-11-24 17:12:40 +00:00
Alan Somers
f998d4c7a2 ping6: update usage text after r365547
MFC after:	2 weeks
2020-11-24 02:51:45 +00:00