Compare commits

...
1049 Commits
Author SHA1 Message Date
Tai-hwa Liang 2b3ce27cae arp(8): fixing the deletion failure of IEEE1394 associated addresses
Without this, 'arp -d ${IEEE1394_ADDRESS}' gives the following error:

	arp: delete: cannot locate 10.0.0.71

Reviewed by:	glebius

(cherry picked from commit a0d6d0d0b9)
2022-09-14 13:10:15 +00:00
Dimitry Andric c36d306bb0 MFC r362623:
Fix copy/paste mistake in kvm_getswapinfo(3)

It seems this manpage was copied from kvm_getloadavg(3), but the
DIAGNOSTICS section was not updated completely. Update the section with
correct information about a return value of -1.
2020-06-30 15:53:52 +00:00
Dimitry Andric bc4f7cabbe MFC r352710:
Do not left-shift a negative number (inducing undefined behavior in
C/C++) in exp(3), expf(3), expm1(3) and expm1f(3) during intermediate
computations that compute the IEEE-754 bit pattern for |2**k| for
integer |k|.

The implementations of exp(3), expf(3), expm1(3) and expm1f(3) need to
compute IEEE-754 bit patterns for 2**k in certain places.  (k is an
integer and 2**k is exactly representable in IEEE-754.)

Currently they do things like 0x3FF0'0000+(k<<20), which is to say they
take the bit pattern representing 1 and then add directly to the
exponent field to get the desired power of two.  This is fine when k is
non-negative.

But when k<0 (and certain classes of input trigger this), this
left-shifts a negative number -- an operation with undefined behavior in
C and C++.

The desired semantics can be achieved by instead adding the
possibly-negative k to the IEEE-754 exponent bias to get the desired
exponent field, _then_ shifting that into its proper overall position.

(Note that in case of s_expm1.c and s_expm1f.c, there are SET_HIGH_WORD
and SET_FLOAT_WORD uses further down in each of these files that perform
shift operations involving k, but by these points k's range has been
restricted to 2 < k <= 56, and the shift operations under those
circumstances can't do anything that would be UB.)

Submitted by:	Jeff Walden, https://github.com/jswalden
Obtained from:	https://github.com/freebsd/freebsd/pull/411
Obtained from:	https://github.com/freebsd/freebsd/pull/412
2019-09-28 08:57:29 +00:00
Tai-hwa Liang 923263dddd MFC r338200: Adding device ID for Terratec SiXPack 5.1+. 2018-12-26 04:06:16 +00:00
Hans Petter Selasky e28fe2d8a7 MFC r339582:
Drop sequencer mutex around uiomove() and make sure we don't move more bytes
than is available, else a panic might happen.

Found by:		Peter Holm <[email protected]>
Sponsored by:		Mellanox Technologies
2018-10-25 15:02:06 +00:00
Hans Petter Selasky 8d27d23671 MFC r339581:
Fix off-by-one which can lead to panics.

Found by:		Peter Holm <[email protected]>
Sponsored by:		Mellanox Technologies
2018-10-25 14:38:03 +00:00
Dimitry Andric e837bd8d02 MFC r309748 (by glebius):
Treat R_X86_64_PLT32 relocs as R_X86_64_PC32.

If we load a binary that is designed to be a library, it produces
relocatable code via assembler directives in the assembly itself
(rather than compiler options).  This emits R_X86_64_PLT32 relocations,
which are not handled by the kernel linker.

Submitted by:	gallatin
Reviewed by:	kib
PR:		231451
2018-09-18 20:46:55 +00:00
Tai-hwa Liang 8620f1555c MFC r338038: Extending the delay cycles to give the codec more time to pump ADC data across the AC-link.
Without this patch, some CS4614 cards will need users to reload the driver manually or
the hardware won't be initialised properly. Something like:

	# kldload snd_csa
	# kldunload snd_csa
	# kldload snd_csa

Tested with:	Terratec SiXPack 5.1+
2018-08-26 13:06:57 +00:00
David C Somayajulu 4b509df4b3 MFC r336438
Fixes for  the following issues:
1. Fix taskqueues drain/free to fix panic seen when interface is being
   bought down and in parallel asynchronous link events happening.

2. Fix bxe_ifmedia_status()

Submitted by:[email protected] and [email protected]
2018-08-09 00:56:40 +00:00
David C Somayajulu cf0b39f604 MFC r333004
Fix Issue with adding MUltiCast Addresses. When multicast addresses are
added/deleted, the delete the multicast addresses previously programmed
in HW and reprogram the new set of multicast addresses.

Submitted by:	[email protected]
2018-05-09 20:49:50 +00:00
Jung-uk Kim f844b0f31f MFS: r295060, r296462, r296597-296598, r299053, r306229, r306335, r308200
Sync. OpenSSL with stable/9.

r295060 (delphij):
Fix OpenSSL SSLv2 ciphersuite downgrade vulnerability. [SA-16:11]

r296462, r296597-296598 (delphij):
Fix multiple OpenSSL vulnerabilities. [SA-16:12]

r299053 (delphij):
Fix several OpenSSL vulnerabilities. [SA-16:17]

r306229, r306335 (delphij):
Fix multiple OpenSSL vulnerabilities. [SA-16:26]

r308200 (delphij):
Fix OpenSSL remote DoS vulnerability. [SA-16:35]

Requested by:	danfe
2018-01-04 01:21:24 +00:00
Jung-uk Kim 853ed450d7 Merge OpenSSL 0.9.8zh.
Requested by:	danfe
2018-01-04 00:58:30 +00:00
Alexey Dokuchaev 563c12e70d MFC r301291:
libiberty: prevent integer overflow.

  Take care of very old bug leading to heap-buffer overflow by
  processing certain file headers via bfd binary.

  PR:		200888
  Obtained from:	OpenBSD

Approved by:	pfg
2017-12-12 12:59:04 +00:00
Hans Petter Selasky 33d01214e8 MFC r326362:
Disallow TUN and TAP character device IOCTLs to modify the network device
type to any value. This can cause page faults and panics due to accessing
uninitialized fields in the "struct ifnet" which are specific to the network
device type.

Found by:	[email protected]
PR:		223767
Sponsored by:	Mellanox Technologies
2017-12-08 15:37:36 +00:00
Hans Petter Selasky da49da4b71 MFC r318860:
Declare the "snd_fxdiv_table" once. This shaves around 24Kbytes of
binary data from sound.ko and the kernel.
2017-05-28 10:46:34 +00:00
Hans Petter Selasky af13472523 MFC r318820:
Increase the allowed maximum number of audio channels from 31 to 127
in the PCM feeder mixer. Without this change a value of 32 channels is
treated like zero, due to using a mask of 0x1f, causing a kernel
assert when trying to playback bitperfect 32-channel audio. Also
update the AWK script which is generating the division tables to
handle more than 18 channels. This commit complements r282650.
2017-05-27 08:30:32 +00:00
Hans Petter Selasky b1c87a9e6b MFC r317584:
Correct manual page link to usbdi(9).
2017-05-16 07:24:09 +00:00
Ian Lepore 7e8a52266e MFC r230208, r230252, r234346:
Add nfs export support to tmpfs(5)

  Return EOPNOTSUPP since we only support update mounts for NFS export.

  tmpfs: Allow update mounts only for certain options.
  Since r230208 update mounts were allowed if the list of mount options
  contained the "export" option. This is not correct as tmpfs doesn't really
  support updating all options.
2017-05-06 16:06:33 +00:00
David C Somayajulu 13bd511686 MFC r314365
1. state checks in bxe_tx_mq_start_locked() and bxe_tx_mq_start() to
         sync threads during interface down or detach.
      2. add sysctl to set pause frame parameters
      3. increase max segs for TSO packets to BXE_TSO_MAX_SEGMENTS (32)
      4. add debug messages for PHY
      5. HW LRO support restricted to FreeBSD versions 8.x and above.

Submitted by:	[email protected]
2017-03-24 03:30:54 +00:00
Hans Petter Selasky c943fb9451 MFC r314328:
Fix startup race initialising ACPI CM battery structures on MacBookPro.

During acpi_cmbat_attach() the acpi_cmbat_init_battery() notification
handler is registered. It has been observed this notification handler
can be called instantly, before the attach routine has returned. In
the notification handler there is a call to device_is_attached() which
returns false. Because the softc is set we know an attach is in
progress and the fix is simply to wait and try again in this case.

Reviewed by:		avg @
2017-03-14 15:58:01 +00:00
Hans Petter Selasky d19861402f MFC r313941:
Make sure the thread constructor and destructor eventhandlers are
called for all threads belonging to a procedure. Currently the first
thread in a procedure is kept around as an optimisation step and is
never freed. Because the first thread in a procedure is never freed
nor allocated, its destructor and constructor callbacks are never
called which means per thread structures allocated by dtrace and the
Linux emulation layers for example, might be present for threads which
don't need these structures.

This patch adds a thread construction and destruction call for the
first thread in a procedure.

Tested:			dtrace, linux emulation
Reviewed by:		kib @
Sponsored by:		Mellanox Technologies
2017-03-14 15:53:24 +00:00
Martin Matuska 2f9eb63eee MFC r314572:
Fix null pointer dereference in zfs_freebsd_setacl().

Prevents unprivileged users from panicking the kernel by calling
__acl_delete_*() on files or directories inside a ZFS mount.
2017-03-05 21:44:29 +00:00
Hans Petter Selasky 16bcbf27a7 MFC r309400:
Fix for endless recursion in the ACPI GPE handler during boot.

When handling a GPE ACPI interrupt object the EcSpaceHandler()
function can be called which checks the EC_EVENT_SCI bit and then
recurse on the EcGpeQueryHandler() function. If there are multiple GPE
events pending the EC_EVENT_SCI bit will be set at the next call to
EcSpaceHandler() causing it to recurse again via the
EcGpeQueryHandler() function. This leads to a slow never ending
recursion during boot which prevents proper system startup, because
the EC_EVENT_SCI bit never gets cleared in this scenario.

The behaviour is reproducible with the ALASKA AMI in combination with
a newer Skylake based mainboard in the following way:

Enter BIOS and adjust the clock one hour forward. Save and exit the
BIOS. System fails to boot due to the above mentioned bug in
EcGpeQueryHandler() which was observed recursing multiple times.

This patch adds a simple recursion guard to the EcGpeQueryHandler()
function and also also adds logic to detect if new GPE events occurred
during the execution of EcGpeQueryHandler() and then loop on this
function instead of recursing.

Reviewed by:		jhb
2016-12-19 10:00:56 +00:00
Hans Petter Selasky ebd60d5f50 MFC r308437 and r308461:
Range check the jitter values to avoid bogus sample rate adjustments.
The expected deviation should not be more than 1Hz per second. The USB
v2.0 specification also mandates this requirement. Refer to chapter
5.12.4.2 about feedback.

Allow higher sample rates to have more jitter than lower ones.

PR:		208791
2016-11-12 17:36:28 +00:00
Hans Petter Selasky 175a986844 MFC r307518:
Fix device delete child function.

When detaching device trees parent devices must be detached prior to
detaching its children. This is because parent devices can have
pointers to the child devices in their softcs which are not
invalidated by device_delete_child(). This can cause use after free
issues and panic().

Device drivers implementing trees, must ensure its detach function
detaches or deletes all its children before returning.

While at it remove now redundant device_detach() calls before
device_delete_child() and device_delete_children(), mostly in
the USB controller drivers.

Tested by:		Jan Henrik Sylvester <[email protected]>
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D8070
2016-11-07 09:27:05 +00:00
Hans Petter Selasky 1ba148867d MFC r308144 and r308165:
Fixes for virtual T-axis buttons.

Make sure the virtual T-axis buttons gets cleared for USB mice which has
less than 6 buttons.

Make sure the virtual T-axis buttons generate button release event(s)
for continuous tilting.

PR:	213919
PR:	213957
2016-11-07 08:18:51 +00:00
Hans Petter Selasky 7dec109bc1 MFC r306478:
Add new USB ID.

While at it remove some whitespaces.

Submitted by:	Jose Luis Duran <[email protected]>
PR:		213110
2016-10-10 11:49:43 +00:00
Hans Petter Selasky adb97d5831 MFC r305590:
Correctly map the USB mouse tilt delta values into buttons 5 and 6
instead of 3 and 4 which is used for the scroll wheel, according to
X.org.

PR:		170358
2016-09-15 08:38:53 +00:00
Hans Petter Selasky 2bb33dd777 MFC r305421:
Resolve deadlock between device_detach() and usbd_do_request_flags()
by reviving the SX control request lock and refining which lock
protects the common scratch area in "struct usb_device".

The SX control request lock was removed by r246759 because it caused a
lock order reversal with the USB enumeration lock inside
usbd_transfer_setup() as a function of r246616. It was thought that
reducing the number of locks would resolve the LOR, but because some
USB device drivers use usbd_do_request_flags() inside callback
functions, like in taskqueues, a deadlock may occur when these are
drained from device_detach(). By restoring the SX control request
lock usbd_do_request_flags() is allowed to complete its execution
when a USB device driver is detaching. By using the SX control request
lock to protect the scratch area, the LOR introduced by r246616 is
also resolved.

Bump the FreeBSD version while at it to force recompilation of all USB
kernel modules.

Found by:	avos@
2016-09-12 10:23:24 +00:00
Hans Petter Selasky 02a0b99cd0 MFC r303765 and r304571:
Keep a reference count on USB keyboard polling to allow recursive
cngrab() during a panic for example, similar to what the AT-keyboard
driver is doing.

Make the UKBD USB transfers double buffered and set them up one by one,
so they are memory independent which allows for handling panics
triggered by the keyboard driver itself, typically via CTRL+ALT+ESC
sequences. Or if the USB keyboard driver was processing a key at the
moment of panic. Allow UKBD to be attached while keyboard polling is active.
2016-09-09 06:51:49 +00:00
Hans Petter Selasky 5b4770cc13 MFC r305284:
Fix array size issue when using the pre-scaling feature for
ISOCHRONOUS USB transfers. Make sure enough length and buffer pointers
are allocated when setting up the libusb transfer structure to support
the maximum number of frames the kernel can handle.
2016-09-09 06:33:56 +00:00
Hans Petter Selasky dd17db0b09 MFC r304629:
Don't separate the status stage of the XHCI USB control transfers into
its own job because this breaks the simplified QEMU XHCI TRB parser,
which expects the complete USB control transfer as a series of back to
back TRBs. The old behaviour is kept under #ifdef in case this change
breaks enumeration of any USB devices.

PR:		212021
2016-08-29 08:55:59 +00:00
Hans Petter Selasky 26b787116e MFC r304597:
Fix for invalid use of bits in input context. Basically split
configuring of EP0 and non-EP0 into xhci_cmd_evaluate_ctx() and
xhci_cmd_configure_ep() respectivly. This resolves some errors when
using XHCI under QEMU and gets is more in line with the XHCI
specification.

PR:		212021
2016-08-29 08:46:15 +00:00
John Baldwin 1f65581b7d MFC 298950: Fix an off by one error when remapping MSI-X vectors.
pci_remap_msix() can be used to alter the mapping of allocated
MSI-X vectors to the MSI-X table.  The code had an off by one error
when adding the IRQ resources after performing a remap.  This was
fatal for any vectors in the table that used the "last" valid IRQ as
those vectors were assigned a garbage IRQ value.
2016-08-20 00:22:39 +00:00
Hans Petter Selasky f7bf0c8e6f MFC r302371:
Fix regression issue with XHCI on 32-bit ARMv7 Armada-38x. Make sure
"struct xhci_dev_ctx_addr" fits into a single 4K page until further.
2016-08-12 08:08:29 +00:00
Hans Petter Selasky 8c1a8a7b98 MFC r301039:
Add support for simplex USB MIDI devices, which only provide BULK or
INTERRUPT endpoints for moving data in one direction, like the KeyRig
49 from M-Audio.

Requested by:	Ivan Klymenko <[email protected]>
2016-08-12 08:03:31 +00:00
Hans Petter Selasky de6e36c8d6 MFC r301842:
Implement code to stop all USB endpoints before executing a USB device
reset command, alternate setting command or set configuration
command. Else LibUSB v1.0 will not re-open the endpoints which the
kernel closes and the USB application might wait infinitely for
transfers to complete.
2016-06-29 10:47:44 +00:00
Hans Petter Selasky 357c8ca738 MFC r302076:
Update the definition for number of scratch pages to match the latest
version of the XHCI specification. Make sure the code can handle the
maximum number of allowed scratch pages.

Submitted by:	[email protected]
2016-06-29 10:25:32 +00:00
Hans Petter Selasky 22523b3a7a MFC r300667:
Check for signals when locking the USB enumeration thread from
userspace, so that USB applications can be killed if an enumeration
thread should be stuck for various reasons.
2016-06-03 08:58:26 +00:00
Hans Petter Selasky 6fbb70afb8 MFC r299060:
Extend the UQ_NO_STRINGS quirk to also cover the USB language string
descriptor. This fixes enumeration of some older Samsung Galaxy S3
phones.
2016-06-03 08:53:14 +00:00
John Baldwin 32a6d64c41 MFC 299310:
Don't store generated firmware object files in the source directory.

Trim the leading directory of a firmware source file from the resulting
target object file name so the object file is stored in the object
directory. Previously, using 'FIRMWS= /path/to/fw.bin:fw.bin' would
store the generated 'fw.bin.fwo' file in the /path/to directory. Now
it stores it in the object directory of the kernel module being built.
2016-05-24 23:04:16 +00:00
David C Somayajulu f08798cea7 MFC r298591
1. Removed -Wno-shift-negative-value from Makefile
2. Fixed warning its absence caused in bxe_elink.c
2016-05-10 03:11:37 +00:00
David C Somayajulu 3861aa4a83 MFC r298496
Remove Unused/Dead Code
2016-05-10 03:04:14 +00:00
David C Somayajulu f5c6c7edd9 MFC r298294
1. modify fwdump (a.k.a grcdump) so that grcdump memory is allocated
   and freed on as needed basis.
2. grcdump can be taken at failure points by invoking bxe_grc_dump()
   when trigger_grcdump sysctl flag is set. When grcdump is taken
   grcdump_done sysctl flag is set.
3. grcdump_done can be monitored by the user to retrieve the grcdump

Submitted by:[email protected]
2016-05-10 02:58:52 +00:00
Alexey Dokuchaev 89af640651 MFC r270256, r298640:
ed(1): switch two statements so we check the index before dereferencing.

Approved by:	pfg
2016-04-29 13:58:01 +00:00
David C Somayajulu 0c318c36db MFC r297884
Add support for Flash Update

Submitted by:[email protected];[email protected];[email protected]
2016-04-19 19:14:04 +00:00
David C Somayajulu 9768d0a1ec MFC r297873
1. Process tx completions in bxe_periodic_callout_func() and restart
   transmissions if possible.
2. For SIOCSIFFLAGS call bxe_init_locked() only if !BXE_STATE_DISABLED
3. remove code not needed in bxe_init_internal_common()

Submitted by:[email protected];[email protected]
2016-04-19 19:08:44 +00:00
Hans Petter Selasky 206d01575b MFC r296342:
Allow for overlapping quirk device ranges. Prior to this patch only
the first device entry matching the USB vendor, product and revision
would be searched for quirks. After this patch all device entries will
be searched for quirks.
2016-04-07 07:19:30 +00:00
David C Somayajulu 44493b0813 MFC r297155
Modifications to achieve a common source base from FreeBSD7.x thru 10.x
2016-04-06 21:45:31 +00:00
Ian Lepore 2ea2edffe1 When building on a newer host, boostrap using lex from the stable-8 source
to match the yacc being used from that source.  This avoids a build error
caused by the newer lex emitting a yylex() decl that's already in the source.

This is a direct commit to stable-8; there is no corresponding change in
later branches to MFC from.  For the record, the new lex came in at version
1000032, but slipping it into the 1000013 block makes more sense than
creating a whole new .if block for it.
2016-03-15 04:03:15 +00:00
Ian Lepore 08ff8965e7 MFC r206424: (by rdivacky in 2010)
Rename the ALIGN macro to LINT_ALIGN so it does not clash with
  machine/param.h

  Bump the alignment to 16bytes because lint1 memory allocator is used for
  objects that require 16bytes alignment on amd64 (ie. val_t). This makes
  lint1 work when compiled with compiler(s) that use SSE for memcpy on amd64.
  (e.g. clang).

This allows me to compile stable-8 on a 64-bit build host running 10-stable,
without dying during the xlint build.  It should work fine on 11-current too.
2016-03-15 03:20:24 +00:00
David C Somayajulu bc83d146ec MFC r296579
Fix code so that buf_ring allocation for Tx Queues and their mutexes
is done during during bxe_attach() and freed during bxe_detach()
2016-03-14 23:43:09 +00:00
David C Somayajulu 26503a7792 MFC r296071
Upgrade the firmware carried in driver and loaded during hardware
initialization (a.k.a STORM firmware) to version 7.13.1 (latest version)
2016-03-09 21:45:09 +00:00
Hans Petter Selasky 87f6067715 MFC r295928:
Configure the correct bMaxPacketSize for control endpoints before
requesting the initial complete device descriptor and not as part of
the subsequent babble error recovery. Babble means that the received
USB packet was bigger than than configured maximum packet size. This
only affects enumeration of FULL speed USB devices which use a
bMaxPacketSize different from 8 bytes. This patch might help fix
enumeration of USB devices which exhibit USB I/O errors in dmesg
during boot.
2016-03-07 10:07:01 +00:00
Ian Lepore 7f4d5e789e MFC r255949: Create /var/cache with mode 0755.
pkg(8) expects this directory to exist, this allows using pkg on 8-stable.
2016-03-01 17:33:27 +00:00
David C Somayajulu 9d7bd55aa4 MFC r295830
Remove dead code. Code Cleanup. Improve clarity in debug messages
2016-02-25 18:20:54 +00:00
David C Somayajulu 89491084f0 MFC r295823
Modified the use of bxe_grc_dump() function so that it can be invoked directly at any potential error path, where a fwdump is needed. The fwdump (a.k.a grcdump) is stored in a driver buffer. The sysctl grcdump_done indicates if a fwdump was taken and waiting to be retrieved.
The sysctl trigger_grcdump can be used to manually trigger a fwdump.
2016-02-25 18:17:06 +00:00
John Baldwin ff0ca0af8a MFC 295418,295419:
Fix hangs or panics when misbehaved kernel threads return from their
main function.

295418:
Mark proc0 as a kernel process via the P_KTHREAD flag.

All other kernel processes have this flag set and all threads in proc0
(including thread0) have the similar TDP_KTHREAD flag set.

295419:
Call kthread_exit() rather than kproc_exit() for a premature kthread exit.

Kernel threads (and processes) are supposed to call kthread_exit() (or
kproc_exit()) to terminate.  However, the kernel includes a fallback in
fork_exit() to force a kthread exit if a kernel thread's "main" routine
returns.  This fallback was added back when the kernel only had processes
and was not updated to call kthread_exit() instead of kproc_exit() when
threads were added to the kernel.

This mistake was particularly exciting when the errant thread belonged to
proc0.  Due to the missing P_KTHREAD flag the fallback did not kick in
and instead tried to return to userland via whatever garbage was in the
trapframe.  With P_KTHREAD set it tried to terminate proc0 resulting in
other amusements.

PR:		204999
2016-02-17 01:45:34 +00:00
Brooks Davis 65ef8d1f4c MFC r293856:
Avoid reading pass the end of the source buffer when it is not NUL
terminated.

If this buffer is adjacent to an unmapped page or a version of C with
bounds checked is used this may result in a crash.

PR:		206178
Submitted by:	Alexander Cherepanov <[email protected]>
Requested by:	danfe
2016-01-22 00:13:18 +00:00
Brooks Davis fa6179d17d MFC r293855:
Avoid reading pass the end of the source buffer when it is not NUL
terminated.

If this buffer is adjacent to an unmapped page or a version of C with
bounds checked is used this may result in a crash.

PR:		206177
Submitted by:	Alexander Cherepanov <[email protected]>
Requested by:	danfe
2016-01-22 00:08:16 +00:00
Dimitry Andric d2c9473e29 MFC r294102:
MFV r294101: 6527 Possible access beyond end of string in zpool comment

Reviewed by: George Wilson <[email protected]>
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Dan McDonald <[email protected]>
Approved by: Gordon Ross <[email protected]>

illumos/illumos-gate@2bd7a8d078

This fixes erroneous double increments of the 'check' variable in a loop
in spa_prop_validate().  I ran into this in the clang380-import branch,
where clang 3.8.0 warns about it.  (It is already fixed there.)
2016-01-19 18:35:22 +00:00
David C Somayajulu f4d7eb1029 MFC r292639
Add support for firmware dump (a.k.a grcdump)
2016-01-13 00:34:16 +00:00
David C Somayajulu e732602bd9 MFC r292638
Check for packet_length is greater than 60 bytes as well as packet_length is
    greater than len_on_bd, before invoking the routine to handle jumbo over SGL
    (bxe_service_rxsgl()).
    Add counters for number of jumbo_over_SGL packets (rx_bxe_service_rxsgl) and
    erroneous jumbo_over_SGL packets (rx_erroneous_jumbo_sge_pkts)

    Fix formatting in bxe_sysctl_state()
2016-01-13 00:29:59 +00:00
David C Somayajulu 113176c7df MFC r289199
Add support for reading device temperature
2016-01-13 00:26:45 +00:00
Hans Petter Selasky 384377e078 MFC r291199:
Fix compile warning about shifting signed negative constant.
2016-01-04 07:30:49 +00:00
Christian Brueffer c3b2316c17 MFH: r207615 by csjp
Add a case to make sure that internal audit records get converted
to BSM format for lpathconf(2) events.

PR:		157946
2015-12-14 13:38:05 +00:00
Hans Petter Selasky b21bd3ba13 MFC r291146:
Add support for Kana and Eisu keys to the USB keyboard driver.

PR:		204709
2015-11-24 12:32:15 +00:00
Hans Petter Selasky 82b529798b MFC r290326:
Relax the BUS_DMA_KEEP_PG_OFFSET requirement to allow optimising
allocation of DMA bounce buffers.

Discussed with:	ian @
2015-11-24 12:23:15 +00:00
Hans Petter Selasky 4eadc15dc5 MFC r284722 and r284724:
Fix endless recursion in ti(4)'s ti_ifmedia_upd(), found by clang 3.7.0.
2015-11-23 13:44:25 +00:00
Edwin Groothuis d0e0194c1b MFC of 290697,tzdata8:
Update to tzdata2015g:

Turkey's 2015 fall-back transition is scheduled for Nov. 8, not Oct. 25.

Norfolk moves from +1130 to +1100 on 2015-10-04 at 02:00 local time.

Fiji's 2016 fall-back transition is scheduled for January 17, not 24.

Fort Nelson, British Columbia will not fall back on 2015-11-01.  It has
effectively been on MST (-0700) since it advanced its clocks on 2015-03-08.
New zone America/Fort_Nelson.
2015-11-12 03:29:36 +00:00
Hans Petter Selasky 5c85d06743 MFC r290441:
Fix for unaligned IP-header.

The mbuf length fields must be set before m_adj() is called else
m_adj() will not always adjust the mbuf and an unaligned read
exception can trigger inside the network stack. This can happen on
platforms where unaligned reads are not supported. Adjust a length
check to include the 2-byte ethernet alignment while at it.
2015-11-09 11:29:54 +00:00
Tai-hwa Liang 3ff71d94e7 MFC r287698: Fixing a memory leak on module unloading. 2015-10-24 19:05:19 +00:00
Tai-hwa Liang 890be803e7 MFC r238980:
Just like the other file systems found in /sys/fs, g_vfs_open()
should be paried with g_vfs_close().  Though g_vfs_close() is a wrapper
around g_wither_geom_close(), r206130 added the following test in
g_vfs_open():

	if (bo->bo_private != vp)
		return (EBUSY);

  Which will cause a 'Device busy' error inside reiserfs_mountfs() if
the same file system is re-mounted again after umount or mounting failure:

	(case 1, /dev/ad4s3 is not a valid REISERFS partition)
	# mount -t reiserfs -o ro /dev/ad4s3 /mnt
	mount: /dev/ad4s3: Invalid argument
	# mount -t msdosfs -o ro /dev/ad4s3 /mnt
	mount: /dev/ad4s3: Device busy

	(case 2, /dev/ad4s3 is a valid REISERFS partition)
	# mount -t reiserfs -o ro /dev/ad4s3 /mnt
	# umount /mnt
	# mount -t reiserfs -o ro /dev/ad4s3 /mnt
	mount: /dev/ad4s3: Device busy

  On the other hand, g_vfs_close() 'fixed' the above cases by doing an
extra step to keep 'sc->sc_bo->bo_private' and 'cp->private' pointers
synchronised.

Reviewed by:	kib
2015-10-07 09:39:45 +00:00
Steven Hartland 5b71bfa7ef MFC r287886:
Fix kqueue write events for files > 2GB

Relnotes:	YES
Sponsored by:	Multiplay
2015-09-24 10:31:39 +00:00
Tai-hwa Liang 7503a2271d MFC r286888: Using consistent coding style to deal with error inside the loop. 2015-09-14 15:47:25 +00:00
Tai-hwa Liang aed16db3e2 MFC r286887: Using the error return code documented in the comment.
Though there is no direct midi_uninit() caller amongst existing drivers
at this moment, a quick experiment indicates that EBUSY gives users more
precise error message once drivers start to honour this result.  For example,
emu_midi_detach() should check the result of mpu401_uninit() and block
module unloading if there is any MIDI I/O in progress.
2015-09-14 15:44:03 +00:00
Tai-hwa Liang be13e79e1f MFC r286886: Fixing typo as well as improving readability of a few comments. 2015-09-09 04:16:55 +00:00
Hans Petter Selasky 3c47c24cd5 MFC r286799:
Fix race in USB PF which can happen if we stop tracing exactly when
the kernel is tapping an USB transfer. This leads to a NULL pointer
access. The solution is to only trace while the USB bus lock is
locked.
2015-08-29 06:28:48 +00:00
Edwin Groothuis 549a2e9e5e MFC of 286750,tzdata8:
Update to tzdata2015f:

Changes affecting future time stamps

    North Korea switches to +0830 on 2015-08-15.  (Thanks to Steffen Thorsen.)
    The abbreviation remains "KST".  (Thanks to Robert Elz.)
    Uruguay no longer observes DST.  (Thanks to Steffen Thorsen and Pablo Camargo.)
    Changes affecting past and future time stamps
    Moldova starts and ends DST at 00:00 UTC, not at 01:00 UTC. (Thanks to Roman Tudos.)
2015-08-14 00:00:50 +00:00
Dimitry Andric 53a5b53e3d MFC r286519:
In GNU as, avoid left-shifting negative integers, which is undefined.
2015-08-12 19:18:54 +00:00
Dimitry Andric 66f64dc478 MFC r286515:
In libm's exp2(3), avoid left-shifting a negative integer, which is
undefined.  Replace it with the intended value, in a defined way.

Reviewed by:	bde
2015-08-12 19:06:35 +00:00
Gregory Neil Shapiro df22aa1b7e MFC: Reminder to check tools/build/mk/OptionalObsoleteFiles.inc on new
version imports.
2015-08-08 16:35:42 +00:00
David C Somayajulu 2bbd808e76 MFC r285973
- Avoid lock contention in the if_transmit callback by using trylock and
     enqueueing the frames when it fails. This way there is some latency
     removed from the transmitting path.
    - If IFF_DRV_OACTIVE is set (and also if IFF_DRV_RUNNING is not) just
     enqueue the desired frames and return successful transmit. This way we
     avoid to return errors on transmit side and resulting in
     possible out-of-order frames. Please note that IFF_DRV_OACTIVE is set
     everytime we get the threshold ring hit, so this can be happening quite
     often.

Submitted by:	[email protected]
2015-08-05 02:08:42 +00:00
Xin LI 50dc85579f Fix a regression introduced with previous OpenSSH by explicitly
initializing devices_done.

Submitted by:	jkim
2015-07-30 10:09:07 +00:00
Glen Barber 38463ac13c Document SA-15:14 through SA-15:17.
Sponsored by:	The FreeBSD Foundation
2015-07-28 20:38:52 +00:00
Xin LI 87e9a831a9 Fix resource exhaustion in TCP reassembly. [SA-15:15]
Fix OpenSSH multiple vulnerabilities. [SA-15:16]

Fix BIND remote denial of service vulnerability. [SA-15:17]
2015-07-28 19:58:54 +00:00
Dimitry Andric 263db338e6 MFC r285340:
Fix swapped copyin(9) arguments in cxgb's iwch_arm_cq() function.
Detected by clang 3.7.0 with the warning:

sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c:309:18: error: variable
'rptr' is uninitialized when used here [-Werror,-Wuninitialized]
		chp->cq.rptr = rptr;
			       ^~~~
2015-07-28 09:19:04 +00:00
Glen Barber 696a132b1f Document FreeBSD-SA-15:13.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2015-07-22 16:38:07 +00:00
Xin LI 58f81b6bea Fix resource exhaustion due to sessions stuck in LAST_ACK state.
Security:	CVE-2015-5358
Security:	SA-15:13.tcp
Submitted by:	Jonathan Looney (Juniper SIRT)
Reviewed by:	lstewart
2015-07-21 23:42:20 +00:00
Gregory Neil Shapiro 546128beff Note merge of sendmail 8.15.2 2015-07-11 04:55:01 +00:00
Gregory Neil Shapiro 2f19f4b40d Previous MFC to trigger new .cf builds didn't catch freebsd.mc. 2015-07-11 03:57:36 +00:00
Gregory Neil Shapiro a9ea7b6b1e MFC: Update for sendmail 8.15.2 import 2015-07-11 03:53:03 +00:00
Gregory Neil Shapiro a6ea98e143 MFC: Minor changes to force commit these files so new freebsd*.cf files
are built to use the new sendmail-8.15.2/cf tree.
2015-07-11 03:50:17 +00:00
Gregory Neil Shapiro 048d94d57e MFC: Merge sendmail 8.15.2 2015-07-11 03:46:36 +00:00
Gregory Neil Shapiro a1012e25d1 MFC: Temporarily disable WARNS while addressing a non-issue with the
upstream code
2015-07-11 03:34:57 +00:00
Gregory Neil Shapiro adb16b1c83 By default, sendmail 8.15 uses uncompressed IPv6 addresses. Keep
current FreeBSD 10 and earlier behavior of using compressed IPv6
addresses in configuration, maps, rulesets, etc.  (FreeBSD 11 and
later will use the new default of uncompressed IPv6 addresses.)
2015-07-11 03:32:22 +00:00
Gregory Neil Shapiro 6248784a23 MFC: libsm/path.c is about to disappear in the merge of sendmail 8.15.2. It
is an empty file now so it is safe to remove before the merge.
2015-07-11 03:29:04 +00:00
Glen Barber a5c0ae3872 Document SA-15:11.bind.
Sponsored by:	The FreeBSD Foundation
2015-07-07 23:37:16 +00:00
Xin LI 5e1b577ce6 Fix BIND resolver remote denial of service when validating.
Security:	CVE-2015-4620
Security:	FreeBSD-SA-15:11.bind
2015-07-07 21:43:23 +00:00
Marius Strobl 28475da59a MFC: r281337
Don't enable RX and TX before their initial configuration is done, i. e.
after setting up interrupt moderation but before turning interrupts on.
This matches what Realtek's r8168 Linux driver does as of version 8.039.00
and fixes problems with certain incarnations of certain MAC revisions
like the interface requiring an extra up/down-cycle after boot to start
working or DMA configuration not being adhered to.

PR:	193743, 197535
2015-07-05 20:16:51 +00:00
Marius Strobl 92855788c9 MFC: r281751
Refine the workaround for Intel HSD131 [1] added in r269052 (MFCed to
stable/8 in r269595):
- Use the full mask described by the erratum as with a sufficiently high
  number of these false-positives, the overflow bit (bit 62) additionally
  gets set [7].
- HSD131 has been brought into several other Haswell-derived CPUs including
  to the next generation, i. e. Intel Broadwell. Thus, also skip reporting of
  these benign errors by default on CPU models affected by HSM142, HSW131 and
  BDM48 [2 - 5], describing the HSD131 silicon bug for additional models.
  Also, Celeron 2955U with a CPU ID of 0x45 have been reported to be covered
  by this fault [6], with the specification update concerned with HSM142 [2]
  only referring to 0x3c and 0x46.

Submitted by:	David Froehlich [7]
Approved by:	re (kib)

http://www.intel.de/content/dam/www/public/us/en/documents/specification-updates/4th-gen-core-family-desktop-specification-update.pdf [1]
http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/4th-gen-core-family-mobile-specification-update.pdf [2]
http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/5th-gen-core-family-spec-update.pdf [3]
http://www.intel.de/content/dam/www/public/us/en/documents/specification-updates/core-m-processor-family-spec-update.pdf [4]
http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/xeon-e3-1200v3-spec-update.pdf [5]
https://lists.freebsd.org/pipermail/freebsd-hackers/2015-January/046878.html [6]
2015-07-05 19:34:45 +00:00
Glen Barber 5d53c30757 Document EN-15:08 (revised), EN-15:09, EN-15:10.
Sponsored by:	The FreeBSD Foundation
2015-07-02 20:41:50 +00:00
David C Somayajulu c6a6a2fd37 MFC r284739
tx_mtx should be grabbed before calling buf_ring_dequeue_sc()

Submitted by:	[email protected]
2015-06-30 20:31:00 +00:00
David C Somayajulu 2e61ce15aa MFC r284470
In bxe_set_mc_list(): added missing BXE_MCAST_UNLOCK()
In __ecore_vlan_mac_h_exec_pending(): need to check for ECORE_PENDING

Submitted by:	[email protected]
2015-06-30 20:28:07 +00:00
David C Somayajulu cce791833b MFC r284335
PHY LOCK acquires the hardware lock via bxe_acquire_phy_lock() and releases it via bxe_release_phy_lock(). It was simply acquiring a mutex earlier which can cause the PHY to use bogus values. Fixes intermittent link failures.

bxe_ioctl() completes all functions within its context as opposed to a taskqueue earlier.

bxe_handle_rx_mode_tq() no longer required. bxe_set_rx_mode() handles the functionality within its context

Submitted by:[email protected]
2015-06-30 20:24:23 +00:00
Glen Barber b33f12baa5 Document FreeBSD-EN-15:06.file, FreeBSD-EN-15:07.zfs,
FreeBSD-EN-15:08.sendmail, FreeBSD-SA-15:10.openssl.

Sponsored by:	The FreeBSD Foundation
2015-06-25 20:01:27 +00:00
Gregory Neil Shapiro f9652d8f41 Add a note on the second sendmail fix for WeakDH interoperability. 2015-06-25 01:57:47 +00:00
Gregory Neil Shapiro de78d252c9 MFC: An additional fix for the openssl Weak DH remediation:
The import of openssl to address the FreeBSD-SA-15:10.openssl security
     advisory includes a change which rejects handshakes with DH parameters
     below 768 bits.  sendmail releases prior to 8.15.2 (not yet released),
     defaulted to a 512 bit DH parameter setting for client connections.

     The first fix committed last week changed the default to 1024 bits.

     This commit fixes the case where the DHParameters option is set to a
     file which doesn't exist, which is the case on newer versions of
     FreeBSD which enable STARTTLS by default by auto-creating TLS
     certificates.
2015-06-25 01:56:36 +00:00
Xin LI ec51edce97 MFC r284237,r284277:
file 5.23.
2015-06-24 23:05:17 +00:00
Dimitry Andric 125ff53fa1 MFC r284346:
Fix the following clang 3.7.0 warnings in lib/libfetch/http.c:

    lib/libfetch/http.c:1628:26: error: address of array 'purl->user'
    will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
                                    aparams.user = purl->user ?
                                                   ~~~~~~^~~~ ~
    lib/libfetch/http.c:1630:30: error: address of array 'purl->pwd'
    will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
                                    aparams.password = purl->pwd?
                                                       ~~~~~~^~~~
    lib/libfetch/http.c:1657:25: error: address of array 'url->user'
    will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
                                    aparams.user = url->user ?
                                                   ~~~~~^~~~ ~
    lib/libfetch/http.c:1659:29: error: address of array 'url->pwd'
    will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
                                    aparams.password = url->pwd ?
                                                       ~~~~~^~~ ~
    lib/libfetch/http.c:1669:25: error: address of array 'url->user'
    will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
                                    aparams.user = url->user ?
                                                   ~~~~~^~~~ ~
    lib/libfetch/http.c:1671:29: error: address of array 'url->pwd'
    will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
                                    aparams.password = url->pwd ?
                                                       ~~~~~^~~ ~

Since url->user and url->pwd are arrays, they can never be NULL, so the
checks can be removed.

Reviewed by:	bapt
Differential Revision: https://reviews.freebsd.org/D2673
2015-06-20 13:30:09 +00:00
Hajimu UMEMOTO 979a523722 MFC r284229: Add support for '_' occurring at the beginning or
end of a name component.

PR:		176093
Submitted by:	landonf__at__bikemonkey.org
2015-06-18 16:46:40 +00:00
Hans Petter Selasky 33568f0cba MFC r284011:
Don't wait forever for USB data to be flushed.
2015-06-17 07:38:50 +00:00
Gregory Neil Shapiro c5a7ad1af2 Add a note regarding the change to sendmail'c default DH parameter size
for client connections.
2015-06-17 03:23:45 +00:00
Gregory Neil Shapiro ccd48af50d MFC: The import of openssl to address the FreeBSD-SA-15:10.openssl security
advisory includes a change which rejects handshakes with DH parameters
     below 768 bits.  sendmail releases prior to 8.15.2 (not yet released),
     defaulted to a 512 bit DH parameter setting for client connections.
     This commit chages that default to 1024 bits.  sendmail 8.15.2, when
     released well use a default of 2048 bits.
2015-06-17 03:22:18 +00:00
Edwin Groothuis aeb33f99fa MFC of 284397,tzdata8:
Update to tzdata2015e:

  Changes affecting future time stamps

    Morocco will suspend DST from 2015-06-14 03:00 through 2015-07-19 02:00,
    not 06-13 and 07-18 as we had guessed.  (Thanks to Milamber.)

    Assume Cayman Islands will observe DST starting next year, using US rules.
    Although it isn't guaranteed, it is the most likely.
2015-06-15 01:03:21 +00:00
Jung-uk Kim 0ce0dd18b3 Merge OpenSSL 0.9.8zg. 2015-06-11 19:39:27 +00:00
John Baldwin da5f850bd5 MFC 281887:
Reassign copyright statements on several files from Advanced
Computing Technologies LLC to Hudson River Trading LLC.
2015-06-02 19:20:39 +00:00
John Baldwin d02dabf1a2 MFC 282417:
Various updates to the ftruncate(2) documentation:
- Note that ftruncate(2) can operate on shared memory objects and cross
  reference shm_open(2).
- Note that ftruncate(2) does not change the file position pointer (aka
  seek pointer) of the file descriptor.
- ftruncate(2) will fail with EINVAL for all sorts of other fd types than
  just sockets, so instead note that it fails for all but regular files and
  shared memory objects.
- Note that ftruncate(2) also appeared in 4.2BSD along with truncate(2).
  (Or at least the manpage for both appeared in 4.2, I did not check the
  kernel code itself to see if either predated 4.2.)

PR:		199472
2015-06-02 15:12:33 +00:00
John Baldwin 9f82cae78a MFC 281170:
vfork() first appeared in 3BSD which pre-dates 2.9BSD.  Verified via the
copy of 3BSD on disc 1 of "The CSRG Archives".

PR:		198612
2015-06-02 15:02:28 +00:00
Jung-uk Kim 30d1cfb8c0 MFC: r283261
Do not probe Intel PIIX4 south bridge quirks on amd64.
2015-06-01 19:26:24 +00:00
David C Somayajulu 013b2a3ff4 MFC r283274
Submitted by:[email protected]
2015-05-29 23:33:49 +00:00
David C Somayajulu 2f07f0a99a MFC r283269
Submitted by:	[email protected]
Approved by:[email protected]
2015-05-29 23:28:55 +00:00
Dimitry Andric 3ae66ca837 MFC r283254:
Ensure that the static structs emitted by the MODULE_DEPEND() and
MODULE_VERSION() macros don't end up as .comm symbols, when all the
version fields are zero.

Normally, such symbols will end up in .bss, but for kernel module
version objects, this can lead to "garbage" version numbers.

Fix this by instructing the compiler to always put these structs in the
.data segment instead.

Reported by:	delphij, ae
2015-05-28 06:45:13 +00:00
Hans Petter Selasky cc2c2bc955 MFC r283064:
Fix an off-by-one error by adding proper range checks when parsing the
HDA association descriptors. This fixes a crash during device probe
for some HDA PCI devices.
2015-05-27 13:27:39 +00:00
Hans Petter Selasky ba5d771459 MFC r282652:
Ensure the USB audio driver doesn't attach twice on the same USB
device by grabbing all the USB audio device interfaces.
2015-05-21 07:09:19 +00:00
Xin LI 6d813cdf6f MFC: file 5.22. 2015-05-19 23:53:25 +00:00
Edwin Groothuis 604e415e45 MFC of 283079,tzdata8:
Update to tzdata2015d:

Release 2015d - 2015-04-24 08:09:46 -0700

  Changes affecting future time stamps

    Egypt will not observe DST in 2015 and will consider canceling it
    permanently.  For now, assume no DST indefinitely.
    (Thanks to Ahmed Nazmy and Tim Parenti.)

  Change affecting past and future time zone abbreviations

    The abbreviations for Hawaii-Aleutian standard and daylight times
    have been changed from HAST/HADT to HST/HDT, as per US Government
    Printing Office style.  This affects only America/Adak since 1983,
    as America/Honolulu was already using the new style.
2015-05-18 21:18:44 +00:00
Edwin Groothuis 08fc0188f6 MFC of 283042,tzdata8:
Update to tzdata2015c:

    Release 2015c - 2015-04-11 08:55:55 -0700

    Changes affecting future time stamps

    Egypt's spring-forward transition is at 24:00 on April's last Thursday,
    not 00:00 on April's last Friday.  2015's transition will therefore be on
    Thursday, April 30 at 24:00, not Friday, April 24 at 00:00.  Similar fixes
    apply to 2026, 2037, 2043, etc.  (Thanks to Steffen Thorsen.)
2015-05-18 02:10:19 +00:00
Glen Barber f238fba0da Document EN-15:04 and EN-15:05.
Sponsored by:	The FreeBSD Foundation
2015-05-14 04:05:34 +00:00
Xin LI 0607080363 MFC: Sync freebsd-update with -HEAD. 2015-05-13 22:39:29 +00:00
Hans Petter Selasky ddf31e9079 MFC r280598:
Add definition of the ISOCHRONOUS endpoint usage bits.
Refer to the USB v2.0 specification for more information.
2015-05-05 20:01:28 +00:00
Bryan Drewery 5102674f90 MFC r281582:
Remove extra flags from r250462.
2015-04-23 15:26:07 +00:00
Bryan Drewery 8848c17097 MFC r280999:
Use proper CHAN_TCP_PACKET_DEFAULT for agent forwarding when HPN disabled.
2015-04-23 15:21:47 +00:00
Glen Barber 6b2fab0b7a Document SA-15:07, SA-15:08, SA-15:09.
Sponsored by:	The FreeBSD Foundation
2015-04-21 16:54:21 +00:00
Brooks Davis f646e0a109 MFC r281605,281768:
r281605:
	Fix a minor function definition inconsistancy.

r281768:
	Bump doc date missed in r281605.
2015-04-21 15:00:49 +00:00
Jung-uk Kim 5b8eced322 MFC: r281331
Do not crash when RSDT/XSDT contains an empty entry.
2015-04-13 22:22:32 +00:00
Jung-uk Kim c933bb5343 MFC: r281171
Tidy up battery status information.  Remove a trailing white space.

PR:		193671
2015-04-11 01:17:19 +00:00
Alexander Motin e55013d9b5 MFC r280757: Remove request sorting from GEOM_MIRROR and GEOM_RAID.
When CPU is not busy, those queues are typically empty.  When CPU is busy,
then one more extra sorting is the last thing it needs.  If specific device
(HDD) really needs sorting, then it will be done later by CAM.

This supposed to fix livelock reported for mirror of two SSDs, when UFS
fires zillion of BIO_DELETE requests, that totally blocks I/O subsystem by
pointless sorting of requests and responses under single mutex lock.
2015-04-10 00:44:43 +00:00
Xin LI 40c750a173 Improve patch for SA-15:04.igmp to solve a potential buffer overflow.
Fix multiple vulnerabilities of ntp. [SA-15:07]

Fix Denial of Service with IPv6 Router Advertisements. [SA-15:09]
2015-04-07 20:20:44 +00:00
David C Somayajulu 6004b3d4b5 MFC r281006
When an mbuf allocation fails in the receive path, the mbuf containing the received packet is not sent to the host network stack and is reused again on the receive ring.  Remaining received packets in the ring are not processed in that invocation of bxe_rxeof() and defered to the task thread
2015-04-07 18:10:58 +00:00
Bryan Drewery 51fead8b25 MFC r280178:
Unhide linker line for libraries.
2015-04-03 17:54:48 +00:00
Bryan Drewery 4b1ae5f481 MFC r280177:
Remove unneeded handling of undefined NM.
2015-04-03 17:49:15 +00:00
Bryan Drewery 3e8aeb7cb1 MFC r278530:
When catopen(3) returns an error, it caches the result of that error from
  r202992. The refcount on the cache entry is not initialized, so any attempt
  to clean the cache will skip over this item since it likely has a >0 value.

  This change is currently a NOP.
2015-04-03 17:18:05 +00:00
Bryan Drewery 95348c1cc9 MFC r272291:
Document [EPERM] for UNIX sockets.
2015-04-03 17:14:19 +00:00
Hans Petter Selasky 9315c09363 MFC r280262 and r280263:
Add more known bugs to the USB audio manual page.
2015-03-26 10:27:39 +00:00
Glen Barber 17dbd2472a Document SA-15:06.
Sponsored by:	The FreeBSD Foundation
2015-03-25 17:58:44 +00:00
Hans Petter Selasky a46778dc8a MFC r280322 and r280429:
The synchronisation value returned by the so-called feedback endpoint
appears to be too inaccurate that it can be used to synchronize the
playback data stream. If there is a recording endpoint associated with
the playback endpoint, use that instead. That means if the isochronous
OUT endpoint is asynchronus the USB audio driver will automatically
start recording, if possible, to get exact information about the
needed sample rate adjustments. In no recording endpoint is present,
no rate adaption will be done.

While at it fix an issue where the hardware buffer pointers don't get
reset at the first device PCM trigger.

Make some variables 32-bit to avoid problems with multithreading.

Use the feedback value from the synchronization endpoint as fallback
when there is no recording channel.

PR: 		198444
2015-03-25 13:18:36 +00:00
Hans Petter Selasky 6c671a21c6 MFC r280345:
Fix for out of order device destruction notifications when using the
delist_dev() function. In addition to this change:
- add a proper description of this function
- add a proper witness assert inside this function
- switch a nearby line to use the "cdp" pointer instead of cdev2priv()
2015-03-25 13:08:57 +00:00
Hans Petter Selasky cdff03ba43 MFC r279854:
Lock softc before clearing bits.
2015-03-25 10:38:59 +00:00
Edwin Groothuis d9327b327e MFC of 280413,tzdata8:
Release 2015b - 2015-03-19 23:28:11 -0700

  Changes affecting future time stamps

    Mongolia will start observing DST again this year, from the last
    Saturday in March at 02:00 to the last Saturday in September at 00:00.
    (Thanks to Ganbold Tsagaankhuu.)

    Palestine will start DST on March 28, not March 27.  Also,
    correct the fall 2014 transition from September 26 to October 24.
    Adjust future predictions accordingly.  (Thanks to Steffen Thorsen.)

  Changes affecting past time stamps

    The 1982 zone shift in Pacific/Easter has been corrected, fixing a 2015a
    regression.  (Thanks to Stuart Bishop for reporting the problem.)

    Some more zones have been turned into links, when they differed
    from existing zones only for older time stamps.  As usual,
    these changes affect UTC offsets in pre-1970 time stamps only.
    Their old contents have been moved to the 'backzone' file.
    The affected zones are: America/Antigua, America/Cayman,
    Pacific/Midway, and Pacific/Saipan.

  Changes affecting time zone abbreviations

    Correct the 1992-2010 DST abbreviation in Volgograd from "MSK" to "MSD".
    (Thanks to Hank W.)
2015-03-24 06:11:20 +00:00
Jung-uk Kim 2bbaca6169 Merge OpenSSL 0.9.8zf.
Relnotes:	yes
2015-03-20 21:56:48 +00:00
Xin LI dd4463597d Fix issues with original SA-15:06.openssl commit:
- Revert a portion of ASN1 change per suggested by OpenBSD
   and OpenSSL developers.  The change was removed from the
   formal OpenSSL release and does not solve security issue.
 - Properly fix CVE-2015-0209 and CVE-2015-0288.

Pointy hat to:	delphij
2015-03-20 07:11:20 +00:00
Xin LI 7105197ff3 Fix multiple OpenSSL vulnerabilities.
Security:	FreeBSD-SA-15:06.openssl
Security:	CVE-2015-0209
Security:	CVE-2015-0286
Security:	CVE-2015-0287
Security:	CVE-2015-0288
Security:	CVE-2015-0289
Security:	CVE-2015-0293
2015-03-19 17:40:43 +00:00
John Baldwin accfcea65e MFC 278321:
Use direct hardware access for internal requests for KCS and SMIC.  In
particular, updates to the watchdog should no longer sleep.
- Add a new IPMI_IO_LOCK for low-level I/O access.  Use this for
  kcs_polled_request() and smic_polled_request().
- Add a new backend callback "ipmi_driver_request" to handle a driver
  request.  The new callback performs the request sychronously for KCS
  and SMIC.  SSIF still defers the work to the worker thread since the
  worker thread sleeps during request processing anyway.
- Allocate driver requests on the stack rather than using malloc().
2015-03-13 20:10:09 +00:00
Peter Wemm a8e58f19dd MFC r254340
Some objects - such as *_genassym.o are not hooked into
SRCS OBJS or anything else, yet have a dependency on symlinks
such as machine/

This causes occasional build failures with -j
2015-03-10 05:23:29 +00:00
Jung-uk Kim 0dcff9da80 MFC: r279364
Use realpath(3) to properly expand $ORIGIN to its absolute path.
2015-03-06 22:35:01 +00:00
Edwin Groothuis c95c0d53be MFC of 279706,tzdata8:
Release 2015a - 2015-01-29

Changes affecting future time stamps

    The Mexican state of Quintana Roo, represented by America/Cancun,
    will shift from Central Time with DST to Eastern Time without DST
    on 2015-02-01 at 02:00.  (Thanks to Steffen Thorsen and Gwillim Law.)

    Chile will not change clocks in April or thereafter; its new standard time
    will be its old daylight saving time.  This affects America/Santiago,
    Pacific/Easter, and Antarctica/Palmer.  (Thanks to Juan Correa.)

    New leap second 2015-06-30 23:59:60 UTC as per IERS Bulletin C 49.
    (Thanks to Tim Parenti.)

  Changes affecting past time stamps

    Iceland observed DST in 1919 and 1921, and its 1939 fallback
    transition was Oct. 29, not Nov. 29.  Remove incorrect data from
    Shanks about time in Iceland between 1837 and 1908.

    Some more zones have been turned into links, when they differed
    from existing zones only for older time stamps.  As usual,
    these changes affect UTC offsets in pre-1970 time stamps only.
    Their old contents have been moved to the 'backzone' file.
    The affected zones are: Asia/Aden, Asia/Bahrain, Asia/Kuwait,
    and Asia/Muscat.
2015-03-06 22:09:44 +00:00
Andrey V. Elsukov 5d98e41045 MFC r279324:
When gpart(8) is trying automatically determine the first available
  block of free space after existing partition, take into account
  provider's stripeoffset, since the result will be adjusted to this
  value.

  PR:        197989
2015-03-05 10:12:28 +00:00
Hans Petter Selasky 7ff8f88c63 MFC r279270:
Add ugen keyword to USB pnpinfo. Remove extra space from existing pnpinfo.

PR:		198015
PR:		198019
PR:		198026
2015-03-05 09:37:27 +00:00
Hans Petter Selasky 055dffe6f3 MFC r279242:
Fix debugging macros.
2015-03-05 09:29:05 +00:00
Hans Petter Selasky 975692e71e MFC r279233:
Ensure that the XHCI driver will refresh the control endpoint settings
when re-enumerating a FULL speed device. Else the wrong max packet
setting might be used when trying to re-enumerate a FULL speed device.
2015-02-27 12:23:30 +00:00
Glen Barber d7e5f079aa Bump __FreeBSD_version after FreeBSD-EN-15:01.vt,
FreeBSD-EN-15:02.openssl, FreeBSD-EN-15:03.freebsd-update,
FreeBSD-SA-15:04.igmp, FreeBSD-SA-15:05.bind

Sponsored by:	The FreeBSD Foundation
2015-02-25 16:44:40 +00:00
Glen Barber 692beafd1e Document FreeBSD-EN-15:01.vt, FreeBSD-EN-15:02.openssl,
FreeBSD-EN-15:03.freebsd-update, FreeBSD-SA-15:04.igmp,
FreeBSD-SA-15:05.bind

Sponsored by:	The FreeBSD Foundation
2015-02-25 16:36:44 +00:00
Xin LI f08a103b24 Instant MFC:
Fix integer overflow in IGMP protocol.

Security:	FreeBSD-SA-15:04.igmp
Security:	CVE-2015-1414
Found by:	Mateusz Kocielski, Logicaltrust
Analyzed by:	Marek Kroemeke, Mateusz Kocielski ([email protected]) and
		22733db72ab3ed94b5f8a1ffcde850251fe6f466
Submited by:	Mariusz Zaborski <[email protected]>
Reviewed by:	bms
Approved by:	so
2015-02-25 05:43:02 +00:00
Ian Lepore a2a2ff357a Remove leftover debugging output, accidentally committed.
Pointy hat:	ian
Noticed by:	dim
2015-02-20 13:34:12 +00:00
Ian Lepore 48798be68f Lower some WARNS from 6 to 5 to eliminate redundant redeclaration errors
on yylex().  This allows stable-8 to build on machines running 10 or later
(with a newer yacc that emits its own declaration) and also keep building
on older machines with a yacc that doesn't do so.

This is a direct commit to stable-8 because it fixes a problem that doesn't
exist on later branches.
2015-02-20 05:23:51 +00:00
Ian Lepore 49f06ea2b5 MFC r204227: Remove -b .orig from patch commands, since it's the default.
This allows an 8-stable build to work on a system with newer tools that
don't have the old -b option.
2015-02-20 01:03:44 +00:00
Ian Lepore dd86e29175 MFC r270190: Don't stop other parallel build legs on failure of make_check. 2015-02-20 00:55:38 +00:00
Xin LI c38fa96db8 Fix CVE-2015-1349.
This is a direct commit to stable/8 because BIND is removed from HEAD.
2015-02-18 22:29:52 +00:00
Xin LI 8f67f3ae4b MFC r278739:
Disallow pattern spaces which would cause intermediate calculations to
overflow size_t.

Obtained from:	DragonFly (2841837793bd095a82f477e9c370cfe6cfb3862c dillon)
Security:	CERT VU#695940
2015-02-17 19:15:07 +00:00
Hans Petter Selasky c3a04ad893 MFC r278503:
Revert r274918 and make a better solution. Poll the synchronisation
endpoint less frequently to make the sample rate adjustment more
accurate. This should resolve problems with the DN32-USB module for
Midas audio systems and possibly other similar products from Klark
Teknik.
2015-02-13 07:53:18 +00:00
Hans Petter Selasky 94c1f163d0 MFC r278477:
Fix DMA address casts.
2015-02-13 07:46:02 +00:00
Hans Petter Selasky e00ce2932f MFC r278105:
Separate out detection of prevent and allow medium removal quirk.

PR:		185747
2015-02-10 13:48:49 +00:00
Hans Petter Selasky 69a4a33690 MFC r278071:
Section 3.2.9 in the XHCI specification about control transfers says
that we should use a normal-TRB if there are more TRBs extending the
data-stage TRB. Add a dedicated state bit to the internal USB transfer
flags to handle this case.
2015-02-10 13:20:34 +00:00
Brooks Davis da8e1f3a3a MFC r278337:
When upgrading, install the ELF runtime linkers before libraries.

This is required to prevent problems with nss modules that use libthr when
upgrading from releases prior to 10.1.

PR:		197366
Differential Revision:	D1790
Reviewed by:	cperciva
Sponsored by:	DARPA, AFRL
2015-02-09 10:09:46 +00:00
Marius Strobl 876e798088 MFC: r266744, r267712, r276351, r277043
- Add PCI ID for AMT based serial interface found on the Lenovo T61.
- add support for MosChip MCS9922...  This is found on an ExpressCard.. [1]
- Add PCI ID for the Oxford Semiconductor OXPCIe952 device.

PR:	186891 [1]
2015-02-08 21:49:29 +00:00
John Baldwin e11510d9d3 MFC 276065:
Explicitly treat timeouts when waiting for IBF or OBF to change state as an
error.  This fixes occasional hangs in the IPMI kcs thread when using
ipmitool locally.
2015-02-06 18:41:57 +00:00
Hans Petter Selasky 867e5b65b5 MFC r277136:
Resolve a special case deadlock: When two or more threads are
simultaneously detaching kernel drivers on the same USB device we can
get stuck in the "usb_wait_pending_ref_locked()" function because the
conditions needed for allowing detach are not met.

While at it ensure that "flag_iserror" is only written when "priv_mtx"
is locked, which is protecting it.
2015-02-05 22:03:12 +00:00
Hans Petter Selasky 376fff6d7c MFC r277179, r277199 and r277391:
Add a kernel function to delist our kernel character devices, so that
the device name can be re-used right away in case we are destroying
the character devices in the background.
2015-02-05 21:53:41 +00:00
John Baldwin 2a85bf9625 MFC 274402:
Add device ID for the T502-BT (dual-port 1G) adapter.
2015-02-05 20:59:48 +00:00
Glen Barber ee2df56975 Add the 'security.url' macro to stable/9 and stable/8
branches, and replace hard-coded (and inconsistent) URLs
in security.xml and errata.xml.

Prefer https:// over http://.

Sponsored by:	The FreeBSD Foundation
2015-02-05 19:31:41 +00:00
Glen Barber f417e1a66d Apply r278265 from head:
Security Advisory information is included on several
pages in the release notes.  Rather than duplicating
the information between various files, add two new
files to include in all pages that currently display
the information.

Bump copyright year.

Move SAs and ENs into their respective files.

Add missing ENs and SAs.

Remove stale SAs [1].

Reported by:	bdrewery (over a year ago)
Sponsored by:	The FreeBSD Foundation
2015-02-05 19:10:32 +00:00
Xin LI c71afafcbe MFC r277433: MFV r277432:
Plug various memory leaks in libzfs import implementation.

Illumos issue:
    5518 Memory leaks in libzfs import implementation
2015-02-04 00:52:58 +00:00
Hans Petter Selasky 80b0c6da1d MFC r277246:
Add more USB device IDs.

PR:		196362
2015-01-28 19:57:40 +00:00
Hans Petter Selasky fcb230b7d1 MFC r277245:
Add more USB request definitions. The values are described in section
9.4.11 and 9.4.12 of the "Universal Serial Bus 3.0 Specification"
2015-01-28 19:54:39 +00:00
Xin LI 52ca05ee18 Fix SCTP SCTP_SS_VALUE kernel memory corruption and disclosure vulnerability
and SCTP stream reset vulnerability.

Security:	FreeBSD-SA-15:02.kmem
Security:	CVE-2014-8612
Security:	FreeBSD-SA-15:03.sctp
Security:	CVE-2014-8613
2015-01-27 19:36:08 +00:00
Hans Petter Selasky adc8b9b098 MFC r239237, r242628 and r277044:
- Add the UQ_MSC_NO_PREVENT_ALLOW quirk to handle devices that do not support
  the 'PREVENT/ALLOW MEDIUM REMOVAL' SCSI command.
- Improve auto-quirks detection for certain Kingston memory sticks.
- Increase the maximum number of dynamic USB quirks. USB memory stick
  devices which don't support the synchronize cache SCSI command are
  likely to also not support the prevent-allow medium removal SCSI
  command.
2015-01-19 07:16:22 +00:00
Navdeep Parhar 0ba79b6799 MFC r276959:
cxgb: replace r273280 with a more comprehensive fix.

Poll for link state when the link is down, even for interrupt capable
PHYs.

Allow PHYs to report a dubious "partial" link.  If this state is seen 3
consecutive times (each check is ~1s apart) then reset the PHY.  This is
a workaround for a situation where repeatedly toggling the link from the
peer gets the AEL2005 PHY into a state where it never establishes a PCS
block lock even when everything is in order.
2015-01-18 20:40:08 +00:00
Hajimu UMEMOTO b596924fe4 Correct comparison of IPv6 wildcard address.
MFH:		r276814
2015-01-11 18:56:16 +00:00
Hans Petter Selasky a3c762ae97 MFC r276532 and r276626:
The "cnputs_mtx" mutex must be allowed to recurse. Debug prints and/or
witness printouts in the console driver clients can cause this mutex
to recurse by calls to "printf()" from witness for example. In
particular this can happen if "debug.witness.skipspin=0" is set in the
boot environment.
2015-01-11 12:21:39 +00:00
Hans Petter Selasky fbf2ace7f8 MFC r251499, r271156, r276321, r276404, r276407, r276799 and r273376:
Various XHCI fixes and improvements:
- Add IDs for Intel Patsburg USB 2.0 controller (dependancy).
- Add support for polling the XHCI interrupt handler when
  the regular interrupt handler is not working properly or
  in case of MSI interrupts which are not yet supported.
  Remove interrupt setup code for FreeBSD versions older
  than 700031.
- Improve and fix MSI interrupt allocation, setup and release.
- Add missed flushing of data which can happen when "xhci_configure_mask()"
  is called from "xhci_configure_reset_endpoint()". Ensure the 3-strikes
  error feature is always enabled except for ISOCHRONOUS transfers.
- Allow systems having a page size greater than 4K to use fewer
  scatter-gather XHCI TRB entries for its payload data. The XHCI
  controller can handle at least 65536 bytes per scatter-gather list
  entry.
- Add the Intel BayTrail USB device which needs port routing for USB 3.0.

PR:	179342
2015-01-11 12:01:46 +00:00
Jung-uk Kim 5746a44647 Merge OpenSSL 0.9.8zd. 2015-01-09 01:11:43 +00:00
Xin LI 9c24ccf54a MFC r275930:
Plug a memory leak.

Obtained from:	DragonFlyBSD (commit 5119ece)
2015-01-02 18:52:18 +00:00
Dimitry Andric dce9e6ba75 MFC r276346:
In contrib/binutils/gas/config/tc-ppc.c, fix a few -Wformat-security
warnings.
2014-12-31 16:28:16 +00:00
Bjoern A. Zeeb 00e5e9d2c9 MFC r276462:
Bump copyright year.

  Happy New Year 2015!
2014-12-31 10:05:42 +00:00
Yoshihiro Takahashi 42616336ef MFC: r272491
Reduce diffs against i386.
2014-12-23 11:00:51 +00:00
Dag-Erling Smørgrav 51213d5822 Strip trailing / characters from paths in "not present" index entries.
Errata:		FreeBSD-EN-14:13.freebsd-update
Approved by:	so@
2014-12-22 22:11:45 +00:00
Xin LI f2f536afee MFC r276071:
Fix multiple ntp vulnerabilities.

Reviewed by:	roberto (earlier revision), philip
Security:	CVE-2014-9293, CVE-2014-9294
Security:	CVE-2014-9295, CVE-2014-9296
Security:	FreeBSD-SA-14:31.ntp
2014-12-22 19:08:09 +00:00
Konstantin Belousov b35c390ea8 MFC r275833:
The iret instruction may generate #np and #ss fault, besides #gp.
When returning to usermode, the handler for that exceptions is also
executed with wrong gs base.  Handle all three possible faults in the
same way, checking for iret fault, and performing full iret.
2014-12-19 09:52:21 +00:00
Hans Petter Selasky b5dd8e309d MFC r275624:
Add port routing support for Wildcat Point.

PR:		195793
2014-12-15 08:31:58 +00:00
Dimitry Andric 2efdfe4d83 MFC r275477:
Pull in r174303 from upstream gcc trunk (by Jason Merrill):

  PR c++/48211
  * name-lookup.h (cp_class_binding): Make base a pointer.
  * name-lookup.c (new_class_binding): Adjust.
  (poplevel_class): Adjust.

This fixes a potential segfault when compiling gold, a part of the
devel/binutils port, with gcc.  See also the upstream bug report:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48211

Thanks to Jason Merrill, Tom Callaway and Red Hat legal for approving
the use of this patch under the GNU GPL, version 2 or later.
2014-12-11 08:05:59 +00:00
Xin LI a689e66a3e Fix multiple vulnerabilities in file(1) and libmagic(3).
Security:	FreeBSD-SA-14:28.file
Security:	CVE-2014-3710, CVE-2014-8116, CVE-2014-8117

Fix BIND remote denial of service vulnerability.

Security:	FreeBSD-SA-14:29.bind
Security:	CVE-2014-8500
2014-12-10 08:31:41 +00:00
Hans Petter Selasky b3cc7584ad MFC r274918:
Don't use the synchronization endpoint unless referenced by the
isochronous endpoint descriptor used for the data transfers, hence the
synchronization feature might not be supposed to be supported [yet].
This makes seamless playback synced with the USB HOST clock work with
the DN32-USB module for Midas audio systems and possibly other similar
products from Klark Teknik.
2014-12-01 07:37:29 +00:00
Navdeep Parhar 4dbba519e6 MFC r274724:
cxgbe(4): figure out the max payload size and save it for later.
2014-11-26 00:48:07 +00:00
Dimitry Andric d6e1f1606b MFC r274900:
Fix the following -Werror warnings from clang 3.5.0, while building
bsnmpd's snmp_hostres module:

usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:204:20: error: absolute value function 'abs' given an argument of type 'const long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
        str[9] = (u_char)(abs(tm->tm_gmtoff) / 3600);
                          ^
usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:204:20: note: use function 'labs' instead
        str[9] = (u_char)(abs(tm->tm_gmtoff) / 3600);
                          ^~~
                          labs
usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:205:22: error: absolute value function 'abs' given an argument of type 'const long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
        str[10] = (u_char)((abs(tm->tm_gmtoff) % 3600) / 60);
                            ^
usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:205:22: note: use function 'labs' instead
        str[10] = (u_char)((abs(tm->tm_gmtoff) % 3600) / 60);
                            ^~~
                            labs

Since tm::tm_gmtoff is a long, use labs(3) instead.
2014-11-25 13:29:13 +00:00
Dimitry Andric 219e75d489 MFC r274898:
Fix the following -Werror warnings from clang 3.5.0, while building
usr.sbin/rtadvd:

usr.sbin/rtadvd/rtadvd.c:1291:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                    abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) {
                    ^
usr.sbin/rtadvd/rtadvd.c:1291:7: note: remove the call to 'abs' since unsigned values cannot be negative
                    abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) {
                    ^~~
usr.sbin/rtadvd/rtadvd.c:1324:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                    abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) {
                    ^
usr.sbin/rtadvd/rtadvd.c:1324:7: note: remove the call to 'abs' since unsigned values cannot be negative
                    abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) {
                    ^~~
2 errors generated.

These warnings occur because both preferred_time and pfx_pltimeexpire
are uint32_t's, so the subtraction expression is also unsigned, and
calling abs() is a no-op.

However, the intention was to look at the absolute difference between
the two unsigned quantities.  Introduce a small static function to
clarify what we're doing, and call that instead.

Reviewed by:	hrs
Differential Revision: https://reviews.freebsd.org/D1197
2014-11-25 13:12:45 +00:00
Dimitry Andric 620f724bb4 MFC r274847:
Fix the following -Werror warnings from clang 3.5.0, while building
usr.bin/locate:

usr.bin/locate/locate/util.c:249:29: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                            MAXPATHLEN, abs(i) < abs(htonl(i)) ? i : htonl(i));
                                                 ^
usr.bin/locate/locate/util.c:249:29: note: remove the call to 'abs' since unsigned values cannot be negative
                            MAXPATHLEN, abs(i) < abs(htonl(i)) ? i : htonl(i));
                                                 ^~~
usr.bin/locate/locate/util.c:274:32: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                            MAXPATHLEN, abs(word) < abs(htonl(word)) ? word :
                                                    ^
usr.bin/locate/locate/util.c:274:32: note: remove the call to 'abs' since unsigned values cannot be negative
                            MAXPATHLEN, abs(word) < abs(htonl(word)) ? word :
                                                    ^~~

The problem is that ntohl() always returns an unsigned quantity.  In
this case, it's expected to be cast back to a signed integer, but to
stop complaints about abs() we just store it into an integer, and don't
call ntohl() again.

Reviewed by:	ngie
Differential Revision: https://reviews.freebsd.org/D1196
2014-11-25 12:45:31 +00:00
Navdeep Parhar bd0a20387b MFC r273360:
One of MAP_ANON, MAP_PRIVATE, MAP_SHARED, or MAP_STACK must be specified.
2014-11-17 07:38:23 +00:00
Navdeep Parhar a22a5ee339 MFC r274351:
cxgbe(4): adjust PMRX and PMTX parameters.
2014-11-17 07:20:53 +00:00
Edwin Groothuis 81b14a3bca MFC of 274559,tzdata8:
Release 2014j - 2014-11-10 17:37:11 -0800

  Changes affecting current and future time stamps

    Turks & Caicos' switch from US eastern time to UTC-4 year-round
    did not occur on 2014-11-02 at 02:00.  It's currently scheduled
    for 2015-11-01 at 02:00.  (Thanks to Chris Walton.)

  Changes affecting past time stamps

    Many pre-1989 time stamps have been corrected for Asia/Seoul and
    Asia/Pyongyang, based on sources for the Korean-language Wikipedia
    entry for time in Korea.  (Thanks to Sanghyuk Jung.)  Also, no
    longer guess that Pyongyang mimicked Seoul time after World War II,
    as this is politically implausible.

    Some more zones have been turned into links, when they differed
    from existing zones only for older time stamps.  As usual,
    these changes affect UTC offsets in pre-1970 time stamps only.
    Their old contents have been moved to the 'backzone' file.
    The affected zones are: Africa/Addis_Ababa, Africa/Asmara,
    Africa/Dar_es_Salaam, Africa/Djibouti, Africa/Kampala,
    Africa/Mogadishu, Indian/Antananarivo, Indian/Comoro, and
    Indian/Mayotte.

  Changes affecting commentary

    The commentary is less enthusiastic about Shanks as a source,
    and is more careful to distinguish UT from UTC.
2014-11-16 04:12:25 +00:00
Navdeep Parhar 248e527656 MFC r273615:
cxgbe(4): bump up PF4's share of some global resources.

This increases the size of the per-port RSS slice and also allows the
driver to use a larger number of tx and rx queues.
2014-11-12 20:26:50 +00:00
Navdeep Parhar ef79df9069 MFC r273280:
cxgb(4): reset the PHY if it generates an interrupt for no apparent reason.
2014-11-12 20:09:48 +00:00
Glen Barber 3a7958fcdd Bump __FreeBSD_version after SA-14:23, SA-14:24,
SA-14:25.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2014-11-06 02:41:38 +00:00
Li-Wen Hsu 699afe12f5 MFC r271992
Reflect the chanages in sleepqueue.h and subr_sleepqueue.c
  - Priority argument is introduced to sleepq_*wait* in r177085
  - sleepq_calc_signal_retval is removed from implementation
  - sleepq_catch_signals is internal now

MFC r272475

  - Bump .Dd

Approved by:  kevlo
2014-11-05 16:27:27 +00:00
Dag-Erling Smørgrav 1eccf42cd3 [SA-14:25] Fix kernel stack disclosure in setlogin(2) / getlogin(2).
[SA-14:26] Fix remote command execution in ftp(1).
[EN-14:12] Fix NFSv4 and ZFS cache consistency issue.

Approved by:	so (des)
2014-11-04 23:30:23 +00:00
Alexander Motin b111316702 Fix build breakage of r274056. 2014-11-03 19:20:10 +00:00
Alexander Motin 2072d0c3ee MFC r272059:
Remake Linux' SOUND_MIXER_INFO IOCTL as a wrapper around new FreeBSD's one.

Submitted by:	Dmitry Luhtionov <[email protected]>
2014-11-03 17:37:49 +00:00
Yoshihiro Takahashi 391b5852aa MFC: r272248
- Cleanups pc98 code.
  - Remove unworked formats.
2014-11-03 10:27:21 +00:00
Yoshihiro Takahashi f72c973a64 MFC: r272245
Remove duplicate prog.
2014-11-03 06:34:28 +00:00
Yoshihiro Takahashi 45086dbb18 MFC: r272243
Add missing library dependencies.
2014-11-03 05:36:35 +00:00
John Baldwin 1cf4975b04 MFC 273834:
Rework the EXAMPLES section to be a bit clearer.
- Add an example of using etcupdate diff.
- Create a subsection on bootstrapping that is below the simple
  examples.  This should make it clearer that 'etcupdate extract' is
  a one-time operation and not part of the common workflow.  It also
  adds more suggestions on when bootstrapping is needed and additional
  steps to make future merges simpler.
2014-11-03 00:13:20 +00:00
John Baldwin 7dc0deaca4 MFC 273644,273738:
Clarify that pthread_cleanup_push()/pop() are implemented as macros that
create a new code block and thus must be balanced at the same lexical
scope.  (This is also a requirement in POSIX.)

PR:		194280
Submitted by:	[email protected]
2014-11-02 23:22:22 +00:00
Dimitry Andric 5fa9eb6c78 MFC r273837:
Fix a clang 3.5 warning about abs(3) being given an argument of type
quad_t in setusercontext().  While here, sanitize the clamping of the
priority value, and use the correct type for the return value of
login_getcapnum().

Reviewed by:	kib
2014-11-01 13:45:01 +00:00
Edwin Groothuis 6fe0c9991a MFC of 273718, tzdata2014i
Upgrade to 2014i

Lots of historical data

Pacific/Fiji will go into DST from 2014-11-02 to 2015-01-18
Pacific/Bougainville will go from UTC+10 to UTC+11.
Europe/Minsk will go from FET to MSK.
2014-10-27 06:12:41 +00:00
Glen Barber b218ff835d Bump __FreeBSD_version to track SA-14:20, SA-14:21, SA-14:22,
SA-14:23

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2014-10-21 21:37:53 +00:00
Xin LI 6b3e21baf6 Fix routed(8) remote denial of service vulnerability. [SA-14:21] 2014-10-21 20:20:26 +00:00
Jung-uk Kim 0d3117bd28 Merge OpenSSL 0.9.8zc. 2014-10-15 20:28:31 +00:00
Ed Maste 7c55a88fec MFC r272762: Correct scale factor for T terabyte suffix
PR:		194250
2014-10-11 01:01:18 +00:00
Bryan Venteicher 8763c64464 MFC 272550:
Remove stray uma_mtx lock/unlock in zone_drain_wait()

  Callers of zone_drain_wait(M_WAITOK) do not need to hold (and were not)
  the uma_mtx, but we would attempt to unlock and relock the mutex if we
  had to sleep because the zone was already draining. The M_NOWAIT callers
  may hold the uma_mtx, but we do not sleep in that case.
2014-10-08 04:34:46 +00:00
Hans Petter Selasky 3212817768 MFC r272480:
When we fail to get a USB reference we should just return, because
there are no more references held.
2014-10-06 06:08:29 +00:00
Hans Petter Selasky f13acd5d7a MFC r272349, r272422 and r272479:
- Fix XHCI driver for devices which have more than 15 physical root HUB
  ports. The current bitmap array was too small to hold more than 16
  bits and would at some point toggle the context size, which then would
  trigger an enumeration fault and cause a fallback to the EHCI
  companion controller, if any.
- Make sure we always set the maximum number of valid contexts.
- Set default cycle state in case of early interrupts.
2014-10-06 06:00:06 +00:00
Xin LI 19bc1eaf22 MFC r272288,272289:
When setting environment variables in the atrun script, use the
"export foo=bar" form instead of "foo=bar; export foo" since the
former allows the shell to catch variable names that are not valid
shell identifiers.  This will cause /bin/sh to exit with an error
(which gets mailed to the at user) and it will not run the script.

Obtained from:	OpenBSD (r1.63 millert)
2014-10-02 18:32:30 +00:00
Xin LI b11e8bb58b MFC r272389:
Diff reduction with kernel code: instruct the compiler that the data of
these types may be unaligned to their "normal" alignment and exercise
caution when accessing them.

PR:		194071
2014-10-02 17:42:21 +00:00
Hans Petter Selasky cdcf9d23b1 MFC r272254:
Instead of creating the full range of possible ports, try to figure
out the actual number of so-called "embedded jacks" which are present
when a USB MIDI device is attaching.
2014-10-02 16:49:22 +00:00
Dag-Erling Smørgrav fd20cd8669 MFH (r272280, r272281, r272348): allow use with null user and rhost
PR:		83099 193927
2014-10-01 10:35:52 +00:00
Hans Petter Selasky f8ed8422a1 MFC r271874:
Add new USB IDs.

PR:		193775
2014-09-27 18:12:05 +00:00
Hans Petter Selasky 41509ed1ac MFC r271953:
Some XHCI hardware requires dropping the endpoint context before
adding it again.
2014-09-25 06:00:31 +00:00
David C Somayajulu 24df159ca2 MFC r271728
For ECORE_DBG_BREAK_IF() ECORE_BUG() ECORE_BUG_ON() check bxe_debug flag before printing error message.
2014-09-22 19:09:04 +00:00
David C Somayajulu cab1ddc2f4 MFC r271727
remove clean option from Makefile
2014-09-22 19:03:23 +00:00
David C Somayajulu aa1acdadc1 MFC r271726
Remove clean option from Makefile
2014-09-22 18:57:37 +00:00
Hans Petter Selasky a16369f7dd MFC r271492:
Workaround for receiving Voice Calls using the E1750 dongle from
Huawei. It might appear as if the firmware is allocating memory blocks
according to the USB transfer size and if there is initially a lot of
data, like at the answering machine prompt, it simply dies without any
apparent reason. The simple workaround for this is to force a zero
length packet at hardware level after every 512 bytes of data. This
will force the other side to use smaller memory blocks aswell.
2014-09-20 08:03:15 +00:00
Dag-Erling Smørgrav 011909ff2e MFH (r271256, r271617): avoid segfault if PAM_RHOST nor PAM_TTY are unset.
PR:             83099
2014-09-18 14:31:28 +00:00
Dimitry Andric dd85e73d8d MFC r257658 (modified to apply to stable/8):
For C++ programs, don't emit any explicit dependency to libstdc++.a or
libc++.a during the early build stages (bootstrap-tools, build-tools,
cross-tools), since it is not possible to know in advance which C++
library is available on the host system.

Instead, just use the bootstrap compiler's built-in default.  This
should eventually make it possible to build stable/9 on head, or on
stable/10, which ship without libstdc++ by default.

[Note: this should get the stable/8 tinderbox at least a bit further in
buildworld.]
2014-09-18 06:40:53 +00:00
Glen Barber b3c3e7bb1a Bump __FreeBSD_version after SA-14:19.tcp
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2014-09-16 19:20:06 +00:00
Xin LI 2102173066 Fix Denial of Service in TCP packet processing.
Security:	FreeBSD-SA-14:19.tcp
2014-09-16 09:49:11 +00:00
Lawrence Stewart b199757001 MFC r270160:
Destroy the "qdiffsample_zone" UMA zone on unload to avoid a use-after-unload
panic easily triggered by running "sysctl -a" after unload.

Reported and tested by:	Grenville Armitage <[email protected]>
2014-09-16 00:11:01 +00:00
Navdeep Parhar 90982bf095 cxgbetool from 9-STABLE (this one works with T5 cards). 2014-09-13 23:03:46 +00:00
Navdeep Parhar 3d81b603c7 MFC r258692 and r260207 (both by gnn).
r258692:
Add constants for use in interrogating various fiber and copper connectors
most often used with network interfaces.

The SFF-8472 standard defines the information that can be retrieved
from an optic or a copper cable plugged into a NIC, most often
referred to as SFP+.  Examples of values that can be read
include the cable vendor's name, part number, date of manufacture
as well as running data such as temperature, voltage and tx
and rx power.

Copious comments on how to use these values with an I2C interface
are given in the header file itself.

r260207:
Convert #defines to enums so that the values are visible in the debugger.
2014-09-13 22:44:33 +00:00
Navdeep Parhar 1357cda10d cxgbe(4): backport Chelsio T5 support from the 9-STABLE branch.
This is a direct commit to get the base 40GbE/10GbE T5 driver to
8-STABLE.  There were too many changes between 8 and 9 (t4_tom,
iw_cxgbe, etc.) and MFC'ing everything and then ripping out stuff
selectively would have been too much trouble.

Tested with "make -DMAKE_JUST_KERNELS universe".
2014-09-13 22:30:04 +00:00
Navdeep Parhar a4167ee4c6 MFC r234098 (jhb) and r255047.
r234098:
Add media types for 40G media that might be used with FreeBSD.

r255047:
Add a routine for attaching an mbuf to a buffer with an external
refcount.  This one is willing to work with buffers that may already be
referenced.  MEXTADD/m_extadd are suitable only for the first attachment
to a cluster -- they initialize the refcount to 1.
2014-09-13 19:37:11 +00:00
Alexander Motin 013a6ffe4b MFC r269228:
Add support for SOUND_MIXER_INFO IOCTL, used by gstreamer.

Submitted by:	Dmitry Luhtionov <[email protected]>
2014-09-13 15:22:08 +00:00
David C Somayajulu 10f662d29a MFC r268854
Initiate error recovery stats fail to update after 3 retries.
    Change bxe_panic() ECORE_DBG_BREAK_IF() ECORE_BUG() ECORE_BUG_ON() to
    panic only if ECORE_STOP_ON_ERROR is defined.
2014-09-12 18:27:20 +00:00
John Baldwin 74323f8eab MFC 270823,270825,270829:
Use a unit number allocator to provide suitable st_dev and st_ino values
for POSIX shared memory descriptors.  The implementation is similar to
that used for pipes.

Approved by:	re (gjb for 10)
2014-09-10 15:45:18 +00:00
Hans Petter Selasky 7e606946e5 MFC r271218:
Update mixer description for FastTrackPro.
2014-09-10 07:20:29 +00:00
Hans Petter Selasky 9a51be98ad MFC r239298, r271017 and r271018:
Add new quirk.

PR:        193279
2014-09-10 07:15:23 +00:00
Hans Petter Selasky cf98fa1f92 MFC r270992:
Fix logical error.
2014-09-10 06:56:09 +00:00
Glen Barber e6d40500f5 Bump __FreeBSD_version after SA-14:18
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2014-09-10 00:19:33 +00:00
John Baldwin ba8787e3a1 MFC 226041:
Export devfs inode number allocator for the kernel consumers.
2014-09-08 21:46:14 +00:00
John Baldwin 108a71c8fd MFC 270722:
Correct the destroy example.  The -n argument is not needed (and is not
valid).

Approved by:	re (gjb for 10)
2014-09-05 17:44:10 +00:00
John Baldwin b1361ec81c MFC 270674:
Clarify that the -c argument clears the list of tracepoints specified by
-t (it does not clear all tracepoints).

Approved by:	re (gjb for 10)
2014-09-05 17:22:20 +00:00
Andrey V. Elsukov 24e3c2aa9d MFC r270661:
Remove leading '/' from hardlink name when removing them from the
  regular file name. This fixes the problem, when bsdtar can not create
  hardlinks to extracted files.
2014-09-03 11:17:27 +00:00
Andrey V. Elsukov cc703285b9 MFC r257985:
Fix panic with RADIX_MPATH, when RTFREE_LOCKED() called for already
  unlocked route. Use in6_rtalloc() instead of in6_rtalloc1. This helps
  simplify the code and remove several now unused variables.

  PR:		156283
2014-09-01 09:00:00 +00:00
Peter Wemm 7b6370ccbe Regenerate 2014-08-31 20:23:56 +00:00
Peter Wemm b38c8bf0b5 Backport the separation of the knob that controls the legacy pkg_install
tools (ie: WITH/WITHOUT_PKGTOOLS) and the pkg bootstrap tool.
2014-08-31 20:14:22 +00:00
Sergey Kandaurov cf719a9aa8 MFC r270728, tzdata2014f
- Parts of Russia will change times on 2014-10-26.
- Time zone name changes for Asia/Novokuznetsk and Xinjiang and Samoa
  and America/Metlakatla, new zones Asia/Chita and Asia/Srednekolymsk.
- Australia will now use Axxx.
- New zone tab data format.

And lots of historical changes (See
http://mm.icann.org/pipermail/tz-announce/2014-August/000023.html
for the full details.)
2014-08-29 13:26:11 +00:00
Don Lewis f85c743c40 MFC r270510:
Catch up to gcc 3.3 -> 3.4 upgrade.
2014-08-28 01:15:56 +00:00
Hans Petter Selasky a983ecd5cd MFC r270134:
Use the "bSubslotSize" and "bSubFrameSize" fields to obtain the actual
sample size. According to the USB audio frame format specification
from USB.org, the value in the "bBitResolution" field can be less than
the actual sample size, depending on the actual hardware, and should
not be used for this computation.

PR:		192755
2014-08-27 14:25:18 +00:00
Hans Petter Selasky d9caf62555 MFC r270133:
Add more USB class codes.
2014-08-27 14:20:01 +00:00
Hans Petter Selasky 4353966618 MFC r269777:
Fix string length argument passed to "sysctl_handle_string()" so that
the complete string is returned by the function and not just only one
byte.

PR:	192544
2014-08-27 14:13:47 +00:00
Dimitry Andric 2c41d7fd4d Bring in a collection of gcc and libstdc++ fixes and updates from head,
most of which are already in stable/10 and stable/9 for some time.

Requested by:	danfe
Tested by:	danfe and make universe

MFC r228328:
  Make it possible to use the debug versions of std::map and std::multimap
  with clang, by removing two unneeded using declarations.  Otherwise, you
  would get errors similar to:

  /usr/include/c++/4.2/debug/map.h:77:20: error: dependent using declaration resolved to type without 'typename'
	using _Base::value_compare;
		     ^

  N.B.: Take care when you actually use the debug versions of any
  libstdc++ header.  They are more likely to contain problems, because
  they are exercised far less often, and since the standard library
  complexity guarantees don't always apply anymore, compile times can
  drastically increase.

MFC r228474 (by ed):
  Add support for __COUNTER__.

  __COUNTER__ allows one to obtain incrementing (read: unique) numbers
  from the C preprocesor. This is useful when implementing things like a
  robust implementation of CTASSERT(), which currently fails when using
  it more than once on a single line of code. Probably not likely to cause
  any breakage, but still.

  __COUNTER__ was also added to GCC 4.3, but since that implementation is
  GPLv3 licensed, I took the liberty of implementing it without looking at
  any upstream sources. Therefore, this version is licensed under the same
  license as the rest of the code; GPLv2.

MFC r231336 (by kientzle):
  Implement -print-file-name=include (which is undocumented
  but used by some Linux boot loaders).  This option prints
  out the directory holding the include files needed by
  a freestanding program.  The default implementation of
  this doesn't work on FreeBSD because of the different
  include file layout.  But it's easy to implement:
  just return /usr/include (or the cross-compiling equivalent).

  Reviewed by:	kan

MFC r233193:
  Add explicit braces to avoid dangling else in stl_tree.h.  This silences
  the following warning produced by clang trunk:

    In file included from /usr/src/sbin/devd/devd.cc:91:
    In file included from /usr/obj/usr/src/tmp/usr/include/c++/4.2/map:64:
    /usr/obj/usr/src/tmp/usr/include/c++/4.2/bits/stl_tree.h:987:2: error: add explicit braces to avoid dangling else [-Werror,-Wdangling-else]
	    else
	    ^

MFC r241957:
  Fix several clang warnings in libstdc++, which were exposed by the
  recent atf import.  These changes are purely cosmetic, no functional
  change.

MFC r244776 (by pfg):
  gcc: avoid generating negative values to DW_AT_byte_size.

  There is a bug in gcc (GCC/35998) where dwarf reports
  sizes of unsigned -1 (0xffffffff).

  On NetBSD this generated a faulty CTF entry which then
  caused a segfault in ctfmerge. The issue was worked
  around in NetBSD's Dtrace but since the issue originated
  in gcc, it seems reasonable to fix it here.

  Upstream gcc has been slow to react to this issue and
  the author that submitted the patch is not interested
  in licensing the change to us, so I did an independent
  workaround for the issue.

MFC r251212 (by pfg):
  GCC: bring back experimental support for amdfam10/barcelona CPUs.

  Initial support for the AMD amdfam10 chipsets has been available in the
  gcc43 branch under GPLv2. AMD and some linux distributions (OpenSUSE) did
  a backport of the amdfam10 support and made it available.

  This is a revised subset of the support initially brought in in r236962
  and later reverted. The collateral efects seem to have disappeared but
  it is still recommended to set the CPUTYPE with caution.

  Reviewed by:	jkim (ages ago)

MFC r258017 (by pfg):
  cxxfilt: small changes from Apple's developer tools

  From Apple's Developer Tools 4.0 [1]:

  demangle.patch
  2007-05-05  Geoffrey Keating
	  (d_name): Detect local-source-name.
	  (d_prefix): Likewise.
	  (d_unqualified_name): Implement local-source-name.

  libiberty-printf.patch

  [1] http://opensource.apple.com/source/cxxfilt/cxxfilt-9/patches/

MFC r258429 (by pfg):
  libstdc++: merge non-abi changes from Apple's developer tools

  Take some changes from Apple's Developer Tools 4.0 [1]:

  block.patch
  emergency-buffer-reduction.patch
  test_cleanup.patch

  vector_copy_no_alloc.patch
	  problem/6473222 copy-constructing a std::vector	from an
	  empty std::vector calls malloc

  2008-10-27  Howard Hinnant
  stl_tree_system_header.patch
	  Added #pragma GCC system_header to stl_tree.h.
  copy_doc.patch
	  Corrected documentation concerning copy in stl_algobase.h.
  string_compare.patch
	  Fixed basic_string.h, basic_string.tcc, incorrect 64bit to
	  32bit narrowing.

  Reference:

  [1] http://opensource.apple.com/source/libstdcxx/libstdcxx-39/patches-4.2.1/

  Obtained from:	Apple

MFC r258501 (by pfg):
  gcc: Bring updates from Google's enhanced gcc-4.2.1.

  Google released and enhanced version of gcc-4.2.1 plus their local
  patches for Android[1].

  The patches are owned by Google and the license hasn't been changed
  from  the original GPLv2. We are only bringing a subset of the
  available patches that may be helpful in FreeBSD. Changes specific
  to android are not included.

  From the README.google file[1].

  Patches applied to google_vendor_src_branch/gcc/gcc-4.2.1:

  gcc/Makefile.in
  gcc/c-common.c
  gcc/c-common.h
  gcc/c-opts.c
  gcc/c-typeck.c
  gcc/cp/typeck.c
  gcc/doc/invoke.texi
  gcc/flags.h
  gcc/opts.c
  gcc/tree-flow.h
  gcc/tree-ssa-alias-warnings.c
  gcc/tree-ssa-alias.c

   Backport of -Wstrict-aliasing from mainline.
    Silvius Rus <[email protected]>

  gcc/coverage.c:
    Patch coverage_checksum_string for PR 25351.
    Seongbae Park <[email protected]>
    Not yet submitted to FSF.

  gcc/c-opts.c
  gcc/c-ppoutput.c
  gcc/c.opt
  gcc/doc/cppopts.texi
  libcpp/Makefile.in
  libcpp/directives-only.c
  libcpp/directives.c
  libcpp/files.c
  libcpp/include/cpplib.h
  libcpp/init.c
  libcpp/internal.h
  libcpp/macro.c
    Support for -fdirectives-only.
    Ollie Wild <[email protected]>.
    Submitted to FSF but not yet approved.

  libstdc++-v3/include/ext/hashtable.h
    http://b/742065
    http://b/629994
    Reduce min size of hashtable for hash_map, hash_set from 53 to 5

  libstdc++-v3/include/ext/hashtable.h
    http://b/629994
    Do not iterate over buckets if hashtable is empty.

  gcc/common.opt
  gcc/doc/invoke.texi
  gcc/flags.h
  gcc/gimplify.c
  gcc/opts.c
    Add Saito's patch for -finstrument-functions-exclude-* options.

  gcc/common.opt
  gcc/doc/invoke.texi
  gcc/final.c
  gcc/flags.h
  gcc/opts.c
  gcc/testsuite/gcc.dg/Wframe-larger-than.c
    Add a new flag -Wframe-larger-than- which enables a new warning
    when a frame size of a function is larger than specified.
    This patch hasn't been integrated into gcc mainline yet.

  gcc/tree-vrp.c
    Add a hack to avoid using ivopts information for pointers starting
    at constant values.

  Reference:

  [1]
  https://android.googlesource.com/toolchain/gcc/+/master/gcc-4.2.1/

  Obtained from:	Google Inc.

MFC r258507 (by pfg):
  gcc: Missing makefile changes for r258501.

  pointyhat:	me

MFC r258530 (by pfg):
  libcpp: Keep a record of changes from upstream GCC (pre-43).

  This makes it easier to track the changes in the rare event of the code
  being distributed without access to version control.

MFC r258651 (by pfg):
  gcc: Altivec register adjustments from Apple.

  Obtained from:	gcc pre-4.3 (rev. 124763; GPLv2)

MFC r258658 (by mdf):
  Fix a segfault / internal compiler error.

  Among other causes, when gcc throws a warning before parsing any tokens,
  the cur_token pointer is at the beginning of malloc'd memory.
  Dereferencing cur_token[-1] can cause a segfault.

  Code taken from OpenBSD
  http://www.openbsd.org/cgi-bin/cvsweb/src/gnu/gcc/libcpp/errors.c
  which was a more complete fix than the one I originally coded.

MFC r258731 (by pfg):
  gcc: Make use of TREE_OVERFLOW_P.

  While it was brought in r258179 only to fix a build issue,
  bringing the rest of the change has the advantage of fixing
  GCC/19978.

  Obtained from:	gcc 4.3 (rev. 120505; GPLv2)

MFC r258748 (by pfg):
  gcc: upstream alignment cleanups.

  This solves GCC/32617 and contributes to reduce differences with
  Apple's gcc42.

  Complete some references in the ChangeLog while here.

  Obtained from:	gcc 4.3 (rev. 126529, 126588; GPLv2)

MFC r258817 (by pfg):
  libiberty: upstream updates.

  There is a new ChangeLog.gcc43 file but most notable:

  * floatformat.c (get_field): Fix segfault with little-endian word
    order on 64-bit hosts.
    (put_field): Likewise.
    (min): Move definition.

  gcc/cp/ChangeLog
  2007-05-04  Geoffrey Keating  <[email protected]>

    PR 31775
    * mangle.c (write_mangled_name): Mangle static variable names.
    (write_unqualified_name): Use local-source-name for
    namespace-scope static variables.
  (Completes FreeBSD's r258017 )

  Obtained from:	gcc 4.3 (rev. 118552, 120097, 20698, 120702,
			   121364, 122972, 126588; GPLv2)

MFC r258826 (by pfg):
  libcpp: Merge fixes from upstream

  GCC preprocessor/29966:
  * macro.c (lex_expansion_token): Save and restore cpp_reader's
  cur_token.
  (_cpp_create_definition): Don't restore cur_token here.
  * lex.c (_cpp_lex_token): Added assertion.

  GCC preprocessor/28709:
  * macro.c (paste_tokens): Remove PASTE_LEFT from the old lhs.

  GCC c/31924
  * expr.c (interpret_float_suffix): Check for invalid suffix.

  GCC preprocessor/14331
  * lex.c (_cpp_get_fresh_line):  Don't warn if no newline at EOF.

  Fixup whitespacing

  Obtained from:	gcc per-4.3 (rev. 121340, 124356, 124358, 124730,
				    125212, 125255 ; GPLv2)

MFC r258943 (by pfg):
  gcc: On rs6000 update sp_offset depending only on size.

  This fixes a nasty bug introduced in r258651.

  Reported and tested by:	Justin Hibbits
  Obtained from:		gcc pre-4.3 (rev. 125116; GPLv2)

MFC r259005 (by pfg):
  gcc: Add -flax-vector-conversions

  Obtained from:	gcc 4.3 (rev. 120572, 120688; GPLv2)

MFC r259022 (by pfg):
  gcc: Include types in error message for build_binary_op.

  Mostly cosmetic change, again to reduce differences with Apple's gcc.

  Obtained from:	gcc 4.3 (rev. 125239; GPLv2)

MFC r259092 (by pfg):
  gcc: new fvisibility-ms-compat option

  Obtained from:	gcc 4.3 (rev. 126088; GPLv2)

MFC r259111:
  Use correct casts in gcc's emmintrin.h for the first arguments of the
  following builtin functions:

  * __builtin_ia32_pslldi128() takes __v4si instead of __v8hi
  * __builtin_ia32_psllqi128() takes __v2di instead of __v8hi
  * __builtin_ia32_psradi128() takes __v4si instead of __v8hi

  This should fix the following errors when building the LINT kernel with
  gcc:

  sys/crypto/aesni/aesni_wrap.c:191: error: incompatible type for argument 1 of
  '__builtin_ia32_psradi128'
  sys/crypto/aesni/aesni_wrap.c:195: error: incompatible type for argument 1 of
  '__builtin_ia32_pslldi128'

MFC r259525 (by pfg):
  gcc: fix ICE in rs600 when using -fno-trapping-math.

  Solves GCC-PR target/30485

  Obtained from:	gcc 4.3 (rev. 120902; GPLv2)

MFC r259529 (by pfg):
  gcc: small merges from upstream

  Solves GCC issues:
  PR middle-end/32602
  PR middle-end/32603

  Updates the to documentation and processing
  improvement.

  Obtained from:	gcc 4.3 (rev. 119427, 126278, 126422; GPLv2)

MFC r259555 (by pfg):
  gcc: add Apple compatible -Wnewline-eof

  GCC 4.2 and previous have always warned about
  "No newline at end of file".

  Upstream GCC removed the warning completely but
  Apple made it an optional warning. Adopt it for
  compatibility with older GCC and clang.

  While here, add comment to complement r258712.

  Obtained from:	Apple Inc. (Apple GCC 4.2 - 5531)

MFC r259558 (by pfg):
  gcc: add Apple compatible -Wnewline-eof

  Fix document: "Apple compatible" suits better the origin.

MFC r259649 (by pfg):
  gcc: more diff reductions against Apple GCC.

  Mostly cosmetical changes to aid further merges.

  Obtained from:	gcc 4.3 (rev. 120611, 124839; GPLv2)

MFC r259655 (by pfg):
  gcc: merge upstream fix and new feature.

  Fix for PR c++/29928

  Add support for Rvalue references as described here:
  http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html

  Obtained from:	gcc 4.3 (rev. 124724, 125211; GPLv2)

MFC r259660 (by pfg):
  gcc: revert Rvalue references.

  They are very useful but at this time I prefer not to figure out
  some  minor conflicts with the bigger Apple's blocks support
  patch that is being worked on for current.

MFC r259841 (by pfg):
  gcc:  Add ability to generate DWARF pubtypes section if
  DEBUG_PUBTYPES_SECTION is defined.

  Obtained from:	gcc 4.3 (rev. 118826; GPLv2)

MFC r259873 (by pfg):
  gcc: small enhancements for the arm support.

  Very small updates: fixes GCC-PR target/31152

  Tested by building the cross-compiler.

  Obtained from:	gcc 4.3 (rev. r118461, 125973: GPLv2)

MFC r259944 (by pfg):
  gcc: merge small upstream change.

  Backport from mainline:
  2007-04-24  Hui-May Chang <[email protected]>

  * reload1.c (merge_assigned_reloads) : Do not merge a RELOAD_OTHER
  instruction with a RELOAD_FOR_OPERAND_ADDRESS instruction.

  Obtained from:	gcc 4.3 (rev. r124115: GPLv2)

MFC r260014 (by pfg):
  gcc: Add support for label attributes and "unavailable" attribute.

  Apple GCC has extensions to support for both label attributes and
  an "unavailable" attribute. These are critical for objc but are
  also useful in regular C/C++.

  Apparently at least the label attributes might have found their way to
  upstream GCC but the code doesn't seem available on the GPLv2 tree so
  we are taking the code directly from Apple. To make this clearer we
  are preserving the annoying "APPLE LOCAL" tags and the ChangeLogs
  when they are available.

  Obtained from:	Apple GCC 4.2 - 5531

MFC r260099 (by pfg):
  gcc: Fix issue with "unavailable" attribute.

  While here, point where we dropped the support for objc from r260014.

MFC r260310 (by pfg):
  libcpp: misc fixes from Apple's GCC.

  Fixes some bugs detected by Apple:
  #error with unmatched quotes
  pragma mark

  Obtained from:	Apple GCC 4.2 - 5553

MFC r263775:
  Avoid "cc1: warning: is shorter than expected" when using GNU cpp in
  combination with dtrace scripts, which have "#!/usr/sbin/dtrace -Cs"
  shebang lines.  This is because dtrace positions the file pointer after
  the shebang line, before passing the file to GNU cpp.

  To fix the warning, adjust the size downwards by the current position,
  after a bit of sanity checking.

  Suggested by:	avg

MFC r269948:
  Supplement r259111 by also using correct casts in gcc's emmintrin.h for
  the first argument of the following builtin function:

  * __builtin_ia32_psrlqi128() takes __v2di instead of __v4si

  This should fix the following errors when building the graphics/webp
  port with base gcc:

  lossless_sse2.c:403: error: incompatible type for argument 1 of '__builtin_ia32_psrlqi128'
  lossless_sse2.c:404: error: incompatible type for argument 1 of '__builtin_ia32_psrlqi128'

  Reported by:	Jos Chrispijn <[email protected]>
2014-08-23 10:58:16 +00:00
Ian Lepore 378eae25f8 MFC r255286: don't stop the whole universe build if one kernel fails. 2014-08-20 00:06:54 +00:00
John Baldwin ec5ccbeb52 MFC 238423,238426,238428,258063,258064,258066,258097,258185,259134:
The etcupdate utility is a tool for managing updates to files that are
not updated as part of `make installworld' such as files in /etc.  It
manages updates by doing a three-way merge of changes made to these files
against the local versions.  It is also designed to minimize the amount
of user intervention with the goal of simplifying upgrades for clusters
of machines.

Requested by:	peter
2014-08-19 17:54:15 +00:00
Hans Petter Selasky 83265c0128 MFC r269566:
Fix for deadlock in USB device side mode.
2014-08-13 07:11:37 +00:00
Xin LI 4e41ea5992 MFC r269180:
When interval is set to very small value with limited amount of packets,
ping6(8) would quit before the remote side gets a chance to respond.

Solve this by resetting the itimer when we have reached the maximum packet
number have reached, but let the other handling to continue.

PR:        bin/151023
Submitted by:    tjmao at tjmao.net
2014-08-11 07:01:29 +00:00
Joerg Wunsch df2c70a838 MFC r269470: avoid divide-by-zero panic when setting baudrate to 0. 2014-08-08 15:04:02 +00:00
Jung-uk Kim d1340fbcdb Merge OpenSSL 0.9.8zb. 2014-08-07 21:06:34 +00:00
Peter Wemm 162e4a7cd9 Fix cut/paste brain-o. Spell #endif correctly. 2014-08-07 20:05:50 +00:00
Peter Wemm dd68530220 Like on stable/9 and later, don't redefine MALLOC_PRODUCTION 2014-08-07 20:01:00 +00:00
Marius Strobl c2d6d098c4 MFC: r260457
The changes in r233781 (MFCed to stable/8 in r235517) attempted to make
logging during a machine check exception more readable.  In practice they
prevented all logging during a machine check exception on at least some
systems.  Specifically, when an uncorrected ECC error is detected in a DIMM
on a Nehalem/Westmere class machine, all CPUs receive a machine check
exception, but only CPUs on the same package as the memory controller for
the erroring DIMM log an error.  The CPUs on the other package would complete
the scan of their machine check banks and panic before the first set of CPUs
could log an error.  The end result was a clearer display during the panic
(no interleaved messages), but a crashdump without any useful info about
the error that occurred.

To handle this case, make all CPUs spin in the machine check handler
once they have completed their scan of their machine check banks until
at least one machine check error is logged.  I tried using a DELAY()
instead so that the CPUs would not potentially hang forever, but that
was not reliable in testing.

While here, don't clear MCIP from MSR_MCG_STATUS before invoking panic.
Only clear it if the machine check handler does not panic and returns
to the interrupted thread.

MFC: r263113

Correct type for malloc().

Submitted by:	"Conrad Meyer" <[email protected]>

MFC: r269052, r269239, r269242

Intel desktop Haswell CPUs may report benign corrected parity errors (see
HSD131 erratum in [1]) at a considerable rate. So filter these (default),
unless logging is enabled. Unfortunately, there really is no better way to
reasonably implement suppressing these errors than to just skipping them
in mca_log(). Given that they are reported for bank 0, they'd need to be
masked in MSR_MC0_CTL. However, P6 family processors require that register
to be set to either all 0s or all 1s, disabling way more than the one error
in question when using all 0s there. Alternatively, it could be masked for
the corresponding CMCI, but that still wouldn't keep the periodic scanner
from detecting these spurious errors. Apart from that, register contents of
MSR_MC0_CTL{,2} don't seem to be publicly documented, neither in the Intel
Architectures Developer's Manual nor in the Haswell datasheets.

Note that while HSD131 actually is only about C0-stepping as of revision
014 of the Intel desktop 4th generation processor family specification
update, these corrected errors also have been observed with D0-stepping
aka "Haswell Refresh".

1: http://www.intel.de/content/dam/www/public/us/en/documents/specification-updates/4th-gen-core-family-desktop-specification-update.pdf

Reviewed by:	jhb
Sponsored by:	Bally Wulff Games & Entertainment GmbH
2014-08-05 16:44:27 +00:00
Hans Petter Selasky 24ebaef11d MFC r268929:
Add new device ID.

PR:		191959
2014-07-29 22:07:52 +00:00
Hans Petter Selasky 1b526ce910 MFC r269127:
Fix for division by zero.
2014-07-29 22:02:27 +00:00
Marius Strobl 504439be9b MFC: r269050 (partial)
Copying and zeroing pages via temporary mappings involves updating the
corresponding page tables followed by accesses to the pages in question.
This sequence is subject to the situation exactly described in the "AMD64
Architecture Programmer's Manual Volume 2: System Programming" rev. 3.23,
"7.3.1 Special Coherency Considerations" [1, p. 171 f.]. Therefore, issuing
the INVLPG right after modifying the PTE bits is crucial.
For pmap_copy_page(), this has been broken in r124956.

1: http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/24593_APM_v21.pdf

Reviewed by:	alc, kib
Sponsored by:	Bally Wulff Games & Entertainment GmbH
2014-07-29 13:08:56 +00:00
Xin LI 0a262c3db0 MFC r268979:
Don't save entropy inside jails.

As of r126744, we no longer feed the entropy device in jails upon
start, and collecting them is no longer useful.

PR:		conf/126744
Submitted by:	Eugene Grosbein <eugen grosbein net> (with minor changes)
Approved by:	so (des)
2014-07-29 06:00:48 +00:00
Don Lewis 0551b38481 MFC r268373
Declaration whitespace changes for style(9).
2014-07-20 06:03:52 +00:00
Hans Petter Selasky 59f38c3e2d MFC r268735:
Improve support for Intel Lynx Point USB 3.0 controllers by using the
USB 2.0 port mask in addition to the USB 3.0 port mask. The hardware
does not always accept when writing -1U to the port switching
registers.
2014-07-19 19:58:26 +00:00
Hans Petter Selasky a0e9f134ae MFC r268583:
Turn off blinking device leds at attach.

PR:		183735
2014-07-16 06:25:44 +00:00
John Baldwin 3a8763e8e7 MFC 255284:
It was reported via email that the cu_sent field used by the
krpc client side UDP was observed as way out of range and
caused the rpc.lockd daemon to hang trying to do an RPC.
Inspection of the code found two places where the RPC request
is re-queued, but the value of cu_sent was not incremented.
Since cu_sent is always decremented when the RPC request is
dequeued, I think this could have caused cu_sent to go out of
range. This patch adds lines to increment cu_sent for these
two cases.
2014-07-15 19:18:46 +00:00
Hans Petter Selasky af09309967 MFC r268354:
Improve support for Intel Lynx Point USB 3.0 controllers by masking
the port routing bits like done in Linux.
2014-07-14 07:27:10 +00:00
Peter Wemm c22be4994c Bump __FreeBSD_version after SA-14:17.kmem so we have something
to test against in the freebsd.org cluster.
2014-07-09 00:12:56 +00:00
Xin LI e6cdb373b9 Fix kernel memory disclosure in control message and SCTP notifications.
Security:	FreeBSD-SA-14:17.kmem
Security:	CVE-2014-3952, CVE-2014-3953
2014-07-08 21:54:50 +00:00
Brooks Davis 7273603b65 Revert r268415.
I botched testing and a large set of changes needs to be applied for this to
work.
2014-07-08 19:15:32 +00:00
Brooks Davis 37d39a3a59 MFC r223930:
Remove include of sys/sbuf.h from geom/geom.h.
sbuf support is not always required for geom/geom.h users, and no need to
depend from it.

PR:		158398
2014-07-08 15:30:05 +00:00
Marius Strobl 868ab19977 MFC: r268095
Actually pro AMD chipsets, making r244146 (MFCed to stable/8 in r245801) work.

Sponsored by:	Bally Wulff Games & Entertainment GmbH
2014-07-04 14:00:29 +00:00
Don Lewis 2cacf4fb87 MFC r266814
Initialize r_flags the same way in all cases using a sanitized copy of
flags that has several bits cleared. The RF_WANTED and RF_FIRSTSHARE
bits are invalid in this context, and we want to defer setting RF_ACTIVE
in r_flags until later.  This should make rman_get_flags() return
the correct answer in all cases.

Add a KASSERT() to catch callers which incorrectly pass the RF_WANTED
or RF_FIRSTSHARE flags.

Do a strict equality check on the share type bits of flags.  In
particular, do an equality check on RF_PREFETCHABLE.  The previous
code would allow one type of mismatch of RF_PREFETCHABLE but disallow
the other type of mismatch.  Also, ignore the the RF_ALIGNMENT_MASK
bits since alignment validity should be handled by the amask check.
This field contains an integer value, but previous code did a strange
bitwise comparison on it.

Leave the original value of flags unmolested as a minor debug aid.

Change the start+amask overflow check to a KASSERT() since it is just
meant to catch a highly unlikely programming error in the caller.

Reviewed by:	jhb
2014-07-03 17:57:12 +00:00
Bryan Drewery d39a836942 MFC r243080:
Only pass ip[46].addr when _addrl contains a value

Partial MFC r204759:

  Redirect stdin from /dev/null when starting a jail:
    At least in RELENG_7 this fixes some start problems for some programs
    from the ports. It is also more correct, as a jail shall not expect
    input (interactivity) from the jail-host.

PR:		180916
2014-07-02 19:18:59 +00:00
Xin LI e7e2c7f157 MFC r267372-267374: fix various misimplementation of instructions.
Submitted by:	Wolf Ramovsky <wolf.ramovsky gmail.com>
2014-07-01 16:01:48 +00:00
John Baldwin f01fd45d0c MFC 266296:
Correct some minor nits in the per-thread signal format description such
as missing posessives and misordering of fields.
2014-06-27 19:50:30 +00:00
Marius Strobl 92e499e9f4 MFC: r224269
Add missing XHCI early takeover code. The XHCI takeover code
is supposed to disable the BIOS from using the XHCI controller
after bootup.
2014-06-27 13:19:03 +00:00
John Baldwin 46becb43cf MFC 253392:
Workaround some broken BIOSes that specify edge-sensitive but active-low
settings for ACPI-enumerated serial ports by forcing any IRQs that use
an ISA IRQ value with these settings to active-high instead of active-low.

This is known to occur with the BIOS on an Intel D2500CCE motherboard.
2014-06-24 19:58:42 +00:00
Xin LI 893a7b36f7 Fix multiple vulnerabilities in file(1) and libmagic(3).
Security:	FreeBSD-SA-14:16.file
Approved by:	so
2014-06-24 19:04:55 +00:00
Marius Strobl edf79cea8f MFC: r220871
Correctly output the entire array for hw.acpi.thermal._ACx.
2014-06-18 10:56:59 +00:00
Marius Strobl f08fb62c46 MFC: r220798
Fix a few acpi sysctls that want "IK" formatting to specify CTLTYPE_INT.

MFC: r245266

Remove not very useful printf, that can be too chatty.

MFC: r255077

Warn about insane _TMP temperature only once.
2014-06-18 10:38:29 +00:00
Edwin Groothuis 80d72568ce MFC of i267473,tzdata2014e
Fix historical data for Egypt.
Better prediction for future Egypt / Morocco changes.
Update to Cocos / Cook islands.
Fix historical data for Russia.
2014-06-14 11:37:53 +00:00
Erwin Lansing 825f042bf7 Sync with 2014060201 which adds IPv6 to b.root-servers.net
Note that this is a direct commit to stable/8 as this file
is no longer in HEAD.

Sponsored by:	DK Hostmaster A/S
2014-06-13 07:23:46 +00:00
Xin LI cfa87343e5 MFC r227519, r227520:
r227519 (das)

Sync the style, comments, and variable names of arc4random.c with
OpenBSD's version (r1.22).  No functional changes, as verified with
md5.

r227520 (das)

Further reduce diffs with OpenBSD's arc4random.  The main functional
change here is to ensure that when a process forks after arc4random
is seeded, the parent and child don't observe the same random sequence.
OpenBSD's fix introduces some additional overhead in the form of a
getpid() call.

The only significant remaining difference between our arc4random and
OpenBSD's is in how we seed the generator in arc4_stir().
2014-06-12 00:19:05 +00:00
Hans Petter Selasky ce1107f1f6 MFC r267240:
Resolve a deadlock setting the USB configuration index from userspace
on USB HUBs by moving the code into the USB explore threads. The
deadlock happens because child devices of the USB HUB don't have the
expected reference count when called from outside the explore
thread. Only the HUB device itself, which the IOCTL interface locks,
gets the correct reference count.
2014-06-11 05:45:48 +00:00
Jung-uk Kim 87f2f4f401 Correct OpenSSL 0.9.8za release date. 2014-06-09 17:03:16 +00:00
Jung-uk Kim f713c9994c Merge OpenSSL 0.9.8za.
Approved by:	so (delphij)
2014-06-09 06:03:38 +00:00
Bryan Drewery 2014467622 MFC r266463:
- Include /etc/newsyslog.conf.d/* and /usr/local/etc/newsyslog.conf.d/* by
    default for newsyslog(8).
2014-06-05 15:39:54 +00:00
Marius Strobl 3ee14007e1 MFC: r266793, r266799, r266808
- Fix compilation with PAE support enabled by merging r233362 and, thus,
  doing away with the unnecessary uint8_t pointer casting.
  physical addresses.
- Nuke the unused softc of emujoy(4).
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.

Sponsored by:	Bally Wulff Games & Entertainment GmbH
2014-06-05 13:24:12 +00:00
Xin LI 457280aa4e Fix OpenSSL multiple vulnerabilities.
Security:	CVE-2014-0195, CVE-2014-0221, CVE-2014-0224,
		CVE-2014-3470
Security:	SA-14:14.openssl
2014-06-05 12:32:38 +00:00
Alexander Motin 76d11dff75 MFC r266538:
Make ng_mppc to not disable the node in case of multiple packet loss.
Quite often it can be just packet reorder, and killing link in such case
is inconvenient.  Add few sysctl's to control that behavior.

PR:		kern/182212
Submitted by:	Eugene Grosbein <[email protected]>
2014-06-05 06:00:08 +00:00
Konstantin Belousov a48cf73e8c MFC r266846:
When usermode loaded non-default segment selector into the %gs,
correctly prepare KGSBASE msr to restore the user descriptor base on
the last swapgs during return to usermode.
2014-06-05 00:50:55 +00:00
John Baldwin 1a3316e4c4 MFC 266281:
Clear the data buffer length field when freeing a command structure so that
it doesn't leak through when the command structure is reused for a user
command without a data buffer.

PR:		189668
2014-06-04 18:22:34 +00:00
Hans Petter Selasky c0b034ea83 MFC r266664:
Add empty LIBUSB_CALL macro, to be compatible to the libusb 1.0-API
from sourceforge.

PR:		usb/190204
2014-06-04 10:42:04 +00:00
Hans Petter Selasky aa74a986f2 MFC r266798 and r266803:
Fix for big-endian architectures.
2014-06-04 10:36:02 +00:00
Xin LI 5743b3b5d6 Fix ktrace memory disclosure. [SA-14:12] 2014-06-03 19:02:42 +00:00
Xin LI 24916dc004 MFC r265995:
Switch using the new $2b$ format by default, when bcrypt is used.

Relnotes:	default Blowfish crypt(3) format have been changed to $2b$.
2014-05-28 18:53:10 +00:00
Dmitry Morozovsky 5f0b1109c4 MFC r266483:
Document VMware-related filesystems additions.
2014-05-28 15:24:30 +00:00
Xin LI 1ebf61fda6 MFC r266520:
Explicitly link libzfs against libavl as it is done in OpenSolaris
(4543:12bb2876a62e).  Without this, some third party applications
may break because the lack of AVL related symbols.

FreeBSD base system are not affected because the FreeBSD ZFS command
line tools were all linked against libavl and thus hide the underlying
issue.

PR:	bin/183081
2014-05-27 18:45:02 +00:00
Gregory Neil Shapiro bc1c3d5a4e Note merge for sendmail 8.14.9. 2014-05-26 16:00:35 +00:00
Gregory Neil Shapiro 64d7a93314 MFC: Minor changes to force commit these files so new freebsd*.cf files are
built to use the new sendmail-8.14.9/cf tree.
2014-05-26 15:46:19 +00:00
Gregory Neil Shapiro 9e35ae1edd MFC: Update for sendmail 8.14.9 import 2014-05-26 15:36:22 +00:00
Gregory Neil Shapiro 2705cd3a1b MFC: Merge sendmail 8.14.9 to HEAD 2014-05-26 15:30:27 +00:00
Hans Petter Selasky 6bd3f41882 MFC r266541:
- Fix a bug where the TLBPC value was forced to being odd for IN
direction isochronous transfers.
- Remove setting of fields which does not belong to the respective
TRBs. These fields are currently set as zero and this is more a
cosmetic change.
2014-05-25 18:26:43 +00:00
Konstantin Belousov 3b757c9443 MFC r266464:
In execve(2), postpone the free of old vmspace until the threads are resumed
and exited.
2014-05-23 09:48:42 +00:00
Peter Holm 257440b3f8 MFC r265534:
msync(2) must return ENOMEM and not EINVAL when the address is outside the
allowed range or when one or more pages are not mapped. This according to
The Open Group Base Specifications Issue 7.

Sponsored by:	EMC / Isilon storage division
2014-05-23 05:35:43 +00:00
Don Lewis 42c186aa02 MFC r266426
Slightly restructure the final loop in rman_reserve_resource_bound().
Replace with the existing loop termination test with a similar
condition from the nested "if" that may terminate the loop a bit
sooner, but still not too early.   This condition can then be removed
from the nested "if".  Relocate an operator to be style(9) compliant.
2014-05-22 00:46:03 +00:00
Hans Petter Selasky 71e0c68b4e MFC r266006 and r266011:
Fix unload of USB audio kernel module.
2014-05-21 06:33:21 +00:00
Xin LI 29e0a594b9 MFC r265465:
Don't reply monlist request when it's not enabled.
2014-05-20 00:57:53 +00:00
Marius Strobl c4d32c7f9b MFC: r259838
Add another HP iLO serial (console) port, found on Itanium servers.
2014-05-19 09:31:49 +00:00
Marius Strobl e80ee8abba MFC: r257808
Add new AMT serial port PCI ID on Intel Lynx Point chipset
2014-05-19 09:30:08 +00:00
Marius Strobl 25f8b447fb MFC: r253654
Set the device description after we call uart_probe(). In uart_probe()
we call device-specific probe functions, which can (and typically will)
set the device description based on low-level device probe information.
In the end we never actually used the device description that we so
carefully maintained in the PCI match table. By setting the device
description after we call uart_probe(), we'll print the more user-
friendly description by default.
2014-05-19 09:26:35 +00:00
Don Lewis 424d3414c6 MFC r265931
Be even more paranoid about overflow.

Requested by:   ache
2014-05-19 07:49:09 +00:00
Don Lewis 0230a74525 Nuke a couple of unnecessary assigments. Nothing uses the values of rstart
and rend after this point.
2014-05-19 07:46:03 +00:00
John Baldwin fe8b5e011f MFC 264766:
- Fix an off by one error when checking for the stop event.  This
  resulted in not showing the most recent event by default.
- When the stop even is hit, break out of the outer loop to stop
  fetching more events.
2014-05-18 15:31:02 +00:00
Hans Petter Selasky 2be2a5412e MFC r265779:
Fix for NULL pointer.
2014-05-16 16:17:06 +00:00
Christian Brueffer b85e207a38 MFC: r265240
Properly free resources in case of error.

CID:		1007032
Found with:	Coverity Prevent(tm)
2014-05-16 15:57:20 +00:00
Christian Brueffer e66cc489c3 MFC: r265238
Properly free resources in case of error.

CID:		1007032
Found with:	Coverity Prevent(tm)
2014-05-16 15:56:07 +00:00
Marius Strobl 6d087286e8 Revert the following MFCs done as part of r265147:
r249438, r249466, r249481, r250025, r253958
leaving the MFCs of r241028 and r241444 in place. While the CAM queuing
changes in question are pretty much self-contained and work fine with all
kinds of SAS, SATA and USB devices, for reasons unknown they cause a hang
with Initio INIC-1610P USB disks not seen with later branches containing
these rewrites. In turn, r241444 actually is sufficient to fix the panic
and problems I was seeing and that lead me to bringing CAM queuing up to
date.

Reported by:	Scott Allendorf
2014-05-15 09:55:21 +00:00
Marius Strobl 48323355d4 MFC: r265535
- Sprinkle const and static as appropriate.
- Fix whitespace bugs.
- Remove pointless returns in void functions.
- Nuke pointless switch cases mirroring the default.

Sponsored by:	Bally Wulff Games & Entertainment GmbH
2014-05-14 16:18:26 +00:00
Marius Strobl f7d197e179 MFC: r256561
Prevent an unlikely, but real double free issue in gvinum(8).

Coverity ID: 1018965
2014-05-14 15:52:36 +00:00
Bryan Drewery 6f7bc77974 MFC r265072:
Remove redundant include
2014-05-14 15:36:23 +00:00
Bryan Drewery a8f1fa04b6 MFC r264499:
Make g_access() KASSERT() more useful.
2014-05-14 15:33:51 +00:00
Marius Strobl f0af934f0b MFC: r204665
- Make function of finding an available drive name a macro.
- Move check of /dev/ prefix and copy into a function to save code duplication.
  This also fixes a bug where the /dev/ prefix could not be used when creating
  volumes on the command line.

MFC: r209051

Initialize variables before usage.

Found by:	clang static analyzer
Found by:	Coverity Prevent[tm] (CID 7736, 7760)

MFC: r215704

Fix some more warnings found by clang.

MFC: r229915

Fix warning when compiling with gcc46.
2014-05-14 15:22:42 +00:00
Bryan Drewery b5f65e7651 MFC r264385:
Use proper MFSNAMELEN for fs type.
2014-05-14 15:19:52 +00:00
Marius Strobl ee2cef3941 MFC: r265454
- Allow foot shooting with the resetconfig command via the -f option.
- Fix typos preventing -f to actually work with the create command.
- Initialize flags to zero rather than using stack garbage when handling
  the grow command.

Sponsored by:	Bally Wulff Games & Entertainment GmbH
2014-05-14 13:48:29 +00:00
Xin LI c7e62e402e Improve build repeatability for kldxref(8). [EN-14:04] 2014-05-13 23:35:29 +00:00
Edwin Groothuis 2d1ddb28ec MFC of 265978, tzdata2014c
- Egypt will go into DST on 15 May 2014.
2014-05-13 21:30:09 +00:00
David C Somayajulu 02c6b2a887 MFC r265703
Modify Copyright information and other strings to reflect
Qlogic Corporation's purchase of Broadcom's NetXtreme business.
Added clean option to Makefile

Submitted by:David C Somayajulu ([email protected]) QLogic Corporation
2014-05-12 15:59:09 +00:00
Don Lewis 53244b0f1e MFC r265363
Avoid unsigned integer overflow which can cause
rman_reserve_resource_bound() to return incorrect results.

Continue the initial search until the first viable region is found.

Add a comment to explain the search termination test.

PR:		kern/188534
Reviewed by:	jhb (previous version)
2014-05-12 07:05:46 +00:00
David C Somayajulu bea26450f6 MFC r265411
Modify Copyright information to reflect Qlogic Corporation's purchase
of Broadcom's NetXtreme business

Submitted by:David C Somayajulu ([email protected]) QLogic Corporation
2014-05-10 02:08:04 +00:00
Xin LI c7f6d2149e MFC r265464:
Sort .ALLSRC before concatenating files together.  This makes sure that the
file are always built the same.

(Note that Header and Localstuff must appear first and in that order, the
sorting does not affect as a coincident effect).

Submitted by:	sjg
2014-05-09 08:22:02 +00:00
Christian Brueffer 4738a0bbcf MFC: r265360
Remove stray comma.
2014-05-08 19:08:07 +00:00
Marius Strobl c21a6d9457 MFC: r251394
CAM_DEV_QFREEZE handling should only be done on request submission but
neither on completion nor by SIM drivers in the first place. This issue
has been revealed by r249466 (MFC'ed to stable/8 in r265147).
2014-05-08 14:28:51 +00:00
Gavin Atkinson 2dc0a39d04 Merge r254959 from head:
Allow more space for interface names.
2014-05-07 20:13:46 +00:00
Alan Cox 0c127943cd MFC r262338
When the kernel is running in a virtual machine, it cannot rely upon the
  processor family to determine if the workaround for AMD Family 10h Erratum
  383 should be enabled.  To enable virtual machine migration among a
  heterogeneous collection of physical machines, the hypervisor may have
  been configured to report an older processor family with a reduced feature
  set.  Effectively, the reported processor family and its features are like
  a "least common denominator" for the collection of machines.

  Therefore, when the kernel is running in a virtual machine, instead of
  relying upon the processor family, we now test for features that prove
  that the underlying processor is not affected by the erratum.  (The
  features that we test for are unlikely to ever be emulated in software
  on an affected physical processor.)

PR:		186061
2014-05-07 16:28:36 +00:00
Marius Strobl b8c9a59706 MFC: r265248
Allow GEOM_VINUM to be statically compiled into the kernel.

Submitted by:	gleb
2014-05-07 09:56:28 +00:00
Marius Strobl 8ca5373703 MFC: r265090
Merge r133175 from upstream:

2008-03-13  Dennis Czeremin  <[email protected]>

	PR libstdc++/35566
	* include/bits/stl_multimap.h (multimap<>::multimap(_InputIterator,
	_InputIterator)): Forward to _M_insert_equal, not _M_insert_unique.

This patch was GPL2 at the time and fixes a regression introduced with
the merge of GCC r129013 in FreeBSD r236829 (merged to stable/8 in r237508).

Sponsored by:	Bally Wulff Games & Entertainment GmbH
2014-05-02 10:31:42 +00:00
Marius Strobl e117a6b90c MFC: r241028
Change queue overflow checks from DIAGNOSTIC+panic() to KASSERT() to make
them enabled on HEAD by default. It is probably better to do single compare
then hunt for unexpected memory corruption.

MFC: r241444

Increase device CCB queue array size by CAM_RL_VALUES - 1 (4) elements.
It is required to store extra recovery requests in case of bus resets.
On ATA/SATA this fixes assertion panics on HEAD with INVARIANTS enabled or
possible memory corruptions otherwise if timeout/reset happens when device
CCB queue is already full.

MFC: r249466 (partial), r249438, r249481, r250025 (partial)

Remove multilevel freezing mechanism, implemented to handle specifics of
the ATA/SATA error recovery, when post-reset recovery commands should be
allocated when queues are already full of payload requests.  Instead of
removing frozen CCBs with specified range of priorities from the queue
to provide free openings, use simple hack, allowing explicit CCBs over-
allocation for requests with priority higher (numerically lower) then
CAM_PRIORITY_OOB threshold.

Simplify CCB allocation logic by removing SIM-level allocation queue.
After that SIM-level queue manages only CCBs execution, while allocation
logic is localized within each single device.

MFC: r253958

Change CCB queue resize logic to be able safely handle overallocations:
 - (re)allocate queue space in power of 2 chunks with 64 elements minimum
and never shrink it; with only 4/8 bytes per element size is insignificant.
 - automatically reallocate the queue to double size if it is overflowed.
 - if queue reallocation failed, store extra CCBs in unsorted TAILQ,
fetching them back as soon as some queue element is freed.

To free space in CCB for TAILQ linking, change highpowerq from keeping
high-power CCBs to keeping devices frozen due to high-power CCBs.

This encloses all pieces of queue resize logic inside of cam_queue.[ch],
removing some not obvious duties from xpt_release_ccb().
2014-04-30 14:09:26 +00:00
Erwin Lansing c963999ad3 Pick up the 2014032601 update which adds an IPv6 address for C.
Note that this is a direct commit to stable/8 as this file
is no longer in HEAD.

Sponsored by: DK Hostmaster A/S
2014-04-30 09:57:38 +00:00
Steven Hartland 5388cc0d03 MFC r265046
Fix ZIO reordering issue which could cause data loss / corruption.

Sponsored by:	Multiplay
2014-04-30 09:53:14 +00:00
Xin LI 57bc932e4d Fix TCP reassembly vulnerability.
Patch done by:	glebius
Security:	FreeBSD-SA-14:08.tcp
Security:	CVE-2014-3000
2014-04-30 04:04:20 +00:00
Hans Petter Selasky 9f7e164987 MFC r265015:
Setting the IMOD value below 0x3F8 can cause IRQ lockups in the Intel
LynxPoint USB 3.0 controllers found in MacBookPro 2013's.
2014-04-29 05:48:50 +00:00
Ian Lepore 5b59f12710 MFC uftdi(4) driver changes...
r264010: Support speeds up to 12mbaud on newer chips.
  r264018: Update list of supported FTDI chips.
  r264031: Use 2K IO buffers for improved throughput.
  r264149: Add ioctl(2) calls to access bitbang, MPSSE, CPU_FIFO,
           and other modes.
  r264800: Various fixes to r264149 pointed out by Coverity scan.
2014-04-28 14:20:21 +00:00
Xin LI 6a71745eff MFC r264467:
Take into account when zpool history block grows exceeding 128KB in zpool(8)
and zdb(8) by growing the buffer on demand with a cap of 1GB (specified in
spa_history_create_obj()).

PR:		bin/186574
Submitted by:	Andrew Childs <lorne cons org nz> (with changes)
2014-04-28 06:12:15 +00:00
Andrey V. Elsukov f39b3b5145 MFC r264582:
Remove unused variable.

PR:		173521
2014-04-24 11:14:17 +00:00
Christian Brueffer c05460634d MFC: r264585
Add a missing break in the TCP case.

Reviewed by:	bms
2014-04-24 10:27:21 +00:00
Christian Brueffer fcf5b8a337 MFC: r264489
Add a missing break in option parsing.

CID:		1011452
Found with:	Coverity Prevent(tm)
2014-04-23 09:24:26 +00:00
Christian Brueffer def81c889e MFC: r264418
Avoid double free in f_acl().

CID:		1018508
Found with:	Coverity Prevent(tm)
2014-04-22 21:17:12 +00:00
Marius Strobl 42ec78b57a MFC: r216746
Make it possible to specify WITHOUT_MODULES in a kernel config file.
2014-04-22 16:04:31 +00:00
Marius Strobl d78df978bf MFC: r249336
Add ID for ASMedia ASM1042 USB 3.0 controller.

MFC: r253094

Use MSI for xhci(4), if supported.

MFC: r253398

Add a tunable to force disable MSI use for xhci(4).
2014-04-22 13:58:39 +00:00
Marius Strobl 9f92c54ef8 MFC: r229379
Add support for Intel EG20T serial ports

MFC: r248340

Add support for Exar XR17V358 8-port serial device to puc(4)

MFC: r248472

Correct the definition for Exar XR17V258IV: we must use a config_function
to specify the offset into the PCI memory spare at which each serial port
will find its registers.  This was already done for other Exar PCI serial
devices; it was accidentally omitted for this specific device.

MFC: r251713

Fix whitespace and normalize some entries.

MFC: r251715

All of Oxford/PLX OX16PCI954, OXm16PCI954 and OXu16PCI954 share the
exact same (subsystem) device and vendor IDs. However, the reference
design for the OXu16PCI954 uses a 14.7456 MHz clock (as does the EXSYS
EX-41098-2 equipped with these), while at least the OX16PCI954 defaults
to a 1.8432 MHz one. According to the datasheets of these chips, the
only difference in PCI configuration space is that OXu16PCI954 have
a revision ID of 1 while the other two are at 0. So employ the latter
for determining the default clock rates of this family.

MFC: r264257, r264327, r264514

Distinguish between the different variants and configurations of Sunix
{MIO,SER}5xxxx chips instead of treating all of them as PUC_PORT_2S.
Among others, this fixes the hang seen when trying to probe the none-
existent second UART on an actually 1-port chip.

Obtained from:	NetBSD (BAR layouts)
Sponsored by:	Bally Wulff Games & Entertainment GmbH
2014-04-22 13:02:12 +00:00
Andrey V. Elsukov a3c0702f20 MFC r264364:
Properly release the in6_multi lock.

Sponsored by:	Yandex LLC
2014-04-21 11:26:46 +00:00
Bryan Drewery 1c38ccf06b MFC r264142:
Show error code when failing to destroy a mirror on delay
2014-04-21 02:54:15 +00:00
Bryan Drewery c69a2d47f4 MFC r264320:
Fix spelling error in g_trace() call.
2014-04-21 02:53:42 +00:00
Hans Petter Selasky e164f54980 MFC r264344:
Tune buffer sizes for SuperSpeed USB when using LibUSB v0.1 and v1.0
APIs to increase the maximum bandwidth limit.
2014-04-18 07:46:26 +00:00
Hans Petter Selasky 61c71f3f28 MFC r264340:
Correct IMOD default value according to comment.
2014-04-18 07:44:43 +00:00
Xin LI 6d78e50e0d Cherry-pick OpenSSL changeset 5be1ae2:
====
Author: Dr. Stephen Henson <[email protected]>

Treat a zero length passed to ssleay_rand_add a no op: the existing logic
zeroes the md value which is very bad. OpenSSL itself never does this
internally and the actual call doesn't make sense as it would be passing
zero bytes of entropy.

Thanks to Marcus Meissner <[email protected]> for reporting this bug.
====

This is a direct commit to stable/8 and stable/9.  -HEAD and stable/10
already have this fix as part of OpenSSL 1.0.1g.

Noticed by:	koobs
Reviewed by:	benl (maintainer)
2014-04-17 20:09:41 +00:00
Christian Brueffer fa61050a00 MFC: r264315, r264316
Fix Xref order in SEE ALSO.
2014-04-17 10:41:26 +00:00
Eitan Adler 1c10b97e0a MFC r249803:
Add support for Intel C600/X79 Series Chipset KT Controller.

PR:		kern/177072
2014-04-16 18:09:39 +00:00
Bryan Drewery c609ed322a MFC Pkg configuration, known public key, and pkg(7) changes to align with pkg(8)
This partially merges:
    r229068,r237795,r252048,r257145,r257147,r257150,r257150,r257159,r257164,
    r257168,r257344,r257344,r257667,r257668,r258227,r258550,r263937,r264420

- etc/
  - Bring in current pkg configuration from head
  - Add /etc/pkg/ and /usr/share/keys to mtree
- share/keys
  - Bring in trusted key fingerprint from head
- share/man/man7
  - Document /usr/share/keys/pkg
- usr.sbin/pkg
  - No longer create pkg.conf as it is deprecated in pkg(8).
  - Show security warning when bootstrapping.
    * This is a direct commit as the signature verification is not being
      MFC'd due to being too large.

Discussed with:	bapt, gjb
2014-04-15 23:40:47 +00:00
John Baldwin 9c2d17d397 Don't pass a timeout of 0 ticks to pause() for a delay of less than 1
hz tick.  On 8.x this results in an infinite sleep as pause() does not
support a delay of 0 ticks.  Since all delay values are converted from
nanoseconds to ticks using a floor function, skipping the sleep for a
delay smaller than 1 tick is the more consistent than rounding up to a
single tick.

This is a direct commit to 8 and 9 as 10.x and later use pause_sbt()
instead.

Reviewed by:	avg
2014-04-15 15:58:06 +00:00
Devin Teske 9fb770077b MFC r250243:
If the kernel is compiled with VMIMAGE support, the first attempt of
mounting smbfs share will cause a panic. Fix setting/restoring vnet
context when needed.

PR:		kern/168077
Submitted by:	dteske
2014-04-13 22:16:18 +00:00
Hans Petter Selasky 7ef5ee23f3 MFC r264294:
Fix for infinite XHCI reset loops when the set address USB request fails.
2014-04-11 06:18:24 +00:00
Joerg Wunsch a71a0a926a MFC r264084: make the Dresden Elektronik "USB Level Shifter Stick Low Cost"
known to the FTDI driver.
2014-04-10 22:10:29 +00:00
Dimitry Andric 4d2d161f77 MFC r264238:
For GNU as, add two missing modes for each of the fcomip and fucomip
instructions.  Partially obtained from OpenBSD by Pedro Giffuni, while I
added the fcomip variants.

Apparently this should help with compiling certain variants of WebKit.
2014-04-10 07:00:24 +00:00
Dimitry Andric 27cf14d2b2 MFC r263778:
Add a SUBDIR_PARALLEL option to bsd.subdir.mk, to allow make to process
all the SUBDIR entries in parallel, instead of serially.  Apply this
option to a selected number of Makefiles, which can greatly speed up the
build on multi-core machines, when using make -j.

This can be extended to more Makefiles later on, whenever they are
verified to work correctly with parallel building.

I tested this on a 24-core machine, with make -j48 buildworld (N = 6):

		before    stddev       after    stddev
		=======   ======       =======  ======
real time        1741.1     16.5         959.8     2.7
user time       12468.7     16.4       14393.0    16.8
sys  time        1825.0     54.8        2110.6    22.8

(user+sys)/real     8.2                   17.1

E.g. the build was approximately 45% faster in real time.  On machines
with less cores, or with lower -j settings, the speedup will not be as
impressive.  But at least you can now almost max out a machine with
buildworld!

Submitted by:	jilles

MFC r263833:

Enable parallel building for gnu/usr.bin and usr.bin/clang too.
2014-04-09 18:16:58 +00:00
Xin LI 2a317c634c Fix NFS deadlock vulnerability. [SA-14:05]
Fix ECDSA Cache Side-channel Attack in OpenSSL. [SA-14:06]
2014-04-08 23:16:19 +00:00
Andrey V. Elsukov d6700607a0 MFC r263969,263971:
Don't generate an ICMPv6 error message if packet was consumed by filter.
  Remove unused label.

Sponsored by:	Yandex LLC
2014-04-07 12:59:30 +00:00
Andrey V. Elsukov 790b1e51bf MFC r263966:
Don't copy the MF flag from original IP header to ICMP error message.

PR:		188092
Sponsored by:	Yandex LLC
2014-04-07 12:51:41 +00:00
Edwin Groothuis 3f800f9608 MFC of 263901, tzdata2014b
- Update antartica.
 - Comments about historical data for Hawaii.
 - Update details for Crimea on 30 March
 - Move location data Simferopol.
2014-03-29 04:20:55 +00:00
Christian Brueffer 22c9d5eaec MFC: r262484
In puthdr(), start the ELF .data section on a new page, as this is
what btxldr expects (.set MEM_DATA,start+0x1000 in btxldr.S).

This makes resulting ELF binaries bootable with grub, gptboot and boot2.

PR:             153801
Submitted by:   Gleb Kurtsou <gleb.kurtsou at gmail.com>
Tested by:      Ruben Kerkhof <ruben at rubenkerkhof.com>
Glanced at by:  jhb, peter
2014-03-27 20:21:13 +00:00
Christian Brueffer c6449b79ad MFC: r263121
Re-format the license to conform to our BSD license template as much
as possible.  This does not change the wording in any way.

Remove the 3rd clause ("advertising clause") of the BSD license as
permitted by the University of Berkeley on July 22, 1999.  While the
clause itself mentions Lawrence Berkeley Laboratory, UCB is the sole
copyright holder of this file.

Reviewed by:    imp, emaste, eadler
2014-03-27 20:15:35 +00:00
Hans Petter Selasky 3605944226 MFC r263423:
Try to resolve a possible deadlock when detaching USB devices which
create character devices. The deadlock can happen if an application is
issuing IOCTLs which require USB refcounting, at the same time the USB
device is detaching.

There is already a counter in place in the USB device structure to
detect this situation, but it was not always checked ahead of invoking
functions that might destroy character devices, like detach, set
configuration, set alternate interface or detach active kernel driver.
2014-03-27 07:06:29 +00:00
Xin LI c2a28a0da2 MFC r262501:
Refresh our implementation of OpenBSD's Blowfish password format.

Notable changes:

 - Support of $2b$ password format to address a problem where very
   long passwords (more than 256 characters, when an integer
   overflow would happen and cause the length to wrap at 256).
 - Updated pseudo code in comments to reflect the reality.
 - Removed our local shortcut of processing magic string and rely
   on the centralized and tigntened validation.
 - Diff reduction from upstream.

For now we are still generating the older $2a$ format of password
but we will migrate to the new format once the format is formally
finalized.
2014-03-27 00:24:48 +00:00
Xin LI 14e3d68977 MFC r262991:
Correct a typo in nlm_find_host_by_addr(): the intention of the
code is to give "<unknown>" rather than comparing the buffer
against it.
2014-03-26 23:58:17 +00:00
Dimitry Andric 9d08c90281 Turn off warnings for building aicasm. Various versions of yacc exist,
which can result in different warnings-as-errors in this tool, but these
are all completely harmless.

This is a direct commit to stable/7, stable/8, stable/9 and stable/10,
since this kernel build tool has already been removed in head.
2014-03-23 14:18:40 +00:00
Christian Brueffer 3913add21a MFC: r262273
Further refine the auth fail regex to catch more auth failures and
reduce false positives.

The committed patch was provided by Christian Marg.

PR:		91732
Submitted by:	Daniel O'Connor <doconnor at gsoft.com.au>
      		Skye Poier <spoier at gmail.com>
      		Alan Amesbury <amesbury at umn.edu>
      		Christian Marg <marg at rz.tu-clausthal.de>
2014-03-23 13:06:27 +00:00
Hans Petter Selasky fff8060b34 MFC r263159:
Workaround for USB MIDI adapters which use non-supported values of
wMaxPacketSize for BULK endpoints.
2014-03-22 17:21:45 +00:00
Hans Petter Selasky c5dba052c3 MFC r263155:
Add support for more sample rates to USB audio driver.

PR:		usb/171254
2014-03-22 17:14:08 +00:00
Eric Davis c1d758d59f MFC 262999
Fixed MSI interrupt allocation and handling.
Fixed a DMA mapping leak that occurs when defragmenting packet chains.

Approved by:	davidch (mentor)
2014-03-21 23:41:21 +00:00
Xin LI f01594e42c Add Solaris's common/zfs to include search path. 2014-03-20 00:46:25 +00:00
Xin LI 636b922ef2 MFC r260183:
MFV r260154 + 260182:

4369 implement zfs bookmarks
4368 zfs send filesystems from readonly pools

Illumos/illumos-gate@78f1710053
2014-03-20 00:38:46 +00:00
Xin LI 983f666008 MFC r254755: MFV r254748:
Fix memory leak in libzfs's iter_dependents_cb().

Illumos ZFS issues:
  4061 libzfs: memory leak in iter_dependents_cb()
2014-03-20 00:32:26 +00:00
Xin LI cddd0b5eca MFC r259850: MFV r258384:
2583 Add -p (parsable) option to zfs list

illumos/illumos-gate@43d68d68c1
2014-03-20 00:25:40 +00:00
Xin LI c3fcc5000f MFC r256999 (smh):
Added support for the 'zfs list -t snap' and 'zfs snap' aliases which are
available under Oracle Solaris 11.

This includes an update to the ZFS(8) man page to reflect all the
available alias (snap, umount, and recv).

Initial changes obtained from ZFS On Linux + fixes for man page and cmd
help:
https://github.com/zfsonlinux/zfs/commit/10b75496bb0cb7a7b8146c263164adc37f1d176a
https://github.com/zfsonlinux/zfs/commit/cf81b00a73fe47fdb21586ac1cc179b734540973

Obtained from:  https://github.com/zfsonlinux/zfs
2014-03-20 00:14:45 +00:00
Xin LI 290745111e MFC r260181:
Fix build on platforms where atomic_swap_64 is not available.
2014-03-20 00:06:16 +00:00
Xin LI a28acc6e2c MFC r260157: MFV r260153:
4121 vdev_label_init should treat request as succeeded when pool
     is read only

illumos/illumos-gate@973c78e94b
2014-03-20 00:02:14 +00:00
Xin LI 3750c801e7 MFC r260150: MFV r259170:
4370 avoid transmitting holes during zfs send

4371 DMU code clean up

illumos/illumos-gate@43466aae47

NOTE: Make sure the boot code is updated if a zpool upgrade is
done on boot zpool.
2014-03-19 23:58:05 +00:00
Xin LI dba95d0d6d MFC r260141: MFV r258385:
(Note: this change is not applicable to FreeBSD and the file
is not included in build.  It's integrated for completeness).

4128 disks in zpools never go away when pulled

illumos/illumos-gate@39cddb10a3
2014-03-19 23:51:29 +00:00
Xin LI b6129efc8e MFC r260138: MFV r242733:
3306 zdb should be able to issue reads in parallel
3321 'zpool reopen' command should be documented in the man page
and help message

illumos/illumos-gate@31d7e8fa33

FreeBSD porting notes: the kernel part of this changeset depends
on Solaris buf(9S) interfaces and are not really applicable for
our use.  vdev_disk.c is patched as-is to reduce diverge from
upstream, but vdev_file.c is left intact.
2014-03-19 23:46:59 +00:00
Xin LI 6b84bc20e5 MFC r259813 + r259816: MFV r258374:
4171 clean up spa_feature_*() interfaces

4172 implement extensible_dataset feature for use by other zpool
features

illumos/illumos-gate@2acef22db7
2014-03-19 23:40:08 +00:00
Xin LI 07bae6f220 MFC r259811: MFV r258373:
4168 ztest assertion failure in dbuf_undirty

4169 verbatim import causes zdb to segfa
4170 zhack leaves pool in ACTIVE state

illumos/illumos-gate@7fdd916c47
2014-03-19 23:31:47 +00:00
Xin LI ce543bc90b MFC r254587: MFV r254421:
Illumos ZFS issues:
  3996 want a libzfs_core API to rollback to latest snapshot
2014-03-19 23:22:25 +00:00
Xin LI 3916a8438e Make it possible to call VOP_PUTPAGES with shared vnode lock instead
of insisting an exclusive lock.

When VFS_LOCK_DEBUG is enabled and when the underlying file system is
capable of MNT_SHARED_WRITES,  a failed assertion may lead to a panic
because when calling fsync(2),  a.k.a.  sys_fsync() over a vnode with
mmap'ed page,  it will grab a shared lock when underlying file system
is capable,  then call vm_object_page_clean that eventually proceeded
to  vnode_pager_putpages()   that  tries  to do  VOP_PUTPAGES,  where
VOP_PUTPAGES_APV  generated from the declaration asserts the vnode is
always exclusively locked by caller.

This is a direct commit to stable/8 because a majority portion of the
original changeset 257899 (kib), which main goal was an optimization,
was omitted.   We saw the panic independently in a FreeNAS bug ticket
(#4578).
2014-03-19 19:33:55 +00:00
Achim Leubner c3f0c17d88 MFC r257847, r260243: Update aacraid to version 3.2.5.
Approved by:	emaste (co-mentor)
2014-03-19 10:20:13 +00:00
Bryan Drewery f7ac2241aa MFC r263021:
Support Last-Modified behind proxies which return UTC instead of GMT.
2014-03-19 00:55:12 +00:00
Xin LI 18271d2793 MFC r249562:
Fix incomplete printf.

PR:		kern/177889
Submitted by:	Sven-Thorsten Dietrich <sven vyatta com>
2014-03-18 20:05:55 +00:00
Xin LI 2163034da2 MFC r249559:
Don't leak lock when returning.

PR:	 kern/177888
Submitted by:	Sven-Thorsten Dietrich <sven vyatta com>
2014-03-18 20:01:46 +00:00
John Baldwin f8548947b0 Increment fi_wgen before awakening threads polling the read socket of a
FIFO.  Previously, a thread sleeping in poll() could be awakened and
re-poll the FIFO with the old value of fi_wgen (and thus improperly
setting POLLINIGNEOF) before a thread closing a writable fifo descriptor
bumped fi_wgen.  The end result was that the reading thread in poll()
would never see POLLHUP but could block forever (or until a timeout).

This is a direct commit to 8 and 9 since the FIFO code is implemented
differently in 10.x and later.  The pipe-backed FIFOs in 10 do not have
this bug.
2014-03-18 17:17:42 +00:00
Xin LI ebe7e95ec1 MFC r262676:
All callers of static method load_nvlist() in spa.c handles error case,
so there is no reason to assert that we won't hit an error.  Instead,
just return that error to caller and have the upper layer handle it.

Obtained from:	FreeNAS
Reported by:	rodrigc
Reviewed by:	Matthew Ahrens
2014-03-17 19:09:39 +00:00
Hans Petter Selasky 3fcfbc92b4 MFC r227751, r238766, r241553, r242748, r244047, r245947, r246021, r247255,
r249039, r249204, r250848, r251351, r252295, r252498, r255123, r255238,
    r256782, r257132, r257390 and r259675:
- Add various new USB ID's and quirks.
- Make sure the usbdevs mergeinfo gets recorded on the sys directory.
2014-03-14 10:30:17 +00:00
Alexander Motin 3167bfb1da MFC r262886:
Fix support for increased logical sector size (4K-native drives).

- Logical sector size is measured in words, not bytes.
- If physical sector is not bigger then logical sector, it does not mean
it should be set equal to 512 bytes, but set to logical sector.

PR:             misc/187269
Submitted by:   Ravi Pokala <[email protected]>
2014-03-14 07:58:11 +00:00
Xin LI 60bfd0b5e7 MFC r262577: MFV r262570:
4626 libzfs memleak in zpool_in_use()
2014-03-14 01:10:54 +00:00
Xin LI 6104cd7cb2 MFC r262572:
Get rid of the 'chan' from softc structure and use the latter
directly as sleep channel.

PR:		kern/174684
Submitted by:	jmg
2014-03-14 01:05:32 +00:00
Bryan Drewery a31abc7f72 MFC r262220:
Add missing Save Cursor support for VT520

PR:		conf/174937
2014-03-13 01:16:51 +00:00
Hans Petter Selasky 753ab37cc5 MFC r262417, r262439, r262454, r262455 and r262478:
- Several updates and improvements to ATP driver.
- Start effort merging WSP and ATP driver.
2014-03-12 08:04:08 +00:00
Hans Petter Selasky aa519826f1 MFC
Sync usbdevs file to head branch.
2014-03-12 08:00:20 +00:00
Edwin Groothuis 3b955efb3b MFC of 263041, tzdata2014a:
- Fix historical info about asia/Zion, Ukraine
- Fiji starts DST at 02:00 instead of 03:00
- Turkey will move to DST at 31 March this year.
2014-03-11 20:35:24 +00:00
Jung-uk Kim 73aea213f5 MFC: r262746, r262748, r262750, r262752
Move fpusave() wrapper for suspend hander to sys/amd64/amd64/fpu.c.
2014-03-10 20:47:24 +00:00
Christian Brueffer 6890469bd3 MFC: r262333
Simplify the way the end of a singly linked list is followed (for adding
items), so it is more obvious that we aren't going to indirect through
a NULL pointer.

PR:             144723
Submitted by:   Garrett Cooper <yaneurabeya at gmail.com>
Obtained from:  NetBSD r1.19
2014-03-08 12:26:17 +00:00
Erwin Lansing 108c5f819f MFC: r253983-253984
MFV: r262443

	Update BIND to 9.8.7

Note this is a commit straight to stable as BIND no longer exists in head.

Sponsored by:	DK Hostmaster A/S
2014-03-03 09:57:04 +00:00
Christian Brueffer b0755be6f2 MFC: r262574
Add tws(4) to the hardware notes.
2014-03-02 12:15:26 +00:00
Christian Brueffer fc585619ab MFC: r262296
Match the correct variable to the variable description.

PR:		121173
Submitted by:	Thomas Mueller <tmueller at sysgo.com>
2014-02-28 00:45:55 +00:00
Christian Brueffer 11834e7ce9 MFC: r261773
In acline_init(), initialize ac_line to SRC_UNKNOWN.  Previously
this could lead to the -n option effectively being ignored (in case
ac_line happened to be 0 aka SRC_AC), or other undefined behaviour.

PR:		169779
Submitted by:	Alex Gonzalez <loox at e-shell.com>
Reviewed by:	jhb
2014-02-25 07:59:33 +00:00
Eitan Adler 4409129dd9 MFC r261774 by feld:
Add caveat to zpool manpage indicating that we do not automatically activate
	hot spares. This should be MFC'd to all STABLE branches.

	Upon the availability of zfsd, the zpool manpage on relevant branches should
	be updated to remove this caveat and document hot spare's reliance on zfsd.

Requested by:	feld
2014-02-24 17:03:02 +00:00
Hans Petter Selasky 7843ca06c5 MFC r261872:
Fix minor logical error in the XHCI driver. Set correct SETUP packet
direction value.
2014-02-23 13:39:15 +00:00
Hans Petter Selasky 5b25065e90 MFC r261981:
Add new PCI ID for hardware which needs port routing for USB 3.0.

PR:		usb/186811
2014-02-23 13:28:37 +00:00
Hans Petter Selasky abcca3fb89 MFC r261795:
Issue doorbell twice before finally freeing the DMA descriptors. This
should fix DMA descriptor caching issues seen with the EHCI controller
found in Google Chromebook C720 during removal and insertion of USB
devices.
2014-02-23 13:13:59 +00:00
Xin LI 5b89eb85bc MFC r261620: MFV r261619:
4574 get_clones_stat does not call zap_count in non-debug kernel

zap_count(...) is never called in non-DEBUG kernel.
As result "count" variable is always 0, and "goto fail" is always
reached.  This means get_clones_stat function never makes up list
of clones for "clones" properties.
2014-02-22 01:13:48 +00:00
Xin LI 461db47362 MFC r261618:
In g_eli_crypto_hmac_init(), zero out after using the ipad buffer,
k_ipad.

Note that the two consumers in geli(4) are not affected by this
issue because the way the code is constructed and as such, we
believe there is no security impact with or without this change
with geli(4)'s usage.

Reported by:	Serge van den Boom <serge vdboom.org>
Reviewed by:	pjd
2014-02-22 00:41:03 +00:00
Christian Brueffer 622f12ae97 MFC: r261900
In chat_UpdateSet(), initialize the input buffer to prevent stale data
from previous timed out commands.

PR:		186530
Submitted by:	Alexander Zagrebin <alexz at visp.ru>
Reviewed by:	brian
2014-02-21 09:27:48 +00:00
Christian Brueffer ba815d04bc MFC: r261885
In sgetpwnam(), save and free pw_class like all other char members
of struct passwd.  This fixes spurious "login_getclass: unknown class"
errors.

PR:		186439
Submitted by:	UEMURA Tetsuya <t_uemura at macome.co.jp>
2014-02-21 09:22:37 +00:00
Christian Brueffer 877ab764b0 MFC: r261858
Fix a bug in be_uuid_dec(); it called le16dec() instead of be16dec(),
probably due to copy+pasting le_uuid_dec().

PR:		146588
Submitted by:	Erwin Rol <erwin at erwinrol.com>
Reviewed by:	marcel
2014-02-20 09:00:13 +00:00
Eitan Adler 6ad457c2bc MFC r257883:
Add support for SIIG x1 pci-e single parallel port card (JJ-E01211-S1)

PR:		kern/182217
2014-02-19 19:47:08 +00:00
John Baldwin 110ffed3ea MFC 261512,261514:
- Partially revert r52493 and change client side interval statistics to
  report the actual number of RPCs issued, not the theoretical number
  that would be issued if all caching was disabled.
- Use the DELTA() macro to tidy the server-side interval stats code a bit.
2014-02-19 19:28:49 +00:00
John Baldwin a796f291e2 MFC 261524:
Properly set the alignment flags when allocating the initial range for a
BAR.  This only really matters when pci_do_realloc_bars is enabled and
the initial allocation of a specific range fails.
2014-02-19 18:35:22 +00:00
John Baldwin 1912efe067 MFC 250691:
Return one-based key so that user can check if the key is ever allocated
in the first place.
2014-02-19 15:00:55 +00:00
John Baldwin 1d2972a1d5 MFC 261518:
- Update a few places to account for va_copy().
- Create a separate 'return values' section and move some statements about
  return values to that section.
- Note that each invocation of va_start() and va_copy() must be paired with
  va_end() in the same function.
2014-02-18 20:16:32 +00:00
Andriy Gapon 4fdb9e4284 MFC r259576: MFV r258923: 4188 assertion failed in dmu_tx_hold_free():
dn_datablkshift != 0
2014-02-18 15:45:15 +00:00
Andriy Gapon 652092f24d MFC r259052: Expose spa_asize_inflation 2014-02-18 15:38:50 +00:00
Andriy Gapon 9bd2fa0a9e MFC r258294: Fix ZFS deadlock when sending a snapshot which is mounted 2014-02-18 15:30:11 +00:00
Andriy Gapon 6188383ead MFC r256889: Use the vdev's ashift to calculate the supported min block
size passed to zio_compress_data
2014-02-18 15:24:59 +00:00
Andriy Gapon 4cd4620cd7 MFC r254757: MFV r254749: 4046 dsl_dataset_t ds_dir->dd_lock is highly
contended
2014-02-18 15:18:21 +00:00
Andriy Gapon bb10740ab4 MFC r254608: Add kstat entries for ZFS compression statistics 2014-02-18 15:05:09 +00:00
Andriy Gapon 5f77fc368f MFC r253820: MFV r253782: 3888 zfs recv -F should destroy any snapshots
created since the incremental source
2014-02-18 14:11:19 +00:00
Andriy Gapon 2a7041ea8c MFC r253819: MFV r253781 + r253871: 3894 zfs should not allow snapshot of inconsistent dataset 2014-02-18 14:06:59 +00:00
Andriy Gapon 581d4e6fce MFC r250149: In case ZFS doesn't use UMA for buffers there's no need to
waste memory
2014-02-18 13:59:06 +00:00
Andriy Gapon c5230bac54 MFC r240829: remove cache entries associated with the source and the
target of rename()
2014-02-18 13:49:03 +00:00
John Baldwin 15c0e2e4bd MFC 260926:
Add support for displaying VPD for PCI devices via pciconf.
- Store the length of each read-only VPD value since not all values are
  guaranteed to be ASCII values (though most are).
- Add a new pciio ioctl to fetch VPD for a single PCI device.  The values
  are returned as a list of variable length records, one for the device
  name and each keyword.
- Add a new -V flag to pciconf's list mode which displays VPD data for
  each device.
2014-02-17 22:19:49 +00:00
Andriy Gapon 4165b55775 MFC r260185: MFV r260155: 4391 panic system rather than corrupting pool
if we hit bug 4390
2014-02-17 18:24:37 +00:00
Andriy Gapon 405b4466ab MFC r260835: MFV r260834: Fix memory leak of compressed buffers in
l2arc_write_done
2014-02-17 18:16:50 +00:00
Andriy Gapon 5e94b1233c MFC r260703: zinject must use ioctl(2) compatibility wrapper 2014-02-17 18:07:07 +00:00
Andriy Gapon 223229fd17 MFC r260704,260717: zfs: getnewvnode_reserve must be called outside of a
zfs transaction
2014-02-17 17:59:51 +00:00
Andriy Gapon b9445b646f MFC r260812: traverse_visitbp: visit DMU_GROUPUSED_OBJECT before
DMU_USERUSED_OBJECT
2014-02-17 17:52:14 +00:00
Andriy Gapon 38229e78a8 MFC r260811: zdb -R: do not treat numeric parameters to a flag as more flags 2014-02-17 17:49:03 +00:00
Andriy Gapon 30a352e7c6 MFC r260703: zinject must use ioctl(2) compatibility wrapper 2014-02-17 17:46:33 +00:00
Andriy Gapon 0a7b68d70e MFC r254591,255753: Enhance the ZFS vdev layer to maintain both a
logical and a physical minimum allocation size for devices

Missed userland bits.
2014-02-17 17:42:33 +00:00
Andriy Gapon c979bb3858 MFC r260706: zfs_deleteextattr: name buffer from namei is needed by zfs_remove 2014-02-17 17:28:19 +00:00
Andriy Gapon 26648c9076 MFC r258717: MFV r258371,r258372: 4101 metaslab_debug should allow for
fine-grained control
2014-02-17 17:12:11 +00:00
Andriy Gapon 508a5c1d51 MFC r255750: MFV r254750: Add support of Illumos dumps on zvol over RAID-Z.
Note that this only adds the features.  FreeBSD would
still need more work to support dumping on zvols.

MFC slacker:	delphij
2014-02-17 17:01:41 +00:00
Andriy Gapon e7da858bd2 MFC r254112: MFV r254079: multiple ZFS issues 2014-02-17 16:48:11 +00:00
Andriy Gapon c90671540a MFC r254077: MFV r254071: Fix a regression introduced by fix for Illumos bug #3834 2014-02-17 16:41:58 +00:00
Andriy Gapon 73e3663d33 MFC r252840: 3836 zio_free() can be processed immediately in the common case
MFC slacker:	mm
2014-02-17 16:33:42 +00:00
Andriy Gapon be5566fe09 MFC r254591,255753: Enhance the ZFS vdev layer to maintain both a
logical and a physical minimum allocation size for devices

Note: on this branch the commit is adjusted for absence of U64
type support in sysctl infrastructure.
2014-02-17 16:30:01 +00:00
Andriy Gapon fa8d37d412 MFC r253441: Manually merge part of vendor import r238583 from Illumos 2014-02-17 16:18:13 +00:00
Bryan Drewery 2cae6f0472 MFC r261401:
Fix newsyslog(8) to use the size of the file instead of the blocks it
  takes on disk, as advertised in newsyslog.conf(5).

Approved by:	bapt (mentor, implicit)
2014-02-17 16:18:04 +00:00
Andriy Gapon a555ec2fb1 MFC r255226: Add sysctl/tunables for various metaslab variables
MFC slacker:	pjd
2014-02-17 15:51:19 +00:00
Andriy Gapon eff32b517a MFC r258715: opensolaris compat: add taskq_wait emulation 2014-02-17 15:41:01 +00:00
Andriy Gapon 086634f9b4 MFC r261122: dtrace: remove unexplained 16MB limitation from dt_alloc/dt_zalloc 2014-02-17 15:35:36 +00:00
Andriy Gapon 5485b8462a MFC r258713,262062: add taskqueue_drain_all 2014-02-17 15:24:49 +00:00
Andriy Gapon e666494ab9 MFC r214019: Update links for taskqueue(9) functions 2014-02-17 15:20:03 +00:00
Andriy Gapon 350cbe631b MFC r253720: Use kern_ioctl() rather than ioctl() for testing the FBT provider 2014-02-17 11:28:27 +00:00
Andriy Gapon 1cb29e457d MFC r252895: Add a man page for the SDT_* macros 2014-02-17 11:23:21 +00:00
Mark Johnston f26b471a27 MFC r249514 (by gnn):
Point args[0] not at the thread that is ending but at the one that
is starting.  This is in line with practice in OpenSolaris.

Note that this change is only in ULE and not in the 4BSD scheduler.
Once this change settles in (MFC timeout has expired) we'll try it out
on 4BSD as well.

MFC r260043:
The arguments to sched:::off-cpu are the thread and associated process of
the thread selected to run, not the currently running thread.
2014-02-17 05:06:43 +00:00
Christian Brueffer 2a3b5b2123 Direct commit to stable/8 to note that the nve(4) driver has been
deprecated.
2014-02-16 19:44:30 +00:00
Christian Brueffer 07fa0afe7a MFC: r261838
Add a deprecation notice to nve.4 and Xref nfe.4.
2014-02-16 11:17:40 +00:00
Christian Brueffer 40510aefb6 MFC: r261584
In IPv6 code examples, use the correct v6 socket.
2014-02-14 08:26:05 +00:00
Mark Johnston 5bb1d1c01e MFC r257600:
Initialize the struct tm before handing it to strptime(3).
2014-02-13 04:55:46 +00:00
Peter Wemm 5f217dc2ed MFC r256557 - kernel and userland osreldate helpers. 2014-02-11 17:07:28 +00:00
Hans Petter Selasky b22adae037 MFC r244535, r245995, r261505 and r258961:
- Use a boundary of zero, hence a PAGE_SIZE boundary
is implied by all memory allocations.
- Fix an external compiler warning about write-only
assigned variable.
2014-02-07 07:34:47 +00:00
Christian Brueffer 81f154bfa9 MFC: r233049 by rmh
Remove gratuitous DEBUG_FLAGS="-g" setting (this is already the default
option with GENERIC kernels).

PR:		179536
Submitted by:	Alexey Markov
2014-02-06 07:59:05 +00:00
Hans Petter Selasky 453537eee9 MFC r260315:
Implement two new libusb API functions.

PR:		usb/185454
2014-02-04 10:25:31 +00:00
Hans Petter Selasky 0b907f03aa MFC r261228:
When detaching a [USB] keyboard, keys might still be pressed. Ensure
that all pressed keys are released before completing the USB keyboard
detach. This will prevent so-called "ghost-keys" from appearing after
that the USB device generating the key event(s) has been detached.
2014-02-04 09:03:14 +00:00
Hans Petter Selasky f742ffc579 MFC r261224:
Comply to the official LibUSB v1.0 API:
"It is legal to attempt to claim an already-claimed interface."
2014-02-04 08:58:12 +00:00
Hans Petter Selasky f30571d105 MFC r261004, r261005 and r261033:
Adjust the DMA delay logic so that the DMA delay does not become too small.
2014-02-04 08:52:08 +00:00
Hans Petter Selasky b4a8363ddb MFC r261123:
Reduce dmesg verbosity.
2014-02-04 08:49:56 +00:00
Gregory Neil Shapiro 543d40a132 MFC: Note merge of sendmail 8.14.8. 2014-02-02 00:08:52 +00:00
Gregory Neil Shapiro 1bf3f9d9d1 MFC: Minor changes to force commit these files so new freebsd*.cf files are
built to use the new sendmail-8.14.8/cf tree.
2014-02-02 00:08:28 +00:00
Gregory Neil Shapiro efc477be2f MFC: Add missing svn:keywords property to new files 2014-02-02 00:07:55 +00:00
Gregory Neil Shapiro b9abb2f8d9 MFC: Update for sendmail 8.14.8 import 2014-02-02 00:07:16 +00:00
Gregory Neil Shapiro 3e3aa89fe6 MFC: Remove local FreeBSD workaround now that upstream project has a better fix. 2014-02-02 00:06:44 +00:00
Gregory Neil Shapiro e125749c93 MFC: Add new sendmail 8.14.8 file 2014-02-02 00:05:30 +00:00
Gregory Neil Shapiro 7065fc5937 MFC: Merge sendmail 8.14.8 2014-02-02 00:04:23 +00:00
Gregory Neil Shapiro b9fd4ebf76 MFC: Update link to vendor import instructions 2014-02-01 22:06:24 +00:00
Sergey Kandaurov 19d12512e6 MFC r261075: Update EINVAL description. 2014-01-30 05:38:14 +00:00
John Baldwin ba1c474a3a MFC 260910:
- Allow PCI devices that are attached to a driver to be identified by their
  device name instead of just the selector.
- Accept an optional device argument to -l to restrict the output to only
  listing details about a single device.  This is mostly useful in
  conjunction with other flags like -e or -c to allow a user to query
  details about a single device.
2014-01-28 21:56:18 +00:00
Hans Petter Selasky bc80bd7b90 MFC r260978:
Add check for "hw.usb.no_pf" sysctl value.
2014-01-28 07:11:23 +00:00
Hans Petter Selasky e1a1d8d16f MFC r258545:
Comply to the XHCI specification. Certain input context fields should
always be zero.
2014-01-24 08:17:47 +00:00
Hans Petter Selasky 30040b5060 MFC r260808 and r260814:
- Close a minor deadlock.
- Fix a possible memory use after free and leak situation associated
with USB device detach when using character device handles. This also
includes LibUSB. It turns out that "usb_close()" cannot always get a
reference to clean up its USB transfers and such, if called during the
kernel USB device detach.
2014-01-24 08:06:14 +00:00
Hans Petter Selasky 118f31b981 MFC r260588 and r260589:
- Separate I/O errors from reception of STALL PID.
- Implement better error recovery for Transaction Translators, TTs,
found in High Speed USB HUBs which translate from High Speed USB into
FULL or LOW speed USB. In some rare cases SPLIT transactions might get
lost, which might leave the TT in an unknown state. Whenever we detect
such an error try to issue either a clear TT buffer request, or if
that is not possible reset the whole TT.
2014-01-24 08:01:42 +00:00
Hans Petter Selasky 99cc31998b MFC r260563:
Make sure reserved fields of the EHCI DMA descriptors are not dirty
after previous transfers.
2014-01-24 07:40:58 +00:00
Hans Petter Selasky ca5acd6040 MFC r260559:
Don't do synchronous USB requests inside USB transfer callbacks. It is
technically OK, but not recommended.
2014-01-24 07:35:27 +00:00
Hans Petter Selasky 16c10d4b1d MFC r260388, r260535 and r260536:
Fix XHCI interrupt logic for "Intel Lynx Point" found in MBP2013.
2014-01-24 07:29:31 +00:00
Pedro F. Giffuni f86153fd97 MFC r260332;
gcc: backport some fixes from llvm-gcc

llvm-gcc backported some patches from gcc trunk:

http://gcc.gnu.org/ml/gcc-cvs/2007-05/msg00662.html
http://gcc.gnu.org/ml/gcc-cvs/2007-07/msg00019.html
http://gcc.gnu.org/ml/gcc-cvs/2007-08/msg00240.html
http://gcc.gnu.org/ml/gcc-cvs/2007-08/msg00493.html

The first two were always GPL2. The last two were
added after the GPL3 transition, but were written
by [email protected] and Rafael Espíndola got permission
to relicense them under the GPL2 for inclusion in
llvm-gcc.

This fixes GCC-PR c++/31749

Obtained from:	llvm-gcc (rev. 75463; GPLv2)
2014-01-21 16:02:31 +00:00
Dmitry Morozovsky 8aed15f8b5 MFC r259925-259926 (with appropriate changes to
g_part_uuid_alias struct):

  Add GPT UUID for VMware vSAN meta-data partition.

Approved by:	ae
2014-01-21 09:22:00 +00:00
Bryan Venteicher 4f5b60938f MFC r260566: Remove incorrect bit shift when assigning the LUN request field 2014-01-18 03:45:07 +00:00
Andriy Gapon 2e5dfffa89 fix a botched merge in r260775, MFC of r258739
This is a direct commit.

Pointyhat to:	avg
2014-01-16 18:01:57 +00:00
Andriy Gapon 7c7857a891 Revert r260780 "add zfs_bmap to aid vnode_pager_haspage"
I thought that I had to have that commit in this branch, but now I
decided to not bother.

This is a direct commit, obviously.
2014-01-16 17:58:22 +00:00
Andriy Gapon 55473e0412 MFC r243518: add zfs_bmap to aid vnode_pager_haspage 2014-01-16 16:37:17 +00:00
Andriy Gapon f5395716e2 MFC r258720: MFV r258665: 4347 ZPL can use dmu_tx_assign(TXG_WAIT) 2014-01-16 16:15:56 +00:00
Andriy Gapon 733c71aa45 MFC r258739: zfs mappedread_sf: assert that a page is never partially valid 2014-01-16 16:13:44 +00:00
Andriy Gapon fffff6621c MFC r258634: MFV r258376: 3964 L2ARC should always compress metadata
buffers
2014-01-16 16:08:26 +00:00
Andriy Gapon bc1d10c6f9 MFC r258633: MFV r255256: 3954 metaslabs continue to load even after
hitting zfs_mg_alloc_failure limit
2014-01-16 16:04:36 +00:00
Andriy Gapon 8df2b921b9 MFC r258632,258704: MFV r255255: 4045 zfs write throttle & i/o scheduler
performance work

Note a change in dmu_tx_delay: pause_sbt is not available in this
branch.

Sponsored by:	HybridCluster [merge]
2014-01-16 16:00:05 +00:00
Andriy Gapon 1e1045bbdd MFC r245511: MFV r245510: improve the comment in txg.c
MFC slacker:	delphij
2014-01-16 15:47:09 +00:00
Andriy Gapon aa3297d2cb MFC r254074: MFV r254070: Merge vendor bugfix for ZFS test suite that
triggers false positives

MFC slacker:	delphij
2014-01-16 15:45:04 +00:00
Andriy Gapon 274cd29975 MFC r251478: MFV r251474: 3137 L2ARC compression
MFC slacker:	delphij
2014-01-16 15:29:44 +00:00
Andriy Gapon efd6fa2ab9 MFC r248426: Fix typo in sysctl description
MFC slacker:	mm
2014-01-16 15:22:49 +00:00
Andriy Gapon f8103b0890 MFC r255437: MFV r247844 (illumos-gate 13975:ef6409bc370f)
Note that a different kind of cv_timedwait_hires shim is provided in
this branch because cv_timedwait_sbt is not available for better
emulation.

Sponsored by:	HybridCluster [merge]
2014-01-16 15:11:48 +00:00
Andriy Gapon 41e4c848d3 MFC r258631: MFV r247578
3581 spa_zio_taskq[ZIO_TYPE_FREE][ZIO_TASKQ_ISSUE]->tq_lock is piping hot
2014-01-16 14:48:26 +00:00
Andriy Gapon 4e8607bfd4 MFC r258630: 734 taskq_dispatch_prealloc() desired 2014-01-16 14:42:22 +00:00
Andriy Gapon 0845b9efeb MFC r258743: drop ZUT_OBJ 2014-01-16 14:37:50 +00:00
Andriy Gapon 7c4cc21e56 MFC r258630: 734 taskq_dispatch_prealloc() desired 2014-01-16 14:35:20 +00:00
Andriy Gapon f760ec8021 MFC r258628: opensolaris taskq: some cosmetic changes 2014-01-16 14:30:46 +00:00
Andriy Gapon 2e52167c1e MFC r258647: zfsboottest: properly specify a library dependency 2014-01-16 14:24:44 +00:00
Andriy Gapon 03644300f4 MFC r258638,258642: expose zfs_flags as debug.zfs_flags r/w tunable and sysctl
Sponsored by:	HybridCluster
2014-01-16 14:22:03 +00:00
Andriy Gapon da1ddf239c MFC r258352: fsx: add an option to randomly call msync(MS_INVALIDATE) 2014-01-16 14:17:55 +00:00
Andriy Gapon ea79b50cf2 MFC r258351: fsx: new option to disable msync(MS_SYNC) after each write 2014-01-16 14:15:14 +00:00
Andriy Gapon 37c355b304 MFC r253821,254753,256259
MFV r253783: 3834 incremental replication of 'holey' file systems is
slow

MFV r254747:4047 panic from dbuf_free_range() from dmu_free_object()
while doing zfs receive

MFV r255257: 4082 zfs receive gets EFBIG from dmu_tx_hold_free()
2014-01-16 14:05:05 +00:00
Xin LI 8bfc1479a4 Fix BIND remote denial of service vulnerability.
Security:	FreeBSD-SA-14:04.bind
Security:	CVE-2014-0591
2014-01-14 19:38:37 +00:00
Xin LI c69e9ad6fc MFC r259951 (kib):
Do not coalesce stack entry. Pass MAP_STACK_GROWS_DOWN and
MAP_STACK_GROWS_UP flags to vm_map_insert() from vm_map_stack()
2014-01-14 19:33:28 +00:00
Xin LI f2f9c48e9a On stable/8 and stable/9, disable hardware random number generators
by default.  This is a direct commit to stable/ branches because
HEAD and stable/10 have superior implementation of random device.

Approved by:	so
2014-01-14 19:27:42 +00:00
Xin LI c7d9dd8b06 MFC r260637:
Disable 'monitor' feature in ntpd by default.

Security:	FreeBSD-SA-14:02.ntpd
Approved by:	so
2014-01-14 19:20:41 +00:00
Xin LI b6b200c3e6 MFC r260636:
Fix bsnmpd remote denial of service vulnerability.

Reported by:	dinoex
Submitted by:	harti
Security:	FreeBSD-SA-14:01.bsnmpd
Security:	CVE-2014-1452
2014-01-14 19:17:20 +00:00
Sergey Kandaurov a3fa30193f MFC r259921,259950:
Provide the manual page for aio_fsync(2).
2014-01-14 10:03:31 +00:00
John Baldwin a98293b6b4 MFC 197775,197777-197779,197781,197794,243152,243313,255478:
First cut at implementing SOCK_SEQPACKET support for UNIX (local) domain
sockets.  This allows for reliable bi-directional datagram communication
over UNIX domain sockets, in contrast to SOCK_DGRAM (M:N, unreliable) or
SOCK_STERAM (bi-directional bytestream).  Largely, this reuses existing
UNIX domain socket code.  This allows applications requiring record-
oriented semantics to do so reliably via local IPC.
2014-01-13 21:29:34 +00:00
Alexander Motin 5fe6baa90a MFC r259197:
Do not DELAY() for P-state transition unless we want to see the result.

Intel manual says: "If a transition is already in progress, transition to
a new value will subsequently take effect. Reads of IA32_PERF_CTL determine
the last targeted operating point."  So seems it should be fine to just
trigger wanted transition and go.  Linux does the same.
2014-01-13 19:14:29 +00:00
Pedro F. Giffuni a5657e7a3e MFC r259666, r259696:
gcc: warnings from -Wformat-security

Obtained from:	Apple GCC 4.2 - 5646 (Radar 5764921)
2014-01-13 16:05:18 +00:00
Pedro F. Giffuni cd1f6ffa74 MFC r259920:
gcc: Implement -Wmost for compatibility with clang.

This is equivalent to -Wall -Wno-parentheses.

Obtained from:	Apple GCC 4.2 - 5531
2014-01-13 15:32:37 +00:00
Pedro F. Giffuni cb961c03bc MFC r258573:
Removes strict-aliasing warnings from newer GCC in tcpdump.
2014-01-13 15:28:39 +00:00
Pedro F. Giffuni dbf12b3682 MFC r258081, r258138, r258143, r258179, r258157, r258204, r258205,
r258206, r258207, r258321

This is a series of commits inspired on Google's gcc-4.2.1 for
Android that were taken from the gcc pre-4.3 under the GPLv2.

gcc: Backport fixes for -W parentheses in C++
	This fixes GCC 19564.
gcc: merge rs6000 change from FSF pre-gcc43
	Don't set MASK_PPC_GFXOPT for 8540 or 8548.
Merge vrp-tree fix from gcc-4.3
	Fix missed conversion from / to >> (GCC PR32521)
Merge in GCCr120505 to include definition of TREE_OVERFLOW_P
gcc: warn about integer overflow in constant expressions in the C++
frontend.
gcc: Add a new option -Wvla to warn variable length array.
libcpp: preprocessor speedup patches from upstream gcc.
gcc: add femit-struct-debug support to reduce Reduce dwarf debug size
gcc: Fix postreload-gcse treatment of call-clobbered registers.
gcc: Record some previous commits in the ChangeLog.gcc43 file.

Tested by:	danfe
2014-01-13 15:22:37 +00:00
Hans Petter Selasky 6bd35f8942 MFC r260184:
Minor correction for the XHCI reset logic.
2014-01-11 08:24:52 +00:00
Pedro F. Giffuni 307c46270d MFC r260361:
gcc: Fix optimization bug.

GCC-PR rtl-optimization/34628
	* combine.c (try_combine): Stop and undo after the first combination
	if an autoincrement side-effect on the first insn has effectively
	been lost.
2014-01-11 01:50:45 +00:00
Peter Wemm c416a3e9d1 Revert MFC of r258821 - it was already handled by MFC of r239672.
Pointy hat to: peter
2014-01-08 03:16:50 +00:00
Eric Davis 4a239e5cb6 Merged r260415 from head.
Approved by:	davidcd
2014-01-07 23:14:55 +00:00
Peter Wemm a8c88afc9d MFC r258821 - fix tcp simultaneous close
PR:             kern/99188
2014-01-07 23:02:13 +00:00
Mikolaj Golub 0f88f85180 MFC r260049:
Add mibs for hastd(1) queue stats.
2014-01-07 21:25:18 +00:00
Hans Petter Selasky 969bbb3b24 MFC r235128:
Add missing LibUSB 1.0 API function: libusb_get_string_descriptor().
2014-01-05 10:52:57 +00:00
Dimitry Andric 16ba6d447a MFC r260112:
In sys/dev/sound/pci/maestro.c, #if 0 two unused static functions.
2014-01-04 23:12:01 +00:00
Dimitry Andric dd01b29c08 MFC r260095:
For sys/boot/i386 and sys/boot/pc98, separate flags to be passed
directly to the linker (LD_FLAGS) from flags passed indirectly, via the
compiler driver (LDFLAGS).

This is because several Makefiles under sys/boot/i386 and sys/boot/pc98
use ${LD} directly to link, and the normal LDFLAGS value should not be
used in these cases.
2014-01-04 22:00:07 +00:00
Dimitry Andric b1b804a6b4 MFC r260103:
In sys/amd64/amd64/pmap.c, remove static function pmap_is_current(),
which has been unused since r189415.

Reviewed by:	alc
2014-01-04 21:45:52 +00:00
Dimitry Andric 7b9820e468 MFC r260057:
In sys/dev/scc, remove unused static function scc_setmreg().  While
here, invoke scc_getmreg() in two more places where it can be used.

Reviewed by:	marcel
2014-01-04 21:32:53 +00:00
Dimitry Andric ff57b2a47e MFC r260055:
In sys/dev/usb/wlan/if_urtw.c, #if 0 a static const variable, which has
been unused since r198194.
2014-01-04 21:18:54 +00:00
Dimitry Andric 17c6f45be5 MFC r260054:
In sys/dev/tpm/tpm.c, #if 0 an unused static function.
2014-01-04 19:13:25 +00:00
Dimitry Andric efae3fe862 MFC r260048:
In sys/netgraph/netflow, use __FBSDID() instead of old-style rcs_id[].
2014-01-04 19:04:53 +00:00
Dimitry Andric 281636a6d0 MFC r260042:
Remove superfluous old-style rcsid[] from if_my.c.  There is already an
__FBSDID() at the top of the file.
2014-01-04 18:58:18 +00:00
Dimitry Andric 5b9d6332d2 MFC r260040:
In sys/dev/mcd/mcd.c, mark the static const COPYRIGHT string as __used,
so it ends up in the object file, and no warnings are emitted about it
being actually unused.
2014-01-04 18:53:31 +00:00
Dimitry Andric 576f0e4561 MFC r260038:
In sys/dev/en/midway.c, #if 0 an unused static function.
2014-01-04 18:48:29 +00:00
Eric Davis 2de681f2dd MFC Broadcom 10Gb bxe driver
Merged r255736, r255861, r256299, r256341, r258187, r259928, r260113

Approved by:  davidch (mentor)
2014-01-04 18:10:15 +00:00
Dimitry Andric b32688e744 MFC r260016:
Remove superfluous old-style rcsid[] from if_sk.c.  There is already an
__FBSDID() at the top of the file.
2014-01-04 17:33:05 +00:00
Sergey Kandaurov 59af27838f MFC r259872:
The compile time constant limit on number of swap devices was removed in 5.2.
 As such, remove the EINVAL error saying so.  Currently the vm.nswapdev sysctl
 just represents the number of added swap devices.
2014-01-02 16:41:10 +00:00
Glen Barber 13f9807c7c MFC r260125:
Bump copyright year.
  Happy New Year 2014!

Sponsored by:	The FreeBSD Foundation
2013-12-31 12:25:04 +00:00
Mikolaj Golub a67d8944a9 MFC r257155, r257582, r259191, r259192, r259193, r259194, r259195, r259196:
r257155:

Make hastctl list command output current queue sizes.

Reviewed by:	pjd

r257582 (pjd):

Correct alignment.

r259191:

For memsync replication, hio_countdown is used not only as an
indication when a request can be moved to done queue, but also for
detecting the current state of memsync request.

This approach has problems, e.g. leaking a request if memsynk ack from
the secondary failed, or racy usage of write_complete, which should be
called only once per write request, but for memsync can be entered by
local_send_thread and ggate_send_thread simultaneously.

So the following approach is implemented instead:

1) Use hio_countdown only for counting components we waiting to
   complete, i.e. initially it is always 2 for any replication mode.

2) To distinguish between "memsync ack" and "memsync fin" responses
   from the secondary, add and use hio_memsyncacked field.

3) write_complete() in component threads is called only before
   releasing hio_countdown (i.e. before the hio may be returned to the
   done queue).

4) Add and use hio_writecount refcounter to detect when
   write_complete() can be called in memsync case.

Reported by:	Pete French petefrench ingresso.co.uk
Tested by:	Pete French petefrench ingresso.co.uk

r259192:

Add some macros to make the code more readable (no functional chages).

r259193:

Fix compiler warnings.

r259194:

In remote_send_thread, if sending a request fails don't take the
request back from the receive queue -- it might already be processed
by remote_recv_thread, which lead to crashes like below:

  (primary) Unable to receive reply header: Connection reset by peer.
  (primary) Unable to send request (Connection reset by peer):
      WRITE(954662912, 131072).
  (primary) Disconnected from kopusha:7772.
  (primary) Increasing localcnt to 1.
  (primary) Assertion failed: (old > 0), function refcnt_release,
      file refcnt.h, line 62.

Taking the request back was not necessary (it would properly be
processed by the remote_recv_thread) and only complicated things.

r259195:

Send wakeup to threads waiting on empty queue before releasing the
lock to decrease spurious wakeups.

Submitted by:	davidxu

r259196:

Check remote protocol version only for the first connection (when it
is actually sent by the remote node).

Otherwise it generated confusing "Negotiated protocol version 1" debug
messages when processing the second connection.
2013-12-28 19:23:16 +00:00
Dimitry Andric 3bdeee5195 MFC r259756:
Get rid of register keyword usage in gperf, it is totally obsolete for
C++, and this allows gperf to be compiled for C++11 without a warning
about it.
2013-12-28 00:03:15 +00:00
Xin LI 1ba4cb7785 MFC r259973:
Tighten default restrictions for ntpd(8) server and provide a link
to NTP access restriction documentation.
2013-12-27 23:09:40 +00:00
John Baldwin 03ee60e806 MFC 259014: There is no sysctl with the MIB { CTL_KERN, KERN_MAXID }. 2013-12-26 16:59:50 +00:00
Dimitry Andric 3ed571155a MFC r259724:
Apply upstream commit 33312fd828e59c78ae4ee30fd70d0ca109748cf0 (by
zoulasc) to contrib/file:

  don't write a char to a pointer.
2013-12-25 00:48:08 +00:00
Andrey V. Elsukov 7d51e45639 MFC r259520:
Fix copy/paste typo.
2013-12-24 23:50:35 +00:00
John Baldwin 2461cb2a87 MFC 258869:
Fix an off-by-one error in r228960.  The maximum priority delta provided
by SCHED_PRI_TICKS should be SCHED_PRI_RANGE - 1 so that the resulting
priority value (before nice adjustment) is between SCHED_PRI_MIN and
SCHED_PRI_MAX, inclusive.
2013-12-24 19:03:30 +00:00
Edwin Groothuis 9fa822450d MFC of 259626, tzdata2013i:
Removed support for solar-time-based time zones
Jordan stays at summer time this year.
Fix historical data for Cuba
2013-12-19 20:26:00 +00:00
Don Lewis 1c78f4545a MFC r258363:
Add alternate ID for Novatel MiFi 2200 CDMA, which is used by my
Virgin Mobile branded device.  It needs the U3GINIT_SCSIEJECT quirk.
2013-12-19 09:46:14 +00:00
Hans Petter Selasky a909e0b09a MFC r259248 and r259462:
Set chain bit correctly. This will fix some problems sending and
receiving Zero Length Packets, ZLPs. See comment in code for more
information.
2013-12-19 07:17:18 +00:00
Hans Petter Selasky 14d5cdca40 MFC r259023 and r259095:
Improve the XHCI command timeout recovery handling code.
Fix some typos while at it.
2013-12-19 07:09:28 +00:00
Nathan Whitehorn e0d00f514b MFC r258819,258928:
Add new sysctl, kern.supported_archs, containing the list of FreeBSD
MACHINE_ARCH values whose binaries this kernel can run. This patch provides
a feature requested for implementing pkgng ABI identifiers in a robust
way.

The list is designed to indicate whether, say, an i386 package can be run on
the current system. If kern.supported_abis contains "i386", then the answer
is yes. Otherwise, the answer is no.

At the moment, this only supports MACHINE_ARCH and MACHINE_ARCH32. As we
gain support for more interesting combinations, this needs to become more
flexible, possibily through the sysent framework, along with the
hw.machine_arch emulation immediately preceding this code in kern_mib.c.

Reviewed by:	imp
2013-12-16 15:08:30 +00:00
Benjamin Kaduk 61b1c0afe4 Fix build breakage after r259449
Approved by:	hrs (mentor, src committer)
2013-12-16 06:56:38 +00:00
Benjamin Kaduk aeea16eb51 MFC r259286,259424,259425:
Apply patch from upstream Heimdal for encoding fix

  RFC 4402 specifies the implementation of the gss_pseudo_random()
  function for the krb5 mechanism (and the C bindings therein).
  The implementation uses a PRF+ function that concatenates the output
  of individual krb5 pseudo-random operations produced with a counter
  and seed.  The original implementation of this function in Heimdal
  incorrectly encoded the counter as a little-endian integer, but the
  RFC specifies the counter encoding as big-endian.  The implementation
  initializes the counter to zero, so the first block of output (16 octets,
  for the modern AES enctypes 17 and 18) is unchanged.  (RFC 4402 specifies
  that the counter should begin at 1, but both existing implementations
  begin with zero and it looks like the standard will be re-issued, with
  test vectors, to begin at zero.)

  This is upstream's commit f85652af868e64811f2b32b815d4198e7f9017f6,
  from 13 October, 2013:
  % Fix krb5's gss_pseudo_random() (n is big-endian)
  %
  % The first enctype RFC3961 prf output length's bytes are correct because
  % the little- and big-endian representations of unsigned zero are the
  % same.  The second block of output was wrong because the counter was not
  % being encoded as big-endian.
  %
  % This change could break applications.  But those applications would not
  % have been interoperating with other implementations anyways (in
  % particular: MIT's).

Bump __FreeBSD_version accordingly and add a note in UPDATING.

Approved by:	hrs (mentor, src committer)
2013-12-16 02:30:56 +00:00
Andrey V. Elsukov c52caa27ab MFC r257987:
Initialize prot variable.

  PR:		177417
2013-12-14 04:24:50 +00:00
Pedro F. Giffuni 981ddda6da MFC r244673:
Fix the __glibcxx_min and __glibcxx_max macros for a signed wchar_t.

This seems to be needed by newer compilers.
2013-12-13 02:47:41 +00:00
Pedro F. Giffuni ddc281e480 MFC r258712;
libcpp: fix an underflow.

Similar fix seen in Apple's gcc42.

Obtained from:	OpenBSD (Rev 1.2)
MFC after:	2 weeks
2013-12-12 19:02:42 +00:00
Pedro F. Giffuni 9e12447d52 MFC r241959:
Fix a number of other clang warnings in libstdc++, which could appear
when building other C++ software with it.  Also fix one actual bug in
libsupc++, which was exposed by such a warning.  This latter fix is the
only functional change.

This is required for newer versions of gcc and clang which have
stricter warnings about parenthesis in C++ programs.
2013-12-12 16:18:45 +00:00
Pedro F. Giffuni c774062b5b MFC r256448, r257029;
Make di_blocks unsigned in UFS1 as is the case already for UFS2.
 Most of the code between UFS1 and UFS2 is shared so this change
 is pretty safe. Not only this makes UFS1 and 2 consistent but it
 also matches what NetBSD and MacOS X have for some years now.

UFS2: make di_extsize unsigned.
 di_extsize is the EA size and as such it should be unsigned.
 Adjust related types for consistency.

Reviewed by:	mckusick
2013-12-11 19:30:27 +00:00
Peter Wemm 6f7ada3dd0 MFC: r258718: fix emulated jail_v0 byte order 2013-11-30 23:06:51 +00:00
Pedro F. Giffuni 31d55414af MFC r246857:
Regenerate libstdc++'s config.h, synchronizing it with our
almost-C99 headers.

After verifying the changes in the source code, avoid expl()
which is not available in 8.x (or 9.x).
2013-11-30 21:29:34 +00:00
Xin LI 76d63c3f2b MFC r257879:
Fix typo in r256646: We want to generate lists of directories in
INDEX-OLD and INDEX-NEW and compare them, not generate the same
list of directories from INDEX-OLD twice...

Pointy hats to: cperciva & everybody who didn't proofread
		EN-13:04 enough
Errata Notice:	FreeBSD-EN-13:05.freebsd-update
2013-11-28 22:08:41 +00:00
Andriy Gapon a50e4c6e15 MFC r229663: Allow to change vfs.zfs.arc_meta_limit at runtime.
- Change vfs.zfs.arc_meta_used from CTLFLAG_RDTUN to CTLFLAG_RD,
as it is not a tunable.

MFC slacker:	pjd
2013-11-26 10:26:40 +00:00
Andriy Gapon 8b50d5c99f MFC r240834: Add rounddown2() macro similar to the roundup2() macro.
MFC slacker:	pjd
2013-11-25 18:51:53 +00:00
Andriy Gapon 9ea58fb1f7 MFV r258377: 4088 use after free in arc_release()
illumos/illumos-gate@ccc22e1304
2013-11-25 16:06:24 +00:00
Andriy Gapon c3cd6ccd86 MFC r258353: zfs page_busy: fix the boundaries of the cleared range
This is a fix for a regression introduced in r246293.

vm_page_clear_dirty expects the range to have DEV_BSIZE aligned
boundaries,
otherwise it extends them.  Thus it can happen that the whole page is
marked clean while actually having some small dirty region(s).
This commit makes the range properly aligned and ensures that only
the clean data is marked as such.

It would interesting to evaluate how much benefit clearing with
DEV_BSIZE
granularity produces.  Perhaps instead we should clear the whole page
when it is completely overwritten and don't bother clearing any bits
if only a portion a page is written.
2013-11-25 15:40:20 +00:00
Pedro F. Giffuni 6da9056afe MFC r255107;
Add support for the GCC binary integer constants extension.

This is required to build the i965 backend with newer versions of mesa.

Original patch from Joerg Wunsch in GCC Bug 23479, under the GPLv2;
also taken from there in OpenBSD.

Obtained from:	gcc 4.3 (rev. 125346; GPLv2)
2013-11-24 22:10:37 +00:00
John Baldwin 59573d5078 MFC 256274:
Ignore attempts to set the nmbcluster sysctls to their current value
rather than failing with an error.
2013-11-15 19:58:31 +00:00
John Baldwin 519abb59f7 MFC 256293:
Sanitize the %eflags returned by BIOS routines.  Some BIOS routines enter
protected mode and may leave protected-mode-specific flags like PSL_NT set
when they return to real mode.  This can cause a fault when BTX re-enters
protected mode after the BIOS mode returns.

PR:		amd64/182740
2013-11-15 15:08:58 +00:00
John Baldwin 338ca13c43 MFC 255497:
Fix an off-by-one error when populating mincore(2) entries for
skipped entries.  lastvecindex references the last valid byte,
so the new bytes should come after it.
2013-11-14 21:27:19 +00:00
John Baldwin b9d9430a80 MFC 255248:
Use an unsigned long when indexing into mfchashtbl[] and mf6ctable[].  This
matches the types used when computing hash indices and the type of the
maximum size of mfchashtbl[].

PR:		kern/181821
2013-11-13 18:35:06 +00:00
John Baldwin 2c9b8e7deb MFC 254699,255030:
Use tvtohz() to convert a socket buffer timeout to a tick value rather
than using a home-rolled version.  The home-rolled version could result
in shorter-than-requested sleeps.

PR:		kern/181416
2013-11-13 17:10:18 +00:00
Andrey V. Elsukov 18fd30477f MFC r257084:
Initialize inc_fibnum for properly handling ICMP6_PACKET_TOO_BIG
  errors in multifib environment.

  PR:		183265
2013-11-11 10:44:38 +00:00
Andrey V. Elsukov f2664d17bc MFC r256689 (modified):
Use the same actor key for media types of the same speed.

  PR:		176097

MFC r256832:
  Add a note that lacp_compose_key() should be updated, when new media
  types will be added.

  Submitted by:	melifaro
2013-11-11 10:38:37 +00:00
Xin LI cd667adfd1 Convert stable/8 to use docbook 5.0. We may still issue security advisories
and do this conversion now so there wouldn't be surprises.
2013-11-07 22:08:04 +00:00
Luigi Rizzo a74d2026cf MFH: sync the picobsd build file with what is in head,
except for the MALLOC_PRODUCTION definition
2013-11-07 04:52:25 +00:00
John Baldwin e24488f71e MFC 254287: Some small cleanups to the fixes in r180340:
- Set NOTE_TRACKERR before running filt_proc().  If the knote did not
  have NOTE_FORK set in fflags when registered, then the TRACKERR event
  could miss being posted.
- Don't pass the pid in to filt_proc() for NOTE_FORK events.  The special
  handling for pids is done knote_fork() directly and no longer in
  filt_proc().
2013-11-06 21:00:18 +00:00
John Baldwin abddcc4a4f MFC 254072:
Don't emit a spurious EVFILT_PROC event with no fflags set on process exit
if NOTE_EXIT is not being monitored.  The rationale is that a listener
should only get an event for exit() if they registered interest via
NOTE_EXIT.  This matches the behavior on OS X.
- Don't save the exit status on process exit unless NOTE_EXIT is being
  monitored.
- Add an internal EV_DROP flag that requests kqueue_scan() to free the
  knote without signalling it to userland and use this when a process
  exits but the fflags in the knote is zero.
2013-11-06 19:35:06 +00:00
Xin LI 69276bc001 MFC r257539:
When zero'ing out a buffer, make sure we are using right size.

Without this change, in the worst but unlikely case scenario, certain
administrative operations, including change of configuration, set or
delete key from a GEOM ELI provider, may leave potentially sensitive
information in buffer allocated from kernel memory.

We believe that it is not possible to actively exploit these issues, nor
does it impact the security of normal usage of GEOM ELI providers when
these operations are not performed after system boot.

Security:	possible sensitive information disclosure
Submitted by:	Clement Lecigne <clecigne google com>
2013-11-05 20:00:17 +00:00
John Baldwin a0b3534fd9 MFC 253656: Enhance the description of NOTE_TRACK:
- NOTE_TRACK has never triggered a NOTE_TRACK event from the parent pid.
  If NOTE_FORK is set, the listener will get a NOTE_FORK event from
  the parent pid, but not a separate NOTE_TRACK event.
- Explicitly note that the event added to monitor the child process
  preserves the fflags from the original event.
- Move the description of NOTE_TRACKERR under NOTE_TRACK as it is not a
  bit for the user to set (which is what this list pupports to be).
  Also, explicitly note that if an error occurs, the NOTE_CHILD event
  will not be generated.
2013-11-05 19:54:35 +00:00
Edwin Groothuis 68d465b103 MFC of 257681
tzdata2013f
- Jordan goes to winter time on the last Friday in October.
- Tocantins in Brazil will not go into summer time in October.
- Indonesian time zones renames.
- Lots of cleanups in with regarding to links and historical data.

tzdata2013h
- Libya didn't go back to DST.
- Fix Morocco 2038 issue.
- Brazil/Acre and ?Western Amazonas are chaning timezones.
2013-11-05 06:39:23 +00:00
Pyun YongHyeon e61306d7f0 MFC r257307:
Fix regression introduced in r235816.
  r235816 triggered kernel panic or hang after warm boot.
  Don't blindly restore BCE_EMAC_MODE media configuration in
  bce_reset().  If driver is about to shutdown it will invoke
  bce_reset() which in turn results in restoring BCE_EMAC_MODE
  media configuration.  This operation seems to confuse controller
  firmware.
2013-11-04 08:48:35 +00:00
Mikolaj Golub d6de478dab MFC r257154:
Merging local and remote bitmaps must be protected by hr_amp lock.

This is believed to fix hastd crashes, which might occur during
synchronization, triggered by the failed assertion:

 Assertion failed: (amp->am_memtab[ext] > 0),
 function activemap_write_complete, file activemap.c, line 351.
2013-10-31 20:32:11 +00:00
Konstantin Belousov 6d2911558c MFC r257221:
Fix typo.
2013-10-31 10:15:22 +00:00
Hans Petter Selasky f1489fcaa6 MFC r257206:
Fix a deadlock when trying to power off a USB device. The deadlock
happens because the code in question is trying to modify the parent
USB port registers outside the USB explore thread.
2013-10-30 06:16:11 +00:00
Bryan Drewery c8232d45f5 MFC r257151:
Document /var/cache/pkg into hier(7) which pkg(8) uses.

Approved by:	bapt
2013-10-29 18:46:41 +00:00
Xin LI 4cf6d110ef MFC r256646, r256767, r257038:
When installing updates, install new directories first and remove old
  directories last.

  Allow ~ in file names so libtool droppings in contrib don't break updates.
  It has happened twice now, and is likely to happen again.

  Be more selective when filtering for lib*.so.N files.  These are deleted
  at the end of the upgrade process, after warning users to upgrade any
  3rd party software (e.g., from the ports tree) which might link to the
  libraries being removed.

Errata Notice:  FreeBSD-EN-13:04.freebsd-update
2013-10-26 19:54:28 +00:00
Xin LI fa926d183b MFC r253816: MFV r253780:
To quote Illumos #3875:

The problem here is that if we ever end up in the error
path, we drop the locks protecting access to the zfsvfs_t
prior to forcibly unmounting the filesystem. Because z_os
is NULL, any thread that had already picked up the zfsvfs_t
and was sitting in ZFS_ENTER() when we dropped our locks
in zfs_resume_fs() will now acquire the lock, attempt to
use z_os, and panic.

Illumos ZFS issues:
  3875 panic in zfs_root() after failed rollback
2013-10-25 15:45:29 +00:00
Hans Petter Selasky 64e6ea4675 MFC r256750:
Improve XHCI stability. When a command timeout happens, the command
should be aborted else the command queue can stop. Refer to section
"4.6.1.2" of the XHCI specification.
2013-10-25 06:47:01 +00:00
Alexander Motin b25e22a573 MFC r256317:
Fix mode page length calculation to remove last garbage line from the
`camcontrol mode daX -l` output.
2013-10-25 06:04:21 +00:00
Mark Johnston 9419282fb5 Fix an inverted check for the master user in "camcontrol security -U". 2013-10-16 03:37:22 +00:00
Dimitry Andric 2c6a8fd9c5 MFC r255931:
Fix a bug in ld, where indirect symbols are not handled properly during
linking of a shared library, leading to corrupt indexes in the dynamic
symbol table.  This should fix the multimedia/ffmpegthumbnailer port.

Reported by:	swills
2013-10-12 16:11:57 +00:00
Dag-Erling Smørgrav 7887cf192c MFH (206038,206040): add a -k option which is passed through to finger(1).
Almost to the day three and a half years after the original MFC date...
2013-10-12 14:54:25 +00:00
Konstantin Belousov a4c4cddaca MFC r256061:
Add padding to match the compat32 struct stat32 definition to the real
struct stat on 32bit architectures.
2013-10-11 04:50:27 +00:00
Bryan Drewery 9bde328968 MFC r255944 (partial):
Use MK_SSP=no after including bsd.own.mk to disable SSP instead of user-knob
  WITH[OUT]_SSP to avoid hitting an error if user has WITH_SSP in their
  make.conf. Ports now use this knob.

    make[7]: "/usr/src/share/mk/bsd.own.mk" line 466: WITH_SSP and
    WITHOUT_SSP can't both be set.

Approved by:    bapt
2013-10-10 12:47:34 +00:00
Dag-Erling Smørgrav 9b244e7295 MFH (r255243): create /var/authpf with correct ownership and permissions
MFH (r255597): add unbound user to facilitate cross-building
MFH (r256097): add missing entries to ftpusers and reorder
2013-10-07 08:20:56 +00:00
Xin LI d0b46517c8 MFC r252857,255718:
Refresh vendor driver version which fixes command queue
full issue with ARC-1214 and ARC-1224.

Update arcmsr(4) driver to 1.20.00.28 which fixes mutex recursion in
CCB abort codepath.

Many thanks to Areca for continuing to support FreeBSD.

Submitted by:	黃清隆 <ching2048 areca com tw>
2013-10-03 23:56:38 +00:00
Mikolaj Golub e83a3e7457 MFC r255714, r255716, r255717:
r255714:

Use cv_broadcast() instead of cv_signal() when waking up threads
waiting on an empty queue as the queue may have several consumers.

Before the fix the following scenario was possible: 2 threads are
waiting on empty queue, 2 threads are inserting simultaneously. The
first inserting thread detects that the queue is empty and is going to
send the signal, but before it sends the second thread inserts
too. When the first sends the signal only one of the waiting threads
receive it while the other one may wait forever.

The scenario above is is believed to be the cause of the observed
cases, when ggate_recv_thread() was getting stuck on taking free
request, while the free queue was not empty.

Reviewed by:	pjd
Tested by:	Yamagi Burmeister yamagi.org

r255716:

When updating the map of dirty extents, most recently used extents are
kept dirty to reduce the number of on-disk metadata updates. The
sequence of operations is:

1) acquire the activemap lock;
2) update in-memory map;
3) if the list of keepdirty extents is changed, update on-disk metadata;
4) release the lock.

On-disk updates are not frequent in comparison with in-memory updates,
while require much more time. So situations are possible when one
thread is updating on-disk metadata and another one is waiting for the
activemap lock just to update the in-memory map.

Improve this by introducing additional, on-disk map lock: when
in-memory map is updated and it is detected that the on-disk map needs
update too, the on-disk map lock is acquired and the on-memory lock is
released before flushing the map.

Reported by:	Yamagi Burmeister yamagi.org
Tested by:	Yamagi Burmeister yamagi.org
Reviewed by:	pjd

r255717:

Fix comments.
2013-10-03 18:53:13 +00:00
Mikolaj Golub 7fe26b67ed MFC r255521, r255526, r255707:
r255521 (jmg):

add support for writing the pid of the daemon program to a pid file so
that daemon can be used w/ rc.subr and ports can use the additional
functionality, such as keeping the ldap daemon up and running, and have
the proper program to signal to exit.

PR:		bin/181341
Submitted by:	feld

r255526 (joel):

mdoc: remove EOL whitespace.

r255707:

1. Properly clean pid files in the case of the error.
2. Write the supervisor pid before the restart loop, so we don't
   uselessly rewrite it after every child restart.
3. Remove duplicate ppfh and pfh initialization.
2013-10-03 18:50:09 +00:00
Hans Petter Selasky 9559bead4a MFC r255768:
Stability fixes for Intel LynxPoint XHCI controllers. Disable XHCI port
routing if we get certain errors. Poll for command completion upon
command timeouts. The XHCI error events might not generate interrupts.

PR:		usb/181159
2013-10-01 08:41:28 +00:00
Xin LI fd318c58c1 MFC r255648:
Fix a typo when accounting for tx_broadcast statistics.

Submitted by:	Paul A. Patience <paul-a patience polymtl ca>
2013-10-01 00:49:57 +00:00
John-Mark Gurney 419d1a498f MFC: r255866, r255867
fix a bug where we access a bread buffer after we have brelse'd it...
  The kernel normally didn't unmap/context switch away before we accessed
  the buffer most of the time, but under heavy I/O pressure and lots of
  mount/unmounting this would cause a fault on nofault panic...

  NULL stale pointers (should be a no-op as they should no longer be
  used)...
2013-09-30 17:35:48 +00:00
Xin LI 0014233b00 MFC r255891:
Import NetBSD readline.c,v 1.104: do not crash with add_history(NULL).
2013-09-29 07:42:25 +00:00
Konstantin Belousov a68f807b82 MFC r255844:
Ensure that the ERESTART return from the syscall reloads the registers,
to make the restarted syscall instruction pass the correct arguments.

PR:	kern/182161
2013-09-27 07:02:48 +00:00
Mark Johnston e1e37f002e MFC r254742:
Hold mfi_io_lock across calls to xpt_rescan() and xpt_alloc_ccb_nowait().
xpt_rescan() expects the SIM lock to be held, and we trip a mtx_assert if
the driver initiates multiple rescans in quick succession.
2013-09-20 21:52:33 +00:00
Hans Petter Selasky 7432490bed MFC r255488:
Don't issue USB resume signalling in USB device mode, if the USB power
mode is ON and suspend is detected. This confuses iPads running in USB
host mode at least.
2013-09-19 05:43:23 +00:00
Kirk McKusick 56ce1f6297 MFC of 253998:
This bug fix is in a code path in rename taken when there is a
collision between a rename and an open system call for the same
target file. Here, rename releases its vnode references, waits for
the open to finish, and then restarts by reacquiring its needed
vnode locks. In this case, rename was unlocking but failing to
release its reference to one of its held vnodes. The effect was
that even after all the actual references to the vnode had gone,
the vnode still showed active references. For files that had been
removed, their space was not reclaimed until the filesystem was
forcibly unmounted.

This bug manifested itself in the Postgres server which would
leak/lose hundreds of files per day amounting to many gigabytes of
disk space. This bug required shutting down Postgres, forcibly
unmounting its filesystem, remounting its filesystem and restarting
Postgres every few days to recover the lost space.

Reported by: Dan Thomas and Palle Girgensohn
Bug-fix by:  kib
Tested by:   Dan Thomas and Palle Girgensohn
2013-09-19 00:18:25 +00:00
Hans Petter Selasky b9a70f3ebe MFC r255472:
Clear correct data structure.
2013-09-18 06:40:47 +00:00
Andrey V. Elsukov 618a5827de MFC r255235:
Remove unused code and sort variables declarations.

PR:		kern/181822
2013-09-17 18:51:35 +00:00
Hans Petter Selasky e2d3665ed6 MFC r254572:
Force keyboards which don't have the required
HID fields to use the USB BOOT protocol for now.

PR:		usb/181425
2013-09-17 12:58:17 +00:00
Hans Petter Selasky 77229189b6 MFC r248246:
- Make quirk for reading device descriptor from broken USB devices.
Else they won't enumerate at all:
hw.usb.full_ddesc=1
- Reduce the USB descriptor read timeout from 1000ms to
500ms. Typical value for LOW speed devices is 50-100ms.
- Enumerate USB device a maximum of 3 times when a port
connection change event is detected, before giving up.
2013-09-17 12:56:37 +00:00
Xin LI 9c7d668650 MFC r255483:
Do not emit size for non-regular files.  There is nothing that
mtree(1) can do in this situation and would cause confusion.
2013-09-16 16:44:18 +00:00
Hans Petter Selasky 0ffdaac643 MFC r255356:
Revert parts of r245132 and r245175. We don't need to write to the
IMAN register to clear the pending interrupt status bits. This patch
tries to solve problems seen on the MacBook Air, as reported by
Johannes Lundberg <[email protected]>
2013-09-16 10:06:40 +00:00
Andriy Gapon 480b6c6409 MFC r254714: zfs: do not reject any operations on a pool just because
it's a boot pool
2013-09-13 14:15:52 +00:00
Andriy Gapon 41bbd9a281 MFC r254445,254711: zfs: inline and remove zfs_vnode_lock 2013-09-13 14:07:32 +00:00
Andriy Gapon b3aaacd5b2 MFC r254713: fbt: drop a local write-only variable 2013-09-13 13:53:47 +00:00
Konstantin Belousov ab83b57fa7 MFC r255439:
Call free() on the pointer returned from malloc().
2013-09-13 06:18:33 +00:00
Sean Bruno 0608cf316d MFC r254330 -- allow users to run SYS_PD mode JBOD with a non-default MAXPHYS 2013-09-11 21:45:02 +00:00
Xin LI 679a9c3f78 MFC r255428:
Pass -n (do not emit comments) when saving mtree information for future
mergemaster(8) runs.
2013-09-11 17:42:35 +00:00
Devin Teske 690e8e06f9 Merge from stable/9 SVN r250927: MFC: r249628, r249742
- recover missing arp_ifinit() call.
- plug static llentry leak (ipv4 & ipv6 were affected).

PR:		kern/172985

Also merge from stable/9 SVN r240313:

Merge r238990 (manually resolving absence of r237263):
  Fix races between in_lltable_prefix_free(), lla_lookup(),
  llentry_free() and arptimer():

  o Use callout_init_rw() for lle timeout, this allows us safely
    disestablish them.
    - This allows us to simplify the arptimer() and make it
      race safe.
  o Consistently use ifp->if_afdata_lock to lock access to
    linked lists in the lle hashes.
  o Introduce new lle flag LLE_LINKED, which marks an entry that
    is attached to the hash.
    - Use LLE_LINKED to avoid double unlinking via consequent
      calls to llentry_free().
    - Mark lle with LLE_DELETED via |= operation istead of =,
      so that other flags won't be lost.
  o Make LLE_ADDREF(), LLE_REMREF() and LLE_FREE_LOCKED() more
    consistent and provide more informative KASSERTs.

  The patch is a collaborative work of all submitters and myself.

  PR:		kern/165863
  Submitted by:	zont, rstone
  Submitted by:	Eric van Gyzen <eric_van_gyzen dell.com>
2013-09-11 07:24:46 +00:00
Dag-Erling Smørgrav 9720beddca In IPv6 and NetATM, stop SIOCSIFADDR, SIOCSIFBRDADDR, SIOCSIFDSTADDR
and SIOCSIFNETMASK at the socket layer rather than pass them on to the
link layer without validation or credential checks.  [SA-13:12]

Prevent cross-mount hardlinks between different nullfs mounts of the
same underlying filesystem.  [SA-13:13]

Security:	CVE-2013-5691
Security:	FreeBSD-SA-13:12.ifioctl
Security:	CVE-2013-5710
Security:	FreeBSD-SA-13:13.nullfs
Approved by:	so
2013-09-10 10:12:09 +00:00
Sean Bruno f8d7e01382 MFC r253980 -- add new pciids for ciss(4) 2013-09-09 21:26:18 +00:00
Sean Bruno ff3c45b622 MFC r254906 -- add SYSPD (real jbod) support to mfiutil
Add support to reconfigure a drive as SYSPD (real JBOD in LSI
terminology).

Adds command "mfiutil syspd <drive#>" to change a drive to SYSPD.  Drive
will then be scanned/reported immediately as /dev/mfisyspdX by the host.

"mfiutil good <drive#>" clears SYSPD mode, remove /dev/mfisyspdX and
sets disk into UNCONFIGURED mode.

Tested on Dell H310 SAS/SATA RAID controller.
2013-09-09 21:05:01 +00:00
John Baldwin 07068734ee MFC 236106:
Passing NULL as a key casues a segfault when loading SSH 1 keys.  Use
an empty string instead.
2013-09-09 15:38:51 +00:00
Hans Petter Selasky d82e02cd67 MFC r255090 and r255128:
Add more USB IDs.

PR:		kern/181728
2013-09-07 06:41:22 +00:00
Joerg Wunsch a12f3a9717 Merged r254809 and 254937 from head:
. Fix "2step" feature (i.e. 360 KiB media in 1200 KiB drives)
. Fix FDOPT_NOERROR option
2013-09-05 20:34:58 +00:00
Mark Johnston e5fa2e1b44 MFC r254018:
Pass variables prefixed with both LD_ and LD_32_ to the run-time linker.
This prevents unintentional execution of programs when running ldd(1) on
32-bit Linux binaries.
2013-09-03 23:20:03 +00:00
Andriy Gapon b01d447140 MFC r211847: Set de_dir for user created symbolic links.
This MFC should fix a panic introduced in r254708.

Reported by:	Toomas Aas <[email protected]>, jase
Tested by:	jase
MFC slacker:	jh
2013-08-29 12:25:12 +00:00
Jilles Tjoelker b4163a9681 MFC 250421: posix_spawn_file_actions_adddup2(3): Document difference with
dup2().

The ability to clear a file descriptor's close-on-exec flag via
posix_spawn_file_actions_adddup2() is in fact proposed in Austin Group issue
#411.
2013-08-25 15:01:43 +00:00
Jilles Tjoelker c8c1294640 MFC r250412: posix_spawn_file_actions_addopen(3): Correct error for bad file
descriptor.

As per POSIX.1-2008, posix_spawn_file_actions_add* return [EBADF] if a file
descriptor is negative, not [EINVAL]. The bug was only in the manual page;
the code is correct.
2013-08-25 15:00:34 +00:00
Hans Petter Selasky a8e7be1036 MFC r254438:
Fix some USB controller names according to pciconf output.

Submitted by:	Dmitry Luhtionov <[email protected]>
2013-08-24 07:19:57 +00:00
Andriy Gapon f0142ee774 MFC r212966: Modify devfs_fqpn() for future use in devfs path reference
counting code

This should fix build failure introduced in r254708.

Pointyhat to:	avg
MFC slacker:	jh
2013-08-23 17:03:43 +00:00
Andriy Gapon 6be389c431 MFC r253677,253679: make path matching in devfs rules consistent and
sane (and safer)
2013-08-23 14:25:04 +00:00
Andriy Gapon 6fdbfa56f0 MFC r253996,253997: opensolaris code: translate INVARIANTS to DEBUG and
ZFS_DEBUG

Please note that support for compiling ZFS into a kernel is not in this
branch as of now.
Also, not all modules from head are in this branch.
2013-08-23 14:18:24 +00:00
Andriy Gapon 3ba156ebf3 MFC r253772,253773,253989: dtrace disassembler: take the latest/last
CDDL code from OpenSolaris
2013-08-23 14:03:48 +00:00
Andriy Gapon 7ebe424522 MFC r253606: zfs module: perform cleanup during shutdown in addition to
module unload
2013-08-23 13:30:07 +00:00
Andriy Gapon 9912468983 MFC r253603: zfs: move vnode creation from zfs_znode_cache_constructor
to zfs_znode_alloc
2013-08-23 13:27:27 +00:00
Andriy Gapon a8752e1eea MFC r253604: rename scheduler->swapper and SI_SUB_RUN_SCHEDULER->SI_SUB_LAST 2013-08-23 13:22:14 +00:00
Andriy Gapon 4628f3b30f MFC r198335,198365: remove dependency between NO_WARNS and CSTD
There is no reason to have it.

Reviewed by:	dim
MFC slackers:	rdivacky, ru
2013-08-23 13:19:12 +00:00
Andrey V. Elsukov cbd7f52e05 MFC r254095:
gpt_entries is used as limit for the number of partition entries in
  the GEOM_PART. Instead of just using number of entries from the GPT
  header, calculate this limit based on the reserved space between
  GPT header and first available LBA.
2013-08-22 06:24:02 +00:00
Xin LI e7e228de48 Fix an integer overflow in computing the size of a temporary buffer
can result in a buffer which is too small for the requested
operation.

Security:	CVE-2013-3077
Security:	FreeBSD-SA-13:09.ip_multicast
2013-08-22 00:51:37 +00:00
Bryan Venteicher 4e2866ff1e MFC r254457
Do not use potentially stale thread in kthread_add()

  When an existing process is provided, the thread selected to use
  to initialize the new thread could have exited and be reaped.
  Acquire the proc lock earlier to ensure the thread remains valid.
2013-08-20 19:17:01 +00:00
Hans Petter Selasky 6ff5d0e739 MFC r254243:
- Try to fix build of 32-bit compatibility USB support for FreeBSD and
Linux targets without breaking the existing IOCTL API.

- Remove some not-needed header file inclusions.

- Wrap a long line.

Reported by:	Damjan Jovanovic <[email protected]>
2013-08-20 07:40:40 +00:00
Hans Petter Selasky 3c5b87ee34 MFC r254238:
Correct an EHCI register write.

Reported by:    [email protected]
2013-08-20 07:15:16 +00:00
Glen Barber c445c539a7 MFC r254525:
Add entry for packages-9.2-release directory.

Approved by:	re (implicit)
2013-08-19 14:38:35 +00:00
Konstantin Belousov 238639815f MFC r254191:
Match malloc(9) calls with free(9), not contigfree(9).
2013-08-17 08:08:58 +00:00
Michael Tuexen 02068c3691 MFC r254338:
Don't send uninitialized memory (two instances of 4 bytes) in
every cookie on the wire. This bug was reported in
https://bugzilla.mozilla.org/show_bug.cgi?id=905080
2013-08-15 04:35:25 +00:00
Gregory Neil Shapiro a2536864a0 MFC: Temporarily revert sendmail 8.14.7 change to getipnodebyname() flags
to prevent problems between the resolver and Microsoft DNS servers with
     AAAA lookups.  The upstream open source project will work on a more
     permanent fix for the next release.  Issue noted by Pavel Timofeev.
2013-08-15 01:40:55 +00:00
Mark Johnston 4b8d8dd29a MFC r253850:
Properly print arguments to vfork(2) and rfork(2).
2013-08-14 02:37:07 +00:00
Mark Johnston 7f63aeb593 MFC r254020:
Add a missing module version declaration to if_tun(4).
2013-08-14 01:55:44 +00:00
Steven Hartland 8b378596b5 MFC: r253926
zfs_ioc_rename should not leave the value of zc_name passed in via zc altered
on return.
2013-08-11 01:06:35 +00:00
Hiroki Sato 3380b891e7 MFC 253887,253977:
- Use pget(PGET_CANDEBUG | PGET_NOTWEXIT) to determine if the specified
  PID is valid for monitoring in FILEMON_SET_PID ioctl.

- Set the monitored PID to -1 when the process exits.

Suggested by:	jilles
Tested by:	sjg
2013-08-08 17:20:09 +00:00
Konstantin Belousov be27efa452 MFC r253859:
Remove unused malloc type.
2013-08-08 05:41:55 +00:00
Andriy Gapon dad56f56ea MFC r253073: zfs: try to properly handle i/o errors in mappedread_sf 2013-08-07 07:44:13 +00:00
Andriy Gapon a9e027237f MFC r253070: zfs: load zpool.cache after a root fs is mounted 2013-08-07 07:42:09 +00:00
Andriy Gapon 05cef302ce MFC r253602: newvers.sh: add another git-svn fallback 2013-08-07 07:39:52 +00:00
Andriy Gapon 4314031be0 MFC r253601: newvers.sh: fix the fallback case of git-svn detection 2013-08-07 07:38:18 +00:00
Andriy Gapon d4fd8bac55 MFC r253072: amd64: use -mno-omit-leaf-frame-pointer in addition to
-fno-omit-frame-pointer
2013-08-07 07:36:37 +00:00
Andriy Gapon 38b2762760 MFC r253605: zfsboottest: remove explicit -Werror 2013-08-07 07:34:59 +00:00
Andriy Gapon 00ae82f2f6 MFC r253068: zfsboottest.sh: remove checks for things that are not
strictly required
2013-08-07 07:33:19 +00:00
Andriy Gapon a13e960668 MFC r253067: zfsboottest: sync with changes in zfs boot code 2013-08-07 07:31:41 +00:00
Andriy Gapon 2184df78ba MFC r253076: rc.d/zfs: pass -v option to zfs mount 2013-08-07 07:28:00 +00:00
Konstantin Belousov 5384bccdaa MFC r253328:
Create a proper stack frame for i386 version of bcopy().
2013-08-07 06:32:13 +00:00
Konstantin Belousov 276709f75f MFC r253417:
Clear the vnode knotes before destroying vpollinfo.

MFC r253737:
Split the destruction into the helper destroy_vpollinfo_free(), and
call it when raced, instead of destroy_vpollinfo().
2013-08-07 06:23:28 +00:00
Steven Hartland d8768177a8 MFC r253818:
Fix zfs send -D hang after processing requiring a CTRL+C to interrupt due to
pthread_join prior to fd close.
2013-08-02 23:33:40 +00:00
Alexander Motin 8f8eca977b MFC r253754:
Partially close race between calls of orphan() method from GEOM and close()
method from ZFS core, that reliably causes use-after-free panic if SSD vdev
detached during inititial erase.
2013-08-01 09:48:12 +00:00
Xin LI cee6f3d0d8 Fix Denial of Service vulnerability in named(8). [13:07]
Security:	CVE-2013-4854
Security:	FreeBSD-SA-13:07.bind
Approved by:	so
2013-07-26 22:53:17 +00:00
Hans Petter Selasky c43ac348a8 MFC r253532:
Fix an XHCI regression:

The Block Event Interrupts, BEI, feature does not
work like expected with the Renesas XHCI chipsets.
Revert feature.

While at it correct the TD SIZE computation in
case of Zero Length Packet, ZLP, in the end of a
multi frame USB transfer.

PR:		usb/180726
2013-07-26 06:28:41 +00:00
Pyun YongHyeon b43f45d6f6 MFC r253404:
o TxD ring requires 8 bytes alignment to work so change alignment
     constraint to 8. Previously it may have triggered watchdog
     timeouts.
   o Check whether interrupt is ours or not.
   o Enable interrupts before attemping to transmit queued packets.
     This will slightly improve TX performance.
   o No need to clear IFF_DRV_OACTIVE in a loop. AE_FLAG_TXAVAIL is
     used to know whether there are enough available TxD ring space.
   o Added missing bus_dmamap_sync(9) in ae_rx_intr() and rearranged
     code to avoid unncessary register access.
   o Make sure to clear TxD, TxS, RxD rings in driver initialization.
     Otherwise some data in these rings could be interpreted as
     'updated' which in turn will advance internally maintained
     pointers and can trigger watchdog timeouts.

  PR:	kern/180382
2013-07-26 06:23:57 +00:00
Jung-uk Kim 09a605c267 MFC: r253455
Decode PCIe ASPM capability and status.
2013-07-24 22:26:58 +00:00
Andriy Gapon 554987acf7 MFC r253380,253413: name passed into __setenv is not necessarily NUL-terminated 2013-07-24 08:56:59 +00:00
John Baldwin ca5bcdc051 MFC 252576:
Don't perform the acpi_DeviceIsPresent() check for PCI-PCI bridges.  If
we are probing a PCI-PCI bridge it is because we found one by enumerating
the devices on a PCI bus, so the bridge is definitely present.  A few
BIOSes report incorrect status (_STA) for some bridges that claimed they
were not present when in fact they were.

While here, move this check earlier for Host-PCI bridges so attach fails
before doing any work that needs to be torn down.

PR:		kern/91594
2013-07-17 14:05:35 +00:00
Konstantin Belousov d9a3e8c9c9 MFC r253141:
When panicing due to the gjournal overflow, print the geom metadata
journal id.
2013-07-17 10:53:11 +00:00
Andriy Gapon ac6bf9bfa1 MFC r253079: dtrace/fasttrap: install hook functions only after all data
is initialized
2013-07-16 11:54:25 +00:00
Andriy Gapon 6de7958b1f MFC r253078: audit_proc_coredump: check return value of audit_new 2013-07-16 10:43:44 +00:00
Andriy Gapon 7c4e5d8024 MFC r253075: namecache sdt: freebsd doesn't support structured
characters yet
2013-07-16 07:28:38 +00:00
Glen Barber b40db28f65 MFC r253290:
Document that a literal jail name of 0 (zero) is not allowed.

PR:		174436
2013-07-15 15:00:17 +00:00
Dag-Erling Smørgrav 52693fa90d MFH (r253138,r253258): install authpf-noip 2013-07-15 09:02:57 +00:00
Sergey Kandaurov 7ca1be93fc MFC r221845: Update sticky(7) cross references.
MFC reminded by:	Torfinn Ingolfsen <[email protected]>
2013-07-14 21:57:25 +00:00
Michael Tuexen 2ccc79bbc4 MFC r253105:
Fix the handling of SCTP_CURRENT_ASSOC and SCTP_ALL_ASSOC in
sctp_opt_info().
2013-07-12 13:52:27 +00:00
Michael Tuexen 3deeedd617 MFC r253104:
Fix a bug where SCTP_ENABLE_STREAM_RESET is not handled by
sctp_opt_info().
2013-07-12 13:51:19 +00:00
Pyun YongHyeon 236637fb0d MFC r253134:
Avoid controller reinitialization which could be triggered by
  dhclient(8) or alias addresses are added.
2013-07-12 02:28:35 +00:00
Rick Macklem 151ed28805 MFC: r252673
A problem with the old NFS client where large writes to large files
would sometimes result in a corrupted file was reported via email.
This problem appears to have been caused by r251719 (reverting
r251719 fixed the problem). Although I have not been able to
reproduce this problem, I suspect it is caused by another thread
increasing np->n_size after the mtx_unlock(&np->n_mtx) but before
the vnode_pager_setsize() call. Since the np->n_mtx mutex serializes
updates to np->n_size, doing the vnode_pager_setsize() with the
mutex locked appears to avoid the problem.
Unfortunately, vnode_pager_setsize() where the new size is smaller,
cannot be called with a mutex held.
This patch returns the semantics to be close to pre-r251719 such that the
call to the vnode_pager_setsize() is only delayed until after the mutex is
unlocked when np->n_size is shrinking. Since the file is growing
when being written, I believe this will fix the corruption.

Tested by:	[email protected]
2013-07-12 00:59:03 +00:00
Steven Hartland 5a6777a99b MFC r253091:
Added 4K QUIRK for OCZ Vertex 4 SSDs
2013-07-11 09:13:05 +00:00
Pyun YongHyeon bdf5b428e2 MFC r245926, r245931
- Improve some comments.
  - Make bge_lookup_{rev,vendor}() static.
  - Factor out chip identification rather than duplicating the code.
  - Sanitize bge_probe() a bit (don't hardcode buffer sizes, allow
    bge_lookup_vendor() to return NULL so the excessive panic() can
    be removed there, etc.) and return BUS_PROBE_DEFAULT rather than
    hardcoding 0.
  - According to the Linux tg3 driver, BCM57791 and BCM57795 aren't
    capable of Gigabit Ethernet.
  - Check the return value of taskqueue_start_threads().
  - Mention NetLink controllers in the fallback description, too.
2013-07-11 08:50:30 +00:00
Pyun YongHyeon 85cdbe909a MFC r245867:
For 57765 class controllers, set low watermark max receive frames to 1.
2013-07-11 08:42:17 +00:00
Pyun YongHyeon 83f819f31e MFC r245870:
bge_attach() can fail before attaching mii(4). So make sure to check
  bge_miibus before detaching mii(4).
2013-07-11 08:18:46 +00:00
Pyun YongHyeon ed14f3f41d MFC r252404:
Fix triggering false watchdog timeout as done in bce(4) when
  controller is in PAUSE state.
2013-07-10 01:33:49 +00:00
Pyun YongHyeon f64cede587 MFC r252402:
Fix triggering false watchdog timeout when controller is in PAUSE
  state.  Previously it used to check if controller has sent a
  PAUSE frame to the remote peer.
2013-07-10 01:30:35 +00:00
Pyun YongHyeon c41d916d10 MFC r252227:
Don't blidly clear GPIOs configuration. Just use firmware configured
  one.  This change also fixes non-working traffic LED on BCM57780.
2013-07-10 01:27:05 +00:00
Michael Tuexen 55a3847480 Don't keep a pointer to freed memory.
This is a direct commit, since this code is gone in head.
2013-07-08 13:22:58 +00:00
Achim Leubner 03ad715640 MFC r250963, r251013, r251056: Driver 'aacraid' added to support Adaptec by PMC RAID controller families Series 6, 7, 8 and upcoming products.
Approved by:	emaste (co-mentor)
2013-07-08 12:17:06 +00:00
Edwin Groothuis f699668d26 MFC of tzdata2013d, 253009
- Morocco:
  announced that the year's Ramadan daylight-savings transitions
  would be 2013-07-07 and 2013-08-10.

- Israel:
  As of 2013, DST starts at 02:00 on the Friday before the last
  Sunday in March.  DST ends at 02:00 on the first Sunday after
  October 1, unless it occurs on the second day of the Jewish Rosh
  Hashana holiday, in which case DST ends a day later (i.e. at 02:00
  the first Monday after October 2).  [Rosh Hashana holidays are
  factored in until 2100.]
2013-07-07 22:27:47 +00:00
Michael Tuexen 02b14c7e7f MFC r252779:
Fix a bug were only 2048 streams where usable even though more than
2048 streams were negotiated on the wire. While there, remove the
hard coded limit of 2048 streams.
2013-07-07 19:07:00 +00:00
Michael Tuexen e33ccf682c MFC r252718:
When processing an incoming ABORT, SHUTDOWN_COMPLETE or ERROR (NAT related)
chunk, take always the T-bit into account, when checking the verification
tag.
2013-07-07 19:04:10 +00:00
Michael Tuexen b9b20cedb7 MFC r252585:
Code cleanups.
2013-07-07 19:01:34 +00:00
Michael Tuexen 334ccea086 MFC r251248:
Use LIST_EMPTY when appropriate.
2013-07-07 18:58:49 +00:00
Michael Tuexen 51f20e7baa MFC r251054:
Remove redundant checks.
2013-07-07 18:56:43 +00:00
Michael Tuexen 6853aa4f0c MFC r250756:
Set errno to ETIMEDOUT if an SCTP association times out during
setup.
2013-07-07 18:53:43 +00:00
Michael Tuexen 38c636c9c9 MFC r250754:
Don't send an ABORT chunk with verification 0.
2013-07-07 18:50:26 +00:00
Michael Tuexen 74fd62b3fa MFC r250466:
Honor the net.inet6.ip6.v6only sysctl variable and the IPV6_V6ONLY
socket option for SCTP sockets in the same way as for UDP or TCP
sockets.
2013-07-07 18:48:21 +00:00
Michael Tuexen 171753da1c MFC r249333:
Remove the number of addresses restriction from sctp_connectx().
Remove unused code.
While there, do some cleanup of the code.
2013-07-07 18:43:48 +00:00
Michael Tuexen dd336a7dcb MFC r248953:
Add a macro for checking for IPv4 link local addresses.
2013-07-07 18:41:25 +00:00
Michael Tuexen bba8b54541 MFC r248172 (partially):
Return an error if sctp_peeloff() fails because a socket can't be allocated.
2013-07-07 18:31:02 +00:00
Lawrence Stewart 1a4aa290a6 MFC r252504:
Import an implementation of the CAIA Delay-Gradient (CDG) congestion control
algorithm, which is based on the 2011 v0.1 patch release and described in the
paper "Revisiting TCP Congestion Control using Delay Gradients" by David Hayes
and Grenville Armitage. It is implemented as a kernel module compatible with the
modular congestion control framework.

CDG is a hybrid congestion control algorithm which reacts to both packet loss
and inferred queuing delay. It attempts to operate as a delay-based algorithm
where possible, but utilises heuristics to detect loss-based TCP cross traffic
and will compete effectively as required. CDG is therefore incrementally
deployable and suitable for use on shared networks.

In collaboration with:	David Hayes <david.hayes at ieee.org> and
				Grenville Armitage <garmitage at swin edu au>
Sponsored by:	Cisco University Research Program and FreeBSD Foundation
2013-07-07 14:20:00 +00:00
Martin Matuska 2be5b2e6f0 MFC r252732:
Fix misleading or remove irrelevant illumos messages and manpage references
in the zfs command.

PR:		bin/178996
Submitted by:	Peter Schaefer <[email protected]>
2013-07-07 09:22:03 +00:00
Andriy Gapon 64d40ef4b2 MFC r248820: rc.subr: disabling globbing while processing devfs rules 2013-07-06 09:03:02 +00:00
Andriy Gapon a8c6b9bcf4 MFC r249139: strncmp for boot code: fix an off by one error 2013-07-06 08:59:27 +00:00
Andriy Gapon b4cc3558b3 MFC r248641: libdwarf: anonymous types are expected to have empty type names 2013-07-06 08:43:49 +00:00
Andriy Gapon 1e8a23dc72 MFC r246243: uart: add resume method and enable it for attachments on
the most common x86 buses
2013-07-06 08:37:43 +00:00
Mark Johnston cfb3edf0be MFC r252325:
The dtmalloc provider uses the short description of a malloc type as the
function name of its corresponding DTrace probes. These descriptions may
contain whitespace, but probe names cannot, so just replace any whitespace
with underscores when creating probes.
2013-07-06 03:40:00 +00:00
Mark Johnston 103910fcc5 MFC r251238:
SDT probes can directly pass up to five arguments as arguments to
dtrace_probe(). Arguments beyond these five must be obtained in an
architecture-specific way; this can be done through the getargval provider
method, and through dtrace_getarg() if getargval isn't overridden.

This change fixes two off-by-one bugs in the way these arguments are fetched
in FreeBSD's DTrace implementation. First, the SDT provider must set the
aframes parameter to 1 when creating a probe. The aframes parameter controls
the number of frames that dtrace_getarg() will step over in order to find
the frame containing the extra arguments. On FreeBSD, dtrace_getarg() is
called in SDT probe context via

dtrace_probe()->dtrace_dif_emulate()->dtrace_dif_variable->dtrace_getarg()

so aframes must be 3 since the arguments are in dtrace_probe()'s frame; it
was previously being called with a value of 2 instead. illumos uses a
different aframes value for SDT probes, but this is because illumos SDT
probes fire by triggering the #UD fault handler rather than calling
dtrace_probe() directly.

The second bug has to do with the way arguments are grabbed out
dtrace_probe()'s frame on amd64. The code currently jumps over the first
stack argument and retrieves the rest of them using a pointer into the
stack. This works on i386 because all of dtrace_probe()'s arguments will be
on the stack and the first argument is the probe ID, which should be
ignored. However, it is incorrect to ignore the first stack argument on
amd64, so we correct the pointer used to access the arguments.
2013-07-06 02:50:22 +00:00
Mikolaj Golub 15a5b0bde5 MFC r252516, r252540:
Add a mib for worker process ID.
2013-07-05 18:47:25 +00:00
Mikolaj Golub f3ff541a9b MFC r252472:
Make hastctl(1) ('list' command) output a worker pid.

Reviewed by:	pjd
2013-07-05 18:44:41 +00:00
Dmitry Morozovsky ce29f3238c Finish MFC of r248291,249741:
Change 'status' command to produce one-line easy-parseable output.

Approved by:	trociny
2013-07-05 08:17:48 +00:00
Xin LI e452390642 MFC r252218:
Diff reduction against Illumos, no real change to code itself.

This marks vendor branch revision 252213 as merged, the actual code was
committed in r245479.
2013-07-05 04:16:52 +00:00
Xin LI d9ea1c4cfc MFC r251646 + r252219:
MFV r251644:

Poor ZFS send / receive performance due to snapshot
hold / release processing (by smh@)

Illumos ZFS issues:
3740 Poor ZFS send / receive performance due to snapshot
     hold / release processing

MFV r252215:

Restore a previous behavior before r251646, where when destructing
ZFS snapshot, the ioctl would return ENOENT when it hit any of
them in the errlist (the new behavior was only return ENOENT when
all returns error).

Illumos ZFS issues:
  3829 fix for 3740 changed behavior of zfs destroy/hold/release ioctl
2013-07-05 04:11:34 +00:00
Xin LI 07c76b493b MFC r251636: illumos #3749 zfs event processing should work on R/O root
filesystems

This log is a modified version of the original one written by gibbs@,
to account for changes made during the illumos RTI process.

Allow ZFS asynchronous event handling to proceed even if the root file
system is mounted read-only.  This restriction appears to have been put
in place to avoid errors with updating the configuration cache file.
However:

 o The majority of asynchronous event handling does not involve
   configuration cache file updates.
 o The configuration cache file need not be on the root file system,
   so the check was not complete.
 o Other classes of errors (e.g. file system full) can also prevent
   a successful update yet do not prevent asynchronous event processing.
 o Configurations such as NanoBSD never have a read-write root,
   so ZFS event processing is permanently disabled in these systems.
 o Failure to handle asynchronous events promptly can extend the
   window of time that a pool is in a critical state.

At worst, a missed configuration cache update will force the operator to
perform a manual "zfs import" (note -f is not required) to inform the
system about a newly created pool.  To minimize the likelihood of this
rare occurrence, configuration cache write failures now emit FMA events
(via devctl) so the operator can take corrective action, and the write
is retried every 5 minutes.  The retry interval, in seconds, is tunable
via the sysctl "vfs.zfs.ccw_retry_interval".

As a side effect of reporting configuration cache events, other sysevents,
such as re-silver start/stop, are now also reported via devctl.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c:
	o As is done in zfs_fm.c, provide a manual declaration for
	  devctl_notify().  Both declarations could be combined
	  into spa_impl.h, but the declaration is fault management
	  related, not spa specific.  sys/fm/fs/zfs.h would be ideal
	  if it weren't so public and reserved for FMA string
	  definitions.  I'm open to suggestions on how to improve
	  this nit while minimizing our divergence from Solaris.
	o Use devctl_notify() to implement sysevent support in
	  spa_event_notify().  The subsystem is EC_ZFS so that
	  these events can never collide with those emitted in
	  zfs_fm.c.
	o Add the sysctl "vfs.zfs.ccw_retry_interval".  The value
	  defaults to 5 minutes and is used to rate limit, on a
	  per-pool basis, configuration cache file write attempts.
	o Modify spa_async_dispatch to honor configuration cache
	  write limiting.  If other events are pending, a configuration
	  cache write will be attempted at the same time, so the
	  rate limiting only applies when the asynchronous dispatch
	  system is otherwise idle.  Async events should be rare
	  (e.g. device arrival/departure) and configuration cache
	  writes rarer, so a more complicated system to strictly
	  honor the retry limit seems unwarranted.
	o Remove check in spa_async_dispatch() for the root file
	  system being read-write.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c:
	Instead of silently ignoring configuration cache write
	failures, report them via a new FMA event as well as
	to the console.  The current zfs_ereport_post() doesn't
	allow arbitrary name=value pairs to be appended to the
	report, so the configuration cache file name is only
	available on the console output.  This limitation should
	be addressed in a future update.

	Note: This error report is only posted once per incident,
	to avoid spamming.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h:
	Add a hrtime_t to the spa data structure to track the
	time (via gethrtime()) of the last configuration cache file
	write failure.  This is referenced in spa_async_dispatch()
	to effect the rate limiting.

sys/cddl/contrib/opensolaris/uts/common/sys/fm/fs/zfs.h:
	  Add FM_EREPORT_ZFS_CONFIG_CACHE_WRITE as an ereport class.

Submitted by:	gibbs
Reviewed by:	Matthew Ahrens <[email protected]>,
		Eric Schrock <[email protected]>,
		Christopher Siden <[email protected]>
Sponsored by:	Spectra Logic
2013-07-05 04:02:15 +00:00
Xin LI 4b725587e0 MFC r251635: illumos #3747 txg commit callbacks don't work
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c:
	Fix commit callbacks by moving them to the task's list.
	Previously, list_move_tail() returned without doing anything because
	the task list was passed as the source rather than destination.

cddl/contrib/opensolaris/cmd/ztest/ztest.c:
	Check the commit callback threshold correctly.

Submitted by:	will
Reviewed by:	Matthew Ahrens <[email protected]>,
		Christopher Siden <[email protected]>
Sponsored by:	Spectra Logic
2013-07-05 03:55:13 +00:00
Xin LI 5e61c4f418 MFC r251634: illumos #3745 zpool create should treat -O mountpoint and -m the same
cddl/contrib/opensolaris/cmd/zpool/zpool_main.c:  (change 644608)
	This allows specifying a mountpoint using the latter form and having
	its value checked and used as it would be using the former form.

	As a consequence of this change:

	1. The mountpoint property is set in the fsprops nvlist prior
	   to creating the pool, rather than being set after creating
	   the pool.  To me, this is the proper approach, since it
	   avoids creating the pool if the mountpoint setting would
	   cause the command to fail.
	2. The mountpoint property, unlike all others, can be specified
	   more than once.  Only the last setting takes effect.  This
	   is to avoid breaking potential existing users that specify
	   -m more than once.

Submitted by:	will

cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
	Fix "zpool create -R <whatever> -m <whatever>".  Ever since
	change 644608, this has been broken.  The problem is that some
	old code in libzfs_pool.c would force a pool's mountpoint to
	"/" when creating a pool with an altroot.  That probably
	implemented some old policy decision regarding altroots, but it
	conflicts with the current manpage.  It also had no effect
	until 644608, because the zpool command would _always_ change
	the pool's mountpoint after creating it.  The solution is to
	delete the old code from libzfs_pool.c.

Submitted by:	asomers

Reviewed by:	Matthew Ahrens <[email protected]>,
		Christopher Siden <[email protected]>
Sponsored by:	Spectra Logic
2013-07-05 03:50:11 +00:00
Xin LI fab95f5ae1 MFC r251633: illumos #3744 zfs shouldn't ignore errors unmounting
snapshots

Propagate errors from zfs_unmount_snap() up to its callers wherever
feasible.

Submitted by:	will
Reviewed by:	Matthew Ahrens <[email protected]>,
		Christopher Siden <[email protected]>
Sponsored by:	Spectra Logic
2013-07-05 03:44:49 +00:00
Xin LI f3da65f835 MFC r251632: illumos #3743 zfs needs a refcount audit
Audit zap cursor usage and correct missing calls to zap_cursor_fini().

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c:
	Correct early exit handling of several functions that
	previously failed to close a cursor prior to returning.

Submitted by:	gibbs

Audit holders of dmu_bufs and correct missing calls to dmu_buf_rele().

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c:
	Correct early exit handling of several functions that
	previously failed to release a dmu_buf prior to returning.

Submitted by:	will

Reviewed by:	Matthew Ahrens <[email protected]>,
		Eric Schrock <[email protected]>,
		George Wilson <[email protected]>,
		Christopher Siden <[email protected]>
Sponsored by:	Spectra Logic
2013-07-05 03:38:53 +00:00
Xin LI 0d46868ed6 MFC r251631: illumos #3742 zfs comments need cleaner, more consistent style
- Make more of ZFS's comments use a natural English writing flow.
- Break up long paragraphs, fix various typos and spelling errors.
- Don't prefix a function description with its name when the function
  definition immediately follows.
- Remove useless comments.
- Add extra whitespace where it makes the comments more readable.

New comments were separated from this change and added in r251629.

Submitted by:	asomers, gibbs, will
Reviewed by:	Matthew Ahrens <[email protected]>,
		George Wilson <[email protected]>,
		Eric Schrock <[email protected]>,
		Christopher Siden <[email protected]>
Sponsored by:	Spectra Logic
2013-07-05 03:06:36 +00:00
Xin LI 2e8c864c53 MFC r251629: 3741 zfs needs better comments
Embellish the comments in various components of ZFS.  Move some comments
around closer to what they describe.  Specifically, answer the questions:

- What are some of the edge cases of the dbuf state machine?
- What does a txg quiesce do?
- When does the DMU notify threads waiting on txg's that they may
  proceed?
- How do the calculations for RAIDZ map allocations work?
- What process do the RAIDZ I/O start and done callbacks follow?

While here, adjust the function prototype of dmu_zfetch.c:dmu_zfetch_colinear()
to match its comment which describes its return as a boolean.

Submitted by:	asomers, gibbs, will
Reviewed by:	Matthew Ahrens <[email protected]>,
		Eric Schrock <[email protected]>,
		Christopher Siden <[email protected]>
Sponsored by:	Spectra Logic
2013-07-05 03:02:19 +00:00
Dimitry Andric 449466da21 MFC r252387:
Make libsupc++'s __cxa_call_terminate() prototype consistent with the
definition.

Submitted by:	[email protected]
2013-07-04 22:09:14 +00:00
Jim Harris 0b568cc35b MFC r252262:
For ATA_PASSTHROUGH commands, pretend isci(4) supports multiword DMA
  by treating it as UDMA.

  This fixes a problem introduced in r249933/r249939, where CAM sends
  ATA_DSM_TRIM to SATA devices using ATA_PASSTHROUGH_16.  scsi_ata_trim()
  sets protocol as DMA (not UDMA) which is for multi-word DMA, even
  though no such mode is selected for the device.  isci(4) would fail
  these commands which is the correct behavior but not consistent with
  other HBAs, namely LSI's.

  smh@ did some further testing on an LSI controller, which rejected
  ATA_PASSTHROUGH_16 commands with mode=UDMA_OUT, even though only
  a UDMA mode was selected on the device.  So this precludes adding
  any kind of mode detection in CAM to determine which mode to use on
  a per-device basis.

Sponsored by: Intel
2013-07-03 23:28:07 +00:00
Mark Johnston cebb2ce7f2 MFC r242726 (ambrisko):
Add support for SCSI pass through devices to be attached and detached.

MFC r251172 (sbruno):
xpt_create_path() requires mfi_io_lock to be held, so do it.

mfi(4) doesn't panic on host startup now.
2013-07-03 23:16:33 +00:00
David E. O'Brien d7f5ab7f9e MF9: r252635, r252638:
MFC: r252348, r252363: sysconf(3) returns a long, not an int.
2013-07-03 22:59:46 +00:00
Devin Teske e81acf4a30 MFC r252600: Fix grammar in a comment. 2013-07-03 20:55:49 +00:00
Steven Hartland f4c521239c MFC r252471:
Remove forced timeout of in-flight commands from mfi_timeout.

While this prevents commands getting stuck forever there is no way to guarantee
that data from the command hasn't been committed to the device.

In addition older mfi firmware has a bug that would cause the controller to
frequently stall IO for over our timeout value, which when combined with
a forced timeout often resulted in panics in UFS; which would otherwise be
avoided when the command eventually completed if left alone.

For reference this timeout issue is resolved in Dell FW package 21.2.1-0000.
Fixed FW package version for none Dell controller will likely vary.
2013-07-03 08:35:14 +00:00
Lawrence Stewart 009aae1542 MFC r252052:
Non-virtualised hhook points are supported as of r251732.
2013-07-03 08:21:05 +00:00
Lawrence Stewart 6c19bc2d72 MFC r251789:
Now that the necessary infrastructure is in place to ensure hhook points which
register after a khelp module will get hooked, move khelp module initialisation
to the earlier SI_SUB_KLD stage.
2013-07-03 07:58:14 +00:00
Lawrence Stewart 8356259383 MFC r251787:
Move hhook's per-vnet initialisation to an earlier SYSINIT SI_SUB stage to
ensure all per-vnet related hhook initialisation is completed prior to any
virtualised hhook points attempting registration.

vnet_register_sysinit() requires that a stage later than SI_SUB_VNET be chosen.
There are no per-vnet initialisors in the source tree at this time which run
earlier than SI_SUB_INIT_IF. A quick audit of non-virtualised SYSINITs indicates
there are no subsystems pre SI_SUB_MBUF that would likely be interested in
registering a virtualised hhook point.

Settle on SI_SUB_MBUF as hhook's per-vnet initialisation stage as it's the first
overtly network-related initilisation stage to run after SI_SUB_VNET. If a
subsystem that initialises earlier than SI_SUB_MBUF ends up wanting to register
virtualised hhook points in future, hhook's use of SI_SUB_MBUF will need to be
revisited and would probably warrant creating a dedicated SI_SUB_HHOOK which
runs immediately after SI_SUB_VNET.
2013-07-03 06:23:46 +00:00
Lawrence Stewart 7e070a5fa7 MFC r251778:
Cleanup and simplification in khelp_{register|deregister}_helper(). No
functional changes.
2013-07-03 05:59:48 +00:00
Lawrence Stewart cf10e7c6bc MFC r251774:
Add a private KPI between hhook and khelp that allows khelp modules to insert
hook functions into hhook points which register after the modules were loaded -
potentially useful during boot or if hhook points are dynamically registered.
2013-07-03 05:47:28 +00:00
Lawrence Stewart 411f10ec12 MFC r251770:
Internalise handling of virtualised hook points inside
hhook_{add|remove}_hook_lookup() so that khelp (and other potential API
consumers) do not have to care when they attempt to (un)hook a particular hook
point identified by id and type.

Reviewed by:	scottl
2013-07-03 05:29:21 +00:00
Lawrence Stewart faddeabb0c MFC r251732,251752:
Add support for non-virtualised hhook points, which are uniquely identified by
type and id, as compared to virtualised hook points which are now uniquely
identified by type, id and a vid (which for vimage is the pointer to the vnet
that the hhook resides in).

All hhook_head structs for both virtualised and non-virtualised hook points
coexist in hhook_head_list, and a separate list is maintained for hhook points
within each vnet to simplify some vimage-related housekeeping.

Reviewed by:	scottl
2013-07-03 04:21:29 +00:00
Lawrence Stewart 022e453100 When a previous call to sbsndptr() leaves sb->sb_sndptroff at the start of an
mbuf that was fully consumed by the previous call, the mbuf ptr returned by the
current call ends up being the previous mbuf in the sb chain to the one that
contains the data we want.

This does not cause any observable issues because the mbuf copy routines happily
walk the mbuf chain to get to the data at the moff offset, which in this case
means they effectively skip over the mbuf returned by sbsndptr().

We can't adjust sb->sb_sndptr during the previous call for this case because the
next mbuf in the chain may not exist yet. We therefore need to detect the
condition and make the adjustment during the current call.

Fix by detecting the special case of moff being at the start of the next mbuf in
the chain and adjust the required accounting variables accordingly.

Reviewed by:	andre
2013-07-03 03:40:06 +00:00
Martin Matuska 16f1a06d5d MFC r252380:
Unbreak "zfs jail" and "zfs unjail" (broken in stable/8 since r251757)

I missed to register zfs_ioc_jail and zfs_ioc_unjail as legacy ioctl's
with the new zfs_ioctl_register_legacy() function.

These operations do not modify pools or datasets so there is no need to
log them to pool history.

Reported by:	Alexander Leidinger <[email protected]> on current@
2013-07-02 19:45:14 +00:00
Mikolaj Golub 4832c09cbb MFC r248286 (pjd):
Removed redundant includes.
2013-07-02 19:29:45 +00:00
Mikolaj Golub 16af4c90a0 MFC r248294, r248296:
r248294 (pjd):

Delete requests can be larger than MAXPHYS.

r248296 (pjd):

Minor corrections.
2013-07-02 19:28:16 +00:00
Xin LI 1ed394a310 MFC r251859:
Return ENETDOWN instead of ENOENT when all lagg(4) links are
inactive when upper layer tries to transmit packet.  This
gives better feedback and meaningful errors for applications.

Reviewed by:	thompsa
2013-07-01 22:07:01 +00:00
Xin LI 4838c6da2c MFC r251825,252486:
Remove vfs_mount(9), it have been died since 2004.
2013-07-01 22:02:39 +00:00
Xin LI 1cabf20e09 MFC r252062:
Call sshd_precmd instead of sshd_configtest when the operator
requests reload or restart, which, in addition of testing the
configuration, will also generate host keys when they are not
present (previous behavior).

Obtained from:	FreeNAS
Ok'ed by:	bdrewery, des
2013-07-01 20:46:35 +00:00
Steven Hartland 3655827395 MFC r252392:
style(9) fixes
2013-07-01 08:27:15 +00:00
Steven Hartland 621456e1c5 MFC r252390:
Remove invalid ASSERT
2013-07-01 08:25:50 +00:00
Pyun YongHyeon 369a3176d2 MFC r251482,251733:
r251482:
  Correct setting TX random backoff register. This register is
  implemented as a 10 bits linear feedback shift register so only
  lower 10 bits are valid.
  Because this register is used to initialize random backoff interval
  register only when resolved duplex is half-duplex, it wouldn't have
  caused issues in these days.

r251733:
  Fix a typo introduced in r213280. IFM_OPTIONS macro should see
  current media word.
2013-07-01 07:03:38 +00:00
Pyun YongHyeon 8f4098aad4 MFC r251481:
Do not report current link status if driver is not running.
  Reporting link status in driver has a side-effect that makes mii(4)
  check current link status.  mii(4) will call link status change
  callback when it sees link state change.  Normally this wouldn't
  have problems. However, ASF/IPMI firmware can actively access PHY
  regardless of driver's running state such that reporting link
  status for not-running interface can generate meaningless link
  UP/DOWN messages.

  This change also makes dhclient think driver got a valid link
  regardless of link establishment so it will bypass dhclient's
  initial link status check. I think that wouldn't be issue
  though.
2013-07-01 06:58:35 +00:00
Pyun YongHyeon af19b8719b MFC r252186:
Add Lenovo USB 2.0 Ethernet adapter to the list of supported
  devices.
2013-07-01 05:33:55 +00:00
Pyun YongHyeon bee88a92af MFC r252185:
Add Lenovo USB 2.0 Ethernet adapter.

  PR:	usb/179920
2013-07-01 05:30:38 +00:00
Pyun YongHyeon be5d2763a6 MFC r252143:
When RX checksum offloading is active, AX88772B will prepend a
  checksum header.  The header contains a received frame length but
  the defined length for AX88772B is different with other ASIX
  controllers.  When the RX checksum is off, AX88772B controller does
  not prepend a checksum header so driver has to use normal header
  length mask.
  This change should fix RX errors when RX checksum offloading is
  off.
2013-07-01 05:26:29 +00:00
Lawrence Stewart 9fc9d6eae5 MFC r251887:
Add new FOREACH_FROM variants of the queue(3) FOREACH macros which can
optionally start the traversal from a previously found element by passing the
element in as "var". Passing a NULL "var" retains the same semantics as the
regular FOREACH macros.

Reviewed by:	jhb (previous version), rpaulo
2013-06-29 04:27:04 +00:00
Dag-Erling Smørgrav 1d677ea6bd MFH (r251088, r252338): revert default privsep setting to "yes" 2013-06-28 10:21:49 +00:00
Lawrence Stewart 055a2d630d MFC r251725:
Fix a potential NULL-pointer dereference that would trigger if the hhook
registration site did not provide storage for a copy of the hhook_head struct.
2013-06-28 03:41:23 +00:00
Lawrence Stewart 37ce2262b3 MFC r251682:
Remove some duplicate code by making KHELP_DECLARE_MOD() a wrapper around
KHELP_DECLARE_MOD_UMA().
2013-06-28 03:23:24 +00:00
Lawrence Stewart 237fb35305 MFC r250951,251838:
Ensure alq's shutdown_pre_sync event handler is deregistered on module unload to
avoid a dangling pointer and eventual panic on system shutdown.

Reported by:	Ali <comnetboy at gmail.com>
2013-06-28 03:04:07 +00:00
John Baldwin dc87512dc7 MFC 233662,233677-233678,250418,252166:
If the firmware/BIOS assigns conflicting ranges to BARs then leaving the
BARs alone could result in one device stealing mmio accesses intended to go
to a second device.  Previously the PCI bus driver attempted to handle this
case by clearing the BAR to 0 depending on BARs based at 0 not decoding (which
is not guaranteed to be true).  Now when a conflicting BAR is detected the
following steps are taken:

 1) If hw.pci.realloc_bars (a new tunable) is enabled (default is disabled),
    then ignore the current BAR setting from the firmware and attempt to
    allocate a fresh resource range for the BAR.

 2) If 1) failed (or was disabled), disable decoding for the relevant
    BAR type (e.g. disable mem decoding for a memory BAR) and emit a
    warning if booting verbose.
2013-06-27 21:02:26 +00:00
Steven Hartland 67fee5dd5a MFC r252056:
Fix destroyed ZFS pools failing to import

MFC r252059:
Fix ZFS zpool freeze (debug command) not processing due to invalid ioctl call syntax.

MFC r252060:
Fix intermittent ZFS lock panic

MFC r252061:
Switch ZFS mutex_owner macro to use sx_xholder as its now exported via sx.h
2013-06-27 14:32:51 +00:00
Steven Hartland 56db78c018 MFC r252045:
Corrected ATA Passthrough defines from decimal to hex
2013-06-27 10:58:31 +00:00
Jim Harris ad234b8c38 MFC r250613:
Fix typo in net.inet.tcp.minmss sysctl description.
2013-06-27 00:51:47 +00:00
Baptiste Daroussin 289495021c MFC r251560
Fix a bad calloc(3) call
2013-06-25 21:50:05 +00:00
Eitan Adler 4900ba4b08 MFC r250377:
Allow the use of lowercase 'yes'

PR:		bin/178422
2013-06-25 20:03:06 +00:00
Alexander Motin 2fe5c7b17e MFC r251945:
Pass proper memory type to free() in ata_ali_chipinit().
2013-06-25 07:11:07 +00:00
Bryan Venteicher 0cbe024fd2 MFC r251769
Fix setting of the Rx filters

  QEMU 1.4 made the descriptor requirement stricter - the size of buffer
  descriptor must exactly match the number of MAC addresses provided.
2013-06-25 04:44:42 +00:00
John Baldwin 19bea97e64 MFC 251323:
- Handle the recursed/not recursed flags with RA_RLOCKED in rw_assert().
- Tweak a panic message.
2013-06-24 19:28:36 +00:00
John Baldwin 46c3031e50 MFC 252037: Document RA_RECURSED and RA_NOTRECURSED. 2013-06-24 18:41:28 +00:00
John Baldwin 2b6578cf4a MFC 251470:
Do not compare the existing mask of a cpuset with a new mask when changing
the mask of a cpuset.  Also, change the cpuset's mask before updating the
masks of all children.  Previously changing a cpuset's mask first required
setting the mask to a super-set of both the old and new masks and then
changing it a second time to the new mask.
2013-06-24 18:37:52 +00:00
John Baldwin b4d64c1ada MFC 250223:
Similar to 233760 and 236717, export some more useful info about the
kernel-based POSIX semaphore descriptors to userland via procstat(1) and
fstat(1):
- Change sem file descriptors to track the pathname they are associated
  with and add a ksem_info() method to copy the path out to a
  caller-supplied buffer.
- Use ksem_info() to export the path of a semaphore via struct kinfo_file.
- Teach fstat about semaphores and to display their path, mode, and value.
2013-06-24 17:09:28 +00:00
Steven Hartland fc7a1f9d77 Added ZFS TRIM support which is enabled by default. To disable
ZFS TRIM support set vfs.zfs.trim.enabled=0 in loader.conf.

Creating new ZFS pools and adding new devices to existing pools
first performs a full device level TRIM which can take a significant
amount of time. The sysctl vfs.zfs.vdev.trim_on_init can be set to 0
to disable this behaviour.

ZFS TRIM requires the underlying device support BIO_DELETE which
is currently provided by methods such as ATA TRIM and SCSI UNMAP
via CAM, which are typically supported by SSD's.

Stats for ZFS TRIM can be monitored by looking at the sysctl's
under kstat.zfs.misc.zio_trim.

MFC r240868: Add TRIM support
MFC r244155: Renamed zfs trim stats
MFC r244187: Upgrade TRIM free request sizes optimisation
MFC r244188: Added vfs.zfs.vdev.trim_on_init sysctl
MFC r248572: Add TRIM support for L2ARC
MFC r248573: Don't register repair writes in the trim map.
MFC r248574: Improve TXG handling in the TRIM module
MFC r248575: TRIM cache devices based on time instead of TXGs
MFC r248576: Names the ZFS TRIM thread
MFC r248577: Optimisation of TRIM processing
MFC r248602: Fix for building libzpool under i386
MFC r249921: Enabled ZFS TRIM by default
2013-06-24 15:35:42 +00:00
Mark Johnston 7a3d0356c0 MFC r251872:
Be sure to actually decrement the "count" parameter for each processed
descriptor so that we return when the threshold has been reached.
2013-06-24 01:05:51 +00:00
Eitan Adler 43ffc289d6 MFC r252042:
Ports switched from dialog to dialog4ports some time ago.

PR:		docs/179785
2013-06-23 20:19:05 +00:00
Glen Barber 392c24e08c Since we likely will not have an 8.5-RELEASE, reword the errata page
for the 8.4-RELEASE.
2013-06-23 20:09:58 +00:00
Devin Teske b55248dba7 MFS9->8 r252025:
Fix a copy/paste error introduced by r248452 (s/ftp/http/ in menu text).
This is a direct commit to stable/8.
2013-06-23 10:16:14 +00:00
Yoshihiro Takahashi c4eac805b0 MFi386: revision 251332
Use slightly more idiomatic expression to get the address of array.
2013-06-23 09:34:55 +00:00
Yoshihiro Takahashi 3119796311 MFi386: revision 245847
Add special loader environment variables 'comconsole_port' and
  'comconsole_pcidev'.
2013-06-23 09:23:32 +00:00
Mark Johnston 60b4c13d27 MFC r250599:
Add a remark to the effect that a manually started relearn will always
result in the battery being completely drained, even in transparent learning
mode.
2013-06-22 05:32:45 +00:00
Mark Johnston 3d788c43f1 MFC r246951:
Mark the coretemp(4) sysctls as MPSAFE, ensuring that Giant won't be held
unnecessarily by a user thread waiting to run on a specific CPU after
calling sched_bind().
2013-06-22 05:25:12 +00:00
Mark Johnston 930b047297 MFC r251166:
Add macros which allow one to define SDT probes with six or seven arguments;
they are needed when porting some of the Solaris providers (ip, iscsi, and
tcp in particular).

dtrace_probe() only takes five arguments from the probe site, so we need to
add the appropriate cast to allow for more than five arguments. The extra
arguments are later copied out of dtrace_probe()'s stack frame by
dtrace_getarg() (or the provider-specific getarg method) as needed.
2013-06-22 04:52:12 +00:00
Mark Johnston abe01037c7 MFC r251723:
The functions are called pci_{msi,msix}_count(), not pci_count_{msi,msix}().
2013-06-22 04:04:34 +00:00
Simon J. Gerraty 44186a4ffe share/mk: merge: r241298,243393,249057,251506 from head for bmake support.
merge: r252048 from stable/9

Makefile: merge: r252048 from stable/9 for bmake support.

Reviewed by: obrien
2013-06-21 22:45:03 +00:00
Devin Teske 2f5e344327 MFS9->8 r249822:
Update error messages when processing the INDEX file to display the given
path rather than a static string. This makes the error messages consistent
with the rest of the functions which already do the same thing (assumed to
be an oversight of r47055, 13+ years ago). A direct commit to stable/9.

This is a direct commit to stable/8.

Reviewed by:	eadler
2013-06-21 21:59:58 +00:00
John Baldwin 299ff709b1 MFC 251637:
Borrow the algorithm from kvm_getprocs() to fix procstat(1) to handle the
case where the process tables grows in between the calls to fetch the size
and fetch the table.

Note that this is not a true MFC as the libprocstat library doesn't exist
in 8.x and the relevant code is in the procstat binary instead.
2013-06-21 19:30:32 +00:00
John Baldwin bb7c5ada19 MFC 250333: Don't pad disk partition sizes with leading zeros. 2013-06-21 15:30:18 +00:00
Pietro Cerutti dc91ac0cfb MFC: r249406
- Do not bail out if stat(2) fails with ENOENT in the spool directory. This
  happens if another atrm process removes a job while we're scanning through
  the directory.
- While at it, optimize a bit the directory scanning, so that we quit
  looping as soon as all jobs specified in argv have been dealt with.

Approved by:	cognet
2013-06-20 16:50:05 +00:00
Jaakko Heinonen c8d88ebe95 MFC r251485:
Revert r238399.

The "failok" option doesn't have any effect at all unless specified in
fstab(5) and combined with the -a flag. The "failok" option is already
documented in fstab(5).

PR:		177630
2013-06-19 18:01:37 +00:00
Alexander Motin 671a1bcb67 MFC r251616:
Don't update provider properties and don't set DISKFLAG_OPEN if d_open()
disk method call returned error.  GEOM considers devices in such case as
still closed, and won't call symmetric d_close() for them.
2013-06-18 09:48:56 +00:00
Alexander Motin 50882f29ab MFC r248720:
Remove extra bio_data and bio_length copying to child request after calling
g_clone_bio(), that already copied them.
2013-06-18 09:36:01 +00:00
Xin LI 3cc431f822 MFC r251349:
Fix a typo: XPORT_SPI should be tested against transport, nor protocol.

Submitted by:	Sascha Wildner <swildner dragonflybsd org>
Reviewed by:	mjacob
2013-06-18 04:06:12 +00:00
Xin LI 8e526cc4ef MFC r251187:
Explicitly use a pair of parentheses to ensure correct evaluation
ordering for bitwise operation.

Submitted by:	swildner (DragonFly)
2013-06-18 04:04:15 +00:00
Andrey V. Elsukov 39dc394d78 MFC r249252:
Remove reference to the nonexistent sysctl node net.inet6.mld.stats.
  Also add cross reference to the icmp6(4).

  PR:	177696
2013-06-17 20:18:12 +00:00
Alexander Motin a851746e1d MFC r251659:
Use CAM_DIR_NONE for requests without data.
Wrong values there confuse some drivers.
2013-06-17 15:01:40 +00:00
Alexander Motin 0e9238a7d5 MFC r251661:
Replicate r242422 from ata(4) to mvs(4):
Only four specific ATA PIO commands transfer several sectors per DRQ block
(interrupt).  All other ATA PIO commands transfer one sector or 512 bytes
at one time.  Hardcode these exceptions in mvs(4).
This fixes timeout of READ LOG EXT command used by `smartctl -x /dev/adaX`.
Also it fixes timeout of DOWNLOAD_MICROCODE on `camcontrol fwdownload`.
2013-06-17 14:56:49 +00:00
Pyun YongHyeon 7dbac9abb6 MFC r251600:
Avoid unnecessary controller reinitialization by checking driver
  running state.  fxp(4) requires controller reinitialization for the
  following cases.
   o RX lockup condition on i82557
   o promiscuous mode change
   o multicast filter change
   o WOL configuration
   o TSO/VLAN hardware tagging/checksum offloading configuration
   o MAC reprogramming after speed/duplex/flow-control resolution
   o Any events that result in MAC reprogramming(link UP/DOWN,
     remote link partner's restart of auto-negotiation etc)
   o Microcode loading/unloading
  Apart from above cases which come from hardware limitation, upper
  stack also blindly reinitializes controller whenever an IP address
  is assigned. After r194573, fxp(4) no longer needs to reinitialize
  the controller to program multicast filter after upping the
  interface. So keeping track of driver running state should remove
  all unnecessary controller reinitializations.

  This change will also address endless controller reinitialization
  triggered by dhclient(8).
2013-06-17 04:42:02 +00:00
Mikolaj Golub 27604e38b6 MFC r251490:
Properly set curvnet context in lagg_port_setlladdr() task handler.

Reported by:	Nikos Vassiliadis <nvass gmx.com>
Submitted by:	zec
Tested by:	Nikos Vassiliadis <nvass gmx.com>
2013-06-15 08:07:47 +00:00
Rick Macklem cbcf050b11 MFC: r249623
Both NFS clients can deadlock when using the "rdirplus" mount
option. This can occur when an nfsiod thread that already holds
a buffer lock attempts to acquire a vnode lock on an entry in
the directory (a LOR) when another thread holding the vnode lock
is waiting on an nfsiod thread. This patch avoids the deadlock by disabling
readahead for this case, so the nfsiod threads never do readdirplus.
Since readaheads for directories need the directory offset cookie
from the previous read, they cannot normally happen in parallel.
As such, testing by jhb@ and myself didn't find any performance
degredation when this patch is applied. If there is a case where
this results in a significant performance degradation, mounting
without the "rdirplus" option can be done to re-enable readahead
for directories.
2013-06-15 01:35:52 +00:00
John Baldwin c0c55d00ae MFC 250220:
Fix FIONREAD on regular files.  The computed result was being ignored and
it was being passed down to VOP_IOCTL() where it promptly resulted in
ENOTTY due to a missing else for the past 8 years.  While here, use a
shared vnode lock while fetching the current file's size.
2013-06-14 22:06:45 +00:00
John Baldwin ef0e909213 MFC 250053:
Only cleanup CMI-related state on detach if the system supports CMI.
2013-06-14 20:44:23 +00:00
Martin Matuska adf0858697 MFC 246619,247187,247265,247348,247398,247540,247585,248265,248267,248571,
248976,249004,249042,249047,249188,249195,249196,249206,249207,249319,
    249326,249356,249357,249787,249883,249858

Merge libzfs_core, zfs deadman thread and other ZFS bugfixes and improvements.

MFC r246619:
  Correct spelling of "daemon".  No .Dd bump.
  Noticed by:	Nathan Rich <Nathan.Rich dynastysystems com>

MFC r247187:
  Import vendor change to avoid "unitialized variable" warnings.

  Illumos ZFS issues:
  3522 zfs module should not allow uninitialized variables

MFC r247265:
  Merge the ZFS I/O deadman thread from vendor (illumos).
  This feature panics the system on hanging ZFS I/O, helps debugging
  and resumes failed service.

  The panic behavior can be controlled with the loader-only tunables:
  vfs.zfs.deadman_enabled (enable or disable panic on stalled ZFS I/O)
  vfs.zfs.deadman_synctime (expiration time for stalled ZFS I/O)

  By default, ZFS I/O deadman is enabled by default on amd64 and i386
  excluding virtual guest machines.

MFC r247348:
  Be more verbose on ZFS deadman I/O panic
  Patch suggested upstream.

MFC r247398:
  Import metaslab_sync() speedup from vendor (illumos).

  Illumos ZFS issues:
  3552 condensing one space map burns 3 seconds of CPU in spa_sync() thread
  3564 spa_sync() spends 5-10% of its time in metaslab_sync() (when not
	condensing)
  3578 transferring the freed map to the defer map should be constant time
  3579 ztest trips assertion in metaslab_weight()

MFC r247540:
  Fix the zfs_ioctl compat layer to support zfs_cmd size change introduced
  in r247265 (ZFS deadman thread). Both new utilities now support the old
  kernel and new kernel properly detects old utilities.

  For future backwards compatibility, the vfs.zfs.version.ioctl read-only
  sysctl has been introduced. With this sysctl zfs utilities will be able
  to detect the ioctl interface version of the currently loaded zfs module.

MFC r247585:
  Merge new read-only zfs properties from vendor (illumos)

  Illumos ZFS issues:
  3588 provide zfs properties for logical (uncompressed) space used and
       referenced

MFC r248265:
  Update zfs.8 manpage date (missing in r247585)

MFC r248267:
  Import minor ZFS changes from vendor

  Illumos ZFS issues:
  3604 zdb should print bpobjs more verbosely (fix zdb hang)
  3606 zpool status -x shouldn't warn about old on-disk format

MFC r248571:
  MFV 238590, 238592:
  In the first zfs ioctl restructuring phase, the libzfs_core library was
  introduced. It is a new thin library that wraps around kernel ioctl's.
  The idea is to provide a forward-compatible way of dealing with new
  features. Arguments are passed in nvlists and not random zfs_cmd fields,
  new-style ioctls are logged to pool history using a new method of
  history logging.

  http://blog.delphix.com/matt/2012/01/17/the-future-of-libzfs/

  MFV 247580 [1]:
  To address issues of several deadlocks and race conditions the locking
  code around dsl_dataset was rewritten and the interface to synctasks
  was changed.

  User-Visible Changes:
  "zfs snapshot" can create more arbitrary snapshots at once (atomically)
  "zfs destroy" destroys multiple snapshots at once
  "zfs recv" has improved performance

  Backward Compatibility:
  I have extended the compatibility layer to support full backward
  compatibility by remapping or rewriting the responsible ioctl arguments.
  Old utilities are fully supported by the new kernel module.

  Forward Compatibility:
  New utilities work with old kernels with the following restrictions:
    - creating, destroying, holding and releasing of multiple snapshots
      at once is not supported, this includes recursive (-r) commands

  Illumos ZFS issues:
    2882 implement libzfs_core
    2900 "zfs snapshot" should be able to create multiple,
         arbitrary snapshots at once
    3464 zfs synctask code needs restructuring

MFC r248976:
  Call dmu_snapshot_list_next() in zvol.c with dsl_pool_config lock held

MFC r249004:
  Do not check against uninitialized rc and comment out vendor code

MFC r249042:
  Fix possible pool hold leak in dmu_send_impl()

  Illumos ZFS issues:
    3645 dmu_send_impl: possibilty of pool hold leak

MFC r249047 (avg):
  spa_open_common: fix argument to zvol_create_minors

  Prior to r248571 spa_open was always called with a bare pool name,
  but now it is called with a dataset name instead (spa_lookup handles
  that).
  So, when a ZFS root is mounted spa_open is called with a name of a root
  dataset, which can very well be different from the pool name.
  But zvol_create_minors should be called with the pool name, because it
  performs a recursive traversal of all datasets under the name to find
  all those that are volumes.

MFC r249188:
  Import vendor change to reduce diff, no effect on FreeBSD.

  Illumos ZFS issues:
    3517 importing pool with autoreplace=on and "hole" vdevs crashes
	 syseventd

MFC r249195:
  Merge change from vendor to reduce diff only.
  ZFS dtrace probes are not supported on FreeBSD yet.

  Illumos ZFS issues:
    3598 want to dtrace when errors are generated in zfs

MFC r249196:
  Provide a fix for kernel panic if receiving recursive deduplicated
  streams. Problem reported to vendor.

  Illumos ZFS issues:
    3692 Panic on zfs receive of a recursive deduplicated stream

MFC r249206:
  Merge vendor change - modify time processing in deadman thread.

  Illumos ZFS issues:
    3618 ::zio dcmd does not show timestamp data

MFC r249207:
  Allow zdb to output a histogram of compressed block sizes.

  Illumos ZFS issues:
    3641 want a histogram of compressed block sizes

MFC r249319:
  ZFS expects a copyout of zfs_cmd_t on an ioctl error. Our sys_ioctl()
  doesn't copyout in this case.

  To solve this a new struct zfs_iocparm_t is introduced consisting of:
  - zfs_ioctl_version (future backwards compatibility purposes)
  - user space pointer to zfs_cmd_t (copyin and copyout)
  - size of zfs_cmd_t (verification purposes)

  The copyin and copyout of zfs_cmd_t is now done the illumos (vendor) way
  what makes porting of new changes easier and ensures correct behavior if
  returning an error.

MFC r249326:
  Cast (void *)(uintptr_t) on copyout and copyin of zfs_iocparm_t.zfs_cmd

MFC r249356:
  Merge bugfixes accepted and integrated by vendor. Underlying problems
  have been reported by us and fixed in r240942 and r249196.

  Illumos ZFS issues:
    3645 dmu_send_impl: possibilty of pool hold leak
    3692 Panic on zfs receive of a recursive deduplicated stream

MFC r249357:
  Fix libzfs to report error instead of returning zero if trying to hold or
  release a non-existing snapshot of a existing dataset. In recursive case
  error is reported if no snapshots with the requested name have been found.

  Illumos ZFS issues:
    3699 zfs hold or release of a non-existent snapshot does not output
	 error

MFC r249787:
  The zfs synctask code restructuring introduced a new bug that makes it
  impossible to set quota and reservation on pools lower than version 22.
  Problem has been reported and a solution discussed with vendor.

  Illumos ZFS issues:
    3739 cannot set zfs quota or reservation on pool version < 22

MFC r249883:
  Respect the enoent_ok flag if reporting error for holding an non-existing
  snapshot.

  Related illumos ZFS issue:
    3699 zfs hold or release of a non-existent snapshot does not output error

MFC r249858:
  Merge vendor bugfix for a possible deadlock related to async destroy
  and improve write performance by introducing a new lock protecting
  tx_open_txg.

  Illumos ZFS issues:
    3642 dsl_scan_active() should not issue I/O to determine if async
         destroying is active
    3643 txg_delay should not hold the tc_lock
2013-06-14 19:26:32 +00:00
John Baldwin b6c6e3a73c MFC 249767:
- Some BIOSes use an Extended IRQ resource descriptor in _PRS for a link
  that uses non-ISA IRQs but use a plain IRQ resource in _CRS.  However,
  a non-ISA IRQ can't fit into a plain IRQ resource.  If we encounter a
  link like this, build the resource buffer from _PRS instead of _CRS.
- Set the correct size of the end tag in a resource buffer.
2013-06-14 18:42:08 +00:00
Pedro F. Giffuni 02b67c3172 MFC r250550:
(Missing libcpp merge)

Add support for "d" floating-point suffix, as defined by draft N1312
of TR 24732.

Reported by:	dim
Pointy hat:	pfg
2013-06-14 10:45:31 +00:00
Pedro F. Giffuni 7952f04bec MFC r250550, r250566;
Update the gcc43 ChangeLog.

Add support for "d" floating-point suffix, as defined by draft N1312
of TR 24732.
2013-06-14 03:28:29 +00:00
Pedro F. Giffuni 305bf722c9 MFC r251561:
libstand: Reset the seek pointer in ext2fs as done in UFS.

PR:		177328
Submitted by:	Eric van Gyzen
Reviewed by:	iedowse
2013-06-14 03:21:53 +00:00
Rick Macklem a9928ace8c MFC: r250177
Fix the getpwnam_r() call in the pname_to_uid() kerberos library function so
that it handles the ERANGE error return case. Without this fix, authentication
of users for certain system setups could fail unexpectedly.
2013-06-14 00:33:55 +00:00
Rick Macklem fece324911 MFC: r250176
Fix the getpwuid_r() call in the gssd daemon so that it handles
the ERANGE error return case. Without this fix, authentication
of users for certain system setups could fail unexpectedly.
2013-06-14 00:30:11 +00:00
Rick Macklem 0920cff32c MFC: r251089
Add a patch analygous to r248567, r248581, r251079 to the
old NFS client to avoid the panic reported in the PR by
doing the vnode_pager_setsize() call after unlocking the mutex.
2013-06-14 00:02:29 +00:00
Eitan Adler 3dc3964517 MFC r227183,r229905,r250432,r250451,r250882:
- Add missing static keywords to split(1)

	- Fix warning when compiling with gcc46:
	 error: variable 'defname' set but not use

	- Implement 'split -d' which allows a numeric suffix instead of an
	alphabetic one.

	- Bump .Dd for recent content change.
	Avoid signed overflow in error handling code.

PR:		bin/116209
2013-06-13 21:06:17 +00:00
John Baldwin 167df324cc MFC 249766: Use a higher TTL (128) for DHCP packets. 2013-06-13 21:03:23 +00:00
John Baldwin 6f5d8ab5bf MFC 249315:
Proxy allocation requests for the PCI ROM BAR from child devices similar
to how the VGA bus driver currently proxies allocation requests for other
PCI BARs.
2013-06-13 21:01:33 +00:00
Eitan Adler 44571e0d46 MFC r250462:
Add option to lockf to avoid creating a file if it does not exist.

PR:	bin/170775
2013-06-13 20:46:30 +00:00
Eitan Adler 0095a1db63 MFC r251109:
Add support for tethering on the iPhone 4S

PR:	usb/179078
2013-06-13 20:41:09 +00:00
John Baldwin ef45aaedc2 MFC 249263: Fix a potential socket leak in the NFS server. 2013-06-13 19:35:56 +00:00
Hiroki Sato ccaa53989b Document an issue in vtnet(4) + QEMU 1.4.1 or later. 2013-06-13 05:51:59 +00:00
Hans Petter Selasky 2e989b4f5b MFC r251249, r251251, r251252, r251253, r251254 and r251515:
Correct XHCI DMA descriptor programming.
Correct maximum IRQ rate.
2013-06-11 06:22:09 +00:00
Konstantin Belousov 2b8b73eb6b MFC r251324:
Assert that interrupts are enabled in the trap handlers on x86 before
calling generic code to deliver signals.
2013-06-10 04:23:11 +00:00
Mark Johnston 14a3463f3c MFC r247221:
Merge part of r1712 from elftoolchain, making it possible to resize ELF
sections and indirectly change the layout of an ELF file when
ELF_F_LAYOUT is not set.
2013-06-09 17:47:16 +00:00
Hiroki Sato 65465faeb3 - Remove bge(4) item [*].
- Add jail_parameters incompatibility.

Discussed with:	yongari [*]
2013-06-09 15:08:51 +00:00
Mark Johnston 0daee4cfed MFC r250939:
Correct the description of the -a option: rtsol(d) -a will in fact send out
router solicitations on multiple interfaces.

MFC r251059:
- Fix wording.
- Improve the descriptions in the FILES section.
2013-06-08 15:48:29 +00:00
Mark Johnston 3aa6a46d34 MFC r250941:
Include descriptions of the flags and fields printed when dumping the IPv6
prefix list.
2013-06-08 15:47:18 +00:00
Mark Johnston 00ec4cd3b9 MFC r235647 for newsyslog (by gleb):
Hide DIR definition by making it an opaque struct typedef.

Introduce dirfd() libc exported symbol replacing macro with same name,
preserve _dirfd() macro for internal use.

Replace dirp->dd_fd with dirfd() call. Avoid using dirfd as variable
name to prevent shadowing global symbol.

MFC r250545:
Some filesystems (NFS in particular) do not fill out the d_type field when
returning directory entries through readdir(3). In this case we need to
obtain the file type ourselves; otherwise newsyslog -t will not be able to
find archived log files and will fail to both delete old log files and to
do interval-based rotations properly.

MFC r251240:
We want to stat the archived log file rather than the logfile itself.
2013-06-08 15:46:09 +00:00
Hiroki Sato 3087db8604 Revert the previous change and fix the tag name. 2013-06-08 13:48:27 +00:00
Hiroki Sato dd2fda66d1 One more s/RELEASE_8_4_0/RELENG_8_4_0_RELEASE/
Spotted by:	nyan
2013-06-08 13:45:43 +00:00
Hiroki Sato 237ddf3345 s/RELEASE_8_4_0/RELENG_8_4_0_RELEASE/
Spotted by:	nyan
2013-06-08 13:40:36 +00:00
Hiroki Sato 4d9fda31d3 Document that CVS repository is no longer supported. 2013-06-08 12:10:52 +00:00
David E. O'Brien ff15f6ad12 MF9: r237968, r251504:
MFC: r251368, r251382: Match the options of the kernel.
   MFC: r237279: install filemon.h into /usr/include for userland consumption.
2013-06-07 21:39:46 +00:00
Sergey Kandaurov 17a235200b Add the entry for 8.4-RELEASE. 2013-06-07 15:52:33 +00:00
Steven Hartland 92c299962a MFC r249895:
Add Host Protected Area (HPA) support to camcontrol

MFC r249904:
mdoc: remove superfluous paragraph macro.

MFC r249153: (included in r251494)
mdoc: remove superfluous paragraph macro.
2013-06-07 13:59:41 +00:00
Steven Hartland 7e4742d574 MFC r249115:
Adds security command to camcontrol which provides the ability to secure erase
SSD's
2013-06-07 13:30:59 +00:00
Steven Hartland 78a70b40a5 MFC r251061:
More 4k quirks for SSD's
2013-06-07 12:42:49 +00:00
Steven Hartland 219d7d2c5f MFC r250792:
Added output of device QUIRKS for CAM and AHCI devices during boot.
2013-06-07 12:33:40 +00:00
Steven Hartland d9c2c4ff91 Enhanced BIO_DELETE support for CAM SCSI to add ATA_TRIM support.
Disable CAM BIO queue sorting for non-rotating media by default.

MFC r245253 Use sysctl tunable values for scsi_da & retry_count (stable/8 only)
MFC r249939 Added available delete methods discovery during device probe
MFC r249941 Automatically disable BIO queue sorting for non-rotating media
MFC r250033 Correct comment typo's
MFC r250179 Update probe flow so that devices with lbp can also disable disksort
MFC r250181 Check for ATA Information VPD before querying for ATA
MFC r250183 Enable CAM SCSI to choice ATA TRIM during autodetection
MFC r250967 Enforce validation on the selected delete method via sysctl
2013-06-07 12:24:15 +00:00
Hiroki Sato 54d0ddb535 Document a bge(4) issue. 2013-06-07 09:06:50 +00:00
Steven Hartland 878280e6eb MFC r216088:
Manual partial MFC of only basic VPD support for scsi_xpt

MFC r249937:
Refactored scsi_xpt use of device_has_vpd
2013-06-06 22:31:52 +00:00
Steven Hartland 7dc18c57a9 MFC r249934:
Updated TRIM calculations in cam/ata to be based off ATA_DSM_* defines
2013-06-06 11:47:54 +00:00
Steven Hartland c5dd6d2eb0 MFC r249933:
Added the ability to send ATA identify and TRIM commands via SCSI
2013-06-06 11:41:22 +00:00
Steven Hartland e0b944d0c6 MFC r249931:
Added Dataset Management defines to be used by TRIM
2013-06-06 10:27:34 +00:00
Steven Hartland 6078cfd7c7 MFC r249930:
Added a sysctl to control the maximum size of a delete request
2013-06-06 10:25:58 +00:00
Steven Hartland c8d3ba9893 MFC r248992:
Added ATA Pass-Through support to CAM
2013-06-06 10:09:20 +00:00
Steven Hartland 047a9966e0 MFC r248922:
Adds the ability to enable / disable sorting of BIO requests
2013-06-06 10:06:32 +00:00
Steven Hartland 36b5d49ad9 MFC r246146:
Format CDB output as 2 digit hex correcting the length
2013-06-06 10:00:22 +00:00
Steven Hartland 09742db93a MFC r245253:
Use sysctl tuneable values for scsi_da and retry_count
2013-06-06 09:58:23 +00:00
Steven Hartland 6404f7a7b6 MFC r245252:
Always maintain disk d_flags

MFC r249929:
Removed unneeded tests in dadeletemethodset
2013-06-06 09:55:00 +00:00
Steven Hartland b450856707 MFC r245251:
Remove essentially unused variables from scsi_da probe setups
2013-06-06 09:50:42 +00:00
Steven Hartland 2ea5b41659 MFC r230053:
BIO_DELETE for SCSI da devices

MFC r239655:
Fix scsi_da's BIO_DELETE->SCSI_UNMAP translation
2013-06-06 09:45:22 +00:00
Steven Hartland a01200e018 MFC r226737:
Allow upper layers to discover that BIO_DELETE / BIO_FLUSH is not supported.
2013-06-06 09:23:21 +00:00
Steven Hartland 363cb6e428 MFC r221855:
Move the ZERO_REGION_SIZE to a machine-dependent
2013-06-06 09:13:07 +00:00
Steven Hartland 05ebdc805e MFC r221853:
Global zeros region
2013-06-06 08:57:32 +00:00
Steven Hartland a5a96d4467 MFC r221229:
Implement BIO_DELETE for vnode devices
2013-06-06 08:48:02 +00:00
Hiroki Sato e42e98b488 Update errata document for 8.4R:
- dhclient does not work on fxp(4).
 - ZFS pool interoperability issue between 8.4 and 9.[01].
2013-06-06 06:11:43 +00:00
Hiroki Sato 4405854328 Remove obsolete translations. 2013-06-06 05:20:05 +00:00
Hiroki Sato 4fcc00e80c MFC: r250746 and r250805.
Fix build after DocBook 4.5 conversion.
2013-06-06 05:17:51 +00:00
Alexander Motin fc9c7aa3e2 MFC r250286:
Some fixes to snd_envy24ht(4) driver:
 - Allow DMA addresses anywhere in the lower 4GB; Envy24HT has a 32-bit DMA
engine, not 28-bit like Envy24.
 - Mark interrupt handler as MPSAFE, seems to be correctly synchronized.

PR:		kern/152378
Submitted by:	Jason Harmening <[email protected]>
2013-06-05 18:49:28 +00:00
Steven Hartland 921b440d6b MFC r245250:
Allow perl scripts to be used in rc.d scripts
2013-06-05 11:37:00 +00:00
Steven Hartland bdf5c65c51 MFC r219696:
Add ZFS to UFS-like file systems.
2013-06-05 11:28:55 +00:00
Steven Hartland a994641b72 MFC r244194:
Fixe zfs receive errors caused by snapshot replication being processed in
random order.

PR:		kern/172259
2013-06-05 11:23:10 +00:00
Steven Hartland 480b8c3f02 MFC r245479:
Report pools which have a removed l2cache disk under zpool status -x
2013-06-05 11:16:17 +00:00
Steven Hartland 50a488cc3f MFC r250206:
Fix uninitialized warning in mps
2013-06-05 10:53:27 +00:00
Steven Hartland 7534905a1e MFC r248579:
Add missing descriptions for ZFS sysctls
2013-06-05 10:37:27 +00:00
Steven Hartland 0aa5870af4 MFC r247426:
Add hw.mfi.cmd_timeout loader / sysctl tuneable.
2013-06-05 10:19:21 +00:00
Konstantin Belousov 0704e07db8 MFC r251039:
Use slightly more idiomatic expression to get the address of array.
2013-06-03 18:17:47 +00:00
Konstantin Belousov dd7ae374c6 MFC r251038:
Use _MC_IA32_HASFPXSTATE name instead of _MC_HASFPXSTATE.
2013-06-03 18:15:48 +00:00
Konstantin Belousov 873880b6ba MFC r251037:
The ia32_get_mcontext() does not need to set PCB_FULL_IRET.
2013-06-03 18:13:25 +00:00
John Baldwin aa9564f136 MFC 248200: Remove fortunes-o from the base system. 2013-06-03 17:34:48 +00:00
Konstantin Belousov 11de4dd536 MFC r251033:
When handling an exception from the attempt from loading the faulting
context on return from the trap handler, re-enable the interrupts on
i386 and amd64.
2013-06-03 17:13:37 +00:00
John Baldwin d7298675c4 MFC 248167:
Fix the 'C' field for a running thread to match the behavior described
in the manpage by having it display the current CPU (ki_oncpu) rather
than the previously used CPU (ki_lastcpu).  ki_lastcpu is still used for
all other thread states.
2013-06-03 17:07:57 +00:00
Jung-uk Kim ce798250ae MFC: r251186
Fix a long standing logic bug introduced in r167814.  The code was added to
get RSDP from loader(8) hint via kenv(2) but the bug nullified the new code
and we always fell back to the previous method, i. e., sysctlbyname(3).
2013-06-03 16:47:46 +00:00
Jaakko Heinonen a5ecc227e6 MFC r250868: Remove an extra semicolon from the DOT language output.
PR:		kern/178540
2013-06-03 16:10:30 +00:00
Glen Barber fd8602354c Since release/8.4.0 tag is created, make stable/8 -STABLE again.
Approved by:	re (implicit)
2013-06-02 17:03:11 +00:00
Xin LI 815824e203 MFC r250050:
Add missing braces.

Submitted by:	Sascha Wildner <saw online de>
Obtained from:	DragonFly
2013-05-30 21:50:25 +00:00
Xin LI 40f4715c7f MFC: less v458. 2013-05-30 20:42:51 +00:00
John Baldwin 169485a21f MFC 249566-249567:
Document that sem_wait() can fail with EINTR if it is interrupted by a
signal.
2013-05-30 20:11:31 +00:00
John Baldwin 253dc092a9 MFC 246417,247116,248584:
Rework the handling of stop signals in the NFS client.  The changes in
195702, 195703, and 195821 prevented a thread from suspending while holding
locks inside of NFS by forcing the thread to fail sleeps with EINTR or
ERESTART but defer the thread suspension to the user boundary.  However,
this had the effect that stopping a process during an NFS request could
abort the request and trigger EINTR errors that were visible to userland
processes (previously the thread would have suspended and completed the
request once it was resumed).

This change instead effectively masks stop signals while in the NFS client.
It uses the existing TDF_SBDRY flag to effect this since SIGSTOP cannot
be masked directly.  Instead of setting PBDRY on individual sleeps, change
the VFS_*() and VOP_*() methods to defer stop signals for filesystems which
request this behavior via a new VFCF_SBDRY flag.  Note that this has to be
a VFC flag rather than a MNTK flag so that it works properly with
VFS_MOUNT() when the mount is not yet fully constructed.  For now, only the
NFS clients set this new flag in VFS_SET().

A few other related changes:
- Add an assertion to ensure that TDF_SBDRY doesn't leak to userland.
- When a lookup request uses VOP_READLINK() to follow a symlink, mark
  the request as being on behalf of the thread performing the lookup
  (cnp_thread) rather than using a NULL thread pointer.  This causes
  NFS to properly handle signals during this VOP on an interruptible
  mount.
- Ignore thread suspend requests due to SIGSTOP if stop signals are
  currently deferred.  This can occur if a process is stopped via
  SIGSTOP while a thread is running or runnable but before it has set
  TDF_SBDRY.
2013-05-30 19:24:29 +00:00
Mark Johnston 060dd349b2 Revert my previous merge. There's a variable name difference between head
and stable (dirfd vs. dir_fd) and I managed to get it wrong again when I
did the MFC, even after I tested.
2013-05-29 22:29:33 +00:00
Mark Johnston 86b8c89681 MFC r250545:
Some filesystems (NFS in particular) do not fill out the d_type field when
  returning directory entries through readdir(3). In this case we need to
  obtain the file type ourselves; otherwise newsyslog -t will not be able to
  find archived log files and will fail to both delete old log files and to
  do interval-based rotations properly.
2013-05-29 21:08:23 +00:00
Bryan Drewery 58a9574978 MFH r250595:
The HPN patch added a new BUG bit for SSH_BUG_LARGEWINDOW
  and the update to 6.1 added SSH_BUG_DYNAMIC_RPORT with the
  same value.

  Fix the HPN SSH_BUG_LARGEWINDOW bit so it is unique.
2013-05-29 17:31:34 +00:00
Dag-Erling Smørgrav 0c1658820a MF9 (r248915): remove harmless duplicate entry for VersionAddendum. 2013-05-29 16:55:33 +00:00
Alexander Motin e7a9ca4d34 MFC r250508:
Disable sending Early R_OK on SiI3726/SiI3826 port multipliers.
With "cached read" HDD testing and multiple ports busy on a SATA
host controller, 3726/3826 PMP will very rarely drop a deferred
R_OK that was intended for the host. Symptom will be all 5 drives
under test will timeout, get reset, and recover.
2013-05-29 04:18:02 +00:00
Alexander Motin b3aa04b5c9 MFC r250819:
Fix vdc->Secondary_Element_Count metadata field access from 16 to 8 bit.
In some cases it could cause kernel panic during failed drive replacement.
2013-05-29 04:14:41 +00:00
Alexander Motin c12a279a51 MFC r250900:
Fix NULL-dereference kernel panic in case of mps_attach() failure.
2013-05-29 04:10:57 +00:00
John Baldwin 22733f2a72 MFC 247332:
Add a quirk to disable this driver for certain older laptops with an ICH2
southbridge and an Intel 82815_MC host bridge where the host bridge's
revision is less than 5
2013-05-28 18:43:58 +00:00
Kirk McKusick 5f1495681e MFC of 250708:
Clean up trailing whitespace.

Submitted by: Andy Kosela

MFC of 250710: (delete addition of -k which does not exist in 8-stable)

When running the -m option to generate a newfs(8) command suitable for
recreating the filesystem, check for and output the -i, -k, and -l
options if appropriate.

Note the remaining deficiencies of the -m option in the dumpfs(8)
manual page. Specifically that newfs(8) options -E, -R, -S, and -T
options are not handled and that -p is not useful so is omitted.
Also document that newfs(8) options -n and -r are neither checked
for nor output but should be. The -r flag is needed if the filesystem
uses gjournal(8).

PR:           bin/163992
Reported by:  Dieter <[email protected]>
Submitted by: Andy Kosela <[email protected]>
2013-05-27 22:41:43 +00:00
Dmitry Morozovsky 61a35642cf Preparation for MFC revs r248291 and r249741:
Add 'list' command, for now the exact equivalent of 'status',
so users of the latter could change their scripts.

This is direct commit to stable, and is temporary.

Requested by:	Pete French <[email protected]>
Approved by:	trociny
2B cleaned after:	6 weeks
2013-05-27 13:51:57 +00:00
Mikolaj Golub 8403be1998 MFC r250405:
Move snmp_hast manual to section 3, where all other manual pages for
bsnmp modules are located.

Section 3 (Library Functions) looks wrong for this manual page, which
contains only module description, that is why initially it was located
to section 8 (System Manager's Manual).  On the other hand manual
pages for all other bsnmpd modules are already located in the section
3, and having all pages in one section looks more consistent.  Also,
currently, similarly to manuals for other modules, snmp_hast manual
contains LIBRARY section, which is not good style for section 8.
2013-05-26 18:54:50 +00:00
Mikolaj Golub 33fd843eb4 MFC r250380:
Register OID for HAST module.
2013-05-26 18:39:33 +00:00
Mikolaj Golub 7b57910a55 MFC r250379, r250503:
HAST module for bsnmpd(1).

Reviewed by:	harti, pjd
2013-05-26 18:37:20 +00:00
Mikolaj Golub 7c2a1a191f MFC r250503:
Get rid of libl dependency.  We needed it only to provide yywrap.  But
yywrap is not necessary when parsing a single hast.conf file.

Suggested by:	kib
Reviewed by:	pjd
2013-05-26 18:30:07 +00:00
Dag-Erling Smørgrav d16c5fe8be MFH (r230478): fix a couple of nits in r230307 (r231248)
MFH (r243149): fix indentation
MFH (r249431): use CONNECT to proxy HTTPS over HTTP

PR:		bin/80176
2013-05-26 17:00:15 +00:00
Hans Petter Selasky a46bf2adf5 MFC r250763 and r250765:
Fix some USB audio device issues.

PR:	usb/178722
2013-05-25 17:19:06 +00:00
Konstantin Belousov 528787fc94 MFC r250741:
Decode new HT 3.00 and 3.10 capabilities.
2013-05-24 18:28:27 +00:00
Konstantin Belousov 9962ef3ab7 MFC r250740:
Add new capability types encodings from HyperTransport I/O Link
Specification revisions 3.00 and 3.10.
2013-05-24 18:26:12 +00:00
John Baldwin c680eae93f MFC 238450,250152-250153,250415:
- Add support for the XSAVEOPT instruction use.
- The check to ensure that xstate_bv always has XFEATURE_ENABLED_X87 and
  XFEATURE_ENABLED_SSE bits set is not needed.  CPU correctly handles
  any bitmask which is subset of the enabled bits in %XCR0.
- Partially saved extended state must be handled always, i.e. for both
  fpu-owned context, and for pcb-saved one.
- Correct the type for the literal used on the left side of the shift up
  to 63 bit positions.

  Do not fill the save area and do not set the saved bit in the xstate
  bit vector for the state which is not marked as enabled in xsave_mask.
2013-05-21 19:25:19 +00:00
Hans Petter Selasky 1217e7e72f MFC r248458:
Add new USB ID.

PR:	usb/177013
2013-05-21 06:09:19 +00:00
Hans Petter Selasky 1779160017 MFC r248499:
Add new USB ID.

PR:		usb/177105
2013-05-21 06:06:16 +00:00
Hans Petter Selasky 39b67b6527 Add new USB ID.
PR:		usb/177173
2013-05-21 06:03:32 +00:00
Hiren Panchasara f99cd96f8a MFC: r250487
Adding a detach method to p4tcc driver.

PR:		118739
Submitted by:	Dan Lukes <[email protected]> (earlier version)
Reviewed by:	jhb
Approved by:	sbruno (mentor)
2013-05-17 17:16:29 +00:00
Eitan Adler a44cdd9c09 MFC r250509:
The M_VESA_MODE_MAX is latest valid mode - not the first invalid.
	Permit its use in vidcontrol -i

PR:		bin/119483
2013-05-17 00:40:48 +00:00
Eitan Adler 6230c6cb77 MFC r250459:
Add the letter 'q' to the font iso05-8x16.fnt

PR:	72585
PR:	169797
2013-05-16 20:32:28 +00:00
Eitan Adler c5275964c0 MFC r250553:
Add the letter 'x' to the font iso05-8x16.fnt

PR:	169797
2013-05-16 20:27:30 +00:00
Konstantin Belousov 1c494bcb19 MFC r250193:
Do a sync of the devvp vnode for the mount, which buffers, among other
things, contain FAT blocks.  This makes fsync(2) for msdosfs more correct
by syncing the metadata needed to read the synced data.
2013-05-16 10:32:01 +00:00
Sergey Kandaurov d869b591d7 MFC r250088:
Pass a format string to kproc_create() [1] and thus fix the build with
  -DBKTR_NEW_MSP34XX_DRIVER and -Wformat-security.

PR:		kern/175546
2013-05-15 21:37:08 +00:00
Sergey Kandaurov 0b913e0212 MFC r248250-248251:
- Add the getcontextx prototype to SYNOPSIS.
- Link getcontextx(3) to getcontext(3).
2013-05-15 21:19:05 +00:00
Sergey Kandaurov 236675037d MFC r246711:
o Bring in sync decoding the first nfssvc(2) parameter (flags) with
the current definitions location.
o Respect numbers in NFSSVC_* (e.g. NFSSVC_V4ROOTEXPORT).
2013-05-15 21:05:25 +00:00
Dimitry Andric 9bef26520f MFC r250393:
When gcc 4.2.0 was imported, the 3DNow intrinsics header <mm3dnow.h> was
not added to the list of intrinsics headers to install, so belatedly (5
years :) add it.
2013-05-15 20:59:00 +00:00
Sergey Kandaurov 9b212547b5 MFC r242995: firmware(9) mdoc cleanup.
- Lowercase a cross reference to make.
  - Sort SEE ALSO cross references.
2013-05-15 19:52:37 +00:00
Sergey Kandaurov dfe6b50044 MFC r242992: Avoid an ambiguous reference to mtx_lock(9). 2013-05-15 19:38:49 +00:00
Pyun YongHyeon d01c2fd649 MFC r248993:
Fix a typo.
2013-05-15 01:22:55 +00:00
Pyun YongHyeon 58e68f35d1 MFC r248542:
For RTL8211B or later PHYs, enable crossover detection and
  auto-correction. This change makes re(4) establish a link with
  a system using non-crossover UTP cable.
2013-05-15 01:17:59 +00:00
Pyun YongHyeon a3f4267682 MFC r248456:
r119712 introduced SIS_TYPE_83816 but it was not actually set in
  driver such that checking against the type was always false.
  To detect NS DP83816, driver should have checked silicon revision
  register for NS controllers. While here, remove SIS_TYPE_83816 to
  not make the similar mistake again.
2013-05-15 01:06:24 +00:00
Pyun YongHyeon 4ee482bb23 MFC r248227:
Disable TX IP header checksum offloading on RL_HWREV_8168CP. The
  controller generates wrong checksummed frame if the IP packet has
  IP options.
2013-05-15 01:00:40 +00:00
Jaakko Heinonen 1ffba2972f MFC r249200: Correct the path.
PR:		176256
2013-05-13 14:00:24 +00:00
Eitan Adler 5ddf488f05 MFC r249949:
Take some improvements from DragonFlyBSD:
		- add const where appropriate
		- add static where appropriate
		- fix a whitespace issues
2013-05-13 01:28:09 +00:00
Eitan Adler 38cec8a4fe MFC r250463:
Permit relative paths with mergemaster -m

PR:	bin/173929
2013-05-13 01:20:36 +00:00
Hans Petter Selasky 78f32a3ab3 MFC r249796, r249830, r249844 and r249845:
USB audio fixes and improvements.
- Fix runtime switching of sample rate
- Fix feedback endpoint algorithm
2013-05-12 12:30:42 +00:00
Hans Petter Selasky dc413d61e5 MFC r249795:
Add convenience wrapper functions to run callbacks in the context of the
USB explore thread.
2013-05-12 12:24:29 +00:00
Eitan Adler 789997d2bf MFC r250012:
Add an alternate version of beastie to the examples directory.

PR:		docs/38556
2013-05-12 01:38:01 +00:00
Dimitry Andric e4c5757bcf MFC r250392:
For some reason, the gcc intrinsics header tmmintrin.h was imported with
two copies of itself pasted together.  Remove the extraneous copy.
2013-05-11 16:44:36 +00:00
Alexander Motin 6e1c9517e3 MFC r249352:
Do not sent 120 TEST UNIT READY requests on generic NOT READY statuses.

Some failing disks tend to return vendor-specific ASC/ASCQ codes with
NOT READY sense key.  It caused extremely long recovery attempts, repeating
these 120 TURs (it takes at least 1 minute) for every I/O request.
Instead of that use default error handling, doing just few retries.
2013-05-11 08:15:56 +00:00
Alexander Motin dc7892ff7b MFC r250185:
Add IDs for HighPoint RocketRAID 640L/642L/644L -- new series of 4-port
6Gbps PCIe 2.0 x2 SATA controllers, based on Marvell 88SE9235 chips.
2013-05-11 08:11:55 +00:00
Steven Hartland d5c6b11de9 MFC r244123 Add CTLFLAG_RWTUN define
MFC r247367 Fix non-recusive mutex MFI I/O lock
MFC r247369 Fix a large amount of bugs in MFI that cause panics

Approved by:	pjd (mentor)
2013-05-11 02:48:40 +00:00
Mark Johnston 433f7efd41 Fix the build: 'valid' is no longer used. 2013-05-11 00:05:05 +00:00
Mark Johnston fa1debaa00 MFC r249257:
Add support for getting and setting BBU properties related to battery
  relearning. Specifically, add subcommands to mfiutil(8) which allow the
  user to set the BBU and autolearn modes when the firmware supports it,
  and add a subcommand which kicks off a battery relearn.

MFC r249258:
  Switch to a 2-clause license.
2013-05-10 21:11:18 +00:00
Mark Johnston 67c619975f MFC r248851:
Ignore interface renames instead of removing the interface from the bridge
  group.

Approved by:	emaste
2013-05-10 20:57:22 +00:00
Mark Johnston 80e19f875d MFC r248776:
Fix interval-based rotations when the -t flag is used. In this case, find
  the most-recently archived logfile and use its mtime to determine whether
  or not to rotate, as in the non-timestamped case.

  Previously we would just try to use the mtime of <logfile>.0, which always
  results in a rotation since it generally doesn't exist in the -t case.

Approved by:	emaste
2013-05-10 20:56:07 +00:00
Sean Bruno d798a53bd9 MFC r249815
Return a lun count of 1 and a lun id of 0 when CAM attempts a REPORT_LUNS
command on a disk device.  This quieseces some noise on the console that
recently appeared.
2013-05-08 15:48:36 +00:00
Konstantin Belousov a94992ba37 MFC r249811:
Literally follow POSIX:
If the bs= expr operand is specified and no conversions other than sync,
noerror, or notrunc are requested, the data returned from each input
block shall be written as a separate output block.

PR:	standards/177742
2013-05-07 09:48:42 +00:00
Jung-uk Kim 536bb5194b MFC: r210877 (partial)
Decrease emulated stack size from 64K to 4K bytes.
2013-05-06 21:13:22 +00:00
Dimitry Andric f641d8cc3e MFC r215137:
Revert r103230, which depended on ld preserving the __start_xxx and
  __stop_xxx symbols for custom sections, even when these were not
  referenced (at link time).  This behaviour was changed again in binutils
  commit 0b8ed435c3fe8bd09a08c23920e65bfb03251221.

  This time, put the __GLOBL macro definition in cdefs.h, so it can be
  reused in a few other places where it will be needed.

  Reviewed by:	kib

MFC r215138:

  Use the same treatment as in linker_set.h for the __start and __stop
  symbols of the set_vnet and set_pcpu sections, so those symbols will
  always be emitted in kernel modules, if they use vnet.h or pcpu.h.

  Also, for pcpu.h, make the __(start|stop)_set_pcpu declarations, and
  associated macros invisible to userland, to prevent it picking up these
  symbols.

  Reviewed by:	kib
2013-05-06 19:59:13 +00:00
Matthew D Fleming acda86cb37 MFC r248933:
Use a shared lock for VOP_GETEXTATTR, as it is a read-like operation.
2013-05-04 18:49:04 +00:00
Bryan Drewery 4afe743878 MFC r249489,249555
Run configtest before restarting so that the system is not
  left without a running sshd.

  Also call configtest before reload to ensure working config.
2013-05-02 21:51:57 +00:00
Konstantin Belousov ca0a8ffc0e MFC r250075:
Properly terminate the result string for intermediate results.
2013-05-02 04:23:57 +00:00
Dimitry Andric e6ac153028 MFC r249846:
When rebooting (exiting) from the BTX loader, make sure to restore the
GDT from the correct segment, otherwise a triple fault would be caused.
In some virtual environments (VMware, VirtualBox, etc) this could lead
to a unhandled error or hang in the guest emulation software.

Thanks to avg and jhb for a few hints in the right direction.

Noticed by:	Jeremy Chadwick <[email protected]> (and many others)
2013-05-01 18:06:53 +00:00
Lawrence Stewart 427ebc6eb9 MFC r245783:
Simplify and fix a bug in cc_ack_received()'s "are we congestion window limited"
logic (refer to [1] for associated discussion). snd_cwnd and snd_wnd are
unsigned long and on 64 bit hosts, min() will truncate them to 32 bits and could
therefore potentially corrupt the result (although under normal operation,
neither variable should legitmately exceed 32 bits).

[1] http://lists.freebsd.org/pipermail/freebsd-net/2013-January/034297.html

Submitted by:	jhb
2013-05-01 08:57:45 +00:00
Eitan Adler 9a2f9f64c7 MFC r249996:
Add missing static qualifiers
2013-04-30 00:49:30 +00:00
Sergey Kandaurov 79e1a669f4 MFC r243314:
Zero the whole struct not just the size of a pointer.

MFC r246670:
 Major update for unix_cmsg.

PR:		bin/131567
Submitted by:	Andrey Simonenko <[email protected]>
2013-04-29 21:33:36 +00:00
Sergey Kandaurov 6d0a588192 MFC r246826:
Add support of passing SCM_BINTIME ancillary data object for PF_LOCAL
 sockets.

PR:		kern/175883
Submitted by:	Andrey Simonenko <[email protected]>
2013-04-29 21:12:18 +00:00
Dag-Erling Smørgrav 1979d17c59 Fix a bug that allows NFS clients to issue READDIR on files.
(files missing from previous commit)

PR:		kern/178016
Security:	CVE-2013-3266
Security:	FreeBSD-SA-13:05.nfsserver
Approved by:	so
2013-04-29 21:10:49 +00:00
Jung-uk Kim 8ee07b0167 MFC: r248777
Loosen restrictions for quoted strings.  Now we can use more complex strings
and "escaped" quote characters.
2013-04-29 21:05:12 +00:00
Sergey Kandaurov 633b457bcb MFC r248253:
Add missed `_load' to the `if_foo_load="YES"' line.

PR:		docs/176915
Submitted by:	Dmitry Afanasiev <[email protected]>
2013-04-29 20:31:25 +00:00
Dag-Erling Smørgrav 20bf0a58d8 Fix a bug that allows NFS clients to issue READDIR on files.
PR:		kern/178016
Security:	CVE-2013-3266
Security:	FreeBSD-SA-13:05.nfsserver
Approved by:	so
2013-04-29 20:15:43 +00:00
Konstantin Belousov 0bc25574e9 MFC r249525:
Rewrite origin_subst_one() to get rid of the wrong limit on the length
of the resulting string.
2013-04-29 17:29:48 +00:00
Sergey Kandaurov 6fc4aa6fc3 Fix build.
- pass a format string to printf
- catch up with constifying uz_name
2013-04-29 11:36:22 +00:00
Jilles Tjoelker 4850c6837c MFC r249471: libc: Fix typo in French translation.
PR:		kern/177704
Submitted by:	martymac
2013-04-26 16:11:07 +00:00
Glen Barber f3a5e4edc1 MFC remainder of r249802 (eadler) to fix build:
- sl_find does not modify 'name'
- make the prototype of sl_find match NetBSD
2013-04-26 11:58:46 +00:00
Eitan Adler 4dd07f1c7e MFC r249802:
- sl_find does not modify 'name'
	- make the prototype of sl_find match NetBSD
2013-04-26 00:47:28 +00:00
Eitan Adler 669c350b0f MFC r249801:
Switch from K&R prototypes to modern C
2013-04-26 00:45:03 +00:00
Sean Bruno f0904b0b7d MFC r249349
Repair camcontrol output and use CAM defined values for string sizes
2013-04-25 17:04:48 +00:00
Randall Stewart 10ae21a16a MFC of PR r249848.
PR:		174749, 157796
2013-04-25 11:24:40 +00:00
Gregory Neil Shapiro 758deda544 Record sendmail 8.14.7 upgrade 2013-04-25 02:25:42 +00:00
Glen Barber c71299ce4b Update perl version to that included on install medium.
This is a direct commit to stable/8 with no intent to MFC/MFS.
2013-04-25 02:18:57 +00:00
Gregory Neil Shapiro 8c8d49d68d MFC: Minor changes to force commit these files so new freebsd*.cf files are
built to use the new sendmail-8.14.7/cf tree.
2013-04-25 02:16:29 +00:00
Gregory Neil Shapiro 75e6229993 MFC: Update for sendmail 8.14.7 2013-04-25 02:15:34 +00:00
Gregory Neil Shapiro ddc23a98b6 MFC: Merge sendmail 8.14.7 2013-04-25 02:14:36 +00:00
Eitan Adler c4c112e0c1 MFC r227101:
Add static keywords to variables and functions where possible in games/.

	This allows us to detect unused functions and variables and allows the
	compiler to do a better job at optimisation.
2013-04-24 12:47:41 +00:00
Sergey Kandaurov 65606d66a0 MFC r249281: Add FreeBSD 8.4. 2013-04-24 10:20:21 +00:00
Eitan Adler 50fa4ffe2a Merge unmerged commits to fortune(1) 2013-04-24 04:21:23 +00:00
Andrey V. Elsukov 5e14a05c4e MFC r249398:
Free memory after deleting an address policy entry.
2013-04-22 06:47:27 +00:00
Edwin Groothuis dcd899f6a1 Merge of current from 249692, tzdata2013c:
- antarctica: AusAQ and ATAQ have been removed.
- Antarctica/Macquarie has been moved to australasia file and AU.
- Asia/Hebron, Palestine updated for 2013.
- Paraguay stays with DST for the whole year.
2013-04-20 11:46:01 +00:00
Sean Bruno 43facc03ed MFC r249170
Notify CAM on state* change to a logical volume not status.  This resolves
the issues reported regarding camcontrol devlist not showing the rebuild
states of volumes unless an explicit camcontrol rescan was executed.
2013-04-19 18:37:49 +00:00
Martin Matuska f8afebd48f MFC r248493:
Plug memory leak in dsl_check_snap_cb()
This was unnoticed because the function is very rarely used.
2013-04-19 10:48:38 +00:00
Martin Matuska 7537a043c5 MFC r240870 (pjd):
It is possible to recursively destroy snapshots even if the snapshot
doesn't exist on a dataset we are starting from. For example if we
have the following configuration:

	tank
	tank/foo
	tank/foo@snap
	tank/bar
	tank/bar@snap

We can execute:

	# zfs destroy -t tank@snap

eventhough tank@snap doesn't exit.

Unfortunately it is not possible to do the same with recursive rename:

	# zfs rename -r tank@snap tank@pans
	cannot open 'tank@snap': dataset does not exist

...until now. This change allows to recursively rename snapshots even if
snapshot doesn't exist on the starting dataset.

Sponsored by:	rsync.net
2013-04-19 10:35:45 +00:00
Kirk McKusick e0192f061f MFC of 249064:
The code in clear_remove() and clear_inodedeps() skips one entry
in the pagedep and inodedep hash tables. An entry in the table is
skipped because 'pagedep_hash' and 'inodedep_hash' hold the size
of the hash tables - 1.

The chance that this would have any operational failure is extremely
unlikely. These funtions only need to find a single entry and are
only called when there are too many entries. The chance that they
would fail because all the entries are on the single skipped hash
chain are remote.

Submitted by: Pedro Martelletto
Reviewed by:  kib
2013-04-18 00:14:51 +00:00
Alexey Dokuchaev ca7b3c85f9 MFC r247910:
Plug a memory leak.

  Reviewed by:	mav
  Sponsored by:	Nginx, Inc.

Approved by:	glebius
2013-04-17 05:56:59 +00:00
Dimitry Andric 7cbfb52385 MFC r249449:
Fix undefined behaviour in several gpio_pin_setflags() routines (under
sys/arm and sys/mips), squelching the clang 3.3 warnings about this.

Noticed by:	tinderbox and many irate spectators
Submitted by:	Luiz Otavio O Souza <[email protected]>
PR:		kern/177759
2013-04-16 17:50:20 +00:00
Dimitry Andric 617750c429 MFC r249316:
Ensure make -j N universe works correctly, by checking for an up-to-date
make before starting the universe targets themselves.  Otherwise, all of
the targets would attempt to build make simultaneously, overwriting each
other's copies of the make object files and executable.  This could lead
to strange errors, for example when partially-written make executables
are invoked.

Also amend r216620, to make the rest of universe wait properly until the
upgrade_checks target is finished, by adding universe_${target}_prologue
to the .ORDER target.  Otherwise, make will be too smart for its own
good, and start building the universe targets simultaneously with the
prologues anyway.
2013-04-16 06:52:32 +00:00
Konstantin Belousov 07108caf0c MFC r249439:
Fix the name of the pcb member in the comments.
2013-04-16 06:21:57 +00:00
Xin LI f8146aca92 MFC r249397:
Fix a few typos.

Reviewed by:	gjb
2013-04-15 05:01:12 +00:00
Robert Watson 0f5f6f458c FreeBSD 8.0 introduced inpcb reference counting, and FreeBSD 8.1 began using
that reference count to protect inpcb stability in udp_pcblist() and other
monitoring functions, preventing the inpcb from being garbage collected
across potentially sleeping copyout() operations despite the inpcb zone
becoming shrinkable.

However, this introduced a race condition in which inp->inp_socket() might
become NULL as a result of the socket being freed, but before the inpcb we
removed from the global list of connections, allowing it to be exposed to a
third thread invoking udp_input() or udp6_input() which would try to
indirect through inp_socket without testing it for NULL.  This might occur
with particular regularity on systems that frequently run netstat, or which
use SNMP for connection monitoring.

Later FreeBSD releases use a different reference/destruction model, but
stable/8 remained affected in FreeBSD 8.2 and 8.3; the problem could be
spotted on very high-load UDP services, such as top-level name servers.

An Errata Note for 8.x branches under continuing support might be
appropriate.  Regardless, this fix should be merged to releng/8.4 prior to
8.4-RELEASE.

PR:		172963
Submitted by:	Vincent Miller <[email protected]>
Submitted by:	Julien Charbon <[email protected]>
Submitted by:	Marc De La Gueronniere <[email protected]>
2013-04-14 16:25:37 +00:00
Dag-Erling Smørgrav 90df0cb952 MFH (r247285): always bootstrap liby along with yacc. 2013-04-14 11:51:25 +00:00
Eitan Adler 480697bb2d MFC r219937, r220094, r221383, r222307, r222817, r222994, r223545, r223638, r225846, r225853, r225854, r226121, r226320, r226351, r228991, r229164, r230876, r231274, r231516, r232105, r232353, r234221, r234320, r234446, r234600, r236392, r236733, r238058, r238976, r239498, r240362, r240548, r242549, r242849, r242900, r245447, r247752, r249113
Merge all outstanding calendar commits.

Discussed with:	gjb, des
2013-04-13 22:30:02 +00:00
Steven Hartland 394ec9fa29 MFC r243520, r243521: zfs: overhaul zfs-vfs glue for vnode life-cycle management
Reviewed by:	avg
Approved by:	avg (co-mentor)
2013-04-12 19:36:53 +00:00
Steven Hartland 6195e3c1c2 MFC r241628: zfs: make use of getnewvnode_reserve in zfs_mknode and zfs_zget
Reviewed by:	avg
Approved by:	avg (co-mentor)
2013-04-12 14:23:21 +00:00
Bjoern A. Zeeb 075486e620 MFC r245525:
Add a conditional sleep 1 in case we add any IPv6 addresses to interfaces.
  Do this per jail started, not per address.  This will allow DAD to complete
  and services to properly start.   Before we have seen problems with services
  trying to start before the IPv6 address was available to use and thus
  erroring and failing to start.
2013-04-11 22:08:59 +00:00
Alexander Motin af81c710d3 MFC r248800:
On SIM destruction free associated CCBs, preallocated inside xpt_get_ccb().
Before this change they were just leaked.  Fortunately USB sticks now use
only one CCB, and so leak was only 2KB per detach, while other bigger SIMs
with much more allocated CCBs are rarely detached.
2013-04-10 17:51:15 +00:00
Steven Hartland e45b6f144c MFC r241556:
Add a KPI to allow to reserve some amount of space in the numvnodes
counter, without actually allocating the vnodes.

For KBI stability, the td_vp_reserv was moved to the end of struct thread.

Reviewed by:	avg
Approved by:	avg (co-mentor)
2013-04-09 15:35:26 +00:00
Xin LI d912288cd5 MFC r248627:
Don't attempt to reference sc before testing whether it's NULL.

Submitted by:	Sascha Wildner
Obtained from:	DragonFly
2013-04-08 23:06:25 +00:00
Xin LI 8e57e6d5d1 MFC r247596:
Fix assignment of maximum bounadary.

Submitted by:	Sascha Wildner <saw online de>
Obtained from:	DragonFly rev fd39c81ba220f7ad6e4dc9b30d45e828cf58a1ad
2013-04-08 23:01:33 +00:00
Xin LI 46dde8787b MFC r247595:
Fix wrong assignment.

Submitted by:	Sascha Wildner <saw online de>
Obtained from:	DragonFly rev 9568dd07a22a136e380e6c19a8ea188eb92976d5
2013-04-08 22:56:40 +00:00
Jung-uk Kim 530319fe2b MFC: r247859
Update the manual page to reflect reality.  With r138509 and r152355,
"nostrictjoliet" option for mount_cd9660(8) was completely replaced with
"brokenjoliet" somehow.
2013-04-08 22:32:37 +00:00
Jung-uk Kim 80dfdeb073 MFC: r248799
Limit the amount of video memory we map for the driver to the maximum value.
2013-04-08 20:45:11 +00:00
Mikolaj Golub 4e52a4c2a3 MFC r248707:
hrStorageSize and hrStorageUsed are 32 bit integers, reporting a fs
size and usage in hrStorageAllocationUnits. If the file system has
more than 2^31 allocations it can not be shown correctly and the
meters are useless.

In such cases follow net-snmp behaviour and increase
hrStorageAllocationUnits so the values fit under INT_MAX.

PR:		bin/177183
Submitted by:	Eugene Grosbein egrosbein rdtc.ru
2013-04-08 19:50:15 +00:00
Konstantin Belousov ff674014cf MFC r248969:
Do not call the VOP_LOOKUP() for the doomed directory vnode.
2013-04-08 08:33:31 +00:00
Mikolaj Golub a77314f44f MFC r246922 (pjd):
- Add support for 'memsync' mode. This is the fastest replication mode that's
  why it will now be the default.
- Bump protocol version to 2 and add backward compatibility for version 1.
- Allow to specify hosts by kern.hostid as well (in addition to hostname and
  kern.hostuuid) in configuration file.

Sponsored by:	Panzura
2013-04-07 17:06:26 +00:00
Xin LI ab623a2202 Further improve previous revision:
- enable_all_pool_feat will be unset if version is specified.  Use it as
   a flag instead of testing the props nvlist;
 - Allow user to use -d -o feature@...=enable to create a v5000 pool when
   desired.  Without this, the implicit -o version=28 would make the utility
   to complain about feature@ and version being conflict, which is confusing.

Reviewed by:	Matthew Ahrens
2013-04-04 23:14:14 +00:00
Raphael Kubo da Costa b5da54505d MFC r244704, r244714 and r244715:
Add vendor IDs for Broadcom USB dongles (BCM20702).

PR:		kern/174707
Approved by:	glebius
2013-04-04 19:31:19 +00:00
Xin LI 4e6ab656da Per Matthew Ahrens, version 5000 should not be exposed to user and there is
a problem with my first revision, namely, specifying -d -o feature@...=enable
will still bail out with:

    'feature@' and 'version' properties cannot be specified together.

Because zpool create -o version=5000 will not likely be supported by other
ZFS implementations (including ours on -CURRENT and 9-STABLE), remove the
hack that make that work.  Users who want feature flags support can still
do an explicit 'zpool upgrade' after creating a pool.
2013-04-04 17:10:36 +00:00
Konstantin Belousov 19e4739001 MFC r248968:
Record the correct error in the trace.
2013-04-04 05:16:14 +00:00
Xin LI 88dbcba2a7 The current ZFS version in 8-STABLE supports feature flags, which
enables many new features but makes it impossible to import pools
created on earlier released FreeBSD 9.x releases, including 9.0
and 9.1-RELEASE, where the feature flags are not yet supported
because they predates the merge (r243674), and 9.2-RELEASE will
not be released before 8.4-RELEASE.

To avoid surprises when users "upgrade" to 9.1-RELEASE, limit the
creation version to 28 by default on stable/8.  The user will still
be able to upgrade the pool by using "zpool upgrade" or at create
time by explicitly specifying "zpool create -o version=5000".

This is a direct commit to stable/8 because it's not applicable to
-HEAD, and can be reverted once 9.2-RELEASE is released.

Requested by:	re (jpaetzel, hrs)
Reviewed by:	mm
2013-04-03 21:15:21 +00:00
Dimitry Andric 961502b740 MFC r248802:
Similar to r239870 and r239872, teach the other binutils tools about the
DW_FORM_flag_present dwarf attribute, so they do not print errors or
warnings on files that contain it.  (This attribute can be emitted by
newer versions of clang and gcc.)
2013-04-03 16:26:58 +00:00
Konstantin Belousov 4221b5e402 MFC r248563:
Increment the write ref counter for the buffer object before calling
bundirty().
2013-04-03 16:02:01 +00:00
Konstantin Belousov 2632cb0faf MFC r248562:
Move the vn_start_write() call in the dounmount() before setting the
MNTK_UNMOUNT flag.
2013-04-03 15:57:18 +00:00
Devin Teske 3443d2809d Oops, r240972 (Add DEBUG kernel distribution) forgot to make said distribution
optional (such as the long-standing "local" distribution; also optional). This
fixes a regression in the install process when the user selects "All" as the
distribution-set.

This is a direct commit to stable/8.

PR:		bin/177309
Reviewed by:	eadler
2013-04-02 14:10:22 +00:00
Andriy Gapon 0518beb88a fix r248946: there is no pmap_page_is_write_mapped in stable/8
This is a direct commit.

Pointyhat to:	avg
2013-03-31 20:40:06 +00:00
Martin Matuska d532555c9f MFC r242845 (delphij):
Illumos r13840:97fd5cdf328a:
    3145 single-copy arc
    3212 ztest: race condition between vdev_online() and spa_vdev_remove()

  Illumos r13849:3468a95b27cd:
    3258 ztest's use of file descriptors is unstable
2013-03-31 19:03:25 +00:00
Martin Matuska ad713a09d6 MFC r247592 (delphij):
Import a fix tighten assertion on SPA versions from vendor (Illumos).

  Illumos ZFS issue:
    3543 Feature flags causes assertion in spa.c to miss certain cases
2013-03-31 18:56:00 +00:00
Martin Matuska 3ffce25816 MFC r248267:
Import minor ZFS changes from vendor

  Illumos ZFS issues:
  3604 zdb should print bpobjs more verbosely (fix zdb hang)
  3606 zpool status -x shouldn't warn about old on-disk format
2013-03-31 18:39:11 +00:00
Martin Matuska 19afda50e2 MFC r247852:
Import ZFS bpobj bugfix from vendor.

  Illumos ZFS issues:
  3603 panic from bpobj_enqueue_subobj()
  3604 zdb should print bpobjs more verbosely
2013-03-31 18:31:58 +00:00
Andriy Gapon fa054782cd MFC r248642: fbt_getargdesc: correctly handle types for return probes 2013-03-31 14:10:49 +00:00
Andriy Gapon 4baeb95729 MFC r248640: fbt_typoff_init: fix an off by one in determining required
memory size
2013-03-31 14:02:43 +00:00
Andriy Gapon 8d7f601c1f MFC r246293: zfs: fix, improve and re-organize page_lookup and page_unlock
Please note that because of the significant VM API differences between HEAD
and stable/8 this commit has some additional changes.
2013-03-31 13:56:13 +00:00
Alexander V. Chernikov 23d2ab3978 MFC r247842.
Write lock is not required for find&compare operation.
2013-03-31 10:20:29 +00:00
Alexander V. Chernikov ce539379ad Merge r248070.
Fix long-standing issue with interface routes being unprotected:
Use RTM_PINNED flag to mark route as immutable.
Forbid deleting immutable routes without special rtrequest1_fib() flag.
Adding interface address with prefix already in route table is handled
by atomically deleting old prefix and adding interface one.
2013-03-31 10:17:39 +00:00
Kirk McKusick 6dde5781b2 MFC of 246876, 246877, and 247387:
MFC reviewed by: kib

MFC 246876:

Add barrier write capability to the VFS buffer interface. A barrier
write is a disk write request that tells the disk that the buffer
being written must be committed to the media along with any writes
that preceeded it before any future blocks may be written to the drive.

Barrier writes are provided by adding the functions bbarrierwrite
(bwrite with barrier) and babarrierwrite (bawrite with barrier).

Following a bbarrierwrite the client knows that the requested buffer
is on the media. It does not ensure that buffers written before that
buffer are on the media. It only ensure that buffers written before
that buffer will get to the media before any buffers written after
that buffer. A flush command must be sent to the disk to ensure that
all earlier written buffers are on the media.

Reviewed by: kib
Tested by:   Peter Holm

MFC 246877:

The UFS2 filesystem allocates new blocks of inodes as they are needed.
When a cylinder group runs short of inodes, a new block for inodes is
allocated, zero'ed, and written to the disk. The zero'ed inodes must
be on the disk before the cylinder group can be updated to claim them.
If the cylinder group claiming the new inodes were written before the
zero'ed block of inodes, the system could crash with the filesystem in
an unrecoverable state.

Rather than adding a soft updates dependency to ensure that the new
inode block is written before it is claimed by the cylinder group
map, we just do a barrier write of the zero'ed inode block to ensure
that it will get written before the updated cylinder group map can
be written. This change should only slow down bulk loading of newly
created filesystems since that is the primary time that new inode
blocks need to be created.

Reported by: Robert Watson
Reviewed by: kib
Tested by:   Peter Holm

MFC 247387:

An inode block must not be blockingly read while cg block is owned.
The order is inode buffer lock -> snaplk -> cg buffer lock, reversing
the order causes deadlocks.

Inode block must not be written while cg block buffer is owned. The
FFS copy on write needs to allocate a block to copy the content of the
inode block, and the cylinder group selected for the allocation might
be the same as the owned cg block.  The reserved block detection code
in the ffs_copyonwrite() and ffs_bp_snapblk() is unable to detect the
situation, because the locked cg buffer is not exposed to it.

In order to maintain the dependency between initialized inode block
and the cg_initediblk pointer, look up the inode buffer in
non-blocking mode. If succeeded, brelse cg block, initialize the inode
block and write it.  After the write is finished, reread cg block and
update the cg_initediblk.

If inode block is already locked by another thread, let the another
thread initialize it.  If another thread raced with us after we
started writing inode block, the situation is detected by an update of
cg_initediblk.  Note that double-initialization of the inode block is
harmless, the block cannot be used until cg_initediblk is incremented.

Sponsored by:   The FreeBSD Foundation
In collaboration with:  pho
Reviewed by:    mckusick
X-MFC-note:     after r246877
2013-03-30 20:57:35 +00:00
Kirk McKusick 3e7bab2114 MFC of 246812 and 246823:
MFC 246812:

Update fsck_ffs buffer cache manager to use TAILQ macros.
No functional changes.

MFC 246823:

Remove write only assignments and thus fix the build after struct bufarea
TAILQ conversion (r246812).
2013-03-30 00:33:46 +00:00
Kirk McKusick d98be73fdf MFC of 246289:
For UFS2 i_blocks is unsigned. The current "sanity" check that it
has gone below zero after the blocks in its inode are freed is a
no-op which the compiler fails to warn about because of the use of
the DIP macro. Change the sanity check to compare the number of
blocks being freed against the value i_blocks. If the number of
blocks being freed exceeds i_blocks, just set i_blocks to zero.

Reported by: Pedro Giffuni (pfg@)
2013-03-30 00:22:26 +00:00
Glen Barber 11cd7954e5 MFC r248857:
- Update hardware notes to reflect that amd64 is no longer "young"
 - Bump copyright year
2013-03-29 14:18:56 +00:00
Tijl Coosemans 965ab04e0c MFC r248256:
- Fix two possible overflows when testing if ELF program headers are on
  the first page:
  1. Cast uint16_t operands in a multiplication to unsigned int because
     otherwise the implicit promotion to int results in a signed
     multiplication that can overflow and the behaviour on integer
     overflow is undefined.
  2. Replace (offset + size > PAGE_SIZE) with (size > PAGE_SIZE - offset)
     because the sum may overflow.
- Use the same tests to see if the path to the interpreter is on the first
  page. There's no overflow here because size is already limited by
  MAXPATHLEN, but the compiler optimises the new tests better. Also fix an
  off-by-one error.
- Simplify tests to see if an ELF note program header is on the first page.
  This also fixes an off-by-one error.

Reviewed by:	kib
2013-03-29 13:23:43 +00:00
Bryan Venteicher 05f5b54679 MFC 247870:
Remove the virtio dependency entry for the VirtIO device drivers. This
    will prevent the kernel from linking if the device driver are included
    without the virtio module. Remove pci and scbus for the same reason.

    Also explain the relationship and necessity of the virtio and virtio_pci
    modules. Currently in FreeBSD, we only support VirtIO PCI, but it could
    be replaced with a different interface (like MMIO) and the device
    (network, block, etc) will still function.
2013-03-29 02:09:46 +00:00
Pyun YongHyeon 13ad3a61e2 MFC r248226:
r241438 broke IPMI access on Sun Fire X2200 M2(BCM5715).
  Fix the IPMI regression by sending BGE_FW_DRV_STATE_UNLOAD to
  ASF/IPMI firmware in driver attach phase.  Sending heartheat to
  ASF/IPMI is enabled only after upping interface so
  setting driver state to BGE_FW_DRV_STATE_START in attach phase
  broke IPMI access.
  While I'm here, add NVRAM arbitration lock before performing
  controller reset. ASF/IPMI firmware may be able to access the NVRAM
  while controller reset is in progress.  Without the arbitration
  lock before resetting the controller, ASF/IPMI may not initialize
  properly.
2013-03-29 00:22:43 +00:00
Sean Bruno 6aaea4d1a4 MFC r247279
The 5300 series ciss(4) board does not work in performant mode with our
currnet initialization sequence.  Set it to simple mode only so that
systems can be updated from stable/7 to newer installations.

At some point, we should figure out why we cannot initialize performant
mode on this board.

PR:		kern/153361
Reviewed by:	scottl
Obtained from:	Yahoo! Inc
2013-03-28 17:27:46 +00:00
Konstantin Belousov f5508a697c MFC r248422:
Remove negative name cache entry pointing to the target name, which
could be instantiated while tdvp was unlocked.
2013-03-28 14:39:50 +00:00
Dag-Erling Smørgrav 85e83ec254 MFH (r248465): revert upstream decommissioning of authorized_keys2 2013-03-28 13:38:02 +00:00
Andrey V. Elsukov 4a4b146309 MFC r248180:
Take the inpcb rlock before calculating checksum, it was accidentally
  moved in r191672.
2013-03-28 09:51:37 +00:00
Gavin Atkinson db9ab560b8 When r241373 was merged, one file appears to have been missed from the
commit.  Merge it:
        Remove undefined behavior from sranddev() and
        srandomdev(). This doesn't actually work
        with any modern C compiler:

        In particular, both clang and modern gcc
        verisons silently elide any xor operation
        with 'junk'.

No mergeinfo changes with this commit as r241475 already updated the
mergeinfo.
2013-03-28 09:03:15 +00:00
Xin LI 20eb15263d Bump __FreeBSD_version to 804500 now that releng/8.4 has been branched. 2013-03-28 06:59:58 +00:00
Xin LI b7cde684c2 8.4-BETA1 is done, identify as 8.4-PRERELEASE again. 2013-03-28 06:56:13 +00:00
Xin LI e538b32559 MFV r248595:
- Integrate OpenSSL revisions
   fb092ef4fca897344daf7189526f5f26be6487ce,
   a93cc7c57333f4538cbcdedd2e961a5a38caa52d, and
   76c61a5d1adb92388f39e585e4af860a20feb9bb.

   This removes the newly added orig_len field of SSL3_RECORD and
   restored ABI.

Approved by:	benl
2013-03-28 06:48:06 +00:00
4422 changed files with 727310 additions and 395143 deletions

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
The compilation of software known as FreeBSD is distributed under the
following terms:
Copyright (c) 1992-2013 The FreeBSD Project. All rights reserved.
Copyright (c) 1992-2015 The FreeBSD Project. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
+17 -3
View File
@@ -117,7 +117,13 @@ MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
BINMAKE= \
`if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
-m ${.CURDIR}/share/mk
.if defined(.PARSEDIR)
# don't pass -J to fmake
_MAKE= PATH=${PATH} MAKEFLAGS="${MAKEFLAGS:N-J:N1*,1*}" ${BINMAKE} -f Makefile.inc1
.else
_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1
.endif
#
# Make sure we have an up-to-date make(1). Only world and buildworld
@@ -175,7 +181,7 @@ ${TGTS}:
.MAIN: all
STARTTIME!= LC_ALL=C date
CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s
CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s; echo
.if !empty(CHECK_TIME)
.error check your date/time: ${STARTTIME}
.endif
@@ -300,7 +306,7 @@ MAKEFAIL=tee -a ${FAILFILE}
MAKEFAIL=cat
.endif
universe: universe_prologue
universe: universe_prologue upgrade_checks
universe_prologue:
@echo "--------------------------------------------------------------"
@echo ">>> make universe started on ${STARTTIME}"
@@ -310,7 +316,7 @@ universe_prologue:
.endif
.for target in ${TARGETS}
universe: universe_${target}
.ORDER: universe_prologue universe_${target} universe_epilogue
.ORDER: universe_prologue upgrade_checks universe_${target}_prologue universe_${target} universe_epilogue
universe_${target}:
@echo ">> ${target} started on `LC_ALL=C date`"
.if !defined(MAKE_JUST_KERNELS)
@@ -366,3 +372,11 @@ universe_epilogue:
fi
.endif
.endif
.if defined(.PARSEDIR)
.if make(universe)
# we do not want a failure of one branch abort all.
MAKE_JOB_ERROR_TOKEN= no
.export MAKE_JOB_ERROR_TOKEN
.endif
.endif
+10 -3
View File
@@ -779,7 +779,7 @@ buildkernel:
cd ${KRNLOBJDIR}/${_kernel}; \
PATH=${BPATH}:${PATH} \
MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \
${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
-f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
@@ -787,7 +787,7 @@ buildkernel:
cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
PATH=${BPATH}:${PATH} \
MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target}
${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF ${target}
.endfor
.endif
.if !defined(NO_KERNELDEPEND)
@@ -953,7 +953,9 @@ _lex= usr.bin/lex
.endif
.if ${BOOTSTRAPPING} >= 1000013
_yacc= usr.bin/yacc
_lex= usr.bin/lex
_yacc= lib/liby \
usr.bin/yacc
.endif
.if ${BOOTSTRAPPING} < 800013
@@ -1139,6 +1141,8 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libheimntlm} \
lib/libopie lib/libpam ${_lib_libthr} \
lib/libradius lib/libsbuf lib/libtacplus \
${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
${_cddl_lib_libavl} \
${_cddl_lib_libzfs_core} \
lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
${_secure_lib_libcrypto} ${_secure_lib_libssh} \
${_secure_lib_libssl}
@@ -1154,7 +1158,10 @@ lib/libopie__L lib/libtacplus__L: lib/libmd__L
.if ${MK_CDDL} != "no"
_cddl_lib_libumem= cddl/lib/libumem
_cddl_lib_libnvpair= cddl/lib/libnvpair
_cddl_lib_libavl= cddl/lib/libavl
_cddl_lib_libzfs_core= cddl/lib/libzfs_core
_cddl_lib= cddl/lib
cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
.endif
.if ${MK_CRYPT} != "no"
+201
View File
@@ -14,6 +14,11 @@
# The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
#
# 20140922: sleepq_calc_signal_retval.9 and sleepq_catch_signals.9 removed
OLD_FILES+=usr/share/man/man9/sleepq_calc_signal_retval.9.gz
OLD_FILES+=usr/share/man/man9/sleepq_catch_signals.9.gz
# 20130701: vfs_mount.9 removed
OLD_FILES+=usr/share/man/man9/vfs_mount.9.gz
# 20110915: rename congestion control manpages
OLD_FILES+=usr/share/man/man4/cc.4.gz
OLD_FILES+=usr/share/man/man9/cc.9.gz
@@ -1970,6 +1975,202 @@ OLD_FILES+=lib/geom/geom_concat.so.1
OLD_FILES+=lib/geom/geom_label.so.1
OLD_FILES+=lib/geom/geom_nop.so.1
OLD_FILES+=lib/geom/geom_stripe.so.1
# 20040728: GCC 3.4.2
OLD_DIRS+=usr/include/c++/3.3
OLD_FILES+=usr/include/c++/3.3/FlexLexer.h
OLD_FILES+=usr/include/c++/3.3/algorithm
OLD_FILES+=usr/include/c++/3.3/backward/algo.h
OLD_FILES+=usr/include/c++/3.3/backward/algobase.h
OLD_FILES+=usr/include/c++/3.3/backward/alloc.h
OLD_FILES+=usr/include/c++/3.3/backward/backward_warning.h
OLD_FILES+=usr/include/c++/3.3/backward/bvector.h
OLD_FILES+=usr/include/c++/3.3/backward/complex.h
OLD_FILES+=usr/include/c++/3.3/backward/defalloc.h
OLD_FILES+=usr/include/c++/3.3/backward/deque.h
OLD_FILES+=usr/include/c++/3.3/backward/fstream.h
OLD_FILES+=usr/include/c++/3.3/backward/function.h
OLD_FILES+=usr/include/c++/3.3/backward/hash_map.h
OLD_FILES+=usr/include/c++/3.3/backward/hash_set.h
OLD_FILES+=usr/include/c++/3.3/backward/hashtable.h
OLD_FILES+=usr/include/c++/3.3/backward/heap.h
OLD_FILES+=usr/include/c++/3.3/backward/iomanip.h
OLD_FILES+=usr/include/c++/3.3/backward/iostream.h
OLD_FILES+=usr/include/c++/3.3/backward/istream.h
OLD_FILES+=usr/include/c++/3.3/backward/iterator.h
OLD_FILES+=usr/include/c++/3.3/backward/list.h
OLD_FILES+=usr/include/c++/3.3/backward/map.h
OLD_FILES+=usr/include/c++/3.3/backward/multimap.h
OLD_FILES+=usr/include/c++/3.3/backward/multiset.h
OLD_FILES+=usr/include/c++/3.3/backward/new.h
OLD_FILES+=usr/include/c++/3.3/backward/ostream.h
OLD_FILES+=usr/include/c++/3.3/backward/pair.h
OLD_FILES+=usr/include/c++/3.3/backward/queue.h
OLD_FILES+=usr/include/c++/3.3/backward/rope.h
OLD_FILES+=usr/include/c++/3.3/backward/set.h
OLD_FILES+=usr/include/c++/3.3/backward/slist.h
OLD_FILES+=usr/include/c++/3.3/backward/stack.h
OLD_FILES+=usr/include/c++/3.3/backward/stream.h
OLD_FILES+=usr/include/c++/3.3/backward/streambuf.h
OLD_FILES+=usr/include/c++/3.3/backward/strstream
OLD_FILES+=usr/include/c++/3.3/backward/strstream.h
OLD_FILES+=usr/include/c++/3.3/backward/tempbuf.h
OLD_FILES+=usr/include/c++/3.3/backward/tree.h
OLD_FILES+=usr/include/c++/3.3/backward/vector.h
OLD_DIRS+=usr/include/c++/3.3/backward
OLD_FILES+=usr/include/c++/3.3/bits/atomicity.h
OLD_FILES+=usr/include/c++/3.3/bits/basic_file.h
OLD_FILES+=usr/include/c++/3.3/bits/basic_ios.h
OLD_FILES+=usr/include/c++/3.3/bits/basic_ios.tcc
OLD_FILES+=usr/include/c++/3.3/bits/basic_string.h
OLD_FILES+=usr/include/c++/3.3/bits/basic_string.tcc
OLD_FILES+=usr/include/c++/3.3/bits/boost_concept_check.h
OLD_FILES+=usr/include/c++/3.3/bits/c++config.h
OLD_FILES+=usr/include/c++/3.3/bits/c++io.h
OLD_FILES+=usr/include/c++/3.3/bits/c++locale.h
OLD_FILES+=usr/include/c++/3.3/bits/c++locale_internal.h
OLD_FILES+=usr/include/c++/3.3/bits/char_traits.h
OLD_FILES+=usr/include/c++/3.3/bits/cmath.tcc
OLD_FILES+=usr/include/c++/3.3/bits/codecvt.h
OLD_FILES+=usr/include/c++/3.3/bits/codecvt_specializations.h
OLD_FILES+=usr/include/c++/3.3/bits/concept_check.h
OLD_FILES+=usr/include/c++/3.3/bits/cpp_type_traits.h
OLD_FILES+=usr/include/c++/3.3/bits/ctype_base.h
OLD_FILES+=usr/include/c++/3.3/bits/ctype_inline.h
OLD_FILES+=usr/include/c++/3.3/bits/ctype_noninline.h
OLD_FILES+=usr/include/c++/3.3/bits/deque.tcc
OLD_FILES+=usr/include/c++/3.3/bits/fpos.h
OLD_FILES+=usr/include/c++/3.3/bits/fstream.tcc
OLD_FILES+=usr/include/c++/3.3/bits/functexcept.h
OLD_FILES+=usr/include/c++/3.3/bits/generic_shadow.h
OLD_FILES+=usr/include/c++/3.3/bits/gslice.h
OLD_FILES+=usr/include/c++/3.3/bits/gslice_array.h
OLD_FILES+=usr/include/c++/3.3/bits/gthr-default.h
OLD_FILES+=usr/include/c++/3.3/bits/gthr-posix.h
OLD_FILES+=usr/include/c++/3.3/bits/gthr-single.h
OLD_FILES+=usr/include/c++/3.3/bits/gthr.h
OLD_FILES+=usr/include/c++/3.3/bits/indirect_array.h
OLD_FILES+=usr/include/c++/3.3/bits/ios_base.h
OLD_FILES+=usr/include/c++/3.3/bits/istream.tcc
OLD_FILES+=usr/include/c++/3.3/bits/list.tcc
OLD_FILES+=usr/include/c++/3.3/bits/locale_classes.h
OLD_FILES+=usr/include/c++/3.3/bits/locale_facets.h
OLD_FILES+=usr/include/c++/3.3/bits/locale_facets.tcc
OLD_FILES+=usr/include/c++/3.3/bits/localefwd.h
OLD_FILES+=usr/include/c++/3.3/bits/mask_array.h
OLD_FILES+=usr/include/c++/3.3/bits/messages_members.h
OLD_FILES+=usr/include/c++/3.3/bits/os_defines.h
OLD_FILES+=usr/include/c++/3.3/bits/ostream.tcc
OLD_FILES+=usr/include/c++/3.3/bits/pthread_allocimpl.h
OLD_FILES+=usr/include/c++/3.3/bits/slice.h
OLD_FILES+=usr/include/c++/3.3/bits/slice_array.h
OLD_FILES+=usr/include/c++/3.3/bits/sstream.tcc
OLD_FILES+=usr/include/c++/3.3/bits/stl_algo.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_algobase.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_alloc.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_bvector.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_construct.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_deque.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_function.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_heap.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_iterator.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_iterator_base_funcs.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_iterator_base_types.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_list.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_map.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_multimap.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_multiset.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_numeric.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_pair.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_pthread_alloc.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_queue.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_raw_storage_iter.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_relops.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_set.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_stack.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_tempbuf.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_threads.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_tree.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_uninitialized.h
OLD_FILES+=usr/include/c++/3.3/bits/stl_vector.h
OLD_FILES+=usr/include/c++/3.3/bits/stream_iterator.h
OLD_FILES+=usr/include/c++/3.3/bits/streambuf.tcc
OLD_FILES+=usr/include/c++/3.3/bits/streambuf_iterator.h
OLD_FILES+=usr/include/c++/3.3/bits/stringfwd.h
OLD_FILES+=usr/include/c++/3.3/bits/time_members.h
OLD_FILES+=usr/include/c++/3.3/bits/type_traits.h
OLD_FILES+=usr/include/c++/3.3/bits/valarray_array.h
OLD_FILES+=usr/include/c++/3.3/bits/valarray_array.tcc
OLD_FILES+=usr/include/c++/3.3/bits/valarray_meta.h
OLD_FILES+=usr/include/c++/3.3/bits/vector.tcc
OLD_DIRS+=usr/include/c++/3.3/bits
OLD_FILES+=usr/include/c++/3.3/bitset
OLD_FILES+=usr/include/c++/3.3/cassert
OLD_FILES+=usr/include/c++/3.3/cctype
OLD_FILES+=usr/include/c++/3.3/cerrno
OLD_FILES+=usr/include/c++/3.3/cfloat
OLD_FILES+=usr/include/c++/3.3/ciso646
OLD_FILES+=usr/include/c++/3.3/climits
OLD_FILES+=usr/include/c++/3.3/clocale
OLD_FILES+=usr/include/c++/3.3/cmath
OLD_FILES+=usr/include/c++/3.3/complex
OLD_FILES+=usr/include/c++/3.3/csetjmp
OLD_FILES+=usr/include/c++/3.3/csignal
OLD_FILES+=usr/include/c++/3.3/cstdarg
OLD_FILES+=usr/include/c++/3.3/cstddef
OLD_FILES+=usr/include/c++/3.3/cstdio
OLD_FILES+=usr/include/c++/3.3/cstdlib
OLD_FILES+=usr/include/c++/3.3/cstring
OLD_FILES+=usr/include/c++/3.3/ctime
OLD_FILES+=usr/include/c++/3.3/cwchar
OLD_FILES+=usr/include/c++/3.3/cwctype
OLD_FILES+=usr/include/c++/3.3/cxxabi.h
OLD_FILES+=usr/include/c++/3.3/deque
OLD_FILES+=usr/include/c++/3.3/exception
OLD_FILES+=usr/include/c++/3.3/exception_defines.h
OLD_FILES+=usr/include/c++/3.3/ext/algorithm
OLD_FILES+=usr/include/c++/3.3/ext/enc_filebuf.h
OLD_FILES+=usr/include/c++/3.3/ext/functional
OLD_FILES+=usr/include/c++/3.3/ext/hash_map
OLD_FILES+=usr/include/c++/3.3/ext/hash_set
OLD_FILES+=usr/include/c++/3.3/ext/iterator
OLD_FILES+=usr/include/c++/3.3/ext/memory
OLD_FILES+=usr/include/c++/3.3/ext/numeric
OLD_FILES+=usr/include/c++/3.3/ext/rb_tree
OLD_FILES+=usr/include/c++/3.3/ext/rope
OLD_FILES+=usr/include/c++/3.3/ext/ropeimpl.h
OLD_FILES+=usr/include/c++/3.3/ext/slist
OLD_FILES+=usr/include/c++/3.3/ext/stdio_filebuf.h
OLD_FILES+=usr/include/c++/3.3/ext/stl_hash_fun.h
OLD_FILES+=usr/include/c++/3.3/ext/stl_hashtable.h
OLD_FILES+=usr/include/c++/3.3/ext/stl_rope.h
OLD_DIRS+=usr/include/c++/3.3/ext
OLD_FILES+=usr/include/c++/3.3/fstream
OLD_FILES+=usr/include/c++/3.3/functional
OLD_FILES+=usr/include/c++/3.3/iomanip
OLD_FILES+=usr/include/c++/3.3/ios
OLD_FILES+=usr/include/c++/3.3/iosfwd
OLD_FILES+=usr/include/c++/3.3/iostream
OLD_FILES+=usr/include/c++/3.3/istream
OLD_FILES+=usr/include/c++/3.3/iterator
OLD_FILES+=usr/include/c++/3.3/limits
OLD_FILES+=usr/include/c++/3.3/list
OLD_FILES+=usr/include/c++/3.3/locale
OLD_FILES+=usr/include/c++/3.3/map
OLD_FILES+=usr/include/c++/3.3/memory
OLD_FILES+=usr/include/c++/3.3/new
OLD_FILES+=usr/include/c++/3.3/numeric
OLD_FILES+=usr/include/c++/3.3/ostream
OLD_FILES+=usr/include/c++/3.3/queue
OLD_FILES+=usr/include/c++/3.3/set
OLD_FILES+=usr/include/c++/3.3/sstream
OLD_FILES+=usr/include/c++/3.3/stack
OLD_FILES+=usr/include/c++/3.3/stdexcept
OLD_FILES+=usr/include/c++/3.3/streambuf
OLD_FILES+=usr/include/c++/3.3/string
OLD_FILES+=usr/include/c++/3.3/typeinfo
OLD_FILES+=usr/include/c++/3.3/utility
OLD_FILES+=usr/include/c++/3.3/valarray
OLD_FILES+=usr/include/c++/3.3/vector
# 20040713: fla(4) removed.
OLD_FILES+=usr/share/man/man4/fla.4.gz
# 200407XX
+69
View File
@@ -15,6 +15,75 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.x IS SLOW ON IA64 OR SUN4V:
debugging tools present in HEAD were left in place because
sun4v support still needs work to become production ready.
20150624:
An additional fix for the issue described in the 20150615 sendmail
entry below has been been committed in revision 284790.
20150615:
The latest version of openssl rejects TLS handshakes with DH
parameters below 768 bits. sendmail releases prior to 8.15.2
(not yet released), defaulted to a 512 bit DH parameter setting
for client connections. To improve interoperability, the
sendmail default for client connections has been raised to
1024 bits.
20140216:
The nve(4) driver for NVIDIA nForce MCP Ethernet adapters has
been deprecated and will not be part of FreeBSD 11.0 and later
releases. If you use this driver, please consider switching to
the nfe(4) driver instead.
20131216:
The behavior of gss_pseudo_random() for the krb5 mechanism
has changed, for applications requesting a longer random string
than produced by the underlying enctype's pseudo-random() function.
In particular, the random string produced from a session key of
enctype aes256-cts-hmac-sha1-96 or aes256-cts-hmac-sha1-96 will
be different at the 17th octet and later, after this change.
The counter used in the PRF+ construction is now encoded as a
big-endian integer in accordance with RFC 4402.
__FreeBSD_version is bumped to 804501.
20130823:
Behavior of devfs rules path matching has been changed.
Pattern is now always matched against fully qualified devfs
path and slash characters must be explicitly matched by
slashes in pattern (FNM_PATHNAME). Rulesets involving devfs
subdirectories must be reviewed.
20130705:
hastctl(8)'s `status' command output changed to terse one-liner format.
Scripts using this should switch to `list' command or be rewritten.
20130624:
Added ZFS TRIM support which is enabled by default. To disable
ZFS TRIM support set vfs.zfs.trim.enabled=0 in loader.conf.
Creating new ZFS pools and adding new devices to existing pools
first performs a full device level TRIM, which can take a significant
amount of time. Set the sysctl vfs.zfs.vdev.trim_on_init to 0 to
disable this behaviour.
ZFS TRIM requires the underlying device support BIO_DELETE which
is currently provided by methods such as ATA TRIM and SCSI UNMAP
via CAM, which are typically supported by SSD's.
Stats for ZFS TRIM can be monitored by looking at the sysctl's
under kstat.zfs.misc.zio_trim.
20130607:
8.4-RELEASE.
20130524:
`list' command has been added to hastctl(8). For now, it is full
equivalent of `status' command.
WARNING: in the near future the output of hastctl's status command
will change to more terse format. If you use `hastctl status'
for parsing in your scripts, switch to `hastctl list'.
20130429:
Fix a bug that allows NFS clients to issue READDIR on files.
20130225:
A new compression method (lz4) has been merged. Please refer to
zpool-features(7) for more information.
+2
View File
@@ -54,4 +54,6 @@ _rmail= rmail
_csh= csh
.endif
SUBDIR_PARALLEL=
.include <bsd.subdir.mk>
+3 -3
View File
@@ -134,7 +134,7 @@ will run with effective gid set to the gid of the file owner.
See
.Xr chmod 2
and
.Xr sticky 8 .
.Xr sticky 7 .
.It Li 0400
Allow read by owner.
.It Li 0200
@@ -325,10 +325,10 @@ option is non-standard and its use in scripts is not recommended.
.Xr umask 2 ,
.Xr fts 3 ,
.Xr setmode 3 ,
.Xr sticky 7 ,
.Xr symlink 7 ,
.Xr chown 8 ,
.Xr mount 8 ,
.Xr sticky 8
.Xr mount 8
.Sh STANDARDS
The
.Nm
+1 -1
View File
@@ -351,7 +351,7 @@ dd_in(void)
* than noerror, notrunc or sync are specified, the block
* is output without buffering as it is read.
*/
if (ddflags & C_BS) {
if ((ddflags & ~(C_NOERROR | C_NOTRUNC | C_SYNC)) == C_BS) {
out.dbcnt = in.dbcnt;
dd_out(1);
in.dbcnt = 0;
+2 -2
View File
@@ -243,7 +243,7 @@ expand_des_key(char *obuf, char *kbuf)
/*
* now translate it, bombing on any illegal hex digit
*/
for (i = 0; kbuf[i] && i < 16; i++)
for (i = 0; i < 16 && kbuf[i]; i++)
if ((nbuf[i] = hex_to_binary((int) kbuf[i], 16)) == -1)
des_error("bad hex digit in key");
while (i < 16)
@@ -263,7 +263,7 @@ expand_des_key(char *obuf, char *kbuf)
/*
* now translate it, bombing on any illegal binary digit
*/
for (i = 0; kbuf[i] && i < 16; i++)
for (i = 0; i < 16 && kbuf[i]; i++)
if ((nbuf[i] = hex_to_binary((int) kbuf[i], 2)) == -1)
des_error("bad binary digit in key");
while (i < 64)
+4 -4
View File
@@ -459,7 +459,7 @@ but not execute or search permission.
(See
.Xr chmod 1
or
.Xr sticky 8 . )
.Xr sticky 7 . )
.It Sy t
The sticky bit is set (mode
.Li 1000 ) ,
@@ -467,7 +467,7 @@ and is searchable or executable.
(See
.Xr chmod 1
or
.Xr sticky 8 . )
.Xr sticky 7 . )
.El
.El
.Pp
@@ -683,9 +683,9 @@ specification.
.Xr strmode 3 ,
.Xr termcap 5 ,
.Xr maclabel 7 ,
.Xr sticky 7 ,
.Xr symlink 7 ,
.Xr getfmac 8 ,
.Xr sticky 8
.Xr getfmac 8
.Sh STANDARDS
With the exception of options
.Fl I , g , n
+2 -2
View File
@@ -135,7 +135,7 @@ main(int argc, char *argv[])
* Returns 1 if a directory has been created,
* 2 if it already existed, and 0 on failure.
*/
int
static int
build(char *path, mode_t omode)
{
struct stat sb;
@@ -208,7 +208,7 @@ build(char *path, mode_t omode)
return (retval);
}
void
static void
usage(void)
{
+17 -17
View File
@@ -62,15 +62,15 @@ int rflag, Iflag;
uid_t uid;
volatile sig_atomic_t info;
int check(char *, char *, struct stat *);
int check2(char **);
void checkdot(char **);
void checkslash(char **);
void rm_file(char **);
int rm_overwrite(char *, struct stat *);
void rm_tree(char **);
static int check(const char *, const char *, struct stat *);
static int check2(char **);
static void checkdot(char **);
static void checkslash(char **);
static void rm_file(char **);
static int rm_overwrite(const char *, struct stat *);
static void rm_tree(char **);
static void siginfo(int __unused);
void usage(void);
static void usage(void);
/*
* rm --
@@ -169,7 +169,7 @@ main(int argc, char *argv[])
exit (eval);
}
void
static void
rm_tree(char **argv)
{
FTS *fts;
@@ -412,7 +412,7 @@ rm_file(char **argv)
* kernel support.
*/
int
rm_overwrite(char *file, struct stat *sbp)
rm_overwrite(const char *file, struct stat *sbp)
{
struct stat sb, sb2;
struct statfs fsb;
@@ -478,8 +478,8 @@ err: eval = 1;
}
int
check(char *path, char *name, struct stat *sp)
static int
check(const char *path, const char *name, struct stat *sp)
{
int ch, first;
char modep[15], *flagsp;
@@ -490,7 +490,7 @@ check(char *path, char *name, struct stat *sp)
else {
/*
* If it's not a symbolic link and it's unwritable and we're
* talking to a terminal, ask. Symbolic links are excluded
* talking to a terminal, ask. Symbolic links are excluded
* because their permissions are meaningless. Check stdin_ok
* first because we may not have stat'ed the file.
*/
@@ -523,7 +523,7 @@ check(char *path, char *name, struct stat *sp)
}
#define ISSLASH(a) ((a)[0] == '/' && (a)[1] == '\0')
void
static void
checkslash(char **argv)
{
char **t, **u;
@@ -543,7 +543,7 @@ checkslash(char **argv)
}
}
int
static int
check2(char **argv)
{
struct stat st;
@@ -594,7 +594,7 @@ check2(char **argv)
}
#define ISDOT(a) ((a)[0] == '.' && (!(a)[1] || ((a)[1] == '.' && !(a)[2])))
void
static void
checkdot(char **argv)
{
char *p, **save, **t;
@@ -618,7 +618,7 @@ checkdot(char **argv)
}
}
void
static void
usage(void)
{
@@ -36,12 +36,12 @@
#pragma D option quiet
#pragma D option statusrate=10ms
fbt::ioctl:entry
fbt::kern_ioctl:entry
{
printf("Entering the ioctl function\n");
}
fbt::ioctl:return
fbt::kern_ioctl:return
{
printf("Returning from ioctl function\n");
exit(0);
@@ -36,7 +36,7 @@
#pragma D option quiet
#pragma D option statusrate=10ms
fbt::ioctl:return
fbt::kern_ioctl:return
{
printf("The function return value is stored in %u\n", arg1);
exit(0);
@@ -36,13 +36,13 @@
#pragma D option quiet
#pragma D option statusrate=10ms
fbt::ioctl:entry
fbt::kern_ioctl:entry
{
printf("Entering the ioctl function\n");
printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);
}
fbt::ioctl:return
fbt::kern_ioctl:return
{
printf("Returning from ioctl function\n");
printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);
@@ -41,12 +41,12 @@ BEGIN
self->traceme = 1;
}
fbt::ioctl:entry
fbt::kern_ioctl:entry
{
printf("Entering the function\n");
}
fbt::ioctl:return
fbt::kern_ioctl:return
{
printf("The offset = %u\n", arg0);
exit(0);
@@ -36,14 +36,14 @@
#pragma D option quiet
#pragma D option statusrate=10ms
fbt::ioctl:entry
fbt::kern_ioctl:entry
{
printf("Entering the ioctl function\n");
printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);
exit(0);
}
fbt::ioctl:return
fbt::kern_ioctl:return
{
printf("Returning from ioctl function\n");
printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);
@@ -36,7 +36,7 @@
#pragma D option quiet
#pragma D option statusrate=10ms
fbt::ioctl:return
fbt::kern_ioctl:return
/arg1 == 0/
{
printf("%s %x returned 0", probefunc, arg0);
@@ -36,7 +36,7 @@
#pragma D option quiet
#pragma D option statusrate=10ms
fbt::ioctl:entry
fbt::kern_ioctl:entry
{
self->traceme = 1;
}
@@ -47,7 +47,7 @@ fbt:::entry
printf("called %s\n", probefunc);
}
fbt::ioctl:return
fbt::kern_ioctl:return
/self->traceme/
{
self->traceme = 0;
+16 -4
View File
@@ -14,11 +14,12 @@
.\"
.\" Copyright 2012, Richard Lowe.
.\" Copyright (c) 2012, Marcelo Araujo <[email protected]>.
.\" Copyright (c) 2012 by Delphix. All rights reserved.
.\" All Rights Reserved.
.\"
.\" $FreeBSD$
.\"
.Dd May 10, 2012
.Dd December 31, 2013
.Dt ZDB 8
.Os
.Sh NAME
@@ -29,27 +30,35 @@
.Op Fl CumdibcsDvhLXFPA
.Op Fl e Op Fl p Ar path...
.Op Fl t Ar txg
.Op Fl U Ar cache
.Op Fl M Ar inflight I/Os
.Ar poolname
.Op Ar object ...
.Nm
.Op Fl divPA
.Op Fl e Op Fl p Ar path...
.Op Fl U Ar cache
.Ar dataset
.Op Ar object ...
.Nm
.Fl m Op Fl LXFPA
.Op Fl t Ar txg
.Op Fl e Op Fl p Ar path...
.Op Fl U Ar cache
.Ar poolname
.Nm
.Fl R Op Fl A
.Op Fl e Op Fl p Ar path...
.Op Fl U Ar cache
.Ar poolname
.Ar poolname
.Ar vdev Ns : Ns Ar offset Ns : Ns Ar size Ns Op Ns : Ns Ar flags
.Nm
.Fl S
.Op Fl AP
.Op Fl e Op Fl p Ar path...
.Op Fl U Ar cache
.Ar poolname
.Ar poolname
.Nm
.Fl l
@@ -205,6 +214,11 @@ flag specifies the path under which devices are to be searched.
.It Fl F
Attempt to make an unreadable pool readable by trying progressively older
transactions.
.It Fl M Ar inflight I/Os
Limit the number of outstanding checksum I/Os to the specified value.
The default value is 200. This option affects the performance of the
.Fl c
option.
.It Fl P
Print numbers in an unscaled form more amenable to parsing, eg. 1000000 rather
than 1M.
@@ -218,9 +232,7 @@ options for a means to see the available uberblocks and their associated
transaction numbers.
.It Fl U Ar cachefile
Use a cache file other than
.Pa /etc/zfs/zpool.cache .
This option is only valid with
.Fl C
.Pa /boot/zfs/zpool.cache .
.It Fl v
Enable verbosity.
Specify multiple times for increased verbosity.
File diff suppressed because it is too large. Load diff
+9 -5
View File
@@ -23,6 +23,10 @@
* Use is subject to license terms.
*/
/*
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
/*
* Print intent log header and statistics.
*/
@@ -47,7 +51,7 @@ print_log_bp(const blkptr_t *bp, const char *prefix)
{
char blkbuf[BP_SPRINTF_LEN];
sprintf_blkptr(blkbuf, bp);
snprintf_blkptr(blkbuf, sizeof (blkbuf), bp);
(void) printf("%s%s\n", prefix, blkbuf);
}
@@ -132,6 +136,7 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write_t *lr)
if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) {
(void) printf("%shas blkptr, %s\n", prefix,
!BP_IS_HOLE(bp) &&
bp->blk_birth >= spa_first_txg(zilog->zl_spa) ?
"will claim" : "won't claim");
print_log_bp(bp, prefix);
@@ -139,8 +144,6 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write_t *lr)
if (BP_IS_HOLE(bp)) {
(void) printf("\t\t\tLSIZE 0x%llx\n",
(u_longlong_t)BP_GET_LSIZE(bp));
}
if (bp->blk_birth == 0) {
bzero(buf, sizeof (buf));
(void) printf("%s<hole>\n", prefix);
return;
@@ -313,7 +316,8 @@ print_log_block(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t claim_txg)
if (verbose >= 5) {
(void) strcpy(blkbuf, ", ");
sprintf_blkptr(blkbuf + strlen(blkbuf), bp);
snprintf_blkptr(blkbuf + strlen(blkbuf),
sizeof (blkbuf) - strlen(blkbuf), bp);
} else {
blkbuf[0] = '\0';
}
@@ -361,7 +365,7 @@ dump_intent_log(zilog_t *zilog)
int verbose = MAX(dump_opt['d'], dump_opt['i']);
int i;
if (zh->zh_log.blk_birth == 0 || verbose < 1)
if (BP_IS_HOLE(&zh->zh_log) || verbose < 1)
return;
(void) printf("\n ZIL header: claim_txg %llu, "
+174 -46
View File
@@ -18,16 +18,18 @@
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012 by Delphix. All rights reserved.
.\" Copyright (c) 2012, Joyent, Inc. All rights reserved.
.\" Copyright (c) 2013 by Delphix. All rights reserved.
.\" Copyright (c) 2011, Pawel Jakub Dawidek <[email protected]>
.\" Copyright (c) 2012, Glen Barber <[email protected]>
.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
.\" Copyright (c) 2013 Nexenta Systems, Inc. All Rights Reserved.
.\" Copyright (c) 2013, Joyent, Inc. All rights reserved.
.\" Copyright (c) 2013, Steven Hartland <[email protected]>
.\" Copyright (c) 2014, Xin LI <[email protected]>
.\"
.\" $FreeBSD$
.\"
.Dd February 10, 2013
.Dd January 2, 2014
.Dt ZFS 8
.Os
.Sh NAME
@@ -55,15 +57,21 @@
.Cm destroy
.Op Fl dnpRrv
.Sm off
.Ar snapshot
.Op % Ns Ar snapname
.Ar filesystem Ns | Ns volume
.Ns @snap
.Op % Ns Ar snap
.Op , Ns Ar snap Op % Ns Ar snap
.Op , Ns ...
.Sm on
.Nm
.Cm snapshot
.Cm destroy
.Ar filesystem Ns | Ns Ar volume Ns # Ns Ar bookmark
.Nm
.Cm snapshot Ns | Ns Cm snap
.Op Fl r
.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
.Ar filesystem@snapname Ns | Ns Ar volume@snapname
.Ar filesystem@snapname Ns | Ns Ar volume@snapname Ns ...
.Nm
.Cm rollback
.Op Fl rRf
@@ -99,7 +107,7 @@
.Nm
.Cm list
.Op Fl r Ns | Ns Fl d Ar depth
.Op Fl H
.Op Fl Hp
.Op Fl o Ar property Ns Oo , Ns property Ns Oc Ns ...
.Op Fl t Ar type Ns Oo , Ns type Ns Oc Ns ...
.Oo Fl s Ar property Oc Ns ...
@@ -155,7 +163,7 @@
.Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
.Fl a | Ar filesystem
.Nm
.Cm unmount
.Cm unmount Ns | Ns Cm umount
.Op Fl f
.Fl a | Ar filesystem Ns | Ns Ar mountpoint
.Nm
@@ -165,16 +173,24 @@
.Cm unshare
.Fl a | Ar filesystem Ns | Ns Ar mountpoint
.Nm
.Cm bookmark
.Ar snapshot
.Ar bookmark
.Nm
.Cm send
.Op Fl DnPpRv
.Op Fl i Ar snapshot | Fl I Ar snapshot
.Ar snapshot
.Nm
.Cm receive
.Cm send
.Op Fl i Ar snapshot Ns | Ns bookmark
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Nm
.Cm receive Ns | Ns Cm recv
.Op Fl vnFu
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Nm
.Cm receive
.Cm receive Ns | Ns Cm recv
.Op Fl vnFu
.Op Fl d | e
.Ar filesystem
@@ -519,6 +535,39 @@ if the snapshot has been marked for deferred destroy by using the
.Qq Nm Cm destroy -d
command. Otherwise, the property is
.Cm off .
.It Sy logicalreferenced
The amount of space that is
.Qq logically
accessible by this dataset.
See the
.Sy referenced
property.
The logical space ignores the effect of the
.Sy compression
and
.Sy copies
properties, giving a quantity closer to the amount of data that applications
see.
However, it does include space consumed by metadata.
.Pp
This property can also be referred to by its shortened column name,
.Sy lrefer .
.It Sy logicalused
The amount of space that is
.Qq logically
consumed by this dataset and all its descendents.
See the
.Sy used
property.
The logical space ignores the effect of the
.Sy compression
and
.Sy copies
properties, giving a quantity closer to the amount of data that applications
see.
.Pp
This property can also be referred to by its shortened column name,
.Sy lused .
.It Sy mounted
For file systems, indicates whether the file system is currently mounted. This
property can be either
@@ -850,14 +899,21 @@ command or unmounted by the
command.
.Pp
This property is not inherited.
.It Sy checksum Ns = Ns Cm on | off | fletcher2 | fletcher4 | sha256
.It Sy checksum Ns = Ns Cm on | off | fletcher2 | fletcher4 | sha256 | noparity
Controls the checksum used to verify data integrity. The default value is
.Cm on ,
which automatically selects an appropriate algorithm (currently,
.Cm fletcher4 ,
but this may change in future releases). The value
.Cm off
disables integrity checking on user data. Disabling checksums is
disables integrity checking on user data.
The value
.Cm noparity
not only
disables integrity but also disables maintaining parity for user data. This
setting is used internally by a dump device residing on a RAID-Z pool and should
not be used by any other dataset.
Disabling checksums is
.Em NOT
a recommended practice.
.It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | zle | Cm lz4
@@ -1158,7 +1214,7 @@ When the
.Sy sharenfs
property is changed for a dataset, the
.Xr mountd 8
dameon is reloaded.
daemon is reloaded.
.It Sy logbias Ns = Ns Cm latency | throughput
Provide a hint to
.Tn ZFS
@@ -1575,7 +1631,11 @@ multiple snapshots.
Destroy (or mark for deferred deletion) all snapshots with this name in
descendent file systems.
.It Fl R
Recursively destroy all dependents.
Recursively destroy all clones of these snapshots, including the clones,
snapshots, and children.
If this flag is specified, the
.Op fl d
flag will have no effect.
.It Fl n
Do a dry-run ("No-op") deletion. No data will be deleted. This is useful in
conjunction with the
@@ -1599,21 +1659,29 @@ options, as they can destroy large portions of a pool and cause unexpected
behavior for mounted file systems in use.
.It Xo
.Nm
.Cm snapshot
.Cm destroy
.Ar filesystem Ns | Ns Ar volume Ns # Ns Ar bookmark
.Xc
.Pp
The given bookmark is destroyed.
.It Xo
.Nm
.Cm snapshot Ns | Ns Cm snap
.Op Fl r
.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
.Ar filesystem@snapname Ns | Ns volume@snapname
.Ar filesystem@snapname Ns | Ns volume@snapname Ns ...
.Xc
.Pp
Creates a snapshot with the given name. All previous modifications by
successful system calls to the file system are part of the snapshot. See the
Creates snapshots with the given names. All previous modifications by
successful system calls to the file system are part of the snapshots.
Snapshots are taken atomically, so that all snapshots correspond to the same
moment in time. See the
.Qq Sx Snapshots
section for details.
.Bl -tag -width indent
.It Fl r
Recursively create snapshots of all descendent datasets. Snapshots are taken
atomically, so that all recursive snapshots correspond to the same moment in
time.
Recursively create snapshots of all descendent datasets
.It Fl o Ar property Ns = Ns Ar value
Sets the specified property; see
.Qq Nm Cm create
@@ -1630,14 +1698,24 @@ Roll back the given dataset to a previous snapshot. When a dataset is rolled
back, all data that has changed since the snapshot is discarded, and the
dataset reverts to the state at the time of the snapshot. By default, the
command refuses to roll back to a snapshot other than the most recent one. In
order to do so, all intermediate snapshots must be destroyed by specifying the
order to do so, all intermediate snapshots and bookmarks must be destroyed
by specifying the
.Fl r
option.
.Pp
The
.Fl rR
options do not recursively destroy the child snapshots of a
recursive snapshot.
Only direct snapshots of the specified filesystem
are destroyed by either of these options.
To completely roll back a
recursive snapshot, you must rollback the individual child snapshots.
.Bl -tag -width indent
.It Fl r
Recursively destroy any snapshots more recent than the one specified.
Destroy any snapshots and bookmarks more recent than the one specified.
.It Fl R
Recursively destroy any more recent snapshots, as well as any clones of those
Destroy any more recent snapshots and bookmarks, as well as any clones of those
snapshots.
.It Fl f
Used with the
@@ -1751,7 +1829,7 @@ only dataset that can be renamed recursively.
.Nm
.Cm list
.Op Fl r Ns | Ns Fl d Ar depth
.Op Fl H
.Op Fl Hp
.Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
.Op Fl t Ar type Ns Oo , Ns Ar type Oc Ns ...
.Oo Fl s Ar property Oc Ns ...
@@ -1782,6 +1860,8 @@ will display only the dataset and its direct children.
.It Fl H
Used for scripting mode. Do not print headers and separate fields by a single
tab instead of arbitrary white space.
.It Fl p
Display numbers in parsable (exact) values.
.It Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
A comma-separated list of properties to display. The property must be:
.Bl -bullet -offset 2n
@@ -1810,7 +1890,7 @@ syntax.
A comma-separated list of types to display, where
.Ar type
is one of
.Sy filesystem , snapshot , volume , No or Sy all .
.Sy filesystem , snapshot , snap , volume , bookmark , No or Sy all .
For example, specifying
.Fl t Cm snapshot
displays only snapshots.
@@ -1907,7 +1987,7 @@ sections.
The special value
.Cm all
can be used to display all properties that apply to the given dataset's type
(filesystem, volume, or snapshot).
(filesystem, volume, snapshot, or bookmark).
.Bl -tag -width indent
.It Fl r
Recursively display properties for any children.
@@ -1922,7 +2002,7 @@ Display output in a form more easily parsed by scripts. Any headers are
omitted, and fields are explicitly separated by a single tab instead of an
arbitrary amount of space.
.It Fl p
Display numbers in parseable (exact) values.
Display numbers in parsable (exact) values.
.It Fl o Cm all | Ar field Ns Oo , Ns Ar field Oc Ns ...
A comma-separated list of columns to display. Supported values are
.Sy name,property,value,received,source .
@@ -2139,7 +2219,7 @@ Mount the specified filesystem.
.El
.It Xo
.Nm
.Cm unmount
.Cm unmount Ns | Ns Cm umount
.Op Fl f
.Fl a | Ar filesystem Ns | Ns Ar mountpoint
.Xc
@@ -2225,6 +2305,26 @@ file system shared on the system.
.El
.It Xo
.Nm
.Cm bookmark
.Ar snapshot
.Ar bookmark
.Xc
.Pp
Creates a bookmark of the given snapshot.
Bookmarks mark the point in time
when the snapshot was created, and can be used as the incremental source for
a
.Qq Nm Cm send
command.
.Pp
This feature must be enabled to be used.
See
.Xr zpool-features 7
for details on ZFS feature flags and the
.Sy bookmark
feature.
.It Xo
.Nm
.Cm send
.Op Fl DnPpRv
.Op Fl i Ar snapshot | Fl I Ar snapshot
@@ -2243,17 +2343,15 @@ a file or to a different system (for example, using
By default, a full stream is generated.
.Bl -tag -width indent
.It Fl i Ar snapshot
Generate an incremental stream from the
.Fl i Ar snapshot
to the last
.Ar snapshot .
The incremental source (the
.Fl i Ar snapshot )
can be specified as the last component of the snapshot name (for example, the
part after the
.Sy @ ) ,
and it is assumed to be from the same file system as the last
.Ar snapshot .
Generate an incremental stream from the first
.Ar snapshot Pq the incremental source
to the second
.Ar snapshot Pq the incremental target .
The incremental source can be specified as the last component of the
snapshot name
.Pq the Em @ No character and following
and
it is assumed to be from the same file system as the incremental target.
.Pp
If the destination is a clone, the source may be the origin snapshot, which
must be fully specified (for example,
@@ -2261,15 +2359,16 @@ must be fully specified (for example,
not just
.Cm @origin ) .
.It Fl I Ar snapshot
Generate a stream package that sends all intermediary snapshots from the
.Fl I Ar snapshot
to the last
Generate a stream package that sends all intermediary snapshots from the first
.Ar snapshot
to the second
.Ar snapshot .
For example,
.Ic -I @a fs@d
is similar to
.Ic -i @a fs@b; -i @b fs@c; -i @c fs@d .
The incremental source snapshot may be specified as with the
The incremental
source may be specified as with the
.Fl i
option.
.It Fl R
@@ -2322,13 +2421,42 @@ on future versions of
.Tn ZFS .
.It Xo
.Nm
.Cm receive
.Cm send
.Op Fl i Ar snapshot Ns | Ns Ar bookmark
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Xc
.Pp
Generate a send stream, which may be of a filesystem, and may be
incremental from a bookmark.
If the destination is a filesystem or volume,
the pool must be read-only, or the filesystem must not be mounted.
When the
stream generated from a filesystem or volume is received, the default snapshot
name will be
.Pq --head-- .
.Bl -tag -width indent
.It Fl i Ar snapshot Ns | Ns bookmark
Generate an incremental send stream.
The incremental source must be an earlier
snapshot in the destination's history.
It will commonly be an earlier
snapshot in the destination's filesystem, in which case it can be
specified as the last component of the name
.Pq the Em # No or Em @ No character and following .
.Pp
If the incremental target is a clone, the incremental source can
be the origin snapshot, or an earlier snapshot in the origin's filesystem,
or the origin's origin, etc.
.El
.It Xo
.Nm
.Cm receive Ns | Ns Cm recv
.Op Fl vnFu
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Xc
.It Xo
.Nm
.Cm receive
.Cm receive Ns | Ns Cm recv
.Op Fl vnFu
.Op Fl d | e
.Ar filesystem
@@ -2764,7 +2892,7 @@ option of
.It \&P Ta event port (not supported on Fx )
.El
.It Fl H
Give more parseable tab-separated output, without header lines and without
Give more parsable tab-separated output, without header lines and without
arrows.
.It Fl t
Display the path's inode change time as the first column of output.
+15 -7
View File
@@ -18,10 +18,13 @@
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
#include <libintl.h>
@@ -70,7 +73,7 @@ uu_avl_pool_t *avl_pool;
* Include snaps if they were requested or if this a zfs list where types
* were not specified and the "listsnapshots" property is set on this pool.
*/
static int
static boolean_t
zfs_include_snapshots(zfs_handle_t *zhp, callback_data_t *cb)
{
zpool_handle_t *zph;
@@ -90,8 +93,9 @@ static int
zfs_callback(zfs_handle_t *zhp, void *data)
{
callback_data_t *cb = data;
int dontclose = 0;
int include_snaps = zfs_include_snapshots(zhp, cb);
boolean_t dontclose = B_FALSE;
boolean_t include_snaps = zfs_include_snapshots(zhp, cb);
boolean_t include_bmarks = (cb->cb_types & ZFS_TYPE_BOOKMARK);
if ((zfs_get_type(zhp) & cb->cb_types) ||
((zfs_get_type(zhp) == ZFS_TYPE_SNAPSHOT) && include_snaps)) {
@@ -109,14 +113,15 @@ zfs_callback(zfs_handle_t *zhp, void *data)
cb->cb_props_table);
if (zfs_expand_proplist(zhp, cb->cb_proplist,
(cb->cb_flags & ZFS_ITER_RECVD_PROPS))
(cb->cb_flags & ZFS_ITER_RECVD_PROPS),
(cb->cb_flags & ZFS_ITER_LITERAL_PROPS))
!= 0) {
free(node);
return (-1);
}
}
uu_avl_insert(cb->cb_avl, node, idx);
dontclose = 1;
dontclose = B_TRUE;
} else {
free(node);
}
@@ -131,11 +136,14 @@ zfs_callback(zfs_handle_t *zhp, void *data)
cb->cb_depth++;
if (zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM)
(void) zfs_iter_filesystems(zhp, zfs_callback, data);
if ((zfs_get_type(zhp) != ZFS_TYPE_SNAPSHOT) && include_snaps) {
if (((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT |
ZFS_TYPE_BOOKMARK)) == 0) && include_snaps)
(void) zfs_iter_snapshots(zhp,
(cb->cb_flags & ZFS_ITER_SIMPLE) != 0, zfs_callback,
data);
}
if (((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT |
ZFS_TYPE_BOOKMARK)) == 0) && include_bmarks)
(void) zfs_iter_bookmarks(zhp, zfs_callback, data);
cb->cb_depth--;
}
@@ -18,9 +18,11 @@
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef ZFS_ITER_H
@@ -44,6 +46,7 @@ typedef struct zfs_sort_column {
#define ZFS_ITER_DEPTH_LIMIT (1 << 3)
#define ZFS_ITER_RECVD_PROPS (1 << 4)
#define ZFS_ITER_SIMPLE (1 << 5)
#define ZFS_ITER_LITERAL_PROPS (1 << 6)
int zfs_for_each(int, char **, int options, zfs_type_t,
zfs_sort_column_t *, zprop_list_t **, int, zfs_iter_f, void *);
File diff suppressed because it is too large. Load diff
+78 -41
View File
@@ -20,7 +20,8 @@
*/
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
*/
/*
@@ -46,6 +47,7 @@
#include <sys/zio_checksum.h>
#include <sys/zio_compress.h>
#include <sys/zfeature.h>
#include <sys/dmu_tx.h>
#undef ZFS_MAXNAMELEN
#undef verify
#include <libzfs.h>
@@ -83,10 +85,15 @@ usage(void)
static void
fatal(const char *fmt, ...)
fatal(spa_t *spa, void *tag, const char *fmt, ...)
{
va_list ap;
if (spa != NULL) {
spa_close(spa, tag);
(void) spa_export(g_pool, NULL, B_TRUE, B_FALSE);
}
va_start(ap, fmt);
(void) fprintf(stderr, "%s: ", cmdname);
(void) vfprintf(stderr, fmt, ap);
@@ -152,18 +159,19 @@ import_pool(const char *target, boolean_t readonly)
g_importargs.poolname = g_pool;
pools = zpool_search_import(g_zfs, &g_importargs);
if (pools == NULL || nvlist_next_nvpair(pools, NULL) == NULL) {
if (nvlist_empty(pools)) {
if (!g_importargs.can_be_active) {
g_importargs.can_be_active = B_TRUE;
if (zpool_search_import(g_zfs, &g_importargs) != NULL ||
spa_open(target, &spa, FTAG) == 0) {
fatal("cannot import '%s': pool is active; run "
"\"zpool export %s\" first\n",
g_pool, g_pool);
fatal(spa, FTAG, "cannot import '%s': pool is "
"active; run " "\"zpool export %s\" "
"first\n", g_pool, g_pool);
}
}
fatal("cannot import '%s': no such pool available\n", g_pool);
fatal(NULL, FTAG, "cannot import '%s': no such pool "
"available\n", g_pool);
}
elem = nvlist_next_nvpair(pools, NULL);
@@ -184,7 +192,8 @@ import_pool(const char *target, boolean_t readonly)
error = 0;
if (error)
fatal("can't import '%s': %s", name, strerror(error));
fatal(NULL, FTAG, "can't import '%s': %s", name,
strerror(error));
}
static void
@@ -199,10 +208,11 @@ zhack_spa_open(const char *target, boolean_t readonly, void *tag, spa_t **spa)
zfeature_checks_disable = B_FALSE;
if (err != 0)
fatal("cannot open '%s': %s", target, strerror(err));
fatal(*spa, FTAG, "cannot open '%s': %s", target,
strerror(err));
if (spa_version(*spa) < SPA_VERSION_FEATURES) {
fatal("'%s' has version %d, features not enabled", target,
(int)spa_version(*spa));
fatal(*spa, FTAG, "'%s' has version %d, features not enabled",
target, (int)spa_version(*spa));
}
}
@@ -267,18 +277,25 @@ zhack_do_feature_stat(int argc, char **argv)
dump_obj(os, spa->spa_feat_for_read_obj, "for_read");
dump_obj(os, spa->spa_feat_for_write_obj, "for_write");
dump_obj(os, spa->spa_feat_desc_obj, "descriptions");
if (spa_feature_is_active(spa, SPA_FEATURE_ENABLED_TXG)) {
dump_obj(os, spa->spa_feat_enabled_txg_obj, "enabled_txg");
}
dump_mos(spa);
spa_close(spa, FTAG);
}
static void
feature_enable_sync(void *arg1, void *arg2, dmu_tx_t *tx)
zhack_feature_enable_sync(void *arg, dmu_tx_t *tx)
{
spa_t *spa = arg1;
zfeature_info_t *feature = arg2;
spa_t *spa = dmu_tx_pool(tx)->dp_spa;
zfeature_info_t *feature = arg;
spa_feature_enable(spa, feature, tx);
feature_enable_sync(spa, feature, tx);
spa_history_log_internal(spa, "zhack enable feature", tx,
"name=%s can_readonly=%u",
feature->fi_guid, feature->fi_can_readonly);
}
static void
@@ -289,7 +306,7 @@ zhack_do_feature_enable(int argc, char **argv)
spa_t *spa;
objset_t *mos;
zfeature_info_t feature;
zfeature_info_t *nodeps[] = { NULL };
spa_feature_t nodeps[] = { SPA_FEATURE_NONE };
/*
* Features are not added to the pool's label until their refcounts
@@ -299,7 +316,9 @@ zhack_do_feature_enable(int argc, char **argv)
feature.fi_uname = "zhack";
feature.fi_mos = B_FALSE;
feature.fi_can_readonly = B_FALSE;
feature.fi_activate_on_enable = B_FALSE;
feature.fi_depends = nodeps;
feature.fi_feature = SPA_FEATURE_NONE;
optind = 1;
while ((c = getopt(argc, argv, "rmd:")) != -1) {
@@ -331,18 +350,19 @@ zhack_do_feature_enable(int argc, char **argv)
feature.fi_guid = argv[1];
if (!zfeature_is_valid_guid(feature.fi_guid))
fatal("invalid feature guid: %s", feature.fi_guid);
fatal(NULL, FTAG, "invalid feature guid: %s", feature.fi_guid);
zhack_spa_open(target, B_FALSE, FTAG, &spa);
mos = spa->spa_meta_objset;
if (0 == zfeature_lookup_guid(feature.fi_guid, NULL))
fatal("'%s' is a real feature, will not enable");
if (zfeature_is_supported(feature.fi_guid))
fatal(spa, FTAG, "'%s' is a real feature, will not enable");
if (0 == zap_contains(mos, spa->spa_feat_desc_obj, feature.fi_guid))
fatal("feature already enabled: %s", feature.fi_guid);
fatal(spa, FTAG, "feature already enabled: %s",
feature.fi_guid);
VERIFY3U(0, ==, dsl_sync_task_do(spa->spa_dsl_pool, NULL,
feature_enable_sync, spa, &feature, 5));
VERIFY0(dsl_sync_task(spa_name(spa), NULL,
zhack_feature_enable_sync, &feature, 5));
spa_close(spa, FTAG);
@@ -350,21 +370,29 @@ zhack_do_feature_enable(int argc, char **argv)
}
static void
feature_incr_sync(void *arg1, void *arg2, dmu_tx_t *tx)
feature_incr_sync(void *arg, dmu_tx_t *tx)
{
spa_t *spa = arg1;
zfeature_info_t *feature = arg2;
spa_t *spa = dmu_tx_pool(tx)->dp_spa;
zfeature_info_t *feature = arg;
uint64_t refcount;
spa_feature_incr(spa, feature, tx);
VERIFY0(feature_get_refcount_from_disk(spa, feature, &refcount));
feature_sync(spa, feature, refcount + 1, tx);
spa_history_log_internal(spa, "zhack feature incr", tx,
"name=%s", feature->fi_guid);
}
static void
feature_decr_sync(void *arg1, void *arg2, dmu_tx_t *tx)
feature_decr_sync(void *arg, dmu_tx_t *tx)
{
spa_t *spa = arg1;
zfeature_info_t *feature = arg2;
spa_t *spa = dmu_tx_pool(tx)->dp_spa;
zfeature_info_t *feature = arg;
uint64_t refcount;
spa_feature_decr(spa, feature, tx);
VERIFY0(feature_get_refcount_from_disk(spa, feature, &refcount));
feature_sync(spa, feature, refcount - 1, tx);
spa_history_log_internal(spa, "zhack feature decr", tx,
"name=%s", feature->fi_guid);
}
static void
@@ -376,7 +404,7 @@ zhack_do_feature_ref(int argc, char **argv)
spa_t *spa;
objset_t *mos;
zfeature_info_t feature;
zfeature_info_t *nodeps[] = { NULL };
spa_feature_t nodeps[] = { SPA_FEATURE_NONE };
/*
* fi_desc does not matter here because it was written to disk
@@ -388,6 +416,7 @@ zhack_do_feature_ref(int argc, char **argv)
feature.fi_mos = B_FALSE;
feature.fi_desc = NULL;
feature.fi_depends = nodeps;
feature.fi_feature = SPA_FEATURE_NONE;
optind = 1;
while ((c = getopt(argc, argv, "md")) != -1) {
@@ -414,13 +443,15 @@ zhack_do_feature_ref(int argc, char **argv)
feature.fi_guid = argv[1];
if (!zfeature_is_valid_guid(feature.fi_guid))
fatal("invalid feature guid: %s", feature.fi_guid);
fatal(NULL, FTAG, "invalid feature guid: %s", feature.fi_guid);
zhack_spa_open(target, B_FALSE, FTAG, &spa);
mos = spa->spa_meta_objset;
if (0 == zfeature_lookup_guid(feature.fi_guid, NULL))
fatal("'%s' is a real feature, will not change refcount");
if (zfeature_is_supported(feature.fi_guid)) {
fatal(spa, FTAG,
"'%s' is a real feature, will not change refcount");
}
if (0 == zap_contains(mos, spa->spa_feat_for_read_obj,
feature.fi_guid)) {
@@ -429,14 +460,20 @@ zhack_do_feature_ref(int argc, char **argv)
feature.fi_guid)) {
feature.fi_can_readonly = B_TRUE;
} else {
fatal("feature is not enabled: %s", feature.fi_guid);
fatal(spa, FTAG, "feature is not enabled: %s", feature.fi_guid);
}
if (decr && !spa_feature_is_active(spa, &feature))
fatal("feature refcount already 0: %s", feature.fi_guid);
if (decr) {
uint64_t count;
if (feature_get_refcount_from_disk(spa, &feature,
&count) == 0 && count != 0) {
fatal(spa, FTAG, "feature refcount already 0: %s",
feature.fi_guid);
}
}
VERIFY3U(0, ==, dsl_sync_task_do(spa->spa_dsl_pool, NULL,
decr ? feature_decr_sync : feature_incr_sync, spa, &feature, 5));
VERIFY0(dsl_sync_task(spa_name(spa), NULL,
decr ? feature_decr_sync : feature_incr_sync, &feature, 5));
spa_close(spa, FTAG);
}
@@ -521,8 +558,8 @@ main(int argc, char **argv)
usage();
}
if (!g_readonly && spa_export(g_pool, NULL, B_TRUE, B_TRUE) != 0) {
fatal("pool export failed; "
if (!g_readonly && spa_export(g_pool, NULL, B_TRUE, B_FALSE) != 0) {
fatal(NULL, FTAG, "pool export failed; "
"changes may not be committed to disk\n");
}
@@ -147,6 +147,7 @@
#include <sys/mount.h>
#include <libzfs.h>
#include <libzfs_compat.h>
#undef verify /* both libzfs.h and zfs_context.h want to define this */
@@ -19,10 +19,11 @@
.\"
.\" Copyright (c) 2012 by Delphix. All rights reserved.
.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
.\" Copyright (c) 2013, Joyent, Inc. All rights reserved.
.\"
.\" $FreeBSD$
.\"
.Dd February 8, 2013
.Dd January 2, 2014
.Dt ZPOOL-FEATURES 7
.Os
.Sh NAME
@@ -221,14 +222,163 @@ command. Please note that doing so will
immediately activate the
.Sy lz4_compress
feature on the underlying
pool (even before any data is written). Since this feature is not
read-only compatible, this operation will render the pool unimportable
on systems without support for the
pool
.Pq even before any data is written ,
and the feature will not be
deactivated.
Since this feature is not read-only compatible, this
operation will render the pool unimportable on systems without support
for the
.Sy lz4_compress
feature. At the
moment, this operation cannot be reversed. Booting off of
feature.
Booting off of
.Sy lz4
-compressed root pools is supported.
.It Sy multi_vdev_crash_dump
.Bl -column "READ\-ONLY COMPATIBLE" "com.joyent:multi_vdev_crash_dump"
.It GUID Ta com.joyent:multi_vdev_crash_dump
.It READ\-ONLY COMPATIBLE Ta no
.It DEPENDENCIES Ta none
.El
.Pp
This feature allows a dump device to be configured with a pool comprised
of multiple vdevs.
Those vdevs may be arranged in any mirrored or raidz
configuration.
.\" TODO: this is not yet supported on FreeBSD.
.\" .Pp
.\" When the
.\" .Sy multi_vdev_crash_dump
.\" feature is set to
.\" .Sy enabled ,
.\" the administrator can use the
.\" .Xr dumpon 8
.\" command to configure a
.\" dump device on a pool comprised of multiple vdevs.
.It Sy spacemap_histogram
.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:spacemap_histogram"
.It GUID Ta com.delphix:spacemap_histogram
.It READ\-ONLY COMPATIBLE Ta yes
.It DEPENDENCIES Ta none
.El
.Pp
This features allows ZFS to maintain more information about how free space
is organized within the pool. If this feature is
.Sy enabled ,
ZFS will
set this feature to
.Sy active
when a new space map object is created or
an existing space map is upgraded to the new format.
Once the feature is
.Sy active ,
it will remain in that state until the pool is destroyed.
.It Sy extensible_dataset
.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:extensible_dataset"
.It GUID Ta com.delphix:extensible_dataset
.It READ\-ONLY COMPATIBLE Ta no
.It DEPENDENCIES Ta none
.El
.Pp
This feature allows more flexible use of internal ZFS data structures,
and exists for other features to depend on.
.Pp
This feature will be
.Sy active
when the first dependent feature uses it,
and will be returned to the
.Sy enabled
state when all datasets that use
this feature are destroyed.
.It Sy bookmarks
.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:bookmarks"
.It GUID Ta com.delphix:bookmarks
.It READ\-ONLY COMPATIBLE Ta yes
.It DEPENDENCIES Ta extensible_dataset
.El
.Pp
This feature enables use of the
.Nm zfs
.Cm bookmark
subcommand.
.Pp
This feature is
.Sy active
while any bookmarks exist in the pool.
All bookmarks in the pool can be listed by running
.Nm zfs
.Cm list
.Fl t No bookmark Fl r Ar poolname .
.It Sy enabled_txg
.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:enabled_txg"
.It GUID Ta com.delphix:enabled_txg
.It READ\-ONLY COMPATIBLE Ta yes
.It DEPENDENCIES Ta none
.El
.Pp
Once this feature is enabled ZFS records the transaction group number
in which new features are enabled. This has no user-visible impact,
but other features may depend on this feature.
.Pp
This feature becomes
.Sy active
as soon as it is enabled and will
never return to being
.Sy enabled .
.It Sy hole_birth
.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:hole_birth"
.It GUID Ta com.delphix:hole_birth
.It READ\-ONLY COMPATIBLE Ta no
.It DEPENDENCIES Ta enabled_txg
.El
.Pp
This feature improves performance of incremental sends
.Pq Dq zfs send -i
and receives for objects with many holes.
The most common case of
hole-filled objects is zvols.
.Pp
An incremental send stream from snapshot
.Sy A
to snapshot
.Sy B
contains information about every block that changed between
.Sy A
and
.Sy B .
Blocks which did not change between those snapshots can be
identified and omitted from the stream using a piece of metadata called
the 'block birth time', but birth times are not recorded for holes
.Pq blocks filled only with zeroes .
Since holes created after
.Sy A
cannot be
distinguished from holes created before
.Sy A ,
information about every
hole in the entire filesystem or zvol is included in the send stream.
.Pp
For workloads where holes are rare this is not a problem.
However, when
incrementally replicating filesystems or zvols with many holes
.Pq for example a zvol formatted with another filesystem
a lot of time will
be spent sending and receiving unnecessary information about holes that
already exist on the receiving side.
.Pp
Once the
.Sy hole_birth
feature has been enabled the block birth times
of all new holes will be recorded.
Incremental sends between snapshots
created after this feature is enabled will use this new metadata to avoid
sending information about holes that already exist on the receiving side.
.Pp
This feature becomes
.Sy active
as soon as it is enabled and will
never return to being
.Sy enabled .
.El
.Sh SEE ALSO
.Xr zpool 8
+20 -3
View File
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 15, 2012
.Dd December 31, 2013
.Dt ZPOOL 8
.Os
.Sh NAME
@@ -141,6 +141,9 @@
.Cm remove
.Ar pool device ...
.Nm
.Cm reopen
.Ar pool
.Nm
.Cm replace
.Op Fl f
.Ar pool device
@@ -1431,6 +1434,13 @@ command. Non-redundant and
devices cannot be removed from a pool.
.It Xo
.Nm
.Cm reopen
.Ar pool
.Xc
.Pp
Reopen all the vdevs associated with the pool.
.It Xo
.Nm
.Cm replace
.Op Fl f
.Ar pool device
@@ -1608,14 +1618,15 @@ is specified, the command exits after
.Ar count
reports are printed.
.Pp
If a scrub or resilver is in progress, this command reports the percentage done
and the estimated time to completion. Both of these are only approximate,
If a scrub or resilver is in progress, this command reports the percentage
done and the estimated time to completion. Both of these are only approximate,
because the amount of data in the pool and the other workloads on the system
can change.
.Bl -tag -width indent
.It Fl x
Only display status for pools that are exhibiting errors or are otherwise
unavailable.
Warnings about pools not using the latest on-disk format will not be included.
.It Fl v
Displays verbose data error information, printing out a complete list of all
data errors since the last complete pool scrub.
@@ -1945,3 +1956,9 @@ The
.Xr mdoc 7
implementation of this manual page was initially written by
.An Martin Matuska Aq [email protected] .
.Sh CAVEATS
The
.Cm spare
feature requires a utility to detect zpool degradation and initiate
disk replacement within the zpool. FreeBSD does not provide such a
utility at this time.
+194 -95
View File
@@ -22,7 +22,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2012 by Frederik Wessels. All rights reserved.
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
*/
@@ -192,9 +192,9 @@ static zpool_command_t command_table[] = {
#define NCOMMAND (sizeof (command_table) / sizeof (command_table[0]))
zpool_command_t *current_command;
static zpool_command_t *current_command;
static char history_str[HIS_MAX_RECORD_LEN];
static boolean_t log_history = B_TRUE;
static uint_t timestamp_fmt = NODATE;
static const char *
@@ -247,7 +247,7 @@ get_usage(zpool_help_t idx) {
case HELP_REMOVE:
return (gettext("\tremove <pool> <device> ...\n"));
case HELP_REOPEN:
return (""); /* Undocumented command */
return (gettext("\treopen <pool>\n"));
case HELP_SCRUB:
return (gettext("\tscrub [-s] <pool> ...\n"));
case HELP_STATUS:
@@ -804,6 +804,7 @@ zpool_do_create(int argc, char **argv)
goto errout;
break;
case 'm':
/* Equivalent to -O mountpoint=optarg */
mountpoint = optarg;
break;
case 'o':
@@ -842,8 +843,18 @@ zpool_do_create(int argc, char **argv)
*propval = '\0';
propval++;
if (add_prop_list(optarg, propval, &fsprops, B_FALSE))
/*
* Mountpoints are checked and then added later.
* Uniquely among properties, they can be specified
* more than once, to avoid conflict with -m.
*/
if (0 == strcmp(optarg,
zfs_prop_to_name(ZFS_PROP_MOUNTPOINT))) {
mountpoint = propval;
} else if (add_prop_list(optarg, propval, &fsprops,
B_FALSE)) {
goto errout;
}
break;
case ':':
(void) fprintf(stderr, gettext("missing argument for "
@@ -856,6 +867,16 @@ zpool_do_create(int argc, char **argv)
}
}
#ifdef __FreeBSD__
/* Compatiblity with FreeBSD 9.0 and 9.1: Use version 28 if unspecified */
if (enable_all_pool_feat && !prop_list_contains_feature(props)) {
if (add_prop_list(zpool_prop_to_name(
ZPOOL_PROP_VERSION), "28", &props, B_TRUE))
goto errout;
enable_all_pool_feat = B_FALSE;
}
#endif /* __FreeBSD__ */
argc -= optind;
argv += optind;
@@ -960,6 +981,18 @@ zpool_do_create(int argc, char **argv)
}
}
/*
* Now that the mountpoint's validity has been checked, ensure that
* the property is set appropriately prior to creating the pool.
*/
if (mountpoint != NULL) {
ret = add_prop_list(zfs_prop_to_name(ZFS_PROP_MOUNTPOINT),
mountpoint, &fsprops, B_FALSE);
if (ret != 0)
goto errout;
}
ret = 1;
if (dryrun) {
/*
* For a dry run invocation, print out a basic message and run
@@ -979,7 +1012,7 @@ zpool_do_create(int argc, char **argv)
* Hand off to libzfs.
*/
if (enable_all_pool_feat) {
int i;
spa_feature_t i;
for (i = 0; i < SPA_FEATURES; i++) {
char propname[MAXPATHLEN];
zfeature_info_t *feat = &spa_feature_table[i];
@@ -994,21 +1027,19 @@ zpool_do_create(int argc, char **argv)
if (nvlist_exists(props, propname))
continue;
if (add_prop_list(propname, ZFS_FEATURE_ENABLED,
&props, B_TRUE) != 0)
ret = add_prop_list(propname,
ZFS_FEATURE_ENABLED, &props, B_TRUE);
if (ret != 0)
goto errout;
}
}
ret = 1;
if (zpool_create(g_zfs, poolname,
nvroot, props, fsprops) == 0) {
zfs_handle_t *pool = zfs_open(g_zfs, poolname,
ZFS_TYPE_FILESYSTEM);
if (pool != NULL) {
if (mountpoint != NULL)
verify(zfs_prop_set(pool,
zfs_prop_to_name(
ZFS_PROP_MOUNTPOINT),
mountpoint) == 0);
if (zfs_mount(pool, NULL, 0) == 0)
ret = zfs_shareall(pool);
zfs_close(pool);
@@ -1092,7 +1123,10 @@ zpool_do_destroy(int argc, char **argv)
return (1);
}
ret = (zpool_destroy(zhp) != 0);
/* The history must be logged as part of the export */
log_history = B_FALSE;
ret = (zpool_destroy(zhp, history_str) != 0);
zpool_close(zhp);
@@ -1156,10 +1190,13 @@ zpool_do_export(int argc, char **argv)
continue;
}
/* The history must be logged as part of the export */
log_history = B_FALSE;
if (hardforce) {
if (zpool_export_force(zhp) != 0)
if (zpool_export_force(zhp, history_str) != 0)
ret = 1;
} else if (zpool_export(zhp, force) != 0) {
} else if (zpool_export(zhp, force, history_str) != 0) {
ret = 1;
}
@@ -1267,12 +1304,13 @@ print_status_config(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
int namewidth, int depth, boolean_t isspare)
{
nvlist_t **child;
uint_t c, children;
uint_t c, vsc, children;
pool_scan_stat_t *ps = NULL;
vdev_stat_t *vs;
char rbuf[6], wbuf[6], cbuf[6];
char *vname;
uint64_t notpresent;
uint64_t ashift;
spare_cbdata_t cb;
const char *state;
@@ -1281,7 +1319,7 @@ print_status_config(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
children = 0;
verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
(uint64_t **)&vs, &c) == 0);
(uint64_t **)&vs, &vsc) == 0);
state = zpool_state_to_name(vs->vs_state, vs->vs_aux);
if (isspare) {
@@ -1335,6 +1373,10 @@ print_status_config(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
(void) printf(gettext("unsupported feature(s)"));
break;
case VDEV_AUX_ASHIFT_TOO_BIG:
(void) printf(gettext("unsupported minimum blocksize"));
break;
case VDEV_AUX_SPARED:
verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID,
&cb.cb_guid) == 0);
@@ -1377,6 +1419,12 @@ print_status_config(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
(void) printf(gettext("corrupted data"));
break;
}
} else if (children == 0 && !isspare &&
VDEV_STAT_VALID(vs_physical_ashift, vsc) &&
vs->vs_configured_ashift < vs->vs_physical_ashift) {
(void) printf(
gettext(" block size: %dB configured, %dB native"),
1 << vs->vs_configured_ashift, 1 << vs->vs_physical_ashift);
}
(void) nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_SCAN_STATS,
@@ -3672,22 +3720,37 @@ zpool_do_reguid(int argc, char **argv)
* zpool reopen <pool>
*
* Reopen the pool so that the kernel can update the sizes of all vdevs.
*
* NOTE: This command is currently undocumented. If the command is ever
* exposed then the appropriate usage() messages will need to be made.
*/
int
zpool_do_reopen(int argc, char **argv)
{
int c;
int ret = 0;
zpool_handle_t *zhp;
char *pool;
/* check options */
while ((c = getopt(argc, argv, "")) != -1) {
switch (c) {
case '?':
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
optopt);
usage(B_FALSE);
}
}
argc--;
argv++;
if (argc != 1)
return (2);
if (argc < 1) {
(void) fprintf(stderr, gettext("missing pool name\n"));
usage(B_FALSE);
}
if (argc > 1) {
(void) fprintf(stderr, gettext("too many arguments\n"));
usage(B_FALSE);
}
pool = argv[0];
if ((zhp = zpool_open_canfail(g_zfs, pool)) == NULL)
@@ -4030,7 +4093,10 @@ status_callback(zpool_handle_t *zhp, void *data)
* If we were given 'zpool status -x', only report those pools with
* problems.
*/
if (reason == ZPOOL_STATUS_OK && cbp->cb_explain) {
if (cbp->cb_explain &&
(reason == ZPOOL_STATUS_OK ||
reason == ZPOOL_STATUS_VERSION_OLDER ||
reason == ZPOOL_STATUS_FEAT_DISABLED)) {
if (!cbp->cb_allpools) {
(void) printf(gettext("pool '%s' is healthy\n"),
zpool_get_name(zhp));
@@ -4237,6 +4303,15 @@ status_callback(zpool_handle_t *zhp, void *data)
"'zpool clear'.\n"));
break;
case ZPOOL_STATUS_NON_NATIVE_ASHIFT:
(void) printf(gettext("status: One or more devices are "
"configured to use a non-native block size.\n"
"\tExpect reduced performance.\n"));
(void) printf(gettext("action: Replace affected devices with "
"devices that support the\n\tconfigured block size, or "
"migrate data to a properly configured\n\tpool.\n"));
break;
default:
/*
* The remaining errors can't actually be generated, yet.
@@ -4559,6 +4634,14 @@ upgrade_cb(zpool_handle_t *zhp, void *arg)
if (count > 0) {
cbp->cb_first = B_FALSE;
printnl = B_TRUE;
/*
* If they did "zpool upgrade -a", then we could
* be doing ioctls to different pools. We need
* to log this history once to each pool, and bypass
* the normal history logging that happens in main().
*/
(void) zpool_log_history(g_zfs, history_str);
log_history = B_FALSE;
}
}
@@ -4920,8 +5003,8 @@ zpool_do_upgrade(int argc, char **argv)
typedef struct hist_cbdata {
boolean_t first;
int longfmt;
int internal;
boolean_t longfmt;
boolean_t internal;
} hist_cbdata_t;
/*
@@ -4933,21 +5016,8 @@ get_history_one(zpool_handle_t *zhp, void *data)
nvlist_t *nvhis;
nvlist_t **records;
uint_t numrecords;
char *cmdstr;
char *pathstr;
uint64_t dst_time;
time_t tsec;
struct tm t;
char tbuf[30];
int ret, i;
uint64_t who;
struct passwd *pwd;
char *hostname;
char *zonename;
char internalstr[MAXPATHLEN];
hist_cbdata_t *cb = (hist_cbdata_t *)data;
uint64_t txg;
uint64_t ievent;
cb->first = B_FALSE;
@@ -4959,64 +5029,94 @@ get_history_one(zpool_handle_t *zhp, void *data)
verify(nvlist_lookup_nvlist_array(nvhis, ZPOOL_HIST_RECORD,
&records, &numrecords) == 0);
for (i = 0; i < numrecords; i++) {
if (nvlist_lookup_uint64(records[i], ZPOOL_HIST_TIME,
&dst_time) != 0)
continue;
nvlist_t *rec = records[i];
char tbuf[30] = "";
/* is it an internal event or a standard event? */
if (nvlist_lookup_string(records[i], ZPOOL_HIST_CMD,
&cmdstr) != 0) {
if (cb->internal == 0)
continue;
if (nvlist_exists(rec, ZPOOL_HIST_TIME)) {
time_t tsec;
struct tm t;
if (nvlist_lookup_uint64(records[i],
ZPOOL_HIST_INT_EVENT, &ievent) != 0)
continue;
verify(nvlist_lookup_uint64(records[i],
ZPOOL_HIST_TXG, &txg) == 0);
verify(nvlist_lookup_string(records[i],
ZPOOL_HIST_INT_STR, &pathstr) == 0);
if (ievent >= LOG_END)
continue;
(void) snprintf(internalstr,
sizeof (internalstr),
"[internal %s txg:%lld] %s",
zfs_history_event_names[ievent], txg,
pathstr);
cmdstr = internalstr;
tsec = fnvlist_lookup_uint64(records[i],
ZPOOL_HIST_TIME);
(void) localtime_r(&tsec, &t);
(void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t);
}
if (nvlist_exists(rec, ZPOOL_HIST_CMD)) {
(void) printf("%s %s", tbuf,
fnvlist_lookup_string(rec, ZPOOL_HIST_CMD));
} else if (nvlist_exists(rec, ZPOOL_HIST_INT_EVENT)) {
int ievent =
fnvlist_lookup_uint64(rec, ZPOOL_HIST_INT_EVENT);
if (!cb->internal)
continue;
if (ievent >= ZFS_NUM_LEGACY_HISTORY_EVENTS) {
(void) printf("%s unrecognized record:\n",
tbuf);
dump_nvlist(rec, 4);
continue;
}
(void) printf("%s [internal %s txg:%lld] %s", tbuf,
zfs_history_event_names[ievent],
fnvlist_lookup_uint64(rec, ZPOOL_HIST_TXG),
fnvlist_lookup_string(rec, ZPOOL_HIST_INT_STR));
} else if (nvlist_exists(rec, ZPOOL_HIST_INT_NAME)) {
if (!cb->internal)
continue;
(void) printf("%s [txg:%lld] %s", tbuf,
fnvlist_lookup_uint64(rec, ZPOOL_HIST_TXG),
fnvlist_lookup_string(rec, ZPOOL_HIST_INT_NAME));
if (nvlist_exists(rec, ZPOOL_HIST_DSNAME)) {
(void) printf(" %s (%llu)",
fnvlist_lookup_string(rec,
ZPOOL_HIST_DSNAME),
fnvlist_lookup_uint64(rec,
ZPOOL_HIST_DSID));
}
(void) printf(" %s", fnvlist_lookup_string(rec,
ZPOOL_HIST_INT_STR));
} else if (nvlist_exists(rec, ZPOOL_HIST_IOCTL)) {
if (!cb->internal)
continue;
(void) printf("%s ioctl %s\n", tbuf,
fnvlist_lookup_string(rec, ZPOOL_HIST_IOCTL));
if (nvlist_exists(rec, ZPOOL_HIST_INPUT_NVL)) {
(void) printf(" input:\n");
dump_nvlist(fnvlist_lookup_nvlist(rec,
ZPOOL_HIST_INPUT_NVL), 8);
}
if (nvlist_exists(rec, ZPOOL_HIST_OUTPUT_NVL)) {
(void) printf(" output:\n");
dump_nvlist(fnvlist_lookup_nvlist(rec,
ZPOOL_HIST_OUTPUT_NVL), 8);
}
} else {
if (!cb->internal)
continue;
(void) printf("%s unrecognized record:\n", tbuf);
dump_nvlist(rec, 4);
}
tsec = dst_time;
(void) localtime_r(&tsec, &t);
(void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t);
(void) printf("%s %s", tbuf, cmdstr);
if (!cb->longfmt) {
(void) printf("\n");
continue;
}
(void) printf(" [");
if (nvlist_lookup_uint64(records[i],
ZPOOL_HIST_WHO, &who) == 0) {
pwd = getpwuid((uid_t)who);
if (pwd)
(void) printf("user %s on",
pwd->pw_name);
else
(void) printf("user %d on",
(int)who);
} else {
(void) printf(gettext("no info]\n"));
continue;
if (nvlist_exists(rec, ZPOOL_HIST_WHO)) {
uid_t who = fnvlist_lookup_uint64(rec, ZPOOL_HIST_WHO);
struct passwd *pwd = getpwuid(who);
(void) printf("user %d ", (int)who);
if (pwd != NULL)
(void) printf("(%s) ", pwd->pw_name);
}
if (nvlist_lookup_string(records[i],
ZPOOL_HIST_HOST, &hostname) == 0) {
(void) printf(" %s", hostname);
if (nvlist_exists(rec, ZPOOL_HIST_HOST)) {
(void) printf("on %s",
fnvlist_lookup_string(rec, ZPOOL_HIST_HOST));
}
if (nvlist_lookup_string(records[i],
ZPOOL_HIST_ZONE, &zonename) == 0) {
(void) printf(":%s", zonename);
if (nvlist_exists(rec, ZPOOL_HIST_ZONE)) {
(void) printf(":%s",
fnvlist_lookup_string(rec, ZPOOL_HIST_ZONE));
}
(void) printf("]");
(void) printf("\n");
}
@@ -5031,8 +5131,6 @@ get_history_one(zpool_handle_t *zhp, void *data)
*
* Displays the history of commands that modified pools.
*/
int
zpool_do_history(int argc, char **argv)
{
@@ -5045,10 +5143,10 @@ zpool_do_history(int argc, char **argv)
while ((c = getopt(argc, argv, "li")) != -1) {
switch (c) {
case 'l':
cbdata.longfmt = 1;
cbdata.longfmt = B_TRUE;
break;
case 'i':
cbdata.internal = 1;
cbdata.internal = B_TRUE;
break;
case '?':
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
@@ -5273,8 +5371,7 @@ main(int argc, char **argv)
if (strcmp(cmdname, "-?") == 0)
usage(B_TRUE);
zpool_set_history_str("zpool", argc, argv, history_str);
verify(zpool_stage_history(g_zfs, history_str) == 0);
zfs_save_arguments(argc, argv, history_str, sizeof (history_str));
/*
* Run the appropriate command.
@@ -5291,16 +5388,18 @@ main(int argc, char **argv)
* 'freeze' is a vile debugging abomination, so we treat
* it as such.
*/
char buf[16384];
int fd = open(ZFS_DEV, O_RDWR);
(void) strcpy((void *)buf, argv[2]);
return (!!ioctl(fd, ZFS_IOC_POOL_FREEZE, buf));
zfs_cmd_t zc = { 0 };
(void) strlcpy(zc.zc_name, argv[2], sizeof (zc.zc_name));
return (!!zfs_ioctl(g_zfs, ZFS_IOC_POOL_FREEZE, &zc));
} else {
(void) fprintf(stderr, gettext("unrecognized "
"command '%s'\n"), cmdname);
usage(B_FALSE);
}
if (ret == 0 && log_history)
(void) zpool_log_history(g_zfs, history_str);
libzfs_fini(g_zfs);
/*
+248 -158
View File
@@ -20,9 +20,10 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
*/
/*
@@ -104,10 +105,12 @@
#include <sys/metaslab_impl.h>
#include <sys/dsl_prop.h>
#include <sys/dsl_dataset.h>
#include <sys/dsl_destroy.h>
#include <sys/dsl_scan.h>
#include <sys/zio_checksum.h>
#include <sys/refcount.h>
#include <sys/zfeature.h>
#include <sys/dsl_userhold.h>
#include <stdio.h>
#include <stdio_ext.h>
#include <stdlib.h>
@@ -121,8 +124,8 @@
#include <sys/fs/zfs.h>
#include <libnvpair.h>
#define ZTEST_FD_DATA 3
#define ZTEST_FD_RAND 4
static int ztest_fd_data = -1;
static int ztest_fd_rand = -1;
typedef struct ztest_shared_hdr {
uint64_t zh_hdr_size;
@@ -183,6 +186,7 @@ static const ztest_shared_opts_t ztest_opts_defaults = {
extern uint64_t metaslab_gang_bang;
extern uint64_t metaslab_df_alloc_threshold;
extern uint64_t zfs_deadman_synctime_ms;
static ztest_shared_opts_t *ztest_shared_opts;
static ztest_shared_opts_t ztest_opts;
@@ -362,12 +366,12 @@ ztest_info_t ztest_info[] = {
{ ztest_fault_inject, 1, &zopt_sometimes },
{ ztest_ddt_repair, 1, &zopt_sometimes },
{ ztest_dmu_snapshot_hold, 1, &zopt_sometimes },
{ ztest_reguid, 1, &zopt_sometimes },
{ ztest_reguid, 1, &zopt_rarely },
{ ztest_spa_rename, 1, &zopt_rarely },
{ ztest_scrub, 1, &zopt_rarely },
{ ztest_spa_upgrade, 1, &zopt_rarely },
{ ztest_dsl_dataset_promote_busy, 1, &zopt_rarely },
{ ztest_vdev_attach_detach, 1, &zopt_rarely },
{ ztest_vdev_attach_detach, 1, &zopt_sometimes },
{ ztest_vdev_LUN_growth, 1, &zopt_rarely },
{ ztest_vdev_add_remove, 1,
&ztest_opts.zo_vdevtime },
@@ -713,14 +717,17 @@ process_options(int argc, char **argv)
UINT64_MAX >> 2);
if (strlen(altdir) > 0) {
char cmd[MAXNAMELEN];
char realaltdir[MAXNAMELEN];
char *cmd;
char *realaltdir;
char *bin;
char *ztest;
char *isa;
int isalen;
(void) realpath(getexecname(), cmd);
cmd = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
realaltdir = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
VERIFY(NULL != realpath(getexecname(), cmd));
if (0 != access(altdir, F_OK)) {
ztest_dump_core = B_FALSE;
fatal(B_TRUE, "invalid alternate ztest path: %s",
@@ -751,6 +758,9 @@ process_options(int argc, char **argv)
fatal(B_TRUE, "invalid alternate lib directory %s",
zo->zo_alt_libpath);
}
umem_free(cmd, MAXPATHLEN);
umem_free(realaltdir, MAXPATHLEN);
}
}
@@ -759,6 +769,16 @@ ztest_kill(ztest_shared_t *zs)
{
zs->zs_alloc = metaslab_class_get_alloc(spa_normal_class(ztest_spa));
zs->zs_space = metaslab_class_get_space(spa_normal_class(ztest_spa));
/*
* Before we kill off ztest, make sure that the config is updated.
* See comment above spa_config_sync().
*/
mutex_enter(&spa_namespace_lock);
spa_config_sync(ztest_spa, B_FALSE, B_FALSE);
mutex_exit(&spa_namespace_lock);
zfs_dbgmsg_print(FTAG);
(void) kill(getpid(), SIGKILL);
}
@@ -767,10 +787,12 @@ ztest_random(uint64_t range)
{
uint64_t r;
ASSERT3S(ztest_fd_rand, >=, 0);
if (range == 0)
return (0);
if (read(ZTEST_FD_RAND, &r, sizeof (r)) != sizeof (r))
if (read(ztest_fd_rand, &r, sizeof (r)) != sizeof (r))
fatal(1, "short read from /dev/urandom");
return (r % range);
@@ -1000,9 +1022,8 @@ ztest_dsl_prop_set_uint64(char *osname, zfs_prop_t prop, uint64_t value,
uint64_t curval;
int error;
error = dsl_prop_set(osname, propname,
(inherit ? ZPROP_SRC_NONE : ZPROP_SRC_LOCAL),
sizeof (value), 1, &value);
error = dsl_prop_set_int(osname, propname,
(inherit ? ZPROP_SRC_NONE : ZPROP_SRC_LOCAL), value);
if (error == ENOSPC) {
ztest_record_enospc(FTAG);
@@ -1010,8 +1031,7 @@ ztest_dsl_prop_set_uint64(char *osname, zfs_prop_t prop, uint64_t value,
}
ASSERT0(error);
VERIFY3U(dsl_prop_get(osname, propname, sizeof (curval),
1, &curval, setpoint), ==, 0);
VERIFY0(dsl_prop_get_integer(osname, propname, &curval, setpoint));
if (ztest_opts.zo_verbose >= 6) {
VERIFY(zfs_prop_index_to_string(prop, curval, &valname) == 0);
@@ -2324,7 +2344,7 @@ ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id)
*/
nvroot = make_vdev_root("/dev/bogus", NULL, NULL, 0, 0, 0, 0, 0, 1);
VERIFY3U(ENOENT, ==,
spa_create("ztest_bad_file", nvroot, NULL, NULL, NULL));
spa_create("ztest_bad_file", nvroot, NULL, NULL));
nvlist_free(nvroot);
/*
@@ -2332,7 +2352,7 @@ ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id)
*/
nvroot = make_vdev_root("/dev/bogus", NULL, NULL, 0, 0, 0, 0, 2, 1);
VERIFY3U(ENOENT, ==,
spa_create("ztest_bad_mirror", nvroot, NULL, NULL, NULL));
spa_create("ztest_bad_mirror", nvroot, NULL, NULL));
nvlist_free(nvroot);
/*
@@ -2341,7 +2361,7 @@ ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id)
*/
(void) rw_rdlock(&ztest_name_lock);
nvroot = make_vdev_root("/dev/bogus", NULL, NULL, 0, 0, 0, 0, 0, 1);
VERIFY3U(EEXIST, ==, spa_create(zo->zo_pool, nvroot, NULL, NULL, NULL));
VERIFY3U(EEXIST, ==, spa_create(zo->zo_pool, nvroot, NULL, NULL));
nvlist_free(nvroot);
VERIFY3U(0, ==, spa_open(zo->zo_pool, &spa, FTAG));
VERIFY3U(EBUSY, ==, spa_destroy(zo->zo_pool));
@@ -2399,7 +2419,7 @@ ztest_spa_upgrade(ztest_ds_t *zd, uint64_t id)
props = fnvlist_alloc();
fnvlist_add_uint64(props,
zpool_prop_to_name(ZPOOL_PROP_VERSION), version);
VERIFY0(spa_create(name, nvroot, props, NULL, NULL));
VERIFY0(spa_create(name, nvroot, props, NULL));
fnvlist_free(nvroot);
fnvlist_free(props);
@@ -2473,8 +2493,7 @@ ztest_vdev_add_remove(ztest_ds_t *zd, uint64_t id)
int error;
VERIFY(mutex_lock(&ztest_vdev_lock) == 0);
leaves =
MAX(zs->zs_mirrors + zs->zs_splits, 1) * ztest_opts.zo_raidz;
leaves = MAX(zs->zs_mirrors + zs->zs_splits, 1) * ztest_opts.zo_raidz;
spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER);
@@ -2724,7 +2743,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
uint64_t leaf, top;
uint64_t ashift = ztest_get_ashift();
uint64_t oldguid, pguid;
size_t oldsize, newsize;
uint64_t oldsize, newsize;
char oldpath[MAXPATHLEN], newpath[MAXPATHLEN];
int replacing;
int oldvd_has_siblings = B_FALSE;
@@ -2883,8 +2902,8 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
if (error != expected_error && expected_error != EBUSY) {
fatal(0, "attach (%s %llu, %s %llu, %d) "
"returned %d, expected %d",
oldpath, (longlong_t)oldsize, newpath,
(longlong_t)newsize, replacing, error, expected_error);
oldpath, oldsize, newpath,
newsize, replacing, error, expected_error);
}
VERIFY(mutex_unlock(&ztest_vdev_lock) == 0);
@@ -3174,7 +3193,7 @@ ztest_objset_destroy_cb(const char *name, void *arg)
/*
* Verify that the dataset contains a directory object.
*/
VERIFY3U(0, ==, dmu_objset_hold(name, FTAG, &os));
VERIFY0(dmu_objset_own(name, DMU_OST_OTHER, B_TRUE, FTAG, &os));
error = dmu_object_info(os, ZTEST_DIROBJ, &doi);
if (error != ENOENT) {
/* We could have crashed in the middle of destroying it */
@@ -3182,12 +3201,16 @@ ztest_objset_destroy_cb(const char *name, void *arg)
ASSERT3U(doi.doi_type, ==, DMU_OT_ZAP_OTHER);
ASSERT3S(doi.doi_physical_blocks_512, >=, 0);
}
dmu_objset_rele(os, FTAG);
dmu_objset_disown(os, FTAG);
/*
* Destroy the dataset.
*/
VERIFY3U(0, ==, dmu_objset_destroy(name, B_FALSE));
if (strchr(name, '@') != NULL) {
VERIFY0(dsl_destroy_snapshot(name, B_FALSE));
} else {
VERIFY0(dsl_destroy_head(name));
}
return (0);
}
@@ -3197,17 +3220,17 @@ ztest_snapshot_create(char *osname, uint64_t id)
char snapname[MAXNAMELEN];
int error;
(void) snprintf(snapname, MAXNAMELEN, "%s@%llu", osname,
(u_longlong_t)id);
(void) snprintf(snapname, sizeof (snapname), "%llu", (u_longlong_t)id);
error = dmu_objset_snapshot(osname, strchr(snapname, '@') + 1,
NULL, NULL, B_FALSE, B_FALSE, -1);
error = dmu_objset_snapshot_one(osname, snapname);
if (error == ENOSPC) {
ztest_record_enospc(FTAG);
return (B_FALSE);
}
if (error != 0 && error != EEXIST)
fatal(0, "ztest_snapshot_create(%s) = %d", snapname, error);
if (error != 0 && error != EEXIST) {
fatal(0, "ztest_snapshot_create(%s@%s) = %d", osname,
snapname, error);
}
return (B_TRUE);
}
@@ -3220,7 +3243,7 @@ ztest_snapshot_destroy(char *osname, uint64_t id)
(void) snprintf(snapname, MAXNAMELEN, "%s@%llu", osname,
(u_longlong_t)id);
error = dmu_objset_destroy(snapname, B_FALSE);
error = dsl_destroy_snapshot(snapname, B_FALSE);
if (error != 0 && error != ENOENT)
fatal(0, "ztest_snapshot_destroy(%s) = %d", snapname, error);
return (B_TRUE);
@@ -3266,7 +3289,8 @@ ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id)
/*
* Verify that the destroyed dataset is no longer in the namespace.
*/
VERIFY3U(ENOENT, ==, dmu_objset_hold(name, FTAG, &os));
VERIFY3U(ENOENT, ==, dmu_objset_own(name, DMU_OST_OTHER, B_TRUE,
FTAG, &os));
/*
* Verify that we can create a new dataset.
@@ -3281,8 +3305,7 @@ ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id)
fatal(0, "dmu_objset_create(%s) = %d", name, error);
}
VERIFY3U(0, ==,
dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os));
VERIFY0(dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os));
ztest_zd_init(&zdtmp, NULL, os);
@@ -3358,21 +3381,21 @@ ztest_dsl_dataset_cleanup(char *osname, uint64_t id)
(void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id);
(void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id);
error = dmu_objset_destroy(clone2name, B_FALSE);
error = dsl_destroy_head(clone2name);
if (error && error != ENOENT)
fatal(0, "dmu_objset_destroy(%s) = %d", clone2name, error);
error = dmu_objset_destroy(snap3name, B_FALSE);
fatal(0, "dsl_destroy_head(%s) = %d", clone2name, error);
error = dsl_destroy_snapshot(snap3name, B_FALSE);
if (error && error != ENOENT)
fatal(0, "dmu_objset_destroy(%s) = %d", snap3name, error);
error = dmu_objset_destroy(snap2name, B_FALSE);
fatal(0, "dsl_destroy_snapshot(%s) = %d", snap3name, error);
error = dsl_destroy_snapshot(snap2name, B_FALSE);
if (error && error != ENOENT)
fatal(0, "dmu_objset_destroy(%s) = %d", snap2name, error);
error = dmu_objset_destroy(clone1name, B_FALSE);
fatal(0, "dsl_destroy_snapshot(%s) = %d", snap2name, error);
error = dsl_destroy_head(clone1name);
if (error && error != ENOENT)
fatal(0, "dmu_objset_destroy(%s) = %d", clone1name, error);
error = dmu_objset_destroy(snap1name, B_FALSE);
fatal(0, "dsl_destroy_head(%s) = %d", clone1name, error);
error = dsl_destroy_snapshot(snap1name, B_FALSE);
if (error && error != ENOENT)
fatal(0, "dmu_objset_destroy(%s) = %d", snap1name, error);
fatal(0, "dsl_destroy_snapshot(%s) = %d", snap1name, error);
}
/*
@@ -3381,8 +3404,7 @@ ztest_dsl_dataset_cleanup(char *osname, uint64_t id)
void
ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
{
objset_t *clone;
dsl_dataset_t *ds;
objset_t *os;
char snap1name[MAXNAMELEN];
char clone1name[MAXNAMELEN];
char snap2name[MAXNAMELEN];
@@ -3401,8 +3423,7 @@ ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
(void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id);
(void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id);
error = dmu_objset_snapshot(osname, strchr(snap1name, '@')+1,
NULL, NULL, B_FALSE, B_FALSE, -1);
error = dmu_objset_snapshot_one(osname, strchr(snap1name, '@') + 1);
if (error && error != EEXIST) {
if (error == ENOSPC) {
ztest_record_enospc(FTAG);
@@ -3411,12 +3432,7 @@ ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
fatal(0, "dmu_take_snapshot(%s) = %d", snap1name, error);
}
error = dmu_objset_hold(snap1name, FTAG, &clone);
if (error)
fatal(0, "dmu_open_snapshot(%s) = %d", snap1name, error);
error = dmu_objset_clone(clone1name, dmu_objset_ds(clone), 0);
dmu_objset_rele(clone, FTAG);
error = dmu_objset_clone(clone1name, snap1name);
if (error) {
if (error == ENOSPC) {
ztest_record_enospc(FTAG);
@@ -3425,8 +3441,7 @@ ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
fatal(0, "dmu_objset_create(%s) = %d", clone1name, error);
}
error = dmu_objset_snapshot(clone1name, strchr(snap2name, '@')+1,
NULL, NULL, B_FALSE, B_FALSE, -1);
error = dmu_objset_snapshot_one(clone1name, strchr(snap2name, '@') + 1);
if (error && error != EEXIST) {
if (error == ENOSPC) {
ztest_record_enospc(FTAG);
@@ -3435,8 +3450,7 @@ ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
fatal(0, "dmu_open_snapshot(%s) = %d", snap2name, error);
}
error = dmu_objset_snapshot(clone1name, strchr(snap3name, '@')+1,
NULL, NULL, B_FALSE, B_FALSE, -1);
error = dmu_objset_snapshot_one(clone1name, strchr(snap3name, '@') + 1);
if (error && error != EEXIST) {
if (error == ENOSPC) {
ztest_record_enospc(FTAG);
@@ -3445,12 +3459,7 @@ ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
fatal(0, "dmu_open_snapshot(%s) = %d", snap3name, error);
}
error = dmu_objset_hold(snap3name, FTAG, &clone);
if (error)
fatal(0, "dmu_open_snapshot(%s) = %d", snap3name, error);
error = dmu_objset_clone(clone2name, dmu_objset_ds(clone), 0);
dmu_objset_rele(clone, FTAG);
error = dmu_objset_clone(clone2name, snap3name);
if (error) {
if (error == ENOSPC) {
ztest_record_enospc(FTAG);
@@ -3459,14 +3468,14 @@ ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
fatal(0, "dmu_objset_create(%s) = %d", clone2name, error);
}
error = dsl_dataset_own(snap2name, B_FALSE, FTAG, &ds);
error = dmu_objset_own(snap2name, DMU_OST_ANY, B_TRUE, FTAG, &os);
if (error)
fatal(0, "dsl_dataset_own(%s) = %d", snap2name, error);
fatal(0, "dmu_objset_own(%s) = %d", snap2name, error);
error = dsl_dataset_promote(clone2name, NULL);
if (error != EBUSY)
fatal(0, "dsl_dataset_promote(%s), %d, not EBUSY", clone2name,
error);
dsl_dataset_disown(ds, FTAG);
dmu_objset_disown(os, FTAG);
out:
ztest_dsl_dataset_cleanup(osname, id);
@@ -3608,6 +3617,9 @@ ztest_dmu_read_write(ztest_ds_t *zd, uint64_t id)
else
dmu_tx_hold_write(tx, bigobj, bigoff, bigsize);
/* This accounts for setting the checksum/compression. */
dmu_tx_hold_bonus(tx, bigobj);
txg = ztest_tx_assign(tx, TXG_MIGHTWAIT, FTAG);
if (txg == 0) {
umem_free(packbuf, packsize);
@@ -4278,7 +4290,7 @@ ztest_zap_parallel(ztest_ds_t *zd, uint64_t id)
}
count = -1ULL;
VERIFY(zap_count(os, object, &count) == 0);
VERIFY0(zap_count(os, object, &count));
ASSERT(count != -1ULL);
/*
@@ -4512,7 +4524,7 @@ ztest_dmu_commit_callbacks(ztest_ds_t *zd, uint64_t id)
*/
tmp_cb = list_head(&zcl.zcl_callbacks);
if (tmp_cb != NULL &&
tmp_cb->zcd_txg > txg - ZTEST_COMMIT_CALLBACK_THRESH) {
(txg - ZTEST_COMMIT_CALLBACK_THRESH) > tmp_cb->zcd_txg) {
fatal(0, "Commit callback threshold exceeded, oldest txg: %"
PRIu64 ", open txg: %" PRIu64 "\n", tmp_cb->zcd_txg, txg);
}
@@ -4589,6 +4601,22 @@ ztest_spa_prop_get_set(ztest_ds_t *zd, uint64_t id)
(void) rw_unlock(&ztest_name_lock);
}
static int
user_release_one(const char *snapname, const char *holdname)
{
nvlist_t *snaps, *holds;
int error;
snaps = fnvlist_alloc();
holds = fnvlist_alloc();
fnvlist_add_boolean(holds, holdname);
fnvlist_add_nvlist(snaps, snapname, holds);
fnvlist_free(holds);
error = dsl_dataset_user_release(snaps, NULL);
fnvlist_free(snaps);
return (error);
}
/*
* Test snapshot hold/release and deferred destroy.
*/
@@ -4603,29 +4631,36 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, uint64_t id)
char clonename[100];
char tag[100];
char osname[MAXNAMELEN];
nvlist_t *holds;
(void) rw_rdlock(&ztest_name_lock);
dmu_objset_name(os, osname);
(void) snprintf(snapname, 100, "sh1_%llu", id);
(void) snprintf(fullname, 100, "%s@%s", osname, snapname);
(void) snprintf(clonename, 100, "%s/ch1_%llu", osname, id);
(void) snprintf(tag, 100, "%tag_%llu", id);
(void) snprintf(snapname, sizeof (snapname), "sh1_%llu", id);
(void) snprintf(fullname, sizeof (fullname), "%s@%s", osname, snapname);
(void) snprintf(clonename, sizeof (clonename),
"%s/ch1_%llu", osname, id);
(void) snprintf(tag, sizeof (tag), "tag_%llu", id);
/*
* Clean up from any previous run.
*/
(void) dmu_objset_destroy(clonename, B_FALSE);
(void) dsl_dataset_user_release(osname, snapname, tag, B_FALSE);
(void) dmu_objset_destroy(fullname, B_FALSE);
error = dsl_destroy_head(clonename);
if (error != ENOENT)
ASSERT0(error);
error = user_release_one(fullname, tag);
if (error != ESRCH && error != ENOENT)
ASSERT0(error);
error = dsl_destroy_snapshot(fullname, B_FALSE);
if (error != ENOENT)
ASSERT0(error);
/*
* Create snapshot, clone it, mark snap for deferred destroy,
* destroy clone, verify snap was also destroyed.
*/
error = dmu_objset_snapshot(osname, snapname, NULL, NULL, FALSE,
FALSE, -1);
error = dmu_objset_snapshot_one(osname, snapname);
if (error) {
if (error == ENOSPC) {
ztest_record_enospc("dmu_objset_snapshot");
@@ -4634,12 +4669,7 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, uint64_t id)
fatal(0, "dmu_objset_snapshot(%s) = %d", fullname, error);
}
error = dmu_objset_hold(fullname, FTAG, &origin);
if (error)
fatal(0, "dmu_objset_hold(%s) = %d", fullname, error);
error = dmu_objset_clone(clonename, dmu_objset_ds(origin), 0);
dmu_objset_rele(origin, FTAG);
error = dmu_objset_clone(clonename, fullname);
if (error) {
if (error == ENOSPC) {
ztest_record_enospc("dmu_objset_clone");
@@ -4648,15 +4678,15 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, uint64_t id)
fatal(0, "dmu_objset_clone(%s) = %d", clonename, error);
}
error = dmu_objset_destroy(fullname, B_TRUE);
error = dsl_destroy_snapshot(fullname, B_TRUE);
if (error) {
fatal(0, "dmu_objset_destroy(%s, B_TRUE) = %d",
fatal(0, "dsl_destroy_snapshot(%s, B_TRUE) = %d",
fullname, error);
}
error = dmu_objset_destroy(clonename, B_FALSE);
error = dsl_destroy_head(clonename);
if (error)
fatal(0, "dmu_objset_destroy(%s) = %d", clonename, error);
fatal(0, "dsl_destroy_head(%s) = %d", clonename, error);
error = dmu_objset_hold(fullname, FTAG, &origin);
if (error != ENOENT)
@@ -4667,8 +4697,7 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, uint64_t id)
* destroy a held snapshot, mark for deferred destroy,
* release hold, verify snapshot was destroyed.
*/
error = dmu_objset_snapshot(osname, snapname, NULL, NULL, FALSE,
FALSE, -1);
error = dmu_objset_snapshot_one(osname, snapname);
if (error) {
if (error == ENOSPC) {
ztest_record_enospc("dmu_objset_snapshot");
@@ -4677,28 +4706,31 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, uint64_t id)
fatal(0, "dmu_objset_snapshot(%s) = %d", fullname, error);
}
error = dsl_dataset_user_hold(osname, snapname, tag, B_FALSE,
B_TRUE, -1);
holds = fnvlist_alloc();
fnvlist_add_string(holds, fullname, tag);
error = dsl_dataset_user_hold(holds, 0, NULL);
fnvlist_free(holds);
if (error)
fatal(0, "dsl_dataset_user_hold(%s)", fullname, tag);
error = dmu_objset_destroy(fullname, B_FALSE);
error = dsl_destroy_snapshot(fullname, B_FALSE);
if (error != EBUSY) {
fatal(0, "dmu_objset_destroy(%s, B_FALSE) = %d",
fatal(0, "dsl_destroy_snapshot(%s, B_FALSE) = %d",
fullname, error);
}
error = dmu_objset_destroy(fullname, B_TRUE);
error = dsl_destroy_snapshot(fullname, B_TRUE);
if (error) {
fatal(0, "dmu_objset_destroy(%s, B_TRUE) = %d",
fatal(0, "dsl_destroy_snapshot(%s, B_TRUE) = %d",
fullname, error);
}
error = dsl_dataset_user_release(osname, snapname, tag, B_FALSE);
error = user_release_one(fullname, tag);
if (error)
fatal(0, "dsl_dataset_user_release(%s)", fullname, tag);
fatal(0, "user_release_one(%s, %s) = %d", fullname, tag, error);
VERIFY(dmu_objset_hold(fullname, FTAG, &origin) == ENOENT);
VERIFY3U(dmu_objset_hold(fullname, FTAG, &origin), ==, ENOENT);
out:
(void) rw_unlock(&ztest_name_lock);
@@ -4737,6 +4769,14 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
ASSERT(leaves >= 1);
/*
* Grab the name lock as reader. There are some operations
* which don't like to have their vdevs changed while
* they are in progress (i.e. spa_change_guid). Those
* operations will have grabbed the name lock as writer.
*/
(void) rw_rdlock(&ztest_name_lock);
/*
* We need SCL_STATE here because we're going to look at vd0->vdev_tsd.
*/
@@ -4766,7 +4806,14 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
if (vd0 != NULL && vd0->vdev_top->vdev_islog)
islog = B_TRUE;
if (vd0 != NULL && maxfaults != 1) {
/*
* If the top-level vdev needs to be resilvered
* then we only allow faults on the device that is
* resilvering.
*/
if (vd0 != NULL && maxfaults != 1 &&
(!vdev_resilver_needed(vd0->vdev_top, NULL, NULL) ||
vd0->vdev_resilver_txg != 0)) {
/*
* Make vd0 explicitly claim to be unreadable,
* or unwriteable, or reach behind its back
@@ -4797,6 +4844,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
if (sav->sav_count == 0) {
spa_config_exit(spa, SCL_STATE, FTAG);
(void) rw_unlock(&ztest_name_lock);
return;
}
vd0 = sav->sav_vdevs[ztest_random(sav->sav_count)];
@@ -4810,6 +4858,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
}
spa_config_exit(spa, SCL_STATE, FTAG);
(void) rw_unlock(&ztest_name_lock);
/*
* If we can tolerate two or more faults, or we're dealing
@@ -4836,7 +4885,18 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
if (islog)
(void) rw_unlock(&ztest_name_lock);
} else {
/*
* Ideally we would like to be able to randomly
* call vdev_[on|off]line without holding locks
* to force unpredictable failures but the side
* effects of vdev_[on|off]line prevent us from
* doing so. We grab the ztest_vdev_lock here to
* prevent a race between injection testing and
* aux_vdev removal.
*/
VERIFY(mutex_lock(&ztest_vdev_lock) == 0);
(void) vdev_online(spa, guid0, 0, NULL);
VERIFY(mutex_unlock(&ztest_vdev_lock) == 0);
}
}
@@ -4941,8 +5001,12 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_t id)
*/
for (int i = 0; i < copies; i++) {
uint64_t offset = i * blocksize;
VERIFY0(dmu_buf_hold(os, object, offset, FTAG, &db,
DMU_READ_NO_PREFETCH));
int error = dmu_buf_hold(os, object, offset, FTAG, &db,
DMU_READ_NO_PREFETCH);
if (error != 0) {
fatal(B_FALSE, "dmu_buf_hold(%p, %llu, %llu) = %u",
os, (long long)object, (long long) offset, error);
}
ASSERT(db->db_offset == offset);
ASSERT(db->db_size == blocksize);
ASSERT(ztest_pattern_match(db->db_data, db->db_size, pattern) ||
@@ -5153,6 +5217,7 @@ ztest_spa_import_export(char *oldname, char *newname)
nvlist_t *config, *newconfig;
uint64_t pool_guid;
spa_t *spa;
int error;
if (ztest_opts.zo_verbose >= 4) {
(void) printf("import/export: old = %s, new = %s\n",
@@ -5197,7 +5262,12 @@ ztest_spa_import_export(char *oldname, char *newname)
/*
* Import it under the new name.
*/
VERIFY3U(0, ==, spa_import(newname, config, NULL, 0));
error = spa_import(newname, config, NULL, 0);
if (error != 0) {
dump_nvlist(config, 0);
fatal(B_FALSE, "couldn't import pool %s as %s: error %u",
oldname, newname, error);
}
ztest_walk_pool_directory("pools after import");
@@ -5254,16 +5324,33 @@ static void *
ztest_deadman_thread(void *arg)
{
ztest_shared_t *zs = arg;
int grace = 300;
hrtime_t delta;
spa_t *spa = ztest_spa;
hrtime_t delta, total = 0;
delta = (zs->zs_thread_stop - zs->zs_thread_start) / NANOSEC + grace;
for (;;) {
delta = zs->zs_thread_stop - zs->zs_thread_start +
MSEC2NSEC(zfs_deadman_synctime_ms);
(void) poll(NULL, 0, (int)(1000 * delta));
(void) poll(NULL, 0, (int)NSEC2MSEC(delta));
fatal(0, "failed to complete within %d seconds of deadline", grace);
/*
* If the pool is suspended then fail immediately. Otherwise,
* check to see if the pool is making any progress. If
* vdev_deadman() discovers that there hasn't been any recent
* I/Os then it will end up aborting the tests.
*/
if (spa_suspended(spa) || spa->spa_root_vdev == NULL) {
fatal(0, "aborting test after %llu seconds because "
"pool has transitioned to a suspended state.",
zfs_deadman_synctime_ms / 1000);
return (NULL);
}
vdev_deadman(spa->spa_root_vdev);
return (NULL);
total += zfs_deadman_synctime_ms/1000;
(void) printf("ztest has been running for %lld seconds\n",
total);
}
}
static void
@@ -5404,7 +5491,7 @@ ztest_dataset_open(int d)
}
ASSERT(error == 0 || error == EEXIST);
VERIFY0(dmu_objset_hold(name, zd, &os));
VERIFY0(dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, zd, &os));
(void) rw_unlock(&ztest_name_lock);
ztest_zd_init(zd, ZTEST_GET_SHARED_DS(d), os);
@@ -5445,7 +5532,7 @@ ztest_dataset_close(int d)
ztest_ds_t *zd = &ztest_ds[d];
zil_close(zd->zd_zilog);
dmu_objset_rele(zd->zd_os, zd);
dmu_objset_disown(zd->zd_os, zd);
ztest_zd_fini(zd);
}
@@ -5489,13 +5576,14 @@ ztest_run(ztest_shared_t *zs)
* Open our pool.
*/
kernel_init(FREAD | FWRITE);
VERIFY(spa_open(ztest_opts.zo_pool, &spa, FTAG) == 0);
VERIFY0(spa_open(ztest_opts.zo_pool, &spa, FTAG));
spa->spa_debug = B_TRUE;
ztest_spa = spa;
VERIFY3U(0, ==, dmu_objset_hold(ztest_opts.zo_pool, FTAG, &os));
VERIFY0(dmu_objset_own(ztest_opts.zo_pool,
DMU_OST_ANY, B_TRUE, FTAG, &os));
zs->zs_guid = dmu_objset_fsid_guid(os);
dmu_objset_rele(os, FTAG);
dmu_objset_disown(os, FTAG);
spa->spa_dedup_ditto = 2 * ZIO_DEDUPDITTO_MIN;
@@ -5576,6 +5664,7 @@ ztest_run(ztest_shared_t *zs)
zs->zs_alloc = metaslab_class_get_alloc(spa_normal_class(spa));
zs->zs_space = metaslab_class_get_space(spa_normal_class(spa));
zfs_dbgmsg_print(FTAG);
umem_free(tid, ztest_opts.zo_threads * sizeof (thread_t));
@@ -5772,8 +5861,7 @@ ztest_init(ztest_shared_t *zs)
spa_feature_table[i].fi_uname);
VERIFY3U(0, ==, nvlist_add_uint64(props, buf, 0));
}
VERIFY3U(0, ==, spa_create(ztest_opts.zo_pool, nvroot, props,
NULL, NULL));
VERIFY3U(0, ==, spa_create(ztest_opts.zo_pool, nvroot, props, NULL));
nvlist_free(nvroot);
VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG));
@@ -5795,29 +5883,16 @@ ztest_init(ztest_shared_t *zs)
}
static void
setup_fds(void)
setup_data_fd(void)
{
int fd;
#ifdef illumos
static char ztest_name_data[] = "/tmp/ztest.data.XXXXXX";
char *tmp = tempnam(NULL, NULL);
fd = open(tmp, O_RDWR | O_CREAT, 0700);
ASSERT3U(fd, ==, ZTEST_FD_DATA);
(void) unlink(tmp);
free(tmp);
#else
char tmp[MAXPATHLEN];
strlcpy(tmp, ztest_opts.zo_dir, MAXPATHLEN);
strlcat(tmp, "/ztest.XXXXXX", MAXPATHLEN);
fd = mkstemp(tmp);
ASSERT3U(fd, ==, ZTEST_FD_DATA);
#endif
fd = open("/dev/urandom", O_RDONLY);
ASSERT3U(fd, ==, ZTEST_FD_RAND);
ztest_fd_data = mkstemp(ztest_name_data);
ASSERT3S(ztest_fd_data, >=, 0);
(void) unlink(ztest_name_data);
}
static int
shared_data_size(ztest_shared_hdr_t *hdr)
{
@@ -5838,15 +5913,11 @@ setup_hdr(void)
int size;
ztest_shared_hdr_t *hdr;
#ifndef illumos
pwrite(ZTEST_FD_DATA, "", 1, 0);
#endif
hdr = (void *)mmap(0, P2ROUNDUP(sizeof (*hdr), getpagesize()),
PROT_READ | PROT_WRITE, MAP_SHARED, ZTEST_FD_DATA, 0);
PROT_READ | PROT_WRITE, MAP_SHARED, ztest_fd_data, 0);
ASSERT(hdr != MAP_FAILED);
VERIFY3U(0, ==, ftruncate(ZTEST_FD_DATA, sizeof (ztest_shared_hdr_t)));
VERIFY3U(0, ==, ftruncate(ztest_fd_data, sizeof (ztest_shared_hdr_t)));
hdr->zh_hdr_size = sizeof (ztest_shared_hdr_t);
hdr->zh_opts_size = sizeof (ztest_shared_opts_t);
@@ -5857,7 +5928,7 @@ setup_hdr(void)
hdr->zh_ds_count = ztest_opts.zo_datasets;
size = shared_data_size(hdr);
VERIFY3U(0, ==, ftruncate(ZTEST_FD_DATA, size));
VERIFY3U(0, ==, ftruncate(ztest_fd_data, size));
(void) munmap((caddr_t)hdr, P2ROUNDUP(sizeof (*hdr), getpagesize()));
}
@@ -5870,14 +5941,14 @@ setup_data(void)
uint8_t *buf;
hdr = (void *)mmap(0, P2ROUNDUP(sizeof (*hdr), getpagesize()),
PROT_READ, MAP_SHARED, ZTEST_FD_DATA, 0);
PROT_READ, MAP_SHARED, ztest_fd_data, 0);
ASSERT(hdr != MAP_FAILED);
size = shared_data_size(hdr);
(void) munmap((caddr_t)hdr, P2ROUNDUP(sizeof (*hdr), getpagesize()));
hdr = ztest_shared_hdr = (void *)mmap(0, P2ROUNDUP(size, getpagesize()),
PROT_READ | PROT_WRITE, MAP_SHARED, ZTEST_FD_DATA, 0);
PROT_READ | PROT_WRITE, MAP_SHARED, ztest_fd_data, 0);
ASSERT(hdr != MAP_FAILED);
buf = (uint8_t *)hdr;
@@ -5896,12 +5967,13 @@ exec_child(char *cmd, char *libpath, boolean_t ignorekill, int *statusp)
{
pid_t pid;
int status;
char cmdbuf[MAXPATHLEN];
char *cmdbuf = NULL;
pid = fork();
if (cmd == NULL) {
(void) strlcpy(cmdbuf, getexecname(), sizeof (cmdbuf));
cmdbuf = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
(void) strlcpy(cmdbuf, getexecname(), MAXPATHLEN);
cmd = cmdbuf;
}
@@ -5910,9 +5982,16 @@ exec_child(char *cmd, char *libpath, boolean_t ignorekill, int *statusp)
if (pid == 0) { /* child */
char *emptyargv[2] = { cmd, NULL };
char fd_data_str[12];
struct rlimit rl = { 1024, 1024 };
(void) setrlimit(RLIMIT_NOFILE, &rl);
(void) close(ztest_fd_rand);
VERIFY3U(11, >=,
snprintf(fd_data_str, 12, "%d", ztest_fd_data));
VERIFY0(setenv("ZTEST_FD_DATA", fd_data_str, 1));
(void) enable_extended_FILE_stdio(-1, -1);
if (libpath != NULL)
VERIFY(0 == setenv("LD_LIBRARY_PATH", libpath, 1));
@@ -5925,6 +6004,11 @@ exec_child(char *cmd, char *libpath, boolean_t ignorekill, int *statusp)
fatal(B_TRUE, "exec failed: %s", cmd);
}
if (cmdbuf != NULL) {
umem_free(cmdbuf, MAXPATHLEN);
cmd = NULL;
}
while (waitpid(pid, &status, 0) != pid)
continue;
if (statusp != NULL)
@@ -5989,39 +6073,42 @@ main(int argc, char **argv)
char timebuf[100];
char numbuf[6];
spa_t *spa;
char cmd[MAXNAMELEN];
char *cmd;
boolean_t hasalt;
boolean_t ischild = (0 == lseek(ZTEST_FD_DATA, 0, SEEK_CUR));
ASSERT(ischild || errno == EBADF);
char *fd_data_str = getenv("ZTEST_FD_DATA");
(void) setvbuf(stdout, NULL, _IOLBF, 0);
dprintf_setup(&argc, argv);
zfs_deadman_synctime_ms = 300000;
if (!ischild) {
ztest_fd_rand = open("/dev/urandom", O_RDONLY);
ASSERT3S(ztest_fd_rand, >=, 0);
if (!fd_data_str) {
process_options(argc, argv);
setup_fds();
setup_data_fd();
setup_hdr();
setup_data();
bcopy(&ztest_opts, ztest_shared_opts,
sizeof (*ztest_shared_opts));
} else {
ztest_fd_data = atoi(fd_data_str);
setup_data();
bcopy(ztest_shared_opts, &ztest_opts, sizeof (ztest_opts));
}
ASSERT3U(ztest_opts.zo_datasets, ==, ztest_shared_hdr->zh_ds_count);
/* Override location of zpool.cache */
(void) asprintf((char **)&spa_config_path, "%s/zpool.cache",
ztest_opts.zo_dir);
VERIFY3U(asprintf((char **)&spa_config_path, "%s/zpool.cache",
ztest_opts.zo_dir), !=, -1);
ztest_ds = umem_alloc(ztest_opts.zo_datasets * sizeof (ztest_ds_t),
UMEM_NOFAIL);
zs = ztest_shared;
if (ischild) {
if (fd_data_str) {
metaslab_gang_bang = ztest_opts.zo_metaslab_gang_bang;
metaslab_df_alloc_threshold =
zs->zs_metaslab_df_alloc_threshold;
@@ -6044,7 +6131,8 @@ main(int argc, char **argv)
(u_longlong_t)ztest_opts.zo_time);
}
(void) strlcpy(cmd, getexecname(), sizeof (cmd));
cmd = umem_alloc(MAXNAMELEN, UMEM_NOFAIL);
(void) strlcpy(cmd, getexecname(), MAXNAMELEN);
zs->zs_do_init = B_TRUE;
if (strlen(ztest_opts.zo_alt_ztest) != 0) {
@@ -6185,5 +6273,7 @@ main(int argc, char **argv)
kills, iters - kills, (100.0 * kills) / MAX(1, iters));
}
umem_free(cmd, MAXNAMELEN);
return (0);
}
@@ -730,11 +730,6 @@ dt_zalloc(dtrace_hdl_t *dtp, size_t size)
{
void *data;
if (size > 16 * 1024 * 1024) {
(void) dt_set_errno(dtp, EDT_NOMEM);
return (NULL);
}
if ((data = malloc(size)) == NULL)
(void) dt_set_errno(dtp, EDT_NOMEM);
else
@@ -748,11 +743,6 @@ dt_alloc(dtrace_hdl_t *dtp, size_t size)
{
void *data;
if (size > 16 * 1024 * 1024) {
(void) dt_set_errno(dtp, EDT_NOMEM);
return (NULL);
}
if ((data = malloc(size)) == NULL)
(void) dt_set_errno(dtp, EDT_NOMEM);
@@ -21,12 +21,13 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _LIBZFS_H
@@ -57,7 +58,8 @@ extern "C" {
/*
* libzfs errors
*/
enum {
typedef enum zfs_error {
EZFS_SUCCESS = 0, /* no error -- success */
EZFS_NOMEM = 2000, /* out of memory */
EZFS_BADPROP, /* invalid property value */
EZFS_PROPREADONLY, /* cannot set readonly property */
@@ -129,7 +131,7 @@ enum {
EZFS_DIFFDATA, /* bad zfs diff data */
EZFS_POOLREADONLY, /* pool is in read-only mode */
EZFS_UNKNOWN
};
} zfs_error_t;
/*
* The following data structures are all part
@@ -185,9 +187,13 @@ extern libzfs_handle_t *zfs_get_handle(zfs_handle_t *);
extern void libzfs_print_on_error(libzfs_handle_t *, boolean_t);
extern void zfs_save_arguments(int argc, char **, char *, int);
extern int zpool_log_history(libzfs_handle_t *, const char *);
extern int libzfs_errno(libzfs_handle_t *);
extern const char *libzfs_error_action(libzfs_handle_t *);
extern const char *libzfs_error_description(libzfs_handle_t *);
extern int zfs_standard_error(libzfs_handle_t *, int, const char *);
extern void libzfs_mnttab_init(libzfs_handle_t *);
extern void libzfs_mnttab_fini(libzfs_handle_t *);
extern void libzfs_mnttab_cache(libzfs_handle_t *, boolean_t);
@@ -220,7 +226,7 @@ extern int zpool_iter(libzfs_handle_t *, zpool_iter_f, void *);
*/
extern int zpool_create(libzfs_handle_t *, const char *, nvlist_t *,
nvlist_t *, nvlist_t *);
extern int zpool_destroy(zpool_handle_t *);
extern int zpool_destroy(zpool_handle_t *, const char *);
extern int zpool_add(zpool_handle_t *, nvlist_t *);
typedef struct splitflags {
@@ -321,6 +327,7 @@ typedef enum {
ZPOOL_STATUS_RESILVERING, /* device being resilvered */
ZPOOL_STATUS_OFFLINE_DEV, /* device online */
ZPOOL_STATUS_REMOVED_DEV, /* removed device */
ZPOOL_STATUS_NON_NATIVE_ASHIFT, /* (e.g. 512e dev with ashift of 9) */
/*
* Finally, the following indicates a healthy pool.
@@ -343,8 +350,8 @@ extern int zpool_get_errlog(zpool_handle_t *, nvlist_t **);
/*
* Import and export functions
*/
extern int zpool_export(zpool_handle_t *, boolean_t);
extern int zpool_export_force(zpool_handle_t *);
extern int zpool_export(zpool_handle_t *, boolean_t, const char *);
extern int zpool_export_force(zpool_handle_t *, const char *);
extern int zpool_import(libzfs_handle_t *, nvlist_t *, const char *,
char *altroot);
extern int zpool_import_props(libzfs_handle_t *, nvlist_t *, const char *,
@@ -378,7 +385,7 @@ extern nvlist_t *zpool_find_import_cached(libzfs_handle_t *, const char *,
*/
struct zfs_cmd;
extern const char *zfs_history_event_names[LOG_END];
extern const char *zfs_history_event_names[];
extern char *zpool_vdev_name(libzfs_handle_t *, zpool_handle_t *, nvlist_t *,
boolean_t verbose);
@@ -386,12 +393,9 @@ extern int zpool_upgrade(zpool_handle_t *, uint64_t);
extern int zpool_get_history(zpool_handle_t *, nvlist_t **);
extern int zpool_history_unpack(char *, uint64_t, uint64_t *,
nvlist_t ***, uint_t *);
extern void zpool_set_history_str(const char *subcommand, int argc,
char **argv, char *history_str);
extern int zpool_stage_history(libzfs_handle_t *, const char *);
extern void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *,
size_t len);
extern int zfs_ioctl(libzfs_handle_t *, unsigned long, struct zfs_cmd *);
extern int zfs_ioctl(libzfs_handle_t *, int request, struct zfs_cmd *);
extern int zpool_get_physpath(zpool_handle_t *, char *, size_t);
extern void zpool_explain_recover(libzfs_handle_t *, const char *, int,
nvlist_t *);
@@ -441,8 +445,6 @@ extern int zfs_prop_get_written(zfs_handle_t *zhp, const char *propname,
char *propbuf, int proplen, boolean_t literal);
extern int zfs_prop_get_feature(zfs_handle_t *zhp, const char *propname,
char *buf, size_t len);
extern int zfs_get_snapused_int(zfs_handle_t *firstsnap, zfs_handle_t *lastsnap,
uint64_t *usedp);
extern uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t);
extern int zfs_prop_inherit(zfs_handle_t *, const char *, boolean_t);
extern const char *zfs_prop_values(zfs_prop_t);
@@ -462,7 +464,8 @@ typedef struct zprop_list {
boolean_t pl_fixed;
} zprop_list_t;
extern int zfs_expand_proplist(zfs_handle_t *, zprop_list_t **, boolean_t);
extern int zfs_expand_proplist(zfs_handle_t *, zprop_list_t **, boolean_t,
boolean_t);
extern void zfs_prune_proplist(zfs_handle_t *, uint8_t *);
#define ZFS_MOUNTPOINT_NONE "none"
@@ -535,6 +538,7 @@ extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *);
extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *);
extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *);
extern int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, void *);
extern int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *);
typedef struct get_all_cb {
zfs_handle_t **cb_handles;
@@ -555,9 +559,11 @@ extern int zfs_create(libzfs_handle_t *, const char *, zfs_type_t,
extern int zfs_create_ancestors(libzfs_handle_t *, const char *);
extern int zfs_destroy(zfs_handle_t *, boolean_t);
extern int zfs_destroy_snaps(zfs_handle_t *, char *, boolean_t);
extern int zfs_destroy_snaps_nvl(zfs_handle_t *, nvlist_t *, boolean_t);
extern int zfs_destroy_snaps_nvl(libzfs_handle_t *, nvlist_t *, boolean_t);
extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *);
extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *);
extern int zfs_snapshot_nvl(libzfs_handle_t *hdl, nvlist_t *snaps,
nvlist_t *props);
extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t);
typedef struct renameflags {
@@ -571,7 +577,8 @@ typedef struct renameflags {
int forceunmount : 1;
} renameflags_t;
extern int zfs_rename(zfs_handle_t *, const char *, renameflags_t flags);
extern int zfs_rename(zfs_handle_t *, const char *, const char *,
renameflags_t flags);
typedef struct sendflags {
/* print informational messages (ie, -v was specified) */
@@ -606,10 +613,12 @@ typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *);
extern int zfs_send(zfs_handle_t *, const char *, const char *,
sendflags_t *, int, snapfilter_cb_t, void *, nvlist_t **);
extern int zfs_send_one(zfs_handle_t *, const char *, int);
extern int zfs_promote(zfs_handle_t *);
extern int zfs_hold(zfs_handle_t *, const char *, const char *, boolean_t,
boolean_t, boolean_t, int, uint64_t, uint64_t);
extern int zfs_hold(zfs_handle_t *, const char *, const char *,
boolean_t, int);
extern int zfs_hold_nvl(zfs_handle_t *, int, nvlist_t *);
extern int zfs_release(zfs_handle_t *, const char *, const char *, boolean_t);
extern int zfs_get_holds(zfs_handle_t *, nvlist_t **);
extern uint64_t zvol_volsize_to_reservation(uint64_t, nvlist_t *);
@@ -674,6 +683,7 @@ extern zfs_handle_t *zfs_path_to_zhandle(libzfs_handle_t *, char *, zfs_type_t);
extern boolean_t zfs_dataset_exists(libzfs_handle_t *, const char *,
zfs_type_t);
extern int zfs_spa_version(zfs_handle_t *, int *);
extern boolean_t zfs_bookmark_exists(const char *path);
/*
* Mount support functions.
@@ -0,0 +1,105 @@
/*
* CDDL HEADER SART
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2013 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
*/
#include "libzfs_compat.h"
int zfs_ioctl_version = ZFS_IOCVER_UNDEF;
static int zfs_spa_version = -1;
/*
* Get zfs_ioctl_version
*/
int
get_zfs_ioctl_version(void)
{
size_t ver_size;
int ver = ZFS_IOCVER_NONE;
ver_size = sizeof(ver);
sysctlbyname("vfs.zfs.version.ioctl", &ver, &ver_size, NULL, 0);
return (ver);
}
/*
* Get the SPA version
*/
static int
get_zfs_spa_version(void)
{
size_t ver_size;
int ver = 0;
ver_size = sizeof(ver);
sysctlbyname("vfs.zfs.version.spa", &ver, &ver_size, NULL, 0);
return (ver);
}
/*
* This is FreeBSD version of ioctl, because Solaris' ioctl() updates
* zc_nvlist_dst_size even if an error is returned, on FreeBSD if an
* error is returned zc_nvlist_dst_size won't be updated.
*/
int
zcmd_ioctl(int fd, int request, zfs_cmd_t *zc)
{
size_t oldsize;
int ret, cflag = ZFS_CMD_COMPAT_NONE;
if (zfs_ioctl_version == ZFS_IOCVER_UNDEF)
zfs_ioctl_version = get_zfs_ioctl_version();
if (zfs_ioctl_version == ZFS_IOCVER_LZC)
cflag = ZFS_CMD_COMPAT_LZC;
else if (zfs_ioctl_version == ZFS_IOCVER_DEADMAN)
cflag = ZFS_CMD_COMPAT_DEADMAN;
/*
* If vfs.zfs.version.ioctl is not defined, assume we have v28
* compatible binaries and use vfs.zfs.version.spa to test for v15
*/
if (zfs_ioctl_version < ZFS_IOCVER_DEADMAN) {
cflag = ZFS_CMD_COMPAT_V28;
if (zfs_spa_version < 0)
zfs_spa_version = get_zfs_spa_version();
if (zfs_spa_version == SPA_VERSION_15 ||
zfs_spa_version == SPA_VERSION_14 ||
zfs_spa_version == SPA_VERSION_13)
cflag = ZFS_CMD_COMPAT_V15;
}
oldsize = zc->zc_nvlist_dst_size;
ret = zcmd_ioctl_compat(fd, request, zc, cflag);
if (ret == 0 && oldsize < zc->zc_nvlist_dst_size) {
ret = -1;
errno = ENOMEM;
}
return (ret);
}
@@ -0,0 +1,44 @@
/*
* CDDL HEADER SART
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2013 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
*/
#ifndef _LIBZFS_COMPAT_H
#define _LIBZFS_COMPAT_H
#include <zfs_ioctl_compat.h>
#ifdef __cplusplus
extern "C" {
#endif
int get_zfs_ioctl_version(void);
int zcmd_ioctl(int fd, int request, zfs_cmd_t *zc);
#define ioctl(fd, ioc, zc) zcmd_ioctl((fd), (ioc), (zc))
#ifdef __cplusplus
}
#endif
#endif /* _LIBZFS_COMPAT_H */
File diff suppressed because it is too large. Load diff
@@ -23,11 +23,12 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright (c) 2011 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2013 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
*/
#ifndef _LIBFS_IMPL_H
#define _LIBFS_IMPL_H
#ifndef _LIBZFS_IMPL_H
#define _LIBZFS_IMPL_H
#include <sys/dmu.h>
#include <sys/fs/zfs.h>
@@ -38,8 +39,8 @@
#include <libshare.h>
#include <libuutil.h>
#include <libzfs.h>
#include "zfs_ioctl_compat.h"
#include <libzfs_core.h>
#include <libzfs_compat.h>
#ifdef __cplusplus
extern "C" {
@@ -69,7 +70,6 @@ struct libzfs_handle {
int libzfs_desc_active;
char libzfs_action[1024];
char libzfs_desc[1024];
char *libzfs_log_str;
int libzfs_printerr;
int libzfs_storeerr; /* stuff error messages into buffer */
void *libzfs_sharehdl; /* libshare handle */
@@ -191,6 +191,8 @@ int create_parents(libzfs_handle_t *, char *, int);
boolean_t isa_child_of(const char *dataset, const char *parent);
zfs_handle_t *make_dataset_handle(libzfs_handle_t *, const char *);
zfs_handle_t *make_bookmark_handle(zfs_handle_t *, const char *,
nvlist_t *props);
int zpool_open_silent(libzfs_handle_t *, const char *, zpool_handle_t **);
@@ -214,46 +216,8 @@ extern int zfs_unshare_proto(zfs_handle_t *,
extern void libzfs_fru_clear(libzfs_handle_t *, boolean_t);
#ifndef sun
static int zfs_kernel_version = 0;
/*
* This is FreeBSD version of ioctl, because Solaris' ioctl() updates
* zc_nvlist_dst_size even if an error is returned, on FreeBSD if an
* error is returned zc_nvlist_dst_size won't be updated.
*/
static __inline int
zcmd_ioctl(int fd, unsigned long cmd, zfs_cmd_t *zc)
{
size_t oldsize, zfs_kernel_version_size;
int version, ret, cflag = ZFS_CMD_COMPAT_NONE;
zfs_kernel_version_size = sizeof(zfs_kernel_version);
if (zfs_kernel_version == 0) {
sysctlbyname("vfs.zfs.version.spa", &zfs_kernel_version,
&zfs_kernel_version_size, NULL, 0);
}
if (zfs_kernel_version == SPA_VERSION_15 ||
zfs_kernel_version == SPA_VERSION_14 ||
zfs_kernel_version == SPA_VERSION_13)
cflag = ZFS_CMD_COMPAT_V15;
oldsize = zc->zc_nvlist_dst_size;
ret = zcmd_ioctl_compat(fd, cmd, zc, cflag);
if (ret == 0 && oldsize < zc->zc_nvlist_dst_size) {
ret = -1;
errno = ENOMEM;
}
return (ret);
}
#define ioctl(fd, cmd, zc) zcmd_ioctl((fd), (cmd), (zc))
#endif /* !sun */
#ifdef __cplusplus
}
#endif
#endif /* _LIBFS_IMPL_H */
#endif /* _LIBZFS_IMPL_H */
@@ -18,9 +18,10 @@
*
* CDDL HEADER END
*/
/*
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
@@ -194,8 +195,10 @@ fix_paths(nvlist_t *nv, name_entry_t *names)
if ((devid = get_devid(best->ne_name)) == NULL) {
(void) nvlist_remove_all(nv, ZPOOL_CONFIG_DEVID);
} else {
if (nvlist_add_string(nv, ZPOOL_CONFIG_DEVID, devid) != 0)
if (nvlist_add_string(nv, ZPOOL_CONFIG_DEVID, devid) != 0) {
devid_str_free(devid);
return (-1);
}
devid_str_free(devid);
}
@@ -661,8 +664,10 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boolean_t active_ok)
nvlist_add_uint64(holey,
ZPOOL_CONFIG_ID, c) != 0 ||
nvlist_add_uint64(holey,
ZPOOL_CONFIG_GUID, 0ULL) != 0)
ZPOOL_CONFIG_GUID, 0ULL) != 0) {
nvlist_free(holey);
goto nomem;
}
child[c] = holey;
}
}
@@ -1107,8 +1112,10 @@ zpool_clear_label(int fd)
for (l = 0; l < VDEV_LABELS; l++) {
if (pwrite64(fd, label, sizeof (vdev_label_t),
label_offset(size, l)) != sizeof (vdev_label_t))
label_offset(size, l)) != sizeof (vdev_label_t)) {
free(label);
return (-1);
}
}
free(label);
@@ -1126,7 +1133,6 @@ static nvlist_t *
zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
{
int i, dirs = iarg->paths;
DIR *dirp = NULL;
struct dirent64 *dp;
char path[MAXPATHLEN];
char *end, **dir = iarg->path;
@@ -1156,6 +1162,8 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
tpool_t *t;
char *rdsk;
int dfd;
boolean_t config_failed = B_FALSE;
DIR *dirp;
/* use realpath to normalize the path */
if (realpath(dir[i], path) == 0) {
@@ -1180,6 +1188,8 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
if ((dfd = open64(rdsk, O_RDONLY)) < 0 ||
(dirp = fdopendir(dfd)) == NULL) {
if (dfd >= 0)
(void) close(dfd);
zfs_error_aux(hdl, strerror(errno));
(void) zfs_error_fmt(hdl, EZFS_BADPATH,
dgettext(TEXT_DOMAIN, "cannot open '%s'"),
@@ -1261,7 +1271,7 @@ skipdir:
cookie = NULL;
while ((slice = avl_destroy_nodes(&slice_cache,
&cookie)) != NULL) {
if (slice->rn_config != NULL) {
if (slice->rn_config != NULL && !config_failed) {
nvlist_t *config = slice->rn_config;
boolean_t matched = B_TRUE;
@@ -1282,13 +1292,16 @@ skipdir:
}
if (!matched) {
nvlist_free(config);
config = NULL;
continue;
} else {
/*
* use the non-raw path for the config
*/
(void) strlcpy(end, slice->rn_name,
pathleft);
if (add_config(hdl, &pools, path,
config) != 0)
config_failed = B_TRUE;
}
/* use the non-raw path for the config */
(void) strlcpy(end, slice->rn_name, pathleft);
if (add_config(hdl, &pools, path, config) != 0)
goto error;
}
free(slice->rn_name);
free(slice);
@@ -1296,7 +1309,9 @@ skipdir:
avl_destroy(&slice_cache);
(void) closedir(dirp);
dirp = NULL;
if (config_failed)
goto error;
}
ret = get_configs(hdl, &pools, iarg->can_be_active);
@@ -1319,14 +1334,10 @@ error:
for (ne = pools.names; ne != NULL; ne = nenext) {
nenext = ne->ne_next;
if (ne->ne_name)
free(ne->ne_name);
free(ne->ne_name);
free(ne);
}
if (dirp)
(void) closedir(dirp);
return (ret);
}
@@ -1606,9 +1617,16 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
* its state to active.
*/
if (pool_active(hdl, name, guid, &isactive) == 0 && isactive &&
(zhp = zpool_open_canfail(hdl, name)) != NULL &&
zpool_get_prop_int(zhp, ZPOOL_PROP_READONLY, NULL))
stateval = POOL_STATE_ACTIVE;
(zhp = zpool_open_canfail(hdl, name)) != NULL) {
if (zpool_get_prop_int(zhp, ZPOOL_PROP_READONLY, NULL))
stateval = POOL_STATE_ACTIVE;
/*
* All we needed the zpool handle for is the
* readonly prop check.
*/
zpool_close(zhp);
}
ret = B_TRUE;
break;
@@ -1683,9 +1701,9 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
cb.cb_type = ZPOOL_CONFIG_SPARES;
if (zpool_iter(hdl, find_aux, &cb) == 1) {
name = (char *)zpool_get_name(cb.cb_zhp);
ret = TRUE;
ret = B_TRUE;
} else {
ret = FALSE;
ret = B_FALSE;
}
break;
@@ -1699,9 +1717,9 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
cb.cb_type = ZPOOL_CONFIG_L2CACHE;
if (zpool_iter(hdl, find_aux, &cb) == 1) {
name = (char *)zpool_get_name(cb.cb_zhp);
ret = TRUE;
ret = B_TRUE;
} else {
ret = FALSE;
ret = B_FALSE;
}
break;
@@ -21,10 +21,10 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2011 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
#include <stdio.h>
@@ -146,7 +146,8 @@ zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple, zfs_iter_f func,
zfs_handle_t *nzhp;
int ret;
if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT)
if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT ||
zhp->zfs_type == ZFS_TYPE_BOOKMARK)
return (0);
zc.zc_simple = simple;
@@ -172,6 +173,59 @@ zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple, zfs_iter_f func,
return ((ret < 0) ? ret : 0);
}
/*
* Iterate over all bookmarks
*/
int
zfs_iter_bookmarks(zfs_handle_t *zhp, zfs_iter_f func, void *data)
{
zfs_handle_t *nzhp;
nvlist_t *props = NULL;
nvlist_t *bmarks = NULL;
int err;
if ((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT | ZFS_TYPE_BOOKMARK)) != 0)
return (0);
/* Setup the requested properties nvlist. */
props = fnvlist_alloc();
fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_GUID));
fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_CREATETXG));
fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_CREATION));
/* Allocate an nvlist to hold the bookmarks. */
bmarks = fnvlist_alloc();
if ((err = lzc_get_bookmarks(zhp->zfs_name, props, &bmarks)) != 0)
goto out;
for (nvpair_t *pair = nvlist_next_nvpair(bmarks, NULL);
pair != NULL; pair = nvlist_next_nvpair(bmarks, pair)) {
char name[ZFS_MAXNAMELEN];
char *bmark_name;
nvlist_t *bmark_props;
bmark_name = nvpair_name(pair);
bmark_props = fnvpair_value_nvlist(pair);
(void) snprintf(name, sizeof (name), "%s#%s", zhp->zfs_name,
bmark_name);
nzhp = make_bookmark_handle(zhp, name, bmark_props);
if (nzhp == NULL)
continue;
if ((err = func(nzhp, data)) != 0)
goto out;
}
out:
fnvlist_free(props);
fnvlist_free(bmarks);
return (err);
}
/*
* Routines for dealing with the sorted snapshot functionality
*/
@@ -308,12 +362,11 @@ int
zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *spec_orig,
zfs_iter_f func, void *arg)
{
char buf[ZFS_MAXNAMELEN];
char *comma_separated, *cp;
char *buf, *comma_separated, *cp;
int err = 0;
int ret = 0;
(void) strlcpy(buf, spec_orig, sizeof (buf));
buf = zfs_strdup(fs_zhp->zfs_hdl, spec_orig);
cp = buf;
while ((comma_separated = strsep(&cp, ",")) != NULL) {
@@ -371,6 +424,7 @@ zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *spec_orig,
}
}
free(buf);
return (ret);
}
@@ -406,13 +460,13 @@ static int
iter_dependents_cb(zfs_handle_t *zhp, void *arg)
{
iter_dependents_arg_t *ida = arg;
int err;
int err = 0;
boolean_t first = ida->first;
ida->first = B_FALSE;
if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT) {
err = zfs_iter_clones(zhp, iter_dependents_cb, ida);
} else {
} else if (zhp->zfs_type != ZFS_TYPE_BOOKMARK) {
iter_stack_frame_t isf;
iter_stack_frame_t *f;
@@ -452,8 +506,12 @@ iter_dependents_cb(zfs_handle_t *zhp, void *arg)
}
ida->stack = isf.next;
}
if (!first && err == 0)
err = ida->func(zhp, ida->data);
else
zfs_close(zhp);
return (err);
}
@@ -20,9 +20,10 @@
*/
/*
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -36,6 +37,7 @@
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <libgen.h>
#include <sys/zfs_ioctl.h>
#include <dlfcn.h>
@@ -441,10 +443,9 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
prop = zpool_name_to_prop(propname);
if (prop == ZPROP_INVAL && zpool_prop_feature(propname)) {
int err;
zfeature_info_t *feature;
char *fname = strchr(propname, '@') + 1;
err = zfeature_lookup_name(fname, &feature);
err = zfeature_lookup_name(fname, NULL);
if (err != 0) {
ASSERT3U(err, ==, ENOENT);
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
@@ -837,14 +838,14 @@ zpool_prop_get_feature(zpool_handle_t *zhp, const char *propname, char *buf,
*/
if (supported) {
int ret;
zfeature_info_t *fi;
spa_feature_t fid;
ret = zfeature_lookup_name(feature, &fi);
ret = zfeature_lookup_name(feature, &fid);
if (ret != 0) {
(void) strlcpy(buf, "-", len);
return (ENOTSUP);
}
feature = fi->fi_guid;
feature = spa_feature_table[fid].fi_guid;
}
if (nvlist_lookup_uint64(features, feature, &refcount) == 0)
@@ -1111,7 +1112,6 @@ zpool_create(libzfs_handle_t *hdl, const char *pool, nvlist_t *nvroot,
nvlist_t *zc_fsprops = NULL;
nvlist_t *zc_props = NULL;
char msg[1024];
char *altroot;
int ret = -1;
(void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN,
@@ -1210,21 +1210,6 @@ zpool_create(libzfs_handle_t *hdl, const char *pool, nvlist_t *nvroot,
}
}
/*
* If this is an alternate root pool, then we automatically set the
* mountpoint of the root dataset to be '/'.
*/
if (nvlist_lookup_string(props, zpool_prop_to_name(ZPOOL_PROP_ALTROOT),
&altroot) == 0) {
zfs_handle_t *zhp;
verify((zhp = zfs_open(hdl, pool, ZFS_TYPE_DATASET)) != NULL);
verify(zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_MOUNTPOINT),
"/") == 0);
zfs_close(zhp);
}
create_failed:
zcmd_free_nvlists(&zc);
nvlist_free(zc_props);
@@ -1237,7 +1222,7 @@ create_failed:
* datasets left in the pool.
*/
int
zpool_destroy(zpool_handle_t *zhp)
zpool_destroy(zpool_handle_t *zhp, const char *log_str)
{
zfs_cmd_t zc = { 0 };
zfs_handle_t *zfp = NULL;
@@ -1249,6 +1234,7 @@ zpool_destroy(zpool_handle_t *zhp)
return (-1);
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
zc.zc_history = (uint64_t)(uintptr_t)log_str;
if (zfs_ioctl(hdl, ZFS_IOC_POOL_DESTROY, &zc) != 0) {
(void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN,
@@ -1403,8 +1389,9 @@ zpool_add(zpool_handle_t *zhp, nvlist_t *nvroot)
* Exports the pool from the system. The caller must ensure that there are no
* mounted datasets in the pool.
*/
int
zpool_export_common(zpool_handle_t *zhp, boolean_t force, boolean_t hardforce)
static int
zpool_export_common(zpool_handle_t *zhp, boolean_t force, boolean_t hardforce,
const char *log_str)
{
zfs_cmd_t zc = { 0 };
char msg[1024];
@@ -1415,6 +1402,7 @@ zpool_export_common(zpool_handle_t *zhp, boolean_t force, boolean_t hardforce)
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
zc.zc_cookie = force;
zc.zc_guid = hardforce;
zc.zc_history = (uint64_t)(uintptr_t)log_str;
if (zfs_ioctl(zhp->zpool_hdl, ZFS_IOC_POOL_EXPORT, &zc) != 0) {
switch (errno) {
@@ -1436,15 +1424,15 @@ zpool_export_common(zpool_handle_t *zhp, boolean_t force, boolean_t hardforce)
}
int
zpool_export(zpool_handle_t *zhp, boolean_t force)
zpool_export(zpool_handle_t *zhp, boolean_t force, const char *log_str)
{
return (zpool_export_common(zhp, force, B_FALSE));
return (zpool_export_common(zhp, force, B_FALSE, log_str));
}
int
zpool_export_force(zpool_handle_t *zhp)
zpool_export_force(zpool_handle_t *zhp, const char *log_str)
{
return (zpool_export_common(zhp, B_TRUE, B_TRUE));
return (zpool_export_common(zhp, B_TRUE, B_TRUE, log_str));
}
static void
@@ -1703,7 +1691,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
thename = origname;
}
if (props) {
if (props != NULL) {
uint64_t version;
prop_flags_t flags = { .create = B_FALSE, .import = B_TRUE };
@@ -1711,12 +1699,13 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
&version) == 0);
if ((props = zpool_valid_proplist(hdl, origname,
props, version, flags, errbuf)) == NULL) {
props, version, flags, errbuf)) == NULL)
return (-1);
} else if (zcmd_write_src_nvlist(hdl, &zc, props) != 0) {
if (zcmd_write_src_nvlist(hdl, &zc, props) != 0) {
nvlist_free(props);
return (-1);
}
nvlist_free(props);
}
(void) strlcpy(zc.zc_name, thename, sizeof (zc.zc_name));
@@ -1725,11 +1714,11 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
&zc.zc_guid) == 0);
if (zcmd_write_conf_nvlist(hdl, &zc, config) != 0) {
nvlist_free(props);
zcmd_free_nvlists(&zc);
return (-1);
}
if (zcmd_alloc_dst_nvlist(hdl, &zc, zc.zc_nvlist_conf_size * 2) != 0) {
nvlist_free(props);
zcmd_free_nvlists(&zc);
return (-1);
}
@@ -1745,6 +1734,9 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
error = errno;
(void) zcmd_read_dst_nvlist(hdl, &zc, &nv);
zcmd_free_nvlists(&zc);
zpool_get_rewind_policy(config, &policy);
if (error) {
@@ -1850,9 +1842,6 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
return (0);
}
zcmd_free_nvlists(&zc);
nvlist_free(props);
return (ret);
}
@@ -3314,8 +3303,10 @@ devid_to_path(char *devid_str)
if (ret != 0)
return (NULL);
if ((path = strdup(list[0].devname)) == NULL)
return (NULL);
/*
* In a case the strdup() fails, we will just return NULL below.
*/
path = strdup(list[0].devname);
devid_free_nmlist(list);
@@ -3632,40 +3623,30 @@ zpool_upgrade(zpool_handle_t *zhp, uint64_t new_version)
}
void
zpool_set_history_str(const char *subcommand, int argc, char **argv,
char *history_str)
zfs_save_arguments(int argc, char **argv, char *string, int len)
{
int i;
(void) strlcpy(history_str, subcommand, HIS_MAX_RECORD_LEN);
for (i = 1; i < argc; i++) {
if (strlen(history_str) + 1 + strlen(argv[i]) >
HIS_MAX_RECORD_LEN)
break;
(void) strlcat(history_str, " ", HIS_MAX_RECORD_LEN);
(void) strlcat(history_str, argv[i], HIS_MAX_RECORD_LEN);
(void) strlcpy(string, basename(argv[0]), len);
for (int i = 1; i < argc; i++) {
(void) strlcat(string, " ", len);
(void) strlcat(string, argv[i], len);
}
}
/*
* Stage command history for logging.
*/
int
zpool_stage_history(libzfs_handle_t *hdl, const char *history_str)
zpool_log_history(libzfs_handle_t *hdl, const char *message)
{
if (history_str == NULL)
return (EINVAL);
zfs_cmd_t zc = { 0 };
nvlist_t *args;
int err;
if (strlen(history_str) > HIS_MAX_RECORD_LEN)
return (EINVAL);
if (hdl->libzfs_log_str != NULL)
free(hdl->libzfs_log_str);
if ((hdl->libzfs_log_str = strdup(history_str)) == NULL)
return (no_memory(hdl));
return (0);
args = fnvlist_alloc();
fnvlist_add_string(args, "message", message);
err = zcmd_write_src_nvlist(hdl, &zc, args);
if (err == 0)
err = ioctl(hdl->libzfs_fd, ZFS_IOC_LOG_HISTORY, &zc);
nvlist_free(args);
zcmd_free_nvlists(&zc);
return (err);
}
/*
@@ -3758,7 +3739,9 @@ zpool_history_unpack(char *buf, uint64_t bytes_read, uint64_t *leftover,
return (0);
}
#define HIS_BUF_LEN (128*1024)
/* from spa_history.c: spa_history_create_obj() */
#define HIS_BUF_LEN_DEF (128 << 10)
#define HIS_BUF_LEN_MAX (1 << 30)
/*
* Retrieve the command history of a pool.
@@ -3766,21 +3749,24 @@ zpool_history_unpack(char *buf, uint64_t bytes_read, uint64_t *leftover,
int
zpool_get_history(zpool_handle_t *zhp, nvlist_t **nvhisp)
{
char buf[HIS_BUF_LEN];
char *buf = NULL;
uint64_t bufsize = HIS_BUF_LEN_DEF;
uint64_t off = 0;
nvlist_t **records = NULL;
uint_t numrecords = 0;
int err, i;
if ((buf = malloc(bufsize)) == NULL)
return (ENOMEM);
do {
uint64_t bytes_read = sizeof (buf);
uint64_t bytes_read = bufsize;
uint64_t leftover;
if ((err = get_history(zhp, buf, &off, &bytes_read)) != 0)
break;
/* if nothing else was read in, we're at EOF, just return */
if (!bytes_read)
if (bytes_read == 0)
break;
if ((err = zpool_history_unpack(buf, bytes_read,
@@ -3788,8 +3774,25 @@ zpool_get_history(zpool_handle_t *zhp, nvlist_t **nvhisp)
break;
off -= leftover;
/*
* If the history block is too big, double the buffer
* size and try again.
*/
if (leftover == bytes_read) {
free(buf);
buf = NULL;
bufsize <<= 1;
if ((bufsize >= HIS_BUF_LEN_MAX) ||
((buf = malloc(bufsize)) == NULL)) {
err = ENOMEM;
break;
}
}
/* CONSTCOND */
} while (1);
free(buf);
if (!err) {
verify(nvlist_alloc(nvhisp, NV_UNIQUE_NAME, 0) == 0);
@@ -4042,9 +4045,7 @@ supported_dump_vdev_type(libzfs_handle_t *hdl, nvlist_t *config, char *errbuf)
uint_t children, c;
verify(nvlist_lookup_string(config, ZPOOL_CONFIG_TYPE, &type) == 0);
if (strcmp(type, VDEV_TYPE_RAIDZ) == 0 ||
strcmp(type, VDEV_TYPE_FILE) == 0 ||
strcmp(type, VDEV_TYPE_LOG) == 0 ||
if (strcmp(type, VDEV_TYPE_FILE) == 0 ||
strcmp(type, VDEV_TYPE_HOLE) == 0 ||
strcmp(type, VDEV_TYPE_MISSING) == 0) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
@@ -4063,8 +4064,12 @@ supported_dump_vdev_type(libzfs_handle_t *hdl, nvlist_t *config, char *errbuf)
}
/*
* check if this zvol is allowable for use as a dump device; zero if
* it is, > 0 if it isn't, < 0 if it isn't a zvol
* Check if this zvol is allowable for use as a dump device; zero if
* it is, > 0 if it isn't, < 0 if it isn't a zvol.
*
* Allowable storage configurations include mirrors, all raidz variants, and
* pools with log, cache, and spare devices. Pools which are backed by files or
* have missing/hole vdevs are not suitable.
*/
int
zvol_check_dump_config(char *arg)
@@ -4126,12 +4131,6 @@ zvol_check_dump_config(char *arg)
verify(nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN,
&top, &toplevels) == 0);
if (toplevels != 1) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"'%s' has multiple top level vdevs"), poolname);
(void) zfs_error(hdl, EZFS_DEVOVERFLOW, errbuf);
goto out;
}
if (!supported_dump_vdev_type(hdl, top[0], errbuf)) {
goto out;
@@ -21,10 +21,11 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
*/
#include <assert.h>
@@ -53,6 +54,10 @@
#include <sys/zio_checksum.h>
#include <sys/ddt.h>
#ifdef __FreeBSD__
extern int zfs_ioctl_version;
#endif
/* in libzfs_dataset.c */
extern void zfs_setprop_error(libzfs_handle_t *, zfs_prop_t, int, char *);
/* We need to use something for ENODATA. */
@@ -727,7 +732,7 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg)
sd->parent_fromsnap_guid = 0;
VERIFY(0 == nvlist_alloc(&sd->parent_snaps, NV_UNIQUE_NAME, 0));
VERIFY(0 == nvlist_alloc(&sd->snapprops, NV_UNIQUE_NAME, 0));
(void) zfs_iter_snapshots(zhp, B_FALSE, send_iterate_snap, sd);
(void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd);
VERIFY(0 == nvlist_add_nvlist(nvfs, "snaps", sd->parent_snaps));
VERIFY(0 == nvlist_add_nvlist(nvfs, "snapprops", sd->snapprops));
nvlist_free(sd->parent_snaps);
@@ -798,6 +803,7 @@ typedef struct send_dump_data {
int outfd;
boolean_t err;
nvlist_t *fss;
nvlist_t *snapholds;
avl_tree_t *fsavl;
snapfilter_cb_t *filter_cb;
void *filter_cb_arg;
@@ -948,43 +954,19 @@ dump_ioctl(zfs_handle_t *zhp, const char *fromsnap, uint64_t fromsnap_obj,
return (0);
}
static int
hold_for_send(zfs_handle_t *zhp, send_dump_data_t *sdd)
static void
gather_holds(zfs_handle_t *zhp, send_dump_data_t *sdd)
{
zfs_handle_t *pzhp;
int error = 0;
char *thissnap;
assert(zhp->zfs_type == ZFS_TYPE_SNAPSHOT);
if (sdd->dryrun)
return (0);
/*
* zfs_send() only opens a cleanup_fd for sends that need it,
* zfs_send() only sets snapholds for sends that need them,
* e.g. replication and doall.
*/
if (sdd->cleanup_fd == -1)
return (0);
if (sdd->snapholds == NULL)
return;
thissnap = strchr(zhp->zfs_name, '@') + 1;
*(thissnap - 1) = '\0';
pzhp = zfs_open(zhp->zfs_hdl, zhp->zfs_name, ZFS_TYPE_DATASET);
*(thissnap - 1) = '@';
/*
* It's OK if the parent no longer exists. The send code will
* handle that error.
*/
if (pzhp) {
error = zfs_hold(pzhp, thissnap, sdd->holdtag,
B_FALSE, B_TRUE, B_TRUE, sdd->cleanup_fd,
zfs_prop_get_int(zhp, ZFS_PROP_OBJSETID),
zfs_prop_get_int(zhp, ZFS_PROP_CREATETXG));
zfs_close(pzhp);
}
return (error);
fnvlist_add_string(sdd->snapholds, zhp->zfs_name, sdd->holdtag);
}
static void *
@@ -1040,28 +1022,23 @@ dump_snapshot(zfs_handle_t *zhp, void *arg)
send_dump_data_t *sdd = arg;
progress_arg_t pa = { 0 };
pthread_t tid;
char *thissnap;
int err;
boolean_t isfromsnap, istosnap, fromorigin;
boolean_t exclude = B_FALSE;
err = 0;
thissnap = strchr(zhp->zfs_name, '@') + 1;
isfromsnap = (sdd->fromsnap != NULL &&
strcmp(sdd->fromsnap, thissnap) == 0);
if (!sdd->seenfrom && isfromsnap) {
err = hold_for_send(zhp, sdd);
if (err == 0) {
sdd->seenfrom = B_TRUE;
(void) strcpy(sdd->prevsnap, thissnap);
sdd->prevsnap_obj = zfs_prop_get_int(zhp,
ZFS_PROP_OBJSETID);
} else if (err == ENOENT) {
err = 0;
}
gather_holds(zhp, sdd);
sdd->seenfrom = B_TRUE;
(void) strcpy(sdd->prevsnap, thissnap);
sdd->prevsnap_obj = zfs_prop_get_int(zhp, ZFS_PROP_OBJSETID);
zfs_close(zhp);
return (err);
return (0);
}
if (sdd->seento || !sdd->seenfrom) {
@@ -1112,14 +1089,7 @@ dump_snapshot(zfs_handle_t *zhp, void *arg)
return (0);
}
err = hold_for_send(zhp, sdd);
if (err) {
if (err == ENOENT)
err = 0;
zfs_close(zhp);
return (err);
}
gather_holds(zhp, sdd);
fromorigin = sdd->prevsnap[0] == '\0' &&
(sdd->fromorigin || sdd->replicate);
@@ -1387,7 +1357,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
avl_tree_t *fsavl = NULL;
static uint64_t holdseq;
int spa_version;
pthread_t tid;
pthread_t tid = 0;
int pipefd[2];
dedup_arg_t dda = { 0 };
int featureflags = 0;
@@ -1460,11 +1430,8 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
*debugnvp = hdrnv;
else
nvlist_free(hdrnv);
if (err) {
fsavl_destroy(fsavl);
nvlist_free(fss);
if (err)
goto stderr_out;
}
}
if (!flags->dryrun) {
@@ -1488,8 +1455,6 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
}
free(packbuf);
if (err == -1) {
fsavl_destroy(fsavl);
nvlist_free(fss);
err = errno;
goto stderr_out;
}
@@ -1500,8 +1465,6 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
drr.drr_u.drr_end.drr_checksum = zc;
err = write(outfd, &drr, sizeof (drr));
if (err == -1) {
fsavl_destroy(fsavl);
nvlist_free(fss);
err = errno;
goto stderr_out;
}
@@ -1513,7 +1476,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
/* dump each stream */
sdd.fromsnap = fromsnap;
sdd.tosnap = tosnap;
if (flags->dedup)
if (tid != 0)
sdd.outfd = pipefd[0];
else
sdd.outfd = outfd;
@@ -1550,34 +1513,69 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
err = errno;
goto stderr_out;
}
sdd.snapholds = fnvlist_alloc();
} else {
sdd.cleanup_fd = -1;
sdd.snapholds = NULL;
}
if (flags->verbose) {
if (flags->verbose || sdd.snapholds != NULL) {
/*
* Do a verbose no-op dry run to get all the verbose output
* before generating any data. Then do a non-verbose real
* run to generate the streams.
* or to gather snapshot hold's before generating any data,
* then do a non-verbose real run to generate the streams.
*/
sdd.dryrun = B_TRUE;
err = dump_filesystems(zhp, &sdd);
sdd.dryrun = flags->dryrun;
sdd.verbose = B_FALSE;
if (flags->parsable) {
(void) fprintf(stderr, "size\t%llu\n",
(longlong_t)sdd.size);
} else {
char buf[16];
zfs_nicenum(sdd.size, buf, sizeof (buf));
(void) fprintf(stderr, dgettext(TEXT_DOMAIN,
"total estimated size is %s\n"), buf);
if (err != 0)
goto stderr_out;
if (flags->verbose) {
if (flags->parsable) {
(void) fprintf(stderr, "size\t%llu\n",
(longlong_t)sdd.size);
} else {
char buf[16];
zfs_nicenum(sdd.size, buf, sizeof (buf));
(void) fprintf(stderr, dgettext(TEXT_DOMAIN,
"total estimated size is %s\n"), buf);
}
}
/* Ensure no snaps found is treated as an error. */
if (!sdd.seento) {
err = ENOENT;
goto err_out;
}
/* Skip the second run if dryrun was requested. */
if (flags->dryrun)
goto err_out;
if (sdd.snapholds != NULL) {
err = zfs_hold_nvl(zhp, sdd.cleanup_fd, sdd.snapholds);
if (err != 0)
goto stderr_out;
fnvlist_free(sdd.snapholds);
sdd.snapholds = NULL;
}
sdd.dryrun = B_FALSE;
sdd.verbose = B_FALSE;
}
err = dump_filesystems(zhp, &sdd);
fsavl_destroy(fsavl);
nvlist_free(fss);
if (flags->dedup) {
/* Ensure no snaps found is treated as an error. */
if (err == 0 && !sdd.seento)
err = ENOENT;
if (tid != 0) {
if (err != 0)
(void) pthread_cancel(tid);
(void) close(pipefd[0]);
(void) pthread_join(tid, NULL);
}
@@ -1607,16 +1605,76 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
stderr_out:
err = zfs_standard_error(zhp->zfs_hdl, err, errbuf);
err_out:
fsavl_destroy(fsavl);
nvlist_free(fss);
fnvlist_free(sdd.snapholds);
if (sdd.cleanup_fd != -1)
VERIFY(0 == close(sdd.cleanup_fd));
if (flags->dedup) {
if (tid != 0) {
(void) pthread_cancel(tid);
(void) pthread_join(tid, NULL);
(void) close(pipefd[0]);
(void) pthread_join(tid, NULL);
}
return (err);
}
int
zfs_send_one(zfs_handle_t *zhp, const char *from, int fd)
{
int err;
libzfs_handle_t *hdl = zhp->zfs_hdl;
char errbuf[1024];
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
"warning: cannot send '%s'"), zhp->zfs_name);
err = lzc_send(zhp->zfs_name, from, fd);
if (err != 0) {
switch (errno) {
case EXDEV:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"not an earlier snapshot from the same fs"));
return (zfs_error(hdl, EZFS_CROSSTARGET, errbuf));
case ENOENT:
case ESRCH:
if (lzc_exists(zhp->zfs_name)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"incremental source (%s) does not exist"),
from);
}
return (zfs_error(hdl, EZFS_NOENT, errbuf));
case EBUSY:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"target is busy; if a filesystem, "
"it must not be mounted"));
return (zfs_error(hdl, EZFS_BUSY, errbuf));
case EDQUOT:
case EFBIG:
case EIO:
case ENOLINK:
case ENOSPC:
#ifdef illumos
case ENOSTR:
#endif
case ENXIO:
case EPIPE:
case ERANGE:
case EFAULT:
case EROFS:
zfs_error_aux(hdl, strerror(errno));
return (zfs_error(hdl, EZFS_BADBACKUP, errbuf));
default:
return (zfs_standard_error(hdl, errno, errbuf));
}
}
return (err != 0);
}
/*
* Routines specific to "zfs recv"
*/
@@ -1719,12 +1777,11 @@ recv_rename(libzfs_handle_t *hdl, const char *name, const char *tryname,
err = ENOENT;
}
if (err != 0 && strncmp(name+baselen, "recv-", 5) != 0) {
if (err != 0 && strncmp(name + baselen, "recv-", 5) != 0) {
seq++;
(void) strncpy(newname, name, baselen);
(void) snprintf(newname+baselen, ZFS_MAXNAMELEN-baselen,
"recv-%u-%u", getpid(), seq);
(void) snprintf(newname, ZFS_MAXNAMELEN, "%.*srecv-%u-%u",
baselen, name, getpid(), seq);
(void) strlcpy(zc.zc_value, newname, sizeof (zc.zc_value));
if (flags->verbose) {
@@ -1945,11 +2002,12 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs,
recvflags_t *flags, nvlist_t *stream_nv, avl_tree_t *stream_avl,
nvlist_t *renamed)
{
nvlist_t *local_nv;
nvlist_t *local_nv, *deleted = NULL;
avl_tree_t *local_avl;
nvpair_t *fselem, *nextfselem;
char *fromsnap;
char newname[ZFS_MAXNAMELEN];
char guidname[32];
int error;
boolean_t needagain, progress, recursive;
char *s1, *s2;
@@ -1965,6 +2023,8 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs,
again:
needagain = progress = B_FALSE;
VERIFY(0 == nvlist_alloc(&deleted, NV_UNIQUE_NAME, 0));
if ((error = gather_nvlist(hdl, tofs, fromsnap, NULL,
recursive, &local_nv, &local_avl)) != 0)
return (error);
@@ -2079,6 +2139,8 @@ again:
needagain = B_TRUE;
else
progress = B_TRUE;
sprintf(guidname, "%lu", thisguid);
nvlist_add_boolean(deleted, guidname);
continue;
}
@@ -2134,6 +2196,8 @@ again:
needagain = B_TRUE;
else
progress = B_TRUE;
sprintf(guidname, "%lu", parent_fromsnap_guid);
nvlist_add_boolean(deleted, guidname);
continue;
}
@@ -2155,6 +2219,24 @@ again:
s1 = strrchr(fsname, '/');
s2 = strrchr(stream_fsname, '/');
/*
* Check if we're going to rename based on parent guid change
* and the current parent guid was also deleted. If it was then
* rename will fail and is likely unneeded, so avoid this and
* force an early retry to determine the new
* parent_fromsnap_guid.
*/
if (stream_parent_fromsnap_guid != 0 &&
parent_fromsnap_guid != 0 &&
stream_parent_fromsnap_guid != parent_fromsnap_guid) {
sprintf(guidname, "%lu", parent_fromsnap_guid);
if (nvlist_exists(deleted, guidname)) {
progress = B_TRUE;
needagain = B_TRUE;
goto doagain;
}
}
/*
* Check for rename. If the exact receive path is specified, it
* does not count as a rename, but we still need to check the
@@ -2209,8 +2291,10 @@ again:
}
}
doagain:
fsavl_destroy(local_avl);
nvlist_free(local_nv);
nvlist_free(deleted);
if (needagain && progress) {
/* do another pass to fix up temporary names */
@@ -2649,9 +2733,17 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
/*
* Determine name of destination snapshot, store in zc_value.
*/
(void) strcpy(zc.zc_top_ds, tosnap);
(void) strcpy(zc.zc_value, tosnap);
(void) strncat(zc.zc_value, chopprefix, sizeof (zc.zc_value));
#ifdef __FreeBSD__
if (zfs_ioctl_version == ZFS_IOCVER_UNDEF)
zfs_ioctl_version = get_zfs_ioctl_version();
/*
* For forward compatibility hide tosnap in zc_value
*/
if (zfs_ioctl_version < ZFS_IOCVER_LZC)
(void) strcpy(zc.zc_value + strlen(zc.zc_value) + 1, tosnap);
#endif
free(cp);
if (!zfs_name_valid(zc.zc_value, ZFS_TYPE_SNAPSHOT)) {
zcmd_free_nvlists(&zc);
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
*/
/*
@@ -72,57 +73,66 @@ static char *zfs_msgid_table[] = {
/* ARGSUSED */
static int
vdev_missing(uint64_t state, uint64_t aux, uint64_t errs)
vdev_missing(vdev_stat_t *vs, uint_t vsc)
{
return (state == VDEV_STATE_CANT_OPEN &&
aux == VDEV_AUX_OPEN_FAILED);
return (vs->vs_state == VDEV_STATE_CANT_OPEN &&
vs->vs_aux == VDEV_AUX_OPEN_FAILED);
}
/* ARGSUSED */
static int
vdev_faulted(uint64_t state, uint64_t aux, uint64_t errs)
vdev_faulted(vdev_stat_t *vs, uint_t vsc)
{
return (state == VDEV_STATE_FAULTED);
return (vs->vs_state == VDEV_STATE_FAULTED);
}
/* ARGSUSED */
static int
vdev_errors(uint64_t state, uint64_t aux, uint64_t errs)
vdev_errors(vdev_stat_t *vs, uint_t vsc)
{
return (state == VDEV_STATE_DEGRADED || errs != 0);
return (vs->vs_state == VDEV_STATE_DEGRADED ||
vs->vs_read_errors != 0 || vs->vs_write_errors != 0 ||
vs->vs_checksum_errors != 0);
}
/* ARGSUSED */
static int
vdev_broken(uint64_t state, uint64_t aux, uint64_t errs)
vdev_broken(vdev_stat_t *vs, uint_t vsc)
{
return (state == VDEV_STATE_CANT_OPEN);
return (vs->vs_state == VDEV_STATE_CANT_OPEN);
}
/* ARGSUSED */
static int
vdev_offlined(uint64_t state, uint64_t aux, uint64_t errs)
vdev_offlined(vdev_stat_t *vs, uint_t vsc)
{
return (state == VDEV_STATE_OFFLINE);
return (vs->vs_state == VDEV_STATE_OFFLINE);
}
/* ARGSUSED */
static int
vdev_removed(uint64_t state, uint64_t aux, uint64_t errs)
vdev_removed(vdev_stat_t *vs, uint_t vsc)
{
return (state == VDEV_STATE_REMOVED);
return (vs->vs_state == VDEV_STATE_REMOVED);
}
static int
vdev_non_native_ashift(vdev_stat_t *vs, uint_t vsc)
{
return (VDEV_STAT_VALID(vs_physical_ashift, vsc) &&
vs->vs_configured_ashift < vs->vs_physical_ashift);
}
/*
* Detect if any leaf devices that have seen errors or could not be opened.
*/
static boolean_t
find_vdev_problem(nvlist_t *vdev, int (*func)(uint64_t, uint64_t, uint64_t))
find_vdev_problem(nvlist_t *vdev, int (*func)(vdev_stat_t *, uint_t),
boolean_t ignore_replacing)
{
nvlist_t **child;
vdev_stat_t *vs;
uint_t c, children;
char *type;
uint_t c, vsc, children;
/*
* Ignore problems within a 'replacing' vdev, since we're presumably in
@@ -130,26 +140,38 @@ find_vdev_problem(nvlist_t *vdev, int (*func)(uint64_t, uint64_t, uint64_t))
* out again. We'll pick up the fact that a resilver is happening
* later.
*/
verify(nvlist_lookup_string(vdev, ZPOOL_CONFIG_TYPE, &type) == 0);
if (strcmp(type, VDEV_TYPE_REPLACING) == 0)
return (B_FALSE);
if (ignore_replacing == B_TRUE) {
char *type;
verify(nvlist_lookup_string(vdev, ZPOOL_CONFIG_TYPE,
&type) == 0);
if (strcmp(type, VDEV_TYPE_REPLACING) == 0)
return (B_FALSE);
}
if (nvlist_lookup_nvlist_array(vdev, ZPOOL_CONFIG_CHILDREN, &child,
&children) == 0) {
for (c = 0; c < children; c++)
if (find_vdev_problem(child[c], func))
if (find_vdev_problem(child[c], func, ignore_replacing))
return (B_TRUE);
} else {
verify(nvlist_lookup_uint64_array(vdev, ZPOOL_CONFIG_VDEV_STATS,
(uint64_t **)&vs, &c) == 0);
(uint64_t **)&vs, &vsc) == 0);
if (func(vs->vs_state, vs->vs_aux,
vs->vs_read_errors +
vs->vs_write_errors +
vs->vs_checksum_errors))
if (func(vs, vsc) != 0)
return (B_TRUE);
}
/*
* Check any L2 cache devs
*/
if (nvlist_lookup_nvlist_array(vdev, ZPOOL_CONFIG_L2CACHE, &child,
&children) == 0) {
for (c = 0; c < children; c++)
if (find_vdev_problem(child[c], func, ignore_replacing))
return (B_TRUE);
}
return (B_FALSE);
}
@@ -259,15 +281,15 @@ check_status(nvlist_t *config, boolean_t isimport)
* Bad devices in non-replicated config.
*/
if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
find_vdev_problem(nvroot, vdev_faulted))
find_vdev_problem(nvroot, vdev_faulted, B_TRUE))
return (ZPOOL_STATUS_FAULTED_DEV_NR);
if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
find_vdev_problem(nvroot, vdev_missing))
find_vdev_problem(nvroot, vdev_missing, B_TRUE))
return (ZPOOL_STATUS_MISSING_DEV_NR);
if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
find_vdev_problem(nvroot, vdev_broken))
find_vdev_problem(nvroot, vdev_broken, B_TRUE))
return (ZPOOL_STATUS_CORRUPT_LABEL_NR);
/*
@@ -289,31 +311,37 @@ check_status(nvlist_t *config, boolean_t isimport)
/*
* Missing devices in a replicated config.
*/
if (find_vdev_problem(nvroot, vdev_faulted))
if (find_vdev_problem(nvroot, vdev_faulted, B_TRUE))
return (ZPOOL_STATUS_FAULTED_DEV_R);
if (find_vdev_problem(nvroot, vdev_missing))
if (find_vdev_problem(nvroot, vdev_missing, B_TRUE))
return (ZPOOL_STATUS_MISSING_DEV_R);
if (find_vdev_problem(nvroot, vdev_broken))
if (find_vdev_problem(nvroot, vdev_broken, B_TRUE))
return (ZPOOL_STATUS_CORRUPT_LABEL_R);
/*
* Devices with errors
*/
if (!isimport && find_vdev_problem(nvroot, vdev_errors))
if (!isimport && find_vdev_problem(nvroot, vdev_errors, B_TRUE))
return (ZPOOL_STATUS_FAILING_DEV);
/*
* Offlined devices
*/
if (find_vdev_problem(nvroot, vdev_offlined))
if (find_vdev_problem(nvroot, vdev_offlined, B_TRUE))
return (ZPOOL_STATUS_OFFLINE_DEV);
/*
* Removed device
*/
if (find_vdev_problem(nvroot, vdev_removed))
if (find_vdev_problem(nvroot, vdev_removed, B_TRUE))
return (ZPOOL_STATUS_REMOVED_DEV);
/*
* Suboptimal, but usable, ashift configuration.
*/
if (find_vdev_problem(nvroot, vdev_non_native_ashift, B_FALSE))
return (ZPOOL_STATUS_NON_NATIVE_ASHIFT);
/*
* Outdated, but usable, version
*/
@@ -48,6 +48,7 @@
#include <sys/types.h>
#include <libzfs.h>
#include <libzfs_core.h>
#include "libzfs_impl.h"
#include "zfs_prop.h"
@@ -657,6 +658,14 @@ libzfs_init(void)
hdl->libzfs_sharetab = fopen(ZFS_EXPORTS_PATH, "r");
if (libzfs_core_init() != 0) {
(void) close(hdl->libzfs_fd);
(void) fclose(hdl->libzfs_mnttab);
(void) fclose(hdl->libzfs_sharetab);
free(hdl);
return (NULL);
}
zfs_prop_init();
zpool_prop_init();
zpool_feature_init();
@@ -674,14 +683,13 @@ libzfs_fini(libzfs_handle_t *hdl)
if (hdl->libzfs_sharetab)
(void) fclose(hdl->libzfs_sharetab);
zfs_uninit_libshare(hdl);
if (hdl->libzfs_log_str)
(void) free(hdl->libzfs_log_str);
zpool_free_handles(hdl);
#ifdef sun
libzfs_fru_clear(hdl, B_TRUE);
#endif
namespace_clear(hdl);
libzfs_mnttab_fini(hdl);
libzfs_core_fini();
free(hdl);
}
@@ -855,19 +863,9 @@ zcmd_read_dst_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, nvlist_t **nvlp)
}
int
zfs_ioctl(libzfs_handle_t *hdl, unsigned long request, zfs_cmd_t *zc)
zfs_ioctl(libzfs_handle_t *hdl, int request, zfs_cmd_t *zc)
{
int error;
zc->zc_history = (uint64_t)(uintptr_t)hdl->libzfs_log_str;
error = ioctl(hdl->libzfs_fd, request, zc);
if (hdl->libzfs_log_str) {
free(hdl->libzfs_log_str);
hdl->libzfs_log_str = NULL;
}
zc->zc_history = 0;
return (error);
return (ioctl(hdl->libzfs_fd, request, zc));
}
/*
@@ -0,0 +1,760 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
*/
/*
* LibZFS_Core (lzc) is intended to replace most functionality in libzfs.
* It has the following characteristics:
*
* - Thread Safe. libzfs_core is accessible concurrently from multiple
* threads. This is accomplished primarily by avoiding global data
* (e.g. caching). Since it's thread-safe, there is no reason for a
* process to have multiple libzfs "instances". Therefore, we store
* our few pieces of data (e.g. the file descriptor) in global
* variables. The fd is reference-counted so that the libzfs_core
* library can be "initialized" multiple times (e.g. by different
* consumers within the same process).
*
* - Committed Interface. The libzfs_core interface will be committed,
* therefore consumers can compile against it and be confident that
* their code will continue to work on future releases of this code.
* Currently, the interface is Evolving (not Committed), but we intend
* to commit to it once it is more complete and we determine that it
* meets the needs of all consumers.
*
* - Programatic Error Handling. libzfs_core communicates errors with
* defined error numbers, and doesn't print anything to stdout/stderr.
*
* - Thin Layer. libzfs_core is a thin layer, marshaling arguments
* to/from the kernel ioctls. There is generally a 1:1 correspondence
* between libzfs_core functions and ioctls to /dev/zfs.
*
* - Clear Atomicity. Because libzfs_core functions are generally 1:1
* with kernel ioctls, and kernel ioctls are general atomic, each
* libzfs_core function is atomic. For example, creating multiple
* snapshots with a single call to lzc_snapshot() is atomic -- it
* can't fail with only some of the requested snapshots created, even
* in the event of power loss or system crash.
*
* - Continued libzfs Support. Some higher-level operations (e.g.
* support for "zfs send -R") are too complicated to fit the scope of
* libzfs_core. This functionality will continue to live in libzfs.
* Where appropriate, libzfs will use the underlying atomic operations
* of libzfs_core. For example, libzfs may implement "zfs send -R |
* zfs receive" by using individual "send one snapshot", rename,
* destroy, and "receive one snapshot" operations in libzfs_core.
* /sbin/zfs and /zbin/zpool will link with both libzfs and
* libzfs_core. Other consumers should aim to use only libzfs_core,
* since that will be the supported, stable interface going forwards.
*/
#define _IN_LIBZFS_CORE_
#include <libzfs_core.h>
#include <ctype.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include <sys/nvpair.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/zfs_ioctl.h>
#include "libzfs_core_compat.h"
#include "libzfs_compat.h"
#ifdef __FreeBSD__
extern int zfs_ioctl_version;
#endif
static int g_fd;
static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
static int g_refcount;
int
libzfs_core_init(void)
{
(void) pthread_mutex_lock(&g_lock);
if (g_refcount == 0) {
g_fd = open("/dev/zfs", O_RDWR);
if (g_fd < 0) {
(void) pthread_mutex_unlock(&g_lock);
return (errno);
}
}
g_refcount++;
(void) pthread_mutex_unlock(&g_lock);
return (0);
}
void
libzfs_core_fini(void)
{
(void) pthread_mutex_lock(&g_lock);
ASSERT3S(g_refcount, >, 0);
g_refcount--;
if (g_refcount == 0)
(void) close(g_fd);
(void) pthread_mutex_unlock(&g_lock);
}
static int
lzc_ioctl(zfs_ioc_t ioc, const char *name,
nvlist_t *source, nvlist_t **resultp)
{
zfs_cmd_t zc = { 0 };
int error = 0;
char *packed;
#ifdef __FreeBSD__
nvlist_t *oldsource;
#endif
size_t size;
ASSERT3S(g_refcount, >, 0);
(void) strlcpy(zc.zc_name, name, sizeof (zc.zc_name));
#ifdef __FreeBSD__
if (zfs_ioctl_version == ZFS_IOCVER_UNDEF)
zfs_ioctl_version = get_zfs_ioctl_version();
if (zfs_ioctl_version < ZFS_IOCVER_LZC) {
oldsource = source;
error = lzc_compat_pre(&zc, &ioc, &source);
if (error)
return (error);
}
#endif
packed = fnvlist_pack(source, &size);
zc.zc_nvlist_src = (uint64_t)(uintptr_t)packed;
zc.zc_nvlist_src_size = size;
if (resultp != NULL) {
*resultp = NULL;
zc.zc_nvlist_dst_size = MAX(size * 2, 128 * 1024);
zc.zc_nvlist_dst = (uint64_t)(uintptr_t)
malloc(zc.zc_nvlist_dst_size);
#ifdef illumos
if (zc.zc_nvlist_dst == NULL) {
#else
if (zc.zc_nvlist_dst == 0) {
#endif
error = ENOMEM;
goto out;
}
}
while (ioctl(g_fd, ioc, &zc) != 0) {
if (errno == ENOMEM && resultp != NULL) {
free((void *)(uintptr_t)zc.zc_nvlist_dst);
zc.zc_nvlist_dst_size *= 2;
zc.zc_nvlist_dst = (uint64_t)(uintptr_t)
malloc(zc.zc_nvlist_dst_size);
#ifdef illumos
if (zc.zc_nvlist_dst == NULL) {
#else
if (zc.zc_nvlist_dst == 0) {
#endif
error = ENOMEM;
goto out;
}
} else {
error = errno;
break;
}
}
#ifdef __FreeBSD__
if (zfs_ioctl_version < ZFS_IOCVER_LZC)
lzc_compat_post(&zc, ioc);
#endif
if (zc.zc_nvlist_dst_filled) {
*resultp = fnvlist_unpack((void *)(uintptr_t)zc.zc_nvlist_dst,
zc.zc_nvlist_dst_size);
}
#ifdef __FreeBSD__
if (zfs_ioctl_version < ZFS_IOCVER_LZC)
lzc_compat_outnvl(&zc, ioc, resultp);
#endif
out:
#ifdef __FreeBSD__
if (zfs_ioctl_version < ZFS_IOCVER_LZC) {
if (source != oldsource)
nvlist_free(source);
source = oldsource;
}
#endif
fnvlist_pack_free(packed, size);
free((void *)(uintptr_t)zc.zc_nvlist_dst);
return (error);
}
int
lzc_create(const char *fsname, dmu_objset_type_t type, nvlist_t *props)
{
int error;
nvlist_t *args = fnvlist_alloc();
fnvlist_add_int32(args, "type", type);
if (props != NULL)
fnvlist_add_nvlist(args, "props", props);
error = lzc_ioctl(ZFS_IOC_CREATE, fsname, args, NULL);
nvlist_free(args);
return (error);
}
int
lzc_clone(const char *fsname, const char *origin,
nvlist_t *props)
{
int error;
nvlist_t *args = fnvlist_alloc();
fnvlist_add_string(args, "origin", origin);
if (props != NULL)
fnvlist_add_nvlist(args, "props", props);
error = lzc_ioctl(ZFS_IOC_CLONE, fsname, args, NULL);
nvlist_free(args);
return (error);
}
/*
* Creates snapshots.
*
* The keys in the snaps nvlist are the snapshots to be created.
* They must all be in the same pool.
*
* The props nvlist is properties to set. Currently only user properties
* are supported. { user:prop_name -> string value }
*
* The returned results nvlist will have an entry for each snapshot that failed.
* The value will be the (int32) error code.
*
* The return value will be 0 if all snapshots were created, otherwise it will
* be the errno of a (unspecified) snapshot that failed.
*/
int
lzc_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t **errlist)
{
nvpair_t *elem;
nvlist_t *args;
int error;
char pool[MAXNAMELEN];
*errlist = NULL;
/* determine the pool name */
elem = nvlist_next_nvpair(snaps, NULL);
if (elem == NULL)
return (0);
(void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
pool[strcspn(pool, "/@")] = '\0';
args = fnvlist_alloc();
fnvlist_add_nvlist(args, "snaps", snaps);
if (props != NULL)
fnvlist_add_nvlist(args, "props", props);
error = lzc_ioctl(ZFS_IOC_SNAPSHOT, pool, args, errlist);
nvlist_free(args);
return (error);
}
/*
* Destroys snapshots.
*
* The keys in the snaps nvlist are the snapshots to be destroyed.
* They must all be in the same pool.
*
* Snapshots that do not exist will be silently ignored.
*
* If 'defer' is not set, and a snapshot has user holds or clones, the
* destroy operation will fail and none of the snapshots will be
* destroyed.
*
* If 'defer' is set, and a snapshot has user holds or clones, it will be
* marked for deferred destruction, and will be destroyed when the last hold
* or clone is removed/destroyed.
*
* The return value will be 0 if all snapshots were destroyed (or marked for
* later destruction if 'defer' is set) or didn't exist to begin with.
*
* Otherwise the return value will be the errno of a (unspecified) snapshot
* that failed, no snapshots will be destroyed, and the errlist will have an
* entry for each snapshot that failed. The value in the errlist will be
* the (int32) error code.
*/
int
lzc_destroy_snaps(nvlist_t *snaps, boolean_t defer, nvlist_t **errlist)
{
nvpair_t *elem;
nvlist_t *args;
int error;
char pool[MAXNAMELEN];
/* determine the pool name */
elem = nvlist_next_nvpair(snaps, NULL);
if (elem == NULL)
return (0);
(void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
pool[strcspn(pool, "/@")] = '\0';
args = fnvlist_alloc();
fnvlist_add_nvlist(args, "snaps", snaps);
if (defer)
fnvlist_add_boolean(args, "defer");
error = lzc_ioctl(ZFS_IOC_DESTROY_SNAPS, pool, args, errlist);
nvlist_free(args);
return (error);
}
int
lzc_snaprange_space(const char *firstsnap, const char *lastsnap,
uint64_t *usedp)
{
nvlist_t *args;
nvlist_t *result;
int err;
char fs[MAXNAMELEN];
char *atp;
/* determine the fs name */
(void) strlcpy(fs, firstsnap, sizeof (fs));
atp = strchr(fs, '@');
if (atp == NULL)
return (EINVAL);
*atp = '\0';
args = fnvlist_alloc();
fnvlist_add_string(args, "firstsnap", firstsnap);
err = lzc_ioctl(ZFS_IOC_SPACE_SNAPS, lastsnap, args, &result);
nvlist_free(args);
if (err == 0)
*usedp = fnvlist_lookup_uint64(result, "used");
fnvlist_free(result);
return (err);
}
boolean_t
lzc_exists(const char *dataset)
{
/*
* The objset_stats ioctl is still legacy, so we need to construct our
* own zfs_cmd_t rather than using zfsc_ioctl().
*/
zfs_cmd_t zc = { 0 };
(void) strlcpy(zc.zc_name, dataset, sizeof (zc.zc_name));
return (ioctl(g_fd, ZFS_IOC_OBJSET_STATS, &zc) == 0);
}
/*
* Create "user holds" on snapshots. If there is a hold on a snapshot,
* the snapshot can not be destroyed. (However, it can be marked for deletion
* by lzc_destroy_snaps(defer=B_TRUE).)
*
* The keys in the nvlist are snapshot names.
* The snapshots must all be in the same pool.
* The value is the name of the hold (string type).
*
* If cleanup_fd is not -1, it must be the result of open("/dev/zfs", O_EXCL).
* In this case, when the cleanup_fd is closed (including on process
* termination), the holds will be released. If the system is shut down
* uncleanly, the holds will be released when the pool is next opened
* or imported.
*
* Holds for snapshots which don't exist will be skipped and have an entry
* added to errlist, but will not cause an overall failure.
*
* The return value will be 0 if all holds, for snapshots that existed,
* were succesfully created.
*
* Otherwise the return value will be the errno of a (unspecified) hold that
* failed and no holds will be created.
*
* In all cases the errlist will have an entry for each hold that failed
* (name = snapshot), with its value being the error code (int32).
*/
int
lzc_hold(nvlist_t *holds, int cleanup_fd, nvlist_t **errlist)
{
char pool[MAXNAMELEN];
nvlist_t *args;
nvpair_t *elem;
int error;
/* determine the pool name */
elem = nvlist_next_nvpair(holds, NULL);
if (elem == NULL)
return (0);
(void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
pool[strcspn(pool, "/@")] = '\0';
args = fnvlist_alloc();
fnvlist_add_nvlist(args, "holds", holds);
if (cleanup_fd != -1)
fnvlist_add_int32(args, "cleanup_fd", cleanup_fd);
error = lzc_ioctl(ZFS_IOC_HOLD, pool, args, errlist);
nvlist_free(args);
return (error);
}
/*
* Release "user holds" on snapshots. If the snapshot has been marked for
* deferred destroy (by lzc_destroy_snaps(defer=B_TRUE)), it does not have
* any clones, and all the user holds are removed, then the snapshot will be
* destroyed.
*
* The keys in the nvlist are snapshot names.
* The snapshots must all be in the same pool.
* The value is a nvlist whose keys are the holds to remove.
*
* Holds which failed to release because they didn't exist will have an entry
* added to errlist, but will not cause an overall failure.
*
* The return value will be 0 if the nvl holds was empty or all holds that
* existed, were successfully removed.
*
* Otherwise the return value will be the errno of a (unspecified) hold that
* failed to release and no holds will be released.
*
* In all cases the errlist will have an entry for each hold that failed to
* to release.
*/
int
lzc_release(nvlist_t *holds, nvlist_t **errlist)
{
char pool[MAXNAMELEN];
nvpair_t *elem;
/* determine the pool name */
elem = nvlist_next_nvpair(holds, NULL);
if (elem == NULL)
return (0);
(void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
pool[strcspn(pool, "/@")] = '\0';
return (lzc_ioctl(ZFS_IOC_RELEASE, pool, holds, errlist));
}
/*
* Retrieve list of user holds on the specified snapshot.
*
* On success, *holdsp will be set to a nvlist which the caller must free.
* The keys are the names of the holds, and the value is the creation time
* of the hold (uint64) in seconds since the epoch.
*/
int
lzc_get_holds(const char *snapname, nvlist_t **holdsp)
{
int error;
nvlist_t *innvl = fnvlist_alloc();
error = lzc_ioctl(ZFS_IOC_GET_HOLDS, snapname, innvl, holdsp);
fnvlist_free(innvl);
return (error);
}
/*
*
* "snapname" is the full name of the snapshot to send (e.g. "pool/fs@snap")
*
* If "from" is NULL, a full (non-incremental) stream will be sent.
* If "from" is non-NULL, it must be the full name of a snapshot or
* bookmark to send an incremental from (e.g. "pool/fs@earlier_snap" or
* "pool/fs#earlier_bmark"). If non-NULL, the specified snapshot or
* bookmark must represent an earlier point in the history of "snapname").
* It can be an earlier snapshot in the same filesystem or zvol as "snapname",
* or it can be the origin of "snapname"'s filesystem, or an earlier
* snapshot in the origin, etc.
*
* "fd" is the file descriptor to write the send stream to.
*/
int
lzc_send(const char *snapname, const char *from, int fd)
{
nvlist_t *args;
int err;
args = fnvlist_alloc();
fnvlist_add_int32(args, "fd", fd);
if (from != NULL)
fnvlist_add_string(args, "fromsnap", from);
err = lzc_ioctl(ZFS_IOC_SEND_NEW, snapname, args, NULL);
nvlist_free(args);
return (err);
}
/*
* If fromsnap is NULL, a full (non-incremental) stream will be estimated.
*/
int
lzc_send_space(const char *snapname, const char *fromsnap, uint64_t *spacep)
{
nvlist_t *args;
nvlist_t *result;
int err;
args = fnvlist_alloc();
if (fromsnap != NULL)
fnvlist_add_string(args, "fromsnap", fromsnap);
err = lzc_ioctl(ZFS_IOC_SEND_SPACE, snapname, args, &result);
nvlist_free(args);
if (err == 0)
*spacep = fnvlist_lookup_uint64(result, "space");
nvlist_free(result);
return (err);
}
static int
recv_read(int fd, void *buf, int ilen)
{
char *cp = buf;
int rv;
int len = ilen;
do {
rv = read(fd, cp, len);
cp += rv;
len -= rv;
} while (rv > 0);
if (rv < 0 || len != 0)
return (EIO);
return (0);
}
/*
* The simplest receive case: receive from the specified fd, creating the
* specified snapshot. Apply the specified properties a "received" properties
* (which can be overridden by locally-set properties). If the stream is a
* clone, its origin snapshot must be specified by 'origin'. The 'force'
* flag will cause the target filesystem to be rolled back or destroyed if
* necessary to receive.
*
* Return 0 on success or an errno on failure.
*
* Note: this interface does not work on dedup'd streams
* (those with DMU_BACKUP_FEATURE_DEDUP).
*/
int
lzc_receive(const char *snapname, nvlist_t *props, const char *origin,
boolean_t force, int fd)
{
/*
* The receive ioctl is still legacy, so we need to construct our own
* zfs_cmd_t rather than using zfsc_ioctl().
*/
zfs_cmd_t zc = { 0 };
char *atp;
char *packed = NULL;
size_t size;
dmu_replay_record_t drr;
int error;
ASSERT3S(g_refcount, >, 0);
/* zc_name is name of containing filesystem */
(void) strlcpy(zc.zc_name, snapname, sizeof (zc.zc_name));
atp = strchr(zc.zc_name, '@');
if (atp == NULL)
return (EINVAL);
*atp = '\0';
/* if the fs does not exist, try its parent. */
if (!lzc_exists(zc.zc_name)) {
char *slashp = strrchr(zc.zc_name, '/');
if (slashp == NULL)
return (ENOENT);
*slashp = '\0';
}
/* zc_value is full name of the snapshot to create */
(void) strlcpy(zc.zc_value, snapname, sizeof (zc.zc_value));
if (props != NULL) {
/* zc_nvlist_src is props to set */
packed = fnvlist_pack(props, &size);
zc.zc_nvlist_src = (uint64_t)(uintptr_t)packed;
zc.zc_nvlist_src_size = size;
}
/* zc_string is name of clone origin (if DRR_FLAG_CLONE) */
if (origin != NULL)
(void) strlcpy(zc.zc_string, origin, sizeof (zc.zc_string));
/* zc_begin_record is non-byteswapped BEGIN record */
error = recv_read(fd, &drr, sizeof (drr));
if (error != 0)
goto out;
zc.zc_begin_record = drr.drr_u.drr_begin;
/* zc_cookie is fd to read from */
zc.zc_cookie = fd;
/* zc guid is force flag */
zc.zc_guid = force;
/* zc_cleanup_fd is unused */
zc.zc_cleanup_fd = -1;
error = ioctl(g_fd, ZFS_IOC_RECV, &zc);
if (error != 0)
error = errno;
out:
if (packed != NULL)
fnvlist_pack_free(packed, size);
free((void*)(uintptr_t)zc.zc_nvlist_dst);
return (error);
}
/*
* Roll back this filesystem or volume to its most recent snapshot.
* If snapnamebuf is not NULL, it will be filled in with the name
* of the most recent snapshot.
*
* Return 0 on success or an errno on failure.
*/
int
lzc_rollback(const char *fsname, char *snapnamebuf, int snapnamelen)
{
nvlist_t *args;
nvlist_t *result;
int err;
args = fnvlist_alloc();
err = lzc_ioctl(ZFS_IOC_ROLLBACK, fsname, args, &result);
nvlist_free(args);
if (err == 0 && snapnamebuf != NULL) {
const char *snapname = fnvlist_lookup_string(result, "target");
(void) strlcpy(snapnamebuf, snapname, snapnamelen);
}
return (err);
}
/*
* Creates bookmarks.
*
* The bookmarks nvlist maps from name of the bookmark (e.g. "pool/fs#bmark") to
* the name of the snapshot (e.g. "pool/fs@snap"). All the bookmarks and
* snapshots must be in the same pool.
*
* The returned results nvlist will have an entry for each bookmark that failed.
* The value will be the (int32) error code.
*
* The return value will be 0 if all bookmarks were created, otherwise it will
* be the errno of a (undetermined) bookmarks that failed.
*/
int
lzc_bookmark(nvlist_t *bookmarks, nvlist_t **errlist)
{
nvpair_t *elem;
int error;
char pool[MAXNAMELEN];
/* determine the pool name */
elem = nvlist_next_nvpair(bookmarks, NULL);
if (elem == NULL)
return (0);
(void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
pool[strcspn(pool, "/#")] = '\0';
error = lzc_ioctl(ZFS_IOC_BOOKMARK, pool, bookmarks, errlist);
return (error);
}
/*
* Retrieve bookmarks.
*
* Retrieve the list of bookmarks for the given file system. The props
* parameter is an nvlist of property names (with no values) that will be
* returned for each bookmark.
*
* The following are valid properties on bookmarks, all of which are numbers
* (represented as uint64 in the nvlist)
*
* "guid" - globally unique identifier of the snapshot it refers to
* "createtxg" - txg when the snapshot it refers to was created
* "creation" - timestamp when the snapshot it refers to was created
*
* The format of the returned nvlist as follows:
* <short name of bookmark> -> {
* <name of property> -> {
* "value" -> uint64
* }
* }
*/
int
lzc_get_bookmarks(const char *fsname, nvlist_t *props, nvlist_t **bmarks)
{
return (lzc_ioctl(ZFS_IOC_GET_BOOKMARKS, fsname, props, bmarks));
}
/*
* Destroys bookmarks.
*
* The keys in the bmarks nvlist are the bookmarks to be destroyed.
* They must all be in the same pool. Bookmarks are specified as
* <fs>#<bmark>.
*
* Bookmarks that do not exist will be silently ignored.
*
* The return value will be 0 if all bookmarks that existed were destroyed.
*
* Otherwise the return value will be the errno of a (undetermined) bookmark
* that failed, no bookmarks will be destroyed, and the errlist will have an
* entry for each bookmarks that failed. The value in the errlist will be
* the (int32) error code.
*/
int
lzc_destroy_bookmarks(nvlist_t *bmarks, nvlist_t **errlist)
{
nvpair_t *elem;
int error;
char pool[MAXNAMELEN];
/* determine the pool name */
elem = nvlist_next_nvpair(bmarks, NULL);
if (elem == NULL)
return (0);
(void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
pool[strcspn(pool, "/#")] = '\0';
error = lzc_ioctl(ZFS_IOC_DESTROY_BOOKMARKS, pool, bmarks, errlist);
return (error);
}
@@ -0,0 +1,68 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2013 by Martin Matuska <mm@FreeBSD.org>. All rights reserved.
*/
#ifndef _LIBZFS_CORE_H
#define _LIBZFS_CORE_H
#include <libnvpair.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/fs/zfs.h>
#ifdef __cplusplus
extern "C" {
#endif
int libzfs_core_init(void);
void libzfs_core_fini(void);
int lzc_snapshot(nvlist_t *, nvlist_t *, nvlist_t **);
int lzc_create(const char *, dmu_objset_type_t, nvlist_t *);
int lzc_clone(const char *, const char *, nvlist_t *);
int lzc_destroy_snaps(nvlist_t *, boolean_t, nvlist_t **);
int lzc_bookmark(nvlist_t *, nvlist_t **);
int lzc_get_bookmarks(const char *, nvlist_t *, nvlist_t **);
int lzc_destroy_bookmarks(nvlist_t *, nvlist_t **);
int lzc_snaprange_space(const char *, const char *, uint64_t *);
int lzc_hold(nvlist_t *, int, nvlist_t **);
int lzc_release(nvlist_t *, nvlist_t **);
int lzc_get_holds(const char *, nvlist_t **);
int lzc_send(const char *, const char *, int);
int lzc_receive(const char *, nvlist_t *, const char *, boolean_t, int);
int lzc_send_space(const char *, const char *, uint64_t *);
boolean_t lzc_exists(const char *);
int lzc_rollback(const char *, char *, int);
#ifdef __cplusplus
}
#endif
#endif /* _LIBZFS_CORE_H */
@@ -0,0 +1,189 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2013 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
*/
#include <sys/zfs_ioctl.h>
#include <zfs_ioctl_compat.h>
#include "libzfs_core_compat.h"
extern int zfs_ioctl_version;
int
lzc_compat_pre(zfs_cmd_t *zc, zfs_ioc_t *ioc, nvlist_t **source)
{
nvlist_t *nvl = NULL;
nvpair_t *pair, *hpair;
char *buf, *val;
zfs_ioc_t vecnum;
uint32_t type32;
int32_t cleanup_fd;
int error = 0;
int pos;
if (zfs_ioctl_version >= ZFS_IOCVER_LZC)
return (0);
vecnum = *ioc;
switch (vecnum) {
case ZFS_IOC_CREATE:
type32 = fnvlist_lookup_int32(*source, "type");
zc->zc_objset_type = (uint64_t)type32;
nvlist_lookup_nvlist(*source, "props", &nvl);
*source = nvl;
break;
case ZFS_IOC_CLONE:
buf = fnvlist_lookup_string(*source, "origin");
strlcpy(zc->zc_value, buf, MAXPATHLEN);
nvlist_lookup_nvlist(*source, "props", &nvl);
*ioc = ZFS_IOC_CREATE;
*source = nvl;
break;
case ZFS_IOC_SNAPSHOT:
nvl = fnvlist_lookup_nvlist(*source, "snaps");
pair = nvlist_next_nvpair(nvl, NULL);
if (pair != NULL) {
buf = nvpair_name(pair);
pos = strcspn(buf, "@");
strlcpy(zc->zc_name, buf, pos + 1);
strlcpy(zc->zc_value, buf + pos + 1, MAXPATHLEN);
} else
error = EINVAL;
/* old kernel cannot create multiple snapshots */
if (!error && nvlist_next_nvpair(nvl, pair) != NULL)
error = EOPNOTSUPP;
nvlist_free(nvl);
nvl = NULL;
nvlist_lookup_nvlist(*source, "props", &nvl);
*source = nvl;
break;
case ZFS_IOC_SPACE_SNAPS:
buf = fnvlist_lookup_string(*source, "firstsnap");
strlcpy(zc->zc_value, buf, MAXPATHLEN);
break;
case ZFS_IOC_DESTROY_SNAPS:
nvl = fnvlist_lookup_nvlist(*source, "snaps");
pair = nvlist_next_nvpair(nvl, NULL);
if (pair != NULL) {
buf = nvpair_name(pair);
pos = strcspn(buf, "@");
strlcpy(zc->zc_name, buf, pos + 1);
} else
error = EINVAL;
/* old kernel cannot atomically destroy multiple snaps */
if (!error && nvlist_next_nvpair(nvl, pair) != NULL)
error = EOPNOTSUPP;
*source = nvl;
break;
case ZFS_IOC_HOLD:
nvl = fnvlist_lookup_nvlist(*source, "holds");
pair = nvlist_next_nvpair(nvl, NULL);
if (pair != NULL) {
buf = nvpair_name(pair);
pos = strcspn(buf, "@");
strlcpy(zc->zc_name, buf, pos + 1);
strlcpy(zc->zc_value, buf + pos + 1, MAXPATHLEN);
if (nvpair_value_string(pair, &val) == 0)
strlcpy(zc->zc_string, val, MAXNAMELEN);
else
error = EINVAL;
} else
error = EINVAL;
/* old kernel cannot atomically create multiple holds */
if (!error && nvlist_next_nvpair(nvl, pair) != NULL)
error = EOPNOTSUPP;
nvlist_free(nvl);
if (nvlist_lookup_int32(*source, "cleanup_fd",
&cleanup_fd) == 0)
zc->zc_cleanup_fd = cleanup_fd;
else
zc->zc_cleanup_fd = -1;
break;
case ZFS_IOC_RELEASE:
pair = nvlist_next_nvpair(*source, NULL);
if (pair != NULL) {
buf = nvpair_name(pair);
pos = strcspn(buf, "@");
strlcpy(zc->zc_name, buf, pos + 1);
strlcpy(zc->zc_value, buf + pos + 1, MAXPATHLEN);
if (nvpair_value_nvlist(pair, &nvl) == 0) {
hpair = nvlist_next_nvpair(nvl, NULL);
if (hpair != NULL)
strlcpy(zc->zc_string,
nvpair_name(hpair), MAXNAMELEN);
else
error = EINVAL;
if (!error && nvlist_next_nvpair(nvl,
hpair) != NULL)
error = EOPNOTSUPP;
} else
error = EINVAL;
} else
error = EINVAL;
/* old kernel cannot atomically release multiple holds */
if (!error && nvlist_next_nvpair(nvl, pair) != NULL)
error = EOPNOTSUPP;
break;
}
return (error);
}
void
lzc_compat_post(zfs_cmd_t *zc, const zfs_ioc_t ioc)
{
if (zfs_ioctl_version >= ZFS_IOCVER_LZC)
return;
switch (ioc) {
case ZFS_IOC_CREATE:
case ZFS_IOC_CLONE:
case ZFS_IOC_SNAPSHOT:
case ZFS_IOC_SPACE_SNAPS:
case ZFS_IOC_DESTROY_SNAPS:
zc->zc_nvlist_dst_filled = B_FALSE;
break;
}
}
int
lzc_compat_outnvl(zfs_cmd_t *zc, const zfs_ioc_t ioc, nvlist_t **outnvl)
{
nvlist_t *nvl;
if (zfs_ioctl_version >= ZFS_IOCVER_LZC)
return (0);
switch (ioc) {
case ZFS_IOC_SPACE_SNAPS:
nvl = fnvlist_alloc();
fnvlist_add_uint64(nvl, "used", zc->zc_cookie);
fnvlist_add_uint64(nvl, "compressed", zc->zc_objset_type);
fnvlist_add_uint64(nvl, "uncompressed", zc->zc_perm_action);
*outnvl = nvl;
break;
}
return (0);
}
@@ -0,0 +1,47 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2013 by Martin Matuska <mm@FreeBSD.org>. All rights reserved.
*/
#ifndef _LIBZFS_CORE_COMPAT_H
#define _LIBZFS_CORE_COMPAT_H
#include <libnvpair.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/fs/zfs.h>
#include <sys/zfs_ioctl.h>
#ifdef __cplusplus
extern "C" {
#endif
int lzc_compat_pre(zfs_cmd_t *, zfs_ioc_t *, nvlist_t **);
void lzc_compat_post(zfs_cmd_t *, const zfs_ioc_t);
int lzc_compat_outnvl(zfs_cmd_t *, const zfs_ioc_t, nvlist_t **);
#ifdef __cplusplus
}
#endif
#endif /* _LIBZFS_CORE_COMPAT_H */
@@ -33,6 +33,7 @@
#include <sys/stat.h>
#include <sys/processor.h>
#include <sys/zfs_context.h>
#include <sys/rrwlock.h>
#include <sys/zmod.h>
#include <sys/utsname.h>
#include <sys/systeminfo.h>
@@ -345,6 +346,41 @@ top:
return (1);
}
/*ARGSUSED*/
clock_t
cv_timedwait_hires(kcondvar_t *cv, kmutex_t *mp, hrtime_t tim, hrtime_t res,
int flag)
{
int error;
timestruc_t ts;
hrtime_t delta;
ASSERT(flag == 0);
top:
delta = tim - gethrtime();
if (delta <= 0)
return (-1);
ts.tv_sec = delta / NANOSEC;
ts.tv_nsec = delta % NANOSEC;
ASSERT(mutex_owner(mp) == curthread);
mp->m_owner = NULL;
error = pthread_cond_timedwait(cv, &mp->m_lock, &ts);
mp->m_owner = curthread;
if (error == ETIMEDOUT)
return (-1);
if (error == EINTR)
goto top;
ASSERT(error == 0);
return (1);
}
void
cv_signal(kcondvar_t *cv)
{
@@ -587,6 +623,12 @@ dprintf_setup(int *argc, char **argv)
dprintf_print_all = 1;
}
int
sysctl_handle_64(SYSCTL_HANDLER_ARGS)
{
return (0);
}
/*
* =========================================================================
* debug printfs
@@ -616,7 +658,7 @@ __dprintf(const char *file, const char *func, int line, const char *fmt, ...)
if (dprintf_find_string("pid"))
(void) printf("%d ", getpid());
if (dprintf_find_string("tid"))
(void) printf("%u ", thr_self());
(void) printf("%ul ", thr_self());
#if 0
if (dprintf_find_string("cpu"))
(void) printf("%u ", getcpuid());
@@ -860,6 +902,8 @@ umem_out_of_memory(void)
void
kernel_init(int mode)
{
extern uint_t rrw_tsd_key;
umem_nofail_callback(umem_out_of_memory);
physmem = sysconf(_SC_PHYS_PAGES);
@@ -876,6 +920,8 @@ kernel_init(int mode)
system_taskq_init();
spa_init(mode);
tsd_create(&rrw_tsd_key, rrw_tsd_destroy);
}
void
@@ -923,6 +969,12 @@ crgetuid(cred_t *cr)
return (0);
}
uid_t
crgetruid(cred_t *cr)
{
return (0);
}
gid_t
crgetgid(cred_t *cr)
{
@@ -1044,3 +1096,50 @@ zvol_create_minors(const char *name)
return (0);
}
#endif
#ifdef illumos
void
bioinit(buf_t *bp)
{
bzero(bp, sizeof (buf_t));
}
void
biodone(buf_t *bp)
{
if (bp->b_iodone != NULL) {
(*(bp->b_iodone))(bp);
return;
}
ASSERT((bp->b_flags & B_DONE) == 0);
bp->b_flags |= B_DONE;
}
void
bioerror(buf_t *bp, int error)
{
ASSERT(bp != NULL);
ASSERT(error >= 0);
if (error != 0) {
bp->b_flags |= B_ERROR;
} else {
bp->b_flags &= ~B_ERROR;
}
bp->b_error = error;
}
int
geterror(struct buf *bp)
{
int error = 0;
if (bp->b_flags & B_ERROR) {
error = bp->b_error;
if (!error)
error = EIO;
}
return (error);
}
#endif
@@ -20,8 +20,12 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _SYS_ZFS_CONTEXT_H
#define _SYS_ZFS_CONTEXT_H
@@ -60,6 +64,9 @@ extern "C" {
#include <umem.h>
#include <inttypes.h>
#include <fsshare.h>
#include <pthread.h>
#include <sched.h>
#include <sys/debug.h>
#include <sys/note.h>
#include <sys/types.h>
#include <sys/cred.h>
@@ -84,6 +91,9 @@ extern "C" {
#include <sys/sysevent/dev.h>
#include <machine/atomic.h>
#include <sys/debug.h>
#ifdef illumos
#include "zfs.h"
#endif
#define ZFS_EXPORTS_PATH "/etc/zfs/exports"
@@ -131,34 +141,72 @@ extern int aok;
#ifdef DTRACE_PROBE
#undef DTRACE_PROBE
#define DTRACE_PROBE(a) ((void)0)
#endif /* DTRACE_PROBE */
#ifdef illumos
#define DTRACE_PROBE(a) \
ZFS_PROBE0(#a)
#endif
#ifdef DTRACE_PROBE1
#undef DTRACE_PROBE1
#define DTRACE_PROBE1(a, b, c) ((void)0)
#endif /* DTRACE_PROBE1 */
#ifdef illumos
#define DTRACE_PROBE1(a, b, c) \
ZFS_PROBE1(#a, (unsigned long)c)
#endif
#ifdef DTRACE_PROBE2
#undef DTRACE_PROBE2
#define DTRACE_PROBE2(a, b, c, d, e) ((void)0)
#endif /* DTRACE_PROBE2 */
#ifdef illumos
#define DTRACE_PROBE2(a, b, c, d, e) \
ZFS_PROBE2(#a, (unsigned long)c, (unsigned long)e)
#endif
#ifdef DTRACE_PROBE3
#undef DTRACE_PROBE3
#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void)0)
#endif /* DTRACE_PROBE3 */
#ifdef illumos
#define DTRACE_PROBE3(a, b, c, d, e, f, g) \
ZFS_PROBE3(#a, (unsigned long)c, (unsigned long)e, (unsigned long)g)
#endif
#ifdef DTRACE_PROBE4
#undef DTRACE_PROBE4
#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0)
#endif /* DTRACE_PROBE4 */
#ifdef illumos
#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) \
ZFS_PROBE4(#a, (unsigned long)c, (unsigned long)e, (unsigned long)g, \
(unsigned long)i)
#endif
#ifdef illumos
/*
* We use the comma operator so that this macro can be used without much
* additional code. For example, "return (EINVAL);" becomes
* "return (SET_ERROR(EINVAL));". Note that the argument will be evaluated
* twice, so it should not have side effects (e.g. something like:
* "return (SET_ERROR(log_error(EINVAL, info)));" would log the error twice).
*/
#define SET_ERROR(err) (ZFS_SET_ERROR(err), err)
#else /* !illumos */
#define DTRACE_PROBE(a) ((void)0)
#define DTRACE_PROBE1(a, b, c) ((void)0)
#define DTRACE_PROBE2(a, b, c, d, e) ((void)0)
#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void)0)
#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0)
#define SET_ERROR(err) (err)
#endif /* !illumos */
/*
* Threads
*/
#define curthread ((void *)(uintptr_t)thr_self())
#define kpreempt(x) sched_yield()
typedef struct kthread kthread_t;
#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \
@@ -242,6 +290,9 @@ typedef int krw_t;
#define RW_WRITE_HELD(x) ((x)->rw_owner == curthread)
#define RW_LOCK_HELD(x) rw_lock_held(x)
#undef RW_LOCK_HELD
#define RW_LOCK_HELD(x) (RW_READ_HELD(x) || RW_WRITE_HELD(x))
extern void rw_init(krwlock_t *rwlp, char *name, int type, void *arg);
extern void rw_destroy(krwlock_t *rwlp);
extern void rw_enter(krwlock_t *rwlp, krw_t rw);
@@ -252,6 +303,7 @@ extern int rw_lock_held(krwlock_t *rwlp);
#define rw_downgrade(rwlp) do { } while (0)
extern uid_t crgetuid(cred_t *cr);
extern uid_t crgetruid(cred_t *cr);
extern gid_t crgetgid(cred_t *cr);
extern int crgetngroups(cred_t *cr);
extern gid_t *crgetgroups(cred_t *cr);
@@ -267,9 +319,19 @@ extern void cv_init(kcondvar_t *cv, char *name, int type, void *arg);
extern void cv_destroy(kcondvar_t *cv);
extern void cv_wait(kcondvar_t *cv, kmutex_t *mp);
extern clock_t cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime);
extern clock_t cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim,
hrtime_t res, int flag);
extern void cv_signal(kcondvar_t *cv);
extern void cv_broadcast(kcondvar_t *cv);
/*
* Thread-specific data
*/
#define tsd_get(k) pthread_getspecific(k)
#define tsd_set(k, v) pthread_setspecific(k, v)
#define tsd_create(kp, d) pthread_key_create(kp, d)
#define tsd_destroy(kp) /* nothing */
/*
* Kernel memory
*/
@@ -310,6 +372,16 @@ typedef struct taskq taskq_t;
typedef uintptr_t taskqid_t;
typedef void (task_func_t)(void *);
typedef struct taskq_ent {
struct taskq_ent *tqent_next;
struct taskq_ent *tqent_prev;
task_func_t *tqent_func;
void *tqent_arg;
uintptr_t tqent_flags;
} taskq_ent_t;
#define TQENT_FLAG_PREALLOC 0x1 /* taskq_dispatch_ent used */
#define TASKQ_PREPOPULATE 0x0001
#define TASKQ_CPR_SAFE 0x0002 /* Use CPR safe protocol */
#define TASKQ_DYNAMIC 0x0004 /* Use dynamic thread scheduling */
@@ -321,6 +393,7 @@ typedef void (task_func_t)(void *);
#define TQ_NOQUEUE 0x02 /* Do not enqueue if can't dispatch */
#define TQ_FRONT 0x08 /* Queue in front */
extern taskq_t *system_taskq;
extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t);
@@ -329,6 +402,8 @@ extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t);
#define taskq_create_sysdc(a, b, d, e, p, dc, f) \
(taskq_create(a, b, maxclsyspri, d, e, f))
extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t);
extern void taskq_dispatch_ent(taskq_t *, task_func_t, void *, uint_t,
taskq_ent_t *);
extern void taskq_destroy(taskq_t *);
extern void taskq_wait(taskq_t *);
extern int taskq_member(taskq_t *, void *);
@@ -523,7 +598,7 @@ typedef struct callb_cpr {
#define INGLOBALZONE(z) (1)
extern char *kmem_asprintf(const char *fmt, ...);
#define strfree(str) kmem_free((str), strlen(str)+1)
#define strfree(str) kmem_free((str), strlen(str) + 1)
/*
* Hostname information
@@ -609,11 +684,55 @@ typedef uint32_t idmap_rid_t;
#define SX_SYSINIT(name, lock, desc)
#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, \
intptr_t arg2, struct sysctl_req *req
/*
* This describes the access space for a sysctl request. This is needed
* so that we can use the interface from the kernel or from user-space.
*/
struct sysctl_req {
struct thread *td; /* used for access checking */
int lock; /* wiring state */
void *oldptr;
size_t oldlen;
size_t oldidx;
int (*oldfunc)(struct sysctl_req *, const void *, size_t);
void *newptr;
size_t newlen;
size_t newidx;
int (*newfunc)(struct sysctl_req *, void *, size_t);
size_t validlen;
int flags;
};
SLIST_HEAD(sysctl_oid_list, sysctl_oid);
/*
* This describes one "oid" in the MIB tree. Potentially more nodes can
* be hidden behind it, expanded by the handler.
*/
struct sysctl_oid {
struct sysctl_oid_list *oid_parent;
SLIST_ENTRY(sysctl_oid) oid_link;
int oid_number;
u_int oid_kind;
void *oid_arg1;
intptr_t oid_arg2;
const char *oid_name;
int (*oid_handler)(SYSCTL_HANDLER_ARGS);
const char *oid_fmt;
int oid_refcnt;
u_int oid_running;
const char *oid_descr;
};
#define SYSCTL_DECL(...)
#define SYSCTL_NODE(...)
#define SYSCTL_INT(...)
#define SYSCTL_UINT(...)
#define SYSCTL_ULONG(...)
#define SYSCTL_PROC(...)
#define SYSCTL_QUAD(...)
#ifdef TUNABLE_INT
#undef TUNABLE_INT
@@ -624,12 +743,46 @@ typedef uint32_t idmap_rid_t;
#define TUNABLE_ULONG(...)
#define TUNABLE_QUAD(...)
int sysctl_handle_64(SYSCTL_HANDLER_ARGS);
/* Errors */
#ifndef ERESTART
#define ERESTART (-1)
#endif
#ifdef illumos
/*
* Buf structure
*/
#define B_BUSY 0x0001
#define B_DONE 0x0002
#define B_ERROR 0x0004
#define B_READ 0x0040 /* read when I/O occurs */
#define B_WRITE 0x0100 /* non-read pseudo-flag */
typedef struct buf {
int b_flags;
size_t b_bcount;
union {
caddr_t b_addr;
} b_un;
lldaddr_t _b_blkno;
#define b_lblkno _b_blkno._f
size_t b_resid;
size_t b_bufsize;
int (*b_iodone)(struct buf *);
int b_error;
void *b_private;
} buf_t;
extern void bioinit(buf_t *);
extern void biodone(buf_t *);
extern void bioerror(buf_t *, int);
extern int geterror(buf_t *);
#endif
#ifdef __cplusplus
}
#endif
@@ -22,19 +22,15 @@
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
#include <sys/zfs_context.h>
int taskq_now;
taskq_t *system_taskq;
typedef struct task {
struct task *task_next;
struct task *task_prev;
task_func_t *task_func;
void *task_arg;
} task_t;
#define TASKQ_ACTIVE 0x00010000
struct taskq {
@@ -51,18 +47,18 @@ struct taskq {
int tq_maxalloc;
kcondvar_t tq_maxalloc_cv;
int tq_maxalloc_wait;
task_t *tq_freelist;
task_t tq_task;
taskq_ent_t *tq_freelist;
taskq_ent_t tq_task;
};
static task_t *
static taskq_ent_t *
task_alloc(taskq_t *tq, int tqflags)
{
task_t *t;
taskq_ent_t *t;
int rv;
again: if ((t = tq->tq_freelist) != NULL && tq->tq_nalloc >= tq->tq_minalloc) {
tq->tq_freelist = t->task_next;
tq->tq_freelist = t->tqent_next;
} else {
if (tq->tq_nalloc >= tq->tq_maxalloc) {
if (!(tqflags & KM_SLEEP))
@@ -87,7 +83,7 @@ again: if ((t = tq->tq_freelist) != NULL && tq->tq_nalloc >= tq->tq_minalloc) {
}
mutex_exit(&tq->tq_lock);
t = kmem_alloc(sizeof (task_t), tqflags & KM_SLEEP);
t = kmem_alloc(sizeof (taskq_ent_t), tqflags & KM_SLEEP);
mutex_enter(&tq->tq_lock);
if (t != NULL)
@@ -97,15 +93,15 @@ again: if ((t = tq->tq_freelist) != NULL && tq->tq_nalloc >= tq->tq_minalloc) {
}
static void
task_free(taskq_t *tq, task_t *t)
task_free(taskq_t *tq, taskq_ent_t *t)
{
if (tq->tq_nalloc <= tq->tq_minalloc) {
t->task_next = tq->tq_freelist;
t->tqent_next = tq->tq_freelist;
tq->tq_freelist = t;
} else {
tq->tq_nalloc--;
mutex_exit(&tq->tq_lock);
kmem_free(t, sizeof (task_t));
kmem_free(t, sizeof (taskq_ent_t));
mutex_enter(&tq->tq_lock);
}
@@ -116,7 +112,7 @@ task_free(taskq_t *tq, task_t *t)
taskqid_t
taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t tqflags)
{
task_t *t;
taskq_ent_t *t;
if (taskq_now) {
func(arg);
@@ -130,26 +126,58 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t tqflags)
return (0);
}
if (tqflags & TQ_FRONT) {
t->task_next = tq->tq_task.task_next;
t->task_prev = &tq->tq_task;
t->tqent_next = tq->tq_task.tqent_next;
t->tqent_prev = &tq->tq_task;
} else {
t->task_next = &tq->tq_task;
t->task_prev = tq->tq_task.task_prev;
t->tqent_next = &tq->tq_task;
t->tqent_prev = tq->tq_task.tqent_prev;
}
t->task_next->task_prev = t;
t->task_prev->task_next = t;
t->task_func = func;
t->task_arg = arg;
t->tqent_next->tqent_prev = t;
t->tqent_prev->tqent_next = t;
t->tqent_func = func;
t->tqent_arg = arg;
cv_signal(&tq->tq_dispatch_cv);
mutex_exit(&tq->tq_lock);
return (1);
}
void
taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags,
taskq_ent_t *t)
{
ASSERT(func != NULL);
ASSERT(!(tq->tq_flags & TASKQ_DYNAMIC));
/*
* Mark it as a prealloc'd task. This is important
* to ensure that we don't free it later.
*/
t->tqent_flags |= TQENT_FLAG_PREALLOC;
/*
* Enqueue the task to the underlying queue.
*/
mutex_enter(&tq->tq_lock);
if (flags & TQ_FRONT) {
t->tqent_next = tq->tq_task.tqent_next;
t->tqent_prev = &tq->tq_task;
} else {
t->tqent_next = &tq->tq_task;
t->tqent_prev = tq->tq_task.tqent_prev;
}
t->tqent_next->tqent_prev = t;
t->tqent_prev->tqent_next = t;
t->tqent_func = func;
t->tqent_arg = arg;
cv_signal(&tq->tq_dispatch_cv);
mutex_exit(&tq->tq_lock);
}
void
taskq_wait(taskq_t *tq)
{
mutex_enter(&tq->tq_lock);
while (tq->tq_task.task_next != &tq->tq_task || tq->tq_active != 0)
while (tq->tq_task.tqent_next != &tq->tq_task || tq->tq_active != 0)
cv_wait(&tq->tq_wait_cv, &tq->tq_lock);
mutex_exit(&tq->tq_lock);
}
@@ -158,27 +186,32 @@ static void *
taskq_thread(void *arg)
{
taskq_t *tq = arg;
task_t *t;
taskq_ent_t *t;
boolean_t prealloc;
mutex_enter(&tq->tq_lock);
while (tq->tq_flags & TASKQ_ACTIVE) {
if ((t = tq->tq_task.task_next) == &tq->tq_task) {
if ((t = tq->tq_task.tqent_next) == &tq->tq_task) {
if (--tq->tq_active == 0)
cv_broadcast(&tq->tq_wait_cv);
cv_wait(&tq->tq_dispatch_cv, &tq->tq_lock);
tq->tq_active++;
continue;
}
t->task_prev->task_next = t->task_next;
t->task_next->task_prev = t->task_prev;
t->tqent_prev->tqent_next = t->tqent_next;
t->tqent_next->tqent_prev = t->tqent_prev;
t->tqent_next = NULL;
t->tqent_prev = NULL;
prealloc = t->tqent_flags & TQENT_FLAG_PREALLOC;
mutex_exit(&tq->tq_lock);
rw_enter(&tq->tq_threadlock, RW_READER);
t->task_func(t->task_arg);
t->tqent_func(t->tqent_arg);
rw_exit(&tq->tq_threadlock);
mutex_enter(&tq->tq_lock);
task_free(tq, t);
if (!prealloc)
task_free(tq, t);
}
tq->tq_nthreads--;
cv_broadcast(&tq->tq_wait_cv);
@@ -217,8 +250,8 @@ taskq_create(const char *name, int nthreads, pri_t pri,
tq->tq_nthreads = nthreads;
tq->tq_minalloc = minalloc;
tq->tq_maxalloc = maxalloc;
tq->tq_task.task_next = &tq->tq_task;
tq->tq_task.task_prev = &tq->tq_task;
tq->tq_task.tqent_next = &tq->tq_task;
tq->tq_task.tqent_prev = &tq->tq_task;
tq->tq_threadlist = kmem_alloc(nthreads * sizeof (thread_t), KM_SLEEP);
if (flags & TASKQ_PREPOPULATE) {
@@ -0,0 +1,36 @@
/*
* CDDL HEADER START
*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
provider zfs {
probe probe0(char *probename);
probe probe1(char *probename, unsigned long arg1);
probe probe2(char *probename, unsigned long arg1, unsigned long arg2);
probe probe3(char *probename, unsigned long arg1, unsigned long arg2,
unsigned long arg3);
probe probe4(char *probename, unsigned long arg1, unsigned long arg2,
unsigned long arg3, unsigned long arg4);
probe set__error(int err);
};
#pragma D attributes Evolving/Evolving/ISA provider zfs provider
#pragma D attributes Private/Private/Unknown provider zfs module
#pragma D attributes Private/Private/Unknown provider zfs function
#pragma D attributes Evolving/Evolving/ISA provider zfs name
#pragma D attributes Evolving/Evolving/ISA provider zfs args
@@ -20,6 +20,7 @@
# CDDL HEADER END
#
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013 by Delphix. All rights reserved.
#
"""This module implements the "zfs allow" and "zfs unallow" subcommands.
@@ -219,6 +220,7 @@ perms_subcmd = dict(
hold=_("Allows adding a user hold to a snapshot"),
release=_("Allows releasing a user hold which\n\t\t\t\tmight destroy the snapshot"),
diff=_("Allows lookup of paths within a dataset,\n\t\t\t\tgiven an object number. Ordinary users need this\n\t\t\t\tin order to use zfs diff"),
bookmark="",
)
perms_other = dict(
+2
View File
@@ -9,10 +9,12 @@ SUBDIR= ${_drti} \
libnvpair \
libumem \
libuutil \
${_libzfs_core} \
${_libzfs} \
${_libzpool}
.if ${MK_ZFS} != "no"
_libzfs_core= libzfs_core
_libzfs= libzfs
.if ${MK_LIBTHR} != "no"
_libzpool= libzpool
+5 -2
View File
@@ -6,8 +6,9 @@
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
LIB= zfs
DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBM} ${LIBNVPAIR}
LDADD= -lmd -lpthread -lumem -lutil -lm -lnvpair
DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBM} ${LIBNVPAIR} \
${LIBAVL} ${LIBZFS_CORE}
LDADD= -lmd -lpthread -lumem -lutil -lm -lnvpair -lavl -lzfs_core
SRCS= deviceid.c \
fsshare.c \
@@ -17,6 +18,7 @@ SRCS= deviceid.c \
zone.c
SRCS+= libzfs_changelist.c \
libzfs_compat.c \
libzfs_config.c \
libzfs_dataset.c \
libzfs_diff.c \
@@ -53,5 +55,6 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs_core/common
.include <bsd.lib.mk>
+37
View File
@@ -0,0 +1,37 @@
# $FreeBSD$
.PATH: ${.CURDIR}/../../../cddl/compat/opensolaris/misc
.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs_core/common
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
LIB= zfs_core
DPADD= ${LIBNVPAIR}
LDADD= -lnvpair
SRCS= libzfs_core.c \
libzfs_core_compat.c
SRCS+= libzfs_compat.c
WARNS?= 0
CSTD= c99
CFLAGS+= -DZFS_NO_ACL
CFLAGS+= -I${.CURDIR}/../../../sbin/mount
CFLAGS+= -I${.CURDIR}/../../../cddl/lib/libumem
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include
CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs_core/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
.include <bsd.lib.mk>
+1 -1
View File
@@ -26,7 +26,7 @@ ATOMIC_SRCS= opensolaris_atomic.c
LIB= zpool
ZFS_COMMON_SRCS= ${ZFS_COMMON_OBJS:C/.o$/.c/} vdev_file.c
ZFS_COMMON_SRCS= ${ZFS_COMMON_OBJS:C/.o$/.c/} vdev_file.c trim_map.c
ZFS_SHARED_SRCS= ${ZFS_SHARED_OBJS:C/.o$/.c/}
KERNEL_SRCS= kernel.c taskq.c util.c
LIST_SRCS= list.c
+3 -2
View File
@@ -13,6 +13,7 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs_core/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libumem/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
@@ -21,7 +22,7 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
DPADD= ${LIBGEOM} ${LIBJAIL} ${LIBNVPAIR} ${LIBUMEM} \
${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
LDADD= -lgeom -ljail -lnvpair -lumem -lutil -luutil -lzfs
${LIBUTIL} ${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS}
LDADD= -lgeom -ljail -lnvpair -lumem -lutil -luutil -lzfs_core -lzfs
.include <bsd.prog.mk>
+2 -2
View File
@@ -26,7 +26,7 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/stat/common
DPADD= ${LIBAVL} ${LIBGEOM} ${LIBNVPAIR} \
${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
LDADD= -lavl -lgeom -lnvpair -lumem -lutil -luutil -lzfs
${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS}
LDADD= -lavl -lgeom -lnvpair -lumem -lutil -luutil -lzfs_core -lzfs
.include <bsd.prog.mk>
+3 -2
View File
@@ -15,11 +15,12 @@ CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/lib/libnvpair
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs/
CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
CFLAGS+= -I${.CURDIR}/../../lib/libumem
DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \
${LIBZFS} ${LIBZPOOL} ${LIBUUTIL}
LDADD= -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool
${LIBZFS_CORE} ${LIBZFS} ${LIBZPOOL}
LDADD= -lgeom -lm -lnvpair -lumem -luutil -lzfs_core -lzfs -lzpool
.include <bsd.prog.mk>
+3 -2
View File
@@ -18,8 +18,9 @@ CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
CFLAGS+= -I${.CURDIR}/../../lib/libumem
DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
${LIBPTHREAD} ${LIBAVL} ${LIBZFS} ${LIBUUTIL}
LDADD= -lgeom -lm -lnvpair -lumem -lzpool -lpthread -lavl -lzfs -luutil
${LIBPTHREAD} ${LIBAVL} ${LIBZFS_CORE} ${LIBZFS} ${LIBUUTIL}
LDADD= -lgeom -lm -lnvpair -lumem -lzpool -lpthread -lavl -lzfs_core -lzfs \
-luutil
CSTD= c99
+2 -2
View File
@@ -21,8 +21,8 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
CFLAGS+= -I${.CURDIR}/../../lib/libumem
DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
${LIBUUTIL} ${LIBZFS} ${LIBZPOOL}
LDADD= -lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs -lzpool
${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS} ${LIBZPOOL}
LDADD= -lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs_core -lzfs -lzpool
CSTD= c99
+2 -2
View File
@@ -23,8 +23,8 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
CFLAGS+= -I${.CURDIR}/../../lib/libumem
DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
${LIBUUTIL} ${LIBZFS} ${LIBZPOOL}
LDADD= -lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs -lzpool
${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS} ${LIBZPOOL}
LDADD= -lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs_core -lzfs -lzpool
CFLAGS+= -DDEBUG=1
#DEBUG_FLAGS+= -g
+691 -31
View File
@@ -1,20 +1,680 @@
--- 9.8.4-P2 released ---
4006. [security] A flaw in delegation handling could be exploited
to put named into an infinite loop. This has
been addressed by placing limits on the number
of levels of recursion named will allow (default 7),
and the number of iterative queries that it will
send (default 50) before terminating a recursive
query (CVE-2014-8500).
3516. [security] Removed the check for regex.h in configure in order
to disable regex syntax checking, as it exposes
BIND to a critical flaw in libregex on some
platforms. [RT #32688]
The recursion depth limit is configured via the
"max-recursion-depth" option, and the query limit
via the "max-recursion-queries" option. [RT #37580]
--- 9.8.4-P1 released ---
--- 9.8.7 released ---
3407. [security] Named could die on specific queries with dns64 enabled.
[Addressed in change #3388 for BIND 9.8.5 and 9.9.3.]
--- 9.8.7rc2 released ---
--- 9.8.4 released ---
3710. [bug] Address double dns_zone_detach when switching to
using automatic empty zones from regular zones.
[RT #35177]
3707. [bug] irs_resconf_load now returns ISC_R_FILENOTFOUND
on a missing resolv.conf file and initializes the
structure as if it had been configured with:
nameserver ::1
nameserver 127.0.0.1
Note: Callers will need to be updated to treat
ISC_R_FILENOTFOUND as a qualified success or else
they will leak memory. The following code fragment
will work with both old and new versions without
changing the behaviour of the existing code.
resconf = NULL;
result = irs_resconf_load(mctx, "/etc/resolv.conf",
&resconf);
if (result != ISC_SUCCESS) {
if (resconf != NULL)
irs_resconf_destroy(&resconf);
....
}
[RT #35194]
3706. [contrib] queryperf: Fixed a possible integer overflow when
printing results. [RT #35182]
3704. [protocol] Accept integer timestamps in RRSIG records. [RT #35185]
--- 9.8.7rc1 released ---
3701. [func] named-checkconf can now suppress the printing of
shared secrets by specifying '-x'. [RT #34465]
3698. [cleanup] Replaced all uses of memcpy() with memmove().
[RT #35120]
3697. [bug] Handle "." as a search list element when IDN support
is enabled. [RT #35133]
3696. [bug] dig failed to handle AXFR style IXFR responses which
span multiple messages. [RT #35137]
3695. [bug] Address a possible race in dispatch.c. [RT #35107]
3694. [bug] Warn when a key-directory is configured for a zone,
but does not exist or is not a directory. [RT #35108]
3693. [security] memcpy was incorrectly called with overlapping
ranges resulting in malformed names being generated
on some platforms. This could cause INSIST failures
when serving NSEC3 signed zones (CVE-2014-0591).
[RT #35120]
3692. [bug] Two calls to dns_db_getoriginnode were fatal if there
was no data at the node. [RT #35080]
3689. [bug] Fixed a bug causing an insecure delegation from one
static-stub zone to another to fail with a broken
trust chain. [RT #35081]
--- 9.8.7b1 released ---
3688. [bug] loadnode could return a freed node on out of memory.
[RT #35106]
3683. [cleanup] Add a more detailed "not found" message to rndc
commands which specify a zone name. [RT #35059]
3681. [port] Update the Windows build system to support feature
selection and WIN64 builds. This is a work in
progress. [RT #34160]
3679. [bug] dig could fail to clean up TCP sockets still
waiting on connect(). [RT #35074]
3678. [port] Update config.guess and config.sub. [RT #35060]
3677. [bug] 'nsupdate' leaked memory if 'realm' was used multiple
times. [RT #35073]
3676. [bug] "named-checkconf -z" now checks zones of type
hint as well as master. [RT #35046]
3675. [misc] Provide a place for third parties to add version
information for their extensions in the version
file by setting the EXTENSIONS variable.
3670. [bug] Address read after free in server side of
lwres_getrrsetbyname. [RT #29075]
3669. [port] freebsd: --with-gssapi needs -lhx509. [RT #35001]
3668. [bug] Fix cast in lex.c which could see 0xff treated as eof.
[RT #34993]
3667. [test] dig: add support to keep the TCP socket open between
successive queries (+[no]keepopen). [RT #34918]
3664. [bug] Updated OpenSSL PKCS#11 patches to fix active list
locking and other bugs. [RT #34855]
3663. [bug] Address bugs in dns_rdata_fromstruct and
dns_rdata_tostruct for WKS and ISDN types. [RT #34910]
3662. [bug] 'host' could die if a UDP query timed out. [RT #34870]
3660. [cleanup] Changed the name of "isc-config.sh" to "bind9-config".
[RT #23825]
3658. [port] linux: Address platform specific compilation issue
when libcap-devel is installed. [RT #34838]
3656. [security] Treat an all zero netmask as invalid when generating
the localnets acl. (The prior behavior could
allow unexpected matches when using some versions
of Winsock: CVE-2013-6320.) [RT #34687]
3655. [cleanup] Simplify TCP message processing when requesting a
zone transfer. [RT #34825]
3654. [bug] Address race condition with manual notify requests.
[RT #34806]
3653. [func] Create delegations for all "children" of empty zones
except "forward first". [RT #34826]
3651. [tuning] Adjust when a master server is deemed unreachable.
[RT #27075]
3650. [tuning] Use separate rate limiting queues for refresh and
notify requests. [RT #30589]
3649. [cleanup] Include a comment in .nzf files, giving the name of
the associated view. [RT #34765]
3648. [test] Updated the ATF test framework to version 0.17.
[RT #25627]
3646. [bug] Journal filename string could be set incorrectly,
causing garbage in log messages. [RT #34738]
3645. [protocol] Use case sensitive compression when responding to
queries. [RT #34737]
3644. [protocol] Check that EDNS subnet client options are well formed.
[RT #34718]
3641. [bug] Handle changes to sig-validity-interval settings
better. [RT #34625]
3640. [bug] ndots was not being checked when searching. Only
continue searching on NXDOMAIN responses. Add the
ability to specify ndots to nslookup. [RT #34711]
3639. [bug] Treat type 65533 (KEYDATA) as opaque except when used
in a key zone. [RT #34238]
--- 9.8.6 released ---
3638. [cleanup] Add the ability to handle ENOPROTOOPT in case it is
encountered. [RT #34668]
--- 9.8.6rc2 released ---
3637. [bug] 'allow-query-on' was checking the source address
rather than the destination address. [RT #34590]
3636. [bug] Automatic empty zones now behave better with
forward only "zones" beneath them. [RT #34583]
3635. [bug] Signatures were not being removed from a zone with
only KSK keys for a algorithm. [RT #34439]
3634. [func] Report build-id in rndc status. Report build-id
when building from a git repository. [RT #20422]
3633. [cleanup] Refactor OPT processing in named to make it easier
to support new EDNS options. [RT #34414]
3632. [bug] Signature from newly inactive keys were not being
removed. [RT #32178]
3631. [bug] Remove spurious warning about missing signatures when
qtype is SIG. [RT #34600]
3630. [bug] Ensure correct ID computation for MD5 keys. [RT #33033]
3627. [bug] RPZ changes were not effective on slaves. [RT #34450]
3625. [bug] Don't send notify messages to machines outside of the
test setup.
--- 9.8.6rc1 released ---
3621. [security] Incorrect bounds checking on private type 'keydata'
can lead to a remotely triggerable REQUIRE failure
(CVE-2013-4854). [RT #34238]
3615. [cleanup] "configure" now finishes by printing a summary
of optional BIND features and whether they are
active or inactive. ("configure --enable-full-report"
increases the verbosity of the summary.) [RT #31777]
3614. [port] Check for <linux/types.h>. [RT #34162]
3611. [bug] Improved resistance to a theoretical authentication
attack based on differential timing. [RT #33939]
3610. [cleanup] win32: Some executables had been omitted from the
installer. [RT #34116]
3608. [port] win32: added todos.pl script to ensure all text files
the win32 build depends on are converted to DOS
newline format. [RT #22067]
3607. [bug] dnssec-keygen had broken 'Invalid keyfile' error
message. [RT #34045]
--- 9.8.6b1 released ---
3605. [port] win32: Addressed several compatibility issues
with newer versions of Visual Studio. [RT #33916]
3603. [bug] Install <isc/stat.h>. [RT #33956]
3601. [bug] Added to PKCS#11 openssl patches a value len
attribute in DH derive key. [RT #33928]
3600. [cleanup] dig: Fixed a typo in the warning output when receiving
an oversized response. [RT #33910]
3599. [tuning] Check for pointer equivalence in name comparisons.
[RT #18125]
3594. [maint] Update config.guess and config.sub. [RT #33816]
3592. [doc] Moved documentation of rndc command options to the
rndc man page. [RT #33506]
3588. [bug] dig: addressed a memory leak in the sigchase code
that could cause a shutdown crash. [RT #33733]
3587. [func] 'named -g' now checks the logging configuration but
does not use it. [RT #33473]
3586. [bug] Handle errors in xmlDocDumpFormatMemoryEnc. [RT #33706]
3584. [security] Caching data from an incompletely signed zone could
trigger an assertion failure in resolver.c
(CVE-2013-3919). [RT #33690]
3583. [bug] Address memory leak in GSS-API processing [RT #33574]
3581. [bug] Changed the tcp-listen-queue default to 10. [RT #33029]
3580. [bug] Addressed a possible race in acache.c [RT #33602]
3579. [maint] Updates to PKCS#11 openssl patches, supporting
versions 0.9.8y, 1.0.0k, 1.0.1e [RT #33463]
3578. [bug] 'rndc -c file' now fails if 'file' does not exist.
[RT #33571]
3577. [bug] Handle zero TTL values better. [RT #33411]
3576. [bug] Address a shutdown race when validating. [RT #33573]
3574. [doc] The 'hostname' keyword was missing from server-id
description in the named.conf man page. [RT #33476]
3573. [bug] "rndc addzone" and "rndc delzone" incorrectly handled
zone names containing punctuation marks and other
nonstandard characters. [RT #33419]
3571. [bug] Address race condition in dns_client_startresolve().
[RT #33234]
3566. [func] Log when forwarding updates to master. [RT #33240]
--- 9.8.5 released ---
3568. [cleanup] Add a product description line to the version file,
to be reported by named -v/-V. [RT #33366]
3567. [bug] Silence clang static analyzer warnings. [RT #33365]
3563. [contrib] zone2sqlite failed with some table names. [RT #33375]
3561. [bug] dig: issue a warning if an EDNS query returns FORMERR
or NOTIMP. Adjust usage message. [RT #33363]
--- 9.8.5rc1 released ---
3560. [bug] isc-config.sh did not honor includedir and libdir
when set via configure. [RT #33345]
3559. [func] Check that both forms of Sender Policy Framework
records exist or do not exist. [RT #33355]
3558. [bug] IXFR of a DLZ stored zone was broken. [RT #33331]
3556. [maint] Added AAAA for D.ROOT-SERVERS.NET.
3555. [bug] Address theoretical race conditions in acache.c
(change #3553 was incomplete). [RT #33252]
3553. [bug] Address suspected double free in acache. [RT #33252]
3552. [bug] Wrong getopt option string for 'nsupdate -r'.
[RT #33280]
3549. [doc] Documentation for "request-nsid" was missing.
[RT #33153]
3548. [bug] The NSID request code in resolver.c was broken
resulting in invalid EDNS options being sent.
[RT #33153]
3547. [bug] Some malformed unknown rdata records were not properly
detected and rejected. [RT #33129]
3056. [func] Added support for URI resource record. [RT #23386]
--- 9.8.5rc1 released ---
3546. [func] Add EUI48 and EUI64 types. [RT #33082]
3544. [contrib] check5011.pl: Script to report the status of
managed keys as recorded in managed-keys.bind.
Contributed by Tony Finch <[email protected]>
3543. [bug] Update socket structure before attaching to socket
manager after accept. [RT #33084]
3542. [bug] masterformat system test was broken. [RT #33086]
3541. [bug] Parts of libdns were not properly initialized when
built in libexport mode. [RT #33028]
3540. [test] libt_api: t_info and t_assert were not thread safe.
3539. [port] win32: timestamp format didn't match other platforms.
3538. [test] Running "make test" now requires loopback interfaces
to be set up. [RT #32452]
3537. [tuning] Slave zones, when updated, now send NOTIFY messages
to peers before being dumped to disk rather than
after. [RT #27242]
3535. [bug] Minor win32 cleanups. [RT #32962]
3534. [bug] Extra text after an embedded NULL was ignored when
parsing zone files. [RT #32699]
3533. [contrib] query-loc-0.4.0: memory leaks. [RT #32960]
3532. [contrib] zkt: fixed buffer overrun, resource leaks. [RT #32960]
3531. [bug] win32: A uninitialized value could be returned on out
of memory. [RT #32960]
3530. [contrib] Better RTT tracking in queryperf. [RT #30128]
3526. [cleanup] Set up dependencies for unit tests correctly during
build. [RT #32803]
3521. [bug] Address memory leak in opensslecdsa_link.c. [RT #32249]
3520. [bug] 'mctx' was not being referenced counted in some places
where it should have been. [RT #32794]
--- 9.8.5b2 released ---
3517. [bug] Reorder destruction to avoid shutdown race. [RT #32777]
3515. [port] '%T' is not portable in strftime(). [RT #32763]
3514. [bug] The ranges for valid key sizes in ddns-confgen and
rndc-confgen were too constrained. Keys up to 512
bits are now allowed for most algorithms, and up
to 1024 bits for hmac-sha384 and hmac-sha512.
[RT #32753]
3509. [cleanup] Added a product line to version file to allow for
easy naming of different products (BIND
vs BIND ESV, for example). [RT #32755]
3508. [contrib] queryperf was incorrectly rejecting the -T option.
[RT #32338]
3503. [doc] Clarify size_spec syntax. [RT #32449]
3500. [security] Support NAPTR regular expression validation on
all platforms without using libregex, which
can be vulnerable to memory exhaustion attack
(CVE-2013-2266). [RT #32688]
3499. [doc] Corrected ARM documentation of built-in zones.
[RT #32694]
3498. [bug] zone statistics for zones which matched a potential
empty zone could have their zone-statistics setting
overridden.
3496. [func] Improvements to RPZ performance. The "response-policy"
syntax now includes a "min-ns-dots" clause, with
default 1, to exclude top-level domains from
NSIP and NSDNAME checking. --enable-rpz-nsip and
--enable-rpz-nsdname are now the default. [RT #32251]
3489. [bug] --enable-developer now turns on ISC_LIST_CHECKINIT.
When cloning a rdataset do not copy the link contents.
[RT #32651]
3488. [bug] Use after free error with DH generated keys. [RT #32649]
3487. [bug] Change 3444 was not complete. There was a additional
place where the NOQNAME proof needed to be saved.
[RT #32629]
3486. [bug] named could crash when using TKEY-negotiated keys
that had been deleted and then recreated. [RT #32506]
3485. [cleanup] Only compile openssl_gostlink.c if we support GOST.
3481. [cleanup] Removed use of const const in atf.
3479. [bug] Address potential memory leaks in gssapi support
code. [RT #32405]
3478. [port] Fix a build failure in strict C99 environments
[RT #32475]
3474. [bug] nsupdate could assert when the local and remote
address families didn't match. [RT #22897]
3470. [bug] Slave zones could fail to dump when successfully
refreshing after an initial failure. [RT #31276]
--- 9.8.5b1 released ---
3468. [security] RPZ rules to generate A records (but not AAAA records)
could trigger an assertion failure when used in
conjunction with DNS64 (CVE-2012-5689). [RT #32141]
3467. [bug] Added checks in dnssec-keygen and dnssec-settime
to check for delete date < inactive date. [RT #31719]
3465. [bug] Handle isolated reserved ports. [RT #31778]
3464. [maint] Updates to PKCS#11 openssl patches, supporting
versions 0.9.8x, 1.0.0j, 1.0.1c [RT #29749]
3463. [doc] Clarify managed-keys syntax in ARM. [RT #32232]
3462. [doc] Clarify server selection behavior of dig when using
-4 or -6 options. [RT #32181]
3461. [bug] Negative responses could incorrectly have AD=1
set. [RT #32237]
3458. [bug] Return FORMERR when presented with a overly long
domain named in a request. [RT #29682]
3457. [protocol] Add ILNP records (NID, LP, L32, L64). [RT #31836]
3456. [port] g++47: ATF failed to compile. [RT #32012]
3455. [contrib] queryperf: fix getopt option list. [RT #32338]
3454. [port] sparc64: improve atomic support. [RT #25182]
3452. [bug] Accept duplicate singleton records. [RT #32329]
3451. [port] Increase per thread stack size from 64K to 1M.
[RT #32230]
3450. [bug] Stop logfileconfig system test spam system logs.
[RT #32315]
3449. [bug] gen.c: use the pre-processor to construct format
strings so that compiler can perform sanity checks;
check the snprintf results. [RT #17576]
3448. [bug] The allow-query-on ACL was not processed correctly.
[RT #29486]
3447. [port] Add support for libxml2-2.9.x [RT #32231]
3446. [port] win32: Add source ID (see change #3400) to build.
[RT #31683]
3445. [bug] Warn about zone files with blank owner names
immediately after $ORIGIN directives. [RT #31848]
3444. [bug] The NOQNAME proof was not being returned from cached
insecure responses. [RT #21409]
3443. [bug] ddns-confgen: Some TSIG algorithms were incorrectly
rejected when generating keys. [RT #31927]
3442. [port] Net::DNS 0.69 introduced a non backwards compatible
change. [RT #32216]
3441. [maint] D.ROOT-SERVERS.NET is now 199.7.91.13.
3440. [bug] Reorder get_key_struct to not trigger a assertion when
cleaning up due to out of memory error. [RT #32131]
3439. [bug] contrib/dlz error checking fixes. [RT #32102]
3438. [bug] Don't accept unknown data escape in quotes. [RT #32031]
3437. [bug] isc_buffer_init -> isc_buffer_constinit to initialize
buffers with constant data. [RT #32064]
3436. [bug] Check malloc/calloc return values. [RT #32088]
3435. [bug] Cross compilation support in configure was broken.
[RT #32078]
3431. [bug] ddns-confgen: Some valid key algorithms were
not accepted. [RT #31927]
3430. [bug] win32: isc_time_formatISO8601 was missing the
'T' between the date and time. [RT #32044]
3429. [bug] dns_zone_getserial2 could a return success without
returning a valid serial. [RT #32007]
3428. [cleanup] dig: Add timezone to date output. [RT #2269]
3427. [bug] dig +trace incorrectly displayed name server
addresses instead of names. [RT #31641]
3425. [bug] "acacheentry" reference counting was broken resulting
in use after free. [RT #31908]
3422. [bug] Added a clear error message for when the SOA does not
match the referral. [RT #31281]
3421. [bug] Named loops when re-signing if all keys are offline.
[RT #31916]
3420. [bug] Address VPATH compilation issues. [RT #31879]
3419. [bug] Memory leak on validation cancel. [RT #31869]
3415. [bug] named could die with a REQUIRE failure if a validation
was canceled. [RT #31804]
3412. [bug] Copy timeval structure from control message data.
[RT #31548]
3411. [tuning] Use IPV6_USE_MIN_MTU or equivalent with TCP in addition
to UDP. [RT #31690]
3410. [bug] Addressed Coverity warnings. [RT #31626]
3409. [contrib] contrib/dane/mkdane.sh: Tool to generate TLSA RR's
from X.509 certificates, for use with DANE
(DNS-based Authentication of Named Entities).
[RT #30513]
3406. [bug] mem.c: Fix compilation errors when building with
ISC_MEM_TRACKLINES or ISC_MEMPOOL_NAMES disabled.
Also, ISC_MEM_DEBUG is no longer optional. [RT #31559]
3405. [bug] Handle time going backwards in acache. [RT #31253]
3404. [bug] dnssec-signzone: When re-signing a zone, remove
RRSIG and NSEC records from nodes that used to be
in-zone but are now below a zone cut. [RT #31556]
3403. [bug] Silence noisy OpenSSL logging. [RT #31497]
3402. [test] The IPv6 interface numbers used for system
tests were incorrect on some platforms. [RT #25085]
3401. [bug] Addressed Coverity warnings. [RT #31484]
3400. [cleanup] "named -V" can now report a source ID string, defined
in the "srcid" file in the build tree and normally set
to the most recent git hash. [RT #31494]
3397. [bug] dig crashed when using +nssearch with +tcp. [RT #25298]
3396. [bug] OPT records were incorrectly removed from signed,
truncated responses. [RT #31439]
3395. [protocol] Add RFC 6598 reverse zones to built in empty zones
list, 64.100.IN-ADDR.ARPA ... 127.100.IN-ADDR.ARPA.
[RT #31336]
3394. [bug] Adjust 'successfully validated after lower casing
signer' log level and category. [RT #31414]
3393. [bug] 'host -C' could core dump if REFUSED was received.
[RT #31381]
3391. [bug] A DNSKEY lookup that encountered a CNAME failed.
[RT #31262]
3390. [bug] Silence clang compiler warnings. [RT #30417]
3389. [bug] Always return NOERROR (not 0) in TSIG. [RT #31275]
3388. [bug] Fixed several Coverity warnings.
Note: This change includes a fix for a bug that
was subsequently determined to be an exploitable
security vulnerability, CVE-2012-5688: named could
die on specific queries with dns64 enabled.
[RT #30996]
3386. [bug] Address locking violation when generating new NSEC /
NSEC3 chains. [RT #31224]
3384. [bug] Improved logging of crypto errors. [RT #30963]
3383. [security] A certain combination of records in the RBT could
cause named to hang while populating the additional
section of a response. [RT #31090]
cause named to hang while populating the additional
section of a response. [RT #31090]
3382. [bug] SOA query from slave used use-v6-udp-ports range,
if set, regardless of the address family in use.
[RT #24173]
3381. [contrib] Update queryperf to support more RR types.
[RT #30762]
3380. [bug] named could die if a nonexistent master list was
referenced in a also-notify. [RT #31004]
3379. [bug] isc_interval_zero and isc_time_epoch should be
"const (type)* const". [RT #31069]
3378. [bug] Handle missing 'managed-keys-directory' better.
[RT #30625]
3376. [bug] Lack of EDNS support was being recorded without a
successful response. [RT #30811]
3375. [func] Check that 'rndc dumpdb' works on a empty cache.
[RT #30808]
3374. [bug] isc_parse_uint32 failed to return a range error on
systems with 64 bit longs. [RT #30232]
3372. [bug] Silence spurious "deleted from unreachable cache"
messages. [RT #30501]
3371. [bug] AD=1 should behave like DO=1 when deciding whether to
add NS RRsets to the additional section or not.
[RT #30479]
--- 9.8.4 released ---
3373. [bug] win32: open raw files in binary mode. [RT #30944]
@@ -135,11 +795,11 @@
--- 9.8.3 released ---
3318. [tuning] Reduce the amount of work performed while holding a
bucket lock when finshed with a fetch context.
bucket lock when finished with a fetch context.
[RT #29239]
3314. [bug] The masters list could be updated while refesh_callback
and stub_callback were using it. [RT #26732]
3314. [bug] The masters list could be updated while stub_callback
or refresh_callback were using it. [RT #26732]
3313. [protocol] Add TLSA record type. [RT #28989]
@@ -151,7 +811,7 @@
3310. [test] Increase table size for mutex profiling. [RT #28809]
3309. [bug] resolver.c:fctx_finddone() was not threadsafe.
3309. [bug] resolver.c:fctx_finddone() was not thread safe.
[RT #27995]
3307. [bug] Add missing ISC_LANG_BEGINDECLS and ISC_LANG_ENDDECLS.
@@ -328,7 +988,7 @@
3234. [bug] 'make depend' produced invalid makefiles. [RT #26830]
3231. [bug] named could fail to send a uncompressable zone.
3231. [bug] named could fail to send a incompressible zone.
[RT #26796]
3230. [bug] 'dig axfr' failed to properly handle a multi-message
@@ -345,7 +1005,7 @@
3226. [bug] Address minor resource leakages. [RT #26624]
3221. [bug] Fixed a potential coredump on shutdown due to
3221. [bug] Fixed a potential core dump on shutdown due to
referencing fetch context after it's been freed.
[RT #26720]
@@ -369,7 +1029,7 @@
3209. [func] Add "dnssec-lookaside 'no'". [RT #24858]
3208. [bug] 'dig -y' handle unknown tsig alorithm better.
3208. [bug] 'dig -y' handle unknown tsig algorithm better.
[RT #25522]
3207. [contrib] Fixed build error in Berkeley DB DLZ module. [RT #26444]
@@ -672,7 +1332,7 @@
3077. [bug] zone.c:zone_refreshkeys() incorrectly called
dns_zone_attach(), use zone->irefs instead. [RT #23303]
3075. [bug] dns_dnssec_findzonekeys{2} used a inconsistant
3075. [bug] dns_dnssec_findzonekeys{2} used a inconsistent
timestamp when determining which keys are active.
[RT #23642]
@@ -686,7 +1346,7 @@
3072. [bug] dns_dns64_aaaaok() potential NULL pointer dereference.
[RT #20256]
3071. [bug] has_nsec could be used unintialised in
3071. [bug] has_nsec could be used uninitialized in
update.c:next_active. [RT #20256]
3070. [bug] dnssec-signzone potential NULL pointer dereference.
@@ -732,7 +1392,7 @@
3052. [test] Fixed last autosign test report. [RT #23256]
3051. [bug] NS records obsure DNAME records at the bottom of the
3051. [bug] NS records obscure DNAME records at the bottom of the
zone if both are present. [RT #23035]
3050. [bug] The autosign system test was timing dependent.
@@ -742,7 +1402,7 @@
3049. [bug] Save and restore the gid when creating creating
named.pid at startup. [RT #23290]
3048. [bug] Fully separate view key mangement. [RT #23419]
3048. [bug] Fully separate view key management. [RT #23419]
3047. [bug] DNSKEY NODATA responses not cached fixed in
validator.c. Tests added to dnssec system test.
@@ -1079,7 +1739,7 @@
no data response. [RT #21744]
2952. [port] win32: named-checkzone and named-checkconf failed
to initialise winsock. [RT #21932]
to initialize winsock. [RT #21932]
2951. [bug] named failed to generate a correct signed response
in a optout, delegation only zone with no secure
@@ -1125,7 +1785,7 @@
in use. [RT# 21868]
2938. [bug] When generating signed responses, from a signed zone
that uses NSEC3, named would use a uninitialised
that uses NSEC3, named would use a uninitialized
pointer if it needed to skip a NSEC3 record because
it didn't match the selected NSEC3PARAM record for
zone. [RT# 21868]
@@ -1179,7 +1839,7 @@
revisit the issue and complete the fix later.
[RT #21710]
2930. [experimental] New "rndc addzone" and "rndc delzone" commads
2930. [experimental] New "rndc addzone" and "rndc delzone" commands
allow dynamic addition and deletion of zones.
To enable this feature, specify a "new-zone-file"
option at the view or options level in named.conf.
@@ -1355,7 +2015,7 @@
successfully responds to the query using plain DNS.
[RT #20930]
2873. [bug] Cancelling a dynamic update via the dns/client module
2873. [bug] Canceling a dynamic update via the dns/client module
could trigger an assertion failure. [RT #21133]
2872. [bug] Modify dns/client.c:dns_client_createx() to only
@@ -1397,7 +2057,7 @@
2860. [bug] named-checkconf's usage was out of date. [RT #21039]
2859. [bug] When cancelling validation it was possible to leak
2859. [bug] When canceling validation it was possible to leak
memory. [RT #20800]
2858. [bug] RTT estimates were not being adjusted on ICMP errors.
@@ -1950,7 +2610,7 @@
2695. [func] DHCP/DDNS - update fdwatch code for use by
DHCP. Modify the api to isc_sockfdwatch_t (the
callback functon for isc_socket_fdwatchcreate)
callback function for isc_socket_fdwatchcreate)
to include information about the direction (read
or write) and add isc_socket_fdwatchpoke.
[RT #20253]
@@ -2015,7 +2675,7 @@
sets the time when a key is no longer used for
signing but is still published.
- The "unpublished" date (-U) is deprecated in
favour of "deleted" (-D).
favor of "deleted" (-D).
[RT #20247]
2676. [bug] --with-export-installdir should have been
@@ -2461,7 +3121,7 @@
2553. [bug] Reference leak on DNSSEC validation errors. [RT #19291]
2552. [bug] zero-no-soa-ttl-cache was not being honoured.
2552. [bug] zero-no-soa-ttl-cache was not being honored.
[RT #19340]
2551. [bug] Potential Reference leak on return. [RT #19341]
@@ -2514,7 +3174,7 @@
2534. [func] Check NAPTR records regular expressions and
replacement strings to ensure they are syntactically
valid and consistant. [RT #18168]
valid and consistent. [RT #18168]
2533. [doc] ARM: document @ (at-sign). [RT #17144]
+28 -8
View File
@@ -1,4 +1,4 @@
Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC")
Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC")
Copyright (C) 1996-2003 Internet Software Consortium.
Permission to use, copy, modify, and/or distribute this software for any
@@ -13,8 +13,6 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
$Id: COPYRIGHT,v 1.17.14.2 2012/01/04 23:46:18 tbox Exp $
Portions of this code release fall under one or more of the
following Copyright notices. Please see individual source
files for details.
@@ -99,11 +97,7 @@ are met:
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by the University of
California, Berkeley and its contributors.
4. Neither the name of the University nor the names of its contributors
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
@@ -516,3 +510,29 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
Copyright (c) 1995, 1997, 1998 The NetBSD Foundation, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
+2 -2
View File
@@ -1,6 +1,6 @@
Frequently Asked Questions about BIND 9
Copyright © 2004-2010 Internet Systems Consortium, Inc. ("ISC")
Copyright © 2004-2010, 2013 Internet Systems Consortium, Inc. ("ISC")
Copyright © 2000-2003 Internet Software Consortium.
@@ -869,7 +869,7 @@ A: If you run Tiger(Mac OS 10.4) or later then this is all you need to do:
Copy the key statement from /etc/rndc.conf into /etc/rndc.key, e.g.:
key "rndc-key" {
algorithm hmac-md5;
algorithm hmac-sha256;
secret "uvceheVuqf17ZwIcTydddw==";
};
+3 -2
View File
@@ -1,7 +1,7 @@
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" []>
<!--
- Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2004-2010, 2013 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2000-2003 Internet Software Consortium.
-
- Permission to use, copy, modify, and/or distribute this software for any
@@ -30,6 +30,7 @@
<year>2008</year>
<year>2009</year>
<year>2010</year>
<year>2013</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
<copyright>
@@ -1564,7 +1565,7 @@ rand_irqs="3 14 15"</programlisting>
<informalexample>
<programlisting>
key "rndc-key" {
algorithm hmac-md5;
algorithm hmac-sha256;
secret "uvceheVuqf17ZwIcTydddw==";
};</programlisting>
</informalexample>
+22 -3
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2004-2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 2004-2009, 2011-2014 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 1998-2002 Internet Software Consortium.
#
# Permission to use, copy, modify, and/or distribute this software for any
@@ -54,16 +54,32 @@ installdirs:
install:: isc-config.sh installdirs
${INSTALL_SCRIPT} isc-config.sh ${DESTDIR}${bindir}
rm -f ${DESTDIR}${bindir}/bind9-config
@LN@ ${DESTDIR}${bindir}/isc-config.sh ${DESTDIR}${bindir}/bind9-config
${INSTALL_DATA} ${top_srcdir}/isc-config.sh.1 ${DESTDIR}${mandir}/man1
rm -f ${DESTDIR}${mandir}/man1/bind9-config.1
@LN@ ${DESTDIR}${mandir}/man1/isc-config.sh.1 ${DESTDIR}${mandir}/man1/bind9-config.1
${INSTALL_DATA} ${top_srcdir}/bind.keys ${DESTDIR}${sysconfdir}
tags:
rm -f TAGS
find lib bin -name "*.[ch]" -print | @ETAGS@ -
check: test
test check:
@if test -n "`${PERL} ${top_srcdir}/bin/tests/system/testsock.pl 2>&- || echo fail`"; then \
echo I: NOTE: The tests were not run because they require that; \
echo I: the IP addresses 10.53.0.1 through 10.53.0.8 are configured; \
echo I: as alias addresses on the loopback interface. Please run; \
echo I: \'bin/tests/system/ifconfig.sh up\' as root to configure; \
echo I: them, then rerun the tests. Run make force-test to run the; \
echo I: tests anyway.; \
exit 1; \
fi
${MAKE} test-force
test:
force-test: test-force
test-force:
status=0; \
(cd bin/tests && ${MAKE} ${MAKEDEFS} test) || status=1; \
(test -f unit/unittest.sh && $(SHELL) unit/unittest.sh) || status=1; \
@@ -74,5 +90,8 @@ FAQ: FAQ.xml
LC_ALL=C ${W3M} -T text/html -dump -cols 72 >$@.tmp
mv $@.tmp $@
unit::
sh ${top_srcdir}/unit/unittest.sh
clean::
rm -f FAQ.tmp
+58 -35
View File
@@ -48,13 +48,36 @@ BIND 9
For a detailed list of user-visible changes from
previous releases, see the CHANGES file.
For up-to-date release notes and errata, see
http://www.isc.org/software/bind9/releasenotes
For up-to-date release notes and errata, see
http://www.isc.org/software/bind9/releasenotes
BIND 9.8.7
BIND 9.8.7 includes several bug fixes and patches the security
flaws described in CVE-2013-6320 and CVE-2014-0591. It also
includes the following functional enhancements:
- "named" now preserves the capitalization of names when
responding to queries.
- "named-checkconf -px" will print the contents of configuration
files with the shared secrets obscured, making it easier to
share configuration (e.g. when submitting a bug report)
without revealing private information.
BIND 9.8.6
BIND 9.8.6 includes several bug fixes and patches the security
flaws described in CVE-2013-3919 and CVE-2013-4854.
BIND 9.8.5
BIND 9.8.5 includes several bug fixes and patches security
flaws described in CVE-2012-5688, CVE-2012-5689 and CVE-2013-2266.
BIND 9.8.4
BIND 9.8.4 includes several bug fixes and patches security
flaws described in CVE-2012-1667, CVE-2012-3817 and CVE-2012-4244.
BIND 9.8.4 includes several bug fixes and patches security
flaws described in CVE-2012-1667, CVE-2012-3817 and CVE-2012-4244.
BIND 9.8.3
@@ -67,32 +90,32 @@ BIND 9.8.2
BIND 9.8.1
BIND 9.8.1 includes a number of bug fixes and enhancements from
BIND 9.8.1 includes a number of bug fixes and enhancements from
BIND 9.8 and earlier releases. New features include:
- The DLZ "dlopen" driver is now built by default.
- Added a new include file with function typedefs
for the DLZ "dlopen" driver.
for the DLZ "dlopen" driver.
- Made "--with-gssapi" default.
- More verbose error reporting from DLZ LDAP.
BIND 9.8.0
BIND 9.8.0 includes a number of changes from BIND 9.7 and earlier
releases. New features include:
BIND 9.8.0 includes a number of changes from BIND 9.7 and earlier
releases. New features include:
- Built-in trust anchor for the root zone, which can be
switched on via "dnssec-validation auto;"
- Support for DNS64.
- Support for response policy zones (RPZ).
- Support for writable DLZ zones.
- Improved ease of configuration of GSS/TSIG for
interoperability with Active Directory
- Support for GOST signing algorithm for DNSSEC.
- Removed RTT Banding from server selection algorithm.
- New "static-stub" zone type.
- Allow configuration of resolver timeouts via
"resolver-query-timeout" option.
- Built-in trust anchor for the root zone, which can be
switched on via "dnssec-validation auto;"
- Support for DNS64.
- Support for response policy zones (RPZ).
- Support for writable DLZ zones.
- Improved ease of configuration of GSS/TSIG for
interoperability with Active Directory
- Support for GOST signing algorithm for DNSSEC.
- Removed RTT Banding from server selection algorithm.
- New "static-stub" zone type.
- Allow configuration of resolver timeouts via
"resolver-query-timeout" option.
BIND 9.7.0
@@ -178,9 +201,9 @@ Building
Ubuntu 7.04, 7.10
Windows XP/2003/2008
NOTE: As of BIND 9.5.1, 9.4.3, and 9.3.6, older versions of
Windows, including Windows NT and Windows 2000, are no longer
supported.
NOTE: As of BIND 9.5.1, 9.4.3, and 9.3.6, older versions of
Windows, including Windows NT and Windows 2000, are no longer
supported.
We have recent reports from the user community that a supported
version of BIND will build and run on the following systems:
@@ -233,7 +256,7 @@ Building
-DDIG_SIGCHASE_BU=1)
Disable dropping queries from particular well known ports.
-DNS_CLIENT_DROPPORT=0
Sibling glue checking in named-checkzone is enabled by default.
Sibling glue checking in named-checkzone is enabled by default.
To disable the default check set. -DCHECK_SIBLING=0
named-checkzone checks out-of-zone addresses by default.
To disable this default set. -DCHECK_LOCAL=0
@@ -280,10 +303,10 @@ Building
on the configure command line. The default is operating
system dependent.
Support for the "fixed" rrset-order option can be enabled
or disabled by specifying "--enable-fixed-rrset" or
"--disable-fixed-rrset" on the configure command line.
The default is "disabled", to reduce memory footprint.
Support for the "fixed" rrset-order option can be enabled
or disabled by specifying "--enable-fixed-rrset" or
"--disable-fixed-rrset" on the configure command line.
The default is "disabled", to reduce memory footprint.
If your operating system has integrated support for IPv6, it
will be used automatically. If you have installed KAME IPv6
@@ -350,8 +373,8 @@ Documentation
Frequently asked questions and their answers can be found in
FAQ.
Additional information on various subjects can be found
in the other README files.
Additional information on various subjects can be found
in the other README files.
Change Log
@@ -368,7 +391,7 @@ Change Log
[security] Fix for a significant security flaw
[experimental] Used for new features when the syntax
or other aspects of the design are still
or other aspects of the design are still
in flux and may change
[port] Portability enhancement
@@ -377,15 +400,15 @@ Change Log
server addresses and keys
[tuning] Changes to built-in configuration defaults
and constants to improve performanceo
and constants to improve performanceo
[protocol] Updates to the DNS protocol such as new
RR types
[test] Changes to the automatic tests, not
affecting server functionality
[test] Changes to the automatic tests, not
affecting server functionality
[cleanup] Minor corrections and refactoring
[cleanup] Minor corrections and refactoring
[doc] Documentation
+5 -2
View File
@@ -1,2 +1,5 @@
sinclude(./libtool.m4)dnl
sinclude(libtool.m4/libtool.m4)dnl
sinclude(libtool.m4/ltoptions.m4)dnl
sinclude(libtool.m4/ltsugar.m4)dnl
sinclude(libtool.m4/ltversion.m4)dnl
sinclude(libtool.m4/lt~obsolete.m4)dnl
+2 -2
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2004, 2007, 2009, 2012 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 2004, 2007, 2009, 2012, 2013 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 1998-2001 Internet Software Consortium.
#
# Permission to use, copy, modify, and/or distribute this software for any
@@ -19,7 +19,7 @@ srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
SUBDIRS = named rndc dig dnssec tests tools nsupdate \
SUBDIRS = named rndc dig dnssec tools tests nsupdate \
check confgen @PKCS11_TOOLS@
TARGETS =
+7 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2004-2010, 2012 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -196,6 +196,10 @@ checkns(dns_zone_t *zone, dns_name_t *name, dns_name_t *owner,
a->type == dns_rdatatype_a);
REQUIRE(aaaa == NULL || !dns_rdataset_isassociated(aaaa) ||
aaaa->type == dns_rdatatype_aaaa);
if (a == NULL || aaaa == NULL)
return (answer);
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
hints.ai_family = PF_UNSPEC;
@@ -258,8 +262,7 @@ checkns(dns_zone_t *zone, dns_name_t *name, dns_name_t *owner,
}
return (ISC_TRUE);
}
if (a == NULL || aaaa == NULL)
return (answer);
/*
* Check that all glue records really exist.
*/
@@ -597,7 +600,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
dns_zone_settype(zone, dns_zone_master);
isc_buffer_init(&buffer, zonename, strlen(zonename));
isc_buffer_constinit(&buffer, zonename, strlen(zonename));
isc_buffer_add(&buffer, strlen(zonename));
dns_fixedname_init(&fixorigin);
origin = dns_fixedname_name(&fixorigin);
+11 -3
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (C) 2004, 2005, 2007, 2009, 2014 Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (C) 2000-2002 Internet Software Consortium.
.\"
.\" Permission to use, copy, modify, and/or distribute this software for any
@@ -33,7 +33,7 @@
named\-checkconf \- named configuration file syntax checking tool
.SH "SYNOPSIS"
.HP 16
\fBnamed\-checkconf\fR [\fB\-h\fR] [\fB\-v\fR] [\fB\-j\fR] [\fB\-t\ \fR\fB\fIdirectory\fR\fR] {filename} [\fB\-p\fR] [\fB\-z\fR]
\fBnamed\-checkconf\fR [\fB\-h\fR] [\fB\-v\fR] [\fB\-j\fR] [\fB\-t\ \fR\fB\fIdirectory\fR\fR] {filename} [\fB\-p\fR] [\fB\-x\fR] [\fB\-z\fR]
.SH "DESCRIPTION"
.PP
\fBnamed\-checkconf\fR
@@ -84,6 +84,14 @@ Print out the
and included files in canonical form if no errors were detected.
.RE
.PP
\-x
.RS 4
When printing the configuration files in canonical form, obscure shared secrets by replacing them with strings of question marks ('?'). This allows the contents of
\fInamed.conf\fR
and related files to be shared \(em for example, when submitting bug reports \(em without compromising private data. This option cannot be used without
\fB\-p\fR.
.RE
.PP
\-z
.RS 4
Perform a test load of all master zones found in
@@ -113,7 +121,7 @@ BIND 9 Administrator Reference Manual.
.PP
Internet Systems Consortium
.SH "COPYRIGHT"
Copyright \(co 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
Copyright \(co 2004, 2005, 2007, 2009, 2014 Internet Systems Consortium, Inc. ("ISC")
.br
Copyright \(co 2000\-2002 Internet Software Consortium.
.br
+71 -10
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004-2007, 2009-2011 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2004-2007, 2009-2014 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -39,10 +39,13 @@
#include <bind9/check.h>
#include <dns/db.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#include <dns/result.h>
#include <dns/rootns.h>
#include <dns/zone.h>
#include "check-tool.h"
@@ -151,6 +154,30 @@ config_get(const cfg_obj_t **maps, const char *name, const cfg_obj_t **obj) {
}
}
static isc_result_t
configure_hint(const char *zfile, const char *zclass, isc_mem_t *mctx) {
isc_result_t result;
dns_db_t *db = NULL;
dns_rdataclass_t rdclass;
isc_textregion_t r;
if (zfile == NULL)
return (ISC_R_FAILURE);
DE_CONST(zclass, r.base);
r.length = strlen(zclass);
result = dns_rdataclass_fromtext(&rdclass, &r);
if (result != ISC_R_SUCCESS)
return (result);
result = dns_rootns_create(mctx, rdclass, zfile, &db);
if (result != ISC_R_SUCCESS)
return (result);
dns_db_detach(&db);
return (ISC_R_SUCCESS);
}
/*% configure the zone */
static isc_result_t
configure_zone(const char *vclass, const char *view,
@@ -161,7 +188,7 @@ configure_zone(const char *vclass, const char *view,
isc_result_t result;
const char *zclass;
const char *zname;
const char *zfile;
const char *zfile = NULL;
const cfg_obj_t *maps[4];
const cfg_obj_t *zoptions = NULL;
const cfg_obj_t *classobj = NULL;
@@ -195,15 +222,26 @@ configure_zone(const char *vclass, const char *view,
cfg_map_get(zoptions, "type", &typeobj);
if (typeobj == NULL)
return (ISC_R_FAILURE);
if (strcasecmp(cfg_obj_asstring(typeobj), "master") != 0)
cfg_map_get(zoptions, "file", &fileobj);
if (fileobj != NULL)
zfile = cfg_obj_asstring(fileobj);
/*
* Check hints files for hint zones.
* Skip loading checks for any type other than master.
*/
if (strcasecmp(cfg_obj_asstring(typeobj), "hint") == 0)
return (configure_hint(zfile, zclass, mctx));
else if ((strcasecmp(cfg_obj_asstring(typeobj), "master") != 0))
return (ISC_R_SUCCESS);
if (zfile == NULL)
return (ISC_R_FAILURE);
cfg_map_get(zoptions, "database", &dbobj);
if (dbobj != NULL)
return (ISC_R_SUCCESS);
cfg_map_get(zoptions, "file", &fileobj);
if (fileobj == NULL)
return (ISC_R_FAILURE);
zfile = cfg_obj_asstring(fileobj);
obj = NULL;
if (get_maps(maps, "check-dup-records", &obj)) {
@@ -294,6 +332,18 @@ configure_zone(const char *vclass, const char *view,
zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
}
obj = NULL;
if (get_maps(maps, "check-spf", &obj)) {
if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
zone_options |= DNS_ZONEOPT_CHECKSPF;
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
zone_options &= ~DNS_ZONEOPT_CHECKSPF;
} else
INSIST(0);
} else {
zone_options |= DNS_ZONEOPT_CHECKSPF;
}
obj = NULL;
if (get_checknames(maps, &obj)) {
if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
@@ -329,7 +379,7 @@ configure_zone(const char *vclass, const char *view,
if (result != ISC_R_SUCCESS)
fprintf(stderr, "%s/%s/%s: %s\n", view, zname, zclass,
dns_result_totext(result));
return(result);
return (result);
}
/*% configure a view */
@@ -430,10 +480,11 @@ main(int argc, char **argv) {
isc_entropy_t *ectx = NULL;
isc_boolean_t load_zones = ISC_FALSE;
isc_boolean_t print = ISC_FALSE;
unsigned int flags = 0;
isc_commandline_errprint = ISC_FALSE;
while ((c = isc_commandline_parse(argc, argv, "dhjt:pvz")) != EOF) {
while ((c = isc_commandline_parse(argc, argv, "dhjt:pvxz")) != EOF) {
switch (c) {
case 'd':
debug++;
@@ -460,6 +511,10 @@ main(int argc, char **argv) {
printf(VERSION "\n");
exit(0);
case 'x':
flags |= CFG_PRINTER_XKEY;
break;
case 'z':
load_zones = ISC_TRUE;
docheckmx = ISC_FALSE;
@@ -471,6 +526,7 @@ main(int argc, char **argv) {
if (isc_commandline_option != '?')
fprintf(stderr, "%s: invalid argument -%c\n",
program, isc_commandline_option);
/* FALLTHROUGH */
case 'h':
usage();
@@ -481,6 +537,11 @@ main(int argc, char **argv) {
}
}
if (((flags & CFG_PRINTER_XKEY) != 0) && !print) {
fprintf(stderr, "%s: -x cannot be used without -p\n", program);
exit(1);
}
if (isc_commandline_index + 1 < argc)
usage();
if (argv[isc_commandline_index] != NULL)
@@ -521,7 +582,7 @@ main(int argc, char **argv) {
}
if (print && exit_status == 0)
cfg_print(config, output, NULL);
cfg_printx(config, flags, output, NULL);
cfg_obj_destroy(parser, &config);
cfg_parser_destroy(&parser);
@@ -2,7 +2,7 @@
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
[<!ENTITY mdash "&#8212;">]>
<!--
- Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2004, 2005, 2007, 2009, 2014 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2000-2002 Internet Software Consortium.
-
- Permission to use, copy, modify, and/or distribute this software for any
@@ -36,6 +36,7 @@
<year>2005</year>
<year>2007</year>
<year>2009</year>
<year>2014</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
<copyright>
@@ -60,6 +61,7 @@
<arg><option>-t <replaceable class="parameter">directory</replaceable></option></arg>
<arg choice="req">filename</arg>
<arg><option>-p</option></arg>
<arg><option>-x</option></arg>
<arg><option>-z</option></arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -129,6 +131,21 @@
</listitem>
</varlistentry>
<varlistentry>
<term>-x</term>
<listitem>
<para>
When printing the configuration files in canonical
form, obscure shared secrets by replacing them with
strings of question marks ('?'). This allows the
contents of <filename>named.conf</filename> and related
files to be shared &mdash; for example, when submitting
bug reports &mdash; without compromising private data.
This option cannot be used without <option>-p</option>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-z</term>
<listitem>
+17 -7
View File
@@ -1,5 +1,5 @@
<!--
- Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2004, 2005, 2007, 2009, 2014 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2000-2002 Internet Software Consortium.
-
- Permission to use, copy, modify, and/or distribute this software for any
@@ -29,10 +29,10 @@
</div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="cmdsynopsis"><p><code class="command">named-checkconf</code> [<code class="option">-h</code>] [<code class="option">-v</code>] [<code class="option">-j</code>] [<code class="option">-t <em class="replaceable"><code>directory</code></em></code>] {filename} [<code class="option">-p</code>] [<code class="option">-z</code>]</p></div>
<div class="cmdsynopsis"><p><code class="command">named-checkconf</code> [<code class="option">-h</code>] [<code class="option">-v</code>] [<code class="option">-j</code>] [<code class="option">-t <em class="replaceable"><code>directory</code></em></code>] {filename} [<code class="option">-p</code>] [<code class="option">-x</code>] [<code class="option">-z</code>]</p></div>
</div>
<div class="refsect1" lang="en">
<a name="id2543396"></a><h2>DESCRIPTION</h2>
<a name="id2543403"></a><h2>DESCRIPTION</h2>
<p><span><strong class="command">named-checkconf</strong></span>
checks the syntax, but not the semantics, of a
<span><strong class="command">named</strong></span> configuration file. The file is parsed
@@ -52,7 +52,7 @@
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2543445"></a><h2>OPTIONS</h2>
<a name="id2543452"></a><h2>OPTIONS</h2>
<div class="variablelist"><dl>
<dt><span class="term">-h</span></dt>
<dd><p>
@@ -74,6 +74,16 @@
Print out the <code class="filename">named.conf</code> and included files
in canonical form if no errors were detected.
</p></dd>
<dt><span class="term">-x</span></dt>
<dd><p>
When printing the configuration files in canonical
form, obscure shared secrets by replacing them with
strings of question marks ('?'). This allows the
contents of <code class="filename">named.conf</code> and related
files to be shared &#8212; for example, when submitting
bug reports &#8212; without compromising private data.
This option cannot be used without <code class="option">-p</code>.
</p></dd>
<dt><span class="term">-z</span></dt>
<dd><p>
Perform a test load of all master zones found in
@@ -91,21 +101,21 @@
</dl></div>
</div>
<div class="refsect1" lang="en">
<a name="id2543569"></a><h2>RETURN VALUES</h2>
<a name="id2543596"></a><h2>RETURN VALUES</h2>
<p><span><strong class="command">named-checkconf</strong></span>
returns an exit status of 1 if
errors were detected and 0 otherwise.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2543580"></a><h2>SEE ALSO</h2>
<a name="id2543608"></a><h2>SEE ALSO</h2>
<p><span class="citerefentry"><span class="refentrytitle">named</span>(8)</span>,
<span class="citerefentry"><span class="refentrytitle">named-checkzone</span>(8)</span>,
<em class="citetitle">BIND 9 Administrator Reference Manual</em>.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2543610"></a><h2>AUTHOR</h2>
<a name="id2543638"></a><h2>AUTHOR</h2>
<p><span class="corpauthor">Internet Systems Consortium</span>
</p>
</div>
+12 -4
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2004-2007, 2009, 2010 Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (C) 2004-2007, 2009, 2010, 2013 Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (C) 2000-2002 Internet Software Consortium.
.\"
.\" Permission to use, copy, modify, and/or distribute this software for any
@@ -33,9 +33,9 @@
named\-checkzone, named\-compilezone \- zone file validity checking or converting tool
.SH "SYNOPSIS"
.HP 16
\fBnamed\-checkzone\fR [\fB\-d\fR] [\fB\-h\fR] [\fB\-j\fR] [\fB\-q\fR] [\fB\-v\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-f\ \fR\fB\fIformat\fR\fR] [\fB\-F\ \fR\fB\fIformat\fR\fR] [\fB\-i\ \fR\fB\fImode\fR\fR] [\fB\-k\ \fR\fB\fImode\fR\fR] [\fB\-m\ \fR\fB\fImode\fR\fR] [\fB\-M\ \fR\fB\fImode\fR\fR] [\fB\-n\ \fR\fB\fImode\fR\fR] [\fB\-o\ \fR\fB\fIfilename\fR\fR] [\fB\-r\ \fR\fB\fImode\fR\fR] [\fB\-s\ \fR\fB\fIstyle\fR\fR] [\fB\-S\ \fR\fB\fImode\fR\fR] [\fB\-t\ \fR\fB\fIdirectory\fR\fR] [\fB\-w\ \fR\fB\fIdirectory\fR\fR] [\fB\-D\fR] [\fB\-W\ \fR\fB\fImode\fR\fR] {zonename} {filename}
\fBnamed\-checkzone\fR [\fB\-d\fR] [\fB\-h\fR] [\fB\-j\fR] [\fB\-q\fR] [\fB\-v\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-f\ \fR\fB\fIformat\fR\fR] [\fB\-F\ \fR\fB\fIformat\fR\fR] [\fB\-i\ \fR\fB\fImode\fR\fR] [\fB\-k\ \fR\fB\fImode\fR\fR] [\fB\-m\ \fR\fB\fImode\fR\fR] [\fB\-M\ \fR\fB\fImode\fR\fR] [\fB\-n\ \fR\fB\fImode\fR\fR] [\fB\-o\ \fR\fB\fIfilename\fR\fR] [\fB\-r\ \fR\fB\fImode\fR\fR] [\fB\-s\ \fR\fB\fIstyle\fR\fR] [\fB\-S\ \fR\fB\fImode\fR\fR] [\fB\-t\ \fR\fB\fIdirectory\fR\fR] [\fB\-T\ \fR\fB\fImode\fR\fR] [\fB\-w\ \fR\fB\fIdirectory\fR\fR] [\fB\-D\fR] [\fB\-W\ \fR\fB\fImode\fR\fR] {zonename} {filename}
.HP 18
\fBnamed\-compilezone\fR [\fB\-d\fR] [\fB\-j\fR] [\fB\-q\fR] [\fB\-v\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-C\ \fR\fB\fImode\fR\fR] [\fB\-f\ \fR\fB\fIformat\fR\fR] [\fB\-F\ \fR\fB\fIformat\fR\fR] [\fB\-i\ \fR\fB\fImode\fR\fR] [\fB\-k\ \fR\fB\fImode\fR\fR] [\fB\-m\ \fR\fB\fImode\fR\fR] [\fB\-n\ \fR\fB\fImode\fR\fR] [\fB\-r\ \fR\fB\fImode\fR\fR] [\fB\-s\ \fR\fB\fIstyle\fR\fR] [\fB\-t\ \fR\fB\fIdirectory\fR\fR] [\fB\-w\ \fR\fB\fIdirectory\fR\fR] [\fB\-D\fR] [\fB\-W\ \fR\fB\fImode\fR\fR] {\fB\-o\ \fR\fB\fIfilename\fR\fR} {zonename} {filename}
\fBnamed\-compilezone\fR [\fB\-d\fR] [\fB\-j\fR] [\fB\-q\fR] [\fB\-v\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-C\ \fR\fB\fImode\fR\fR] [\fB\-f\ \fR\fB\fIformat\fR\fR] [\fB\-F\ \fR\fB\fIformat\fR\fR] [\fB\-i\ \fR\fB\fImode\fR\fR] [\fB\-k\ \fR\fB\fImode\fR\fR] [\fB\-m\ \fR\fB\fImode\fR\fR] [\fB\-n\ \fR\fB\fImode\fR\fR] [\fB\-r\ \fR\fB\fImode\fR\fR] [\fB\-s\ \fR\fB\fIstyle\fR\fR] [\fB\-t\ \fR\fB\fIdirectory\fR\fR] [\fB\-T\ \fR\fB\fImode\fR\fR] [\fB\-w\ \fR\fB\fIdirectory\fR\fR] [\fB\-D\fR] [\fB\-W\ \fR\fB\fImode\fR\fR] {\fB\-o\ \fR\fB\fIfilename\fR\fR} {zonename} {filename}
.SH "DESCRIPTION"
.PP
\fBnamed\-checkzone\fR
@@ -236,6 +236,14 @@ Chroot to
so that include directives in the configuration file are processed as if run by a similarly chrooted named.
.RE
.PP
\-T \fImode\fR
.RS 4
Check if Sender Policy Framework records (TXT and SPF) both exist or both don't exist. A warning is issued if they don't match. Possible modes are
\fB"warn"\fR
(default),
\fB"ignore"\fR.
.RE
.PP
\-w \fIdirectory\fR
.RS 4
chdir to
@@ -281,7 +289,7 @@ BIND 9 Administrator Reference Manual.
.PP
Internet Systems Consortium
.SH "COPYRIGHT"
Copyright \(co 2004\-2007, 2009, 2010 Internet Systems Consortium, Inc. ("ISC")
Copyright \(co 2004\-2007, 2009, 2010, 2013 Internet Systems Consortium, Inc. ("ISC")
.br
Copyright \(co 2000\-2002 Internet Software Consortium.
.br
+18 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -145,19 +145,21 @@ main(int argc, char **argv) {
if (progmode == progmode_compile) {
zone_options |= (DNS_ZONEOPT_CHECKNS |
DNS_ZONEOPT_FATALNS |
DNS_ZONEOPT_CHECKSPF |
DNS_ZONEOPT_CHECKDUPRR |
DNS_ZONEOPT_CHECKNAMES |
DNS_ZONEOPT_CHECKNAMESFAIL |
DNS_ZONEOPT_CHECKWILDCARD);
} else
zone_options |= DNS_ZONEOPT_CHECKDUPRR;
zone_options |= (DNS_ZONEOPT_CHECKDUPRR |
DNS_ZONEOPT_CHECKSPF);
#define ARGCMP(X) (strcmp(isc_commandline_argument, X) == 0)
isc_commandline_errprint = ISC_FALSE;
while ((c = isc_commandline_parse(argc, argv,
"c:df:hi:jk:m:n:qr:s:t:o:vw:DF:M:S:W:"))
"c:df:hi:jk:m:n:qr:s:t:o:vw:DF:M:S:T:W:"))
!= EOF) {
switch (c) {
case 'c':
@@ -363,6 +365,18 @@ main(int argc, char **argv) {
}
break;
case 'T':
if (ARGCMP("warn")) {
zone_options |= DNS_ZONEOPT_CHECKSPF;
} else if (ARGCMP("ignore")) {
zone_options &= ~DNS_ZONEOPT_CHECKSPF;
} else {
fprintf(stderr, "invalid argument to -T: %s\n",
isc_commandline_argument);
exit(1);
}
break;
case 'W':
if (ARGCMP("warn"))
zone_options |= DNS_ZONEOPT_CHECKWILDCARD;
@@ -374,6 +388,7 @@ main(int argc, char **argv) {
if (isc_commandline_option != '?')
fprintf(stderr, "%s: invalid argument -%c\n",
prog_name, isc_commandline_option);
/* FALLTHROUGH */
case 'h':
usage();
@@ -2,7 +2,7 @@
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
[<!ENTITY mdash "&#8212;">]>
<!--
- Copyright (C) 2004-2007, 2009, 2010 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2004-2007, 2009, 2010, 2013 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2000-2002 Internet Software Consortium.
-
- Permission to use, copy, modify, and/or distribute this software for any
@@ -38,6 +38,7 @@
<year>2007</year>
<year>2009</year>
<year>2010</year>
<year>2013</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
<copyright>
@@ -75,6 +76,7 @@
<arg><option>-s <replaceable class="parameter">style</replaceable></option></arg>
<arg><option>-S <replaceable class="parameter">mode</replaceable></option></arg>
<arg><option>-t <replaceable class="parameter">directory</replaceable></option></arg>
<arg><option>-T <replaceable class="parameter">mode</replaceable></option></arg>
<arg><option>-w <replaceable class="parameter">directory</replaceable></option></arg>
<arg><option>-D</option></arg>
<arg><option>-W <replaceable class="parameter">mode</replaceable></option></arg>
@@ -98,6 +100,7 @@
<arg><option>-r <replaceable class="parameter">mode</replaceable></option></arg>
<arg><option>-s <replaceable class="parameter">style</replaceable></option></arg>
<arg><option>-t <replaceable class="parameter">directory</replaceable></option></arg>
<arg><option>-T <replaceable class="parameter">mode</replaceable></option></arg>
<arg><option>-w <replaceable class="parameter">directory</replaceable></option></arg>
<arg><option>-D</option></arg>
<arg><option>-W <replaceable class="parameter">mode</replaceable></option></arg>
@@ -379,6 +382,18 @@
</listitem>
</varlistentry>
<varlistentry>
<term>-T <replaceable class="parameter">mode</replaceable></term>
<listitem>
<para>
Check if Sender Policy Framework records (TXT and SPF)
both exist or both don't exist. A warning is issued
if they don't match. Possible modes are
<command>"warn"</command> (default), <command>"ignore"</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-w <replaceable class="parameter">directory</replaceable></term>
<listitem>
+15 -8
View File
@@ -1,5 +1,5 @@
<!--
- Copyright (C) 2004-2007, 2009, 2010 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2004-2007, 2009, 2010, 2013 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2000-2002 Internet Software Consortium.
-
- Permission to use, copy, modify, and/or distribute this software for any
@@ -29,11 +29,11 @@
</div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="cmdsynopsis"><p><code class="command">named-checkzone</code> [<code class="option">-d</code>] [<code class="option">-h</code>] [<code class="option">-j</code>] [<code class="option">-q</code>] [<code class="option">-v</code>] [<code class="option">-c <em class="replaceable"><code>class</code></em></code>] [<code class="option">-f <em class="replaceable"><code>format</code></em></code>] [<code class="option">-F <em class="replaceable"><code>format</code></em></code>] [<code class="option">-i <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-k <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-m <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-M <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-n <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-o <em class="replaceable"><code>filename</code></em></code>] [<code class="option">-r <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-s <em class="replaceable"><code>style</code></em></code>] [<code class="option">-S <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-t <em class="replaceable"><code>directory</code></em></code>] [<code class="option">-w <em class="replaceable"><code>directory</code></em></code>] [<code class="option">-D</code>] [<code class="option">-W <em class="replaceable"><code>mode</code></em></code>] {zonename} {filename}</p></div>
<div class="cmdsynopsis"><p><code class="command">named-compilezone</code> [<code class="option">-d</code>] [<code class="option">-j</code>] [<code class="option">-q</code>] [<code class="option">-v</code>] [<code class="option">-c <em class="replaceable"><code>class</code></em></code>] [<code class="option">-C <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-f <em class="replaceable"><code>format</code></em></code>] [<code class="option">-F <em class="replaceable"><code>format</code></em></code>] [<code class="option">-i <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-k <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-m <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-n <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-r <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-s <em class="replaceable"><code>style</code></em></code>] [<code class="option">-t <em class="replaceable"><code>directory</code></em></code>] [<code class="option">-w <em class="replaceable"><code>directory</code></em></code>] [<code class="option">-D</code>] [<code class="option">-W <em class="replaceable"><code>mode</code></em></code>] {<code class="option">-o <em class="replaceable"><code>filename</code></em></code>} {zonename} {filename}</p></div>
<div class="cmdsynopsis"><p><code class="command">named-checkzone</code> [<code class="option">-d</code>] [<code class="option">-h</code>] [<code class="option">-j</code>] [<code class="option">-q</code>] [<code class="option">-v</code>] [<code class="option">-c <em class="replaceable"><code>class</code></em></code>] [<code class="option">-f <em class="replaceable"><code>format</code></em></code>] [<code class="option">-F <em class="replaceable"><code>format</code></em></code>] [<code class="option">-i <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-k <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-m <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-M <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-n <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-o <em class="replaceable"><code>filename</code></em></code>] [<code class="option">-r <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-s <em class="replaceable"><code>style</code></em></code>] [<code class="option">-S <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-t <em class="replaceable"><code>directory</code></em></code>] [<code class="option">-T <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-w <em class="replaceable"><code>directory</code></em></code>] [<code class="option">-D</code>] [<code class="option">-W <em class="replaceable"><code>mode</code></em></code>] {zonename} {filename}</p></div>
<div class="cmdsynopsis"><p><code class="command">named-compilezone</code> [<code class="option">-d</code>] [<code class="option">-j</code>] [<code class="option">-q</code>] [<code class="option">-v</code>] [<code class="option">-c <em class="replaceable"><code>class</code></em></code>] [<code class="option">-C <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-f <em class="replaceable"><code>format</code></em></code>] [<code class="option">-F <em class="replaceable"><code>format</code></em></code>] [<code class="option">-i <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-k <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-m <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-n <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-r <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-s <em class="replaceable"><code>style</code></em></code>] [<code class="option">-t <em class="replaceable"><code>directory</code></em></code>] [<code class="option">-T <em class="replaceable"><code>mode</code></em></code>] [<code class="option">-w <em class="replaceable"><code>directory</code></em></code>] [<code class="option">-D</code>] [<code class="option">-W <em class="replaceable"><code>mode</code></em></code>] {<code class="option">-o <em class="replaceable"><code>filename</code></em></code>} {zonename} {filename}</p></div>
</div>
<div class="refsect1" lang="en">
<a name="id2543696"></a><h2>DESCRIPTION</h2>
<a name="id2543716"></a><h2>DESCRIPTION</h2>
<p><span><strong class="command">named-checkzone</strong></span>
checks the syntax and integrity of a zone file. It performs the
same checks as <span><strong class="command">named</strong></span> does when loading a
@@ -53,7 +53,7 @@
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2543731"></a><h2>OPTIONS</h2>
<a name="id2543751"></a><h2>OPTIONS</h2>
<div class="variablelist"><dl>
<dt><span class="term">-d</span></dt>
<dd><p>
@@ -214,6 +214,13 @@
directives in the configuration file are processed as if
run by a similarly chrooted named.
</p></dd>
<dt><span class="term">-T <em class="replaceable"><code>mode</code></em></span></dt>
<dd><p>
Check if Sender Policy Framework records (TXT and SPF)
both exist or both don't exist. A warning is issued
if they don't match. Possible modes are
<span><strong class="command">"warn"</strong></span> (default), <span><strong class="command">"ignore"</strong></span>.
</p></dd>
<dt><span class="term">-w <em class="replaceable"><code>directory</code></em></span></dt>
<dd><p>
chdir to <code class="filename">directory</code> so that
@@ -247,14 +254,14 @@
</dl></div>
</div>
<div class="refsect1" lang="en">
<a name="id2544446"></a><h2>RETURN VALUES</h2>
<a name="id2544422"></a><h2>RETURN VALUES</h2>
<p><span><strong class="command">named-checkzone</strong></span>
returns an exit status of 1 if
errors were detected and 0 otherwise.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2544458"></a><h2>SEE ALSO</h2>
<a name="id2544434"></a><h2>SEE ALSO</h2>
<p><span class="citerefentry"><span class="refentrytitle">named</span>(8)</span>,
<span class="citerefentry"><span class="refentrytitle">named-checkconf</span>(8)</span>,
<em class="citetitle">RFC 1035</em>,
@@ -262,7 +269,7 @@
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2544491"></a><h2>AUTHOR</h2>
<a name="id2544603"></a><h2>AUTHOR</h2>
<p><span class="corpauthor">Internet Systems Consortium</span>
</p>
</div>
+2 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009, 2011 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2009, 2011, 2014 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -101,7 +101,7 @@ main(int argc, char **argv) {
result = isc_file_progname(*argv, program, sizeof(program));
if (result != ISC_R_SUCCESS)
memcpy(program, "ddns-confgen", 13);
memmove(program, "ddns-confgen", 13);
progname = program;
isc_commandline_errprint = ISC_FALSE;
+8 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2009, 2012, 2013 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -126,13 +126,17 @@ generate_key(isc_mem_t *mctx, const char *randomfile, dns_secalg_t alg,
switch (alg) {
case DST_ALG_HMACMD5:
case DST_ALG_HMACSHA1:
case DST_ALG_HMACSHA224:
case DST_ALG_HMACSHA256:
if (keysize < 1 || keysize > 512)
fatal("keysize %d out of range (must be 1-512)\n",
keysize);
break;
case DST_ALG_HMACSHA256:
if (keysize < 1 || keysize > 256)
fatal("keysize %d out of range (must be 1-256)\n",
case DST_ALG_HMACSHA384:
case DST_ALG_HMACSHA512:
if (keysize < 1 || keysize > 1024)
fatal("keysize %d out of range (must be 1-1024)\n",
keysize);
break;
default:
+2 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004, 2005, 2007-2009, 2011 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2004, 2005, 2007-2009, 2011, 2013, 2014 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -120,7 +120,7 @@ main(int argc, char **argv) {
result = isc_file_progname(*argv, program, sizeof(program));
if (result != ISC_R_SUCCESS)
memcpy(program, "rndc-confgen", 13);
memmove(program, "rndc-confgen", 13);
progname = program;
keyname = DEFAULT_KEYNAME;
@@ -140,8 +140,6 @@ main(int argc, char **argv) {
keysize = strtol(isc_commandline_argument, &p, 10);
if (*p != '\0' || keysize < 0)
fatal("-b requires a non-negative number");
if (keysize < 1 || keysize > 512)
fatal("-b must be in the range 1 through 512");
break;
case 'c':
keyfile = isc_commandline_argument;
+23 -8
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (C) 2004-2010, 2013 Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (C) 2000-2003 Internet Software Consortium.
.\"
.\" Permission to use, copy, modify, and/or distribute this software for any
@@ -20,11 +20,11 @@
.\" Title: dig
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/>
.\" Date: Jun 30, 2000
.\" Date: June 30, 2000
.\" Manual: BIND9
.\" Source: BIND9
.\"
.TH "DIG" "1" "Jun 30, 2000" "BIND9" "BIND9"
.TH "DIG" "1" "June 30, 2000" "BIND9" "BIND9"
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
@@ -57,7 +57,9 @@ allows multiple lookups to be issued from the command line.
Unless it is told to query a specific name server,
\fBdig\fR
will try each of the servers listed in
\fI/etc/resolv.conf\fR.
\fI/etc/resolv.conf\fR. If no usable server addresses are found,
\fBdig\fR
will send the query to the local host.
.PP
When no command line arguments or options are given,
\fBdig\fR
@@ -95,13 +97,20 @@ is the name or IP address of the name server to query. This can be an IPv4 addre
\fIserver\fR
argument is a hostname,
\fBdig\fR
resolves that name before querying that name server. If no
resolves that name before querying that name server.
.sp
If no
\fIserver\fR
argument is provided,
\fBdig\fR
consults
\fI/etc/resolv.conf\fR
and queries the name servers listed there. The reply from the name server that responds is displayed.
\fI/etc/resolv.conf\fR; if an address is found there, it queries the name server at that address. If either of the
\fB\-4\fR
or
\fB\-6\fR
options are in use, then only addresses for the corresponding transport will be tried. If no usable addresses are found,
\fBdig\fR
will send the query to the local host. The reply from the name server that responds is displayed.
.RE
.PP
\fBname\fR
@@ -505,6 +514,12 @@ When chasing DNSSEC signature chains perform a top\-down validation. Requires di
.RS 4
Include an EDNS name server ID request when sending a query.
.RE
.PP
\fB+[no]keepopen\fR
.RS 4
Keep the TCP socket open between queries and reuse it rather than creating a new TCP socket for each lookup. The default is
\fB+nokeepopen\fR.
.RE
.SH "MULTIPLE QUERIES"
.PP
The BIND 9 implementation of
@@ -567,7 +582,7 @@ RFC1035.
.PP
There are probably too many query options.
.SH "COPYRIGHT"
Copyright \(co 2004\-2010 Internet Systems Consortium, Inc. ("ISC")
Copyright \(co 2004\-2010, 2013 Internet Systems Consortium, Inc. ("ISC")
.br
Copyright \(co 2000\-2003 Internet Software Consortium.
.br
+27 -8
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -186,7 +186,7 @@ help(void) {
" +domain=### (Set default domainname)\n"
" +bufsize=### (Set EDNS0 Max UDP packet size)\n"
" +ndots=### (Set NDOTS value)\n"
" +edns=### (Set EDNS version)\n"
" +[no]edns[=###] (Set EDNS version) [0]\n"
" +[no]search (Set whether to use searchlist)\n"
" +[no]showsearch (Search with intermediate results)\n"
" +[no]defname (Ditto)\n"
@@ -225,6 +225,7 @@ help(void) {
#endif
" +[no]multiline (Print records in an expanded format)\n"
" +[no]onesoa (AXFR prints only one soa record)\n"
" +[no]keepopen (Keep the TCP socket open between queries)\n"
" global d-opts and servers (before host name) affect all queries.\n"
" local d-opts and servers (after host name) affect only that lookup.\n"
" -h (print help and exit)\n"
@@ -240,6 +241,8 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) {
isc_uint64_t diff;
isc_time_t now;
time_t tnow;
struct tm tmnow;
char time_str[100];
char fromtext[ISC_SOCKADDR_FORMATSIZE];
isc_sockaddr_format(from, fromtext, sizeof(fromtext));
@@ -251,7 +254,10 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) {
printf(";; Query time: %ld msec\n", (long int)diff/1000);
printf(";; SERVER: %s(%s)\n", fromtext, query->servname);
time(&tnow);
printf(";; WHEN: %s", ctime(&tnow));
tmnow = *localtime(&tnow);
if (strftime(time_str, sizeof(time_str),
"%a %b %d %H:%M:%S %Z %Y", &tmnow) > 0U)
printf(";; WHEN: %s\n", time_str);
if (query->lookup->doing_xfr) {
printf(";; XFR size: %u records (messages %u, "
"bytes %" ISC_PRINT_QUADFORMAT "u)\n",
@@ -259,7 +265,6 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) {
query->byte_count);
} else {
printf(";; MSG SIZE rcvd: %u\n", bytes);
}
if (key != NULL) {
if (!validated)
@@ -276,7 +281,7 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) {
"from %s(%s) in %d ms\n\n",
query->lookup->doing_xfr ?
query->byte_count : (isc_uint64_t)bytes,
fromtext, query->servname,
fromtext, query->userarg,
(int)diff/1000);
}
}
@@ -525,8 +530,16 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
printf(";; WARNING: recursion requested "
"but not available\n");
}
if (msg != query->lookup->sendmsg &&
query->lookup->edns != -1 && msg->opt == NULL &&
(msg->rcode == dns_rcode_formerr ||
msg->rcode == dns_rcode_notimp))
printf("\n;; WARNING: EDNS query returned status "
"%s - retry with '%s+noedns'\n",
rcode_totext(msg->rcode),
query->lookup->dnssec ? "+nodnssec ": "");
if (msg != query->lookup->sendmsg && extrabytes != 0U)
printf(";; WARNING: Messages has %u extra byte%s at "
printf(";; WARNING: Message has %u extra byte%s at "
"end\n", extrabytes, extrabytes != 0 ? "s" : "");
}
@@ -855,8 +868,10 @@ plus_option(char *option, isc_boolean_t is_batchfile,
lookup->edns = -1;
break;
}
if (value == NULL)
goto need_value;
if (value == NULL) {
lookup->edns = 0;
break;
}
result = parse_uint(&num, value, 255, "edns");
if (result != ISC_R_SUCCESS)
fatal("Couldn't parse edns");
@@ -878,6 +893,10 @@ plus_option(char *option, isc_boolean_t is_batchfile,
lookup->ignore = ISC_TRUE;
}
break;
case 'k':
FULLCHECK("keepopen");
keep_open = state;
break;
case 'm': /* multiline */
FULLCHECK("multiline");
multiline = state;
+35 -18
View File
@@ -2,7 +2,7 @@
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
[<!ENTITY mdash "&#8212;">]>
<!--
- Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2004-2010, 2013 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2000-2003 Internet Software Consortium.
-
- Permission to use, copy, modify, and/or distribute this software for any
@@ -22,7 +22,7 @@
<refentry id="man.dig">
<refentryinfo>
<date>Jun 30, 2000</date>
<date>June 30, 2000</date>
</refentryinfo>
<refmeta>
@@ -45,6 +45,7 @@
<year>2008</year>
<year>2009</year>
<year>2010</year>
<year>2013</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
<copyright>
@@ -116,9 +117,10 @@
<para>
Unless it is told to query a specific name server,
<command>dig</command> will try each of the servers listed
in
<filename>/etc/resolv.conf</filename>.
<command>dig</command> will try each of the servers listed in
<filename>/etc/resolv.conf</filename>. If no usable server addresses
are found, <command>dig</command> will send the query to the local
host.
</para>
<para>
@@ -157,20 +159,25 @@
<term><constant>server</constant></term>
<listitem>
<para>
is the name or IP address of the name server to query. This can
be an IPv4
address in dotted-decimal notation or an IPv6
is the name or IP address of the name server to query. This
can be an IPv4 address in dotted-decimal notation or an IPv6
address in colon-delimited notation. When the supplied
<parameter>server</parameter> argument is a
hostname,
<command>dig</command> resolves that name before
querying that name
server. If no <parameter>server</parameter>
argument is provided,
<command>dig</command> consults <filename>/etc/resolv.conf</filename>
and queries the name servers listed there. The reply from the
name
server that responds is displayed.
<parameter>server</parameter> argument is a hostname,
<command>dig</command> resolves that name before querying
that name server.
</para>
<para>
If no <parameter>server</parameter> argument is
provided, <command>dig</command> consults
<filename>/etc/resolv.conf</filename>; if an
address is found there, it queries the name server at
that address. If either of the <option>-4</option> or
<option>-6</option> options are in use, then
only addresses for the corresponding transport
will be tried. If no usable addresses are found,
<command>dig</command> will send the query to the
local host. The reply from the name server that
responds is displayed.
</para>
</listitem>
</varlistentry>
@@ -861,6 +868,16 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]keepopen</option></term>
<listitem>
<para>
Keep the TCP socket open between queries and reuse it rather
than creating a new TCP socket for each lookup. The default
is <option>+nokeepopen</option>.
</para>
</listitem>
</varlistentry>
</variablelist>
+42 -28
View File
@@ -1,5 +1,5 @@
<!--
- Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2004-2010, 2013 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2000-2003 Internet Software Consortium.
-
- Permission to use, copy, modify, and/or distribute this software for any
@@ -34,7 +34,7 @@
<div class="cmdsynopsis"><p><code class="command">dig</code> [global-queryopt...] [query...]</p></div>
</div>
<div class="refsect1" lang="en">
<a name="id2543524"></a><h2>DESCRIPTION</h2>
<a name="id2543527"></a><h2>DESCRIPTION</h2>
<p><span><strong class="command">dig</strong></span>
(domain information groper) is a flexible tool
for interrogating DNS name servers. It performs DNS lookups and
@@ -57,9 +57,10 @@
</p>
<p>
Unless it is told to query a specific name server,
<span><strong class="command">dig</strong></span> will try each of the servers listed
in
<code class="filename">/etc/resolv.conf</code>.
<span><strong class="command">dig</strong></span> will try each of the servers listed in
<code class="filename">/etc/resolv.conf</code>. If no usable server addresses
are found, <span><strong class="command">dig</strong></span> will send the query to the local
host.
</p>
<p>
When no command line arguments or options are given,
@@ -80,7 +81,7 @@
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2543597"></a><h2>SIMPLE USAGE</h2>
<a name="id2543606"></a><h2>SIMPLE USAGE</h2>
<p>
A typical invocation of <span><strong class="command">dig</strong></span> looks like:
</p>
@@ -91,22 +92,29 @@
</p>
<div class="variablelist"><dl>
<dt><span class="term"><code class="constant">server</code></span></dt>
<dd><p>
is the name or IP address of the name server to query. This can
be an IPv4
address in dotted-decimal notation or an IPv6
<dd>
<p>
is the name or IP address of the name server to query. This
can be an IPv4 address in dotted-decimal notation or an IPv6
address in colon-delimited notation. When the supplied
<em class="parameter"><code>server</code></em> argument is a
hostname,
<span><strong class="command">dig</strong></span> resolves that name before
querying that name
server. If no <em class="parameter"><code>server</code></em>
argument is provided,
<span><strong class="command">dig</strong></span> consults <code class="filename">/etc/resolv.conf</code>
and queries the name servers listed there. The reply from the
name
server that responds is displayed.
</p></dd>
<em class="parameter"><code>server</code></em> argument is a hostname,
<span><strong class="command">dig</strong></span> resolves that name before querying
that name server.
</p>
<p>
If no <em class="parameter"><code>server</code></em> argument is
provided, <span><strong class="command">dig</strong></span> consults
<code class="filename">/etc/resolv.conf</code>; if an
address is found there, it queries the name server at
that address. If either of the <code class="option">-4</code> or
<code class="option">-6</code> options are in use, then
only addresses for the corresponding transport
will be tried. If no usable addresses are found,
<span><strong class="command">dig</strong></span> will send the query to the
local host. The reply from the name server that
responds is displayed.
</p>
</dd>
<dt><span class="term"><code class="constant">name</code></span></dt>
<dd><p>
is the name of the resource record that is to be looked up.
@@ -126,7 +134,7 @@
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2543688"></a><h2>OPTIONS</h2>
<a name="id2543709"></a><h2>OPTIONS</h2>
<p>
The <code class="option">-b</code> option sets the source IP address of the query
to <em class="parameter"><code>address</code></em>. This must be a valid
@@ -230,7 +238,7 @@
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2544037"></a><h2>QUERY OPTIONS</h2>
<a name="id2544058"></a><h2>QUERY OPTIONS</h2>
<p><span><strong class="command">dig</strong></span>
provides a number of query options which affect
the way in which lookups are made and the results displayed. Some of
@@ -555,13 +563,19 @@
<dd><p>
Include an EDNS name server ID request when sending a query.
</p></dd>
<dt><span class="term"><code class="option">+[no]keepopen</code></span></dt>
<dd><p>
Keep the TCP socket open between queries and reuse it rather
than creating a new TCP socket for each lookup. The default
is <code class="option">+nokeepopen</code>.
</p></dd>
</dl></div>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2545186"></a><h2>MULTIPLE QUERIES</h2>
<a name="id2545224"></a><h2>MULTIPLE QUERIES</h2>
<p>
The BIND 9 implementation of <span><strong class="command">dig </strong></span>
supports
@@ -607,7 +621,7 @@ dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2545248"></a><h2>IDN SUPPORT</h2>
<a name="id2545354"></a><h2>IDN SUPPORT</h2>
<p>
If <span><strong class="command">dig</strong></span> has been built with IDN (internationalized
domain name) support, it can accept and display non-ASCII domain names.
@@ -621,14 +635,14 @@ dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2545338"></a><h2>FILES</h2>
<a name="id2545377"></a><h2>FILES</h2>
<p><code class="filename">/etc/resolv.conf</code>
</p>
<p><code class="filename">${HOME}/.digrc</code>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2545355"></a><h2>SEE ALSO</h2>
<a name="id2545462"></a><h2>SEE ALSO</h2>
<p><span class="citerefentry"><span class="refentrytitle">host</span>(1)</span>,
<span class="citerefentry"><span class="refentrytitle">named</span>(8)</span>,
<span class="citerefentry"><span class="refentrytitle">dnssec-keygen</span>(8)</span>,
@@ -636,7 +650,7 @@ dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2545393"></a><h2>BUGS</h2>
<a name="id2545499"></a><h2>BUGS</h2>
<p>
There are probably too many query options.
</p>
+202 -179
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -46,8 +46,10 @@
#include <dns/byaddr.h>
#ifdef DIG_SIGCHASE
#include <dns/callbacks.h>
#include <dns/dnssec.h>
#include <dns/ds.h>
#include <dns/master.h>
#include <dns/nsec.h>
#include <isc/random.h>
#include <ctype.h>
@@ -123,7 +125,8 @@ isc_boolean_t
usesearch = ISC_FALSE,
showsearch = ISC_FALSE,
qr = ISC_FALSE,
is_dst_up = ISC_FALSE;
is_dst_up = ISC_FALSE,
keep_open = ISC_FALSE;
in_port_t port = 53;
unsigned int timeout = 0;
unsigned int extrabytes;
@@ -155,6 +158,9 @@ static void idn_check_result(idn_result_t r, const char *msg);
int idnoptions = 0;
#endif
isc_socket_t *keep = NULL;
isc_sockaddr_t keepaddr;
/*%
* Exit Codes:
*
@@ -178,6 +184,7 @@ isc_boolean_t validated = ISC_TRUE;
isc_entropy_t *entp = NULL;
isc_mempool_t *commctx = NULL;
isc_boolean_t debugging = ISC_FALSE;
isc_boolean_t debugtiming = ISC_FALSE;
isc_boolean_t memdebugging = ISC_FALSE;
char *progname = NULL;
isc_mutex_t lookup_lock;
@@ -250,11 +257,10 @@ isc_result_t prove_nx(dns_message_t * msg, dns_name_t * name,
dns_rdataset_t ** sigrdataset);
static void nameFromString(const char *str, dns_name_t *p_ret);
int inf_name(dns_name_t * name1, dns_name_t * name2);
isc_result_t opentmpkey(isc_mem_t *mctx, const char *file,
char **tempp, FILE **fp);
isc_result_t removetmpkey(isc_mem_t *mctx, const char *file);
void clean_trustedkey(void);
void insert_trustedkey(dst_key_t **key);
isc_result_t insert_trustedkey(void *arg, dns_name_t *name,
dns_rdataset_t *rdataset);
#if DIG_SIGCHASE_BU
isc_result_t getneededrr(dns_message_t *msg);
void sigchase_bottom_up(dns_message_t *msg);
@@ -444,7 +450,7 @@ static isc_result_t
append(const char *text, int len, char **p, char *end) {
if (len > end - *p)
return (ISC_R_NOSPACE);
memcpy(*p, text, len);
memmove(*p, text, len);
*p += len;
return (ISC_R_SUCCESS);
}
@@ -461,7 +467,7 @@ reverse_octets(const char *in, char **p, char *end) {
result = append(".", 1, p, end);
if (result != ISC_R_SUCCESS)
return (result);
len = dot - in;
len = (int)(dot - in);
} else {
len = strlen(in);
}
@@ -491,7 +497,7 @@ get_reverse(char *reverse, size_t len, char *value, isc_boolean_t ip6_int,
result = dns_byaddr_createptrname2(&addr, options, name);
if (result != ISC_R_SUCCESS)
return (result);
dns_name_format(name, reverse, len);
dns_name_format(name, reverse, (unsigned int)len);
return (ISC_R_SUCCESS);
} else {
/*
@@ -537,9 +543,15 @@ fatal(const char *format, ...) {
void
debug(const char *format, ...) {
va_list args;
isc_time_t t;
if (debugging) {
fflush(stdout);
if (debugtiming) {
TIME_NOW(&t);
fprintf(stderr, "%d.%06d: ", isc_time_seconds(&t),
isc_time_nanoseconds(&t) / 1000);
}
va_start(args, format);
vfprintf(stderr, format, args);
va_end(args);
@@ -794,6 +806,7 @@ make_empty_lookup(void) {
dns_fixedname_init(&looknew->fdomain);
ISC_LINK_INIT(looknew, link);
ISC_LIST_INIT(looknew->q);
ISC_LIST_INIT(looknew->connecting);
ISC_LIST_INIT(looknew->my_server_list);
return (looknew);
}
@@ -815,11 +828,11 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
looknew = make_empty_lookup();
INSIST(looknew != NULL);
strncpy(looknew->textname, lookold->textname, MXNAME);
strlcpy(looknew->textname, lookold->textname, MXNAME);
#if DIG_SIGCHASE_TD
strncpy(looknew->textnamesigchase, lookold->textnamesigchase, MXNAME);
strlcpy(looknew->textnamesigchase, lookold->textnamesigchase, MXNAME);
#endif
strncpy(looknew->cmdline, lookold->cmdline, MXNAME);
strlcpy(looknew->cmdline, lookold->cmdline, MXNAME);
looknew->textname[MXNAME-1] = 0;
looknew->rdtype = lookold->rdtype;
looknew->qrdtype = lookold->qrdtype;
@@ -998,7 +1011,7 @@ parse_hmac(const char *hmac) {
len = strlen(hmac);
if (len >= (int) sizeof(buf))
fatal("unknown key type '%.*s'", len, hmac);
strncpy(buf, hmac, sizeof(buf));
strlcpy(buf, hmac, sizeof(buf));
digestbits = 0;
@@ -1080,8 +1093,8 @@ read_confkey(void) {
secretstr = cfg_obj_asstring(secretobj);
algorithm = cfg_obj_asstring(algorithmobj);
strncpy(keynametext, keyname, sizeof(keynametext));
strncpy(keysecret, secretstr, sizeof(keysecret));
strlcpy(keynametext, keyname, sizeof(keynametext));
strlcpy(keysecret, secretstr, sizeof(keysecret));
parse_hmac(algorithm);
setup_text_key();
@@ -1164,7 +1177,7 @@ make_searchlist_entry(char *domain) {
if (search == NULL)
fatal("memory allocation failure in %s:%d",
__FILE__, __LINE__);
strncpy(search->origin, domain, MXNAME);
strlcpy(search->origin, domain, MXNAME);
search->origin[MXNAME-1] = 0;
ISC_LINK_INIT(search, link);
return (search);
@@ -1317,6 +1330,7 @@ setup_libs(void) {
result = isc_mem_create(0, 0, &mctx);
check_result(result, "isc_mem_create");
isc_mem_setname(mctx, "dig", NULL);
result = isc_log_create(mctx, &lctx, &logconfig);
check_result(result, "isc_log_create");
@@ -1335,6 +1349,7 @@ setup_libs(void) {
result = isc_task_create(taskmgr, 0, &global_task);
check_result(result, "isc_task_create");
isc_task_setname(global_task, "dig", NULL);
result = isc_timermgr_create(mctx, &timermgr);
check_result(result, "isc_timermgr_create");
@@ -1473,7 +1488,10 @@ clear_query(dig_query_t *query) {
if (lookup->current_query == query)
lookup->current_query = NULL;
ISC_LIST_UNLINK(lookup->q, query, link);
if (ISC_LINK_LINKED(query, link))
ISC_LIST_UNLINK(lookup->q, query, link);
if (ISC_LINK_LINKED(query, clink))
ISC_LIST_UNLINK(lookup->connecting, query, clink);
if (ISC_LINK_LINKED(&query->recvbuf, link))
ISC_LIST_DEQUEUE(query->recvlist, &query->recvbuf,
link);
@@ -1481,6 +1499,7 @@ clear_query(dig_query_t *query) {
ISC_LIST_DEQUEUE(query->lengthlist, &query->lengthbuf,
link);
INSIST(query->recvspace != NULL);
if (query->sock != NULL) {
isc_socket_detach(&query->sock);
sockcount--;
@@ -1508,13 +1527,22 @@ try_clear_lookup(dig_lookup_t *lookup) {
debug("try_clear_lookup(%p)", lookup);
if (ISC_LIST_HEAD(lookup->q) != NULL) {
if (ISC_LIST_HEAD(lookup->q) != NULL ||
ISC_LIST_HEAD(lookup->connecting) != NULL)
{
if (debugging) {
q = ISC_LIST_HEAD(lookup->q);
while (q != NULL) {
debug("query to %s still pending", q->servname);
q = ISC_LIST_NEXT(q, link);
}
q = ISC_LIST_HEAD(lookup->connecting);
while (q != NULL) {
debug("query to %s still connecting",
q->servname);
q = ISC_LIST_NEXT(q, clink);
}
}
return (ISC_FALSE);
}
@@ -1642,7 +1670,7 @@ start_lookup(void) {
= current_lookup->rdclassset;
current_lookup->rdclass = dns_rdataclass_in;
strncpy(current_lookup->textnamesigchase,
strlcpy(current_lookup->textnamesigchase,
current_lookup->textname, MXNAME);
current_lookup->trace_root_sigchase = ISC_TRUE;
@@ -1654,7 +1682,7 @@ start_lookup(void) {
check_result(result, "dns_name_totext");
isc_buffer_usedregion(b, &r);
r.base[r.length] = '\0';
strncpy(current_lookup->textname, (char*)r.base,
strlcpy(current_lookup->textname, (char*)r.base,
MXNAME);
isc_buffer_free(&b);
@@ -1870,6 +1898,9 @@ static isc_boolean_t
next_origin(dig_query_t *query) {
dig_lookup_t *lookup;
dig_searchlist_t *search;
dns_fixedname_t fixed;
dns_name_t *name;
isc_result_t result;
INSIST(!free_now);
@@ -1882,6 +1913,19 @@ next_origin(dig_query_t *query) {
* about finding the next entry.
*/
return (ISC_FALSE);
/*
* Check for a absolute name or ndots being met.
*/
dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
result = dns_name_fromstring2(name, query->lookup->textname, NULL,
0, NULL);
if (result == ISC_R_SUCCESS &&
(dns_name_isabsolute(name) ||
(int)dns_name_countlabels(name) > ndots))
return (ISC_FALSE);
if (query->lookup->origin == NULL && !query->lookup->need_search)
/*
* Then we just did rootorg; there's nothing left.
@@ -2290,7 +2334,7 @@ setup_lookup(dig_lookup_t *lookup) {
query->rr_count = 0;
query->msg_count = 0;
query->byte_count = 0;
ISC_LINK_INIT(query, link);
query->ixfr_axfr = ISC_FALSE;
ISC_LIST_INIT(query->recvlist);
ISC_LIST_INIT(query->lengthlist);
query->sock = NULL;
@@ -2303,6 +2347,7 @@ setup_lookup(dig_lookup_t *lookup) {
isc_buffer_init(&query->slbuf, query->slspace, 2);
query->sendbuf = lookup->renderbuf;
ISC_LINK_INIT(query, clink);
ISC_LINK_INIT(query, link);
ISC_LIST_ENQUEUE(lookup->q, query, link);
}
@@ -2338,8 +2383,10 @@ send_done(isc_task_t *_task, isc_event_t *event) {
for (b = ISC_LIST_HEAD(sevent->bufferlist);
b != NULL;
b = ISC_LIST_HEAD(sevent->bufferlist))
b = ISC_LIST_HEAD(sevent->bufferlist)) {
ISC_LIST_DEQUEUE(sevent->bufferlist, b, link);
isc_mem_free(mctx, b);
}
query = event->ev_arg;
query->waiting_senddone = ISC_FALSE;
@@ -2424,6 +2471,7 @@ static void
force_timeout(dig_lookup_t *l, dig_query_t *query) {
isc_event_t *event;
debug("force_timeout ()");
event = isc_event_allocate(mctx, query, ISC_TIMEREVENT_IDLE,
connect_timeout, l,
sizeof(isc_event_t));
@@ -2491,7 +2539,17 @@ send_tcp_connect(dig_query_t *query) {
send_tcp_connect(next);
return;
}
INSIST(query->sock == NULL);
if (keep != NULL && isc_sockaddr_equal(&keepaddr, &query->sockaddr)) {
sockcount++;
isc_socket_attach(keep, &query->sock);
query->waiting_connect = ISC_FALSE;
launch_next_query(query, ISC_TRUE);
goto search;
}
result = isc_socket_create(socketmgr,
isc_sockaddr_pf(&query->sockaddr),
isc_sockettype_tcp, &query->sock);
@@ -2514,6 +2572,7 @@ send_tcp_connect(dig_query_t *query) {
result = isc_socket_connect(query->sock, &query->sockaddr,
global_task, connect_done, query);
check_result(result, "isc_socket_connect");
search:
/*
* If we're at the endgame of a nameserver search, we need to
* immediately bring up all the queries. Do it here.
@@ -2521,11 +2580,25 @@ send_tcp_connect(dig_query_t *query) {
if (l->ns_search_only && !l->trace_root) {
debug("sending next, since searching");
next = ISC_LIST_NEXT(query, link);
if (ISC_LINK_LINKED(query, link))
ISC_LIST_DEQUEUE(l->q, query, link);
ISC_LIST_ENQUEUE(l->connecting, query, clink);
if (next != NULL)
send_tcp_connect(next);
}
}
static isc_buffer_t *
clone_buffer(isc_buffer_t *source) {
isc_buffer_t *buffer;
buffer = isc_mem_allocate(mctx, sizeof(*buffer));
if (buffer == NULL)
fatal("memory allocation failure in %s:%d",
__FILE__, __LINE__);
*buffer = *source;
return (buffer);
}
/*%
* Send a UDP packet to the remote nameserver, possible starting the
* recv action as well. Also make sure that the timer is running and
@@ -2535,6 +2608,7 @@ static void
send_udp(dig_query_t *query) {
dig_lookup_t *l = NULL;
isc_result_t result;
isc_buffer_t *sendbuf;
debug("send_udp(%p)", query);
@@ -2581,14 +2655,16 @@ send_udp(dig_query_t *query) {
debug("recvcount=%d", recvcount);
}
ISC_LIST_INIT(query->sendlist);
ISC_LIST_ENQUEUE(query->sendlist, &query->sendbuf, link);
sendbuf = clone_buffer(&query->sendbuf);
ISC_LIST_ENQUEUE(query->sendlist, sendbuf, link);
debug("sending a request");
TIME_NOW(&query->time_sent);
INSIST(query->sock != NULL);
query->waiting_senddone = ISC_TRUE;
result = isc_socket_sendtov(query->sock, &query->sendlist,
global_task, send_done, query,
&query->sockaddr, NULL);
result = isc_socket_sendtov2(query->sock, &query->sendlist,
global_task, send_done, query,
&query->sockaddr, NULL,
ISC_SOCKFLAG_NORETRY);
check_result(result, "isc_socket_sendtov");
sendcount++;
}
@@ -2601,7 +2677,7 @@ send_udp(dig_query_t *query) {
static void
connect_timeout(isc_task_t *task, isc_event_t *event) {
dig_lookup_t *l = NULL;
dig_query_t *query = NULL, *cq;
dig_query_t *query = NULL, *next, *cq;
UNUSED(task);
REQUIRE(event->ev_type == ISC_TIMEREVENT_IDLE);
@@ -2625,7 +2701,9 @@ connect_timeout(isc_task_t *task, isc_event_t *event) {
if (query->sock != NULL)
isc_socket_cancel(query->sock, NULL,
ISC_SOCKCANCEL_ALL);
send_tcp_connect(ISC_LIST_NEXT(cq, link));
next = ISC_LIST_NEXT(cq, link);
if (next != NULL)
send_tcp_connect(next);
}
UNLOCK_LOOKUP;
return;
@@ -2748,6 +2826,7 @@ static void
launch_next_query(dig_query_t *query, isc_boolean_t include_question) {
isc_result_t result;
dig_lookup_t *l;
isc_buffer_t *buffer;
INSIST(!free_now);
@@ -2771,9 +2850,15 @@ launch_next_query(dig_query_t *query, isc_boolean_t include_question) {
isc_buffer_putuint16(&query->slbuf, (isc_uint16_t) query->sendbuf.used);
ISC_LIST_INIT(query->sendlist);
ISC_LINK_INIT(&query->slbuf, link);
ISC_LIST_ENQUEUE(query->sendlist, &query->slbuf, link);
if (include_question)
ISC_LIST_ENQUEUE(query->sendlist, &query->sendbuf, link);
if (!query->first_soa_rcvd) {
buffer = clone_buffer(&query->slbuf);
ISC_LIST_ENQUEUE(query->sendlist, buffer, link);
if (include_question) {
buffer = clone_buffer(&query->sendbuf);
ISC_LIST_ENQUEUE(query->sendlist, buffer, link);
}
}
ISC_LINK_INIT(&query->lengthbuf, link);
ISC_LIST_ENQUEUE(query->lengthlist, &query->lengthbuf, link);
@@ -2868,12 +2953,17 @@ connect_done(isc_task_t *task, isc_event_t *event) {
if (next != NULL) {
bringup_timer(next, TCP_TIMEOUT);
send_tcp_connect(next);
} else {
} else
check_next_lookup(l);
}
UNLOCK_LOOKUP;
return;
}
if (keep_open) {
if (keep != NULL)
isc_socket_detach(&keep);
isc_socket_attach(query->sock, &keep);
keepaddr = query->sockaddr;
}
launch_next_query(query, ISC_TRUE);
isc_event_free(&event);
UNLOCK_LOOKUP;
@@ -2897,6 +2987,9 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
isc_boolean_t ixfr = query->lookup->rdtype == dns_rdatatype_ixfr;
isc_boolean_t axfr = query->lookup->rdtype == dns_rdatatype_axfr;
if (ixfr)
axfr = query->ixfr_axfr;
debug("check_for_more_data()");
/*
@@ -2945,7 +3038,7 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
query->second_rr_rcvd = ISC_TRUE;
query->second_rr_serial = 0;
debug("got the second rr as nonsoa");
axfr = ISC_TRUE;
axfr = query->ixfr_axfr = ISC_TRUE;
goto next_rdata;
}
@@ -3381,7 +3474,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
}
if (!l->doing_xfr || l->xfr_q == query) {
if (msg->rcode != dns_rcode_noerror &&
if (msg->rcode == dns_rcode_nxdomain &&
(l->origin != NULL || l->need_search)) {
if (!next_origin(query) || showsearch) {
printmessage(query, msg, ISC_TRUE);
@@ -3427,6 +3520,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
if (n == 0)
docancel = ISC_TRUE;
l->trace_root = ISC_FALSE;
usesearch = ISC_FALSE;
} else
#ifdef DIG_SIGCHASE
if (!do_sigchase)
@@ -3603,15 +3697,19 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp) {
*/
void
do_lookup(dig_lookup_t *lookup) {
dig_query_t *query;
REQUIRE(lookup != NULL);
debug("do_lookup()");
lookup->pending = ISC_TRUE;
if (lookup->tcp_mode)
send_tcp_connect(ISC_LIST_HEAD(lookup->q));
else
send_udp(ISC_LIST_HEAD(lookup->q));
query = ISC_LIST_HEAD(lookup->q);
if (query != NULL) {
if (lookup->tcp_mode)
send_tcp_connect(query);
else
send_udp(query);
}
}
/*%
@@ -3647,18 +3745,31 @@ cancel_all(void) {
if (current_lookup != NULL) {
if (current_lookup->timer != NULL)
isc_timer_detach(&current_lookup->timer);
q = ISC_LIST_HEAD(current_lookup->q);
while (q != NULL) {
debug("canceling query %p, belonging to %p",
q, current_lookup);
for (q = ISC_LIST_HEAD(current_lookup->q);
q != NULL;
q = nq)
{
nq = ISC_LIST_NEXT(q, link);
if (q->sock != NULL) {
debug("canceling pending query %p, belonging to %p",
q, current_lookup);
if (q->sock != NULL)
isc_socket_cancel(q->sock, NULL,
ISC_SOCKCANCEL_ALL);
} else {
else
clear_query(q);
}
for (q = ISC_LIST_HEAD(current_lookup->connecting);
q != NULL;
q = nq)
{
nq = ISC_LIST_NEXT(q, clink);
debug("canceling connecting query %p, belonging to %p",
q, current_lookup);
if (q->sock != NULL)
isc_socket_cancel(q->sock, NULL,
ISC_SOCKCANCEL_ALL);
else
clear_query(q);
}
q = nq;
}
}
l = ISC_LIST_HEAD(lookup_list);
@@ -3685,6 +3796,8 @@ destroy_libs(void) {
isc_result_t result;
#endif
if (keep != NULL)
isc_socket_detach(&keep);
debug("destroy_libs()");
if (global_task != NULL) {
debug("freeing task");
@@ -3836,7 +3949,7 @@ output_filter(isc_buffer_t *buffer, unsigned int used_org,
fromlen = isc_buffer_usedlength(buffer) - used_org;
if (fromlen >= MAXDLEN)
return (ISC_R_SUCCESS);
memcpy(tmp1, (char *)isc_buffer_base(buffer) + used_org, fromlen);
memmove(tmp1, (char *)isc_buffer_base(buffer) + used_org, fromlen);
end_with_dot = (tmp1[fromlen - 1] == '.') ? ISC_TRUE : ISC_FALSE;
if (absolute && !end_with_dot) {
fromlen++;
@@ -3865,8 +3978,8 @@ output_filter(isc_buffer_t *buffer, unsigned int used_org,
return (ISC_R_NOSPACE);
isc_buffer_subtract(buffer, isc_buffer_usedlength(buffer) - used_org);
memcpy(isc_buffer_used(buffer), tmp1, tolen);
isc_buffer_add(buffer, tolen);
memmove(isc_buffer_used(buffer), tmp1, tolen);
isc_buffer_add(buffer, (unsigned int)tolen);
return (ISC_R_SUCCESS);
}
@@ -3885,7 +3998,8 @@ append_textname(char *name, const char *origin, size_t namesize) {
if (namelen + 1 + originlen >= namesize)
return idn_buffer_overflow;
name[namelen++] = '.';
if (*origin != '.')
name[namelen++] = '.';
(void)strcpy(name + namelen, origin);
return idn_success;
}
@@ -4083,7 +4197,7 @@ sigchase_scanname(dns_rdatatype_t type, dns_rdatatype_t covers,
check_result(result, "dns_name_totext");
isc_buffer_usedregion(b, &r);
r.base[r.length] = '\0';
strcpy(lookup->textname, (char*)r.base);
strlcpy(lookup->textname, (char*)r.base, sizeof(lookup->textname));
isc_buffer_free(&b);
if (type == dns_rdatatype_rrsig)
@@ -4108,17 +4222,35 @@ sigchase_scanname(dns_rdatatype_t type, dns_rdatatype_t covers,
return (NULL);
}
void
insert_trustedkey(dst_key_t **keyp)
isc_result_t
insert_trustedkey(void *arg, dns_name_t *name, dns_rdataset_t *rdataset)
{
if (*keyp == NULL)
return;
if (tk_list.nb_tk >= MAX_TRUSTED_KEY)
return;
isc_result_t result;
dst_key_t *key;
tk_list.key[tk_list.nb_tk++] = *keyp;
*keyp = NULL;
return;
UNUSED(arg);
if (rdataset == NULL || rdataset->type != dns_rdatatype_dnskey)
return (ISC_R_SUCCESS);
for (result = dns_rdataset_first(rdataset);
result == ISC_R_SUCCESS;
result = dns_rdataset_next(rdataset)) {
dns_rdata_t rdata = DNS_RDATA_INIT;
isc_buffer_t b;
dns_rdataset_current(rdataset, &rdata);
isc_buffer_init(&b, rdata.data, rdata.length);
isc_buffer_add(&b, rdata.length);
if (tk_list.nb_tk >= MAX_TRUSTED_KEY)
return (ISC_R_SUCCESS);
key = NULL;
result = dst_key_fromdns(name, rdata.rdclass, &b, mctx, &key);
if (result != ISC_R_SUCCESS)
continue;
tk_list.key[tk_list.nb_tk++] = key;
}
return (ISC_R_SUCCESS);
}
void
@@ -4164,87 +4296,12 @@ removetmpkey(isc_mem_t *mctx, const char *file)
return (result);
}
isc_result_t
opentmpkey(isc_mem_t *mctx, const char *file, char **tempp, FILE **fp) {
FILE *f = NULL;
isc_result_t result;
char *tempname = NULL;
char *tempnamekey = NULL;
int tempnamelen;
int tempnamekeylen;
char *x;
char *cp;
isc_uint32_t which;
while (1) {
tempnamelen = strlen(file) + 20;
tempname = isc_mem_allocate(mctx, tempnamelen);
if (tempname == NULL)
return (ISC_R_NOMEMORY);
memset(tempname, 0, tempnamelen);
result = isc_file_mktemplate(file, tempname, tempnamelen);
if (result != ISC_R_SUCCESS)
goto cleanup;
cp = tempname;
while (*cp != '\0')
cp++;
if (cp == tempname) {
isc_mem_free(mctx, tempname);
return (ISC_R_FAILURE);
}
x = cp--;
while (cp >= tempname && *cp == 'X') {
isc_random_get(&which);
*cp = alphnum[which % (sizeof(alphnum) - 1)];
x = cp--;
}
tempnamekeylen = tempnamelen+5;
tempnamekey = isc_mem_allocate(mctx, tempnamekeylen);
if (tempnamekey == NULL)
return (ISC_R_NOMEMORY);
memset(tempnamekey, 0, tempnamekeylen);
strncpy(tempnamekey, tempname, tempnamelen);
strcat(tempnamekey ,".key");
if (isc_file_exists(tempnamekey)) {
isc_mem_free(mctx, tempnamekey);
isc_mem_free(mctx, tempname);
continue;
}
if ((f = fopen(tempnamekey, "w")) == NULL) {
printf("get_trusted_key(): trusted key not found %s\n",
tempnamekey);
return (ISC_R_FAILURE);
}
break;
}
isc_mem_free(mctx, tempnamekey);
*tempp = tempname;
*fp = f;
return (ISC_R_SUCCESS);
cleanup:
isc_mem_free(mctx, tempname);
return (result);
}
isc_result_t
get_trusted_key(isc_mem_t *mctx)
{
isc_result_t result;
const char *filename = NULL;
char *filetemp = NULL;
char buf[1500];
FILE *fp, *fptemp;
dst_key_t *key = NULL;
dns_rdatacallbacks_t callbacks;
result = isc_file_exists(trustedkey);
if (result != ISC_TRUE) {
@@ -4265,40 +4322,11 @@ get_trusted_key(isc_mem_t *mctx)
return (ISC_R_FAILURE);
}
if ((fp = fopen(filename, "r")) == NULL) {
printf("get_trusted_key(): trusted key not found %s\n",
filename);
return (ISC_R_FAILURE);
}
while (fgets(buf, sizeof(buf), fp) != NULL) {
result = opentmpkey(mctx,"tmp_file", &filetemp, &fptemp);
if (result != ISC_R_SUCCESS) {
fclose(fp);
return (ISC_R_FAILURE);
}
if (fputs(buf, fptemp) < 0) {
fclose(fp);
fclose(fptemp);
return (ISC_R_FAILURE);
}
fclose(fptemp);
result = dst_key_fromnamedfile(filetemp, NULL, DST_TYPE_PUBLIC,
mctx, &key);
removetmpkey(mctx, filetemp);
isc_mem_free(mctx, filetemp);
if (result != ISC_R_SUCCESS) {
fclose(fp);
return (ISC_R_FAILURE);
}
#if 0
dst_key_tofile(key, DST_TYPE_PUBLIC,"/tmp");
#endif
insert_trustedkey(&key);
if (key != NULL)
dst_key_free(&key);
}
fclose(fp);
return (ISC_R_SUCCESS);
dns_rdatacallbacks_init_stdio(&callbacks);
callbacks.add = insert_trustedkey;
return (dns_master_loadfile(filename, dns_rootname, dns_rootname,
current_lookup->rdclass, 0, &callbacks,
mctx));
}
@@ -4312,7 +4340,7 @@ nameFromString(const char *str, dns_name_t *p_ret) {
REQUIRE(p_ret != NULL);
REQUIRE(str != NULL);
isc_buffer_init(&buffer, str, len);
isc_buffer_constinit(&buffer, str, len);
isc_buffer_add(&buffer, len);
dns_fixedname_init(&fixedname);
@@ -4342,7 +4370,7 @@ prepare_lookup(dns_name_t *name)
lookup->new_search = ISC_TRUE;
lookup->trace_root_sigchase = ISC_FALSE;
strncpy(lookup->textname, lookup->textnamesigchase, MXNAME);
strlcpy(lookup->textname, lookup->textnamesigchase, MXNAME);
lookup->rdtype = lookup->rdtype_sigchase;
lookup->rdtypeset = ISC_TRUE;
@@ -4401,7 +4429,7 @@ prepare_lookup(dns_name_t *name)
dns_rdata_totext(&aaaa, &ns.name, b);
isc_buffer_usedregion(b, &r);
r.base[r.length] = '\0';
strncpy(namestr, (char*)r.base,
strlcpy(namestr, (char*)r.base,
DNS_NAME_FORMATSIZE);
isc_buffer_free(&b);
dns_rdata_reset(&aaaa);
@@ -4430,7 +4458,7 @@ prepare_lookup(dns_name_t *name)
dns_rdata_totext(&a, &ns.name, b);
isc_buffer_usedregion(b, &r);
r.base[r.length] = '\0';
strncpy(namestr, (char*)r.base,
strlcpy(namestr, (char*)r.base,
DNS_NAME_FORMATSIZE);
isc_buffer_free(&b);
dns_rdata_reset(&a);
@@ -4609,7 +4637,6 @@ contains_trusted_key(dns_name_t *name, dns_rdataset_t *rdataset,
{
isc_result_t result;
dns_rdata_t rdata = DNS_RDATA_INIT;
dst_key_t *trustedKey = NULL;
dst_key_t *dnsseckey = NULL;
int i;
@@ -4653,10 +4680,6 @@ contains_trusted_key(dns_name_t *name, dns_rdataset_t *rdataset,
dst_key_free(&dnsseckey);
} while (dns_rdataset_next(rdataset) == ISC_R_SUCCESS);
if (trustedKey != NULL)
dst_key_free(&trustedKey);
trustedKey = NULL;
return (ISC_R_NOTFOUND);
}
+15 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004-2007, 2009-2011 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2004-2007, 2009-2013 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -446,10 +446,18 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
if (msg->rcode != 0) {
char namestr[DNS_NAME_FORMATSIZE];
dns_name_format(query->lookup->name, namestr, sizeof(namestr));
printf("Host %s not found: %d(%s)\n",
(msg->rcode != dns_rcode_nxdomain) ? namestr :
query->lookup->textname, msg->rcode,
rcode_totext(msg->rcode));
if (query->lookup->identify_previous_line)
printf("Nameserver %s:\n\t%s not found: %d(%s)\n",
query->servname,
(msg->rcode != dns_rcode_nxdomain) ? namestr :
query->lookup->textname, msg->rcode,
rcode_totext(msg->rcode));
else
printf("Host %s not found: %d(%s)\n",
(msg->rcode != dns_rcode_nxdomain) ? namestr :
query->lookup->textname, msg->rcode,
rcode_totext(msg->rcode));
return (ISC_R_SUCCESS);
}
@@ -630,6 +638,8 @@ pre_parse_args(int argc, char **argv) {
case 'w': break;
case 'C': break;
case 'D':
if (debugging)
debugtiming = ISC_TRUE;
debugging = ISC_TRUE;
break;
case 'N': break;
+6 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004-2009, 2011 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2004-2009, 2011-2014 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -168,6 +168,7 @@ isc_boolean_t sigchase;
dns_name_t *oname;
ISC_LINK(dig_lookup_t) link;
ISC_LIST(dig_query_t) q;
ISC_LIST(dig_query_t) connecting;
dig_query_t *current_query;
dig_serverlist_t my_server_list;
dig_searchlist_t *origin;
@@ -201,6 +202,7 @@ struct dig_query {
isc_uint32_t second_rr_serial;
isc_uint32_t msg_count;
isc_uint32_t rr_count;
isc_boolean_t ixfr_axfr;
char *servname;
char *userarg;
isc_bufferlist_t sendlist,
@@ -214,6 +216,7 @@ struct dig_query {
slspace[4];
isc_socket_t *sock;
ISC_LINK(dig_query_t) link;
ISC_LINK(dig_query_t) clink;
isc_sockaddr_t sockaddr;
isc_time_t time_sent;
isc_uint64_t byte_count;
@@ -273,7 +276,8 @@ extern isc_boolean_t validated;
extern isc_taskmgr_t *taskmgr;
extern isc_task_t *global_task;
extern isc_boolean_t free_now;
extern isc_boolean_t debugging, memdebugging;
extern isc_boolean_t debugging, debugtiming, memdebugging;
extern isc_boolean_t keep_open;
extern char *progname;
extern int tries;
+7 -2
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2004-2007, 2010 Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (C) 2004-2007, 2010, 2013, 2014 Internet Systems Consortium, Inc. ("ISC")
.\"
.\" Permission to use, copy, modify, and/or distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
@@ -216,6 +216,11 @@ Tell the name server to query other servers if it does not have the information.
(Default = recurse; abbreviation = [no]rec)
.RE
.PP
\fBndots=\fR\fInumber\fR
.RS 4
Set the number of dots (label separators) in a domain that will disable searching. Absolute names always stop searching.
.RE
.PP
\fBretry=\fR\fInumber\fR
.RS 4
Set the number of retries to number.
@@ -254,5 +259,5 @@ Try the next nameserver if a nameserver responds with SERVFAIL or a referral (no
.PP
Andrew Cherenson
.SH "COPYRIGHT"
Copyright \(co 2004\-2007, 2010 Internet Systems Consortium, Inc. ("ISC")
Copyright \(co 2004\-2007, 2010, 2013, 2014 Internet Systems Consortium, Inc. ("ISC")
.br
+14 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -434,8 +434,7 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
dns_name_format(query->lookup->name,
nametext, sizeof(nametext));
printf("** server can't find %s: %s\n",
(msg->rcode != dns_rcode_nxdomain) ? nametext :
query->lookup->textname, rcode_totext(msg->rcode));
nametext, rcode_totext(msg->rcode));
debug("returning with rcode == 0");
/* the lookup failed */
@@ -494,8 +493,8 @@ show_settings(isc_boolean_t full, isc_boolean_t serv_only) {
printf(" %s\t\t%s\n",
usesearch ? "search" : "nosearch",
recurse ? "recurse" : "norecurse");
printf(" timeout = %d\t\tretry = %d\tport = %d\n",
timeout, tries, port);
printf(" timeout = %d\t\tretry = %d\tport = %d\tndots = %d\n",
timeout, tries, port, ndots);
printf(" querytype = %-8s\tclass = %s\n", deftype, defclass);
printf(" srchlist = ");
for (listent = ISC_LIST_HEAD(search_list);
@@ -566,6 +565,14 @@ set_tries(const char *value) {
tries = n;
}
static void
set_ndots(const char *value) {
isc_uint32_t n;
isc_result_t result = parse_uint(&n, value, 128, "ndots");
if (result == ISC_R_SUCCESS)
ndots = n;
}
static void
setoption(char *opt) {
if (strncasecmp(opt, "all", 4) == 0) {
@@ -646,6 +653,8 @@ setoption(char *opt) {
nofail=ISC_FALSE;
} else if (strncasecmp(opt, "nofail", 3) == 0) {
nofail=ISC_TRUE;
} else if (strncasecmp(opt, "ndots=", 6) == 0) {
set_ndots(&opt[6]);
} else {
printf("*** Invalid option: %s\n", opt);
}
+15 -6
View File
@@ -2,7 +2,7 @@
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
[<!ENTITY mdash "&#8212;">]>
<!--
- Copyright (C) 2004-2007, 2010 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2004-2007, 2010, 2013, 2014 Internet Systems Consortium, Inc. ("ISC")
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
@@ -30,11 +30,7 @@
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. All advertising materials mentioning features or use of this software
- must display the following acknowledgement:
- This product includes software developed by the University of
- California, Berkeley and its contributors.
- 4. Neither the name of the University nor the names of its contributors
- 3. Neither the name of the University nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
@@ -74,6 +70,8 @@
<year>2006</year>
<year>2007</year>
<year>2010</year>
<year>2013</year>
<year>2014</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
</docinfo>
@@ -409,6 +407,17 @@ nslookup -query=hinfo -timeout=10
</listitem>
</varlistentry>
<varlistentry>
<term><constant>ndots=</constant><replaceable>number</replaceable></term>
<listitem>
<para>
Set the number of dots (label separators) in a domain
that will disable searching. Absolute names always
stop searching.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>retry=</constant><replaceable>number</replaceable></term>
<listitem>
+13 -7
View File
@@ -1,5 +1,5 @@
<!--
- Copyright (C) 2004-2007, 2010 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2004-2007, 2010, 2013, 2014 Internet Systems Consortium, Inc. ("ISC")
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
@@ -31,7 +31,7 @@
<div class="cmdsynopsis"><p><code class="command">nslookup</code> [<code class="option">-option</code>] [name | -] [server]</p></div>
</div>
<div class="refsect1" lang="en">
<a name="id2543361"></a><h2>DESCRIPTION</h2>
<a name="id2543435"></a><h2>DESCRIPTION</h2>
<p><span><strong class="command">Nslookup</strong></span>
is a program to query Internet domain name servers. <span><strong class="command">Nslookup</strong></span>
has two modes: interactive and non-interactive. Interactive mode allows
@@ -43,7 +43,7 @@
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2543377"></a><h2>ARGUMENTS</h2>
<a name="id2543451"></a><h2>ARGUMENTS</h2>
<p>
Interactive mode is entered in the following cases:
</p>
@@ -78,7 +78,7 @@ nslookup -query=hinfo -timeout=10
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2543420"></a><h2>INTERACTIVE COMMANDS</h2>
<a name="id2543495"></a><h2>INTERACTIVE COMMANDS</h2>
<div class="variablelist"><dl>
<dt><span class="term"><code class="constant">host</code> [<span class="optional">server</span>]</span></dt>
<dd>
@@ -249,6 +249,12 @@ nslookup -query=hinfo -timeout=10
(Default = recurse; abbreviation = [no]rec)
</p>
</dd>
<dt><span class="term"><code class="constant">ndots=</code><em class="replaceable"><code>number</code></em></span></dt>
<dd><p>
Set the number of dots (label separators) in a domain
that will disable searching. Absolute names always
stop searching.
</p></dd>
<dt><span class="term"><code class="constant">retry=</code><em class="replaceable"><code>number</code></em></span></dt>
<dd><p>
Set the number of retries to number.
@@ -288,19 +294,19 @@ nslookup -query=hinfo -timeout=10
</dl></div>
</div>
<div class="refsect1" lang="en">
<a name="id2546286"></a><h2>FILES</h2>
<a name="id2546309"></a><h2>FILES</h2>
<p><code class="filename">/etc/resolv.conf</code>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2546298"></a><h2>SEE ALSO</h2>
<a name="id2546321"></a><h2>SEE ALSO</h2>
<p><span class="citerefentry"><span class="refentrytitle">dig</span>(1)</span>,
<span class="citerefentry"><span class="refentrytitle">host</span>(1)</span>,
<span class="citerefentry"><span class="refentrytitle">named</span>(8)</span>.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2546332"></a><h2>Author</h2>
<a name="id2546355"></a><h2>Author</h2>
<p>
Andrew Cherenson
</p>
@@ -356,6 +356,8 @@ main(int argc, char **argv) {
fprintf(stderr, "The use of RSA (RSAMD5) is not recommended.\n"
"If you still wish to use RSA (RSAMD5) please "
"specify \"-a RSAMD5\"\n");
if (freeit != NULL)
free(freeit);
return (1);
} else {
r.base = algname;
+12 -4
View File
@@ -1,5 +1,5 @@
/*
* Portions Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC")
* Portions Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC")
* Portions Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -526,6 +526,7 @@ main(int argc, char **argv) {
"recommended.\nIf you still wish to "
"use RSA (RSAMD5) please specify "
"\"-a RSAMD5\"\n");
INSIST(freeit == NULL);
return (1);
} else if (strcasecmp(algname, "HMAC-MD5") == 0)
alg = DST_ALG_HMACMD5;
@@ -645,9 +646,9 @@ main(int argc, char **argv) {
mctx, &prevkey);
if (ret != ISC_R_SUCCESS)
fatal("Invalid keyfile %s: %s",
filename, isc_result_totext(ret));
predecessor, isc_result_totext(ret));
if (!dst_key_isprivate(prevkey))
fatal("%s is not a private key", filename);
fatal("%s is not a private key", predecessor);
name = dst_key_name(prevkey);
alg = dst_key_alg(prevkey);
@@ -960,8 +961,15 @@ main(int argc, char **argv) {
dst_key_settime(key, DST_TIME_INACTIVE,
inactive);
if (setdel)
if (setdel) {
if (setinact && delete < inactive)
fprintf(stderr, "%s: warning: Key is "
"scheduled to be deleted "
"before it is scheduled to be "
"made inactive.\n",
program);
dst_key_settime(key, DST_TIME_DELETE, delete);
}
} else {
if (setpub || setact || setrev || setinact ||
setdel || unsetpub || unsetact ||
+1 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2011 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2009-2012 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -20,7 +20,6 @@
#include <config.h>
#include <libgen.h>
#include <stdlib.h>
#include <unistd.h>
+27 -8
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2012 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2009-2013 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -20,7 +20,6 @@
#include <config.h>
#include <libgen.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
@@ -140,6 +139,7 @@ main(int argc, char **argv) {
int prepub = -1;
isc_stdtime_t now;
isc_stdtime_t pub = 0, act = 0, rev = 0, inact = 0, del = 0;
isc_stdtime_t prevact = 0, previnact = 0, prevdel = 0;
isc_boolean_t setpub = ISC_FALSE, setact = ISC_FALSE;
isc_boolean_t setrev = ISC_FALSE, setinact = ISC_FALSE;
isc_boolean_t setdel = ISC_FALSE;
@@ -344,7 +344,6 @@ main(int argc, char **argv) {
if (predecessor != NULL) {
char keystr[DST_KEY_FORMATSIZE];
isc_stdtime_t when;
int major, minor;
if (prepub == -1)
@@ -376,19 +375,20 @@ main(int argc, char **argv) {
fatal("Predecessor has incompatible format "
"version %d.%d\n\t", major, minor);
result = dst_key_gettime(prevkey, DST_TIME_ACTIVATE, &when);
result = dst_key_gettime(prevkey, DST_TIME_ACTIVATE, &prevact);
if (result != ISC_R_SUCCESS)
fatal("Predecessor has no activation date. "
"You must set one before\n\t"
"generating a successor.");
result = dst_key_gettime(prevkey, DST_TIME_INACTIVE, &act);
result = dst_key_gettime(prevkey, DST_TIME_INACTIVE,
&previnact);
if (result != ISC_R_SUCCESS)
fatal("Predecessor has no inactivation date. "
"You must set one before\n\t"
"generating a successor.");
pub = act - prepub;
pub = prevact - prepub;
if (pub < now && prepub != 0)
fatal("Predecessor will become inactive before the\n\t"
"prepublication period ends. Either change "
@@ -396,13 +396,18 @@ main(int argc, char **argv) {
"or use the -i option to set a shorter "
"prepublication interval.");
result = dst_key_gettime(prevkey, DST_TIME_DELETE, &when);
result = dst_key_gettime(prevkey, DST_TIME_DELETE, &prevdel);
if (result != ISC_R_SUCCESS)
fprintf(stderr, "%s: WARNING: Predecessor has no "
fprintf(stderr, "%s: warning: Predecessor has no "
"removal date;\n\t"
"it will remain in the zone "
"indefinitely after rollover.\n",
program);
else if (prevdel < previnact)
fprintf(stderr, "%s: warning: Predecessor is "
"scheduled to be deleted\n\t"
"before it is scheduled to be "
"inactive.\n", program);
changed = setpub = setact = ISC_TRUE;
dst_key_free(&prevkey);
@@ -464,6 +469,20 @@ main(int argc, char **argv) {
fatal("Key flags mismatch");
}
prevdel = previnact = 0;
if ((setdel && setinact && del < inact) ||
(dst_key_gettime(key, DST_TIME_INACTIVE,
&previnact) == ISC_R_SUCCESS &&
setdel && !setinact && del < previnact) ||
(dst_key_gettime(key, DST_TIME_DELETE,
&prevdel) == ISC_R_SUCCESS &&
setinact && !setdel && prevdel < inact) ||
(!setdel && !setinact && prevdel < previnact))
fprintf(stderr, "%s: warning: Key is scheduled to "
"be deleted before it is\n\t"
"scheduled to be inactive.\n",
program);
if (force)
set_keyversion(key);
else
+3 -3
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (C) 2004-2009, 2013 Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (C) 2000-2003 Internet Software Consortium.
.\"
.\" Permission to use, copy, modify, and/or distribute this software for any
@@ -309,7 +309,7 @@ Generate an NSEC3 chain with the given hex encoded salt. A dash (\fIsalt\fR) can
.PP
\-H \fIiterations\fR
.RS 4
When generating an NSEC3 chain, use this many interations. The default is 10.
When generating an NSEC3 chain, use this many iterations. The default is 10.
.RE
.PP
\-A
@@ -378,7 +378,7 @@ RFC 4033.
.PP
Internet Systems Consortium
.SH "COPYRIGHT"
Copyright \(co 2004\-2009 Internet Systems Consortium, Inc. ("ISC")
Copyright \(co 2004\-2009, 2013 Internet Systems Consortium, Inc. ("ISC")
.br
Copyright \(co 2000\-2003 Internet Software Consortium.
.br
+66 -17
View File
@@ -1,5 +1,5 @@
/*
* Portions Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC")
* Portions Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC")
* Portions Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -646,9 +646,11 @@ hashlist_add(hashlist_t *l, const unsigned char *hash, size_t len)
if (l->entries == l->size) {
l->size = l->size * 2 + 100;
l->hashbuf = realloc(l->hashbuf, l->size * l->length);
if (l->hashbuf == NULL)
fatal("unable to grow hashlist: out of memory");
}
memset(l->hashbuf + l->entries * l->length, 0, l->length);
memcpy(l->hashbuf + l->entries * l->length, hash, len);
memmove(l->hashbuf + l->entries * l->length, hash, len);
l->entries++;
}
@@ -663,7 +665,8 @@ hashlist_add_dns_name(hashlist_t *l, /*const*/ dns_name_t *name,
unsigned int len;
size_t i;
len = isc_iterated_hash(hash, hashalg, iterations, salt, salt_length,
len = isc_iterated_hash(hash, hashalg, iterations,
salt, (int)salt_length,
name->ndata, name->length);
if (verbose) {
dns_name_format(name, nametext, sizeof nametext);
@@ -715,7 +718,7 @@ static const unsigned char *
hashlist_findnext(const hashlist_t *l,
const unsigned char hash[NSEC3_MAX_HASH_LENGTH])
{
unsigned int entries = l->entries;
size_t entries = l->entries;
const unsigned char *next = bsearch(hash, l->hashbuf, l->entries,
l->length, hashlist_comp);
INSIST(next != NULL);
@@ -727,8 +730,8 @@ hashlist_findnext(const hashlist_t *l,
next = l->hashbuf;
if (next[l->length - 1] == 0)
break;
} while (entries-- > 1);
INSIST(entries != 0);
} while (entries-- > 1U);
INSIST(entries != 0U);
return (next);
}
@@ -1612,7 +1615,8 @@ verifyzone(void) {
fprintf(stderr, "No self signing KSK found. Using "
"self signed ZSK's for active "
"algorithm list.\n");
memcpy(ksk_algorithms, self_algorithms, sizeof(ksk_algorithms));
memmove(ksk_algorithms, self_algorithms,
sizeof(ksk_algorithms));
if (!allzsksigned)
fprintf(stderr, "warning: not all ZSK's are self "
"signed.\n");
@@ -2027,7 +2031,9 @@ add_ds(dns_name_t *name, dns_dbnode_t *node, isc_uint32_t nsttl) {
* Remove records of the given type and their signatures.
*/
static void
remove_records(dns_dbnode_t *node, dns_rdatatype_t which) {
remove_records(dns_dbnode_t *node, dns_rdatatype_t which,
isc_boolean_t checknsec)
{
isc_result_t result;
dns_rdatatype_t type, covers;
dns_rdatasetiter_t *rdsiter = NULL;
@@ -2048,10 +2054,12 @@ remove_records(dns_dbnode_t *node, dns_rdatatype_t which) {
covers = rdataset.covers;
dns_rdataset_disassociate(&rdataset);
if (type == which || covers == which) {
if (which == dns_rdatatype_nsec && !update_chain)
if (which == dns_rdatatype_nsec &&
checknsec && !update_chain)
fatal("Zone contains NSEC records. Use -u "
"to update to NSEC3.");
if (which == dns_rdatatype_nsec3param && !update_chain)
if (which == dns_rdatatype_nsec3param &&
checknsec && !update_chain)
fatal("Zone contains NSEC3 chains. Use -u "
"to update to NSEC.");
result = dns_db_deleterdataset(gdb, node, gversion,
@@ -2063,6 +2071,39 @@ remove_records(dns_dbnode_t *node, dns_rdatatype_t which) {
dns_rdatasetiter_destroy(&rdsiter);
}
/*
* Remove signatures covering the given type (0 == all signatures).
*/
static void
remove_sigs(dns_dbnode_t *node, dns_rdatatype_t which) {
isc_result_t result;
dns_rdatatype_t type, covers;
dns_rdatasetiter_t *rdsiter = NULL;
dns_rdataset_t rdataset;
dns_rdataset_init(&rdataset);
result = dns_db_allrdatasets(gdb, node, gversion, 0, &rdsiter);
check_result(result, "dns_db_allrdatasets()");
for (result = dns_rdatasetiter_first(rdsiter);
result == ISC_R_SUCCESS;
result = dns_rdatasetiter_next(rdsiter)) {
dns_rdatasetiter_current(rdsiter, &rdataset);
type = rdataset.type;
covers = rdataset.covers;
dns_rdataset_disassociate(&rdataset);
if (type == dns_rdatatype_rrsig &&
(covers == which || which == 0))
{
result = dns_db_deleterdataset(gdb, node, gversion,
type, covers);
check_result(result, "dns_db_deleterdataset()");
continue;
}
}
dns_rdatasetiter_destroy(&rdsiter);
}
/*%
* Generate NSEC records for the zone and remove NSEC3/NSEC3PARAM records.
*/
@@ -2139,14 +2180,17 @@ nsecify(void) {
}
if (dns_name_equal(name, gorigin))
remove_records(node, dns_rdatatype_nsec3param);
remove_records(node, dns_rdatatype_nsec3param,
ISC_TRUE);
if (delegation(name, node, &nsttl)) {
zonecut = dns_fixedname_name(&fzonecut);
dns_name_copy(name, zonecut, NULL);
remove_sigs(node, 0);
if (generateds)
add_ds(name, node, nsttl);
}
result = dns_dbiterator_next(dbiter);
nextnode = NULL;
while (result == ISC_R_SUCCESS) {
@@ -2164,6 +2208,9 @@ nsecify(void) {
(zonecut != NULL &&
dns_name_issubdomain(nextname, zonecut)))
{
remove_sigs(nextnode, 0);
remove_records(nextnode, dns_rdatatype_nsec,
ISC_FALSE);
dns_db_detachnode(gdb, &nextnode);
result = dns_dbiterator_next(dbiter);
continue;
@@ -2189,7 +2236,7 @@ nsecify(void) {
static void
addnsec3param(const unsigned char *salt, size_t salt_length,
unsigned int iterations)
dns_iterations_t iterations)
{
dns_dbnode_t *node = NULL;
dns_rdata_nsec3param_t nsec3param;
@@ -2209,7 +2256,7 @@ addnsec3param(const unsigned char *salt, size_t salt_length,
nsec3param.flags = 0;
nsec3param.hash = unknownalg ? DNS_NSEC3_UNKNOWNALG : dns_hash_sha1;
nsec3param.iterations = iterations;
nsec3param.salt_length = salt_length;
nsec3param.salt_length = (unsigned char)salt_length;
DE_CONST(salt, nsec3param.salt);
isc_buffer_init(&b, nsec3parambuf, sizeof(nsec3parambuf));
@@ -2506,7 +2553,7 @@ remove_duplicates(void) {
* Generate NSEC3 records for the zone.
*/
static void
nsec3ify(unsigned int hashalg, unsigned int iterations,
nsec3ify(unsigned int hashalg, dns_iterations_t iterations,
const unsigned char *salt, size_t salt_length, hashlist_t *hashlist)
{
dns_dbiterator_t *dbiter = NULL;
@@ -2555,7 +2602,7 @@ nsec3ify(unsigned int hashalg, unsigned int iterations,
}
if (dns_name_equal(name, gorigin))
remove_records(node, dns_rdatatype_nsec);
remove_records(node, dns_rdatatype_nsec, ISC_TRUE);
result = dns_dbiterator_next(dbiter);
nextnode = NULL;
@@ -2572,6 +2619,7 @@ nsec3ify(unsigned int hashalg, unsigned int iterations,
if (!dns_name_issubdomain(nextname, gorigin) ||
(zonecut != NULL &&
dns_name_issubdomain(nextname, zonecut))) {
remove_sigs(nextnode, 0);
dns_db_detachnode(gdb, &nextnode);
result = dns_dbiterator_next(dbiter);
continue;
@@ -2579,6 +2627,7 @@ nsec3ify(unsigned int hashalg, unsigned int iterations,
if (delegation(nextname, nextnode, &nsttl)) {
zonecut = dns_fixedname_name(&fzonecut);
dns_name_copy(nextname, zonecut, NULL);
remove_sigs(nextnode, 0);
if (generateds)
add_ds(nextname, nextnode, nsttl);
if (OPTOUT(nsec3flags) &&
@@ -3011,7 +3060,7 @@ set_nsec3params(isc_boolean_t update_chain, isc_boolean_t set_salt,
dns_rdata_nsec3_t nsec3;
dns_fixedname_t fname;
dns_name_t *hashname;
unsigned char orig_salt[256];
unsigned char orig_salt[255];
size_t orig_saltlen;
dns_hash_t orig_hash;
isc_uint16_t orig_iter;
@@ -3035,7 +3084,7 @@ set_nsec3params(isc_boolean_t update_chain, isc_boolean_t set_salt,
"Use -u to update it.");
} else if (!set_salt) {
salt_length = orig_saltlen;
memcpy(saltbuf, orig_salt, orig_saltlen);
memmove(saltbuf, orig_salt, orig_saltlen);
salt = saltbuf;
}
Loaded 100 of 4422 files, more files were not shown because too many files have changed in this diff. Show more