Fix dnsmasq '_PATH_LOG' undeclared build error.

This change came from upstream, presumably so they can build against the NDK.

(cherry picked from commit 70eeec149a396b7c457d05de9e38d270a861b9fa)

Change-Id: Idca02fba6fd31e60fdd5710973c98e07ac71a7bc
Allow configuring a socket mark for DNS packets.

This allows dnsmasq to send DNS queries on a non-default network
(e.g., the DUN APN). We add support for a mark instead of using
existing code to bind DNS servers to interfaces because:

1. Marks are more flexible, and we use them elsewhere.
2. The existing code to bind DNS servers to interfaces causes
   the DNS socket to be bound to a constant port, which exposes
   us to a Kaminsky attack.

Bug: 16357676
Change-Id: I8933b6de198a92c2aaf0291931ace8966ddba275
Fixup existing listeners struct irec pointers.

This fixes a difficult to diagnose bug in which when closing old
listeners and creating new listeners, any listeners which stick
around are regrettably left with their iface pointer pointing to
a struct irec that is free()d at the end of the set_interfaces()
call.

This results in a situation where subsequent malloc()s can reuse
this memory which, when written to, corrupts the listener's concept
of its listening address (by overwriting iface.addr).

This mean that when this listener is later closed because, say,
tethering on its interface has been removed, the close logic is
comparing IPv4 socket addresses with possible garbage, resulting
in the socket not being closed because no matching listening
address is found.

Because the socket is never closed, if the interface is later
re-added the bind() to the interface address fails with
EADDRINUSE.

Also: fix a bogus memset() invocation.

Bug: 17475756
Change-Id: I369dcd50b1d03db279fdb2c1d7f0e048df21be65
Aliasing fixes.