icwmp: Fix firewall rule on reload

This commit is contained in:
Vivek Kumar Dutta 2025-04-07 13:39:04 +05:30
parent 86d7bf8c67
commit 941a46dae6
No known key found for this signature in database
GPG key ID: 4E09F5AD8265FD4C
2 changed files with 8 additions and 9 deletions

View file

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=icwmp
PKG_VERSION:=9.9.0
PKG_VERSION:=9.9.1
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/icwmp.git
PKG_SOURCE_VERSION:=dc2cf6979d40658c7da65686d9c9fa1b3000e115
PKG_SOURCE_VERSION:=e0fde6e9134afcf3ddd307ff13f4891e189cd6ea
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View file

@ -6,7 +6,7 @@ log() {
}
get_firewall_zone() {
zone="$(uci show firewall|grep network|grep -w ${1}|cut -d. -f 2)"
zone="$(uci show firewall|grep network|grep -w "${1}"|cut -d. -f 2)"
zone="${zone:-wan}" # defaults to wan zone
echo "$zone"
}
@ -82,7 +82,7 @@ add_firewall_rule() {
return
fi
if [ "${version}" == "ipv6" ]; then
if [ "${version}" = "ipv6" ]; then
cmd="ip6tables -w 1 -I zone_${zone_name}_input -p tcp"
else
cmd="iptables -w 1 -I zone_${zone_name}_input -p tcp"
@ -96,8 +96,7 @@ add_firewall_rule() {
cmd="${cmd} --dport ${port}"
fi
echo "${cmd}"|grep -q "\-\-dport \|\-s "
if [ "$?" -eq 0 ]; then
if echo "${cmd}"|grep -q "\-\-dport \|\-s "; then
cmd="${cmd} -j ACCEPT -m comment --comment=Open_ACS_port"
${cmd}
log "Applied [${cmd}]"
@ -140,7 +139,7 @@ configure_connection_req_rules() {
fi
if [ -z "${app}" ]; then
if ! ubus -t 1 list tr069 2>/dev/null;
if ! ubus -t 1 list tr069 2>/dev/null; then
log "cwmp client not running"
exit 0
fi
@ -152,7 +151,7 @@ configure_connection_req_rules() {
ipaddr=$(uci -q get cwmp.cpe.allowed_cr_ip)
if [ -n "${ipaddr}" ]; then
for ip in $ipaddr; do
if [[ "${ip}" =~ ":" ]]; then
if echo "${ip}" | grep -q ":"; then
add_firewall_rule "ipv6" "${ip}" "${port}" "${wan_zone_name}"
else
add_firewall_rule "ipv4" "${ip}" "${port}" "${wan_zone_name}"
@ -170,4 +169,4 @@ configure_connection_req_rules() {
fi
}
configure_connection_req_rules $@
configure_connection_req_rules "$@"