[Dnsmasq-discuss] Permutation depends on order of entries in /etc/hosts

Geert Stappers stappers at stappers.nl
Sun Apr 24 08:39:21 UTC 2022


On Fri, Apr 22, 2022 at 11:54:01AM +0000, Christian König wrote:
> Hi all,
> 
> I think I came across a bug.

I'm thinking about http://www.catb.org/~esr/faqs/smart-questions.html#idm368


> Depending of the order of entries in /etc/hosts the permutation of
> answers for queries with more then one entry might not happen. According
> to [1], permutation is the desired behavior.

Acknowledge on
  permutation is the desired behavior.

(Use case: Round robin dns)


> Tested with dnsmasq 2.87test8.
> 
> Minimal example:
> 
> /etc/hosts with
> ```
> 10.0.2.1 gateway.lan
> 10.0.2.2 gateway.lan
> 10.0.2.1 son.lan
> ```
> 
> does permutate the answers to repeated queries by `dig gateway.lan`
> ___
> 
> However, if the order in /etc/hosts is
> ```
> 10.0.2.1 son.lan
> 10.0.2.1 gateway.lan
> 10.0.2.2 gateway.lan
> ```
> the answers are not permutated.


Please test with these four cases:
```
10.0.2.1 gateway.lan son.lan
10.0.2.2 gateway.lan
```

```
10.0.2.2 gateway.lan
10.0.2.1 gateway.lan son.lan
```

```
10.0.2.1 son.lan gateway.lan
10.0.2.2 gateway.lan
```

```
10.0.2.2 gateway.lan
10.0.2.1 son.lan gateway.lan
```

And get karma bonus points for reporting back.



Groeten
Geert Stappers

> [1] https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2008q1/001774.html

That learnt me the use case for the desired behavior: Round robin dns with dnsmasq
-- 
Silence is hard to parse



More information about the Dnsmasq-discuss mailing list