<div dir="ltr">Hi,<br><br>I wrote a patch to add nftables set support to dnsmasq. The patch is<br>available at <a href="https://github.com/Fugoes/dnsmasq">https://github.com/Fugoes/dnsmasq</a>. It is in an early stage,<br>though I have tested it with a configuration file with ~70000 nftables<br>set rules and it works just fine.<br><br>I think this feature is quite useful, e.g. Debian 10 has switched to<br>nftables backend by default, and ipset is not available.<br><br>Here are some notes on this patch:<br>- It uses libnftables to execute nftables operations. This library is<br>  kind of a high level library. libnftables provides an interface with<br>  nft's cli interface:<br>  > int nft_run_cmd_from_buffer(struct nft_ctx *nft, const char *buf);<br>  The library does not invoke fork(). The only overhead is parsing the<br>  command. libnftables is based on libnftnl, and libnftnl is based on<br>  libnl. The overhead of parsing could be avoided by using libnftnl or<br>  even libnl. However, I could not find useful documentation of<br>  libnftnl, so I go with libnftables.<br>- It uses a radix-tree-like data structure (as well as a hash table) to<br>  search for domain name's nftables set name. Check the src/dntree.*<br>  files for more information.<br><br>nftables set's "add" command does NOT reset the target entry's timeout<br>value, while ipset's "add" command would reset it. AFAIK, there is no<br>direct way to implement ipset's "add" command's behavior in nftables.<br>Any suggestions?<br><br>-- <br>Qi-An Fu<br></div>