When we use "" on the command line to pass a value with spaces
the argument was broken when passing it to the next function.
Now the argument is kept as one string with spaces
Fixes: #11438
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
54 files changed:
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- address=$(cli_get_val ${1})
+ address=$(cli_get_val "${1}")
- mode=$(cli_get_val ${1})
+ mode=$(cli_get_val "${1}")
;;
*)
error "Unrecognized argument: ${1}"
;;
*)
error "Unrecognized argument: ${1}"
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- address=$(cli_get_val ${1})
+ address=$(cli_get_val "${1}")
- mtu=$(cli_get_val ${1})
+ mtu=$(cli_get_val "${1}")
;;
*)
error "Unrecognized argument: ${1}"
;;
*)
error "Unrecognized argument: ${1}"
assert isset protocol
shift
assert isset protocol
shift
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man firewall-panic
exit ${EXIT_OK}
fi
cli_show_man firewall-panic
exit ${EXIT_OK}
fi
}
firewall_cli_settings() {
}
firewall_cli_settings() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man firewall-settings
exit ${EXIT_OK}
fi
cli_show_man firewall-settings
exit ${EXIT_OK}
fi
assert isset protocol
shift
assert isset protocol
shift
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man firewall-zone
exit ${EXIT_OK}
fi
cli_show_man firewall-zone
exit ${EXIT_OK}
fi
# Process the given action.
case "${action}" in
edit)
# Process the given action.
case "${action}" in
edit)
- firewall_cli_zone_edit ${zone} $@
+ firewall_cli_zone_edit ${zone} "$@"
- firewall_cli_zone_status ${zone} $@
+ firewall_cli_zone_status ${zone} "$@"
;;
# Print the raw configuration settings.
show)
;;
# Print the raw configuration settings.
show)
- firewall_zone_print ${zone} $@
+ firewall_zone_print ${zone} "$@"
case "${action}" in
reset)
case "${action}" in
reset)
+ firewall_zone_reset "$@"
}
# Returns true if a device is a tun device
}
# Returns true if a device is a tun device
# Check if the device is free
device_is_free() {
# Check if the device is free
device_is_free() {
}
# Check if the device is used
}
# Check if the device is used
seconds="$(cli_get_val "${arg}")"
;;
esac
seconds="$(cli_get_val "${arg}")"
;;
esac
+ done <<< "$(args "$@")"
- local services=$(dhcpd_service $@)
+ local services=$(dhcpd_service "$@")
local service
for service in ${services}; do
local service
for service in ${services}; do
- local services=$(dhcpd_service $@)
+ local services=$(dhcpd_service "$@")
local service
for service in ${services}; do
local service
for service in ${services}; do
dhcpd_restart() {
# DHCP does not support a reload, so
# we retsart it.
dhcpd_restart() {
# DHCP does not support a reload, so
# we retsart it.
- local services=$(dhcpd_service $@)
+ local services=$(dhcpd_service "$@")
local service
for service in ${services}; do
local service
for service in ${services}; do
- local services=$(dhcpd_service $@)
+ local services=$(dhcpd_service "$@")
local service
for service in ${services}; do
local service
for service in ${services}; do
- local services=$(dhcpd_service $@)
+ local services=$(dhcpd_service "$@")
local service
for service in ${services}; do
local service
for service in ${services}; do
- _dhcpd_edit_ipv6 $@ || return $?
+ _dhcpd_edit_ipv6 "$@" || return $?
- _dhcpd_edit_ipv4 $@ || return $?
+ _dhcpd_edit_ipv4 "$@" || return $?
while [ $# -gt 0 ]; do
case "${1}" in
--authoritative=*)
while [ $# -gt 0 ]; do
case "${1}" in
--authoritative=*)
- val=$(cli_get_val ${1})
+ val=$(cli_get_val "${1}")
if enabled val; then
AUTHORITATIVE="true"
if enabled val; then
AUTHORITATIVE="true"
fi
;;
--default-lease-time=*)
fi
;;
--default-lease-time=*)
- local val=$(cli_get_val ${1})
+ local val=$(cli_get_val "${1}")
DEFAULT_LEASE_TIME=$(parse_time ${val})
if ! isinteger DEFAULT_LEASE_TIME; then
DEFAULT_LEASE_TIME=$(parse_time ${val})
if ! isinteger DEFAULT_LEASE_TIME; then
fi
;;
--max-lease-time=*)
fi
;;
--max-lease-time=*)
- local val=$(cli_get_val ${1})
+ local val=$(cli_get_val "${1}")
MAX_LEASE_TIME=$(parse_time ${val})
if ! isinteger MAX_LEASE_TIME; then
MAX_LEASE_TIME=$(parse_time ${val})
if ! isinteger MAX_LEASE_TIME; then
fi
;;
--min-lease-time=*)
fi
;;
--min-lease-time=*)
- local val=$(cli_get_val ${1})
+ local val=$(cli_get_val "${1}")
MIN_LEASE_TIME=$(parse_time ${val})
if isset MIN_LEASE_TIME; then
MIN_LEASE_TIME=$(parse_time ${val})
if isset MIN_LEASE_TIME; then
while [ $# -gt 0 ]; do
case "${1}" in
--preferred-lifetime=*)
while [ $# -gt 0 ]; do
case "${1}" in
--preferred-lifetime=*)
- local val=$(cli_get_val ${1})
+ local val=$(cli_get_val "${1}")
PREFERRED_LIFETIME=$(parse_time ${val})
if ! isinteger PREFERRED_LIFETIME; then
PREFERRED_LIFETIME=$(parse_time ${val})
if ! isinteger PREFERRED_LIFETIME; then
fi
;;
--valid-lifetime=*)
fi
;;
--valid-lifetime=*)
- local val=$(cli_get_val ${1})
+ local val=$(cli_get_val "${1}")
VALID_LIFETIME=$(parse_time ${val})
if ! isinteger VALID_LIFETIME; then
VALID_LIFETIME=$(parse_time ${val})
if ! isinteger VALID_LIFETIME; then
}
dhcpd_subnet_exists() {
}
dhcpd_subnet_exists() {
+ dhcpd_subnet_match "$@"
- dhcpd_subnet_edit ${proto} "new" $@
+ dhcpd_subnet_edit ${proto} "new" "$@"
case "${proto},${mode},${1}" in
# Common options
ipv6,new,*:*/*|ipv4,new,*.*.*.*/*)
case "${proto},${mode},${1}" in
# Common options
ipv6,new,*:*/*|ipv4,new,*.*.*.*/*)
- local subnet="$(cli_get_val ${1})"
+ local subnet="$(cli_get_val "${1}")"
ADDRESS="$(ip_split_prefix ${subnet})"
PREFIX="$(ip_get_prefix ${subnet})"
ADDRESS="$(ip_split_prefix ${subnet})"
PREFIX="$(ip_get_prefix ${subnet})"
# IPv4 options
ipv4,*,--routers=*)
# IPv4 options
ipv4,*,--routers=*)
- ROUTERS=$(cli_get_val ${1})
+ ROUTERS=$(cli_get_val "${1}")
}
dhcpd_subnet_options_file() {
}
dhcpd_subnet_options_file() {
- local path=$(dhcpd_subnet_path $@)
+ local path=$(dhcpd_subnet_path "$@")
assert isset path
print "${path}/options"
assert isset path
print "${path}/options"
local line k v
while read line; do
local line k v
while read line; do
- k=$(cli_get_key ${line})
- v=$(cli_get_val ${line})
+ k=$(cli_get_key "${line}")
+ v=$(cli_get_val "${line}")
if [ "${what}" = "${k}" ]; then
echo "${v//\"/}"
if [ "${what}" = "${k}" ]; then
echo "${v//\"/}"
while read -r arg; do
case "${arg}" in
server=*)
while read -r arg; do
case "${arg}" in
server=*)
- server=$(cli_get_val ${arg})
+ server=$(cli_get_val "${arg}")
- priority=$(cli_get_val ${arg})
+ priority=$(cli_get_val "${arg}")
+ done <<< "$(args "$@")"
# The server address must be set.
isset server || return ${EXIT_ERROR}
# The server address must be set.
isset server || return ${EXIT_ERROR}
shift
# Execute the check function
shift
# Execute the check function
local ret="${?}"
case "${ret}" in
local ret="${?}"
case "${ret}" in
- val=$(cli_get_val ${arg})
+ val=$(cli_get_val "${arg}")
+ done <<< "$(args "$@")"
# action must always be set.
if ! isset action; then
# action must always be set.
if ! isset action; then
}
firewall_zone_exists() {
}
firewall_zone_exists() {
- local file=$(firewall_zone_config $@)
+ local file=$(firewall_zone_config "$@")
[ -r "${file}" ] && return ${EXIT_TRUE} || return ${EXIT_FALSE}
}
[ -r "${file}" ] && return ${EXIT_TRUE} || return ${EXIT_FALSE}
}
while [ $# -gt 0 ]; do
case "${1}" in
--masquerade4=*)
while [ $# -gt 0 ]; do
case "${1}" in
--masquerade4=*)
- MASQUERADE4=$(cli_get_val ${1})
+ MASQUERADE4=$(cli_get_val "${1}")
- POLICY=$(cli_get_val ${1})
+ POLICY=$(cli_get_val "${1}")
;;
*)
warning "Unknown option: ${1}"
;;
*)
warning "Unknown option: ${1}"
while [ $# -gt 0 ]; do
case "${1}" in
--username=*)
while [ $# -gt 0 ]; do
case "${1}" in
--username=*)
- username="$(cli_get_val ${1})"
+ username="$(cli_get_val "${1}")"
- password="$(cli_get_val ${1})"
+ password="$(cli_get_val "${1}")"
- tunnel_id="$(cli_get_val ${1})"
+ tunnel_id="$(cli_get_val "${1}")"
+ hook_exists config "$@"
}
hook_config_get_all() {
}
hook_config_get_all() {
while [ $# -gt 0 ]; do
case "${1}" in
--broadcast-ssid=*)
while [ $# -gt 0 ]; do
case "${1}" in
--broadcast-ssid=*)
- broadcast_ssid=$(cli_get_val ${1})
+ broadcast_ssid=$(cli_get_val "${1}")
- channel=$(cli_get_val ${1})
+ channel=$(cli_get_val "${1}")
- encryption=$(cli_get_val ${1})
+ encryption=$(cli_get_val "${1}")
;;
--ieee80211d=*)
local val="$(cli_get_val "${1}")"
;;
--ieee80211d=*)
local val="$(cli_get_val "${1}")"
- key=$(cli_get_val ${1})
+ key=$(cli_get_val "${1}")
- mode=$(cli_get_val ${1})
+ mode=$(cli_get_val "${1}")
- ssid=$(cli_get_val ${1})
+ ssid=$(cli_get_val "${1}")
;;
--wmm=*)
local val="$(cli_get_val "${1}")"
;;
--wmm=*)
local val="$(cli_get_val "${1}")"
while [ $# -gt 0 ]; do
case "${1}" in
--username=*)
while [ $# -gt 0 ]; do
case "${1}" in
--username=*)
- username="$(cli_get_val ${1})"
+ username="$(cli_get_val "${1}")"
- password="$(cli_get_val ${1})"
+ password="$(cli_get_val "${1}")"
- local url="$(cli_get_val ${1})"
+ local url="$(cli_get_val "${1}")"
shift
# Add credentials to the URL.
shift
# Add credentials to the URL.
}
__processor_id_to_bitmap() {
}
__processor_id_to_bitmap() {
}
interrupt_set_smp_affinity() {
}
interrupt_set_smp_affinity() {
- inetcalc -n $@ && return ${EXIT_OK} || return ${EXIT_ERROR}
+ inetcalc -n "$@" && return ${EXIT_OK} || return ${EXIT_ERROR}
}
ip_network_is_subset_of() {
assert [ $# -eq 2 ]
}
ip_network_is_subset_of() {
assert [ $# -eq 2 ]
- inetcalc -s $@ && return ${EXIT_TRUE} || return ${EXIT_FALSE}
+ inetcalc -s "$@" && return ${EXIT_TRUE} || return ${EXIT_FALSE}
while [ $# -gt 0 ]; do
case "${1}" in
--mode=*)
while [ $# -gt 0 ]; do
case "${1}" in
--mode=*)
- mode="$(cli_get_val ${1})"
+ mode="$(cli_get_val "${1}")"
- ttl="$(cli_get_val ${1})"
+ ttl="$(cli_get_val "${1}")"
- remote_address="$(cli_get_val ${1})"
+ remote_address="$(cli_get_val "${1}")"
- local_address="$(cli_get_val ${1})"
+ local_address="$(cli_get_val "${1}")"
;;
# Keys for VTI
--ikey=*)
;;
# Keys for VTI
--ikey=*)
- ikey="$(cli_get_val ${1})"
+ ikey="$(cli_get_val "${1}")"
- okey="$(cli_get_val ${1})"
+ okey="$(cli_get_val "${1}")"
case "${action}" in
connection)
case "${action}" in
connection)
- cli_ipsec_connection $@
+ cli_ipsec_connection "$@"
;;
*)
error "Unrecognized argument: ${action}"
;;
*)
error "Unrecognized argument: ${action}"
case "${key}" in
authentication|down|disable|dpd|enable|inactivity_timeout|local|mode|peer|pool|remote|security_policy|start_action|up)
case "${key}" in
authentication|down|disable|dpd|enable|inactivity_timeout|local|mode|peer|pool|remote|security_policy|start_action|up)
- ipsec_connection_${key} ${connection} $@
+ ipsec_connection_${key} ${connection} "$@"
;;
show)
cli_ipsec_connection_show "${connection}"
;;
show)
cli_ipsec_connection_show "${connection}"
- ipsec_connection_new $@
+ ipsec_connection_new "$@"
- cli_ipsec_connection_destroy $@
+ cli_ipsec_connection_destroy "$@"
;;
""|*)
if [ -n "${action}" ]; then
;;
""|*)
if [ -n "${action}" ]; then
case "${key}" in
dns_server|network)
case "${key}" in
dns_server|network)
- ipsec_pool_${key} ${pool} $@
+ ipsec_pool_${key} ${pool} "$@"
;;
show)
cli_ipsec_pool_show "${pool}"
;;
show)
cli_ipsec_pool_show "${pool}"
+ ipsec_pool_destroy "$@"
;;
""|*)
if [ -n "${action}" ]; then
;;
""|*)
if [ -n "${action}" ]; then
if [ $# -eq 0 ] && [ -n "${IPSEC_CONNECTION_CONFIG_SETTINGS}" ]; then
list_append args ${IPSEC_CONNECTION_CONFIG_SETTINGS}
else
if [ $# -eq 0 ] && [ -n "${IPSEC_CONNECTION_CONFIG_SETTINGS}" ]; then
list_append args ${IPSEC_CONNECTION_CONFIG_SETTINGS}
else
fi
local path="${NETWORK_IPSEC_CONNS_DIR}/${connection}/settings"
fi
local path="${NETWORK_IPSEC_CONNS_DIR}/${connection}/settings"
- ipsec_connection_authentication_mode "${connection}" $@
+ ipsec_connection_authentication_mode "${connection}" "$@"
- ipsec_connection_authentication_psk "${connection}" $@
+ ipsec_connection_authentication_psk "${connection}" "$@"
;;
*)
log ERROR "Unrecognized argument: ${cmd}"
;;
*)
log ERROR "Unrecognized argument: ${cmd}"
- ipsec_connection_dpd_action "${connection}" $@
+ ipsec_connection_dpd_action "${connection}" "$@"
- ipsec_connection_dpd_delay "${connection}" $@
+ ipsec_connection_dpd_delay "${connection}" "$@"
- ipsec_connection_dpd_timeout "${connection}" $@
+ ipsec_connection_dpd_timeout "${connection}" "$@"
;;
*)
log ERROR "Unrecognized argument: ${cmd}"
;;
*)
log ERROR "Unrecognized argument: ${cmd}"
local value=$@
if ! isinteger value; then
local value=$@
if ! isinteger value; then
+ value=$(parse_time "$@")
if [ ! $? -eq 0 ]; then
log ERROR "Parsing the passed time was not sucessful please check the passed values."
return ${EXIT_ERROR}
if [ ! $? -eq 0 ]; then
log ERROR "Parsing the passed time was not sucessful please check the passed values."
return ${EXIT_ERROR}
local value=$@
if ! isinteger value; then
local value=$@
if ! isinteger value; then
+ value=$(parse_time "$@")
if [ ! $? -eq 0 ]; then
log ERROR "Parsing the passed time was not sucessful please check the passed values."
return ${EXIT_ERROR}
if [ ! $? -eq 0 ]; then
log ERROR "Parsing the passed time was not sucessful please check the passed values."
return ${EXIT_ERROR}
- ipsec_connection_local_address "${connection}" $@
+ ipsec_connection_local_address "${connection}" "$@"
- ipsec_connection_id "${connection}" "LOCAL" $@
+ ipsec_connection_id "${connection}" "LOCAL" "$@"
- ipsec_connection_prefix "${connection}" "LOCAL" $@
+ ipsec_connection_prefix "${connection}" "LOCAL" "$@"
;;
*)
log ERROR "Unrecognized argument: ${cmd}"
;;
*)
log ERROR "Unrecognized argument: ${cmd}"
- ipsec_connection_id "${connection}" "REMOTE" $@
+ ipsec_connection_id "${connection}" "REMOTE" "$@"
- ipsec_connection_prefix "${connection}" "REMOTE" $@
+ ipsec_connection_prefix "${connection}" "REMOTE" "$@"
;;
*)
log ERROR "Unrecognized argument: ${cmd}"
;;
*)
log ERROR "Unrecognized argument: ${cmd}"
local value=$@
if ! isinteger value; then
local value=$@
if ! isinteger value; then
+ value=$(parse_time "$@")
if [ ! $? -eq 0 ]; then
log ERROR "Parsing the passed time was not sucessful please check the passed values."
return ${EXIT_ERROR}
if [ ! $? -eq 0 ]; then
log ERROR "Parsing the passed time was not sucessful please check the passed values."
return ${EXIT_ERROR}
# Function that deletes based on the passed parameters one ore more vpn security policies
ipsec_connection_destroy() {
local connection
# Function that deletes based on the passed parameters one ore more vpn security policies
ipsec_connection_destroy() {
local connection
- for connection in $@; do
+ for connection in "$@"; do
if ! ipsec_connection_exists "${connection}"; then
log ERROR "The VPN IPsec connection ${connection} does not exist."
continue
if ! ipsec_connection_exists "${connection}"; then
log ERROR "The VPN IPsec connection ${connection} does not exist."
continue
if [ $# -eq 0 ] && [ -n "${IPSEC_POOL_CONFIG_SETTINGS}" ]; then
list_append args ${IPSEC_POOL_CONFIG_SETTINGS}
else
if [ $# -eq 0 ] && [ -n "${IPSEC_POOL_CONFIG_SETTINGS}" ]; then
list_append args ${IPSEC_POOL_CONFIG_SETTINGS}
else
fi
local path="${NETWORK_IPSEC_POOLS_DIR}/${pool}/settings"
fi
local path="${NETWORK_IPSEC_POOLS_DIR}/${pool}/settings"
# one ore more vpn ipsec pools
ipsec_pool_destroy() {
local pool
# one ore more vpn ipsec pools
ipsec_pool_destroy() {
local pool
if ! ipsec_pool_exists "${pool}"; then
log ERROR "The VPN IPsec pool ${pool} does not exist."
continue
if ! ipsec_pool_exists "${pool}"; then
log ERROR "The VPN IPsec pool ${pool} does not exist."
continue
- policy="$(cli_get_val ${1})"
+ policy="$(cli_get_val "${1}")"
;;
-*)
log WARNING "Unrecognized argument: ${1}"
;;
-*)
log WARNING "Unrecognized argument: ${1}"
while [ $# -gt 0 ]; do
case "${1}" in
--log-facility=*)
while [ $# -gt 0 ]; do
case "${1}" in
--log-facility=*)
- log_facility="$(cli_get_val ${1})"
+ log_facility="$(cli_get_val "${1}")"
;;
*)
log WARNING "Unrecognized argument: ${1}"
;;
*)
log WARNING "Unrecognized argument: ${1}"
IPTABLES_PORTRANGE=2
_iptables_port_range() {
IPTABLES_PORTRANGE=2
_iptables_port_range() {
}
_iptables_port_multiport() {
}
_iptables_port_multiport() {
iptables_source_port() {
[ -z "$@" ] && return
local type
iptables_source_port() {
[ -z "$@" ] && return
local type
- type=$(_iptables_port $@)
+ type=$(_iptables_port "$@")
if [ "$type" = "$IPTABLES_MULTIPORT" ]; then
echo "-m multiport --source-ports $@"
else
if [ "$type" = "$IPTABLES_MULTIPORT" ]; then
echo "-m multiport --source-ports $@"
else
iptables_destination_port() {
[ -z "$@" ] && return
local type
iptables_destination_port() {
[ -z "$@" ] && return
local type
- type=$(_iptables_port $@)
+ type=$(_iptables_port "$@")
if [ "$type" = "$IPTABLES_MULTIPORT" ]; then
echo "-m multiport --destination-ports $@"
else
if [ "$type" = "$IPTABLES_MULTIPORT" ]; then
echo "-m multiport --destination-ports $@"
else
- inetcalc -4 -b $@ && return ${EXIT_OK} || return ${EXIT_ERROR}
+ inetcalc -4 -b "$@" && return ${EXIT_OK} || return ${EXIT_ERROR}
- ipv4_addr_eq $@ || ipv4_addr_gt $@
+ ipv4_addr_eq "$@" || ipv4_addr_gt "$@"
- ! ipv4_addr_eq $@ && ! ipv4_addr_gt $@
+ ! ipv4_addr_eq "$@" && ! ipv4_addr_gt "$@"
- ipv4_addr_eq $@ || ! ipv4_addr_gt $@
+ ipv4_addr_eq "$@" || ! ipv4_addr_gt "$@"
+ done <<< "$(args "$@")"
sysctl_set "net.ipv6.conf.${device}.forwarding" 1
sysctl_set "net.ipv6.conf.${device}.forwarding" 1
wait_for_dad="false"
;;
esac
wait_for_dad="false"
;;
esac
+ done <<< "$(args "$@")"
local cmd="ip addr add ${address} dev ${device} scope ${scope}"
local cmd="ip addr add ${address} dev ${device} scope ${scope}"
valid_lft="$(cli_get_val "${arg}")"
;;
esac
valid_lft="$(cli_get_val "${arg}")"
;;
esac
+ done <<< "$(args "$@")"
local cmd="ip -6 addr change ${address} dev ${device} scope global"
local cmd="ip -6 addr change ${address} dev ${device} scope global"
scope="$(cli_get_val "${arg}")"
;;
esac
scope="$(cli_get_val "${arg}")"
;;
esac
+ done <<< "$(args "$@")"
local cmd="ip -o addr show dev ${device}"
if isset scope; then
local cmd="ip -o addr show dev ${device}"
if isset scope; then
- ipv6_addr_eq $@ || ipv6_addr_gt $@
+ ipv6_addr_eq "$@" || ipv6_addr_gt "$@"
- ! ipv6_addr_eq $@ && ! ipv6_addr_gt $@
+ ! ipv6_addr_eq "$@" && ! ipv6_addr_gt "$@"
- ipv6_addr_eq $@ || ! ipv6_addr_gt $@
+ ipv6_addr_eq "$@" || ! ipv6_addr_gt "$@"
list_append_one "${list}" "${arg}"
done
}
list_append_one "${list}" "${arg}"
done
}
local ret=${EXIT_ERROR}
local arg
local ret=${EXIT_ERROR}
local arg
if ! list_match ${arg} ${!list}; then
list_append_one ${list} "${arg}"
ret=${EXIT_OK}
if ! list_match ${arg} ${!list}; then
list_append_one ${list} "${arg}"
ret=${EXIT_OK}
local _list k
for k in ${!list}; do
local _list k
for k in ${!list}; do
- if list_match ${k} $@; then
+ if list_match ${k} "$@"; then
ret=${EXIT_OK}
continue
fi
ret=${EXIT_OK}
continue
fi
print "${i}"
done | sort | tr '\n' ' '
print
print "${i}"
done | sort | tr '\n' ' '
print
list_unique() {
local items item
list_unique() {
local items item
# Check if the item has already been processed.
list_match "${item}" ${items} && continue
# Check if the item has already been processed.
list_match "${item}" ${items} && continue
[ "${match}" = "${i}" ] && return ${EXIT_OK}
done
[ "${match}" = "${i}" ] && return ${EXIT_OK}
done
length=$(( ${length} + 1 ))
done
length=$(( ${length} + 1 ))
done
local counter=0
local arg
local counter=0
local arg
if [ "${arg}" = "${what}" ]; then
counter=$(( ${counter} + 1 ))
fi
if [ "${arg}" = "${what}" ]; then
counter=$(( ${counter} + 1 ))
fi
list_reverse() {
local reversed arg
list_reverse() {
local reversed arg
reversed="${arg} ${reversed}"
done
reversed="${arg} ${reversed}"
done
print "${arg}"
return ${EXIT_OK}
done
print "${arg}"
return ${EXIT_OK}
done
while [ $# -gt 0 ]; do
case "${1}" in
--timeout=*)
while [ $# -gt 0 ]; do
case "${1}" in
--timeout=*)
- timeout=$(cli_get_val ${1})
+ timeout=$(cli_get_val "${1}")
- answer=$(cli_get_val ${1})
+ answer=$(cli_get_val "${1}")
- modem_sim_unlocked $@ && return ${EXIT_FALSE} || return ${EXIT_TRUE}
+ modem_sim_unlocked "$@" && return ${EXIT_FALSE} || return ${EXIT_TRUE}
- hook_exec port "${hook}" new $@
+ hook_exec port "${hook}" new "$@"
- hook_exec port ${hook} ${cmd} ${port} $@
+ hook_exec port ${hook} ${cmd} ${port} "$@"
while [ $# -gt 0 ]; do
case "${1}" in
--auth=*)
while [ $# -gt 0 ]; do
case "${1}" in
--auth=*)
- auth=$(cli_get_val ${1})
+ auth=$(cli_get_val "${1}")
- baudrate=$(cli_get_val ${1})
+ baudrate=$(cli_get_val "${1}")
assert isoneof baudrate ${SERIAL_BAUDRATES}
;;
--connect-command=*)
assert isoneof baudrate ${SERIAL_BAUDRATES}
;;
--connect-command=*)
- connect_cmd=$(cli_get_val ${1})
+ connect_cmd=$(cli_get_val "${1}")
;;
# Enable or disable the use of the default asyncmap.
--default-asyncmap=*)
;;
# Enable or disable the use of the default asyncmap.
--default-asyncmap=*)
- value=$(cli_get_val ${1})
+ value=$(cli_get_val "${1}")
if enabled value; then
default_asyncmap="true"
else
if enabled value; then
default_asyncmap="true"
else
;;
# The name of the created ppp interface.
--interface=*)
;;
# The name of the created ppp interface.
--interface=*)
- interface=$(cli_get_val ${1})
+ interface=$(cli_get_val "${1}")
- ipv6="$(cli_get_val ${1})"
+ ipv6="$(cli_get_val "${1}")"
;;
# LCP echo failure.
--lcr-echo-failure=*)
;;
# LCP echo failure.
--lcr-echo-failure=*)
- lcr_echo_failure=$(cli_get_val ${1})
+ lcr_echo_failure=$(cli_get_val "${1}")
if ! isinteger ${lcr_echo_failure}; then
error "--lcr-echo-failure= requires a number"
if ! isinteger ${lcr_echo_failure}; then
error "--lcr-echo-failure= requires a number"
;;
# LCP echo interval.
--lcr-echo-interval=*)
;;
# LCP echo interval.
--lcr-echo-interval=*)
- lcr_echo_interval=$(cli_get_val ${1})
+ lcr_echo_interval=$(cli_get_val "${1}")
if ! isinteger ${lcr_echo_failure}; then
error "--lcr-echo-interval= requires a number"
if ! isinteger ${lcr_echo_failure}; then
error "--lcr-echo-interval= requires a number"
;;
# Maximum Transmission Unit
--mtu=*)
;;
# Maximum Transmission Unit
--mtu=*)
- mtu=$(cli_get_val ${1})
+ mtu=$(cli_get_val "${1}")
;;
# Maximum Receive Unit
--mru=*)
;;
# Maximum Receive Unit
--mru=*)
- mru=$(cli_get_val ${1})
+ mru=$(cli_get_val "${1}")
- password=$(cli_get_val ${1})
+ password=$(cli_get_val "${1}")
- plugin=$(cli_get_val ${1})
+ plugin=$(cli_get_val "${1}")
- plugin_options=$(cli_get_val ${1})
+ plugin_options=$(cli_get_val "${1}")
- pty=$(cli_get_val ${1})
+ pty=$(cli_get_val "${1}")
;;
# Refused authentication methods
--refuse=*)
;;
# Refused authentication methods
--refuse=*)
;;
# Sets if the modem is a serial device.
--serial=*)
;;
# Sets if the modem is a serial device.
--serial=*)
- serial=$(cli_get_val ${1})
+ serial=$(cli_get_val "${1}")
- serial_device=$(cli_get_val ${1})
+ serial_device=$(cli_get_val "${1}")
- username=$(cli_get_val ${1})
+ username=$(cli_get_val "${1}")
;;
*)
log WARNING "Unhandled argument: ${1}"
;;
*)
log WARNING "Unhandled argument: ${1}"
while [ $# -gt 0 ]; do
case "${1}" in
--auth=*)
while [ $# -gt 0 ]; do
case "${1}" in
--auth=*)
- auth=$(cli_get_val ${1})
+ auth=$(cli_get_val "${1}")
- default_asyncmap=$(cli_get_val ${1})
+ default_asyncmap=$(cli_get_val "${1}")
;;
--disable-ipv6)
ipv6="false"
;;
--dns-servers=*)
;;
--disable-ipv6)
ipv6="false"
;;
--dns-servers=*)
- dns_servers="$(cli_get_val ${1})"
+ dns_servers="$(cli_get_val "${1}")"
- lcp_echo_failure=$(cli_get_val ${1})
+ lcp_echo_failure=$(cli_get_val "${1}")
assert isinteger ${lcp_echo_failure}
;;
--lcp-echo-interval=*)
assert isinteger ${lcp_echo_failure}
;;
--lcp-echo-interval=*)
- lcp_echo_interval=$(cli_get_val ${1})
+ lcp_echo_interval=$(cli_get_val "${1}")
assert isinteger ${lcp_echo_interval}
;;
--proxyarp=*)
assert isinteger ${lcp_echo_interval}
;;
--proxyarp=*)
- proxyarp=$(cli_get_val ${1})
+ proxyarp=$(cli_get_val "${1}")
- required_auths="${required_auths} $(cli_get_val ${1})"
+ required_auths="${required_auths} $(cli_get_val "${1}")"
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-route
exit ${EXIT_OK}
fi
cli_show_man network-route
exit ${EXIT_OK}
fi
case "${action}" in
static)
case "${action}" in
static)
;;
*)
error "Unrecognized action: ${action}"
;;
*)
error "Unrecognized action: ${action}"
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-route-static
exit ${EXIT_OK}
fi
cli_show_man network-route-static
exit ${EXIT_OK}
fi
case "${action}" in
# Add a new route.
add)
case "${action}" in
# Add a new route.
add)
;;
# Remove an existing route.
remove)
;;
# Remove an existing route.
remove)
;;
# List all routes.
list)
;;
# List all routes.
list)
return ${EXIT_OK}
;;
# Reload all routes
reload)
return ${EXIT_OK}
;;
# Reload all routes
reload)
;;
*)
error "Unrecognized action: ${action}"
;;
*)
error "Unrecognized action: ${action}"
while [ $# -gt 0 ]; do
case "${1}" in
--gateway=*)
while [ $# -gt 0 ]; do
case "${1}" in
--gateway=*)
- gateway=$(cli_get_val ${1})
+ gateway=$(cli_get_val "${1}")
;;
--unreachable)
unreachable="true"
;;
--unreachable)
unreachable="true"
blackhole="true"
;;
--mtu=*)
blackhole="true"
;;
--mtu=*)
- mtu=$(cli_get_val ${1})
+ mtu=$(cli_get_val "${1}")
;;
*)
if isset network; then
;;
*)
if isset network; then
local _network
local error=${EXIT_OK}
local _network
local error=${EXIT_OK}
+ for _network in "$@"; do
# Validate input
if ! ip_net_is_valid ${_network} && ! ip_is_valid ${_network}; then
error "Invalid IP address or network: ${_network}"
# Validate input
if ! ip_net_is_valid ${_network} && ! ip_is_valid ${_network}; then
error "Invalid IP address or network: ${_network}"
while [ $# -gt 0 ]; do
case "${1}" in
--protocol=*)
while [ $# -gt 0 ]; do
case "${1}" in
--protocol=*)
- protocol=$(cli_get_val ${1})
+ protocol=$(cli_get_val "${1}")
;;
*)
warning "Unrecognized argument: ${1}"
;;
*)
warning "Unrecognized argument: ${1}"
while read arg; do
case "${arg}" in
network=*)
while read arg; do
case "${arg}" in
network=*)
- network=$(cli_get_val ${arg})
+ network=$(cli_get_val "${arg}")
- gateway=$(cli_get_val ${arg})
+ gateway=$(cli_get_val "${arg}")
- unreachable=$(cli_get_val ${arg})
+ unreachable=$(cli_get_val "${arg}")
- prohibit=$(cli_get_val ${arg})
+ prohibit=$(cli_get_val "${arg}")
- blackhole=$(cli_get_val ${arg})
+ blackhole=$(cli_get_val "${arg}")
- mtu=$(cli_get_val ${arg})
+ mtu=$(cli_get_val "${arg}")
+ done <<< "$(args "$@")"
### Check if all values are correctly set.
### Check if all values are correctly set.
while [ $# -gt 0 ]; do
case "${1}" in
--gateway=*)
while [ $# -gt 0 ]; do
case "${1}" in
--gateway=*)
- gateway=$(cli_get_val ${1})
+ gateway=$(cli_get_val "${1}")
- table=$(cli_get_val ${1})
+ table=$(cli_get_val "${1}")
- type=$(cli_get_val ${1})
+ type=$(cli_get_val "${1}")
- proto=$(cli_get_val ${1})
+ proto=$(cli_get_val "${1}")
- mtu=$(cli_get_val ${1})
+ mtu=$(cli_get_val "${1}")
;;
*)
if isset network; then
;;
*)
if isset network; then
while [ $# -gt 0 ]; do
case "${1}" in
--protocol=*)
while [ $# -gt 0 ]; do
case "${1}" in
--protocol=*)
- protocol=$(cli_get_val ${1})
+ protocol=$(cli_get_val "${1}")
while [ $# -gt 0 ]; do
case "${1}" in
--id=*)
while [ $# -gt 0 ]; do
case "${1}" in
--id=*)
- _id=$(cli_get_val ${1})
+ _id=$(cli_get_val "${1}")
while [ $# -gt 0 ]; do
case "${1}" in
--lookup=*)
while [ $# -gt 0 ]; do
case "${1}" in
--lookup=*)
- lookup=$(cli_get_val ${1})
+ lookup=$(cli_get_val "${1}")
- priority=$(cli_get_val ${1})
+ priority=$(cli_get_val "${1}")
- protocols=$(cli_get_val ${1})
+ protocols=$(cli_get_val "${1}")
assert isoneof protocols ${IP_SUPPORTED_PROTOCOLS}
;;
assert isoneof protocols ${IP_SUPPORTED_PROTOCOLS}
;;
while [ $# -gt 0 ]; do
case "${1}" in
--from=*)
while [ $# -gt 0 ]; do
case "${1}" in
--from=*)
- from=$(cli_get_val ${1})
+ from=$(cli_get_val "${1}")
- lookup=$(cli_get_val ${1})
+ lookup=$(cli_get_val "${1}")
- prio=$(cli_get_val ${1})
+ prio=$(cli_get_val "${1}")
- proto=$(cli_get_val ${1})
+ proto=$(cli_get_val "${1}")
;;
*)
warning "Unrecognized argument: ${1}"
;;
*)
warning "Unrecognized argument: ${1}"
list_append valid_keys "${arg}"
;;
esac
list_append valid_keys "${arg}"
;;
esac
+ done <<< "$(args "$@")"
if [ -d "${file}" ]; then
error "Not a configuration file: '${file}'"
if [ -d "${file}" ]; then
error "Not a configuration file: '${file}'"
list_match ${key} ${valid_keys} || continue
fi
list_match ${key} ${valid_keys} || continue
fi
- val=$(cli_get_val ${line})
+ val=$(cli_get_val "${line}")
val=$(settings_strip ${val})
# Assign variable.
val=$(settings_strip ${val})
# Assign variable.
- val=$(cli_get_val ${line})
+ val=$(cli_get_val "${line}")
val=$(settings_strip ${val})
# Assign variable.
val=$(settings_strip ${val})
# Assign variable.
+ done <<< "$(args "$@")"
# Check if all values to be written are sane
if isset check_func && ! settings_check "${check_func}"; then
# Check if all values to be written are sane
if isset check_func && ! settings_check "${check_func}"; then
> ${settings_file}
local param
> ${settings_file}
local param
- for param in $(list_sort $@); do
+ for param in $(list_sort "$@"); do
echo "${param}=\"${!param}\"" >> ${settings_file}
done
}
echo "${param}=\"${!param}\"" >> ${settings_file}
done
}
settings_print() {
local param
settings_print() {
local param
- for param in $(list_sort $@); do
+ for param in $(list_sort "$@"); do
printf "%-32s = %s\n" "${param}" "${!param}"
done
}
printf "%-32s = %s\n" "${param}" "${!param}"
done
}
while [ $# -gt 0 ]; do
case "${1}" in
*=*)
while [ $# -gt 0 ]; do
case "${1}" in
*=*)
- local key=$(cli_get_key ${1})
- local val=$(cli_get_val ${1})
+ local key=$(cli_get_key "${1}")
+ local val=$(cli_get_val "${1}")
log INFO "Setting configuration option '${key}=${val}'".
log INFO "Setting configuration option '${key}=${val}'".
- local key=$(cli_get_key ${arg})
- local val=$(cli_get_val ${arg})
+ local key=$(cli_get_key "${arg}")
+ local val=$(cli_get_val "${arg}")
case "${key}" in
DNS_RANDOMIZE|DNS_SEARCH_DOMAIN|DNS_USE_LOCAL_RESOLVER)
case "${key}" in
DNS_RANDOMIZE|DNS_SEARCH_DOMAIN|DNS_USE_LOCAL_RESOLVER)
local unit
case "${arg}" in
local unit
case "${arg}" in
# Executes the given command in background
cmd_background() {
# Executes the given command in background
cmd_background() {
}
# Prints the PID of the process that was started last
}
# Prints the PID of the process that was started last
# Increase security of the read command
read() {
# Increase security of the read command
read() {
}
# Prints the number of seconds since epoch.
}
# Prints the number of seconds since epoch.
case "${action}" in
ipsec)
case "${action}" in
ipsec)
- cli_vpn_security_policies $@
+ cli_vpn_security_policies "$@"
;;
*)
error "Unrecognized argument: ${action}"
;;
*)
error "Unrecognized argument: ${action}"
case "${key}" in
cipher|compression|integrity|lifetime|pfs|show)
case "${key}" in
cipher|compression|integrity|lifetime|pfs|show)
- vpn_security_policies_${key} ${security_policy} $@
+ vpn_security_policies_${key} ${security_policy} "$@"
- vpn_security_policies_group_type ${security_policy} $@
+ vpn_security_policies_group_type ${security_policy} "$@"
- vpn_security_policies_key_exchange ${security_policy} $@
+ vpn_security_policies_key_exchange ${security_policy} "$@"
;;
*)
error "Unrecognized argument: ${key}"
;;
*)
error "Unrecognized argument: ${key}"
- vpn_security_policies_new $@
+ vpn_security_policies_new "$@"
- vpn_security_policies_destroy $@
+ vpn_security_policies_destroy "$@"
;;
""|*)
if [ -n "${action}" ]; then
;;
""|*)
if [ -n "${action}" ]; then
if [ $# -eq 0 ] && [ -n "${VPN_SECURITY_POLICIES_CONFIG_SETTINGS}" ]; then
list_append args ${VPN_SECURITY_POLICIES_CONFIG_SETTINGS}
else
if [ $# -eq 0 ] && [ -n "${VPN_SECURITY_POLICIES_CONFIG_SETTINGS}" ]; then
list_append args ${VPN_SECURITY_POLICIES_CONFIG_SETTINGS}
else
fi
local path="$(vpn_security_policies_path ${name})"
fi
local path="$(vpn_security_policies_path ${name})"
fi
if ! isinteger value; then
fi
if ! isinteger value; then
+ value=$(parse_time "$@")
if [ ! $? -eq 0 ]; then
log ERROR "Parsing the passed time was not sucessful please check the passed values."
return ${EXIT_ERROR}
if [ ! $? -eq 0 ]; then
log ERROR "Parsing the passed time was not sucessful please check the passed values."
return ${EXIT_ERROR}
# Function that deletes based on the passed parameters one ore more vpn security policies
vpn_security_policies_destroy() {
local name
# Function that deletes based on the passed parameters one ore more vpn security policies
vpn_security_policies_destroy() {
local name
if ! vpn_security_policy_exists ${name}; then
log ERROR "The vpn security policy ${name} does not exist."
continue
if ! vpn_security_policy_exists ${name}; then
log ERROR "The vpn security policy ${name} does not exist."
continue
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- address=$(cli_get_val ${1})
+ address=$(cli_get_val "${1}")
;;
--channel=*)
channel=$(cli_get_val "${1}")
;;
--phy=*)
;;
--channel=*)
channel=$(cli_get_val "${1}")
;;
--phy=*)
- phy=$(cli_get_val ${1})
+ phy=$(cli_get_val "${1}")
phy=$(phy_get ${phy})
;;
--type=*)
phy=$(phy_get ${phy})
;;
--type=*)
- type=$(cli_get_val ${1})
+ type=$(cli_get_val "${1}")
# ap --> __ap
[ "${type}" = "ap" ] && type="__ap"
# ap --> __ap
[ "${type}" = "ap" ] && type="__ap"
while [ $# -gt 0 ]; do
case "${1}" in
--bssid=*)
while [ $# -gt 0 ]; do
case "${1}" in
--bssid=*)
- bssid="$(cli_get_val ${1})"
+ bssid="$(cli_get_val "${1}")"
- essid="$(cli_get_val ${1})"
+ essid="$(cli_get_val "${1}")"
- local channel="$(cli_get_val ${1})"
+ local channel="$(cli_get_val "${1}")"
# Save the frequency of the channel instead
# of the channel itself.
# Save the frequency of the channel instead
# of the channel itself.
for arg in "$@"; do
case "${arg}" in
--ap-scan=*)
for arg in "$@"; do
case "${arg}" in
--ap-scan=*)
- ap_scan=$(cli_get_val ${arg})
+ ap_scan=$(cli_get_val "${arg}")
- mode=$(cli_get_val ${arg})
+ mode=$(cli_get_val "${arg}")
# Empty signals no encryption.
isset mode || mode="NONE"
;;
--ssid=*)
# Empty signals no encryption.
isset mode || mode="NONE"
;;
--ssid=*)
- ssid=$(cli_get_val ${arg})
+ ssid=$(cli_get_val "${arg}")
- key=$(cli_get_val ${arg})
+ key=$(cli_get_val "${arg}")
;;
*)
error "Unrecognized argument: ${arg}"
;;
*)
error "Unrecognized argument: ${arg}"
local hook="$(zone_get_hook ${zone})"
assert isset hook
local hook="$(zone_get_hook ${zone})"
assert isset hook
- hook_exec zone "${hook}" "${cmd}" "${zone}" $@
+ hook_exec zone "${hook}" "${cmd}" "${zone}" "$@"
# Create directories for configs and ports
mkdir -p $(zone_dir ${zone})/{configs,ports}
# Create directories for configs and ports
mkdir -p $(zone_dir ${zone})/{configs,ports}
- hook_zone_exec "${hook}" "new" "${zone}" $@
+ hook_zone_exec "${hook}" "new" "${zone}" "$@"
local ret=$?
# Maybe the zone new hook did not exit correctly.
local ret=$?
# Maybe the zone new hook did not exit correctly.
- hook_zone_exec ${hook} edit ${zone} $@
+ hook_zone_exec ${hook} edit ${zone} "$@"
- hook_zone_exec ${hook} up ${zone} $@
+ hook_zone_exec ${hook} up ${zone} "$@"
- hook_zone_exec ${hook} down ${zone} $@
+ hook_zone_exec ${hook} down ${zone} "$@"
local port
for port in $(zone_get_ports "${zone}"); do
# Identify all the ports
local port
for port in $(zone_get_ports "${zone}"); do
# Identify all the ports
- port_identify "${port}" --background $@
+ port_identify "${port}" --background "$@"
# Save the PIDs of the subprocesses
list_append pids "$(cmd_background_get_pid)"
# Save the PIDs of the subprocesses
list_append pids "$(cmd_background_get_pid)"
zones_show() {
local zone
zones_show() {
local zone
- for zone in $(zones_get $@); do
+ for zone in $(zones_get "$@"); do
assert isset hook
# Dispatch command to hook
assert isset hook
# Dispatch command to hook
- hook_zone_exec "${hook}" "${cmd}" "${zone}" "${port}" $@
+ hook_zone_exec "${hook}" "${cmd}" "${zone}" "${port}" "$@"
- zone_port_cmd "port_create" $@
+ zone_port_cmd "port_create" "$@"
- zone_port_cmd "port_remove" $@
+ zone_port_cmd "port_remove" "$@"
- zone_port_cmd "port_up" $@
+ zone_port_cmd "port_up" "$@"
- zone_port_cmd "port_down" $@
+ zone_port_cmd "port_down" "$@"
}
# The next two functions automagically bring up and down
}
# The next two functions automagically bring up and down
- zone_port_cmd "port_status" $@
+ zone_port_cmd "port_status" "$@"
local port
for port in $(zone_get_ports ${zone}); do
local port
for port in $(zone_get_ports ${zone}); do
- hook_zone_exec "${hook}" "${cmd}" "${zone}" "${port}" $@
+ hook_zone_exec "${hook}" "${cmd}" "${zone}" "${port}" "$@"
done
}
zone_ports_create() {
done
}
zone_ports_create() {
- zone_ports_cmd "port_create" $@
+ zone_ports_cmd "port_create" "$@"
- zone_ports_cmd "port_remove" $@
+ zone_ports_cmd "port_remove" "$@"
- zone_ports_cmd "port_up" $@
+ zone_ports_cmd "port_up" "$@"
- zone_ports_cmd "port_down" $@
+ zone_ports_cmd "port_down" "$@"
- zone_ports_cmd "port_status" $@
+ zone_ports_cmd "port_status" "$@"
local config_hook="$(zone_config_get_hook "${zone}" "${config}")"
assert isset config_hook
local config_hook="$(zone_config_get_hook "${zone}" "${config}")"
assert isset config_hook
- hook_config_exec "${config_hook}" "${cmd}" "${zone}" "${config}" $@
+ hook_config_exec "${config_hook}" "${cmd}" "${zone}" "${config}" "$@"
done
}
zone_configs_up() {
done
}
zone_configs_up() {
- zone_configs_cmd "up" $@
+ zone_configs_cmd "up" "$@"
- zone_configs_cmd "down" $@
+ zone_configs_cmd "down" "$@"
}
zone_configs_status() {
}
zone_configs_status() {
- zone_configs_cmd "status" $@
+ zone_configs_cmd "status" "$@"
}
zone_get_supported_port_hooks() {
}
zone_get_supported_port_hooks() {
if [ $# -eq 0 ] && [ -n "${HOOK_SETTINGS}" ]; then
list_append args ${HOOK_SETTINGS}
else
if [ $# -eq 0 ] && [ -n "${HOOK_SETTINGS}" ]; then
list_append args ${HOOK_SETTINGS}
else
fi
# Save the HOOK variable.
fi
# Save the HOOK variable.
if [ $# -eq 0 ] && [ -n "${HOOK_CONFIG_SETTINGS}" ]; then
list_append args ${HOOK_CONFIG_SETTINGS}
else
if [ $# -eq 0 ] && [ -n "${HOOK_CONFIG_SETTINGS}" ]; then
list_append args ${HOOK_CONFIG_SETTINGS}
else
fi
local path="$(zone_dir "${zone}")/configs/${config}"
fi
local path="$(zone_dir "${zone}")/configs/${config}"
if [ $# -eq 0 ] && [ -n "${HOOK_PORT_SETTINGS}" ]; then
list_append args ${HOOK_PORT_SETTINGS}
else
if [ $# -eq 0 ] && [ -n "${HOOK_PORT_SETTINGS}" ]; then
list_append args ${HOOK_PORT_SETTINGS}
else
fi
local path="$(zone_dir "${zone}")/ports/${port}"
fi
local path="$(zone_dir "${zone}")/ports/${port}"
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
# Return an error if the parsing of the cmd line fails
return ${EXIT_ERROR}
fi
# Return an error if the parsing of the cmd line fails
return ${EXIT_ERROR}
fi
port_settings_read "${port}" ${HOOK_SETTINGS}
port_settings_read "${port}" ${HOOK_SETTINGS}
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
}
# Returns a list of all children of this port
}
# Returns a list of all children of this port
# Depends on the port existing
hook_up() {
# Depends on the port existing
hook_up() {
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
local ret
case "${action}" in
add|create|edit|rem|show)
local ret
case "${action}" in
add|create|edit|rem|show)
- hook_port_${action} "${zone}" $@
+ hook_port_${action} "${zone}" "$@"
- hook_default_port_create $@
+ hook_default_port_create "$@"
}
hook_default_port_remove() {
}
hook_default_port_remove() {
- hook_default_port_remove $@
+ hook_default_port_remove "$@"
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
# Return an error if the parsing of the cmd line fails
return ${EXIT_ERROR}
fi
# Return an error if the parsing of the cmd line fails
return ${EXIT_ERROR}
fi
exit ${EXIT_CONF_ERROR}
;;
esac
exit ${EXIT_CONF_ERROR}
;;
esac
+ done <<< "$(args "$@")"
if ! isset ADDRESS; then
error "You need to provide an IPv4 address"
if ! isset ADDRESS; then
error "You need to provide an IPv4 address"
assert zone_exists "${zone}"
assert zone_exists "${zone}"
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
# Return an error if the parsing of the cmd line fails
return ${EXIT_ERROR}
fi
# Return an error if the parsing of the cmd line fails
return ${EXIT_ERROR}
fi
+ done <<< "$(args "$@")"
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
# Return an error if the parsing of the cmd line fails
return ${EXIT_ERROR}
fi
# Return an error if the parsing of the cmd line fails
return ${EXIT_ERROR}
fi
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
# Return an error if the parsing of the cmd line fails
return ${EXIT_ERROR}
fi
# Return an error if the parsing of the cmd line fails
return ${EXIT_ERROR}
fi
done
;;
--max-sessions=*)
done
;;
--max-sessions=*)
- MAX_SESSIONS=$(cli_get_val ${1})
+ MAX_SESSIONS=$(cli_get_val "${1}")
if ! isinteger ${MAX_SESSIONS} || ! [ ${MAX_SESSIONS} -ge 0 ]; then
error "Invalid value for '--max-session'. This value must be an integer greate or eqal zero."
exit ${EXIT_ERROR}
fi
;;
--mtu=*)
if ! isinteger ${MAX_SESSIONS} || ! [ ${MAX_SESSIONS} -ge 0 ]; then
error "Invalid value for '--max-session'. This value must be an integer greate or eqal zero."
exit ${EXIT_ERROR}
fi
;;
--mtu=*)
- MTU=$(cli_get_val ${1})
+ MTU=$(cli_get_val "${1}")
if ! mtu_is_valid "ipv4" ${MTU}; then
error "Invalid value for '--mtu'. Cannot be larger then 9000 or smaller than 576"
exit ${EXIT_ERROR}
fi
;;
--service-name=*)
if ! mtu_is_valid "ipv4" ${MTU}; then
error "Invalid value for '--mtu'. Cannot be larger then 9000 or smaller than 576"
exit ${EXIT_ERROR}
fi
;;
--service-name=*)
- SERVICE_NAME=$(cli_get_val ${1})
+ SERVICE_NAME=$(cli_get_val "${1}")
- SUBNET=$(cli_get_val ${1})
+ SUBNET=$(cli_get_val "${1}")
if ! ipv4_net_is_valid "${SUBNET}"; then
error "Invalid IPv4 Subnet ${SUBNET}."
exit ${EXIT_ERROR}
if ! ipv4_net_is_valid "${SUBNET}"; then
error "Invalid IPv4 Subnet ${SUBNET}."
exit ${EXIT_ERROR}
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
# Return an error if the parsing of the cmd line fails
return ${EXIT_ERROR}
fi
# Return an error if the parsing of the cmd line fails
return ${EXIT_ERROR}
fi
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- ADDRESS="$(cli_get_val ${1})"
+ ADDRESS="$(cli_get_val "${1}")"
- SLAVES="$(cli_get_val ${1})"
+ SLAVES="$(cli_get_val "${1}")"
;;
*)
warning "Ignoring unknown argument '${1}'"
;;
*)
warning "Ignoring unknown argument '${1}'"
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- ADDRESS="$(cli_get_val ${1})"
+ ADDRESS="$(cli_get_val "${1}")"
- SLAVES="${SLAVES} $(cli_get_val ${1})"
+ SLAVES="${SLAVES} $(cli_get_val "${1}")"
- local slave="$(cli_get_val ${1})"
+ local slave="$(cli_get_val "${1}")"
local s slaves
for s in ${SLAVES}; do
local s slaves
for s in ${SLAVES}; do
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- ADDRESS=$(cli_get_val ${1})
+ ADDRESS=$(cli_get_val "${1}")
- MIIMON=$(cli_get_val ${1})
+ MIIMON=$(cli_get_val "${1}")
- MODE=$(cli_get_val ${1})
+ MODE=$(cli_get_val "${1}")
- local slave=$(cli_get_val ${1:1})
+ local slave=$(cli_get_val "${1:1}")
if port_exists "${slave}"; then
if list_match "${slave}" ${SLAVES}; then
if port_exists "${slave}"; then
if list_match "${slave}" ${SLAVES}; then
- local slave=$(cli_get_val ${1:1})
+ local slave=$(cli_get_val "${1:1}")
if ! list_remove SLAVES "${slave}"; then
warning "Port ${slave} is not a slave of this bonding device"
fi
if ! list_remove SLAVES "${slave}"; then
warning "Port ${slave} is not a slave of this bonding device"
fi
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
hook_edit() {
local port=${1}
hook_edit() {
local port=${1}
- if ! hook_default_edit $@; then
+ if ! hook_default_edit "$@"; then
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- ADDRESS=$(cli_get_val ${1})
+ ADDRESS=$(cli_get_val "${1}")
;;
*)
warning "Unknown argument '${1}'"
;;
*)
warning "Unknown argument '${1}'"
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
while [ $# -gt 0 ]; do
case "${1}" in
--parent-device=*)
while [ $# -gt 0 ]; do
case "${1}" in
--parent-device=*)
- PARENT_DEVICE=$(cli_get_val ${1})
+ PARENT_DEVICE=$(cli_get_val "${1}")
- ADDRESS=$(cli_get_val ${1})
+ ADDRESS=$(cli_get_val "${1}")
- TAG=$(cli_get_val ${1})
+ TAG=$(cli_get_val "${1}")
;;
*)
warning "Unknown argument '${1}'"
;;
*)
warning "Unknown argument '${1}'"
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- ADDRESS=$(cli_get_val ${1})
+ ADDRESS=$(cli_get_val "${1}")
;;
*)
warning "Unknown argument '${1}'"
;;
*)
warning "Unknown argument '${1}'"
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- ADDRESS=$(cli_get_val ${1})
+ ADDRESS=$(cli_get_val "${1}")
- BSSID=$(cli_get_val ${1})
+ BSSID=$(cli_get_val "${1}")
- CHANNEL=$(cli_get_val ${1})
+ CHANNEL=$(cli_get_val "${1}")
;;
--mtu=*)
MTU="$(cli_get_val "${1}")"
;;
--phy=*)
;;
--mtu=*)
MTU="$(cli_get_val "${1}")"
;;
--phy=*)
- PHY=$(cli_get_val ${1})
+ PHY=$(cli_get_val "${1}")
- SSID=$(cli_get_val ${1})
+ SSID=$(cli_get_val "${1}")
;;
*)
warning "Ignoring unknown argument '${1}'"
;;
*)
warning "Ignoring unknown argument '${1}'"
while [ $# -gt 0 ]; do
case "${1}" in
--bssid=*)
while [ $# -gt 0 ]; do
case "${1}" in
--bssid=*)
- BSSID=$(cli_get_val ${1})
+ BSSID=$(cli_get_val "${1}")
- CHANNEL=$(cli_get_val ${1})
+ CHANNEL=$(cli_get_val "${1}")
;;
--mtu=*)
MTU="$(cli_get_val "${1}")"
;;
--ssid=*)
;;
--mtu=*)
MTU="$(cli_get_val "${1}")"
;;
--ssid=*)
- SSID=$(cli_get_val ${1})
+ SSID=$(cli_get_val "${1}")
;;
*)
warning "Unknown argument '${1}'"
;;
*)
warning "Unknown argument '${1}'"
while [ $# -gt 0 ]; do
case "${1}" in
--broadcast-ssid=*)
while [ $# -gt 0 ]; do
case "${1}" in
--broadcast-ssid=*)
- BROADCAST_SSID=$(cli_get_val ${1})
+ BROADCAST_SSID=$(cli_get_val "${1}")
- CHANNEL=$(cli_get_val ${1})
+ CHANNEL=$(cli_get_val "${1}")
- ENCRYPTION=$(cli_get_val ${1})
+ ENCRYPTION=$(cli_get_val "${1}")
- KEY=$(cli_get_val ${1})
+ KEY=$(cli_get_val "${1}")
- ADDRESS=$(cli_get_val ${1})
+ ADDRESS=$(cli_get_val "${1}")
- MODE=$(cli_get_val ${1})
+ MODE=$(cli_get_val "${1}")
- PHY=$(cli_get_val ${1})
+ PHY=$(cli_get_val "${1}")
- SSID=$(cli_get_val ${1})
+ SSID=$(cli_get_val "${1}")
;;
*)
warning "Ignoring unknown argument '${1}'"
;;
*)
warning "Ignoring unknown argument '${1}'"
local port=${1}
assert isset port
local port=${1}
assert isset port
- if ! hook_default_edit $@; then
+ if ! hook_default_edit "$@"; then
while [ $# -gt 0 ]; do
case "${1}" in
--server-address=*)
while [ $# -gt 0 ]; do
case "${1}" in
--server-address=*)
- SERVER_ADDRESS=$(cli_get_val ${1})
+ SERVER_ADDRESS=$(cli_get_val "${1}")
;;
--local-ipv4-address=*)
;;
--local-ipv4-address=*)
- LOCAL_ADDRESS=$(cli_get_val ${1})
+ LOCAL_ADDRESS=$(cli_get_val "${1}")
;;
--local-ipv6-address=*)
;;
--local-ipv6-address=*)
- LOCAL_ADDRESS6=$(cli_get_val ${1})
+ LOCAL_ADDRESS6=$(cli_get_val "${1}")
;;
--auto-update-endpoint=*)
;;
--auto-update-endpoint=*)
- local val="$(cli_get_val ${1})"
+ local val="$(cli_get_val "${1}")"
if enabled val; then
AUTO_UPDATE_ENDPOINT="true"
if enabled val; then
AUTO_UPDATE_ENDPOINT="true"
- TUNNEL_ID="$(cli_get_val ${1})"
+ TUNNEL_ID="$(cli_get_val "${1}")"
- USERNAME="$(cli_get_val ${1})"
+ USERNAME="$(cli_get_val "${1}")"
- PASSWORD="$(cli_get_val ${1})"
+ PASSWORD="$(cli_get_val "${1}")"
;;
*)
echo "Unknown option: ${1}" >&2
;;
*)
echo "Unknown option: ${1}" >&2
PRIORITY="$(cli_get_val "${arg}")"
;;
esac
PRIORITY="$(cli_get_val "${arg}")"
;;
esac
+ done <<< "$(args "$@")"
if ! zone_port_settings_write "${zone}" "${port}"; then
exit ${EXIT_ERROR}
if ! zone_port_settings_write "${zone}" "${port}"; then
exit ${EXIT_ERROR}
while [ $# -gt 0 ]; do
case "${1}" in
--apn=*)
while [ $# -gt 0 ]; do
case "${1}" in
--apn=*)
- APN=$(cli_get_val ${1})
+ APN=$(cli_get_val "${1}")
- AUTH=$(cli_get_val ${1})
+ AUTH=$(cli_get_val "${1}")
- BAUDRATE=$(cli_get_val ${1})
+ BAUDRATE=$(cli_get_val "${1}")
assert isoneif "${BAUDRATE}" ${SERIAL_BAUDRATES}
;;
--device=*)
assert isoneif "${BAUDRATE}" ${SERIAL_BAUDRATES}
;;
--device=*)
- DEVICE=$(cli_get_val ${1})
+ DEVICE=$(cli_get_val "${1}")
;;
--imsi=*)
IMSI="$(cli_get_val "${1}")"
;;
--monitor-device=*)
;;
--imsi=*)
IMSI="$(cli_get_val "${1}")"
;;
--monitor-device=*)
- MONITOR_DEVICE=$(cli_get_val ${1})
+ MONITOR_DEVICE=$(cli_get_val "${1}")
- MTU=$(cli_get_val ${1})
+ MTU=$(cli_get_val "${1}")
assert isinteger ${MTU}
;;
--password=*)
assert isinteger ${MTU}
;;
--password=*)
- PASSWORD=$(cli_get_val ${1})
+ PASSWORD=$(cli_get_val "${1}")
- PHONE_NUMBER=$(cli_get_val ${1})
+ PHONE_NUMBER=$(cli_get_val "${1}")
- PIN=$(cli_get_val ${1})
+ PIN=$(cli_get_val "${1}")
- USERNAME=$(cli_get_val ${1})
+ USERNAME=$(cli_get_val "${1}")
;;
*)
echo "Unknown argument: ${1}" >&2
;;
*)
echo "Unknown argument: ${1}" >&2
while [ $# -gt 0 ]; do
case "${1}" in
--access-concentrator=*)
while [ $# -gt 0 ]; do
case "${1}" in
--access-concentrator=*)
- ACCESS_CONCENTRATOR=$(cli_get_val ${1})
+ ACCESS_CONCENTRATOR=$(cli_get_val "${1}")
- AUTH=$(cli_get_val ${1})
+ AUTH=$(cli_get_val "${1}")
;;
--ipv6=*)
local value="$(cli_get_val "${1}")"
;;
--ipv6=*)
local value="$(cli_get_val "${1}")"
- MTU=$(cli_get_val ${1})
+ MTU=$(cli_get_val "${1}")
- PASSWORD=$(cli_get_val ${1})
+ PASSWORD=$(cli_get_val "${1}")
;;
--prefix-delegation=*)
PREFIX_DELEGATION="$(cli_get_bool "${1}")"
;;
--service-name=*)
;;
--prefix-delegation=*)
PREFIX_DELEGATION="$(cli_get_bool "${1}")"
;;
--service-name=*)
- SERVICE_NAME=$(cli_get_val ${1})
+ SERVICE_NAME=$(cli_get_val "${1}")
- USERNAME=$(cli_get_val ${1})
+ USERNAME=$(cli_get_val "${1}")
;;
*)
warning "Unknown argument: ${1}" >&2
;;
*)
warning "Unknown argument: ${1}" >&2
while [ $# -gt 0 ]; do
case "${1}" in
--phy=*|--parent-device=*)
while [ $# -gt 0 ]; do
case "${1}" in
--phy=*|--parent-device=*)
- PHY=$(cli_get_val ${1})
+ PHY=$(cli_get_val "${1}")
- ENCRYPTION_MODE=$(cli_get_val ${1})
+ ENCRYPTION_MODE=$(cli_get_val "${1}")
- ADDRESS=$(cli_get_val ${1})
+ ADDRESS=$(cli_get_val "${1}")
- SSID=$(cli_get_val ${1})
+ SSID=$(cli_get_val "${1}")
- KEY=$(cli_get_val ${1})
+ KEY=$(cli_get_val "${1}")
;;
*)
warning "Unrecognized option: ${1}"
;;
*)
warning "Unrecognized option: ${1}"
network_settings_read
cli_settings() {
network_settings_read
cli_settings() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-settings
exit ${EXIT_OK}
fi
if [ -n "${1}" ]; then
cli_show_man network-settings
exit ${EXIT_OK}
fi
if [ -n "${1}" ]; then
- network_settings_set $@
+ network_settings_set "$@"
network_settings_write
else
network_settings_print
network_settings_write
else
network_settings_print
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-device
exit ${EXIT_OK}
fi
cli_show_man network-device
exit ${EXIT_OK}
fi
case "${action}" in
list)
case "${action}" in
list)
;;
*)
local device="${action}"
;;
*)
local device="${action}"
case "${action}" in
discover)
case "${action}" in
discover)
- cli_device_discover ${device} $@
+ cli_device_discover ${device} "$@"
- device_identify "${device}" $@
+ device_identify "${device}" "$@"
- cli_device_monitor "${device}" $@
+ cli_device_monitor "${device}" "$@"
;;
status)
cli_device_status ${device}
;;
unlock)
;;
status)
cli_device_status ${device}
;;
unlock)
- cli_device_serial_unlock ${device} $@
+ cli_device_serial_unlock ${device} "$@"
- cli_device_send_ussd_command "${device}" $@
+ cli_device_send_ussd_command "${device}" "$@"
;;
*)
cli_show_man network-device
;;
*)
cli_show_man network-device
}
cli_device_serial_unlock() {
}
cli_device_serial_unlock() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-device
exit ${EXIT_OK}
fi
cli_show_man network-device
exit ${EXIT_OK}
fi
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network
exit ${EXIT_OK}
fi
cli_show_man network
exit ${EXIT_OK}
fi
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-port
exit ${EXIT_OK}
fi
cli_show_man network-port
exit ${EXIT_OK}
fi
case "${action}" in
edit|create|remove|up|down|status|identify)
case "${action}" in
edit|create|remove|up|down|status|identify)
- port_${action} "${port}" $@
+ port_${action} "${port}" "$@"
- color_cli "port" "${port}" $@
+ color_cli "port" "${port}" "$@"
- description_cli "port" "${port}" $@
+ description_cli "port" "${port}" "$@"
;;
*)
error "Unrecognized argument: ${action}"
;;
*)
error "Unrecognized argument: ${action}"
case "${action}" in
new|destroy)
case "${action}" in
new|destroy)
;;
*)
error "Unrecognized argument: ${action}"
;;
*)
error "Unrecognized argument: ${action}"
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-zone
exit ${EXIT_OK}
fi
cli_show_man network-zone
exit ${EXIT_OK}
fi
case "${action}" in
port)
case "${action}" in
port)
- cli_zone_port "${zone}" $@
+ cli_zone_port "${zone}" "$@"
- cli_zone_rename "${zone}" $@
+ cli_zone_rename "${zone}" "$@"
;;
config|disable|down|edit|enable|identify|status|up)
;;
config|disable|down|edit|enable|identify|status|up)
- zone_${action} ${zone} $@
+ zone_${action} ${zone} "$@"
- color_cli "zone" "${zone}" $@
+ color_cli "zone" "${zone}" "$@"
- description_cli "zone" ${zone} $@
+ description_cli "zone" ${zone} "$@"
;;
*)
error "Unrecognized argument: ${action}"
;;
*)
error "Unrecognized argument: ${action}"
;;
""|*)
if [ -n "${action}" ]; then
;;
""|*)
if [ -n "${action}" ]; then
- if cli_help_requested $@ || [ $# -lt 2 ]; then
+ if cli_help_requested "$@" || [ $# -lt 2 ]; then
cli_show_man network-zone-new
exit ${EXIT_OK}
fi
cli_show_man network-zone-new
exit ${EXIT_OK}
fi
}
# Removes a zone either immediately, if it is currently down,
# or adds a tag that the removal will be done when the zone
# is brought down the next time.
cli_zone_destroy() {
}
# Removes a zone either immediately, if it is currently down,
# or adds a tag that the removal will be done when the zone
# is brought down the next time.
cli_zone_destroy() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-zone
exit ${EXIT_OK}
fi
cli_show_man network-zone
exit ${EXIT_OK}
fi
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-zone-port
exit ${EXIT_OK}
fi
cli_show_man network-zone-port
exit ${EXIT_OK}
fi
case "${action}" in
edit)
case "${action}" in
edit)
- zone_port_edit "${zone}" "${port}" $@
+ zone_port_edit "${zone}" "${port}" "$@"
;;
*)
error "Unrecognised argument: ${action}"
;;
*)
error "Unrecognised argument: ${action}"
case "${action}" in
attach)
case "${action}" in
attach)
- zone_port_attach "${zone}" $@
+ zone_port_attach "${zone}" "$@"
- zone_port_detach "${zone}" $@
+ zone_port_detach "${zone}" "$@"
;;
*)
error "Unrecognised argument: ${action}"
;;
*)
error "Unrecognised argument: ${action}"
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-zone
exit ${EXIT_OK}
fi
cli_show_man network-zone
exit ${EXIT_OK}
fi
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-zone
exit ${EXIT_OK}
fi
cli_show_man network-zone
exit ${EXIT_OK}
fi
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-dhcp
exit ${EXIT_OK}
fi
cli_show_man network-dhcp
exit ${EXIT_OK}
fi
case "${action}" in
edit)
case "${action}" in
edit)
+ dhcpd_edit ${proto} "$@"
;;
start)
dhcpd_start ${proto}
;;
start)
dhcpd_start ${proto}
dhcpd_reload ${proto}
;;
subnet)
dhcpd_reload ${proto}
;;
subnet)
- cli_dhcpd_subnet ${proto} $@
+ cli_dhcpd_subnet ${proto} "$@"
- cli_dhcpd_show ${proto} $@
+ cli_dhcpd_show ${proto} "$@"
;;
*)
error "Unrecognized action: ${action}"
;;
*)
error "Unrecognized action: ${action}"
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-dhcp-subnet
exit ${EXIT_OK}
fi
cli_show_man network-dhcp-subnet
exit ${EXIT_OK}
fi
- dhcpd_subnet_new ${proto} $@
+ dhcpd_subnet_new ${proto} "$@"
- dhcpd_subnet_remove ${proto} $@
+ dhcpd_subnet_remove ${proto} "$@"
;;
*:*/*|*.*.*.*/*)
local subnet=${action}
;;
*:*/*|*.*.*.*/*)
local subnet=${action}
case "${action}" in
edit)
case "${action}" in
edit)
- dhcpd_subnet_edit ${proto} ${subnet} $@
+ dhcpd_subnet_edit ${proto} ${subnet} "$@"
local ret=$?
if [ ${ret} -eq ${EXIT_OK} ]; then
local ret=$?
if [ ${ret} -eq ${EXIT_OK} ]; then
- cli_dhcpd_subnet_range ${proto} ${subnet} $@
+ cli_dhcpd_subnet_range ${proto} ${subnet} "$@"
- cli_dhcpd_subnet_show ${proto} ${subnet} $@
+ cli_dhcpd_subnet_show ${proto} ${subnet} "$@"
- cli_dhcpd_subnet_options ${proto} ${subnet} $@
+ cli_dhcpd_subnet_options ${proto} ${subnet} "$@"
- dhcpd_subnet_range_new ${proto} ${subnet} $@ || exit ${EXIT_ERROR}
+ dhcpd_subnet_range_new ${proto} ${subnet} "$@" || exit ${EXIT_ERROR}
- dhcpd_subnet_range_remove ${proto} ${subnet} $@ || exit ${EXIT_ERROR}
+ dhcpd_subnet_range_remove ${proto} ${subnet} "$@" || exit ${EXIT_ERROR}
;;
*)
error "Unrecognized action: ${action}"
;;
*)
error "Unrecognized action: ${action}"
case "${1}" in
*=*)
key=$(cli_get_key ${1})
case "${1}" in
*=*)
key=$(cli_get_key ${1})
- val=$(cli_get_val ${1})
+ val=$(cli_get_val "${1}")
dhcpd_subnet_option_set ${proto} ${subnet} ${key} ${val}
esac
dhcpd_subnet_option_set ${proto} ${subnet} ${key} ${val}
esac
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network
exit ${EXIT_OK}
fi
cli_show_man network
exit ${EXIT_OK}
fi
- local zones=$(zones_get $@)
+ local zones=$(zones_get "$@")
local zone
for zone in ${zones}; do
local zone
for zone in ${zones}; do
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network
exit ${EXIT_OK}
fi
cli_show_man network
exit ${EXIT_OK}
fi
- local zones=$(zones_get $@)
+ local zones=$(zones_get "$@")
local zone
for zone in ${zones}; do
local zone
for zone in ${zones}; do
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network
exit ${EXIT_OK}
fi
cli_show_man network
exit ${EXIT_OK}
fi
# Give the system some time to calm down
sleep ${TIMEOUT_RESTART}
# Give the system some time to calm down
sleep ${TIMEOUT_RESTART}
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network
exit ${EXIT_OK}
fi
cli_show_man network
exit ${EXIT_OK}
fi
local log_disable_stdout=${LOG_DISABLE_STDOUT}
LOG_DISABLE_STDOUT="true"
local log_disable_stdout=${LOG_DISABLE_STDOUT}
LOG_DISABLE_STDOUT="true"
- local zones=$(zones_get $@)
+ local zones=$(zones_get "$@")
local zone
for zone in ${zones}; do
local zone
for zone in ${zones}; do
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network
exit ${EXIT_OK}
fi
cli_show_man network
exit ${EXIT_OK}
fi
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-dns-server
exit ${EXIT_OK}
fi
cli_show_man network-dns-server
exit ${EXIT_OK}
fi
db_dump
;;
ipsec-connection-exists)
db_dump
;;
ipsec-connection-exists)
- ipsec_connection_exists $@
+ ipsec_connection_exists "$@"
;;
list-devices)
device_list
;;
list-dhcpd-ranges-of-subnet)
;;
list-devices)
device_list
;;
list-dhcpd-ranges-of-subnet)
- dhcpd_subnet_range_list $@
+ dhcpd_subnet_range_list "$@"
- dhcpd_global_settings_list $@
+ dhcpd_global_settings_list "$@"
;;
list-dhcpd-subnet-options)
;;
list-dhcpd-subnet-options)
- dhcpd_subnet_options_list $@
+ dhcpd_subnet_options_list "$@"
;;
list-dns-servers)
dns_server_list
;;
list-dns-servers)
dns_server_list
port_list_free
;;
list-hooks)
port_list_free
;;
list-hooks)
;;
list-ipsec-connections)
ipsec_list_connections
;;
list-ipsec-connections)
ipsec_list_connections
port_list
;;
list-ports-of-zone)
port_list
;;
list-ports-of-zone)
;;
list-vpn-security-policies-all)
vpn_security_policies_list_all
;;
list-vpn-security-policies-all)
vpn_security_policies_list_all
zones_get_next_free
;;
list-zone-config-ids)
zones_get_next_free
;;
list-zone-config-ids)
- zone_config_list_ids $@
+ zone_config_list_ids "$@"
;;
list-zone-config-hids)
;;
list-zone-config-hids)
- zone_config_list_hids $@
+ zone_config_list_hids "$@"
;;
vpn-security-policy-exists)
;;
vpn-security-policy-exists)
- vpn_security_policy_exists $@
+ vpn_security_policy_exists "$@"
+ zone_name_is_valid "$@"
;;
zone-config-id-is-valid)
;;
zone-config-id-is-valid)
- zone_config_id_is_valid $@
+ zone_config_id_is_valid "$@"
;;
zone-config-hid-is-valid)
;;
zone-config-hid-is-valid)
- zone_config_hid_is_valid $@
+ zone_config_hid_is_valid "$@"
;;
*)
error "No such command: ${cmd}"
;;
*)
error "No such command: ${cmd}"
;;
settings|hostname|port|device|zone|start|stop|restart|status|reset|route|vpn)
;;
settings|hostname|port|device|zone|start|stop|restart|status|reset|route|vpn)
;;
# DHCP server configuration (automatically detects which protocol to use).
dhcpv6|dhcpv4)
;;
# DHCP server configuration (automatically detects which protocol to use).
dhcpv6|dhcpv4)
- cli_dhcpd ${action/dhcp/ip} $@
+ cli_dhcpd ${action/dhcp/ip} "$@"
;;
# DNS server configuration.
dns-server)
;;
# DNS server configuration.
dns-server)