path: root/sbin
Commit message (Collapse)AuthorAgeFilesLines
* Fix memory leaks in route(8).Alexander V. Chernikov2018-03-311-0/+2
| | | | | | | | | Submitted by: Tom Rix (trix_juniper.net) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D9676 Notes: svn path=/head/; revision=331844
* Rework ipfw rules parsing and printing code.Andrey V. Elsukov2018-03-283-751/+785
| | | | | | | | | | | | | | | | | | | | | Introduce show_state structure to keep information about printed opcodes. Split show_static_rule() function into several smaller functions. Make parsing and printing opcodes into several passes. Each printed opcode is marked in show_state structure and will be skipped in next passes. Now show_static_rule() function is simple, it just prints each part of rule separately: action, modifiers, proto, src and dst addresses, options. The main goal of this change is avoiding occurrence of wrong result of `ifpw show` command, that can not be parsed by ipfw(8). Also now it is possible to make some simple static optimizations by reordering of opcodes in the rule. PR: 222705 Discussed with: melifaro MFC after: 2 weeks Sponsored by: Yandex LLC Notes: svn path=/head/; revision=331668
* Bump .Dd after r331113.Edward Tomasz Napierala2018-03-271-1/+1
| | | | | | | | Reported by: oshogbo@ MFC after: 2 weeks Notes: svn path=/head/; revision=331624
* Allow to specify PCP on packets not belonging to any VLAN.Konstantin Belousov2018-03-272-69/+97
| | | | | | | | | | | | | | | | | | | | | | | | According to 802.1Q-2014, VLAN tagged packets with VLAN id 0 should be considered as untagged, and only PCP and DEI values from the VLAN tag are meaningful. See for instance https://www.cisco.com/c/en/us/td/docs/switches/connectedgrid/cg-switch-sw-master/software/configuration/guide/vlan0/b_vlan_0.html. Make it possible to specify PCP value for outgoing packets on an ethernet interface. When PCP is supplied, the tag is appended, VLAN id set to 0, and PCP is filled by the supplied value. The code to do VLAN tag encapsulation is refactored from the if_vlan.c and moved into if_ethersubr.c. Drivers might have issues with filtering VID 0 packets on receive. This bug should be fixed for each driver. Reviewed by: ae (previous version), hselasky, melifaro Sponsored by: Mellanox Technologies MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D14702 Notes: svn path=/head/; revision=331622
* vfs_donmount: in certain cases try r/o mount if r/w mount failsAndriy Gapon2018-03-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | If the operation is not an update, if neither r/w nor r/o mode is explicitly requested, if the error code hints at the possibility of the media being read-only, and if the fallback is allowed, then we can try to automatically downgrade to the readonly mode. This is especially useful for auto-mounting of removable media that sometimes can happen to be write-protected. The fallback to r/o is not enabled by default. It can be requested on a per-mount basis with a new mount option, 'autoro'. Or it can be globally allowed by setting vfs.default_autoro. Reviewed by: cem, kib MFC after: 3 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D13361 Notes: svn path=/head/; revision=331616
* Remove note that `fwd tablearg` is supported only by IPv4. IPv6 isAndrey V. Elsukov2018-03-191-2/+2
| | | | | | | | | supported too. MFC after: 1 week Notes: svn path=/head/; revision=331203
* Xr crashinfo(8) from savecore(8).Edward Tomasz Napierala2018-03-171-0/+1
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=331113
* Revert r313780 (UFS_ prefix)Ed Maste2018-03-1716-125/+123
| | | | Notes: svn path=/head/; revision=331095
* Prefix UFS symbols with UFS_ to reduce namespace pollutionEd Maste2018-03-1716-123/+125
| | | | | | | | | | | | | Followup to r313780. Also prefix ext2's and nandfs's versions with EXT2_ and NANDFS_. Reported by: kib Reviewed by: kib, mckusick Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D9623 Notes: svn path=/head/; revision=331083
* Extend SSID maximum string length to 32 chars to support longer SSIDKirill Ponomarev2018-03-161-1/+1
| | | | | | | | | | names. Approved by: adrian Differential Revision: https://reviews.freebsd.org/D14710 Notes: svn path=/head/; revision=331064
* Add some argument checks to be more user-friendly.Alexander Motin2018-03-131-23/+35
| | | | | | | | MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=330846
* Add `nvmecontrol format` subcommand.Alexander Motin2018-03-137-11/+225
| | | | | | | | | | | It allows to change namespace parameters, such as block size, metadata, protection information, etc. and/or erase the data. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=330826
* Print fuses and fna fields in identify data.Alexander Motin2018-03-121-0/+11
| | | | | | | | MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=330802
* Do not try to reassemble IPv6 fragments in "reass" rule.Andrey V. Elsukov2018-03-121-2/+2
| | | | | | | | | | | | ip_reass() expects IPv4 packet and will just corrupt any IPv6 packets that it gets. Until proper IPv6 fragments handling function will be implemented, pass IPv6 packets to next rule. PR: 170604 MFC after: 1 week Notes: svn path=/head/; revision=330792
* Add new identify data structures fields from NVMe 1.3a.Alexander Motin2018-03-111-15/+117
| | | | | | | | Some of them are already supported by existing hardware, so reporting them `nvmecontrol identify` can be useful. Notes: svn path=/head/; revision=330759
* Permit sysctl(8) to set an array of numeric values for a single node.John Baldwin2018-03-092-93/+135
| | | | | | | | | | | | | | | | | | | | Most sysctl nodes only return a single value, but some nodes return an array of values (e.g. kern.cp_time). sysctl(8) understand how to display the values of a node that returns multiple values (it prints out each numeric value separated by spaces). However, until now sysctl(8) has only been able to set sysctl nodes to a single value. This change allows sysctl to accept a new value for a numeric sysctl node that contains multiple values separated by either spaces or commas. sysctl(8) parses this list into an array of values and passes the array as the "new" value to sysctl(2). Reviewed by: rpokala MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D14569 Notes: svn path=/head/; revision=330711
* Remove decade's old whine about msdos vs msdosfs.Warner Losh2018-03-091-4/+1
| | | | | | | | | Retain the compatibility silently though. Reviewed by: cem@, kevans@, emaste@ (and many others in the past) Notes: svn path=/head/; revision=330705
* ipfw(8): Fix endianness for Legacy and Ipv4 table hostname valuesConrad Meyer2018-03-081-3/+6
| | | | | | | | | | | | | | | | | | | | | The lookup_host() helper subroutine emits a struct in_addr value in network byte order via caller passed pointer. However, the table value is expected to be stored in host byte order. On little-endian machines, this produced a reversed endian table value for Legacy or IPv4 table types when the value was a hostname (instead of a plain IP address). Fix by using ntohl() on the output 32-bit address. While here, avoid some aliasing violations by storing the lookup_host() output in an intermediate object of the correct type. PR: 226429 Reported by: bugs.freebsd.org AT mx.zzux.com (also: Tested by) Security: ipfw hostname table rules could potentially not act as admin intended Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=330665
* Clarify and clean up some language, and add an explicit example.Warren Block2018-03-021-11/+15
| | | | | | | | Sponsored by: iXsystems Differential Revision: https://reviews.freebsd.org/D12336 Notes: svn path=/head/; revision=330291
* dhclient violates RFC2131 when sending early DHCPREQUEST message to ↵David Bright2018-02-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | re-obtain old IP When dhclient first starts, if an old IP address exists in the dhclient.leases file, dhclient(8) sends early DHCPREQUEST message(s) in an attempt to re-obtain the old IP address again. These messages contain the old IP as a requested-IP-address option in the message body (correct) but also use the old IP address as the packet's source IP (incorrect). RFC2131 sec 4.1 states: DHCP messages broadcast by a client prior to that client obtaining its IP address must have the source address field in the IP header set to 0. The use of the old IP as the packet's source address is incorrect if (a) the computer is now on a different network or (b) it is on the same network, but the old IP has been reallocated to another host. Fix dhclient to use as the source IP in this circumstance without removing any existing functionality. Any previously-used old IP is still requested in the body of an early DHCPREQUEST message. PR: 199378 Submitted by: J.R. Oldroyd <fbsd@opal.com> Reported by: J.R. Oldroyd <fbsd@opal.com> Reviewed by: cem, asomers, vangyzen MFC after: 1 week Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D14527 Notes: svn path=/head/; revision=330085
* fix typo in ipfw(8). No functional change.Alan Somers2018-02-271-1/+1
| | | | | | | | Submitted by: zxzharmlesszxz Pull Request: https://github.com/freebsd/freebsd/pull/132 Notes: svn path=/head/; revision=330076
* Improve missing tty handling in init(8). This removes a check that didEdward Tomasz Napierala2018-02-271-14/+36
| | | | | | | | | | | | | | | | | | | nothing - it was checking for ENXIO, which, with devfs, is no longer returned - and was badly placed anyway, and replaces it with similar one that works, and is done just before starting getty, instead of being done when rereading ttys(5). From the practical point of view, this makes init(8) handle disappearing terminals (eg /dev/ttyU*) gracefully, without unneccessary getty restarts and resulting error messages. Reviewed by: imp@ MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D14307 Notes: svn path=/head/; revision=330054
* route(8): make it possible to manually delete pinned routeEugene Grosbein2018-02-241-1/+3
| | | | | | | | | Reported by: Andreas Longwitz <longwitz@incore.de> Approved by: avg (mentor) MFC after: 1 week Notes: svn path=/head/; revision=329930
* nvmecontrol: fix build on amd64/clangAlan Somers2018-02-221-1/+1
| | | | | | | | Broken by: 329824 Sponsored by: Spectra Logic Corp Notes: svn path=/head/; revision=329830
* NVMe: Add big-endian supportWojciech Macek2018-02-228-88/+234
| | | | | | | | | | | | | | | | Remove bitfields from defined structures as they are not portable. Instead use shift and mask macros in the driver and nvmecontrol application. NVMe is now working on powerpc64 host. Submitted by: Michal Stanek <mst@semihalf.com> Obtained from: Semihalf Reviewed by: imp, wma Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D13916 Notes: svn path=/head/; revision=329824
* Add bsdlabel and fdisk to powerpc64Wojciech Macek2018-02-221-0/+4
| | | | | | | | | Submitted by: Wojciech Macek <wma@semihalf.org> Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Notes: svn path=/head/; revision=329822
* dhclient: raise WARNS to 4Alan Somers2018-02-2114-78/+97
| | | | | | | | | | | | | | | | Mostly const-correctness fixes. There were also some variable-shadowing, unused variable, and a couple of sockaddr type-correctness changes. I also had trouble with cast-align warnings. I was able to prove that one of them was a false positive. But ultimately I had to disable the warning program-wide to deal with the others. Reviewed by: cem MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D14460 Notes: svn path=/head/; revision=329754
* Fix a read past the end of a buffer in fsck.Kirk McKusick2018-02-211-1/+3
| | | | | | | | | | | | | | | | | | To minimize the time spent scanning all of the directories in pass 2 (Check Pathnames), fsck uses a search order based on the location of their first block. Zero length directories have no first block, so the array being used to hold the block numbers of directory inodes was of zero length. Thus a lookup was done past the end of the array getting at best a random value and at worst a segment fault. For zero length directories, this change allocates a one element block array and initializes it to zero. The effect is that all zero length directories are handled first in pass 2. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D14163 Notes: svn path=/head/; revision=329749
* Fix route manpage to show correct flush syntaxRyan Stone2018-02-211-1/+2
| | | | | | | | | | | | | | The current route(8) manpage shows that "flush" is an argument to the optional -n flag, rather than a separate subcommand. Correct this to properly show flush as a route subcommand. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Reviewed by: rgrimes Differential Revision: https://reviews.freebsd.org/D14401 Notes: svn path=/head/; revision=329744
* Allow route change requests to not specify the gateway.Ryan Stone2018-02-211-3/+15
| | | | | | | | | | | | | | | | | | | Only require a gateway to be specified on a route add request. On a route change request that does not specify the gateway, the gateway will remain the same. This allows changing other route parameters without having to re-specifying the gateway, like in "route change -mtu 9000". Update the route(8) manpage to explicitly call out this usage as being supported. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Reviewed By: eugen (rtsock.c change), rgrimes Differential Revision: https://reviews.freebsd.org/D14291 Notes: svn path=/head/; revision=329743
* More verbose output.Warner Losh2018-02-201-0/+2
| | | | Notes: svn path=/head/; revision=329633
* Print more info for -v runs and temp hack for usb vs uhubWarner Losh2018-02-181-5/+22
| | | | | | | | | | | | | | Despite best efforts to regularize, there's a few tables in the system that still report they are for bus usb when they are really for bus uhub (where usb devices attach). Add a temporary workaround for this until these places have been eliminated (likely my fault). Second, when running verbose, describe what we're doing when searching. This output can be quite long, but says exactly what's going on (this output is to stdout, so it's useless for scripting). Notes: svn path=/head/; revision=329538
* Fix USB driver matching in devmatch(8).Hans Petter Selasky2018-02-171-2/+63
| | | | | | | | | | | | Multiple drivers can match on the same USB device and the order of loading decides which driver gets the device. Use the supplied mask value as an indication of priority, so that vendor specific device drivers are loaded before more generic ones. Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=329458
* Implement --hints to read hints file directlyWarner Losh2018-02-172-38/+69
| | | | | | | | | | | | In testing, it's often useful to copy a few files into a directory and kldxref them to ensure that particular cases are handled correctly. Add --hints (-h) to facilitate this testing and enable future automated testing. Sponsored by: Netflix Notes: svn path=/head/; revision=329446
* Add option to parse NOMATCH event and suggest modules to loadWarner Losh2018-02-172-3/+55
| | | | | | | | | | | Add --nomatch/-p to search for individual drivers based on a NOMATCH event from devd. Submitted by: hps (earlier version) Sponsored by: Netflix Notes: svn path=/head/; revision=329444
* Tweak the 'I' flagged valueWarner Losh2018-02-171-1/+1
| | | | | | | | | | | | | 'I' was omitting 'zero' values. This is not quite correct, and was put in as a hack but not documented. Remove it. If we find what the hack was really needed for, we'll either fix the need for it, or invent a new flagged value type. Submitted by: hps@ Sponsored by: Netflix Notes: svn path=/head/; revision=329443
* Implement 'T' field matching.Warner Losh2018-02-171-0/+18
| | | | | | | | | | | | | | | Implement 'T' field matching. This is needed to prevent false positives. However, it's not general enough. It only handles one field and there's a ton of edge cases even with that it likely wouldn't handle. To do it more generally and also eliminate a lot of the hackiness that's in this program now, we'd need to creating directories for lookups ala awk, pearl, python, etc. It appears to be sufficient, though, to get my keyboard loaded on boot. Sponsored by: Netflix Notes: svn path=/head/; revision=329442
* Warn when we encounter unknown PNP field specifiers.Warner Losh2018-02-171-0/+1
| | | | | | | | | | The 'T' field went unimplemented for months due to a lack of warning. Add a warnings to detect mistakes sooner. Sponsored by: Netflix Notes: svn path=/head/; revision=329439
* Prevent savecore from reading bounds from the current directory.Mike Silbersack2018-02-161-0/+7
| | | | | | | | | | | | | | | | Rev 244218 removed the requirement that you provide a dump directory when checking if there is a coredump ready to be written. That had the side-effect of causing the bounds file to be read from the current working directory instead of the dump directory. As the bounds file is irrelevant when just checking, the simplest fix is to not read the bounds file when checking. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14383 Notes: svn path=/head/; revision=329362
* devd: don't pass &fds in useless parameters to select(2)Eitan Adler2018-02-151-1/+1
| | | | | | | | | | | select(2) should be declared as restrict. In addition the only fd in the fdset is open O_RDONLY, and it's not a socket that can provide OOB notifications, Reviewed by: ian, imp, vangyzen Notes: svn path=/head/; revision=329296
* Add support for zstd-compressed user and kernel core dumps.Mark Johnston2018-02-133-20/+66
| | | | | | | | | | | | | | | | | | | This works similarly to the existing gzip compression support, but zstd is typically faster and gives better compression ratios. Support for this functionality must be configured by adding ZSTDIO to one's kernel configuration file. dumpon(8)'s new -Z option is used to configure zstd compression for kernel dumps. savecore(8) now recognizes and saves zstd-compressed kernel dumps with a .zst extension. Submitted by: cem (original version) Relnotes: yes Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D13101, https://reviews.freebsd.org/D13633 Notes: svn path=/head/; revision=329240
* DSCP values passed to setdscp need to be lowercase.Nick Hibma2018-02-131-22/+22
| | | | | | | | | | See definition of f_ipdscp values. They are compared against using bcmp which is case sensitive. MFC after: 1 week Notes: svn path=/head/; revision=329197
* devmatch.8: Link to MODULE_PNP_INFO(9)Conrad Meyer2018-02-121-2/+3
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=329186
* Move devmatch to sbin from usr/sbin.Warner Losh2018-02-124-0/+525
| | | | | | | | | | Since we want to use devmatch in context before a split /,/usr system has mounted /usr, move devmatch to /sbin. Sponsored by: Netflix Notes: svn path=/head/; revision=329161
* Add GUID and alias for Apple APFS partitionConrad Meyer2018-02-111-1/+3
| | | | | | | | PR: 225813 Submitted by: James Wright <james.wright AT jigsawdezign.com> Notes: svn path=/head/; revision=329119
* Include files missed in 329051.Kirk McKusick2018-02-083-1/+43
| | | | Notes: svn path=/head/; revision=329052
* The goal of this change is to prevent accidental foot shooting byKirk McKusick2018-02-083-31/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | folks running filesystems created on check-hash enabled kernels (which I will call "new") on a non-check-hash enabled kernels (which I will call "old). The idea here is to detect when a filesystem is run on an old kernel and flag the filesystem so that when it gets moved back to a new kernel, it will not start getting a slew of check-hash errors. Back when the UFS version 2 filesystem was created, it added a file flag FS_INDEXDIRS that was to be set on any filesystem that kept some sort of on-disk indexing for directories. The idea was precisely to solve the issue we have today. Specifically that a newer kernel that supported indexing would be able to tell that the filesystem had been run on an older non-indexing kernel and that the indexes should not be used until they had been rebuilt. Since we have never implemented on-disk directory indicies, the FS_INDEXDIRS flag is cleared every time any UFS version 2 filesystem ever created is mounted for writing. This commit repurposes the FS_INDEXDIRS flag as the FS_METACKHASH flag. Thus, the FS_METACKHASH is definitively known to have always been cleared. The FS_INDEXDIRS flag has been moved to a new block of flags that will always be cleared starting with this commit (until they get used to implement some future feature which needs to detect that the filesystem was mounted on a kernel that predates the new feature). If a filesystem with check-hashes enabled is mounted on an old kernel the FS_METACKHASH flag is cleared. When that filesystem is mounted on a new kernel it will see that the FS_METACKHASH has been cleared and clears all of the fs_metackhash flags. To get them re-enabled the user must run fsck (in interactive mode without the -y flag) which will ask for each supported check hash whether it should be rebuilt and enabled. When fsck is run in its default preen mode, it will just ignore the check hashes so they will remain disabled. The kernel has always disabled any check hash functions that it does not support, so as more types of check hashes are added, we will get a non-surprising result. Specifically if filesystems get moved to kernels supporting fewer of the check hashes, those that are not supported will be disabled. If the filesystem is moved back to a kernel with more of the check-hashes available and fsck is run interactively to rebuild them, then their checking will resume. Otherwise just the smaller subset will be checked. A side effect of this commit is that filesystems running with cylinder-group check hashes will stop having them checked until fsck is run to re-enable them (since none of them currently have the FS_METACKHASH flag set). So, if you want check hashes enabled on your filesystems after booting a kernel with these changes, you need to run fsck to enable them. Any newly created filesystems will have check hashes enabled. If in doubt as to whether you have check hashes emabled, run dumpfs and look at the list of enabled flags at the end of the superblock details. Notes: svn path=/head/; revision=329051
* [etherswitchcfg] print the switch MAC address if provided.Adrian Chadd2018-02-061-0/+7
| | | | Notes: svn path=/head/; revision=328923
* geom: don't write stack garbage in disk labelsAlan Somers2018-02-049-0/+16
| | | | | | | | | | | | | | | | | | | | | | Most consumers of g_metadata_store were passing in partially unallocated memory, resulting in stack garbage being written to disk labels. Fix them by zeroing the memory first. gvirstor repeated the same mistake, but in the kernel. Also, glabel's label contained a fixed-size string that wasn't initialized to zero. PR: 222077 Reported by: Maxim Khitrov <max@mxcrypt.com> Reviewed by: cem MFC after: 3 weeks X-MFC-With: 323314 X-MFC-With: 323338 Differential Revision: https://reviews.freebsd.org/D14164 Notes: svn path=/head/; revision=328849
* Check and report error returns from sbput(3) calls.Kirk McKusick2018-02-021-36/+21
| | | | | | | | | | Convert to using cgput(3) for writing cylinder groups. Check and report error returns from cgput(3). Submitted by: Bruce Evans <bde@freebsd.org> Notes: svn path=/head/; revision=328821