[Dnsmasq-discuss] [PATCH] Fix parsing of IPv6 addresses with peer from netlink
Geert Stappers
stappers at stappers.nl
Wed May 18 14:10:52 UTC 2022
On Wed, May 18, 2022 at 02:48:09PM +0200, Beniamino Galvani wrote:
> --- a/src/netlink.c
> +++ b/src/netlink.c
> @@ -258,7 +258,9 @@ int iface_enumerate(int family, void *parm, int (*callback)())
>
> while (RTA_OK(rta, len1))
> {
> - if (rta->rta_type == IFA_ADDRESS)
> + 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));
> else if (rta->rta_type == IFA_CACHEINFO)
> {
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?
Groeten
Geert Stappers
P.S.
@Beniamino welcome to dnsmasq
do know that I'm more sysadmin then C-programmer
--
Silence is hard to parse
More information about the Dnsmasq-discuss
mailing list