[Dnsmasq-discuss] failed to bind DHCP server socket: Address already in use

Simon Kelley simon at thekelleys.org.uk
Tue Oct 14 10:42:40 BST 2008


Michael Rack wrote:
> I use dhcp-fwd v0.7 patched by my self to support dhcp-server override 
> and many other features.
> 
> But it is realy suspect that dhcp-fwd creates two identical entrys:
> 
> udp        0      0 0.0.0.0:67              0.0.0.0:*
> udp        0      0 0.0.0.0:67              0.0.0.0:*
> udp   108324      0 0.0.0.0:68              0.0.0.0:*
> udp        0      0 0.0.0.0:68              0.0.0.0:*
> 

I think that dhcp-fwd is binding to net devices using the non-portable, 
Linux only SO_BINDTODEVICE socket option.

Very early versions of dnsmasq used to do this, but moved to the current 
scheme (one socket, read which device a packet arrived from and discard 
any not needed) when portability to *BSD was added.


> And DNSMASQ creates only one of each port (67/68) ?!? I will try to 
> implement the SO_REUSEADDDR option to the dhcp-fwd process and hope to 
> get it running :-) My C++ skills are very terrible *smile* But i think i 
> will do it :-)

OK, please let me know how you get on, if that works, I'll add it to 
dhcp-helper too.


Cheers,

Simon.

> 
> Thanks,
> Michael.
> 
> 
> 
> Simon Kelley schrieb:
>> Which dhcp-forwarder are you using?
>>
>> There's no portable way to listen on an _interface_ in Unix, one 
>> normally listens on the _address_ of an interface, but that breaks 
>> DHCP which has to receive packets sent to/from strange addresses 
>> during the configuration process. For that reason, a DHCP server has 
>> to listen on the wildcard address, 0.0.0.0
>>
>> Dnsmasq partly solves this problem by setting the SO_REUSEADDR flag on 
>> DHCP sockets when --bind-interfaces is set. That allows the wildcard 
>> address to be bound multiple times, as long as every instance sets the 
>> flag. That allows multiple instances of dnsmasq to run, but it breaks 
>> when something else is binding the wildcard address and NOT setting 
>> SO_REUSEADDDR. I suspect that's the case here.
>>
>> Cheers,
>>
>> Simon.
> 




More information about the Dnsmasq-discuss mailing list