[Dnsmasq-discuss] It works: multiple dnsmasqs running

Simon Kelley simon at thekelleys.org.uk
Mon Oct 15 17:04:10 BST 2012


On 15/10/12 15:48, Gene Czarcinski wrote:
> On 10/15/2012 06:47 AM, Simon Kelley wrote:
>> On 13/10/12 19:39, Gene Czarcinski wrote:
>>
>>> I again proved to myself that specifying listen-address=<ip4-address>
>>> and listen-address=<ip6-address> does not work with dhcp6 whereas
>>> specifying interface=eth0 does.  I am not sure how/why it seems to work
>>> with dhcp4 (as demonstrated by libvirt) but not dhcp6.  BTW, there is
>>> one difference: libvirt specifies --listen-address on the command line
>>> whereas I had it in a conf file.
>>
>> conf-file versus command line will make no difference. Which address
>> are you using? the Link-local one or a globally-routed one?
> I have tried both and it makes no difference.
>
> I am using a manually configured IPv6 address.
>
> I have done a "little" instrumentation o dnsmasq to attempt to locate
> the problem (that's "expert talk" for adding a whole bunch of my_syslog
> lines to to see what is going on and just what is being executed).  In
> fact, I have added a lot of lines which produce lots and lots of
> messages in syslog.
>
> I believe I can see what the problem is but not necessarily how to fix
> it.  The reason that dhcp4 works and dhcp6 does not is that dhcp4 has a
> "fallback" when an interface is not specified.
>
> I have looked at a lot of code so far and a lot of syslog files. I found
> the difference in dhcp_packet() versus dhcp6_packet() ... dhcp_packet()
> adds an async function complete_context() to make things work.  But, I
> have never done any socket programming before and it took me at least a
> little while to realize what is going on (or at least I believe that I
> do). [I was wonder why all those iface_check() calls where being made.]
>
> When a ff00::1:2 dhcp6 packet arrived, dhcp6_packet() did not fined any
> entry for the incoming device in the daemon->if_names list, so it just
> drops the packet.
>
> I am sure that you can come up with a solution much quicker than I can
> but I am going to continue looking into this to see if I can fix it.
> Like I said, I have never done any programming with sockets and this
> interests me.
>

What's supposed to happen in dhcp6_packet() is that the IPv6 address in 
dest matches the --listen-address address. The check for this is done by 
iface_check() , which should return 1.

So the crucial bit of information is what is in the variable dest?

Something like

{ char buf[200];
   inet_ntop(AF_INET6, &dest.addr.addr6, buf, 200);
   my_syslog(MS_DHCP | LOG_INFO, "destination address is %s", buf);
}

will do the trick.


Cheers,

Simon.





More information about the Dnsmasq-discuss mailing list