[Dnsmasq-discuss] dropped dhcp6 packet logging revisited

Simon Kelley simon at thekelleys.org.uk
Wed Oct 24 14:00:50 BST 2012


On 24/10/12 12:36, Gene Czarcinski wrote:
> On 10/24/2012 06:33 AM, Simon Kelley wrote:
>>> On 23/10/12 17:32, Gene Czarcinski wrote:
>>>
>>>> I am going to add some code to do such logging because it seems I need
>>>> some proof that the problem exists. I have no idea why, but there
>>>> appears to be reluctance on the part of the libvirt developers to
>>>> accept
>>>> adding the interface= parameter to dnsmasq. I believe that, even
>>>> with my
>>>> limited testing, I have seen the problem occur.
>>>>
>>> It's probably possible, as a fallback position, to make a dnsmasq
>>> instance with a single --listen-address config do the right thing.
>>> That would preclude changes to libbvirt.
>>
>>> Simon.
>>
>> OK, so this is vaguely embarrassing. Having checked the actual code,
>> rather than the changelog, I see that dnsmasq >=2.61 _already_ does the
>> right thing. Setting --bind-interfaces* and a single --listen-address
>> will cause the code to set SO_BINDTODEVICE on the DHCP socket(s).
>>
>> So, there is not a problem with the existing libvirt command line.
>>
>> Gene, apologies for sending you on a wild-goose chase with this.
>>
>> * or bind-dyanmic on 2.63 and later.
>>
>>
> OK, this explains why the problems have not been obvious becuase most
> libvirt instances of dnsmasq do have only a single --listen-address.
> 
> However, how about specification of an IPv4 and an IPv6 address?  Is
> this counted as two or as one in each type?
> 
> And then there is this little gem:  With libvirt, you can define as many
> different ip networks as you like on an interface.  There will be only
> one dnsmasq because it is really tied to the virtual network device.
> 
> Now, I am not proposing that dnsmasq make any changes because, IMO, the
> simplest answer is to add the interface= specification [it adds one line
> of code and changes nine test data files].  I am still campaigning to
> make this happen.
> 
> However, dnsmasq could check to see if all of the addresses specified
> where on the same interface and, if they were, do the bind as if
> interface= was specified.
> 

OK, learning from past mistakes and checking the code, this is what happens.

You can have as many --listen-address as you like, as long as the
addresses all belong to the same interface. This applies to both IPv4
and IPv6,  so if you have an interface with two addresses

192.168.0.10 and
fd00::10

then

dnsmasq --listen-address=192.168.0.10 --listen-address=fd00::10

would set SO_BINDTODEVICE. But if those addresses belonged to two
different interfaces, the same command line would not set
SO_BINDTODEVICE. The same applies with more than one IPv4 or IPv6
address, so an interface with addresses

192.168.0.10 and
192.168.1.10

sets SO_BINDTODEVICE with

dnsmasq --listen-address=192.168.1.10 --listen-address=192.168.0.10

so it looks like libvirt is good.


Cheers,

Simon.





More information about the Dnsmasq-discuss mailing list