On 24/09/18 19:12, Kristian Evensen wrote:
> Hello,
> I have some routers running OpenWRT (latest nightly) and that I have
> to access remotely (using reverse SSH). When I restart networking
> (/etc/init.d/network restart), clients on the LAN can no longer obtain
> an IP address using DHCP. If I restart networking locally, DHCP works
> as expected after the network is back up.
> In order to try and figure out what is going on, I have checked/tried
> the following:
> * I started out by checking if dnsmasq has been restarted and if the
> DHCP socket has been created. I can always see the socket in netstat.
> * I then took a look at the firewall. I can see the DHCP packets in
> the INPUT chain in filter, which according to my understanding of
> Netfilter-internals is the last stop before a packet is delivered to a
> socket.
> * I then instrumented dnsmasq and added some logging in dhcp_packet()
> in dhcp.c. This function is never called, as none of my log-messages
> are written to syslog. I checked that the logging works by checking
> for my messages when DHCP is working.
> * Restarting dnsmasq makes DHCP work again. I can't see any difference
> in for example netstat-output.
> Does anyone have any idea on what to try or where to look next? After
> having spent a couple of days on this issue, I am quickly starting to
> run out of ideas.

I wonder if this is caused by dnsmasq using the BINDTODEVICE sockopt on
the DHCP socket. If the networking restart takes down and re-creates the
network interface, then that socket may be remain bound to the old

This comment in whichdevice() in dhcp-common.c decribes the condition
under which the binding happens.

 /* If we are doing DHCP on exactly one interface, and running linux, do
     to that device. This is for the use case of  (eg) OpenStack, which
runs a new
     dnsmasq instance for each VLAN interface it creates. Without the
     individual processes don't always see the packets they should.
     SO_BINDTODEVICE is only available Linux.

     Note that if wildcards are used in --interface, or --interface is
not used at all,
     or a configured interface doesn't yet exist, then more interfaces
may arrive later,
     so we can't safely assert there is only one interface and proceed.

Simplest test is to make whichdevice always return NULL, and see if that



Dnsmasq-discuss mailing list

Reply via email to