Commit Graph

8909 Commits

Author SHA1 Message Date
Warner Losh
7d923c13d7 Usage cleanup pt 1
Provide a usage() function that takes a struct nvme_function pointer
and produces a usage mssage. Eliminate all now-redundant usage
functions. Propigate the new argument through the program as needed.
Use common routine to print usage.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403
2018-12-02 23:12:58 +00:00
Warner Losh
fbf14fe84b Return after we find the dispatched function.
If the dispatched function doesn't exit, then we get can get a
spurious function not found message. They all do exit, but this is a
little cleaner.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403
2018-12-02 23:12:48 +00:00
Warner Losh
e2ed7941e0 Move the hgst/wdc log page printing code into wdc.c
These are all hgst/wdc specific, so move them into the wdc.c to live
with the wdc command.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403
2018-12-02 23:12:37 +00:00
Warner Losh
a773b08b88 Move common logpage routines into nvmecontrol.h
For the upcoming move of vendor specific code into vendor specific
files, make the common logpage routines global and move them to
nvmecontrol.h.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403
2018-12-02 23:12:26 +00:00
Warner Losh
aecd1901a9 Make logpage functions a linker set.
Move logpage function def to header. Convert all the logpage_function
elements to elements of the linker set. Leave them all in logpage.c
for the moment.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403
2018-12-02 23:12:16 +00:00
Warner Losh
a13a291adf Move nvmecontrol to using linker sets for commands
More commands will be added to nvmecontrol. Also, there will be a few
more vendor commands (some of which may need to remain private to
companies writing them). The first step on that journey is to move to
using linker sets to dispatch commands. The next step will be using
dlopen to bring in the .so's that have the command that might need
to remain private for seamless integration.

Similar changes to this will be needed for vendor specific log pages.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403
2018-12-02 23:10:55 +00:00
Eugene Grosbein
3b78397008 Small language fix after r340978.
MFC after:	3 days
2018-11-26 16:10:20 +00:00
Eugene Grosbein
3a498c2e8a ipfw.8: add new section to EXAMPLES:
SELECTIVE MIRRORING
     If your network has network traffic analyzer connected to your host
     directly via dedicated interface or remotely via RSPAN vlan, you can
     selectively mirror some ethernet layer2 frames to the analyzer.
     ...
2018-11-26 16:02:17 +00:00
Yuri Pankov
52ee41b778 bectl: sync usage with man page, removing stray multibyte characters
in the process.

PR:		233526
Submitted by:	tigersharke@gmail.com (original version)
Reviewed by:	kevans
Approved by:	kib (mentor, implicit)
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D18335
2018-11-26 15:11:32 +00:00
Kirk McKusick
038c170fc2 Properly recover from superblock check-hash failures. Specifically,
report the check-hash failure and offer to search for and use
alternate superblocks.  Prior to this fix fsck_ffs would simply
report the check-hash failure and exit.

Reported by:  Julian H. Stacey <jhs@berklix.com>
Tested by:    Peter Holm
Sponsored by: Netflix
2018-11-25 18:09:39 +00:00
Guangyuan Yang
e9e747efe2 Fix a minor typo in ipfw(8) manual page.
PR:		230747
Submitted by:	f.toscan@hotmail.it
MFC after:	1 week
2018-11-23 03:42:05 +00:00
Mateusz Piotrowski
f5c8cb4c35 Cross-reference libbe(3) and bectl(8).
Those two manual pages are already referencing each other in the HISTORY
sections, which people might skip. Mention those manual pages explicitly in
the SEE ALSO sections.  Also, remove a reference to be(1) from libbe(3).

