Skip to content

Commit

Permalink
适配OpenWrt“DHCP/DNS-IP集”配置中多个IP集使用同一个域名列表时的情况
Browse files Browse the repository at this point in the history
  • Loading branch information
larsonzh committed Nov 12, 2022
1 parent ec35f9a commit f79fef1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions release/lzrules/lzrules.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# lzrules.sh v1.0.6
# lzrules.sh v1.0.7
# By LZ 妙妙呜 ([email protected])

# LZ RULES script for OpenWrt based router
Expand Down Expand Up @@ -209,7 +209,7 @@ CUSTOM_IPSETS_LST=""
DNAME_IPSETS_LST=""

# 版本号
LZ_VERSION=v1.0.6
LZ_VERSION=v1.0.7

# 项目标识
PROJECT_ID="lzrules"
Expand Down Expand Up @@ -566,7 +566,7 @@ print_wan_ispip_item_num() {
local buf=""
for name in ${DNAME_IPSETS_LST}
do
buf="$( uci show "${HOST_DHCP_FILENAME}" 2> /dev/null | awk -F '.' '$0 ~ "'"name=\'${name}\'"'" {print $2}' )"
buf="$( uci show "${HOST_DHCP_FILENAME}" 2> /dev/null | awk -F '.' '$2 ~ /^@ipset/ && $3 ~ "'"^name=.*\'${name}\'"'" {print $2}' )"
[ -n "${buf}" ] && buf="$( uci get "${HOST_DHCP_FILENAME}.${buf}.domain" 2> /dev/null | awk '{print NF; exit}' )"
[ -z "${buf}" ] && buf="0"
num="$( get_ipset_total "${name}" )"
Expand Down Expand Up @@ -640,7 +640,7 @@ load_ipsets() {
[ -n "${DNAME_IPSETS_LST}" ] && /etc/init.d/dnsmasq restart > /dev/null 2>&1
for name in ${DNAME_IPSETS_LST}
do
buf="$( uci show "${HOST_DHCP_FILENAME}" 2> /dev/null | awk -F '.' '$0 ~ "'"name=\'${name}\'"'" {print $2}' )"
buf="$( uci show "${HOST_DHCP_FILENAME}" 2> /dev/null | awk -F '.' '$2 ~ /^@ipset/ && $3 ~ "'"^name=.*\'${name}\'"'" {print $2}' )"
[ -n "${buf}" ] && uci get "${HOST_DHCP_FILENAME}.${buf}.domain" 2> /dev/null \
| sed -e 's/[ \t][ \t]*/\n/g' -e '/^[ \t]*$/d' \
| awk '{system("nslookup -type=a "$1" > /dev/null 2>&1")}'
Expand Down

0 comments on commit f79fef1

Please sign in to comment.