Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnsmasq: 'ipset' config sections #3020

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions package/network/services/dnsmasq/files/dnsmasq.init
Expand Up @@ -768,6 +768,29 @@ dhcp_relay_add() {
fi
}

dnsmasq_ipset_add() {
local cfg="$1"
local ipsets domains

add_ipset() {
ipsets="${ipsets:+$ipsets,}$1"
}

add_domain() {
# leading '/' is expected
domains="$domains/$1"
}

config_list_foreach "$cfg" "name" add_ipset
config_list_foreach "$cfg" "domain" add_domain

if [ -z "$ipsets" ] || [ -z "$domains" ]; then
return 0
fi

xappend "--ipset=$domains/$ipsets"
}

dnsmasq_start()
{
local cfg="$1"
Expand Down Expand Up @@ -1054,6 +1077,10 @@ dnsmasq_start()
config_foreach filter_dnsmasq cname dhcp_cname_add "$cfg"
echo >> $CONFIGFILE_TMP

echo >> $CONFIGFILE_TMP
config_foreach filter_dnsmasq ipset dnsmasq_ipset_add "$cfg"
echo >> $CONFIGFILE_TMP

echo >> $CONFIGFILE_TMP
mv -f $CONFIGFILE_TMP $CONFIGFILE
mv -f $HOSTFILE_TMP $HOSTFILE
Expand Down