Reviewed by:	bcr
Approved by:	krion (mentor, implicit), mat (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D18136
2018-11-21 12:46:28 +00:00
Guangyuan Yang
14b520eaa2 Fix incorrect DSCP value range from 0..64 to 0..63.
PR:		232786
Submitted by:	Sergey Akhmatov <sergey@akhmatov.ru>
Reviewed by:	AllanJude
MFC after:	1 week
2018-11-21 00:22:31 +00:00
Andrey V. Elsukov
5786c6b9f9 Make multiline APPLY_MASK() macro to be function-like.
Reported by:	cem
MFC after:	1 week
2018-11-20 18:38:28 +00:00
Mark Johnston
79dd8f690a Avoid clobbering a user-specified -g value after r340547.
CID:		1396919
MFC with:	r340547
2018-11-20 18:10:56 +00:00
Kyle Evans
6fc21012a3 bectl(8) tests: attempt to load the ZFS module
Observed in a CI test image, bectl_create test will run and be marked as
skipped because the module is not loaded. The first zpool invocation will
automagically load the module, but bectl_create is still skipped. Subsequent
tests all pass as expected because the module is now loaded and everything
is OK.

MFC after:	3 days
2018-11-19 17:09:57 +00:00
Kyle Evans
9c1535e9ab bectl(8): Add some regression tests
These tests operate on a file-backed zpool that gets created in the kyua
temp dir. root and ZFS support are both required for these tests. Current
tests cover create, destroy, export/import, jail, list (kind of), mount,
rename, and jail.

List tests should later be extended to cover formatting and the different
list flags, but for now only covers basic "are create/destroy actually
reflected properly"

MFC after:	3 days
2018-11-19 02:30:12 +00:00
Kyle Evans
cc624025b4 bectl(3)/libbe(3): Allow BE root to be specified
Add an undocumented -r option preceding the bectl subcommand to specify a BE
root to operate out of. This will remain undocumented for now, as some
caveats apply:

- BEs cannot be activated in the pool that doesn't contain the rootfs
- bectl create cannot work out of the box without the -e option right now,
  since it defaults to the rootfs and cross-pool cloning doesn't work like
  that (IIRC)

Plumb the BE root through to libbe(3) so that some things -can- be done to
it, e.g.

bectl -r tank/ROOT create -e default upgrade
bectl -r tank/ROOT mount upgrade /mnt

this aides in some upgrade setups where rootfs is not necessarily ZFS, and
also makes it easier/possible to regression-test bectl when combined with a
file-backed zpool.

MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D18029
2018-11-19 02:12:08 +00:00
Mark Johnston
e5fff57dd0 Change dumpon(8)'s handling of -g.
Rather than using a special value to denote "use the default router",
treat the absence of the -g option to mean the same thing.  The
in-kernel netdump client will always attempt to reach the server
directly before falling back to the configured gateway anyway.  This
change makes it cleaner to support a hostname value for -g.

Reviewed by:	cem
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D18025
2018-11-18 01:58:48 +00:00
Alan Somers
02419b46cf mount_fusefs.8: expand HISTORY section
Note that fuse was available from ports long before joining the base system.
Also, update the upstream URL.

MFC after:	2 weeks
2018-11-17 21:35:01 +00:00
Kirk McKusick
07436eeb49 Fix build break from dump incompatibility I introduced in -r340411
Pointy-hat to: mckusick
2018-11-14 00:21:52 +00:00
Gleb Smirnoff
d4f7db4764 Plug build break after r340411. 2018-11-13 23:44:27 +00:00
Kirk McKusick
9fc5d538fc In preparation for adding inode check-hashes, clean up and
document the libufs interface for fetching and storing inodes.
The undocumented getino / putino interface has been replaced
with a new getinode / putinode interface.

Convert the utilities that had been using the undocumented
interface to use the new documented interface.

No functional change (as for now the libufs library does not
do inode check-hashes).

Reviewed by:  kib
Tested by:    Peter Holm
Sponsored by: Netflix
2018-11-13 21:40:56 +00:00
Eugene Grosbein
d95e8d6474 Fix part of the SYNOPSIS documenting LIST OF RULES AND PREPROCESSING
that is still referred as last section of the SYNOPSIS later
but was erroneously situated in the section IN-KERNEL NAT.

MFC after:	1 month
2018-11-13 13:57:15 +00:00
Mariusz Zaborski
752d135e0d libcasper: ange the name of limits in cap_dns so the intentions are obvious.
Reported by:	pjd
MFC after:	3 weeks
2018-11-12 15:52:45 +00:00
Andrey V. Elsukov
b2b5660688 Add ability to use dynamic external prefix in ipfw_nptv6 module.
Now an interface name can be specified for nptv6 instance instead of
ext_prefix. The module will track if_addr_ext events and when suitable
IPv6 address will be added to specified interface, it will be configured
as external prefix. When address disappears instance becomes unusable,
i.e. it doesn't match any packets.

Reviewed by:	0mp (manpages)
Tested by:	Dries Michiels <driesm dot michiels gmail com>
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D17765
2018-11-12 11:20:59 +00:00
Kristof Provost
0f9e47a9c4 pfctl: Populate ifname in ifa_lookup()
pfctl_adjust_skip_ifaces() relies on this name.

MFC after:	2 weeks
2018-11-08 21:53:09 +00:00
Eugene Grosbein
6ff080c445 ipfw.8: fix small syntax error in an example
MFC after:	3 days
2018-11-08 13:17:38 +00:00
Eugene Grosbein
c0a3773ad2 ping(8): improve diagnostics in case of wrong arguments.
For example, in case of super-user:
$ sudo ping -s -64 127.0.0.1
PING 127.0.0.1 (127.0.0.1): -64 data bytes
ping: sendto: Invalid argument

For unprivileged user:
$ ping -s -64 127.0.0.1
ping: packet size too large: 18446744073709551552 > 56: Operation not permitted

Fix this by switching from strtoul() to strtol() for integer arguments
and adding explicit checks for negative values.

MFC after:	1 month
2018-11-08 09:45:13 +00:00
Andrey V. Elsukov
8f47ad010c Do not print "ip6" keyword in print_icmp6types() for O_ICMP6TYPE opcode.
It produces incompatibility when rules listing is used again to
restore saved ruleset, because "ip6" keyword produces separate opcode.
The kernel already has the check and only IPv6 packets will be checked
for matching.

PR:		232939
MFC after:	3 days
2018-11-06 07:41:32 +00:00
Mariusz Zaborski
d68e2c047b ping: simplify use of Casper
There is no need to check if capdns is NULL.
If we will build the system without casper all cap_gethostaddr will be
replaced by the standard functions.
2018-11-04 20:26:29 +00:00
Mariusz Zaborski
377421df96 capsicum: use a new capsicum helpers in tools
Use caph_{rights,ioctls,fcntls}_limit to simplify the code.
2018-11-04 19:24:49 +00:00
Eugene Grosbein
5a2b0b0daa ipfw(8): clarify layer2 processing abilities
Make it clear that ipfw action set for layer2 frames it a bit limited.

PR:			59835
Reviewed by:		yuripv
MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D17719
2018-11-04 06:35:48 +00:00
Andrey V. Elsukov
880d3c76b5 Do not use bzero() for the O_ICMP6TYPE opcode.
The buffer is already zeroed in compile_rule() function, and also it
may contain configured F_NOT flag in o.len field. This fixes the filling
for "not icmp6types" opcode.

PR:		232939
MFC after:	3 days
2018-11-03 20:05:50 +00:00
Warner Losh
1a658069d6 Further research shows usbdump(8) is what we should point people at
rather than tcpdump for usb traffic capture.
2018-11-02 22:18:02 +00:00
Warner Losh
43a9662438 Catch up with the SCSI device removal. We should likely review why we
even have this.
2018-11-02 22:15:47 +00:00
Warner Losh
7e4161c109 Document r226775: tell why we omit usbus[0-9]+
tcpdump can capture packet traces from the usb bus. usbus[0-9] are
registered as ifnet devices so this can work. When these devices come
up, devd was trying to run pccard_ether on those interfaces, which
didn't exist and generated an error.
2018-11-02 22:15:30 +00:00
Kirk McKusick
a3d27cad4d In preparation for adding inode check-hashes, convert the clri(8)
program to use the libufs library interface. No functional change
(as for now the libufs library does not do inode check-hashes).

Reviewed by:  kib
Sponsored by: Netflix
2018-11-01 03:38:57 +00:00
Kirk McKusick
2c288c95d9 In preparation for adding inode check-hashes, change the fsck_ffs
inodirty() function to have a pointer to the inode being dirtied.
No functional change (as for now the parameter is ununsed).

Sponsored by: Netflix
2018-10-31 05:17:53 +00:00
Bjoern A. Zeeb
201100c58b Initial implementation of draft-ietf-6man-ipv6only-flag.
This change defines the RA "6" (IPv6-Only) flag which routers
may advertise, kernel logic to check if all routers on a link
have the flag set and accordingly update a per-interface flag.

If all routers agree that it is an IPv6-only link, ether_output_frame(),
based on the interface flag, will filter out all ETHERTYPE_IP/ARP
frames, drop them, and return EAFNOSUPPORT to upper layers.

The change also updates ndp to show the "6" flag, ifconfig to
display the IPV6_ONLY nd6 flag if set, and rtadvd to allow
announcing the flag.

Further changes to tcpdump (contrib code) are availble and will
be upstreamed.

Tested the code (slightly earlier version) with 2 FreeBSD
IPv6 routers, a FreeBSD laptop on ethernet as well as wifi,
and with Win10 and OSX clients (which did not fall over with
the "6" flag set but not understood).

We may also want to (a) implement and RX filter, and (b) over
time enahnce user space to, say, stop dhclient from running
when the interface flag is set.  Also we might want to start
IPv6 before IPv4 in the future.

All the code is hidden under the EXPERIMENTAL option and not
compiled by default as the draft is a work-in-progress and
we cannot rely on the fact that IANA will assign the bits
as requested by the draft and hence they may change.

Dear 6man, you have running code.

Discussed with:	Bob Hinden, Brian E Carpenter
2018-10-30 20:08:48 +00:00
Kristof Provost
c964e17bfe pfctl test: Add a test for macro names with a space in it 2018-10-28 05:50:04 +00:00
Kristof Provost
d3f6532494 pfctl: Do not allow whitespace in macro names
i.e. "this is" = "a variable" is not valid. It was accepted by the
parser, but the variable could not be used afterwards.

Obtained from:	OpenBSD
2018-10-28 05:41:13 +00:00
Kristof Provost
99eb00558a pf: Make ':0' ignore link-local v6 addresses too
When users mark an interface to not use aliases they likely also don't
want to use the link-local v6 address there.

PR:		201695
Submitted by:	Russell Yount <Russell.Yount AT gmail.com>
Differential Revision:	https://reviews.freebsd.org/D17633
2018-10-28 05:32:50 +00:00
Eugene Grosbein
b25a469f94 rcorder(8): add support for /etc/rc.resume, so it calls "rcorder -k resume"
and runs scripts containing "KEYWORD: resume" with single "resume" argument.

Working example is the port sysutils/cpupdate that defines
extra_commands="resume" to reload CPU microcode cleared
by suspend/resume sequence.

This change does nothing for a system having no scripts with KEYWORD: resume.

MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D15247
2018-10-27 17:21:13 +00:00
Eugene Grosbein
a9dea3d2ba mount_msdosfs: do not fail mounts requiring locale name conversion table
that is already present in a kernel statically.

For example, the command "mount_msdosfs -L ru_RU.KOI8-R" fails with error
"mount_msdosfs: msdosfs_iconv: File exists" for a kernel having
options LIBICONV and MSDOSFS_ICONV. After this change, it mounts successfully.

MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D16951
2018-10-27 16:41:34 +00:00
Eugene Grosbein
2814116849 route(8): correctly return exit status when "-q" flag is used.
Previously, route returned 1 in case of error  properly signalling failure
but "route -q" it returned 0 for same case. Fix it.

PR:		186333
MFC after:	1 month
2018-10-27 07:59:19 +00:00
Conrad Meyer
0fb8835bcf dumpon.8: Significantly revamp page
Start with a short summary and cover the options in a standard list style.

Organize sections by common focus and prioritize more useful information
closer to the top.

Flesh out authors, history, caveats, and security considerations sections.

Reviewed by:	markj, eadler (previous version)
Differential Revision:	https://reviews.freebsd.org/D17679
2018-10-26 20:03:59 +00:00
Conrad Meyer
f27d255c59 dumpon(8): Provide seatbelt against weak RSA keys
The premise of dumpon -k foo.pem is that dump contents will be confidential
except to anyone holding the corresponding RSA private key.

This guarantee breaks down when weak RSA keys are used.  Small RSA keys
(e.g. 512 bits) can be broken on a single personal computer in tractible
time.  Marginal RSA keys (768 bits) can be broken by EC2 and a few dollars.
Even 1024 bit keys can probably be broken by sophisticated and wealthy
attackers.

NIST SP800-57 (2016) recommends a minimum of 2048 bit RSA keys, and
estimates this provides 112 bits of security.

It would also be good to protect users from weak values of 'e' (i.e., 3) and
perhaps sanity check that their public key .pem does not accidentally
contain their private key as well.  These considerations are left as future
work.

Reviewed by:	markj, darius AT dons.net.au (previous version)
Discussed with:	bjk
Differential Revision:	https://reviews.freebsd.org/D17678
2018-10-26 19:53:59 +00:00
Andrey V. Elsukov
427dc1f755 Use correct format specificator to print setdscp action.
PR:		232642
MFC after:	3 days
2018-10-25 18:06:23 +00:00
Rodney W. Grimes
554e6a7563 Allow fdisk(8) to deal with sectors larger than 2048
especially for 4Kn drives with PMBR's

Approved by:    bde (mentor)
MFC:            3 days
2018-10-25 12:13:13 +00:00