Failure to recognise connections from localhost over IPv6
Wrong type used while comparing IPv6 addresses
Wrong type used while comparing IPv4 addresses
Incorrect check of thr result of getpeername(2).