Properly fence off incomplete ICMP plumbing for promiscuous INET
interfaces that are not in fib 0.
- Added uinet_shutdown(), which performs libuinet cleanup when called.

- Added uinet_install_sighandlers(), which installs a cleanup handler
  on all signals whose default handler terminates the process and
  whose current handler is the default handler.  Applications that
  implement their own termination signal handlers should call
  uinet_shutdown() from those handlers.
- The netmap interface driver now restores the buffer indices in the
  receive ring during detach, to work around the netmap
  double-free/leak issue that can occur when doing zero-copy receive.
  Calling uinet_shutdown() runs the detach routines, so this netmap
  issue is worked around in all cases where uinet_shutdown() is called
  (so there is still some exposure to this via SIGKILL and when
  working in the debugger).

- Fenced off the not-ready portions of the netmap and pcap interface
  detach routines.
Updated sample programs to install the libuinet signal handlers and
use uinet_shutdown() to clean up when done.
To allow more complex shutdown operations than are possible from
within a sginal handler, there is now a shutdown helper thread that
does all the work.  The thread waits for a shutdown message to be sent
from uinet_shutdown().  The shutdown thread and uinet_shutdown() use a
new thread-and-signal-handler-safe UHI facility for sending and
waiting on messages.

The netmap interface now cleanly stops the transmit and receive
threads during detach.  This resolves a concurrency issue that existed
when the receive thread was still running while detach was performing
the netmap ring cleanup workaround.
Fix uhi_cond_timedwait() so that it actually uses absolute time.
Also, don't bother setting the pthread_cond clock to anything other
than the default CLOCK_REALTIME.  The result is more uniform behavior
across platforms (can't use CLOCK_MONOTONIC on MAC OS X, for example),
in exchange for timedwaits waiting less or more than desired if there
are large clock changes.
Improvements to shutdown-related signal handling:

- All internal uinet threads and all application threads that use the
  uinet API now mask all signals.  This avoids a deadlock scenario
  between uinet_shutdown() waiting for the shutdown thread to complete
  when running in a signal handler executing in the context of a
  thread that is holding a lock that must be acquired for the shutdown
  thread to proceed.

- An additional thread is now spawned by libuinet that unmasks all
  signals, to ensure that at least one thread is available to process
  signals.  At some point this will become configurable as this can
  subvert careful thread signal mask policing by some applications.

- The shutdown thread will now respond to multiple shutdown trigger
  messages, but only execute the shutdown actions once.  This provides
  better behavior in applications where uinet_shutdown()-calling
  signal handlers can be concurrently executing in multiple threads.
  Now, in such a scenario, all uinet_shutdown() calls will complete
  and shutdown will be performed exactly once.

- A use-after-free hazard associated with the shutdown helper message
  is now avoided in exchange for a small memory leak at shutdown.

- The uhi_msg_*() routines, which may be called from signal handlers,
  and which call functions that might adjust errno, now preserve errno
  across their invocations.
Unbreak synfilter decision values in libuinet.

The kernel synfilter decision values (SYNF_*) and the libuinet API
versions of the same (UINET_SYNF_*) must match, as they are not
translated at runtime.  They went out of sync with the initial
version of passive receive functionality, breaking everything other
than SYNF_ACCEPT.

Assertions at compile and/or runtime, or translation at runtime to
maintain a stable libuinet ABI, may be desirable in the future.
inp->inp_socket may be NULL here, check for that.

The code here assumes it can dereference inp->inp_socket without a
check for inp->inp_socket being NULL, even though later code admits
this is a potentiality with which this code must deal.  While this
is needed in practice in the outer conditional, not using passive
mode myself at the moment I am unsure if it is needed in the inner
one, and am unable to determine this empirically, unlike with the
outer one.
Use memcpy() instead of strcpy() for copying the syn filter instance
arg, as it may be used to convey binary data.
Fixed lock-order reversal between sock lock and inp lock when setting
l2info on a socket.

The sock lock was being held by sosetopt() across the call to
ip_ctloutput(), which acquires the inp lock, now out-of-order.  This
tends to show up when the l2info is being set on a freshly accepted
socket while segments for that socket are being processed by
tcp_input() - when tcp_input() tries to acquire the receive sockbuf
lock while holding the inp lock, deadlock ensues, as the sock lock and
the receive sockbuf lock are currently one and the same.
Fix inbound VLAN tag mask selection bug.  listens on specific VLAN tag
stacks were affected by this.
Add missing consts and make room for type translation in setl2info.
Make optval pointer const in so_setsockopt() and cast away const-ness
internally.  This is consistent with how the userland setsockopt()
works.