FreeBSD-specific fixes

- do not define bswap32 on FreebSD (and OpenBSD I guess)
- netinet/tcp.h requires sys/types.h