Hello!
> - When the socket is closed (inet_release() is called, tproxy has its
> "callback" function here), the corresponding entries are deleted from
> tproxy's hash tables, again, based on the local ip:port pair.
The mistake is here. inet_release() has nothing to do to connection
state. Socket is not closed at this point, it goes to FIN-WAIT*, LAST-ACK or
something like this and can exist for long time after this and proxying
is to be continued all this time.
Right place to finish tracking is when socket is removed from TCP
hash tables, and to start tracking is when the socket is inserted
to TCP hash tables. BTW you would not see the problem with binding
if it was made right.
Alexey