[Dnsmasq-discuss] [patch] Answer DHCP requests when dnsmasq is not bound to the 1st IP of an interface
Simon Kelley
simon at thekelleys.org.uk
Mon Nov 21 11:58:45 GMT 2011
On 20/11/11 08:03, dnsmasq.20.masuefke at spamgourmet.com wrote:
> Hello,
>
> I ran into an unusual situation:
> - Network interface is br0, two IPv4 addresses assigned.
> - First ip port 53 occupied by other dns resolver
> - Dnsmasq had to be bound to the 2nd ip with options "bind-interfaces"
> and "listen-address=<2nd ip>"
> --> Dnsmasq did not respond to dhcp requests anymore.
>
> The problem was traced to dnsmasq checking only an interfaces with
> ioctl( ... SIOCGIFADDR ... ) in dhcp.c at line ca 245
>
> The patch seems a bit crude but works.
> I have built it on Linux/amd64 with IPv4, no clue about BSD, Solaris and
> IPv6 at all.
> Also, I have not figured out the best place where to enable the patch
> with #define. For now it's enabled in dnsmasq.h
>
> In the patch, there are quite some many my_syslog( ) statements used for
> debugging the new code. You will not want to run that in production as
> it spams the log.
>
> The patch is against dnsmasq-2.57, I hope that does not cause too much
> trouble.
>
> -Martin
> PS: I may not stay on the list for long, please CC me in replies.
>
Yes, the current code assumes the the "primary" address of a physical
interface is the one to be used for DHCP. Note that to start with, all
you know about a client is what interface it's attached to, so selecting
which address to use when there's more than one is problematic. Your
patch kind of ignores this, but what happens if an interface has two or
more addresses, and you --listen-address on both?
This stuff doesn't just affect access control, it affects address
allocation and things like the default gateway supplied to DHCP clients.
Maybe there should be explicit configuration?
--dhcp-interface-address = <interface name>, <IP address>
to tell the DHCP subsystem which address to use.
I'll put something together and get back to you.
Cheers,
Simon.
More information about the Dnsmasq-discuss
mailing list