Commit Graph
8306 Commits
Author SHA1 Message Date
Edward Tomasz Napierala 141c06dff8 MFC r320803:
Fix "mount -uw /" when the filesystem type doesn't match.

This basically makes "mount -uw /" work when the filesystem
mounted on / is NFS, but the one configured in fstab(5) is UFS,
which can happen when you forget to modify fstab.

Note that the whole special case ("else if (argv[0][0] == '/'")
is probably not needed anyway.  I'll take a look at removing it
altogether; for now this is a minimally intrusive fix.
2017-10-04 12:04:35 +00:00
Enji Cooper 281d3045a3 MFC r320701:
Remove SUBDIR ordering/uniquifying in *bin/Makefile

After the addition of SUBDIR.yes, uniquifying/ordering the SUBDIRs doesn't
make a whole lot of sense, and it's in effect a half measure.

Ordering SUBDIR (after adding SUBDIR.yes to it) in bsd.subdir.mk is a
separate change that warrants more discussion/testing, because while
the SUBDIR_PARALLEL work largely fixed dependency ordering for SUBDIRs,
there might be downstream FreeBSD consumers that rely on the SUBDIR
ordering.
2017-09-08 04:46:55 +00:00
Rick Macklem ac0465ec67 MFC: r321689
Add a new "-N" option to umount(8), that does a forced dismount of an NFS mount
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.
2017-08-25 22:58:54 +00:00
Kirk McKusick c101981761 MFC of 322200, 322201, 322271, and 322297
322200: Remove (broken) search for alternate superblocks
322201: Show differences when alternate superblock fails to match
322271: Cleanup for 322200.
322297: Restore fsck_ffs ability to find alternate superblocks

Discussed with: kib, imp
Differential Revision: https://reviews.freebsd.org/D11589
2017-08-23 04:35:03 +00:00
Konstantin Belousov 225cb11be4 MFC r322550:
Typo, the '-6' option selects inet6.
2017-08-18 07:00:00 +00:00
Xin LI 0a7369cd8d MFC r320761:
- Use strlcat() instead of strncat().
 - Use asprintf() and handle allocation errors.
2017-08-02 05:30:41 +00:00
Mark Johnston 9a8c7e0c5c MFC r321437:
Fix style and wrap lines to 80 columns in savecore.c.
2017-07-31 00:34:36 +00:00
Mark Johnston e3fcafe384 Include stdbool.h for r321447.
This is a direct commit to stable/11.
2017-07-25 00:30:25 +00:00
Mark Johnston 0076d6bc21 MFC r320896:
Add a subroutine for comparing kerneldump identifiers.
2017-07-25 00:28:29 +00:00
Enji Cooper b0b9c73592 Relnotes: yes (subtle output/behavior change)
MFC r316938,r316953:

r316938:

savecore: fix space calculation with respect to `minfree` in check_space(..)

- Use strtoll(3) instead of atoi(3), because atoi(3) limits the
  representable data to INT_MAX. Check the values received from
  strtoll(3), trimming trailing whitespace off the end to maintain
  POLA.
- Use `KiB` instead of `kB` when describing free space, total space,
  etc. I am now fully aware of `KiB` being the IEC standard for 1024
  bytes and `kB` being the IEC standard for 1000 bytes.
- Store available number of KiB in `available` so it can be more
  easily queried and compared to ensure that there are enough KiB to
  store the dump image on disk.
- Print out the reserved space on disk, per `minfree`, so end-users
  can troubleshoot why check_space(..) is reporting that there isn't
  enough free space.

Tested with:	positive/negative cases (see review); make tinderbox

r316953:

Switch back to non-IEC units for 1024 bytes

I was swayed a little too quickly when I saw the wiki page discussing
kB vs KiB. Switch back as none of the code in base openly uses
IEC units via humanize_number(3) (which was my next step), and there's
a large degree of dislike with IEC vs more SI-like units.
2017-07-19 16:39:00 +00:00
Alan Somers 06b077ccc1 MFC r320165-r320167
r320165:
devd(8): Remove pidfile on shutdown

Sponsored by:	Spectra Logic Corp

r320166:
Require devd to be running for its ATF tests to run

The ATF tests communicate with the system's running devd

PR:		220169
Reported by:	gjb
Sponsored by:	Spectra Logic Corp

r320167:
zfsd(8): Remove pidfile on shutdown

Sponsored by:	Spectra Logic Corp
2017-07-06 17:34:53 +00:00
Alan Somers a7f646058a MFC r319900:
sbin/ipfw: strcpy, strncpy => strlcpy

Reported by:	Coverity
CID:		1356162, 1356166
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D10662
2017-07-05 15:50:41 +00:00
Alan Somers 5a6f0d7bec MFC r319337:
Fix integer overflow in "camcontrol format"

Reported by:	Coverity
CID:		1011426
Sponsored by:	Spectra Logic Corp
2017-07-05 15:34:06 +00:00
Kirk McKusick dfe5e4ddfb MFC of 320176:
Allow '_' in labels when specifying -L to newfs.

PR: 220163
Reported by: Keve Nagy
Reviewed by: kib
Approved by: re@ (Xin Li)
2017-06-26 17:29:32 +00:00
Enji Cooper 1d8c977049 MFC r316742:
Clarify units for mediasize and sectorsize in DoFile(..)

They're byte quantities.
2017-05-31 08:43:46 +00:00
Enji Cooper f300c64054 MFC r316740:
Clarify `minfree` warning message in check_space(..)

- State that the units are kB.
- Be more complete/concise in terms of what is required (in this case
  `minfree` must be at least `X`kB)
2017-05-31 08:42:31 +00:00
Xin LI d7ab634bec MFC r313695, r313760, r314769, r314863, r314865, r316125
r313695:
MFV r313676: libpcap 1.8.1

r313760:
MFV r313759: license change for a few headers (4 clause BSD to 3 clause BSD).

X-MFC-with:	r313695

r314769:
Remove compatibility with old libpcap.

Differential Revision:	https://reviews.freebsd.org/D9606

r314863:
Stop installing pcap-int.h, which is the internal interface for libpcap.

Reference:	https://github.com/the-tcpdump-group/libpcap/issues/560
PR:		217221

r314865:
Bump __FreeBSD_version for removal of pcap-int.h.

PR:		217221

r316125:
MFV r316124: Fix build when WITHOUT_INET6.

Reported by:	Randy Westlund <rwestlun gmail com>
2017-05-31 05:20:59 +00:00
Enji Cooper 5bf9f6567f MFC r314655:
bin: normalize paths using SRCTOP-relative paths or :H when possible

This simplifies make logic/output
2017-05-30 04:17:22 +00:00
Glen Barber 06a8bb4808 MFC r318794, r318795:
Update the "first appeared in" version in several manual pages.

Sponsored by:	The FreeBSD Foundation
2017-05-27 00:30:51 +00:00
Alan Somers 65bb5576f4 MFC r317759:
Fix memory leaks in camcontrol

Reported by:	Coverity
CID:		1331674, 1331675
Reviewed by:	ken
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D10588
2017-05-24 21:18:13 +00:00
Alan Somers a9cafbf146 MFC r317755, r317758
r317755:
Various Coverity fixes in ifconfig(8)

* Exit early if kldload(2) fails (1011259). This is the only change that
  affects ifconfig's behavior.
* Close memory and resource leaks (1305624, 1305205, 1007100)
* Mark usage() as _Noreturn (1305806, 1305750)
* Fix some dereference after null checks (1011474, 270774)

Reported by:	Coverity
CID:		1305624, 1305205, 1007100, 1305806, 1305750, 1011474,
CID:		270774, 1011259
Reviewed by:	cem
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D10587

r317758:
Unbreak ifconfig for mlx4en(4) after r317755

ifconfig doesn't correctly infer mlx interfaces' module names, so it will
attempt to load the mlx(4) module even when not necessary.

Reported by:	rstone
X-MFC-With:	317755
Sponsored by:	Spectra Logic Corp
2017-05-24 20:52:47 +00:00
Alan Somers a49cffb2d4 MFC r317715:
ifconfig displays ND6_IFF_NO_DAD as "IGNORELOOP"

PR:		218958
Reviewed by:	kristof
Differential Revision:	https://reviews.freebsd.org/D10543
2017-05-24 20:25:40 +00:00
Andrey V. Elsukov 66fca3cc26 MFC r318400:
Allow zero port specification in table entries with type flow.

  PR:		217620
2017-05-24 09:01:54 +00:00
Alexander Motin 41a65f8b4e MFC r309321:
Add `gmirror create` subcommand, alike to gstripe, gconcat, etc.

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.

Sponsored by:	iXsystems, Inc.
2017-05-23 17:00:56 +00:00
Rick Macklem 6c035f338f MFC: r317931
Fix mount_nfs so that it doesn't create mounttab entries for NFSv4 mounts.

