netd: Futher fixes
With these applied you can ping and remotely interact with the stack but
local interactions are not yet working (probably byte order) and also the
close() functionality is a bit messed up.
We need to
a) break the mapping when the kernel asks us to move to closed
b) do the flag test *outside* of the app callbacks (as we may be closing
without any app callbacks happening)
c) allow for events from uip on unmapped sockets (one the kernel closed),
in which case we should reset if there is data arriving, and otherwise
cycle through the close states and close in uip, then free up the broken
mapping slot