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
signature.asc
Description: PGP signature
_______________________________________________ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss