aboutsummaryrefslogtreecommitdiff
path: root/sbin
Commit message (Collapse)AuthorAgeFilesLines
* Add checks for received mode page length.Alexander Motin2017-01-101-3/+6
| | | | | | | | | | | | If our buffer is too small, we may receive part of the page, and should not try read/write past the end of the buffer. Reported by: Coverity CID: 1368374, 1368375 MFC after: 1 week Notes: svn path=/head/; revision=311897
* Add skein(3) front ends to the md5 manpageAllan Jude2017-01-071-9/+28
| | | | | | | Reported by: emaste Notes: svn path=/head/; revision=311656
* Make 'camcontrol modepage' support subpages.Alexander Motin2017-01-074-139/+187
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=311636
* Make do_buff_decode() not read past the end of the buffer.Alexander Motin2017-01-071-1/+8
| | | | | | | | | Abort format processing as soon as we have no enough data. MFC after: 2 weeks Notes: svn path=/head/; revision=311623
* [ifconfig] add initial VHT (802.11ac) configuration and channel support to ↵Adrian Chadd2017-01-071-4/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ifconfig. This is very preliminary and mostly enough for me (with other patches) to work on VHT support. It adds: * VHT20, VHT40 and VHT80 regulatory/band awareness * VHT20, VHT40 and VHT80 channel configuration / population * Parses vht channel specifications (eg ifconfig wlan0 create wlandev athp0 wlanmode monitor channel 36:vht/80) * Configuration of VHT, VHT40, VHT80, VHT80+80, VHT160 channel width (IEEE80211_FVHT_VHT* flags in net80211) TODO: * No VHT80+80 or VHT160 channels yet - I don't yet have hardware, and I'm not yet sure how to support/populate VHT80+80 channels. * No, I won't update the manpage until this is "more done", lest someone tries using vht and gets upset with me. * No, I won't commit the regulatory database I'm testing with, so you'll just end up with no VHT channels ever populated. Which is good, as there isn't an 11ac driver in-tree yet to try it with. Notes: svn path=/head/; revision=311579
* Fix clang 4.0.0 warnings about taking the address of a packed member ofDimitry Andric2017-01-061-2/+5
| | | | | | | | | | | | | | | | | | | | struct ip in ping(8): sbin/ping/ping.c:1684:53: error: taking address of packed member 'ip_src' of class or structure 'ip' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] (void)printf(" %s ", inet_ntoa(*(struct in_addr *)&ip->ip_src.s_addr)); ^~~~~~~~~~~~~~~~~ sbin/ping/ping.c:1685:53: error: taking address of packed member 'ip_dst' of class or structure 'ip' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] (void)printf(" %s ", inet_ntoa(*(struct in_addr *)&ip->ip_dst.s_addr)); ^~~~~~~~~~~~~~~~~ MFC after: 3 days Notes: svn path=/head/; revision=311530
* Use type-independent formats for printing nlink_t and ino_t.Konstantin Belousov2017-01-061-22/+32
| | | | | | | | | | Extracted from: ino64 work by gleb, mckusick Discussed with: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=311522
* Remove dead code in dhclient(8)Alan Somers2017-01-041-6/+2
| | | | | | | | | | | | | The offending code has been dead ever since the import from OpenBSD in r195805. OpenBSD later deleted that entire function. Reported by: Coverity CID: 500059 MFC after: 4 weeks Sponsored by: Spectra Logic Corp Notes: svn path=/head/; revision=311298
* sysctl(8): fix typename for uint32_t.Andriy Voskoboinyk2016-12-311-1/+1
| | | | | | | MFC after: 5 days. Notes: svn path=/head/; revision=310961
* Fix a bug in r272840; given that the optlen parameter of setsockopt(2)Marius Strobl2016-12-282-4/+6
| | | | | | | | | | | | | | | is a 32-bit socklen_t, do_get3() passes the kernel to access the wrong 32-bit half on big-endian LP64 machines when simply casting the 64-bit size_t optlen to a socklen_t pointer. While at it and given that the intention of do_get3() apparently is to hide/wrap the fact that socket options are used for communication with ipfw(4), change the optlen parameter of do_set3() to be of type size_t and as such more appropriate than uintptr_t, too. MFC after: 3 days Notes: svn path=/head/; revision=310727
* Fix the parsing of NPt binat rules.Luiz Otavio O Souza2016-12-281-1/+1
| | | | | | | | | | | | | | In this specific case the src address can be set to any, which was not accepted prior to this commit. pfSense bug report: https://redmine.pfsense.org/issues/6985 Reviewed by: kp Obtained from: pfSense MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=310707
* Convert tunefs use to nmount(2)Brooks Davis2016-12-222-5/+19
| | | | | | | | | Reviewed by: jhb, emaste Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8822 Notes: svn path=/head/; revision=310382
* Add a free_iovec() function to reset iovec's.Brooks Davis2016-12-142-0/+15
| | | | | | | | | | | | | The primary purpose is to call nmount() in a loop with new iovec's so free_iovec takes arguments by reference and resets their values. Reviewed by: cem MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513 Notes: svn path=/head/; revision=310092
* ifconfig: do not truncate SSID in verbose mode.Andriy Voskoboinyk2016-12-141-1/+1
| | | | | | | | | | | Fix 32-character SSID abbreviation for 'ifconfig -v wlan0 scan' command. PR: 215301 Submitted by: <ms-freebsd-bugzilla@stoffnet.at> MFC after: 4 days Notes: svn path=/head/; revision=310089
* Language and mdoc cleanup.Christian Brueffer2016-12-131-10/+8
| | | | Notes: svn path=/head/; revision=310026
* Cut to the chase and just call free instead of free(x) + x = NULLEnji Cooper2016-12-101-10/+3
| | | | | | | | | | | NULLing out x wasn't required as the memory was immediately scribbled over with strdup in the following call. MFC after: 1 week Submitted by: imp Notes: svn path=/head/; revision=309840
* free/NULL out variables prior to calling strdup to avoid leaking memoryEnji Cooper2016-12-101-0/+10
| | | | | | | | | | if arguments are specified more than once with "camcontrol timestamp". CID: 1366829, 1366831 MFC after: 1 week Notes: svn path=/head/; revision=309839
* Add support for encrypted kernel crash dumps.Konrad Witaszczyk2016-12-109-25/+812
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes include modifications in kernel crash dump routines, dumpon(8) and savecore(8). A new tool called decryptcore(8) was added. A new DIOCSKERNELDUMP I/O control was added to send a kernel crash dump configuration in the diocskerneldump_arg structure to the kernel. The old DIOCSKERNELDUMP I/O control was renamed to DIOCSKERNELDUMP_FREEBSD11 for backward ABI compatibility. dumpon(8) generates an one-time random symmetric key and encrypts it using an RSA public key in capability mode. Currently only AES-256-CBC is supported but EKCD was designed to implement support for other algorithms in the future. The public key is chosen using the -k flag. The dumpon rc(8) script can do this automatically during startup using the dumppubkey rc.conf(5) variable. Once the keys are calculated dumpon sends them to the kernel via DIOCSKERNELDUMP I/O control. When the kernel receives the DIOCSKERNELDUMP I/O control it generates a random IV and sets up the key schedule for the specified algorithm. Each time the kernel tries to write a crash dump to the dump device, the IV is replaced by a SHA-256 hash of the previous value. This is intended to make a possible differential cryptanalysis harder since it is possible to write multiple crash dumps without reboot by repeating the following commands: # sysctl debug.kdb.enter=1 db> call doadump(0) db> continue # savecore A kernel dump key consists of an algorithm identifier, an IV and an encrypted symmetric key. The kernel dump key size is included in a kernel dump header. The size is an unsigned 32-bit integer and it is aligned to a block size. The header structure has 512 bytes to match the block size so it was required to make a panic string 4 bytes shorter to add a new field to the header structure. If the kernel dump key size in the header is nonzero it is assumed that the kernel dump key is placed after the first header on the dump device and the core dump is encrypted. Separate functions were implemented to write the kernel dump header and the kernel dump key as they need to be unencrypted. The dump_write function encrypts data if the kernel was compiled with the EKCD option. Encrypted kernel textdumps are not supported due to the way they are constructed which makes it impossible to use the CBC mode for encryption. It should be also noted that textdumps don't contain sensitive data by design as a user decides what information should be dumped. savecore(8) writes the kernel dump key to a key.# file if its size in the header is nonzero. # is the number of the current core dump. decryptcore(8) decrypts the core dump using a private RSA key and the kernel dump key. This is performed by a child process in capability mode. If the decryption was not successful the parent process removes a partially decrypted core dump. Description on how to encrypt crash dumps was added to the decryptcore(8), dumpon(8), rc.conf(5) and savecore(8) manual pages. EKCD was tested on amd64 using bhyve and i386, mipsel and sparc64 using QEMU. The feature still has to be tested on arm and arm64 as it wasn't possible to run FreeBSD due to the problems with QEMU emulation and lack of hardware. Designed by: def, pjd Reviewed by: cem, oshogbo, pjd Partial review: delphij, emaste, jhb, kib Approved by: pjd (mentor) Differential Revision: https://reviews.freebsd.org/D4712 Notes: svn path=/head/; revision=309818
* Implement Intel's log page 0xc1 (Read Command Latency Log) and pageWarner Losh2016-12-091-2/+47
| | | | | | | | | 0xc1 (Write Command Latency Log). Sponsored By: Netflix, Inc Notes: svn path=/head/; revision=309777
* Fix TypoWarner Losh2016-12-071-1/+1
| | | | Notes: svn path=/head/; revision=309684
* Add rcorder-visualize.sh, which generates graphviz from rc.d scriptsEric van Gyzen2016-12-061-0/+52
| | | | | | | | | | | | | | | This is imported from NetBSD. The author--Joerg Sonnenberger--agreed to apply a two-clause BSD license, just so the license was clear. This source tree location matches NetBSD, and is the first place someone might look for such a tool. Obtained from: Joerg Sonnenberger via NetBSD MFC after: 3 days Sponsored by: Dell EMC Notes: svn path=/head/; revision=309625
* [camcontrol] init ts=0 to quieten gcc.Adrian Chadd2016-12-031-1/+1
| | | | | | | | | | It "looks" like ts is set to something on success, and not modified on error. Checked on IRC with: cem Notes: svn path=/head/; revision=309513
* Flag the vendor specific pages as such. This allows different decodingWarner Losh2016-12-021-20/+27
| | | | | | | | for the same page number as different vendors encode vendor specific pages differently. Notes: svn path=/head/; revision=309413
* Add SCSI REPORT TIMESTAMP and SET TIMESTAMP support.Kenneth D. Merry2016-12-015-3/+586
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support to camcontrol(8) and libcam(3) for getting and setting the time on SCSI protocol drives. This is more commonly found on tape drives, but is a SPC (SCSI Primary Commands) command, and may be found on any device that speaks SCSI. The new camcontrol timestamp subcommand allows getting the current device time or setting the time to the current system time or any arbitrary time. sbin/camcontrol/Makefile: Add timestamp.c. sbin/camcontrol/camcontrol.8: Document the new timestamp subcommand. sbin/camcontrol/camcontrol.c: Add the timestamp subcommand to camcontrol. sbin/camcontrol/camcontrol.h: Add the timestamp() function prototype. sbin/camcontrol/timestamp.c: Timestamp setting and reporting functionality. sys/cam/scsi/scsi_all.c: Add two new CCB building functions, scsi_set_timestamp() and scsi_report_timestamp(). Also, add a new helper function, scsi_create_timestamp(). sys/cam/scsi/scsi_all.h: Add CDB and parameter data for the the set and report timestamp commands. Add function declarations for the new CCB building and helper functions. Submitted by: Sam Klopsch Sponsored by: Spectra Logic MFC After: 2 weeks Notes: svn path=/head/; revision=309374
* Simplify test.Warner Losh2016-12-011-1/+1
| | | | Notes: svn path=/head/; revision=309349
* Add `gmirror create` subcommand, alike to gstripe, gconcat, etc.Alexander Motin2016-11-302-1/+24
| | | | | | | | | | | | It is quite specific mode of operation without storing on-disk metadata. It can be useful in some cases in combination with some external control tools handling mirror creation and disks hot-plug. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=309321
* Fix 'ipfw delete set N':Oleg Bulyzhin2016-11-291-1/+1
| | | | | | | | | do not emit meaningless 'rule 0 not found' warning if set was already empty. MFC after: 1 week Notes: svn path=/head/; revision=309281
* Allocate a struct ifreq rather than using a (wrong) computed size forBrooks Davis2016-11-221-2/+2
| | | | | | | | | | | | | | | | | | | | the BIOCSETIF ioctl. The kernel always copies an entire struct ifreq and IPv4 addresses will always fit in an ifreq. On systems with pointers larger than 64-bits, the computed size will be less than the size of struct ifreq, potentially resulting in the kernel attempting to copyin memory from outside the allocation. Reviewed by: jhb Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8445 Notes: svn path=/head/; revision=309027
* Modify umount so that it does not do an Unmount RPC for NFSv4 mountsRick Macklem2016-11-191-2/+22
| | | | | | | | | | | | | and uses TCP for the Unmount RPC if the mount is over TCP. Without this patch, umount does an Unmount RPC over UDP for all NFS mounts. Suggested by: cperciva Reviewed by: cperciva MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D8503 Notes: svn path=/head/; revision=308871
* i386 turns out to not have __uint128_t. So confusingly use 64-bit mathWarner Losh2016-11-191-1/+9
| | | | | | | | | | | | | | instead. Since we're little endian, we can get away with it. Also, since the counters in quesitons would require billions of iops for tens of billions of seconds to overflow, and since such data rates are unlikely for people using i386 for a while, that's OK. The fastest cards today can't do even a million IOPs. Noticed by: dim@ Sponsored by: Netflix, Inc Notes: svn path=/head/; revision=308869
* Decode the Intel-specific Additional SMART data page (0xca) and printWarner Losh2016-11-191-1/+80
| | | | | | | | | | | | | | it in human readable form. Include a pointer to the public spec that was followed to implement this in the code. Samsung also implements page 0xca on some of their drives, but the format is slighly different, so the code skips printing zero keys. Samsung's log page has additional, unknown data after the end of Intel defined data which isn't displayed. Supported by: Netfix, Inc Notes: svn path=/head/; revision=308856
* Implement HGST Log page 0xc1, as documented in the HGST SN100 andWarner Losh2016-11-191-0/+420
| | | | | | | | | SN150 product manuals. Subpage 0x32 is documented, but not implemented. Sponsored by: Netflix, Inc Notes: svn path=/head/; revision=308855
* Print Intel's expanded Temperature log page.Warner Losh2016-11-191-1/+32
| | | | | | | Sponsored by: Netflix, Inc Notes: svn path=/head/; revision=308854
* Expand the SMART / Health Information Log Page (Page 02) printoutWarner Losh2016-11-191-6/+21
| | | | | | | | | based on NVM Express 1.2.1 Standard. Sponsored by: Netflix, Inc Notes: svn path=/head/; revision=308851
* Print numbers instead of hex values for smart data. The full 128-bitWarner Losh2016-11-191-34/+58
| | | | | | | | | | number is printed, even though you'd need like a billion IOPs for a 10 billion seconds to overflow the 64-bit counters (~300 years). Sponsored by: Netflix, Inc Notes: svn path=/head/; revision=308850
* Use a table for pages we know the size of. We have a special case forWarner Losh2016-11-191-19/+15
| | | | | | | | | the error log since it isn't a fixed size. Sponsored by: Netflix, Inc Notes: svn path=/head/; revision=308849
* Remove check for valid log pages. Let the drive tell us which pagesWarner Losh2016-11-191-8/+0
| | | | | | | | | | | are valid or not. While many pages are reserved in the standard, that doesn't make them invalid and future versions of the standard may define then. Sponsored by: Netflix, Inc Notes: svn path=/head/; revision=308848
* [ifconfig] remove now duplicate IEEE80211_C_BITS definition; it's now in ↵Adrian Chadd2016-11-181-6/+0
| | | | | | | | | | _ieee80211.h . Reviewed by: avos Differential Revision: https://reviews.freebsd.org/D8553 Notes: svn path=/head/; revision=308812
* Zero etherswitch_vlangroup structure before doing partial assignments.Luiz Otavio O Souza2016-11-171-2/+4
| | | | | | | | MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=308775
* Add missing support of named lookup tables to the IPv6 code.Andrey V. Elsukov2016-11-153-25/+20
| | | | | | | | | PR: 214419 MFC after: 1 week Sponsored by: Yandex LLC Notes: svn path=/head/; revision=308673
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2016-11-131-0/+1
| | | | | | | | MFC after: 2 weeks Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=308606
* DIRDEPS_BUILD: Connect new dependencies.Bryan Drewery2016-11-131-0/+32
| | | | | | | | MFC after: 2 weeks Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=308605
* pfctl: fix nested inline anchorsKristof Provost2016-11-101-1/+1
| | | | | | | | | | | Import the OpenBSD fix for nested inline anchors. PR: 196314 Submitted by: krichy@cflinux.hu Obtained from: OpenBSD Notes: svn path=/head/; revision=308486
* Fix improper use of "its".Bryan Drewery2016-11-081-2/+2
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=308457
* Remove MATCHOUI macro, unused since r197980.Gavin Atkinson2016-11-011-6/+0
| | | | Notes: svn path=/head/; revision=308182
* Fix alignment issues on MIPS: align the pointers properly.Ruslan Bukin2016-10-311-1/+1
| | | | | | | | | | | All the 5520 GEOM_ELI tests passed successfully on MIPS64EB. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D7905 Notes: svn path=/head/; revision=308137
* zfsbootcfg: a simple tool to set next boot (one time) options for zfsbootAndriy Gapon2016-10-294-0/+238
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (gpt)zfsboot will read one-time boot directives from a special ZFS pool area. The area was previously described as "Boot Block Header", but currently it is know as Pad2, marked as reserved and is zeroed out on pool creation. The new code interprets data in this area, if any, using the same format as boot.config. The area is immediately wiped out. Failure to parse the directives results in a reboot right after the cleanup. Otherwise the boot sequence proceeds as usual. zfsbootcfg writes zfsboot arguments specified on its command line to the Pad2 area of a disk identified by vfs.zfs.boot.primary_pool and vfs.zfs.boot.primary_vdev kenv variables that are set by loader during boot. Please see the manual page for more. Thanks to all who reviewed, contributed and made suggestions! There are many potential improvements to the feature, please see the review for details. Reviewed by: wblock (docs) Discussed with: jhb, tsoome MFC after: 3 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D7612 Notes: svn path=/head/; revision=308089
* swapoff: Remove only late devices with -aL.Jilles Tjoelker2016-10-212-1/+11
| | | | | | | | | | | | | | | | | | | | | Currently, '/etc/rc.d/swaplate stop' removes all swap devices. This can be very slow and may not even be possible if there is a lot of swap space in use. However, removing swap devices is only needed for late swap devices that may depend on daemons that subsequent shutdown steps stop. Normal swap devices such as hard disk partitions will remain available throughout the shutdown process and need not be removed. In swapoff, interpret -aL to remove late swap devices only, and use this in etc/rc.d/swaplate. The meaning of -aL in swapon remains unchanged (add all swap devices, both normal and late). PR: 187081 Reviewed by: wblock (man page only), ngie MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8126 Notes: svn path=/head/; revision=307755
* Fix a problem in camcontrol(8) that cropped up with r307684.Kenneth D. Merry2016-10-211-54/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In r307684, I changed rescan_or_reset_bus() to bzero stack-allocated CCBs before sending them to the kernel because there was stack garbage in there that wound up meaning that bogus CCB flags were set. While this fixed the 'camcontrol rescan all' case (XPT_DEV_MATCH CCBs were failing previously), it broke the 'camcontrol rescan 0' (or any other number) case when INVARIANTS are turned on. Rescanning a single bus reliably produced an assert in cam_periph_runccb(): panic: cam_periph_runccb: ccb=0xfffff80044ffe000, func_code=0x708, flags=0xffffdde0 The flags values don't make sense from the code. Changing the CCBs in rescan_or_reset_bus() from stack to heap allocated avoids the problem. It would be better to understand why userland stack allocated CCBs don't work properly, since there may be other code that breaks if stack allocated CCBs don't work. sbin/camcontrol/camcontrol.c: In rescan_or_reset_bus(), allocate the CCBs using malloc(3) instead of on the stack to avoid an assertion in cam_periph_runccb(). MFC after: 3 days Sponsored by: Spectra Logic Notes: svn path=/head/; revision=307747
* For CCBs allocated on the stack, we need to clear the entire CCB, not justKenneth D. Merry2016-10-201-1/+3
| | | | | | | | | | | | | | | | | the header. Otherwise stack garbage can lead to random flags getting set. This showed up as 'camcontrol rescan all' failing with EINVAL because the address type wasn't CAM_DATA_VADDR. sbin/camcontrol/camcontrol.c: In rescan_or_reset_bus(), bzero the stack-allocated CCBs before use instead of clearing the body. MFC after: 3 days Sponsored by: Spectra Logic Notes: svn path=/head/; revision=307684