Re: [Dnsmasq-discuss] Method to get Dnsmasq serve address of a host from interface address
This is really the function of the dnsmasq.conf.example file that's ditsributed with the source code for dnsmasq. Unfortunately that has become rather out-of-date. It could do with a major overhaul. Simon. On 14/03/2023 07:55, Olivier wrote: Hello, Could it be possible to add an example in interface-name section of dnsmasq.conf man page as IMHO, current content is not very easy to understand. Best regards ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Method to get Dnsmasq serve address of a host from interface address
Hello, Could it be possible to add an example in interface-name section of dnsmasq.conf man page as IMHO, current content is not very easy to understand. Best regards ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Method to get Dnsmasq serve address of a host from interface address
Thank you Simon for the quick reply, I did indeed miss `interface-name` when skimming through the manual page and from the looks of it other users on this thread did too. My suggestion is to have interface-name and dynamic-host mention each other in the manual page and to modify the error message `warning: no addresses found for interface dsl-provider` to something less cryptic. The only reason I used dynamic-host is because it was first in the manual page (I know it's not an excuse for not reading thoroughly, but it seemed to do what I wanted and I didn't think that there was something better). Thanks again! On 3/13/23 19:01, Simon Kelley wrote: Thanks for the bug report, it's definitely not noise. The history of line 363 is interesting. When the dynamic-host option was added, it looked like if (netmask.s_addr == 0x) and stayed like that until October 2022 when it got changed to the current version if (netmask.s_addr == 0x) That's what was released as part of 2.88 So that explains why it used to work for you, and no longer does in 2.88 and 2.89. If your PPoe interface had netmask 255.255.0.0 then it would not have worked previously, but would work now. The change was prompted by this email to the list. https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2022q4/016607.html and the explanation that it looks like the intention was to skip interfaces with /32 prefixes looks pretty sensible, so the patch went in without too much thought. My dilemma is that I can't see the reason to do that and I have no recollection of why I might done it in early 2021 when dynamic-host was first implemented. Someone should invent a way to core-dump human brain state to git for future reference. The best I can come up with is that what you are trying to do is not what I expected dynamic-host to be used for. I expected it to be used to name hosts on an internal network whose prefix was supplied by the ISP, typically in IPv6-land with prefix delegation. So the host is not the one running dnsmasq but another host connected to the same network as the interface but with a suffix. Clearly that can only exist when the prefix length is smaller than 32(IPv4) or 128(IPv6). Actually, it's reasonable not to have considered your "weird hack", because dnsmasq has had an explicit mechanism to do what you want for a long time, interface-name. You could just use. interface-name=myip.my.local.domain,dsl-provider So. There's an easier way to do what you want to do. Your "weird hack" used to work because the code that was supposed to stop it used to be buggy and didn't. The bug got fixed in 2.88 and now does stop your weird hack. There's a very limited need for the once-buggy, now fixed code and I can't really remember what it was for. Going forward we have three options for line 363 1) revert the October 2022 change. That would be stupid. 2) leave as is and educate people to use interface-name for this and not hack dynamic-host 3) remove it so that people skimming the man page who find dynamic-host before they find interface-name and rediscover your "weird hack" are not bewildered. This would also avoid people who found and used the "weird hack" in pre-2.88 releases from suffering a regression when they upgrade. For that last reason alone, I propose option 3. Comments? Cheers, Simon. On 13/03/2023 00:31, 0zl wrote: Well, it seems like dnsmasq just ignores addresses with /32s. I see in src/network.c for some reason if an interface has 255.255.255.255 it just skips it (line 363)? This might possibly the cause for the issue, I'm not sure if this is intentional or some sort of bug. Thanks again and sorry for the noise! On 3/13/23 02:08, 0zl wrote: Hi everyone, Previously on Debian Stable, I was using dynamic-host as a weird hack to get Dnsmasq to serve my PPPOE interface's IP address however this no longer seems to work with the Dnsmasq supplied in Debian Testing. It was OK to just specify 0.0.0.0 as my ISP would allocate for me a /32 and so this thankfully matched my interface address and worked properly. Now that this no longer works on 2.89, are there any alternatives I could use? (What no longer works is `dynamic-host=myip.my.local.domain,0.0.0.0,dsl-provider` and Dnsmasq fails with `warning: no addresses found for interface dsl-provider`) TIA ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Method to get Dnsmasq serve address of a host from interface address
On 13/03/2023 17:01, Simon Kelley wrote: Thanks for the bug report, it's definitely not noise. The history of line 363 is interesting. When the dynamic-host option was added, it looked like if (netmask.s_addr == 0x) and stayed like that until October 2022 when it got changed to the current version if (netmask.s_addr == 0x) That's what was released as part of 2.88 So that explains why it used to work for you, and no longer does in 2.88 and 2.89. If your PPoe interface had netmask 255.255.0.0 then it would not have worked previously, but would work now. The change was prompted by this email to the list. https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2022q4/016607.html and the explanation that it looks like the intention was to skip interfaces with /32 prefixes looks pretty sensible, so the patch went in without too much thought. My dilemma is that I can't see the reason to do that and I have no recollection of why I might done it in early 2021 when dynamic-host was first implemented. Someone should invent a way to core-dump human brain state to git for future reference. The best I can come up with is that what you are trying to do is not what I expected dynamic-host to be used for. I expected it to be used to name hosts on an internal network whose prefix was supplied by the ISP, typically in IPv6-land with prefix delegation. So the host is not the one running dnsmasq but another host connected to the same network as the interface but with a suffix. Clearly that can only exist when the prefix length is smaller than 32(IPv4) or 128(IPv6). Actually, it's reasonable not to have considered your "weird hack", because dnsmasq has had an explicit mechanism to do what you want for a long time, interface-name. You could just use. interface-name=myip.my.local.domain,dsl-provider So. There's an easier way to do what you want to do. Your "weird hack" used to work because the code that was supposed to stop it used to be buggy and didn't. The bug got fixed in 2.88 and now does stop your weird hack. There's a very limited need for the once-buggy, now fixed code and I can't really remember what it was for. Going forward we have three options for line 363 1) revert the October 2022 change. That would be stupid. 2) leave as is and educate people to use interface-name for this and not hack dynamic-host 3) remove it so that people skimming the man page who find dynamic-host before they find interface-name and rediscover your "weird hack" are not bewildered. This would also avoid people who found and used the "weird hack" in pre-2.88 releases from suffering a regression when they upgrade. For that last reason alone, I propose option 3. Comments? Cheers, Simon. Replying to myself, there's further evidence of the intention behind line 363 in the analogous code for IPv6, around line 401. /* No sense in doing /128. */ if (prefixlen == 128) continue; If 363 goes, 401 should go too. Simon. On 13/03/2023 00:31, 0zl wrote: Well, it seems like dnsmasq just ignores addresses with /32s. I see in src/network.c for some reason if an interface has 255.255.255.255 it just skips it (line 363)? This might possibly the cause for the issue, I'm not sure if this is intentional or some sort of bug. Thanks again and sorry for the noise! On 3/13/23 02:08, 0zl wrote: Hi everyone, Previously on Debian Stable, I was using dynamic-host as a weird hack to get Dnsmasq to serve my PPPOE interface's IP address however this no longer seems to work with the Dnsmasq supplied in Debian Testing. It was OK to just specify 0.0.0.0 as my ISP would allocate for me a /32 and so this thankfully matched my interface address and worked properly. Now that this no longer works on 2.89, are there any alternatives I could use? (What no longer works is `dynamic-host=myip.my.local.domain,0.0.0.0,dsl-provider` and Dnsmasq fails with `warning: no addresses found for interface dsl-provider`) TIA ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Method to get Dnsmasq serve address of a host from interface address
Thanks for the bug report, it's definitely not noise. The history of line 363 is interesting. When the dynamic-host option was added, it looked like if (netmask.s_addr == 0x) and stayed like that until October 2022 when it got changed to the current version if (netmask.s_addr == 0x) That's what was released as part of 2.88 So that explains why it used to work for you, and no longer does in 2.88 and 2.89. If your PPoe interface had netmask 255.255.0.0 then it would not have worked previously, but would work now. The change was prompted by this email to the list. https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2022q4/016607.html and the explanation that it looks like the intention was to skip interfaces with /32 prefixes looks pretty sensible, so the patch went in without too much thought. My dilemma is that I can't see the reason to do that and I have no recollection of why I might done it in early 2021 when dynamic-host was first implemented. Someone should invent a way to core-dump human brain state to git for future reference. The best I can come up with is that what you are trying to do is not what I expected dynamic-host to be used for. I expected it to be used to name hosts on an internal network whose prefix was supplied by the ISP, typically in IPv6-land with prefix delegation. So the host is not the one running dnsmasq but another host connected to the same network as the interface but with a suffix. Clearly that can only exist when the prefix length is smaller than 32(IPv4) or 128(IPv6). Actually, it's reasonable not to have considered your "weird hack", because dnsmasq has had an explicit mechanism to do what you want for a long time, interface-name. You could just use. interface-name=myip.my.local.domain,dsl-provider So. There's an easier way to do what you want to do. Your "weird hack" used to work because the code that was supposed to stop it used to be buggy and didn't. The bug got fixed in 2.88 and now does stop your weird hack. There's a very limited need for the once-buggy, now fixed code and I can't really remember what it was for. Going forward we have three options for line 363 1) revert the October 2022 change. That would be stupid. 2) leave as is and educate people to use interface-name for this and not hack dynamic-host 3) remove it so that people skimming the man page who find dynamic-host before they find interface-name and rediscover your "weird hack" are not bewildered. This would also avoid people who found and used the "weird hack" in pre-2.88 releases from suffering a regression when they upgrade. For that last reason alone, I propose option 3. Comments? Cheers, Simon. On 13/03/2023 00:31, 0zl wrote: Well, it seems like dnsmasq just ignores addresses with /32s. I see in src/network.c for some reason if an interface has 255.255.255.255 it just skips it (line 363)? This might possibly the cause for the issue, I'm not sure if this is intentional or some sort of bug. Thanks again and sorry for the noise! On 3/13/23 02:08, 0zl wrote: Hi everyone, Previously on Debian Stable, I was using dynamic-host as a weird hack to get Dnsmasq to serve my PPPOE interface's IP address however this no longer seems to work with the Dnsmasq supplied in Debian Testing. It was OK to just specify 0.0.0.0 as my ISP would allocate for me a /32 and so this thankfully matched my interface address and worked properly. Now that this no longer works on 2.89, are there any alternatives I could use? (What no longer works is `dynamic-host=myip.my.local.domain,0.0.0.0,dsl-provider` and Dnsmasq fails with `warning: no addresses found for interface dsl-provider`) TIA ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Method to get Dnsmasq serve address of a host from interface address
Hi 0zl and everyone, I’m writing to add some more information about this issue and my personal use case that falls on the same problem. I have being using dnsmasq for a couple of years now, with Pi-Hole project. In the last year I started using tailscale as a VPN to connect directly to some machines and use my dnsmasq server as DNS resolver while I’m outside my local network. In order to easily access the services deployed across my personal machines I created some entries in dnsmasq, with dynamic-host option to properly solve depending where the request was coming from. Since version 2.88 this setup stopped working, not correctly resolving the queries arriving from the tailscale interface. This issue was caused by the same problem 0zl is reporting, the tailscale interface had a /32 mask. There are good reasons for tailscale to use a /32, some are in the discussion that I had in the GitHub of the project about this problem: https://github.com/tailscale/tailscale/issues/7340 There was also a relevante discussion about this problem, in the pi-hole project where the code change was identified (src/dnsmasq/network.c:365) https://github.com/pi-hole/FTL/issues/1531 My suggestion is to allow use cases where the network interface has a /32 mask. Maybe via flag to manually add interfaces (ignore such filtering based on the mask) or a flag to disable the behaviour of filtering. Thanks in advance and will be looking forward for a solution, Eduardo. ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Method to get Dnsmasq serve address of a host from interface address
Well, it seems like dnsmasq just ignores addresses with /32s. I see in src/network.c for some reason if an interface has 255.255.255.255 it just skips it (line 363)? This might possibly the cause for the issue, I'm not sure if this is intentional or some sort of bug. Thanks again and sorry for the noise! On 3/13/23 02:08, 0zl wrote: Hi everyone, Previously on Debian Stable, I was using dynamic-host as a weird hack to get Dnsmasq to serve my PPPOE interface's IP address however this no longer seems to work with the Dnsmasq supplied in Debian Testing. It was OK to just specify 0.0.0.0 as my ISP would allocate for me a /32 and so this thankfully matched my interface address and worked properly. Now that this no longer works on 2.89, are there any alternatives I could use? (What no longer works is `dynamic-host=myip.my.local.domain,0.0.0.0,dsl-provider` and Dnsmasq fails with `warning: no addresses found for interface dsl-provider`) TIA ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
[Dnsmasq-discuss] Method to get Dnsmasq serve address of a host from interface address
Hi everyone, Previously on Debian Stable, I was using dynamic-host as a weird hack to get Dnsmasq to serve my PPPOE interface's IP address however this no longer seems to work with the Dnsmasq supplied in Debian Testing. It was OK to just specify 0.0.0.0 as my ISP would allocate for me a /32 and so this thankfully matched my interface address and worked properly. Now that this no longer works on 2.89, are there any alternatives I could use? (What no longer works is `dynamic-host=myip.my.local.domain,0.0.0.0,dsl-provider` and Dnsmasq fails with `warning: no addresses found for interface dsl-provider`) TIA ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss