aboutsummaryrefslogtreecommitdiff
path: root/sbin
Commit message (Collapse)AuthorAgeFilesLines
* Simplify ping sandbox.Mariusz Zaborski2017-10-281-20/+0
| | | | | | | | | | We don't need to check if casper is present, this is done in the library itself. Reviewed by: emaste, cem, ed Differential Revision: https://reviews.freebsd.org/D8754 Notes: svn path=/head/; revision=325064
* Implement power cycle in init.Warner Losh2017-10-252-3/+5
| | | | | | | | | If SIGWINCH is received, then halt with power cycle. Sponsored by: Netflix Notes: svn path=/head/; revision=324987
* Add power cycle support to reboot/halt as -c.Warner Losh2017-10-252-4/+30
| | | | | | | | | | | When -c is specified, the system will be power cycled if the underlying hardware supports it. Otherwise the system will be halted or rebooted depending on which command was used. Sponsored by: Netflix Notes: svn path=/head/; revision=324986
* Add power cycle support (-c) to shutdown.Warner Losh2017-10-252-11/+35
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=324985
* Report only the valid slots in the firmware log page.Warner Losh2017-10-251-2/+7
| | | | | | | | | | | | Printing the entire log page is causing confusion over available slots. Report only those slots that are valid. In the case where the firmware download isn't supported, assume that only the first slot is valid (I have no hardware to test this assumption though) Sponsored by: Netflix Notes: svn path=/head/; revision=324978
* Add nvme_controller_data argument to all print functions.Warner Losh2017-10-251-15/+23
| | | | | | | | | | It's desirable to access controler data to inform printing log pages (such as limiting the printing to valid ranges). Sponsored by: Netflix Notes: svn path=/head/; revision=324977
* Add support for compressed kernel dumps.Mark Johnston2017-10-254-25/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using a kernel built with the GZIO config option, dumpon -z can be used to configure gzip compression using the in-kernel copy of zlib. This is useful on systems with large amounts of RAM, which require a correspondingly large dump device. Recovery of compressed dumps is also faster since fewer bytes need to be copied from the dump device. Because we have no way of knowing the final size of a compressed dump until it is written, the kernel will always attempt to dump when compression is configured, regardless of the dump device size. If the dump is aborted because we run out of space, an error is reported on the console. savecore(8) is modified to handle compressed dumps and save them to vmcore.<index>.gz, as it does when given the -z option. A new rc.conf variable, dumpon_flags, is added. Its value is added to the boot-time dumpon(8) invocation that occurs when a dump device is configured in rc.conf. Reviewed by: cem (earlier version) Discussed with: def, rgrimes Relnotes: yes Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11723 Notes: svn path=/head/; revision=324965
* Return 'errno' value from the table_do_modify_record(), it is expectedAndrey V. Elsukov2017-10-131-0/+2
| | | | | | | | | | | | by table_modify_record(). This makes quiet operations with tables really quiet. PR: 222953 MFC after: 1 week Notes: svn path=/head/; revision=324592
* growfs: ANSIfy cgckhash()Ed Maste2017-10-101-2/+1
| | | | | | | | | | | | The build was broken on GCC-using architectures with: growfs.c: In function 'cgckhash': growfs.c:1753: warning: old-style function definition Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=324507
* Growfs got missed in r323923 that added a check hash to cylinder groups.Kirk McKusick2017-10-102-1/+19
| | | | | | | | | | | | This makes the needed changes to add/update cylinder group check hashes when a filesystem is expanded. Reported by: kib and Warner Losh (imp) Reviewed by: kib Tested by: Peter Holm (pho) Notes: svn path=/head/; revision=324499
* Check the exit code from fsck_ffs instead of relying on MODIFIED being in ↵Enji Cooper2017-10-101-9/+21
| | | | | | | | | | | | | | | | | | | the output ^/head@r323923 changed when MODIFIED is printed at exit. It's better to follow the documented way of determining whether or not a filesystem is clean per fsck_ffs, i.e., ensure that the exit code is either 0 or 7. The pass/fail determination is brittle prior to this commit, and ^/head@r323923 made the issue apparent -- thus this needs to be fixed independent of ^/head@r323923. PR: 222780 MFC after: 1 week MFC with: r323923 Reported by: Jenkins Notes: svn path=/head/; revision=324478
* Do not report the filesystem as modified when the only change is toKirk McKusick2017-10-091-1/+7
| | | | | | | | | | update the timestamp in the superblock. Reported by: Peter Holm MFC after: 1 week Notes: svn path=/head/; revision=324456
* Fix alignment of 'last' in autofill.Marcel Moolenaar2017-10-061-1/+1
| | | | | | | | | | | | | | 'last' is the sector number of the last usable sector. Sector numbers start with 0. As such, 'last' is always 1 less than the count of sectors and aligning 'last' down as-is means that the number of free sectors is pessimized by 'alignment - 1' if the number of usable sectors was already a multiple of the alignment. Consequently, gpart(8) failed to create a partition when the alignment and size were such that it would extend to the end of the disk. Notes: svn path=/head/; revision=324369
* Correct sense of crypt(3) NULL checks in init(8) and lock(1)Conrad Meyer2017-10-031-1/+1
| | | | | | | | | | | | | | | | | | In r231994, an attempt was made to fix crypt(3) failure returns (NULL). However, instead of treating crypt(3) failure as authentication failure, some of the changes treated crypt(3) failure as authentication success. This is wrong. r324225 fixed this for ppp, which also inspired this review. The other changes in the 231994 revision were audited for correctness and look ok. Reviewed by: jhb Security: yes Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12571 Notes: svn path=/head/; revision=324229
* Whitespace changes: Remove leading spaces followed by a tab.Michael Tuexen2017-10-021-7/+7
| | | | Notes: svn path=/head/; revision=324218
* Fix a bug which avoided that rules for matching port numbers for SCTPMichael Tuexen2017-10-021-3/+3
| | | | | | | | | | | packets where actually matched. While there, make clean in the man-page that SCTP port numbers are supported in rules. MFC after: 1 month Notes: svn path=/head/; revision=324216
* Initialize mdsize to make gcc happy again. This fixes buildworld on powerpc.Andreas Tobler2017-09-301-0/+1
| | | | | | | Reviewed by: ian@ Notes: svn path=/head/; revision=324125
* Enhance mdmfs(8) to work with tmpfs(5).Ian Lepore2017-09-292-50/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Existing scripts and associated config such as rc.initdiskless, rc.d/var, and others, use mdmfs to create memory filesystems. That program accepts a size argument which allows SI suffixes and treats an unsuffixed number as a count of 512 byte sectors. That makes it difficult to convert existing scripts to use tmpfs instead of mdmfs, because tmpfs treats unsuffixed numbers as a count of bytes. The script logic to deal with existing user config that might include suffixed and unsuffixed numbers is... unpleasant. Also, there is no g'tee that tmpfs will be available. It is sometimes configured out of small-resource embedded systems to save memory and flash storage space. These changes enhance mdmfs(8) so that it accepts two new values for the 'md-device' arg: 'tmpfs' and 'auto'. With tmpfs, the program always uses tmpfs(5) (and fails if it's not available). With 'auto' the program prefers tmpfs, but falls back to using md(4) if tmpfs isn't available. It also handles the -s <size> argument so that the mdconfig interpetation of unsuffixed numbers applies when tmpfs is used as well, so that existing user config keeps working after a switch to tmpfs. A new rc setting, mfs_type, is added to etc/defaults/rc.conf to let users force the use of tmpfs or md; the default value is "auto". Differential Revision: https://reviews.freebsd.org/D12301 Notes: svn path=/head/; revision=324107
* Continuing efforts to provide hardening of FFS, this change adds aKirk McKusick2017-09-225-1/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | check hash to cylinder groups. If a check hash fails when a cylinder group is read, no further allocations are attempted in that cylinder group until it has been fixed by fsck. This avoids a class of filesystem panics related to corrupted cylinder group maps. The hash is done using crc32c. Check hases are added only to UFS2 and not to UFS1 as UFS1 is primarily used in embedded systems with small memories and low-powered processors which need as light-weight a filesystem as possible. Specifics of the changes: sys/sys/buf.h: Add BX_FSPRIV to reserve a set of eight b_xflags that may be used by individual filesystems for their own purpose. Their specific definitions are found in the header files for each filesystem that uses them. Also add fields to struct buf as noted below. sys/kern/vfs_bio.c: It is only necessary to compute a check hash for a cylinder group when it is actually read from disk. When calling bread, you do not know whether the buffer was found in the cache or read. So a new flag (GB_CKHASH) and a pointer to a function to perform the hash has been added to breadn_flags to say that the function should be called to calculate a hash if the data has been read. The check hash is placed in b_ckhash and the B_CKHASH flag is set to indicate that a read was done and a check hash calculated. Though a rather elaborate mechanism, it should also work for check hashing other metadata in the future. A kernel internal API change was to change breada into a static fucntion and add flags and a function pointer to a check-hash function. sys/ufs/ffs/fs.h: Add flags for types of check hashes; stored in a new word in the superblock. Define corresponding BX_ flags for the different types of check hashes. Add a check hash word in the cylinder group. sys/ufs/ffs/ffs_alloc.c: In ffs_getcg do the dance with breadn_flags to get a check hash and if one is provided, check it. sys/ufs/ffs/ffs_vfsops.c: Copy across the BX_FFSTYPES flags in background writes. Update the check hash when writing out buffers that need them. sys/ufs/ffs/ffs_snapshot.c: Recompute check hash when updating snapshot cylinder groups. sys/libkern/crc32.c: lib/libufs/Makefile: lib/libufs/libufs.h: lib/libufs/cgroup.c: Include libkern/crc32.c in libufs and use it to compute check hashes when updating cylinder groups. Four utilities are affected: sbin/newfs/mkfs.c: Add the check hashes when building the cylinder groups. sbin/fsck_ffs/fsck.h: sbin/fsck_ffs/fsutil.c: Verify and update check hashes when checking and writing cylinder groups. sbin/fsck_ffs/pass5.c: Offer to add check hashes to existing filesystems. Precompute check hashes when rebuilding cylinder group (although this will be done when it is written in fsutil.c it is necessary to do it early before comparing with the old cylinder group) sbin/dumpfs/dumpfs.c Print out the new check hash flag(s) sbin/fsdb/Makefile: Needs to add libufs now used by pass5.c imported from fsck_ffs. Reviewed by: kib Tested by: Peter Holm (pho) Notes: svn path=/head/; revision=323923
* Use UFS_LINK_MAX instead of LINK_MAX.John Baldwin2017-09-211-1/+1
| | | | | | | | Submitted by: bde Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=323881
* We use a few different ifdef's names to check if we are using Casper or not,Mariusz Zaborski2017-09-212-12/+12
| | | | | | | | | | let's standardize this. Now we are always use WITH_CASPER name. Discussed with: emaste@ MFC after: 1 month Notes: svn path=/head/; revision=323866
* Provide an articulate example of how to properly delete partitions andAlexey Dokuchaev2017-09-191-1/+24
| | | | | | | | | | | | | | | | partitioning scheme. Users often get confused and frustrated when trying to delete partition table and getting ``Device busy'' error because they forgot (or did not ever know that they have) to delete all its partitions first, and while the manual page mentions this briefly, it does not stress it out enough. Approved by: ae, manpages (bjk) PR (as inspiration): 196102 Differential Revision: https://reviews.freebsd.org/D12336 Notes: svn path=/head/; revision=323764
* Fix language used in the r322923.Mariusz Zaborski2017-09-171-7/+12
| | | | | | | | | Pointed out by: wblock@ MFC after: 1 week X-MFC-with: r322923 Notes: svn path=/head/; revision=323671
* kern.osreldate is an integer, not a stringAllan Jude2017-09-161-1/+1
| | | | | | | | | PR: 217501 Submitted by: Yavuz Tanriverdi <stemix@gmail.com> MFC after: 1 week Notes: svn path=/head/; revision=323645
* geom_virstor: Remove wholly unnecessary g_metadata_store copyConrad Meyer2017-09-081-57/+1
| | | | | | | | | Just code cleanup. No functional change. Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=323315
* Audit userspace geom code for leaking memory to diskConrad Meyer2017-09-082-0/+2
| | | | | | | | | | | | | | | | | | Any geom class using g_metadata_store, as well as geom_virstor which duplicated g_metadata_store internally, would dump sectorsize - mdsize bytes of userspace memory following the metadata block stored. This is most or all geom classes (gcache, gconcat, geli, gjournal, glabel, gmirror, gmultipath, graid3, gshsec, gstripe, and geom_virstor). PR: 222077 (comment #3) Reported by: Maxim Khitrov <max AT mxcrypt.com> Reviewed by: des Security: yes Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12269 Notes: svn path=/head/; revision=323314
* The new fsck recovery information to enable it to find backupKirk McKusick2017-09-042-38/+83
| | | | | | | | | | | | | | | | superblocks created in revision 322297 only works on disks with sector sizes up to 4K. This update allows the recovery information to be created by newfs and used by fsck on disks with sector sizes up to 64K. Note that FFS currently limits filesystem to be mounted from disks with up to 8K sectors. Expanding this limitation will be the subject of another commit. Reported by: Peter Holm Reviewed with: kib Notes: svn path=/head/; revision=323157
* Print the controller's ID in identify.Warner Losh2017-08-281-1/+2
| | | | | | | | Submitted by: Matt Williams Sponsored by: Netflix Notes: svn path=/head/; revision=322992
* Add ability to label md(4) devices.Maxim Sobolev2017-08-282-9/+26
| | | | | | | | | | | | | | | This feature comes from the fact that we rely memory-backed md(4) in our build process heavily. However, if the build goes haywire the allocated resources (i.e. swap and memory-backed md(4)'s) need to be purged. It is extremely useful to have ability to attach arbitrary labels to each of the virtual disks so that they can be identified and GC'ed if neecessary. MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D10457 Notes: svn path=/head/; revision=322969
* Hide length of geli passphrase during boot.Mariusz Zaborski2017-08-262-12/+58
| | | | | | | | | | | | | Introduce additional flag to the geli which allows to restore previous behavior. Reviewed by: AllanJude@, cem@ (previous version) MFC: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D11751 Notes: svn path=/head/; revision=322923
* Typo, the '-6' option selects inet6.Konstantin Belousov2017-08-151-1/+1
| | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days Notes: svn path=/head/; revision=322550
* Add supporting changes for `Add limited sandbox capability to "make check"`Enji Cooper2017-08-146-0/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Non-tests/... changes: - Add HAS_TESTS= to Makefiles with libraries and programs to enable iteration and propagate the appropriate environment down to *.test.mk. tests/... changes: - Add appropriate support Makefile.inc's to set HAS_TESTS in a minimal manner, since tests/... is a special subdirectory tree compared to the others. MFC after: 2 months MFC with: r322511 Reviewed by: arch (silence), testing (silence) Differential Revision: D12014 Notes: svn path=/head/; revision=322515
| * Add HAS_TESTS to all Makefiles that are currently using theEnji Cooper2017-08-026-0/+6
| | | | | | | | | | | | | | | | | | `SUBDIR.${MK_TESTS}+= tests` idiom. This is a follow up to r321912. Notes: svn path=/projects/make-check-sandbox/; revision=321914
* | Since the switch to GPT disk labels, fsck for UFS/FFS has beenKirk McKusick2017-08-092-4/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | unable to automatically find alternate superblocks. This checkin places the information needed to find alternate superblocks to the end of the area reserved for the boot block. Filesystems created with a newfs of this vintage or later will create the recovery information. If you have a filesystem created prior to this change and wish to have a recovery block created for your filesystem, you can do so by running fsck in forground mode (i.e., do not use the -p or -y options). As it starts, fsck will ask ``SAVE DATA TO FIND ALTERNATE SUPERBLOCKS'' to which you should answer yes. Discussed with: kib, imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11589 Notes: svn path=/head/; revision=322297
* | Add missing parenthesis on error messageRenato Botelho2017-08-081-1/+1
| | | | | | | | | | | | | | | | | | Approved by: loos MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=322281
* | Remove now-unused badsb declaration, missed in r322200Ed Maste2017-08-081-2/+0
| | | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=322271
* | In debug mode, print the differences between the superblock andWarner Losh2017-08-071-25/+35
| | | | | | | | | | | | | | | | | | | | alternate superblock when the values disagree and we're going to reject it. Differential Revision: https://reviews.freebsd.org/D11589 Notes: svn path=/head/; revision=322201
* | Make it possible to ignore superblock mismatch. This will not fix suchWarner Losh2017-08-071-36/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a mismatch, but will allow fsck to continue when the last alternate superblock gets corrupted somehow. Also, remove searching for alternate super blocks. It should have been removed two years ago with r276737 by imp@. Leave minor vestiges in place in case someone wants to solve the hard problem of knowing where altnernate superblocks live without access to data formerly stored in disklabels. Differential Revision: https://reviews.freebsd.org/D11589 Notes: svn path=/head/; revision=322200
* | Selectively print "hwaddr" from ifconfig(8).Matt Joras2017-08-041-1/+9
|/ | | | | | | | | | | | | ifconfig(8) printing the hwaddr is only really useful if it differs from the link layer address. Reported by: jhb Reviewed by: rpokala Approved by: rstone (mentor) Differential Revision: https://reviews.freebsd.org/D11777 Notes: svn path=/head/; revision=322062
* Convert traditional ${MK_TESTS} conditional idiom for including testEnji Cooper2017-08-026-18/+6
| | | | | | | | | | | | | | directories to SUBDIR.${MK_TESTS} idiom This is being done to pave the way for future work (and homogenity) in ^/projects/make-check-sandbox . No functional change intended. MFC after: 1 weeks Notes: svn path=/head/; revision=321912
* Don't request CTLTYPE_OPAQUE if we can't print them.Andrew Gallatin2017-07-311-18/+26
| | | | | | | | | | | | | | | | | | | The intent is to skip expensive opaque sysctls like tcp_pcblist unless they are explicitly requested. Sysctl nodes like this don't show up in sysctl -a, but they do generate output that winds up being dropped, unless the user specifically requested binary/hex output or opaques. This reduces the runtime of sysctl in many circumstances on a loaded system. It also reduces the likelihood that simply gathering diagnostics on a sick machine (stuck lock, etc) via sysctl -a might push it over the edge into a total lockup. Reviewed by: jtl Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D11461 Notes: svn path=/head/; revision=321790
* Add a new "-N" option to umount(8), that does a forced dismount of an NFS mountRick Macklem2017-07-292-8/+54
| | | | | | | | | | | | | | | | | | | | | | point. The new "-N" option does a forced dismount of an NFS mount point, but avoids doing any checking of the mounted-on path, so that it will not get hung when a vnode lock is held by another hung process on the mounted-on vnode. The most common case of this is a "umount" with the "-f" option. Other than avoiding checking the mounted-on path, it performs the same forced dismount as a successful "umount -f" would do. This commit includes a content change to the man page. Tested by: pho Reviewed by: kib MFC after: 2 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D11735 Notes: svn path=/head/; revision=321689
* Fix style and wrap lines to 80 columns in savecore.c.Mark Johnston2017-07-241-16/+29
| | | | | | | | | No functional change intended. MFC after: 3 days Notes: svn path=/head/; revision=321437
* Revert r320918 and have mkdumpheader() handle version string truncation.Mark Johnston2017-07-151-1/+1
| | | | | | | | Reported by: jhb MFC after: 1 week Notes: svn path=/head/; revision=321035
* pfctl parser testsKristof Provost2017-07-15162-0/+1669
| | | | | | | | | | | | | | | | | | | | Copy the most important test cases from OpenBSD's corresponding src/regress/sbin/pfctl, those that run pfctl on a test input file and check correctness of its output. We have also added some new tests using the same format. The tests consist of a collection of input files (pf*.in) and corresponding output files (pf*.ok). We run pfctl -nv on the input files and check that the output matches the output files. If any discrepancy is discovered during future development in the source tree, we know that a regression bug has been introduced into the tree. Submitted by: paggas Sponsored by: Google, Inc (GSoC 2017) Differential Revision: https://reviews.freebsd.org/D11322 Notes: svn path=/head/; revision=321030
* Add a newline after the version string.Mark Johnston2017-07-121-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=320918
* Add a subroutine for comparing kerneldump identifiers.Mark Johnston2017-07-111-5/+10
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=320896
* Fix whitespace bugsEnji Cooper2017-07-101-390/+387
| | | | | | | | | | | | | | - Delete trailing whitespace. - Replace 8 single column spaces with hard tabs. - Delete lines with consisting purely of blank space. - Add space between `return` and `(`, per style(9). Special care was taken to not blindly replace 8 single column spaces with tabs; doing so could break tools that do strict string comparisons with camcontrol output. Notes: svn path=/head/; revision=320861
* Fix -Wuninitialized warning with gccEnji Cooper2017-07-101-1/+1
| | | | | | | | | | | Initialize mmc_data_byte to 0, as it could be used uninitialized later on. MFC with: r320846 Reported by: Jenkins (powerpc jobs) Notes: svn path=/head/; revision=320859
* New command 'mmcsdcmd' for camcontrol, to allow interacting with SD cardsWarner Losh2017-07-091-1/+302
| | | | | | | Submitted by: Ilya Babulin Notes: svn path=/head/; revision=320846