dns: explicitly endian-convert all fields in header and question
For added type-safety and to avoid possible alignment issues make all
conversions explicit. While at it, mark header struct as packed so that
its layout is guaranteed to match RFC.
Prompted by gcc 8 & 9 warning in dns.c:
dns.c:261:2: error: converting a packed ‘struct dns_question’
pointer (alignment 1) to a ‘uint16_t’ {aka ‘short unsigned int’} pointer
(alignment 2) may result in an unaligned pointer value
[-Werror=address-of-packed-member]
261 | uint16_t *swap = (uint16_t *) q;
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
[Tweak commit message]
Acked-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>