core: Fix strict-aliasing problems with authentication domains

Dodgy casts are the worst.
tests: Fix strict aliasing problems with struct sockaddr

Make it a union and GCC is happy again.