MFV r249496,249498.  The most visible change is that we no longer shuts
down the connection when stdin closes, by default.  This matches Hobbit's
original netcat and GNU netcat.

Old behavior can be restored with the new -N flag.

MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@249499 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Use arc4random() instead of random().

MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@249500 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Although we perform path compression to reduce the height of the trie and
the number of interior nodes, we have previously created a level zero
interior node at the root of every non-empty trie, even when that node is
not strictly necessary, i.e., it has only one child.  This change is the
second (and final) step in eliminating those unnecessary level zero interior
nodes.  Specifically, it updates the deletion and insertion functions so
that they do not require a level zero interior node at the root of the trie.
For a "buildworld" workload, this change results in a 16.8% reduction in the
number of interior nodes allocated and a similar reduction in the average
execution time for lookup functions.  For example, the average execution
time for a call to vm_radix_lookup_ge() is reduced by 22.9%.

Reviewed by:	attilio, jeff (an earlier version)
Sponsored by:	EMC / Isilon Storage Division


git-svn-id: svn://svn.freebsd.org/base/head@249502 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
fix a bug in the computation of the userspace offset for a give netmap buffer.

Submitted by: Hugh Nhan


git-svn-id: svn://svn.freebsd.org/base/head@249504 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Switch lagg(4) statistics to counter(9).

The lagg(4) is often used to bond high speed links, so basic per-packet +=
on statistics cause cache misses and statistics loss.

Perfect solution would be to convert ifnet(9) to counters(9), but this
requires much more work, and unfortunately ABI change, so temporarily
patch lagg(4) manually.

We store counters in the softc, and once per second push their values
to legacy ifnet counters.

Sponsored by:	Nginx, Inc.


git-svn-id: svn://svn.freebsd.org/base/head@249506 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Introduce a symbol for the GEOM class name instead of using the ad-hoc string
constant.


git-svn-id: svn://svn.freebsd.org/base/head@249507 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Introduce glabel labels based on GEOM ident attributes. In this initial
implementation, error on the side of conservatism and only create labels
for GEOMs of classes DISK and MULTIPATH.

Discussed with:	trasz
Approved by:	silence from freebsd-geom@


git-svn-id: svn://svn.freebsd.org/base/head@249508 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Corrections to the RX checksum code, make sure its disabled as
well as enabled when necessary. And simplify the checksum routine
itself, adding UDP bit to the test. Thanks to Kevin Lo for pointing
out the problems and code suggestions.


git-svn-id: svn://svn.freebsd.org/base/head@249509 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
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.

PR:		177706
Submitted by:	Tiwei Bie
MFC after:	1 month


git-svn-id: svn://svn.freebsd.org/base/head@249514 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Bring over some AR9271 register definitions from the QCA HAL.

Obtained from:	Qualcomm Atheros


git-svn-id: svn://svn.freebsd.org/base/head@249516 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Now that the register definitions are in -HEAD, enable this.


git-svn-id: svn://svn.freebsd.org/base/head@249517 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Reflect version update.

MFC after:	13 days


git-svn-id: svn://svn.freebsd.org/base/head@249520 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix N32/N64 register saving by ensuring that all registers resolve
to unique values.

There's some confusion about what the n32 assembler API really is
(since on page 9 of the spec they say that t0-t3 don't exist, then
turn around on page 22 and say that t4-t7 don't exist), and this
doesn't touch that.

NetBSD's version of this file follows the convention I used here, and
is likely to be correct.

This should fix gdb/ptrace.


git-svn-id: svn://svn.freebsd.org/base/head@249523 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
The origin_subst_one() function limits the length of the string to
PATH_MAX after the token substitution.  This is wrong, because
origin_subst_one() performs the substitution on the whole rpath and
similar strings, which contain several pathes separated by colon.  As
result, long (but correct) rpath consisting of many path elements is
rejected by the function.

Correct the problem by rewriting the origin_subst_one() to perform two
passes, first pass to calculate the number of substitutions to be
performed, and second pass to generate the resulting string.  Second
pass allocates the memory for the result based on the count from the
first pass, without enforcing a limit.

Reported and tested by:	pgj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@249525 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
DTrace: NFS translators should be split into client/server pieces

Merge change from illumos:

1731 DTrace NFS translators should be split into client/server pieces

Illumos Revision:	13523:6763769941d2

This code seems to be currently unused on FreeBSD.

Reference:
https://www.illumos.org/issues/1731

Obtained from:	Illumos
MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@249526 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
The source address selection algorithm tries to apply several rules
for the set of IPv6 addresses. Now each attempt goes into IPv6 statistics,
even if given rule did not won. Change this and take into account only
those rules, that won. Also add accounting for cases, when algorithm
fails to select an address.


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