Commit Graph

9173 Commits

Author SHA1 Message Date
Alan Somers
7cc426fb42 ping: add a basic functional test
Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21289
2019-08-22 15:00:36 +00:00
Xin LI
aa9cb40e30 When creating a new FAT32 filesystem, use "unknown" (0xFFFFFFFF) for
FSI_Nxt_Free instead of providing a wrong value.

With this change, fsck_msdosfs would no longer complain about invalid
FSInfo information.

MFC after:	2 weeks
2019-08-22 06:14:06 +00:00
Alan Somers
99f13ae12c ping: add -H option for enabling reverse DNS lookup
This is the reverse of the -n flag.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
Sponsored by:	Google LLC (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21356
2019-08-21 21:05:15 +00:00
Alan Somers
229e8bf2bb ping: do reverse DNS lookup of the target address
When printing replies, ping will now attempt a reverse DNS lookup of the
target.  That can be suppressed by using the "-n" option.  Curiously, ping
has always done reverse lookups in certain error paths, but never in the
success path.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google LLC (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21351
2019-08-21 14:52:12 +00:00
Alan Somers
c43633c6a1 ping: Add tests of the Internet checksum function
Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google LLC (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21340
2019-08-20 21:59:48 +00:00
Alan Somers
a3ce769851 Fix uninitialized variable warnings when MK_CASPER=no
Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21322
2019-08-19 17:54:40 +00:00
Alan Somers
7898770a26 ping: fix -Wformat-truncating warning with GCC
Increase buffer size for the string representation of n_time

ICMP timestamp is a 32-bit number. In pr_ntime(), number of minutes
and seconds is always 2 characters wide. Max. number of hours is 4
characters wide. The buffer size should be at least:

4 + 2 + 2 + 1 (':') + 1 (':') + 1 ('\0') = 11

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21325
2019-08-19 17:28:12 +00:00
Alan Somers
818f498f29 ping6: revert r350857
Some socket options require root privileges to set.  The old code did indeed
drop privileges at the earliest opportunity.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	Never
Sponsored by:	Google, Inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21319
2019-08-19 14:20:26 +00:00
Xin LI
55d26365b1 Use calloc().
MFC after:	2 weeks
2019-08-19 05:24:42 +00:00
Xin LI
b9919ec960 Remove redundant check and wrong fix: fat.c checks already take care
about cluster chains.

Obtained from:	OpenBSD
MFC after:	2 weeks
2019-08-19 04:28:12 +00:00
Alan Somers
60df116853 ping6: Raise WARNS level to 6
Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21260
2019-08-17 17:22:08 +00:00
Alan Somers
ff77ab831a ping: Move in_cksum() to a separate source file
This is a preparation step for adding ATF tests of in_cksum(), which has been
modified to operate on unaligned data. ping.o cannot be linked to the test
executable because both of them contain 'main' symbol.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21288
2019-08-17 15:25:01 +00:00
Alan Somers
62da1eef7f ping6: Fix dnsdecode() bug introduced by r350859
Revision 350859 removed level of indirection that was needed for setting the
caller's `cp' pointer. dnsdecode() uses return value to indicate error or
success. It returns pointer to a buffer holding a decompressed DNS name or
NULL. The caller uses that value only to find out the result, not for accessing
the buffer.

We use the return value to propagate the new value of `cp' pointer to
the caller instead of using an output argument.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
MFC-With:	350859
Sponsored by:	Google, Inc (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21266
2019-08-17 14:28:32 +00:00
Eric Joyner
f4aa9b67eb net: Update SFF-8024 definitions and strings with values from rev 4.6
This will let ifconfig -v's SFF eeprom read functionality recognize more
module types.

Signed-off-by: Eric Joyner <erj@freebsd.org>

Reviewed by:	gallatin@
MFC after:	1 week
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D21041
2019-08-17 00:10:56 +00:00
Alan Somers
2933651bf4 ping6: Fix alignment errors
This fixes -Wcast-align errors when compiled with WARNS=6.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21217
2019-08-15 19:52:32 +00:00
Alan Somers
8a3107c8f3 ping6: fix uninitialized variable warnings when MK_CASPER=no
Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21273
2019-08-15 19:27:36 +00:00
Alan Somers
0b894a06bd ping6: Fix data type of the buffer for ancillary data of a received message
The old code worked, but wasted some stack space.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21275
2019-08-15 17:24:10 +00:00
John-Mark Gurney
a521fa63c2 finish the pcp feature, but documenting it in the man page... 2019-08-15 16:58:00 +00:00
Alan Somers
631b873cd8 ping6: fix uninitialized variable warning for intvl
GCC isn't smart enough to realize that this variable was always initialized.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21271
2019-08-15 16:09:27 +00:00
Alan Somers
899ecf0904 ping6: quiet an undefined variable warning
GCC 4.2 isn't smart enough to know that this variable is already defined by
the time it's used.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21269
2019-08-15 15:55:01 +00:00
Alan Somers
dab7253c41 ping6: quiet warning about unused copyright variable
Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21270
2019-08-15 15:49:01 +00:00
Doug Moore
504f5e294e swap_pager.c reserves 2 blocks for a bsd label. Change that 2 to the
expression howmany(BBSIZE, PAGE_SIZE), where BBSIZE is the size of the
boot block area.  That can be less than 2 if PAGE_SIZE is big.

swapon(8) has an option to trim (delete) all the blocks of a device at
startup.  However, if the first of those blocks is a bsd label, then
trimming those blocks is destructive.  Change swapon to leave the
first BBSIZE bytes untrimmed.

Update manual pages to reflect changes in how swapon and how it may be
used, espeically in association with savecore.

Reviewed by: alc
Approved by: markj (mentor)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D21191
2019-08-15 02:30:44 +00:00
Alexander Motin
4035e778f8 Print few more useful identify fields.
MFC after:	2 weeks
2019-08-14 17:36:26 +00:00
Alan Somers
d63a94876b ping: Make in_cksum() operate on u_char buffer
This fixes -Wcast-align errors for in_cksum() calls when compiled with
WARNS=6.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21261
2019-08-14 16:55:06 +00:00
Alan Somers
84633ef14a ping: fix triptime calculation after r350998
That revision changed the internal clock to the monotonic, but neglected to
change the datagram's timestamp source.

Reported by:	Oliver Hartmann, Michael Butler
Reviewed by:	Ján Sučan <sucanjan@gmail.com>, allanjude
MFC after:	2 weeks
MFC-With:	r350998
Differential Revision:	https://reviews.freebsd.org/D21258
2019-08-14 16:45:09 +00:00
Conrad Meyer
ac8e5d02cf Remove deprecated GEOM classes
Follow-up on r322318 and r322319 and remove the deprecated modules.

Shift some now-unused kernel files into userspace utilities that incorporate
them.  Remove references to removed GEOM classes in userspace utilities.

Reviewed by:	imp (earlier version)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D21249
2019-08-13 20:06:55 +00:00
Alan Somers
1ad76f1b60 ping: use the monotonic clock to measure durations
Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21245
2019-08-13 19:27:23 +00:00
Alan Somers
42bf965528 ping6: use the monotonic clock to measure durations
Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21226
2019-08-13 19:24:17 +00:00
Alan Somers
2c29d74c4f ping: fix data type of a variable for a packet sequence number
Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21244
2019-08-13 16:25:23 +00:00
Alan Somers
354c349080 Consistently use the byteorder functions in the correct direction
Though ntohs and htons are functionally identical, they have different meanings.Using the correct one helps to document the code.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21219
2019-08-13 16:22:43 +00:00
Alan Somers
5e9c6b7239 ping6: Fix data type of a variable for a packet sequence number
Submitted by:   Ján Sučan <sucanjan@gmail.com>
MFC after:      2 weeks
Sponsored by:   Google, inc. (Google Summer of Code 2019)
Differential Revision:  https://reviews.freebsd.org/D21218
2019-08-13 15:30:29 +00:00
Alan Somers
17e49888f6 ping6: Fix data type of a variable for a packet sequence number
Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21218
2019-08-12 19:14:11 +00:00
Alan Somers
401d89a9e2 ping6: Remove unnecessary level of indirection from dnsdecode() parameter
The `sp' pointer doesn't need to be modified in the caller of
dnsdecode().

This fixes -Wcast-qual error (`must have all intermediate pointers
const qualified to be safe') when compiled with WARNS=6.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21215
2019-08-11 15:36:18 +00:00
Alan Somers
5e35df9474 ping6: Add missing static keyword for a global variable
This fixes -Wmissing-variable-declarations error when compiled with
WARNS=6.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21214
2019-08-11 15:27:34 +00:00
Alan Somers
0ef7ac044a ping6: Revoke root privilege earlier
It can be done just after the sockets have been created.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21213
2019-08-11 15:22:53 +00:00
Mark Johnston
d4c8b7594f Fix formatting.
PR:		239726
Submitted by:	Gordon Bergling <gbergling@gmail.com>
MFC after:	3 days
2019-08-08 20:56:52 +00:00
Kirk McKusick
47d3e2f83b Correct the location of the first backup superblock in fsck_ffs.8.
Make a note in the newfs.8 manual page to update the first backup
superblock location when changing the default fragment size for
the filesystem.

Reported by:  O. Hartmann
2019-08-07 16:56:00 +00:00
Alexander Motin
b7e08f9305 Make GCC happy about math in r350676.
MFC after:	1 week
2019-08-07 15:05:08 +00:00
Alexander Motin
0912877616 Make camcontrol modepage support block descriptors.
It allows to read and write block descriptors alike to mode page parameters.
It allows to change block size or short-stroke HDDs or overprovision SSDs.
Depenting on -P parameter the change can be either persistent or till reset.
In case of block size change device may need reformat after the setting.
In case of SSD overprovisioning format or sanitize may be needed to really
free the flash.

During implementation appeared that csio_encode_visit() can not handle
integers of more then 4 bytes, that makes 8-byte LBA handling awkward.
I had to split it into two 4-byte halves now.

MFC after:	1 week
Relnotes:	yes
Sponsored by:	iXsystems, Inc.
2019-08-07 14:45:10 +00:00
Alan Somers
0b4275accb fusefs: merge from projects/fuse2
This commit imports the new fusefs driver. It raises the protocol level
from 7.8 to 7.23, fixes many bugs, adds a test suite for the driver, and
adds many new features. New features include:

* Optional kernel-side permissions checks (-o default_permissions)
* Implement VOP_MKNOD, VOP_BMAP, and VOP_ADVLOCK
* Allow interrupting FUSE operations
* Support named pipes and unix-domain sockets in fusefs file systems
* Forward UTIME_NOW during utimensat(2) to the daemon
* kqueue support for /dev/fuse
* Allow updating mounts with "mount -u"
* Allow exporting fusefs file systems over NFS
* Server-initiated invalidation of the name cache or data cache
* Respect RLIMIT_FSIZE
* Try to support servers as old as protocol 7.4

Performance enhancements include:

* Implement FUSE's FOPEN_KEEP_CACHE and FUSE_ASYNC_READ flags
* Cache file attributes
* Cache lookup entries, both positive and negative
* Server-selectable cache modes: writethrough, writeback, or uncached
* Write clustering
* Readahead
* Use counter(9) for statistical reporting

PR:		199934 216391 233783 234581 235773 235774 235775
PR:		236226 236231 236236 236291 236329 236381 236405
PR:		236327 236466 236472 236473 236474 236530 236557
PR:		236560 236844 237052 237181 237588 238565
Reviewed by:	bcr (man pages)
Reviewed by:	cem, ngie, rpokala, glebius, kib, bde, emaste (post-commit
		review on project branch)
MFC after:	3 weeks
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Pull Request:	https://reviews.freebsd.org/D21110
2019-08-07 00:38:26 +00:00
Warner Losh
ef7a2ead30 Fix mismerge.
I merged passthru.c from the wrong branch (it was a branch that went further in
a direction I wound up not taking). Fix the mismerge and turn passthru on.
2019-08-06 18:15:26 +00:00
Alexander Motin
217c81f334 Fix alignment issue r350599.
MFC after:	10 days
2019-08-05 19:30:28 +00:00
Alexander Motin
70d20ed34f Add nvmecontrol resv to handle NVMe reservations.
NVMe reservations are quite alike to SCSI persistent reservations and
can be used in clustered setups with shared multiport storage.

MFC after:	10 days
Relnotes:	yes
Sponsored by:	iXsystems, Inc.
2019-08-05 17:36:00 +00:00
Kyle Evans
c144616b7d ipfw: fix jail option after r348215
r348215 changed jail_getid(3) to validate passed-in jids as active jails
(as the function is documented to return -1 if the jail does not exist).
This broke the jail option (in some cases?) as the jail historically hasn't
needed to exist at the time of rule parsing; jids will get stored and later
applied.

Fix this caller to attempt to parse *av as a number first and just use it
as-is to match historical behavior. jail_getid(3) must still be used in
order for name arguments to work, but it's strictly a fallback in case we
weren't given a number.

Reported and tested by:	Ari Suutari <ari stonepile fi>
Reviewed by:	ae
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D21128
2019-08-05 00:08:25 +00:00
Alexander Motin
278ba86cec Add nvmecontrol sanitize command.
It allows to delete all user data from NVM subsystem in one of 3 methods.
It is a close equivalent of SCSI SANITIZE command of `camcontrol sanitize`,
so I tried to keep arguments as close as possible.

While there, fix supported sanitize methods reporting in `identify`.

MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	iXsystems, Inc.
2019-08-03 19:24:56 +00:00
Alan Somers
2943ddcf51 Capsicumize ping6
Add capsicum support to ping6, mostly copying the strategy used for ping.

Submitted by:	Ján Sučan <jansucan@gmail.com>
Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21050
2019-08-03 13:53:14 +00:00
Alexander Motin
ea44065c1f Fix parameter check broken at r350057.
MFC after:	2 weeks
2019-08-03 04:30:22 +00:00
Alexander Motin
6c99d1325e Decode few more NVMe log pages.
In particular: Changed Namespace List, Commands Supported and Effects,
Reservation Notification, Sanitize Status.

Add few new arguments to `nvmecontrol log` subcommand.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2019-08-02 20:16:21 +00:00
Alexander Motin
90dfa8f0ac Add more new fields and values from NVMe 1.4.
MFC after:	2 weeks
2019-08-02 03:43:24 +00:00
Alexander Motin
48ec75f0e7 Rename function added in r350523 to make gcc happy.
MFC after:	2 weeks
2019-08-01 22:22:06 +00:00