Always create /var/run/casper with correct permissions and don't depend on the
calling process' umask.

Submitted by:	Mikhail <mp@lenta.ru>
Do some more sanity checks in route(8): require netmask to have
the same address family as destination.

Found by:	jmg
MFC after:	2 weeks
Add MRT6_DLOG() macro for debugging.
Reduce number of MRT6DEBUG ifdefs and fix some broken format strings.

MFC after:	1 week
Sponsored by:	Yandex LLC
Be much more specific (and correct) about the device id matching.

These device IDs have an AR3012 bluetooth device that shows up with
bcdDevice=1 when it doesn't have the firmware loaded, and bcdDevice=2
when it's ready to speak full HCI.

Tested:

* AR5B225 PCIe - AR9485 + AR3012
Import error message shown to the user when trying to load a module that is
already loaded or compiled withing the kernel

MFC after:	1 week
Fix error counting
Remove extra nesting from X_ip6_mforward() function.
Also remove disabled definitions from ip6_mroute.h.

PR:		185148
Sponsored by:	Yandex LLC
Remove very low default limit of 4 nfsd threads.  nfsd's own default is
8 * hw.ncpu, that sounds more appropriate for these SMP/NCQ/... days.
Split rt_newaddrmsg_fib() into two different functions.
Adding/deleting interface addresses involves access to 3 different subsystems,
int different parts of code. Each call can fail, so reporting successful
operation by rtsock in the middle of the process error-prone.

Further split routing notification API and actual rtsock calls via creating
public-available rt_addrmsg() / rt_routemsg() functions with "private"
rtsock_* backend.

MFC after:	2 weeks
Add a function to print the contents of the static device mapping table,
and invoke it for bootverbose logging, and also from a new DDB command,
"show devmap".  Also tweak the format string for the bootverbose output
of physical memory chunks to get the leading zeros in the hex values.
Use .cpp as the extension for temporary C++ files.

Using a .c extension for a C++ file raises the following warning, which
breaks our header file tests if the compiler is using -Werror as well:

c++: warning: treating 'c' input as 'c++' when in C++ mode, this
behavior is deprecated

Obtained from:	atf (git 3104010c2849330440cc0ce108ff341913433339)
MFC after:	3 days
Check if the given argument to 'gpart add' is actually a geom device and
give a hint to use 'gpart create' before trying to add a partition.

Approved by:	pjd
Add a prototype for the new arm_devmap_print_table().  This should have
been part of r260490.
Fix a braino with r259730: we cannot currently use CFLAGS.gcc or
CFLAGS.clang in sys/conf/Makefile.arm, since the main kernel build does
not use <bsd.sys.mk>.  So revert that particular change for now.

Pointy hat to:	me
Noticed by:	zbb
MFC after:	3 days
X-MFC-With:	r259730
revert part of r260485 which changes how part of the header gets
included..  netstat uses -DKERNEL=1 to get these parts and breaks the
build w/o it...

melifaro@ says that ae@ is probably asleep, and the PR doesn't have
this part of the patch...  Probably a local change got in by accident..

PR:		185148
Pointy hat to:	ae@
Use m_getcl() instead of MGETHDR/MCLGET macros.

Suggested by:	glebius
Allow tests to provide a Kyuafile when they relied on auto-generation.

When generating a Kyuafile in the KYUAFILE=auto case, use a filename
that is unlikely to clash with the filename used by explicitly-provided
Kyuafiles.

This allows a Makefile to set KYUAFILE=yes and provide a Kyuafile in
the same directory when such Makefile was previously relying on
KYUAFILE=auto.

Fixes issues with new Kyuafiles not being picked up in NO_CLEAN builds
(although manual intervention is required once, unfortunately, as
described in UPDATING).

Reviewed by:	sjg
MFC after:	1 week
Run the sh(1) and test(1) tests as unprivileged.

One of the tests for test(1) fails and some of the tests for sh(1) are
silently bypassed when running as root.

To fix these tests and ensure they all run, mark the test programs for
sh(1) and test(1) as requiring an unprivileged user.  (This should and
will be the default in Kyua but isn't yet.)

MFC after:	1 week
Simplify inet alias handling code: if we're adding/removing alias which
has the same prefix as some other alias on the same interface, use
newly-added rt_addrmsg() instead of hand-rolled in_addralias_rtmsg().

This eliminates the following rtsock messages:

Pinned RTM_ADD for prefix (for alias addition).
Pinned RTM_DELETE for prefix (for alias withdrawal).

Example (got 10.0.0.1/24 on vlan4, playing with 10.0.0.2/24):

before commit, addition:

  got message of size 116 on Fri Jan 10 14:13:15 2014
  RTM_NEWADDR: address being added to iface: len 116, metric 0, flags:
  sockaddrs: <NETMASK,IFP,IFA,BRD>
   255.255.255.0 vlan4:8.0.27.c5.29.d4 10.0.0.2 10.0.0.255

  got message of size 192 on Fri Jan 10 14:13:15 2014
  RTM_ADD: Add Route: len 192, pid: 0, seq 0, errno 0, flags:<UP,PINNED>
  locks:  inits:
  sockaddrs: <DST,GATEWAY,NETMASK>
   10.0.0.0 10.0.0.2 (255) ffff ffff ff

after commit, addition:

  got message of size 116 on Fri Jan 10 13:56:26 2014
  RTM_NEWADDR: address being added to iface: len 116, metric 0, flags:
  sockaddrs: <NETMASK,IFP,IFA,BRD>
   255.255.255.0 vlan4:8.0.27.c5.29.d4 14.0.0.2 14.0.0.255

before commit, wihdrawal:

  got message of size 192 on Fri Jan 10 13:58:59 2014
  RTM_DELETE: Delete Route: len 192, pid: 0, seq 0, errno 0, flags:<UP,PINNED>
  locks:  inits:
  sockaddrs: <DST,GATEWAY,NETMASK>
   10.0.0.0 10.0.0.2 (255) ffff ffff ff

  got message of size 116 on Fri Jan 10 13:58:59 2014
  RTM_DELADDR: address being removed from iface: len 116, metric 0, flags:
  sockaddrs: <NETMASK,IFP,IFA,BRD>
   255.255.255.0 vlan4:8.0.27.c5.29.d4 10.0.0.2 10.0.0.255

adter commit, withdrawal:

  got message of size 116 on Fri Jan 10 14:14:11 2014
  RTM_DELADDR: address being removed from iface: len 116, metric 0, flags:
  sockaddrs: <NETMASK,IFP,IFA,BRD>
   255.255.255.0 vlan4:8.0.27.c5.29.d4 10.0.0.2 10.0.0.255

Sending both RTM_ADD/RTM_DELETE messages to rtsock is completely wrong
(and requires some hacks to keep prefix in route table on RTM_DELETE).

I've tested this change with quagga (no change) and bird (*).

bird alias handling is already broken in *BSD sysdep code, so nothing
changes here, too.

I'm going to MFC this change if there will be no complains about behavior
change.

While here, fix some style(9) bugs introduced by r260488
(pointed by glebius and bde).

Sponsored by:	Yandex LLC
MFC after:	4 weeks
Replace several instances of -1 with appropriate CAM_*_WILDCARD and types.

It was equal before r259397, but for good or bad, not any more for LUNs.

This change fixes at least CAM debugging.