Support killing sockets using SOCK_DESTROY.

This gives netd the ability to close sockets on a particular
source IP address using SOCK_DESTROY. It does not yet enable
this behaviour.

The microbenchmark is able to close 500 IPv6 sockets in ~30ms on
my angler. Specifically:

- Scanning 500 socketpairs: ~5ms
- Scanning 500 socketpairs and killing one half of each: ~30ms
- Scanning 500 socketpairs and killing both halves of each: ~40ms

This is about ~2.5x-3.5x slower than SIOCKILLADDR:
 - For 500 sockets, it's 9.5ms vs. 22.9ms.
 - For 4000 sockets, it's ~40ms vs ~135ms.

A large part of that is due to sending RST packets, which
SIOCKILLADDR does not do. If the kernel is modified so that
SOCK_DESTROY does not send RSTs, the time taken to kill 4000
sockets goes down to ~70ms

Batching the destroy operations does not help much. It saves
5-10%, but it complicates error handling.

Bug: 26976388

(cherry picked from commit 8464e1ed13a30ca91ae44dd2e334f63de7ade0f3)

Change-Id: Ib85d573ee2af6f6ffc4ce50a31cfbb6e9a720ca1
5 files changed
tree: 1f0ac9461f19198427ec016add1cd70b384a6ae9
  1. Android.mk
  2. MODULE_LICENSE_APACHE2
  3. NOTICE
  4. client/
  5. include/
  6. server/
  7. tests/