MFC: r271286

Use the right constants in comparisons.  This is currently a nop, as
MIN_RXD == MIN_TXD and MAX_RXD == MAX_TXD.

Reviewed by:    Eric Joyner @ Intel
Approved by:    re (kib)


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271621 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
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 <garmitage@swin.edu.au>


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271653 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix Denial of Service in TCP packet processing.

Security:	FreeBSD-SA-14:19.tcp


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271668 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Bump __FreeBSD_version after SA-14:19.tcp

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271686 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Document SA-14:19

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271687 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r271604, r271616:
Add couple memory barriers to order tdq_cpu_idle and tdq_load accesses.

This change fixes transient performance drops in some of my benchmarks,
vanishing as soon as I am trying to collect any stats from the scheduler.
It looks like reordered access to those variables sometimes caused loss of
IPI_PREEMPT, that delayed thread execution until some later interrupt.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271708 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r271403: Add PCI ID for Promise TX8660 8-port 3Gbps HBA.

This device reports RAID subclass, but appears to be AHCI compatible.

Submitted by:	Yuri Perejilin <yuri@rivera.ru>


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271710 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC 270830:
When anouncing link state changes on an 802.11 interface with a vap,
announce the change on the vap's ifnet instead of the main ifnet.  This
matches the behavior of other wireless drivers in the tree and allows the
default devd configuration to correctly start dhclient automatically after
an ndis wireless device associates.

Approved by:	re (marius for 10)


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271714 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r271597:

Pull in r217410 from upstream llvm trunk (by Bob Wilson):

  Set trunc store action to Expand for all X86 targets.

  When compiling without SSE2, isTruncStoreLegal(F64, F32) would return
  Legal, whereas with SSE2 it would return Expand. And since the Target
  doesn't seem to actually handle a truncstore for double -> float, it
  would just output a store of a full double in the space for a float
  hence overwriting other bits on the stack.

  Patch by Luqman Aden!

This should fix clang -O0 on i386 assigning garbage to floats, in
certain scenarios.

PR:		187437
Submitted by:	cebd@gmail.com
Obtained from:	http://llvm.org/viewvc/llvm-project?rev=217410&view=rev


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271737 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r271644:
Add quirks to disable READ CAPACITY (16) for PNY USB 3.0 Flash Drives.

Submitted by:	Sean Fagan <sef@ixsystems.com>


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271749 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFH (r271256, r271617): avoid segfault if PAM_RHOST nor PAM_TTY are unset.

PR:		83099


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271767 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC 263779, except for the ATF test change.

Correct ARP update handling when the routes for network interfaces are
restricted to a single FIB in a multifib system.

Restricting an interface's routes to the FIB to which it is assigned (by
setting net.add_addr_allfibs=0) causes ARP updates to fail with "arpresolve:
can't allocate llinfo for x.x.x.x".  This is due to the ARP update code hard
coding it's lookup for existing routing entries to FIB 0.

sys/netinet/in.c:
        When dealing with RTM_ADD (add route) requests for an interface, use
        the interface's assigned FIB instead of the default (FIB 0).

sys/netinet/if_ether.c:
        In arpresolve(), enhance error message generated when an
        lla_lookup() fails so that the interface causing the error is
        visible in logs.

PR:             kern/167947


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271809 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r264887, except for the ATF test change.  Also,
ifa_switch_loopback_route doesn't exist in stable/9, so the relevant change
to that function went into in_scrubprefix instead.

Fix host and network routes for new interfaces when net.add_addr_allfibs=0

sys/net/route.c
        In rtinit1, use the interface fib instead of the process fib.  The
        latter wasn't very useful because ifconfig(8) is usually invoked
        with the default process fib.  Changing ifconfig(8) to use setfib(2)
        would be redundant, because it already sets the interface fib.

tests/sys/netinet/fibs_test.sh
        Clear the expected ATF failure

sys/net/if.c
        Pass the interface fib in calls to rtrequest1_fib and rtalloc1_fib

sys/netinet/in.c
sys/net/if_var.h
        Add a fibnum argument to ifa_switch_loopback_route, a subroutine of
        in_scrubprefix.  Pass it the interface fib.

PR:             kern/187549


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271825 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r264905 and r266860, except for the ATF parts.

r266860
Fix unintended KBI change from r264905.  Add _fib versions of
ifa_ifwithnet() and ifa_ifwithdstaddr()  The legacy functions will call the
_fib() versions with RT_ALL_FIBS, preserving legacy behavior.

sys/net/if_var.h
sys/net/if.c
        Add legacy-compatible functions as described above.  Ensure legacy
        behavior when RT_ALL_FIBS is passed as fibnum.

sys/netinet/in_pcb.c
sys/netinet/ip_output.c
sys/netinet/ip_options.c
sys/net/route.c
sys/net/rtsock.c
sys/netinet6/nd6.c
        Call with _fib() functions if we must use a specific fib, or the
        legacy functions otherwise.

r264905
Fix subnet and default routes on different FIBs on the same subnet.

These two bugs are closely related.  The root cause is that ifa_ifwithnet
does not consider FIBs when searching for an interface address.

sys/net/if_var.h
sys/net/if.c
        Add a fib argument to ifa_ifwithnet and ifa_ifwithdstadddr.  Those
        functions will only return an address whose interface fib equals the
        argument.

sys/net/route.c
        Update calls to ifa_ifwithnet and ifa_ifwithdstaddr with fib
        arguments.

sys/netinet/in.c
        Update in_addprefix to consider the interface fib when adding
        prefixes.  This will prevent it from not adding a subnet route when
        one already exists on a different fib.

sys/net/rtsock.c
sys/netinet/in_pcb.c
sys/netinet/ip_output.c
sys/netinet/ip_options.c
sys/netinet6/nd6.c
        Add RT_DEFAULT_FIB arguments to ifa_ifwithdstaddr and ifa_ifwithnet.
        In some cases it there wasn't a clear specific fib number to use.
        In others, I was unable to test those functions so I chose
        RT_DEFAULT_FIB to minimize divergence from current behavior.  I will
        fix some of the latter changes along with PR kern/187553.

PR:             kern/187550
PR:             kern/187552


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271840 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r265092, except for the ATF bits.

Fix a panic when removing an IP address from an interface, if the same address
exists on another interface.  The panic was introduced by change 264887, which
changed the fibnum parameter in the call to rtalloc1_fib() in
ifa_switch_loopback_route() from RT_DEFAULT_FIB to RT_ALL_FIBS.  The solution
is to use the interface fib in that call.  For the majority of users, that will
be equivalent to the legacy behavior.

PR:             kern/189089


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


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271897 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r256800: pathchk: Ensure bytes >= 128 are considered non-portable
characters.

This was not broken on architectures such as ARM where char is unsigned.

Also, remove the first non-portable character from the output. POSIX does
not require this, and printing the first byte may yield an invalid byte
sequence with UTF-8.

PR:		165988
Reported by:	Nicolas Rachinsky
Relnotes:	yes


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@271902 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f