mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
icwmp: fix shellcheck errors
This commit is contained in:
parent
32ea5ee333
commit
6c6abcd25a
4 changed files with 39 additions and 39 deletions
|
|
@ -8,7 +8,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=9.1.11
|
||||
PKG_VERSION:=9.1.12
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ if [ -z "${zone_name}" ]; then
|
|||
exit 0
|
||||
elif [ "$zone_name" = "icwmp" ]; then
|
||||
iptables -nL zone_icwmp_input 2> /dev/null
|
||||
if [ $? != 0 ]; then
|
||||
if [ "$?" != 0 ]; then
|
||||
iptables -w 1 -N zone_icwmp_input
|
||||
iptables -w 1 -t filter -A INPUT -j zone_icwmp_input
|
||||
iptables -w 1 -I zone_icwmp_input -p tcp --dport $port -j REJECT
|
||||
iptables -w 1 -I zone_icwmp_input -p tcp --dport "${port}" -j REJECT
|
||||
else
|
||||
iptables -w 1 -F zone_icwmp_input
|
||||
iptables -w 1 -I zone_icwmp_input -p tcp --dport $port -j REJECT
|
||||
iptables -w 1 -I zone_icwmp_input -p tcp --dport "${port}" -j REJECT
|
||||
fi
|
||||
else
|
||||
iptables -w 1 -F zone_icwmp_input 2> /dev/null
|
||||
|
|
@ -64,13 +64,13 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
echo ${cmd}|grep -q "\-\-dport \|\-s "
|
||||
echo "${cmd}"|grep -q "\-\-dport \|\-s "
|
||||
if [ "$?" -eq 0 ]; then
|
||||
cmd="${cmd} -j ACCEPT -m comment --comment=Open_ACS_port"
|
||||
${cmd}
|
||||
fi
|
||||
|
||||
echo ${cmd6}|grep -q "\-\-dport \|\-s "
|
||||
echo "${cmd6}"|grep -q "\-\-dport \|\-s "
|
||||
if [ "$?" -eq 0 ]; then
|
||||
cmd6="${cmd6} -j ACCEPT -m comment --comment=Open_ACS_port"
|
||||
${cmd6}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ handle_icwmp_update() {
|
|||
|
||||
ret=$(ubus call service list '{"name":"icwmpd"}' | jsonfilter -qe '@.icwmpd.instances.icwmp.running')
|
||||
|
||||
if [ "$ret" == "true" ]; then
|
||||
if [ "$ret" = "true" ]; then
|
||||
# read status from var/state/cwmp
|
||||
status=$(uci -q -c /var/state get cwmp.sess_status.current_status)
|
||||
if [ "$status" != "running" ]; then
|
||||
|
|
@ -29,4 +29,4 @@ handle_icwmp_update() {
|
|||
fi
|
||||
}
|
||||
|
||||
handle_icwmp_update $@
|
||||
handle_icwmp_update "$@"
|
||||
|
|
|
|||
|
|
@ -23,22 +23,22 @@ regenerate_ssl_link()
|
|||
[ ! -d "${cert_dir}" ] && return 0;
|
||||
|
||||
### Generate all ssl link for pem certicates ###
|
||||
all_file=$(ls $cert_dir/*.pem 2>/dev/null)
|
||||
all_file=$(ls "${cert_dir}"/*.pem 2>/dev/null)
|
||||
if [ -n "${all_file}" ]; then
|
||||
for cfile in $all_file; do
|
||||
rehash="$(openssl x509 -hash -noout -in $cfile)"
|
||||
[ -f ${cert_dir}/${rehash}.0 ] || \
|
||||
ln -s $cfile $cert_dir/${rehash}.0
|
||||
rehash="$(openssl x509 -hash -noout -in "${cfile}")"
|
||||
[ -f "${cert_dir}"/"${rehash}".0 ] || \
|
||||
ln -s "${cfile}" "${cert_dir}"/"${rehash}".0
|
||||
done
|
||||
fi
|
||||
|
||||
### Generate all ssl link for crt certicates ###
|
||||
all_file=$(ls $cert_dir/*.crt 2>/dev/null)
|
||||
all_file=$(ls "${cert_dir}"/*.crt 2>/dev/null)
|
||||
if [ -n "${all_file}" ]; then
|
||||
for cfile in $all_file; do
|
||||
rehash="$(openssl x509 -hash -noout -in $cfile)"
|
||||
[ -f ${cert_dir}/${rehash}.0 ] || \
|
||||
ln -s $cfile $cert_dir/${rehash}.0
|
||||
rehash="$(openssl x509 -hash -noout -in "${cfile}")"
|
||||
[ -f "${cert_dir}"/"${rehash}".0 ] || \
|
||||
ln -s "${cfile}" "${cert_dir}"/"${rehash}".0
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
|
@ -47,8 +47,8 @@ enable_dhcp_option43() {
|
|||
local wan="${1}"
|
||||
|
||||
### Ask for DHCP Option 43 only if CWMP is enabled ###
|
||||
local reqopts="$(uci -q get network.$wan.reqopts)"
|
||||
local proto="$(uci -q get network.$wan.proto)"
|
||||
local reqopts="$(uci -q get network."${wan}".reqopts)"
|
||||
local proto="$(uci -q get network."${wan}".proto)"
|
||||
local newreqopts=""
|
||||
local option43_present=0
|
||||
|
||||
|
|
@ -64,8 +64,8 @@ enable_dhcp_option43() {
|
|||
fi
|
||||
|
||||
newreqopts="$reqopts 43"
|
||||
if [ "${proto}" == "dhcp" ]; then
|
||||
uci -q set network.$wan.reqopts="$newreqopts"
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
uci -q set network."${wan}".reqopts="$newreqopts"
|
||||
uci commit network
|
||||
ubus call network reload
|
||||
fi
|
||||
|
|
@ -122,12 +122,12 @@ configure_send_op125() {
|
|||
serial_len=$(echo -n "${serial}" | wc -m)
|
||||
class_len=$(echo -n "${class}" | wc -m)
|
||||
|
||||
if [ ${oui_len} -eq 0 ] || [ ${serial_len} -eq 0 ]; then
|
||||
if [ "${oui_len}" -eq 0 ] || [ "${serial_len}" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
opt125_len=$((oui_len + serial_len + class_len))
|
||||
if [ ${class_len} -gt 0 ]; then
|
||||
if [ "${class_len}" -gt 0 ]; then
|
||||
opt125_len=$((opt125_len + 6))
|
||||
else
|
||||
opt125_len=$((opt125_len + 4))
|
||||
|
|
@ -159,7 +159,7 @@ configure_send_op125() {
|
|||
opt125="${opt125}:05:${hex_serial_len}${hex_serial}"
|
||||
fi
|
||||
|
||||
if [ ${class_len} -gt 0 ]; then
|
||||
if [ "${class_len}" -gt 0 ]; then
|
||||
hex_class=$(convert_to_hex "${class}")
|
||||
if [ -z "${hex_class}" ]; then
|
||||
return 0
|
||||
|
|
@ -176,9 +176,9 @@ configure_send_op125() {
|
|||
|
||||
if [ "${uci}" = "network" ]; then
|
||||
new_send_opt="$sendopt $opt125"
|
||||
uci -q set network.$intf.sendopts="$new_send_opt"
|
||||
uci -q set network."${intf}".sendopts="$new_send_opt"
|
||||
else
|
||||
uci -q add_list dhcp.$intf.dhcp_option="$opt125"
|
||||
uci -q add_list dhcp."${intf}".dhcp_option="$opt125"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -187,9 +187,9 @@ enable_dnsmasq_option125() {
|
|||
local send125_present=0
|
||||
local opt125="125,"
|
||||
|
||||
local proto="$(uci -q get dhcp.$lan.dhcpv4)"
|
||||
local proto="$(uci -q get dhcp."${lan}".dhcpv4)"
|
||||
if [ "${proto}" = "server" ]; then
|
||||
opt_list="$(uci -q get dhcp.$lan.dhcp_option)"
|
||||
opt_list="$(uci -q get dhcp."${lan}".dhcp_option)"
|
||||
|
||||
for sopt in $opt_list; do
|
||||
if [[ "$sopt" == "$opt125"* ]]; then
|
||||
|
|
@ -207,15 +207,15 @@ enable_dnsmasq_option125() {
|
|||
|
||||
set_vendor_id() {
|
||||
local wan="${1}"
|
||||
local proto="$(uci -q get network.$wan.proto)"
|
||||
local proto="$(uci -q get network."${wan}".proto)"
|
||||
|
||||
if [ "${proto}" == "dhcp" ]; then
|
||||
vendorid="$(uci -q get network.$wan.vendorid)"
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
vendorid="$(uci -q get network."${wan}".vendorid)"
|
||||
if [ -z "${vendorid}" ]; then
|
||||
uci -q set network.$wan.vendorid="dslforum.org"
|
||||
uci -q set network."${wan}".vendorid="dslforum.org"
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
elif [[ $vendorid != *"dslforum.org"* ]]; then
|
||||
uci -q set network.$wan.vendorid="${vendorid},dslforum.org"
|
||||
uci -q set network."${wan}".vendorid="${vendorid},dslforum.org"
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
fi
|
||||
fi
|
||||
|
|
@ -223,9 +223,9 @@ set_vendor_id() {
|
|||
|
||||
enable_dhcp_option125() {
|
||||
local wan="${1}"
|
||||
local reqopts="$(uci -q get network.$wan.reqopts)"
|
||||
local sendopts="$(uci -q get network.$wan.sendopts)"
|
||||
local proto="$(uci -q get network.$wan.proto)"
|
||||
local reqopts="$(uci -q get network."${wan}".reqopts)"
|
||||
local sendopts="$(uci -q get network."${wan}".sendopts)"
|
||||
local proto="$(uci -q get network."${wan}".proto)"
|
||||
local newreqopts=""
|
||||
local newsendopts=""
|
||||
local req125_present=0
|
||||
|
|
@ -247,10 +247,10 @@ enable_dhcp_option125() {
|
|||
fi
|
||||
done
|
||||
|
||||
if [ "${proto}" == "dhcp" ]; then
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
if [ ${req125_present} -eq 0 ]; then
|
||||
newreqopts="$reqopts 125"
|
||||
uci -q set network.$wan.reqopts="$newreqopts"
|
||||
uci -q set network."${wan}".reqopts="$newreqopts"
|
||||
network_uci_update=1
|
||||
fi
|
||||
|
||||
|
|
@ -389,7 +389,7 @@ boot() {
|
|||
config_get dhcp_discovery acs dhcp_discovery "0"
|
||||
config_get wan_interface cpe default_wan_interface "wan"
|
||||
|
||||
if [ "${dhcp_discovery}" == "enable" ] || [ "${dhcp_discovery}" == "1" ]; then
|
||||
if [ "${dhcp_discovery}" = "enable" ] || [ "${dhcp_discovery}" = "1" ]; then
|
||||
# Set dhcp option 43 if not already configured
|
||||
enable_dhcp_option43 "${wan_interface}"
|
||||
# Set dhcp option 60
|
||||
|
|
@ -473,7 +473,7 @@ reload_service() {
|
|||
return 0
|
||||
fi
|
||||
|
||||
status="$(echo $tr069_status | jsonfilter -qe '@.cwmp.status')"
|
||||
status="$(echo "${tr069_status}" | jsonfilter -qe '@.cwmp.status')"
|
||||
ret="$?"
|
||||
if [ "$status" = "up" ]; then
|
||||
ubus -t 1 call tr069 command '{"command":"reload"}'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue