<div dir="auto">ok, i agree, if wrong family, at most, it is ignored by ipset.</div><div dir="auto"><br></div><div dir="auto">but, if <span style="color:rgb(49,49,49);word-spacing:1px">ipset=/</span><a href="http://google.com/proxyv4,proxyv6" rel="noreferrer" target="_blank" style="font-size:1rem;word-spacing:1px">google.com/proxyv4,proxyv6</a></div><div dir="auto"><br></div><div dir="auto">then, likely dnsmasq will run ipset add at least 4 times ( twice for one ipv4 and twice for one ipv6) </div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Mon, Jan 10, 2022 at 06:14 Simon Kelley <<a href="mailto:simon@thekelleys.org.uk">simon@thekelleys.org.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 09/01/2022 06:37, Justin wrote:<br>
> So. i have<br>
> <br>
> local=/<a href="http://google.com/8.8.8.8" rel="noreferrer" target="_blank">google.com/8.8.8.8</a><br>
> ipset=/<a href="http://google.com/proxy" rel="noreferrer" target="_blank">google.com/proxy</a><br>
> <br>
> when "curl <a href="http://google.com" rel="noreferrer" target="_blank">google.com</a>"<br>
> dnsmasq log shows:<br>
> <br>
> ipset add proxy 142.250.217.142 <a href="http://google.com" rel="noreferrer" target="_blank">google.com</a><br>
> ipset add proxy 2607:f8b0:4007:818::200e <a href="http://google.com" rel="noreferrer" target="_blank">google.com</a><br>
> <br>
> looks like dnsmasq does not check the SETNAME "proxy" is ipv4 or ipv6.<br>
> so "ipset add proxy 2607:f8b0:4007:818::200e <a href="http://google.com" rel="noreferrer" target="_blank">google.com</a>" is not going to work.<br>
> <br>
> while on ipset command:<br>
> <br>
> "ipset create testname hash:net" by default creates an ipv4 family.<br>
> there seems to be no way to create a SETNAME that contains both ipv4<br>
> and ipv6 family.<br>
> <br>
> finally, my suggestion: can dnsmasq check and SETNAME family and don't<br>
> try to add ipv4 or ipv6 ip to wrong family?<br>
> <br>
<br>
<br>
It could, and there are two ways it could.<br>
<br>
1) Check the address family of the ipset at startup - this will<br>
misbehave if the ipset is (for instance) deleted and recreated with a<br>
different AF.<br>
<br>
2) Check the address family of the ipset each time it does an insertion.<br>
This is OK, but it's actually more work than what happens now, which is<br>
that the code attempts to insert the address anyway, and if it's the<br>
wrong AF, the ipset code ignores it.<br>
<br>
<br>
The main downside to the current system is that the logging is<br>
misleading. Maybe just mentioning this behaviour in the man page is the<br>
best fix?<br>
<br>
<br>
If you're interesting in IPv6 and IPv4 addresses, you need two ipsets<br>
and something like<br>
<br>
ipset=/<a href="http://google.com/proxyv4,proxyv6" rel="noreferrer" target="_blank">google.com/proxyv4,proxyv6</a><br>
<br>
<br>
Cheers<br>
<br>
Simon.<br>
<br>
> thanks<br>
> <br>
> _______________________________________________<br>
> Dnsmasq-discuss mailing list<br>
> <a href="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk" target="_blank">Dnsmasq-discuss@lists.thekelleys.org.uk</a><br>
> <a href="https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss" rel="noreferrer" target="_blank">https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss</a><br>
> <br>
<br>
<br>
_______________________________________________<br>
Dnsmasq-discuss mailing list<br>
<a href="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk" target="_blank">Dnsmasq-discuss@lists.thekelleys.org.uk</a><br>
<a href="https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss" rel="noreferrer" target="_blank">https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss</a><br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><br>Regards<br>Justin He</div>