[Dnsmasq-discuss] [PATCH] IDN parameter enablement & domain_len optimization

Simon Kelley simon at thekelleys.org.uk
Wed Oct 6 22:52:59 UTC 2021


On 30/09/2021 22:16, Petr Menšík wrote:
> Hi,
> 
> I am submitting patch enabling IDN usage for input parameters. We have
> support for IDN, but because locale is not properly initialized, no
> parameters using special characters are accepted.
> 
> Patch #1 adds domain_len to more places, quite similar to struct server
> and struct serv_local. It computes length of saved domain only once and
> uses it on various processing. Just small optimization on not critical
> bits, since main lookup_domain already uses it. I think it should be
> used on more places.
> 
> I think we could define someting like struct binstring { char *str, u16
> len }; and use it more in code. Pairs of string and its length are
> common and handled different way. Because just basic char * is used on
> many places, strlen is called again and again, often not required.
> Especially might be useful for DHCP binary strings processing.
> 
> Patch #2 enables --address=/münchen.de/háčkyčárky.cz/ on input even on
> builds without defined LOCALEDIR. Which is missing on Fedora and it
> seems IDN support is effectively inactive that way. Adds --auth-zone
> support for IDN too.
> 
> Patch #3 disables IDN_TRANSITIONAL mode. I wanted to try some refused
> IDN name, but transitional mode accepts almost any character. It accepts
> also --address=/💻🚱.test/. I think there is no need to support such
> obscure names, but we should accept normal names supported by browsers.
> Since I think IDN 2003 support were not properly enabled before, I think
> we should start just from IDN 2008 standard.
> 
> I think there is still something weird, because --address=/испытание./
> is accepted but --address=/испытание/ is not. Improvement anyway.
> 

Applied 2 and 3. Not applied 1 but extracted and applied auth-zone code.

I'm not sure there's any point to the domain-len stuff, even from a
performance point of view, since the tests are all strlen(string) == 0,
which will be compiled as *string == 0 by any sane compiler.

I added the domain_len field for struct server since the search code
does lots of comparisons of (non-zero) domain string lengths.


Cheers,

Simon.






More information about the Dnsmasq-discuss mailing list