The NFSv4 protocol doesn't use the Mount protocol, so it doesn't make sense
to add an entry for an NFSv4 mount to /var/db/mounttab. Also, r308871
modified umount so that it doesn't remove any entry created by mount_nfs.
2017-05-22 21:41:34 +00:00
Nick Hibma db596f1b3d MFC:
------------------------------------------------------------------------
	r317923 | n_hibma | 2017-05-07 23:11:28 +0200 (Sun, 07 May 2017) | 8 lines

	Fix the output of very large rebind, renew and lease time options in
	lease file.

	Some routers set very large values for rebind time (Netgear) and these
	are erroneously reported as negative in the leasefile. This was due to a
	wrong printf format specification of %ld for an unsigned long on 32-bit
	platforms.

	------------------------------------------------------------------------
	r317915 | n_hibma | 2017-05-07 21:59:37 +0200 (Sun, 07 May 2017) | 16 lines

	Fix handling of large DHCP expiry values.

	They would overflow a signed 32-bit time_t on 32 bit architectures. This
	was taken care of, but a compiler optimisation makes this behave
	erratically. This could be resolved by adding a -fwrapv flag, but
	instead we can check the value before adding the current timestamp to
	it.

	In the lease file values are still wrong though:

		option dhcp-rebinding-time -644245096;

PR:		218980
2017-05-22 10:28:17 +00:00
Enji Cooper 4aea5d3388 MFC r315775:
Add a post-humous manpage for cd9660(5), the ISO-9660 file system

Describe (briefly) how to compile the filesystem into the kernel and
load as a module.

Reference cd9660(5) in mount(8) and mount_cd9660(8).
2017-05-22 06:20:22 +00:00
Edward Tomasz Napierala f4830df478 MFC r317517:
Advertise kldxref(8) a little better.
2017-05-18 20:40:49 +00:00
Ravi Pokala 96c3e37273 MFC r318160, 318176: Persistently store NIC's hardware MAC address, and add
a way to retrive it

The MAC address reported by `ifconfig ${nic} ether' does not always match
the address in the hardware, as reported by the driver during attach. In
particular, NICs which are components of a lagg(4) interface all report the
same MAC.

When attaching, the NIC driver passes the MAC address it read from the
hardware as an argument to ether_ifattach(). Keep a second copy of it, and
create ioctl(SIOCGHWADDR) to return it. Teach `ifconfig' to report it along
with the active MAC address.

PR:		194386
2017-05-17 05:53:25 +00:00
Marcelo Araujo c8957d1617 MFC r315112, r315196
r315112:
Add the capability to refresh the gpart(8) label without need a reboot.

gpart(8) has functionality to change the label of an GPT partition.
This functionality works like it should, however, after a label change
the /dev/gpt/ entries remain unchanged. glabel(8) status output remains
unchanged. The change only takes effect after a reboot.

PR:		162690
Submitted by:	sub.mesa@gmail, Ben RUBSON <[email protected]>, ae
Reviewed by:	allanjude, bapt, bcr
Differential Revision:	https://reviews.freebsd.org/D9935

r315196:
After r315112 I broke the tests with eli, instead to pass 0, I should pass
M_NOWAIT to g_media_changed() that will call g_post_event() with this flag.

Reported by:	lwhsu, ngie and ae
2017-05-17 05:21:03 +00:00
Marius Strobl 3545775dd9 MFC: r317343
In fill_ip6(), the value of the pointer av changes before it is
free(3)ed. Thus, introduce a new variable to track the original
value.
2017-05-14 13:59:36 +00:00
Maxim Sobolev c6becb2128 MFC r316718, r316738: make mksnap_ffs functional in the chroot'ed environment. 2017-05-14 10:48:47 +00:00
Andrey V. Elsukov c29ec8388f MFC r317666:
Add sets support for ipfw table info/list/flush commands.

  PR:		212668
2017-05-10 05:05:21 +00:00
Andrey V. Elsukov 074f1c58cd MFC r317667:
In parse_range() validate both range values instead of checking
  the top value twice.

  PR:		202295
2017-05-10 05:04:16 +00:00
Andrey V. Elsukov 839dbf4842 MFC r317663:
Properly initialize ipfw_range_tlv variable to fix possible EINVAL
  in case when ipfw delete/zero/resetlog command issued for several rules
  in the loop. Also reorder some variables by size.

  PR:		218993
2017-05-10 05:02:38 +00:00
Andrey V. Elsukov 731cc7cd4e MFC r317682:
Add `ipfw table all destroy` support.

  PR:		212669
2017-05-10 05:01:05 +00:00
Bryan Drewery e033e4c690 DIRDEPS_BUILD: Connect new directories.
This is a direct commit since MFCing these changes is impractical.

Sponsored by:	Dell EMC Isilon
2017-05-09 20:43:57 +00:00
Kenneth D. Merry a236cbadcc MFC r317854:
When editing a mode page on a tape drive, do not clear the device
  specific parameter.

  Tape drives include write protect (WP), Buffered Mode and Speed
  settings in the device-specific parameter.  Clearing this
  parameter on a mode select can have the effect of turning off
  write protect or buffered mode, or changing the speed setting of
  the tape drive.

  Disks report DPO/FUA support via the device specific parameter
  for MODE SENSE, but the bit is reserved for MODE SELECT.  So we
  clear this for disks (and other non-tape devices) to avoid
  potential errors from the target device.

  sbin/camcontrol/modeedit.c:
  	Clear the device-specific parameter in the mode page
  	header if we're not operating on a tape drive.

Sponsored by:	Spectra Logic
2017-05-08 18:30:55 +00:00
Kenneth D. Merry bcd298c5ac MFC r317774, r317776
r317774:
  Add the ability to rescan or reset devices specified by peripheral
  name and unit number in camcontrol(8).

  Previously camcontrol(8) only supported rescanning or resetting
  devices specified by bus:target:lun.  This is because for
  rescanning at least, you don't have a peripheral name and unit
  number (e.g. da4) for devices that don't exist yet.

  That is still the case after this change, but in other cases, when
  the device does exist in the CAM EDT (Existing Device Table), we
  do a careful lookup of the bus/target/lun if the user supplies a
  peripheral name and unit number to find the bus:target:lun and then
  issue the requested reset or rescan.

  The lookup is done without actually opening the device in question,
  since a rescan is often done to make a device go away after it has
  been pulled.  (This is especially true for busses/controllers, like
  parallel SCSI controllers, that don't automatically detect changes
  in topology.)  Opening a device that is no longer there to
  determine the bus/target/lun might result in error recovery actions
  when the user really just wanted to make the device go away.

  sbin/camcontrol/camcontrol.c:
  	In dorescan_or_reset(), if the use hasn't specified a
  	numeric argument, assume he has specified a device.  Lookup
  	the pass(4) instance for that device using the transport
  	layer CAMGETPASSTHRU ioctl.  If that is successful, we can
  	use the returned bus:target:lun to rescan or reset the
  	device.

  	Under the hood, resetting a device using XPT_RESET_DEV is
  	actually sent via the pass(4) device anyway.  But this
  	provides a way for the user to specify devices in a more
  	convenient way, and can work on device rescans when the
  	device is going away, assuming it still exists in the EDT.

  sbin/camcontrol/camcontrol.8:
  	Update the man page for the rescan and reset subcommands
  	to reflect that you can now use a device name and unit
  	number with them.

Sponsored by:	Spectra Logic

r317776:
  Bump the camcontrol(8) man page date.

Sponsored by:	Spectra Logic
2017-05-08 17:02:01 +00:00
Pedro F. Giffuni 911906c1d7 MFC r317283:
fsck_ffs: Unsign some variables and make use of reallocarray(3).

Instead of casting listmax and numdirs to unsigned values just define
them as unsigned and avoid the casts. Use reallocarray(3).

While here, fs_ncg is already unsigned so the cast is unnecessary.

Reviewed by:	mckusick
2017-05-06 02:39:11 +00:00
Alexander Motin e281302e81 MFC r317246: Always allow setting number of iterations for the first time.
Before this change it was impossible to set number of PKCS#5v2 iterations,
required to set passphrase, if it has two keys and never had any passphrase.
Due to present metadata format limitations there are still cases when number
of iterations can not be changed, but now it works in cases when it can.

PR:		218512
Sponsored by:	iXsystems, Inc.
2017-05-06 00:50:24 +00:00
Kenneth D. Merry 3ba1bd9482 MFC r317657:
Fix camcontrol timestamp setting and update the man page.

  camcontrol timestamp -s would somtimes fail due to stack garbage.  Zero out
  the timestamp parameters to fix it.

  Fix another nearby bug, and update the man page.

  sbin/camcontrol/timestamp.c:
  	In set_timestamp(), bzero ts_p prior to creating the timestamp.
  	Previously stack garbage could cause some tape drives to reject the
  	timestamp.

  	In set_timestamp(), check for failures from strptime().

  sbin/camcontrol/camcontrol.8:
  	Add the time argument to the -T option to camcontrol timestamp -s
  	in the long description.

  	Change the time/date format used in the camcontrol timestamp
  	example to RFC 2822 format.  This fixes a time zone issue with the
  	original example by specifying the time zone as -0600.  Otherwise,
  	the time zone seems to default to standard time in the current
  	locale, which makes the time, when reported back from the drive,
  	1 hour off from the intended setting.  This also fixes a duplicate
  	day of the week ("Wednesday Wed") in the previous example.

Submitted by:	Sam Klopsch
Sponsored by:	Spectra Logic
2017-05-04 14:20:52 +00:00
Alan Somers d2ce9599ce MFC r316611:
sbin/mount: strcpy -> strlcpy

Reported by:	Coverity
CID:		1011173, 1011174
Sponsored by:	Spectra Logic Corp
2017-04-28 14:48:29 +00:00
Rick Macklem 4428771110 MFC: r316793
Document the "oneopenown" option added by r316792.

This is a content change.
2017-04-27 20:21:29 +00:00
Andrey V. Elsukov 37604ec9de MFC r316759:
Add large replay widow support to setkey(8) and libipsec.

  When the replay window size is large than UINT8_MAX, add to the request
  the SADB_X_EXT_SA_REPLAY extension header that was added in r309144.

  Also add support of SADB_X_EXT_NAT_T_TYPE, SADB_X_EXT_NAT_T_SPORT,
  SADB_X_EXT_NAT_T_DPORT, SADB_X_EXT_NAT_T_OAI, SADB_X_EXT_NAT_T_OAR,
  SADB_X_EXT_SA_REPLAY, SADB_X_EXT_NEW_ADDRESS_SRC, SADB_X_EXT_NEW_ADDRESS_DST
  extension headers to the key_debug that is used by `setkey -x`.

  Modify kdebug_sockaddr() to use inet_ntop() for IP addresses formatting.
  And modify kdebug_sadb_x_policy() to show policy scope and priority.

  Reviewed by:	gnn, Emeric Poupon
  Differential Revision:	https://reviews.freebsd.org/D10375
2017-04-27 12:16:58 +00:00
Alan Somers 61568f53a3 MFC r316530, r316535
r316530:
Fix clearing geom metadata if DIOCGSECTORSIZE fails

An unhandled error case would result in passing SIZE_MAX to malloc.
While I'm here, remove an unnecessary NULL check before free

Reported by:	Coverity
CID:		1017793
Sponsored by:	Spectra Logic Corp

r316535:
Fix memory leak in "gpart bootcode"

Also, annotate that gpart_issue never returns

Reported by:	Coverity
CID:		1007105
Sponsored by:	Spectra Logic Corp
2017-04-26 14:50:06 +00:00
Alan Somers 236d481161 MFC r312558:
Misc Coverity fixes in camcontrol(8)

CID 1229913	Fix output of "camcontrol persist -i report_capabilities".
		The reported Persistent Reservation Types were wrong in all
		cases.
CID 1356029	Annotate the code so Coverity will know that this is a false
		positive.
CID 1366830	Fix a memory leak in "camcontrol timestamp -s"
CID 1366832	Fix a segfault that could be caused by bad drive firmware

Also, fix the man page entry for the "camcontrol epc state" command to match
what the code does.

Reviewed by:	ken, wblock
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D9239
2017-04-24 16:07:30 +00:00
Benedict Reuschling 735734bc16 MFC r316657:
Make setkey(8) more clear about anti-replay window size option semantics.

PR:		172913
Submitted by:	[email protected]
Reviewed by:	ae@
Differential Revision:  https://reviews.freebsd.org/D10304
2017-04-23 10:29:09 +00:00
Edward Tomasz Napierala 66dbf5fec4 MFC r315560:
Document how to use reroot with NFS.

Sponsored by:	DARPA, AFRL
2017-04-23 08:36:29 +00:00
Konstantin Belousov e1de9ca86b MFC r316852:
In fsck_ffs pass1, prevent the inosused variable from wrapping.

PR:	218592
2017-04-21 10:13:07 +00:00