[Dnsmasq-discuss] [PATCH] Fix parsing of IPv6 addresses with peer from netlink

Simon Kelley simon at thekelleys.org.uk
Fri May 27 20:28:44 UTC 2022


The patch looks good to me. Applied.


Cheers,

Simon.


On 19/05/2022 10:43, Beniamino Galvani wrote:
> On Wed, May 18, 2022 at 04:10:52PM +0200, Geert Stappers via Dnsmasq-discuss wrote:
>> There new lines and one old line
>>> +			if (rta->rta_type == IFA_LOCAL)
>>> +			  addrp = ((struct in6_addr *)(rta+1));
>>> +			else if (rta->rta_type == IFA_ADDRESS && !addrp)
>>>   			  addrp = ((struct in6_addr *)(rta+1));
>> rewritten as I see them
>> +      if (conditionLOCAL)
>> +         addrp = value
>> +      else if (conditionADDRESS && !addrp)
>>            addrp = value
>>
>>
>> It is the "&& !addrp" that makes me feel uncomfortable.
>>
>>
>> Would
>> +      if (conditionLOCAL)
>> +         addrp = value
>> +      else if (conditionADDRESS)
>>            addrp = value
>>
>> do?
> 
> It wouldn't work, because a netlink message for an address with peer
> has:
> 
>   IFA_LOCAL   = addr
>   IFA_ADDRESS = peer
> 
> We would first evaluate IFA_LOCAL and set addrp = addr, then overwrite
> it with peer when evaluating the next attribute IFA_ADDRESS.
> 
> Since we are interested in 'addr', when IFA_LOCAL is present it should
> always override IFA_ADDRESS.
> 
>> P.S.
>> @Beniamino   welcome to dnsmasq
> 
> Thanks,
> Beniamino
> 
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss



More information about the Dnsmasq-discuss mailing list