olsr: fix minor complain from 'shellcheck'
This commit is contained in:
parent
22c05861e6
commit
67939e59a2
1 changed files with 19 additions and 11 deletions
|
@ -176,6 +176,7 @@ olsrd_write_plparam() {
|
||||||
else
|
else
|
||||||
warning_invalid_value olsrd "$cfg" "NonOlsrIf"
|
warning_invalid_value olsrd "$cfg" "NonOlsrIf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -z "$ifname" ] || value=$ifname
|
[ -z "$ifname" ] || value=$ifname
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -184,15 +185,16 @@ olsrd_write_plparam() {
|
||||||
|
|
||||||
config_update_schema() {
|
config_update_schema() {
|
||||||
local schema_varname="$1"
|
local schema_varname="$1"
|
||||||
validate_varname "$schema_varname" || return 1
|
|
||||||
local command="$2"
|
local command="$2"
|
||||||
validate_varname "$command" || return 1
|
|
||||||
local option="$3"
|
local option="$3"
|
||||||
validate_varname "$option" || return 1
|
|
||||||
local value="$4"
|
local value="$4"
|
||||||
local schema
|
local schema
|
||||||
local cur_option
|
local cur_option
|
||||||
|
|
||||||
|
validate_varname "$schema_varname" || return 1
|
||||||
|
validate_varname "$command" || return 1
|
||||||
|
validate_varname "$option" || return 1
|
||||||
|
|
||||||
case "$varname" in
|
case "$varname" in
|
||||||
*_LENGTH) return 0;;
|
*_LENGTH) return 0;;
|
||||||
*_ITEM*) return 0;;
|
*_ITEM*) return 0;;
|
||||||
|
@ -393,6 +395,8 @@ olsrd_write_olsrd() {
|
||||||
|
|
||||||
config_get smartgateway "$cfg" SmartGateway
|
config_get smartgateway "$cfg" SmartGateway
|
||||||
config_get smartgatewayuplink "$cfg" SmartGatewayUplink
|
config_get smartgatewayuplink "$cfg" SmartGatewayUplink
|
||||||
|
export smartgateway
|
||||||
|
export smartgatewayuplink
|
||||||
|
|
||||||
config_write_options "$OLSRD_OLSRD_SCHEMA" "$cfg" olsrd_write_option
|
config_write_options "$OLSRD_OLSRD_SCHEMA" "$cfg" olsrd_write_option
|
||||||
echo
|
echo
|
||||||
|
@ -599,13 +603,13 @@ olsrd_write_interface_defaults() {
|
||||||
|
|
||||||
olsrd_update_schema() {
|
olsrd_update_schema() {
|
||||||
local command="$1"
|
local command="$1"
|
||||||
validate_varname "$command" || return 0
|
|
||||||
local varname="$2"
|
local varname="$2"
|
||||||
validate_varname "$varname" || return 0
|
|
||||||
local value="$3"
|
local value="$3"
|
||||||
local cfg="$CONFIG_SECTION"
|
local cfg="$CONFIG_SECTION"
|
||||||
local cfgt
|
local cfgt
|
||||||
local cur_varname
|
|
||||||
|
validate_varname "$command" || return 0
|
||||||
|
validate_varname "$varname" || return 0
|
||||||
|
|
||||||
config_get cfgt "$cfg" TYPE
|
config_get cfgt "$cfg" TYPE
|
||||||
case "$cfgt" in
|
case "$cfgt" in
|
||||||
|
@ -643,7 +647,7 @@ get_wan_ifnames()
|
||||||
{
|
{
|
||||||
local wanifnames word catch_next
|
local wanifnames word catch_next
|
||||||
|
|
||||||
which ip >/dev/null || return 1
|
command -v ip >/dev/null || return 1
|
||||||
|
|
||||||
set -- $( ip route list exact 0.0.0.0/0 table all )
|
set -- $( ip route list exact 0.0.0.0/0 table all )
|
||||||
for word in $*; do
|
for word in $*; do
|
||||||
|
@ -672,8 +676,10 @@ get_wan_ifnames()
|
||||||
|
|
||||||
olsrd_setup_smartgw_rules() {
|
olsrd_setup_smartgw_rules() {
|
||||||
local funcname="olsrd_setup_smartgw_rules"
|
local funcname="olsrd_setup_smartgw_rules"
|
||||||
# Check if ipip is installed
|
local file=
|
||||||
[ -e /etc/modules.d/[0-9]*-ipip ] || {
|
|
||||||
|
for file in /etc/modules.d/[0-9]*-ipip; do :; done
|
||||||
|
[ -e "$file" ] || {
|
||||||
log "$funcname() Warning: kmod-ipip is missing. SmartGateway will not work until you install it."
|
log "$funcname() Warning: kmod-ipip is missing. SmartGateway will not work until you install it."
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
@ -686,8 +692,8 @@ olsrd_setup_smartgw_rules() {
|
||||||
nowan=0
|
nowan=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IP4T=$(which iptables)
|
IP4T="$( command -v iptables )"
|
||||||
IP6T=$(which ip6tables)
|
IP6T="$( command -v ip6tables )"
|
||||||
|
|
||||||
# Delete smartgw firewall rules first
|
# Delete smartgw firewall rules first
|
||||||
if [ "$UCI_CONF_NAME" = "olsrd6" ]; then
|
if [ "$UCI_CONF_NAME" = "olsrd6" ]; then
|
||||||
|
@ -709,8 +715,10 @@ olsrd_setup_smartgw_rules() {
|
||||||
while $IP4T -t nat -D postrouting_rule -o tnl_+ -j MASQUERADE 2> /dev/null; do :;done
|
while $IP4T -t nat -D postrouting_rule -o tnl_+ -j MASQUERADE 2> /dev/null; do :;done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# var 'smartgateway' + 'smartgatewayuplink' build in olsrd_write_olsrd()
|
||||||
if [ "$smartgateway" = "yes" ]; then
|
if [ "$smartgateway" = "yes" ]; then
|
||||||
log "$funcname() Notice: Inserting firewall rules for SmartGateway"
|
log "$funcname() Notice: Inserting firewall rules for SmartGateway"
|
||||||
|
|
||||||
if [ ! "$smartgatewayuplink" = "none" ]; then
|
if [ ! "$smartgatewayuplink" = "none" ]; then
|
||||||
if [ "$smartgatewayuplink" = "ipv4" ]; then
|
if [ "$smartgatewayuplink" = "ipv4" ]; then
|
||||||
# Allow everything to be forwarded to tnl_+ and use NAT for it
|
# Allow everything to be forwarded to tnl_+ and use NAT for it
|
||||||
|
|
Loading…
Reference in a new issue