[Dnsmasq-discuss] 2.53rc2

clemens fischer ino-news at spotteswoode.dnsalias.org
Thu May 27 17:45:58 BST 2010


Matthias Andree wrote:

> Assuming Linux or one of the supported BSDs, try:
> 
> strace -e trace=network dnsmasq -d [other dnsmasq options]
> 
> Other systems might provide truss or ktrace/kdump.

So I followed this advice and made the following discoveries:

2010-05-27_16:07:11.46459 + exec strace -f -e \
  trace=network /usr/local/sbin/dnsmasq -C /etc/dnsmasq.conf \
  -u nobody -g nobody -q --log-dhcp --log-facility=- \
  --log-async=0 -k --rebind-domain-ok=/zen.spamhaus.org/ \
  --rebind-domain-ok=/dnsbl-1.uceprotect.net/ \
  --rebind-domain-ok=/ix.dnsbl.manitu.net/ --rebind-localhost-ok
2010-05-27_16:07:11.53129 socket(PF_NETLINK, SOCK_RAW, 0)         = 3
2010-05-27_16:07:11.53151 bind(3, {sa_family=AF_NETLINK, pid=0,
  groups=00000440}, 12) = 0
2010-05-27_16:07:11.53166 getsockname(3, {sa_family=AF_NETLINK,
  pid=10011, groups=00000440}, [12]) = 0

I wonder what netlink is used for?  Could it be DBus?  Quite a bit of
traffic on the netlink socket.

...
2010-05-27_16:07:11.54045 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 7
2010-05-27_16:07:11.54059 setsockopt(7, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
2010-05-27_16:07:11.54073 bind(7, {sa_family=AF_INET,
  sin_port=htons(53), sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EADDRINUSE
  (Address already in use)
2010-05-27_16:07:11.54092
2010-05-27_16:07:11.54110 dnsmasq: failed to create listening
  socket: Address already in use

So I presume nothing can be done if people want to wildcard-bind in
order to use any interfaces, even when they don't exist yet.

2010-05-27_16:07:11.54204 socket(PF_FILE, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 8
2010-05-27_16:07:11.54225 connect(8, {sa_family=AF_FILE,
  path="/dev/log"}, 110) = 0
2010-05-27_16:07:11.54241 send(8, "<26>May 27 18:07:11
  dnsmasq[1001"..., 93, MSG_NOSIGNAL) = 93
2010-05-27_16:07:11.54264 send(8, "<26>May 27 18:07:11
  dnsmasq[1001"..., 54, MSG_NOSIGNAL) = 54

This is a little disturbing:  logging is configured to go to a file
(stderr), not to syslog.  It doesn't make much difference here, though.

It's a bit less automatic than I had wished for, but my solution is to
put an "--interface=x" line into the arguments to dnsmasq and start it
only after this interface is up (any bourne shell syntax):

  local_dev_wlan="wlan0"
  pattern_wlan_up="up.+up"
  prog_ip="/usr/sbin/ip"
  prog_egrep="/bin/egrep"
  prog_sleep="/bin/sleep"
  time_sleep=3
  #
  echo "${0}: $(date) wait for ${local_dev_wlan} to come up"
  until ${prog_ip} link show "${local_dev_wlan}" |
      ${prog_egrep} -i "${pattern_wlan_up}" >/dev/null 2>&1
  do ${prog_sleep} ${time_sleep}; done

Also, I use "--bind-interfaces".


clemens




More information about the Dnsmasq-discuss mailing list