[Dnsmasq-discuss] [PATCH v2] Support Cisco Umbrella/OpenDNS Device ID & Remote IP

Simon Kelley simon at thekelleys.org.uk
Fri Apr 9 16:59:32 UTC 2021

Much better, thank you. One error I can see, inline below.

> +  if (daemon->umbrella_device) {
> +    PUTLONG(daemon->umbrella_device >> 32, u)
> +    PUTLONG(daemon->umbrella_device & 0xffffffff, u)

This isn't going to work: you populate daemon->umbrella_device with
strtoll, so the bytes in memory (for 0x0123456780abcdef) will be

0x01 0x23 0x45 0x67 0x89 0xab 0xcd 0xef

or a big-endian host and

0xef 0xcd 0xab 0x89 0x67 0x45 0x23 0x01

on a little endian host.

On a big endian host, PUTLONG won't swap the bytes, since
network-endianess is big endian, but on a little endian host, it will.
You can't however byteswap a 64-bit value in two chunks of 32 bits,
you'll get

0x89 0xab 0xcd 0xef 0x01 0x23 0x45 0x67

the original code for parsing umbrella_device is better, just needs to
be moved to option.c



More information about the Dnsmasq-discuss mailing list