Disable destination address selection support of
getipnodebyname(1).  RFC 2553 mentions IPv6 addresses
are returned 1st.

Spotted by:	uqs
MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@245225 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix a bug in the device pager code that can trigger an assertion
in devfs if a particular race condition is hit in the device pager
code.

This was a side effect of change 227530 which changed the device
pager interface to call a new destructor routine for the cdev.
That destructor routine, old_dev_pager_dtor(), takes a VM object
handle.

The object handle is cast to a struct cdev *, and passed into
dev_rel().

That works in most cases, except the case in cdev_pager_allocate()
where there is a race condition between two threads allocating an
object backed by the same device.  The loser of the race
deallocates its object at the end of the function.

The problem is that before inserting the object into the
dev_pager_object_list, the object's handle is changed from the
struct cdev pointer to the object's own address.  This is to avoid
conflicts with the winner of the race, which already inserted an
object in the list with a handle that is a pointer to the same cdev
structure.

The object is then passed to vm_object_deallocate(), and eventually
makes its way down to old_dev_pager_dtor().  That function passes
the handle pointer (which is actually a VM object, not a struct
cdev as usual) into dev_rel().  dev_rel() decrements the reference
count in the assumed struct cdev (which happens to be 0), and
that triggers the assertion in dev_rel() that the reference count
is greater than or equal to 0.

The fix is to add a cdev pointer to the VM object, and use that
pointer when calling the cdev_pg_dtor() routine.

vm_object.h:	Add a struct cdev pointer to the VM object
		structure.

device_pager.c:	In cdev_pager_allocate(), populate the new cdev
		pointer.

		In dev_pager_dealloc(), use the new cdev pointer
		when calling the object's cdev_pg_dtor() routine.

Reviewed by:	kib
Sponsored by:	Spectra Logic Corporation
MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@245226 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Make CTL work a little better with loading and unloading drivers.

Previously CTL would leave individual LUNs enabled in the target
driver, whether or not the port as a whole was enabled.  It would
also leave the wildcard LUN enabled indefinitely.

This change means that CTL will enable and disable any active LUNs,
as well as the wildcard LUN, when enabling and disabling a port.

Also, fix a bug that could crop up due to an uninitialized CCB
type.

ctl.c:		Before calling ctl_frontend_online(), run through
		the LUN list and enable all active LUNs.

		After calling ctl_frontend_offline(), run through
		the LUN list and disble all active LUNs.

scsi_ctl.c:	Before bringing a port online, allocate the
		wildcard peripheral for that bus.  And after taking
		a port offline, invalidate the wildcard peripheral
		for that bus.

		Make sure that we hold the SIM lock around all
		calls to xpt_action() and other transport layer
		interfaces that require it.

		Use CAM_SIM_{LOCK|UNLOCK} consistently to acquire
		and release the SIM lock.

		Update a number of outdated comments.  Some of
		these should have been fixed long ago.

		Actually do LUN disbables now.  The newer drivers
		in the tree work correctly for this as far as I
		know.

		Initialize the CCB type to CTLFE_CCB_DEFAULT to
		avoid a panic due to uninitialized memory.

Submitted by:	Chuck Tuffli (partially)
MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@245228 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add no_prefer_iface option.
It stops treating the address on the interface as special by source
address selection rule even when the interface is outgoing interface.
This is desired in some situation.

Requested by:	hrs
Reviewed by:	IHANet folks including hrs
MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@245230 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add the "enable at reset" functionality to trigger spectral scan upon
a channel change/reset.


git-svn-id: svn://svn.freebsd.org/base/head@245231 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Remove unneeded variable.

MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@245233 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix the bindto parameter declaration.

Submitted by:	sem


git-svn-id: svn://svn.freebsd.org/base/head@245234 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Update where porters handbook lives.

MFC after:	3 days


git-svn-id: svn://svn.freebsd.org/base/head@245236 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Don't drop options from the third retransmitted SYN by default.  If the
SYNs (or SYN/ACK replies) are dropped due to network congestion, then the
remote end of the connection may act as if options such as window scaling
are enabled but the local end will think they are not.  This can result in
very slow data transfers in the case of window scaling disagreements.

The old behavior can be obtained by setting the
net.inet.tcp.rexmit_drop_options sysctl to a non-zero value.

Reviewed by:	net@
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@245238 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Always install our mtree as /usr/sbin/fmtree and link it as
/usr/sbin/mtree by default.

Add a src.conf option WITH_NMTREE that causes NetBSD's mtree to be linked
as /usr/sbin/mtree as well as /usr/sbin/nmtree.


git-svn-id: svn://svn.freebsd.org/base/head@245241 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
cxgbe(4): updates to the configuration file that controls how hardware
resources are partitioned.

- Reduce the number of virtual interfaces reserved for PF4.  This leaves
  spare room in the source MAC table and allows the driver to setup
  filters that rewrite the source MAC address.

- Reduce the number of filters and use the freed up space for the CLIP
  (Compressed Local IPv6 addresses) table.  This is a prerequisite for
  IPv6 TOE support which will follow separately in a series of commits.

MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@245243 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Simplify in6_setscope() function to get better performance.
Currently we use interface indeces as zone IDs for link-local and
interface-local scopes, and since we don't have any tool to configure
zone IDs, there is no need to acquire the afdata lock several times per
packet only to read if_index value.
So, now in6_setscope reads zone IDs for interface-local, link-local and
global scopes without a lock.

Sponsored by:	Yandex LLC
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@245244 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix detection of Razer Copperhead as a USB mouse.
Factor out USB mouse and keyboard detection logic.
Reject USB keyboards which have mouse alike HID items
in their HID descriptors.

Submitted by:	Matthew W
MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@245248 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Bugfix: Fix sizeof() argument.

Found by:	Haakon Loevdal
MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@245249 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Allow perl scripts to be used in rc.d scripts

PR:		conf/117027
Reviewed by:	pjd (mentor)
Approved by:	hrs
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@245250 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Removes essentially unused variables from scsi_da probe setups

PR:		kern/169835
Reviewed by:	pjd (mentor)
Approved by:	mav
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@245251 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Updates delete_method sysctl changes to always maintain disk d_flags
DISKFLAG_CANDELETE. While this change makes this layer consistent
other layers such as UFS and ZFS BIO_DELETE support may not notice
any change made manually via these device sysctls until the device
is reopened via a mount.

Also corrected var order in dadeletemethodsysctl

PR:		kern/169801
Reviewed by:	pjd (mentor)
Approved by:	mav
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@245252 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Changed scsi_da device requests to use the sysctl tunable value for retry_count
and da_default_timeout where their current hardcoded values matched the current
default value for said tunables.

PR:		kern/169976
Reviewed by:	pjd (mentor)
Approved by:	mav


git-svn-id: svn://svn.freebsd.org/base/head@245253 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
- Reduce kernel size by removing unnecessary pointer indirections.

GENERIC kernel size reduced in 16 bytes and RACCT kernel in 336 bytes.

Suggested by:	alc
Reviewed by:	alc
Approved by:	kib (mentor)
MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@245255 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Merge remote-tracking branch 'upstream/master'