luci: add ip-rules tab page.
This commit is contained in:
@@ -50,7 +50,7 @@ endef
|
||||
|
||||
define Package/smartdns/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/smartdns $(1)/etc/smartdns/domain-set $(1)/etc/smartdns/conf.d/
|
||||
$(INSTALL_DIR) $(1)/etc/smartdns $(1)/etc/smartdns/domain-set $(1)/etc/smartdns/conf.d/ $(1)/etc/smartdns/ip-set
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/smartdns $(1)/usr/sbin/smartdns
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/package/openwrt/files/etc/init.d/smartdns $(1)/etc/init.d/smartdns
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/package/openwrt/address.conf $(1)/etc/smartdns/address.conf
|
||||
|
||||
@@ -362,6 +362,52 @@ load_domain_rule_list()
|
||||
conf_append "domain-rules" "/domain-set:domain-rule-list-${domain_set_name}/ $domain_set_args"
|
||||
}
|
||||
|
||||
ip_rule_addr_append()
|
||||
{
|
||||
conf_append "ip-rules" "$1 $IP_set_args"
|
||||
}
|
||||
|
||||
load_IP_rule_list()
|
||||
{
|
||||
local section="$1"
|
||||
local IP_set_args=""
|
||||
local IP_set_name="$section"
|
||||
|
||||
config_get_bool enabled "$section" "enabled" "0"
|
||||
[ "$enabled" != "1" ] && return
|
||||
|
||||
config_get ip_set_file "$section" "ip_set_file" ""
|
||||
|
||||
config_get_bool whitelist_ip "$section" "whitelist_ip" "0"
|
||||
[ "$whitelist_ip" = "1" ] && IP_set_args="$IP_set_args -whitelist-ip"
|
||||
|
||||
config_get_bool blacklist_ip "$section" "blacklist_ip" "0"
|
||||
[ "$blacklist_ip" = "1" ] && IP_set_args="$IP_set_args -blacklist-ip"
|
||||
|
||||
config_get_bool ignore_ip "$section" "ignore_ip" "0"
|
||||
[ "$ignore_ip" = "1" ] && IP_set_args="$IP_set_args -ignore-ip"
|
||||
|
||||
config_get_bool bogus_nxdomain "$section" "bogus_nxdomain" "0"
|
||||
[ "$bogus_nxdomain" = "1" ] && IP_set_args="$IP_set_args -bogus-nxdomain"
|
||||
|
||||
config_get ip_alias "$section" "ip_alias" ""
|
||||
[ ! -z "$ip_alias" ] && {
|
||||
ip_alias="$(echo "$ip_alias" | sed 's/ /,/g')"
|
||||
IP_set_args="$IP_set_args -ip-alias $ip_alias"
|
||||
}
|
||||
|
||||
config_get addition_flag "$section" "addition_flag" ""
|
||||
[ ! -z "$addition_flag" ] && IP_set_args="$IP_set_args $addition_flag"
|
||||
[ -z "$IP_set_args" ] && return
|
||||
|
||||
[ ! -z "$ip_set_file" ] && [ -e "$ip_set_file" ] && {
|
||||
conf_append "ip-set" "-name ip-rule-list-file-${section} -file '$ip_set_file'"
|
||||
conf_append "ip-rules" "ip-set:ip-rule-list-file-${section} $IP_set_args"
|
||||
}
|
||||
|
||||
config_list_foreach "$section" "ip_addr" ip_rule_addr_append
|
||||
}
|
||||
|
||||
conf_append_bind()
|
||||
{
|
||||
local ADDR=""
|
||||
@@ -667,6 +713,8 @@ load_service()
|
||||
|
||||
config_foreach load_domain_rule_list "domain-rule-list"
|
||||
|
||||
config_foreach load_IP_rule_list "ip-rule-list"
|
||||
|
||||
{
|
||||
echo "conf-file $ADDRESS_CONF"
|
||||
echo "conf-file $BLACKLIST_IP_CONF"
|
||||
|
||||
@@ -48,6 +48,7 @@ build()
|
||||
mkdir $ROOT/root/etc/init.d -p
|
||||
mkdir $ROOT/root/etc/smartdns/ -p
|
||||
mkdir $ROOT/root/etc/smartdns/domain-set/ -p
|
||||
mkdir $ROOT/root/etc/smartdns/ip-set/ -p
|
||||
mkdir $ROOT/root/etc/smartdns/conf.d/ -p
|
||||
|
||||
cp $SMARTDNS_CONF $ROOT/root/etc/smartdns/
|
||||
|
||||
Reference in New Issue
Block a user