while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- address=$(cli_get_val ${1})
+ address=$(cli_get_val "${1}")
;;
--mode=*)
- mode=$(cli_get_val ${1})
+ mode=$(cli_get_val "${1}")
;;
*)
error "Unrecognized argument: ${1}"
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- address=$(cli_get_val ${1})
+ address=$(cli_get_val "${1}")
;;
--mtu=*)
- mtu=$(cli_get_val ${1})
+ mtu=$(cli_get_val "${1}")
;;
*)
error "Unrecognized argument: ${1}"
;;
zone)
- firewall_cli_zone $@
+ firewall_cli_zone "$@"
;;
""|help|--help|-h)
assert isset protocol
shift
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man firewall-panic
exit ${EXIT_OK}
fi
}
firewall_cli_settings() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man firewall-settings
exit ${EXIT_OK}
fi
assert isset protocol
shift
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man firewall-zone
exit ${EXIT_OK}
fi
# Process the given action.
case "${action}" in
edit)
- firewall_cli_zone_edit ${zone} $@
+ firewall_cli_zone_edit ${zone} "$@"
;;
status|"")
- firewall_cli_zone_status ${zone} $@
+ firewall_cli_zone_status ${zone} "$@"
;;
# Print the raw configuration settings.
show)
- firewall_zone_print ${zone} $@
+ firewall_zone_print ${zone} "$@"
exit ${EXIT_ERROR}
;;
case "${action}" in
reset)
- firewall_zone_reset $@
+ firewall_zone_reset "$@"
exit $?
;;
}
device_is_phy() {
- phy_exists $@
+ phy_exists "$@"
}
device_is_serial() {
- serial_exists $@
+ serial_exists "$@"
}
# Returns true if a device is a tun device
# Check if the device is free
device_is_free() {
- ! device_is_used $@
+ ! device_is_used "$@"
}
# Check if the device is used
seconds="$(cli_get_val "${arg}")"
;;
esac
- done <<< "$(args $@)"
+ done <<< "$(args "$@")"
assert isinteger seconds
}
dhcpd_start() {
- local services=$(dhcpd_service $@)
+ local services=$(dhcpd_service "$@")
local service
for service in ${services}; do
}
dhcpd_stop() {
- local services=$(dhcpd_service $@)
+ local services=$(dhcpd_service "$@")
local service
for service in ${services}; do
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
}
dhcpd_reload() {
- dhcpd_restart $@
+ dhcpd_restart "$@"
}
dhcpd_enable() {
- local services=$(dhcpd_service $@)
+ local services=$(dhcpd_service "$@")
local service
for service in ${services}; do
}
dhcpd_disable() {
- local services=$(dhcpd_service $@)
+ local services=$(dhcpd_service "$@")
local service
for service in ${services}; do
case "${proto}" in
ipv6)
- _dhcpd_edit_ipv6 $@ || return $?
+ _dhcpd_edit_ipv6 "$@" || return $?
;;
ipv4)
- _dhcpd_edit_ipv4 $@ || return $?
+ _dhcpd_edit_ipv4 "$@" || return $?
;;
esac
while [ $# -gt 0 ]; do
case "${1}" in
--authoritative=*)
- val=$(cli_get_val ${1})
+ val=$(cli_get_val "${1}")
if enabled val; then
AUTHORITATIVE="true"
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
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
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
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
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
}
dhcpd_subnet_exists() {
- dhcpd_subnet_match $@
+ dhcpd_subnet_match "$@"
}
dhcpd_subnet_new() {
assert isset proto
shift
- dhcpd_subnet_edit ${proto} "new" $@
+ dhcpd_subnet_edit ${proto} "new" "$@"
}
dhcpd_subnet_edit() {
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})"
# IPv4 options
ipv4,*,--routers=*)
- ROUTERS=$(cli_get_val ${1})
+ ROUTERS=$(cli_get_val "${1}")
;;
*)
}
dhcpd_subnet_options_file() {
- local path=$(dhcpd_subnet_path $@)
+ local path=$(dhcpd_subnet_path "$@")
assert isset path
print "${path}/options"
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//\"/}"
while read -r arg; do
case "${arg}" in
server=*)
- server=$(cli_get_val ${arg})
+ server=$(cli_get_val "${arg}")
;;
priority=*)
- priority=$(cli_get_val ${arg})
+ priority=$(cli_get_val "${arg}")
;;
esac
- done <<< "$(args $@)"
+ done <<< "$(args "$@")"
# The server address must be set.
isset server || return ${EXIT_ERROR}
shift
# Execute the check function
- "${check_func}" $@
+ "${check_func}" "$@"
local ret="${?}"
case "${ret}" in
return ${EXIT_ERROR}
fi
- val=$(cli_get_val ${arg})
+ val=$(cli_get_val "${arg}")
assign "${key}" "${val}"
- done <<< "$(args $@)"
+ done <<< "$(args "$@")"
# action must always be set.
if ! isset action; then
}
firewall_zone_exists() {
- local file=$(firewall_zone_config $@)
+ local file=$(firewall_zone_config "$@")
[ -r "${file}" ] && return ${EXIT_TRUE} || return ${EXIT_FALSE}
}
while [ $# -gt 0 ]; do
case "${1}" in
--masquerade4=*)
- MASQUERADE4=$(cli_get_val ${1})
+ MASQUERADE4=$(cli_get_val "${1}")
;;
--policy=*)
- POLICY=$(cli_get_val ${1})
+ POLICY=$(cli_get_val "${1}")
;;
*)
warning "Unknown option: ${1}"
while [ $# -gt 0 ]; do
case "${1}" in
--username=*)
- username="$(cli_get_val ${1})"
+ username="$(cli_get_val "${1}")"
;;
--password=*)
- password="$(cli_get_val ${1})"
+ password="$(cli_get_val "${1}")"
;;
--tunnel-id=*)
- tunnel_id="$(cli_get_val ${1})"
+ tunnel_id="$(cli_get_val "${1}")"
;;
esac
shift
}
hook_zone_exists() {
- hook_exists zone $@
+ hook_exists zone "$@"
}
hook_zone_exec() {
- hook_exec zone $@
+ hook_exec zone "$@"
}
hook_zone_get_all() {
}
hook_config_exists() {
- hook_exists config $@
+ hook_exists config "$@"
}
hook_config_exec() {
- hook_exec config $@
+ hook_exec config "$@"
}
hook_config_get_all() {
while [ $# -gt 0 ]; do
case "${1}" in
--broadcast-ssid=*)
- broadcast_ssid=$(cli_get_val ${1})
+ broadcast_ssid=$(cli_get_val "${1}")
;;
--channel=*)
- channel=$(cli_get_val ${1})
+ channel=$(cli_get_val "${1}")
;;
--encryption=*)
- encryption=$(cli_get_val ${1})
+ encryption=$(cli_get_val "${1}")
;;
--ieee80211d=*)
local val="$(cli_get_val "${1}")"
fi
;;
--key=*)
- key=$(cli_get_val ${1})
+ key=$(cli_get_val "${1}")
;;
--mode=*)
- mode=$(cli_get_val ${1})
+ mode=$(cli_get_val "${1}")
;;
--ssid=*)
- ssid=$(cli_get_val ${1})
+ ssid=$(cli_get_val "${1}")
;;
--wmm=*)
local val="$(cli_get_val "${1}")"
while [ $# -gt 0 ]; do
case "${1}" in
--username=*)
- username="$(cli_get_val ${1})"
+ username="$(cli_get_val "${1}")"
;;
--password=*)
- password="$(cli_get_val ${1})"
+ password="$(cli_get_val "${1}")"
;;
*)
break
shift
done
- local url="$(cli_get_val ${1})"
+ local url="$(cli_get_val "${1}")"
shift
# Add credentials to the URL.
}
__processor_id_to_bitmap() {
- hex $(( 1 << $@ ))
+ hex $(( 1 << "$@" ))
}
interrupt_set_smp_affinity() {
}
ip_get_network() {
- inetcalc -n $@ && return ${EXIT_OK} || return ${EXIT_ERROR}
+ inetcalc -n "$@" && return ${EXIT_OK} || return ${EXIT_ERROR}
}
ip_network_is_subset_of() {
assert [ $# -eq 2 ]
- inetcalc -s $@ && return ${EXIT_TRUE} || return ${EXIT_FALSE}
+ inetcalc -s "$@" && return ${EXIT_TRUE} || return ${EXIT_FALSE}
}
ip_address_add() {
while [ $# -gt 0 ]; do
case "${1}" in
--mode=*)
- mode="$(cli_get_val ${1})"
+ mode="$(cli_get_val "${1}")"
;;
--ttl=*)
- ttl="$(cli_get_val ${1})"
+ ttl="$(cli_get_val "${1}")"
;;
--remote-address=*)
- remote_address="$(cli_get_val ${1})"
+ remote_address="$(cli_get_val "${1}")"
;;
--local-address=*)
- local_address="$(cli_get_val ${1})"
+ local_address="$(cli_get_val "${1}")"
;;
# Keys for VTI
--ikey=*)
- ikey="$(cli_get_val ${1})"
+ ikey="$(cli_get_val "${1}")"
;;
--okey=*)
- okey="$(cli_get_val ${1})"
+ okey="$(cli_get_val "${1}")"
;;
esac
shift
case "${action}" in
connection)
- cli_ipsec_connection $@
+ cli_ipsec_connection "$@"
;;
pool)
- cli_ipsec_pool $@
+ cli_ipsec_pool "$@"
;;
*)
error "Unrecognized argument: ${action}"
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}"
case "${action}" in
new)
- ipsec_connection_new $@
+ ipsec_connection_new "$@"
;;
destroy)
- cli_ipsec_connection_destroy $@
+ cli_ipsec_connection_destroy "$@"
;;
""|*)
if [ -n "${action}" ]; then
case "${key}" in
dns_server|network)
- ipsec_pool_${key} ${pool} $@
+ ipsec_pool_${key} ${pool} "$@"
;;
show)
cli_ipsec_pool_show "${pool}"
case "${action}" in
new)
- ipsec_pool_new $@
+ ipsec_pool_new "$@"
;;
destroy)
- ipsec_pool_destroy $@
+ ipsec_pool_destroy "$@"
;;
""|*)
if [ -n "${action}" ]; then
if [ $# -eq 0 ] && [ -n "${IPSEC_CONNECTION_CONFIG_SETTINGS}" ]; then
list_append args ${IPSEC_CONNECTION_CONFIG_SETTINGS}
else
- list_append args $@
+ list_append args "$@"
fi
local path="${NETWORK_IPSEC_CONNS_DIR}/${connection}/settings"
case ${cmd} in
mode)
- ipsec_connection_authentication_mode "${connection}" $@
+ ipsec_connection_authentication_mode "${connection}" "$@"
;;
pre-shared-key)
- ipsec_connection_authentication_psk "${connection}" $@
+ ipsec_connection_authentication_psk "${connection}" "$@"
;;
*)
log ERROR "Unrecognized argument: ${cmd}"
case ${cmd} in
action)
- ipsec_connection_dpd_action "${connection}" $@
+ ipsec_connection_dpd_action "${connection}" "$@"
;;
delay)
- ipsec_connection_dpd_delay "${connection}" $@
+ ipsec_connection_dpd_delay "${connection}" "$@"
;;
timeout)
- ipsec_connection_dpd_timeout "${connection}" $@
+ ipsec_connection_dpd_timeout "${connection}" "$@"
;;
*)
log ERROR "Unrecognized argument: ${cmd}"
local value=$@
if ! isinteger value; then
- value=$(parse_time $@)
+ value=$(parse_time "$@")
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
- value=$(parse_time $@)
+ value=$(parse_time "$@")
if [ ! $? -eq 0 ]; then
log ERROR "Parsing the passed time was not sucessful please check the passed values."
return ${EXIT_ERROR}
case ${cmd} in
address)
- ipsec_connection_local_address "${connection}" $@
+ ipsec_connection_local_address "${connection}" "$@"
;;
id)
- ipsec_connection_id "${connection}" "LOCAL" $@
+ ipsec_connection_id "${connection}" "LOCAL" "$@"
;;
prefix)
- ipsec_connection_prefix "${connection}" "LOCAL" $@
+ ipsec_connection_prefix "${connection}" "LOCAL" "$@"
;;
*)
log ERROR "Unrecognized argument: ${cmd}"
case ${cmd} in
id)
- ipsec_connection_id "${connection}" "REMOTE" $@
+ ipsec_connection_id "${connection}" "REMOTE" "$@"
;;
prefix)
- ipsec_connection_prefix "${connection}" "REMOTE" $@
+ ipsec_connection_prefix "${connection}" "REMOTE" "$@"
;;
*)
log ERROR "Unrecognized argument: ${cmd}"
local value=$@
if ! isinteger value; then
- value=$(parse_time $@)
+ value=$(parse_time "$@")
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
- 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 [ $# -eq 0 ] && [ -n "${IPSEC_POOL_CONFIG_SETTINGS}" ]; then
list_append args ${IPSEC_POOL_CONFIG_SETTINGS}
else
- list_append args $@
+ list_append args "$@"
fi
local path="${NETWORK_IPSEC_POOLS_DIR}/${pool}/settings"
# one ore more vpn ipsec pools
ipsec_pool_destroy() {
local pool
- for pool in $@; do
+ for pool in "$@"; do
if ! ipsec_pool_exists "${pool}"; then
log ERROR "The VPN IPsec pool ${pool} does not exist."
continue
shift
;;
--policy=*)
- policy="$(cli_get_val ${1})"
+ policy="$(cli_get_val "${1}")"
;;
-*)
log WARNING "Unrecognized argument: ${1}"
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}"
IPTABLES_PORTRANGE=2
_iptables_port_range() {
- grep -q ":" <<< $@
+ grep -q ":" <<< "$@"
}
_iptables_port_multiport() {
- grep -q "," <<< $@
+ grep -q "," <<< "$@"
}
_iptables_port() {
iptables_source_port() {
[ -z "$@" ] && return
local type
- type=$(_iptables_port $@)
+ type=$(_iptables_port "$@")
if [ "$type" = "$IPTABLES_MULTIPORT" ]; then
echo "-m multiport --source-ports $@"
else
iptables_destination_port() {
[ -z "$@" ] && return
local type
- type=$(_iptables_port $@)
+ type=$(_iptables_port "$@")
if [ "$type" = "$IPTABLES_MULTIPORT" ]; then
echo "-m multiport --destination-ports $@"
else
}
ipv4_get_network() {
- ip_get_network $@
+ ip_get_network "$@"
}
ipv4_get_broadcast() {
- inetcalc -4 -b $@ && return ${EXIT_OK} || return ${EXIT_ERROR}
+ inetcalc -4 -b "$@" && return ${EXIT_OK} || return ${EXIT_ERROR}
}
ipv4_encode() {
}
ipv4_addr_ge() {
- ipv4_addr_eq $@ || ipv4_addr_gt $@
+ ipv4_addr_eq "$@" || ipv4_addr_gt "$@"
}
ipv4_addr_lt() {
- ! ipv4_addr_eq $@ && ! ipv4_addr_gt $@
+ ! ipv4_addr_eq "$@" && ! ipv4_addr_gt "$@"
}
ipv4_addr_le() {
- ipv4_addr_eq $@ || ! ipv4_addr_gt $@
+ ipv4_addr_eq "$@" || ! ipv4_addr_gt "$@"
}
ipv4_range() {
accept_ra=2
;;
esac
- done <<< "$(args $@)"
+ done <<< "$(args "$@")"
sysctl_set "net.ipv6.conf.${device}.forwarding" 1
wait_for_dad="false"
;;
esac
- done <<< "$(args $@)"
+ done <<< "$(args "$@")"
local cmd="ip addr add ${address} dev ${device} scope ${scope}"
valid_lft="$(cli_get_val "${arg}")"
;;
esac
- done <<< "$(args $@)"
+ done <<< "$(args "$@")"
local cmd="ip -6 addr change ${address} dev ${device} scope global"
scope="$(cli_get_val "${arg}")"
;;
esac
- done <<< "$(args $@)"
+ done <<< "$(args "$@")"
local cmd="ip -o addr show dev ${device}"
if isset scope; then
}
ipv6_format() {
- inetcalc -6 -f $@
+ inetcalc -6 -f "$@"
}
ipv6_addr_eq() {
}
ipv6_addr_ge() {
- ipv6_addr_eq $@ || ipv6_addr_gt $@
+ ipv6_addr_eq "$@" || ipv6_addr_gt "$@"
}
ipv6_addr_lt() {
- ! ipv6_addr_eq $@ && ! ipv6_addr_gt $@
+ ! ipv6_addr_eq "$@" && ! ipv6_addr_gt "$@"
}
ipv6_addr_le() {
- ipv6_addr_eq $@ || ! ipv6_addr_gt $@
+ ipv6_addr_eq "$@" || ! ipv6_addr_gt "$@"
}
ipv6_get_network() {
- ip_get_network $@
+ ip_get_network "$@"
}
shift
local arg
- for arg in $@; do
+ for arg in "$@"; do
list_append_one "${list}" "${arg}"
done
}
local ret=${EXIT_ERROR}
local arg
- for arg in $@; do
+ for arg in "$@"; do
if ! list_match ${arg} ${!list}; then
list_append_one ${list} "${arg}"
ret=${EXIT_OK}
local _list k
for k in ${!list}; do
- if list_match ${k} $@; then
+ if list_match ${k} "$@"; then
ret=${EXIT_OK}
continue
fi
list_sort() {
local i
- for i in $@; do
+ for i in "$@"; do
print "${i}"
done | sort | tr '\n' ' '
print
list_unique() {
local items item
- for item in $@; do
+ for item in "$@"; do
# Check if the item has already been processed.
list_match "${item}" ${items} && continue
shift
local i
- for i in $@; do
+ for i in "$@"; do
[ "${match}" = "${i}" ] && return ${EXIT_OK}
done
local length=0
local i
- for i in $@; do
+ for i in "$@"; do
length=$(( ${length} + 1 ))
done
local counter=0
local arg
- for arg in $@; do
+ for arg in "$@"; do
if [ "${arg}" = "${what}" ]; then
counter=$(( ${counter} + 1 ))
fi
list_reverse() {
local reversed arg
- for arg in $@; do
+ for arg in "$@"; do
reversed="${arg} ${reversed}"
done
list_head() {
local arg
- for arg in $@; do
+ for arg in "$@"; do
print "${arg}"
return ${EXIT_OK}
done
while [ $# -gt 0 ]; do
case "${1}" in
--timeout=*)
- timeout=$(cli_get_val ${1})
+ timeout=$(cli_get_val "${1}")
;;
--answer=*)
- answer=$(cli_get_val ${1})
+ answer=$(cli_get_val "${1}")
;;
--quiet)
quiet="true"
}
modem_sim_locked() {
- modem_sim_unlocked $@ && return ${EXIT_FALSE} || return ${EXIT_TRUE}
+ modem_sim_unlocked "$@" && return ${EXIT_FALSE} || return ${EXIT_TRUE}
}
modem_sim_unlock() {
}
port_is_up() {
- device_is_up $@
+ device_is_up "$@"
}
port_new() {
return ${EXIT_ERROR}
fi
- hook_exec port "${hook}" new $@
+ hook_exec port "${hook}" new "$@"
}
port_destroy() {
}
port_create() {
- port_cmd "create" $@
+ port_cmd "create" "$@"
}
port_remove() {
}
port_edit() {
- port_cmd edit $@
+ port_cmd edit "$@"
}
port_up() {
}
port_down() {
- port_cmd down $@
+ port_cmd down "$@"
}
port_status() {
- port_cmd status $@
+ port_cmd status "$@"
}
port_cmd() {
return ${EXIT_ERROR}
fi
- hook_exec port ${hook} ${cmd} ${port} $@
+ hook_exec port ${hook} ${cmd} ${port} "$@"
}
ports_get() {
}
port_identify() {
- device_identify $@
+ device_identify "$@"
}
port_get_color() {
while [ $# -gt 0 ]; do
case "${1}" in
--auth=*)
- auth=$(cli_get_val ${1})
+ auth=$(cli_get_val "${1}")
;;
--baudrate=*)
- baudrate=$(cli_get_val ${1})
+ baudrate=$(cli_get_val "${1}")
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=*)
- value=$(cli_get_val ${1})
+ value=$(cli_get_val "${1}")
if enabled value; then
default_asyncmap="true"
else
;;
# The name of the created ppp interface.
--interface=*)
- interface=$(cli_get_val ${1})
+ interface=$(cli_get_val "${1}")
;;
# IPv6
--ipv6=*)
- ipv6="$(cli_get_val ${1})"
+ ipv6="$(cli_get_val "${1}")"
;;
# 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"
;;
# 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"
;;
# Maximum Transmission Unit
--mtu=*)
- mtu=$(cli_get_val ${1})
+ mtu=$(cli_get_val "${1}")
;;
# Maximum Receive Unit
--mru=*)
- mru=$(cli_get_val ${1})
+ mru=$(cli_get_val "${1}")
;;
--password=*)
- password=$(cli_get_val ${1})
+ password=$(cli_get_val "${1}")
;;
--plugin=*)
- plugin=$(cli_get_val ${1})
+ plugin=$(cli_get_val "${1}")
;;
--plugin-options=*)
- plugin_options=$(cli_get_val ${1})
+ plugin_options=$(cli_get_val "${1}")
;;
--pty=*)
- pty=$(cli_get_val ${1})
+ pty=$(cli_get_val "${1}")
;;
# Refused authentication methods
--refuse=*)
;;
# Sets if the modem is a serial device.
--serial=*)
- serial=$(cli_get_val ${1})
+ serial=$(cli_get_val "${1}")
;;
--serial-device=*)
- serial_device=$(cli_get_val ${1})
+ serial_device=$(cli_get_val "${1}")
;;
--username=*)
- username=$(cli_get_val ${1})
+ username=$(cli_get_val "${1}")
;;
*)
log WARNING "Unhandled argument: ${1}"
while [ $# -gt 0 ]; do
case "${1}" in
--auth=*)
- auth=$(cli_get_val ${1})
+ auth=$(cli_get_val "${1}")
;;
--default-asyncmap=*)
- default_asyncmap=$(cli_get_val ${1})
+ default_asyncmap=$(cli_get_val "${1}")
;;
--disable-ipv6)
ipv6="false"
;;
--dns-servers=*)
- dns_servers="$(cli_get_val ${1})"
+ dns_servers="$(cli_get_val "${1}")"
;;
--lcp-echo-failure=*)
- lcp_echo_failure=$(cli_get_val ${1})
+ lcp_echo_failure=$(cli_get_val "${1}")
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=*)
- proxyarp=$(cli_get_val ${1})
+ proxyarp=$(cli_get_val "${1}")
;;
--require-auth=*)
- required_auths="${required_auths} $(cli_get_val ${1})"
+ required_auths="${required_auths} $(cli_get_val "${1}")"
;;
esac
shift
#
cli_route() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-route
exit ${EXIT_OK}
fi
case "${action}" in
static)
- cli_route_static $@
+ cli_route_static "$@"
;;
*)
error "Unrecognized action: ${action}"
}
cli_route_static() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-route-static
exit ${EXIT_OK}
fi
case "${action}" in
# Add a new route.
add)
- route_add $@
+ route_add "$@"
;;
# Remove an existing route.
remove)
- route_remove $@
+ route_remove "$@"
;;
# List all routes.
list)
- route_list $@
+ route_list "$@"
return ${EXIT_OK}
;;
# Reload all routes
reload)
- route_apply $@
+ route_apply "$@"
;;
*)
error "Unrecognized action: ${action}"
while [ $# -gt 0 ]; do
case "${1}" in
--gateway=*)
- gateway=$(cli_get_val ${1})
+ gateway=$(cli_get_val "${1}")
;;
--unreachable)
unreachable="true"
blackhole="true"
;;
--mtu=*)
- mtu=$(cli_get_val ${1})
+ mtu=$(cli_get_val "${1}")
;;
*)
if isset network; then
local _network
local error=${EXIT_OK}
- for _network in $@; do
+ for _network in "$@"; do
# 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=*)
- protocol=$(cli_get_val ${1})
+ protocol=$(cli_get_val "${1}")
;;
*)
warning "Unrecognized argument: ${1}"
while read arg; do
case "${arg}" in
network=*)
- network=$(cli_get_val ${arg})
+ network=$(cli_get_val "${arg}")
;;
gateway=*)
- gateway=$(cli_get_val ${arg})
+ gateway=$(cli_get_val "${arg}")
;;
unreachable=*)
- unreachable=$(cli_get_val ${arg})
+ unreachable=$(cli_get_val "${arg}")
;;
prohibit=*)
- prohibit=$(cli_get_val ${arg})
+ prohibit=$(cli_get_val "${arg}")
;;
blackhole=*)
- blackhole=$(cli_get_val ${arg})
+ blackhole=$(cli_get_val "${arg}")
;;
mtu=*)
- mtu=$(cli_get_val ${arg})
+ mtu=$(cli_get_val "${arg}")
;;
esac
- done <<< "$(args $@)"
+ done <<< "$(args "$@")"
### Check if all values are correctly set.
while [ $# -gt 0 ]; do
case "${1}" in
--gateway=*)
- gateway=$(cli_get_val ${1})
+ gateway=$(cli_get_val "${1}")
;;
--table=*)
- table=$(cli_get_val ${1})
+ table=$(cli_get_val "${1}")
;;
--type=*)
- type=$(cli_get_val ${1})
+ type=$(cli_get_val "${1}")
;;
--proto=*)
- proto=$(cli_get_val ${1})
+ proto=$(cli_get_val "${1}")
;;
--mtu=*)
- mtu=$(cli_get_val ${1})
+ mtu=$(cli_get_val "${1}")
;;
*)
if isset network; then
while [ $# -gt 0 ]; do
case "${1}" in
--protocol=*)
- protocol=$(cli_get_val ${1})
+ protocol=$(cli_get_val "${1}")
;;
*)
table="${1}"
while [ $# -gt 0 ]; do
case "${1}" in
--id=*)
- _id=$(cli_get_val ${1})
+ _id=$(cli_get_val "${1}")
;;
*)
_table=${1}
while [ $# -gt 0 ]; do
case "${1}" in
--lookup=*)
- lookup=$(cli_get_val ${1})
+ lookup=$(cli_get_val "${1}")
;;
--priority=*)
- priority=$(cli_get_val ${1})
+ priority=$(cli_get_val "${1}")
;;
--protocol=*)
- protocols=$(cli_get_val ${1})
+ protocols=$(cli_get_val "${1}")
assert isoneof protocols ${IP_SUPPORTED_PROTOCOLS}
;;
while [ $# -gt 0 ]; do
case "${1}" in
--from=*)
- from=$(cli_get_val ${1})
+ from=$(cli_get_val "${1}")
;;
--lookup=*)
- lookup=$(cli_get_val ${1})
+ lookup=$(cli_get_val "${1}")
;;
--priority=*)
- prio=$(cli_get_val ${1})
+ prio=$(cli_get_val "${1}")
;;
--protocol=*)
- proto=$(cli_get_val ${1})
+ proto=$(cli_get_val "${1}")
;;
*)
warning "Unrecognized argument: ${1}"
list_append valid_keys "${arg}"
;;
esac
- done <<< "$(args $@)"
+ done <<< "$(args "$@")"
if [ -d "${file}" ]; then
error "Not a configuration file: '${file}'"
list_match ${key} ${valid_keys} || continue
fi
- val=$(cli_get_val ${line})
+ val=$(cli_get_val "${line}")
val=$(settings_strip ${val})
# Assign variable.
fi
fi
- val=$(cli_get_val ${line})
+ val=$(cli_get_val "${line}")
val=$(settings_strip ${val})
# Assign variable.
;;
esac
shift
- done <<< "$(args $@)"
+ done <<< "$(args "$@")"
# Check if all values to be written are sane
if isset check_func && ! settings_check "${check_func}"; then
> ${settings_file}
local param
- for param in $(list_sort $@); do
+ for param in $(list_sort "$@"); do
echo "${param}=\"${!param}\"" >> ${settings_file}
done
}
settings_print() {
local param
- for param in $(list_sort $@); do
+ for param in $(list_sort "$@"); do
printf "%-32s = %s\n" "${param}" "${!param}"
done
}
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}'".
case "${arg}" in
*=*)
- 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)
local ret=0
local arg
- for arg in $@; do
+ for arg in "$@"; do
local unit
case "${arg}" in
}
cmd_quiet() {
- cmd $@ &>/dev/null
+ cmd "$@" &>/dev/null
}
cmd_exec() {
# Executes the given command in background
cmd_background() {
- cmd_quiet $@ &
+ cmd_quiet "$@" &
}
# Prints the PID of the process that was started last
# Increase security of the read command
read() {
- builtin read -r $@
+ builtin read -r "$@"
}
seq() {
}
which() {
- type -P $@
+ type -P "$@"
}
# Prints the number of seconds since epoch.
case "${action}" in
ipsec)
- cli_ipsec $@
+ cli_ipsec "$@"
;;
security-policies)
- cli_vpn_security_policies $@
+ cli_vpn_security_policies "$@"
;;
*)
error "Unrecognized argument: ${action}"
case "${key}" in
cipher|compression|integrity|lifetime|pfs|show)
- vpn_security_policies_${key} ${security_policy} $@
+ vpn_security_policies_${key} ${security_policy} "$@"
;;
group-type)
- vpn_security_policies_group_type ${security_policy} $@
+ vpn_security_policies_group_type ${security_policy} "$@"
;;
key-exchange)
- vpn_security_policies_key_exchange ${security_policy} $@
+ vpn_security_policies_key_exchange ${security_policy} "$@"
;;
*)
error "Unrecognized argument: ${key}"
case "${action}" in
new)
- vpn_security_policies_new $@
+ vpn_security_policies_new "$@"
;;
destroy)
- vpn_security_policies_destroy $@
+ vpn_security_policies_destroy "$@"
;;
""|*)
if [ -n "${action}" ]; then
if [ $# -eq 0 ] && [ -n "${VPN_SECURITY_POLICIES_CONFIG_SETTINGS}" ]; then
list_append args ${VPN_SECURITY_POLICIES_CONFIG_SETTINGS}
else
- list_append args $@
+ list_append args "$@"
fi
local path="$(vpn_security_policies_path ${name})"
fi
if ! isinteger value; then
- value=$(parse_time $@)
+ value=$(parse_time "$@")
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
- for name in $@; do
+ for name in "$@"; do
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=*)
- address=$(cli_get_val ${1})
+ address=$(cli_get_val "${1}")
;;
--channel=*)
channel=$(cli_get_val "${1}")
;;
--phy=*)
- phy=$(cli_get_val ${1})
+ phy=$(cli_get_val "${1}")
phy=$(phy_get ${phy})
;;
--type=*)
- type=$(cli_get_val ${1})
+ type=$(cli_get_val "${1}")
# ap --> __ap
[ "${type}" = "ap" ] && type="__ap"
while [ $# -gt 0 ]; do
case "${1}" in
--bssid=*)
- bssid="$(cli_get_val ${1})"
+ bssid="$(cli_get_val "${1}")"
;;
--essid=*)
- essid="$(cli_get_val ${1})"
+ essid="$(cli_get_val "${1}")"
;;
--channel=*)
- local channel="$(cli_get_val ${1})"
+ local channel="$(cli_get_val "${1}")"
# Save the frequency of the channel instead
# of the channel itself.
for arg in "$@"; do
case "${arg}" in
--ap-scan=*)
- ap_scan=$(cli_get_val ${arg})
+ ap_scan=$(cli_get_val "${arg}")
;;
--mode=*)
- mode=$(cli_get_val ${arg})
+ mode=$(cli_get_val "${arg}")
# Empty signals no encryption.
isset mode || mode="NONE"
;;
--ssid=*)
- ssid=$(cli_get_val ${arg})
+ ssid=$(cli_get_val "${arg}")
;;
--key=*)
- key=$(cli_get_val ${arg})
+ key=$(cli_get_val "${arg}")
;;
*)
error "Unrecognized argument: ${arg}"
local hook="$(zone_get_hook ${zone})"
assert isset hook
- hook_exec zone "${hook}" "${cmd}" "${zone}" $@
+ hook_exec zone "${hook}" "${cmd}" "${zone}" "$@"
}
zone_new() {
# 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.
return ${EXIT_ERROR}
fi
- hook_zone_exec ${hook} edit ${zone} $@
+ hook_zone_exec ${hook} edit ${zone} "$@"
}
zone_rename() {
zone_db ${zone} starting
- hook_zone_exec ${hook} up ${zone} $@
+ hook_zone_exec ${hook} up ${zone} "$@"
zone_db ${zone} started
zone_db ${zone} stopping
- hook_zone_exec ${hook} down ${zone} $@
+ hook_zone_exec ${hook} down ${zone} "$@"
zone_db ${zone} stopped
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)"
zones_show() {
local zone
- for zone in $(zones_get $@); do
+ for zone in $(zones_get "$@"); do
zone_show ${zone}
done
}
assert isset hook
# Dispatch command to hook
- hook_zone_exec "${hook}" "${cmd}" "${zone}" "${port}" $@
+ hook_zone_exec "${hook}" "${cmd}" "${zone}" "${port}" "$@"
}
zone_port_create() {
- zone_port_cmd "port_create" $@
+ zone_port_cmd "port_create" "$@"
}
zone_port_remove() {
- zone_port_cmd "port_remove" $@
+ zone_port_cmd "port_remove" "$@"
}
zone_port_up() {
- zone_port_cmd "port_up" $@
+ zone_port_cmd "port_up" "$@"
}
zone_port_down() {
- zone_port_cmd "port_down" $@
+ zone_port_cmd "port_down" "$@"
}
# The next two functions automagically bring up and down
}
zone_port_status() {
- zone_port_cmd "port_status" $@
+ zone_port_cmd "port_status" "$@"
}
zone_ports_cmd() {
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() {
- zone_ports_cmd "port_create" $@
+ zone_ports_cmd "port_create" "$@"
}
zone_ports_remove() {
- zone_ports_cmd "port_remove" $@
+ zone_ports_cmd "port_remove" "$@"
}
zone_ports_up() {
- zone_ports_cmd "port_up" $@
+ zone_ports_cmd "port_up" "$@"
}
zone_ports_down() {
- zone_ports_cmd "port_down" $@
+ zone_ports_cmd "port_down" "$@"
}
zone_ports_status() {
- zone_ports_cmd "port_status" $@
+ zone_ports_cmd "port_status" "$@"
}
zone_configs_cmd() {
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() {
- zone_configs_cmd "up" $@
+ zone_configs_cmd "up" "$@"
}
zone_configs_down() {
- zone_configs_cmd "down" $@
+ zone_configs_cmd "down" "$@"
}
zone_configs_status() {
- zone_configs_cmd "status" $@
+ zone_configs_cmd "status" "$@"
}
zone_configs_list() {
}
zone_has_ip() {
- device_has_ip $@
+ device_has_ip "$@"
}
zone_db() {
}
zone_is_down() {
- ! zone_is_up $@
+ ! zone_is_up "$@"
}
zone_get_supported_port_hooks() {
if [ $# -eq 0 ] && [ -n "${HOOK_SETTINGS}" ]; then
list_append args ${HOOK_SETTINGS}
else
- list_append args $@
+ list_append args "$@"
fi
# Save the HOOK variable.
if [ $# -eq 0 ] && [ -n "${HOOK_CONFIG_SETTINGS}" ]; then
list_append args ${HOOK_CONFIG_SETTINGS}
else
- list_append args $@
+ list_append args "$@"
fi
local path="$(zone_dir "${zone}")/configs/${config}"
if [ $# -eq 0 ] && [ -n "${HOOK_PORT_SETTINGS}" ]; then
list_append args ${HOOK_PORT_SETTINGS}
else
- list_append args $@
+ list_append args "$@"
fi
local path="$(zone_dir "${zone}")/ports/${port}"
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
port_settings_read "${port}" ${HOOK_SETTINGS}
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
return ${EXIT_ERROR}
fi
}
hook_edit() {
- hook_default_edit $@
+ hook_default_edit "$@"
}
# Returns a list of all children of this port
# Depends on the port existing
hook_up() {
- hook_default_up $@
+ hook_default_up "$@"
}
hook_default_down() {
}
hook_down() {
- hook_default_down $@
+ hook_default_down "$@"
}
assert isset zone
shift
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
return ${EXIT_ERROR}
fi
return ${EXIT_ERROR}
fi
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
return ${EXIT_ERROR}
fi
local ret
case "${action}" in
add|create|edit|rem|show)
- hook_port_${action} "${zone}" $@
+ hook_port_${action} "${zone}" "$@"
ret=$?
;;
*)
}
hook_port_create() {
- hook_default_port_create $@
+ hook_default_port_create "$@"
}
hook_default_port_remove() {
}
hook_port_remove() {
- hook_default_port_remove $@
+ hook_default_port_remove "$@"
}
hook_port_up() {
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
exit ${EXIT_CONF_ERROR}
;;
esac
- done <<< "$(args $@)"
+ done <<< "$(args "$@")"
if ! isset ADDRESS; then
error "You need to provide an IPv4 address"
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
fi
;;
esac
- done <<< "$(args $@)"
+ done <<< "$(args "$@")"
}
hook_new() {
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
local zone=${1}
shift
- 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
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=*)
- 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=*)
- SERVICE_NAME=$(cli_get_val ${1})
+ SERVICE_NAME=$(cli_get_val "${1}")
;;
--subnet=*)
- 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}
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
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="$(cli_get_val "${1}")"
;;
*)
warning "Ignoring unknown argument '${1}'"
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- ADDRESS="$(cli_get_val ${1})"
+ ADDRESS="$(cli_get_val "${1}")"
;;
--add-slave=*)
- SLAVES="${SLAVES} $(cli_get_val ${1})"
+ SLAVES="${SLAVES} $(cli_get_val "${1}")"
;;
--del-slave=*)
- local slave="$(cli_get_val ${1})"
+ local slave="$(cli_get_val "${1}")"
local s slaves
for s in ${SLAVES}; do
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- ADDRESS=$(cli_get_val ${1})
+ ADDRESS=$(cli_get_val "${1}")
;;
--miimon=*)
- MIIMON=$(cli_get_val ${1})
+ MIIMON=$(cli_get_val "${1}")
;;
--mode=*)
- 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
fi
;;
-*)
- 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
}
hook_new() {
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
return ${EXIT_ERROR}
fi
hook_edit() {
local port=${1}
- if ! hook_default_edit $@; then
+ if ! hook_default_edit "$@"; then
return ${EXIT_ERROR}
fi
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- ADDRESS=$(cli_get_val ${1})
+ ADDRESS=$(cli_get_val "${1}")
;;
*)
warning "Unknown argument '${1}'"
}
hook_new() {
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
return ${EXIT_ERROR}
fi
while [ $# -gt 0 ]; do
case "${1}" in
--parent-device=*)
- PARENT_DEVICE=$(cli_get_val ${1})
+ PARENT_DEVICE=$(cli_get_val "${1}")
;;
--address=*)
- ADDRESS=$(cli_get_val ${1})
+ ADDRESS=$(cli_get_val "${1}")
;;
--tag=*)
- TAG=$(cli_get_val ${1})
+ TAG=$(cli_get_val "${1}")
;;
*)
warning "Unknown argument '${1}'"
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- ADDRESS=$(cli_get_val ${1})
+ ADDRESS=$(cli_get_val "${1}")
;;
*)
warning "Unknown argument '${1}'"
while [ $# -gt 0 ]; do
case "${1}" in
--address=*)
- ADDRESS=$(cli_get_val ${1})
+ ADDRESS=$(cli_get_val "${1}")
;;
--bssid=*)
- BSSID=$(cli_get_val ${1})
+ BSSID=$(cli_get_val "${1}")
;;
--channel=*)
- CHANNEL=$(cli_get_val ${1})
+ CHANNEL=$(cli_get_val "${1}")
;;
--mtu=*)
MTU="$(cli_get_val "${1}")"
;;
--phy=*)
- PHY=$(cli_get_val ${1})
+ PHY=$(cli_get_val "${1}")
;;
--ssid=*)
- SSID=$(cli_get_val ${1})
+ SSID=$(cli_get_val "${1}")
;;
*)
warning "Ignoring unknown argument '${1}'"
while [ $# -gt 0 ]; do
case "${1}" in
--bssid=*)
- BSSID=$(cli_get_val ${1})
+ BSSID=$(cli_get_val "${1}")
;;
--channel=*)
- CHANNEL=$(cli_get_val ${1})
+ CHANNEL=$(cli_get_val "${1}")
;;
--mtu=*)
MTU="$(cli_get_val "${1}")"
;;
--ssid=*)
- SSID=$(cli_get_val ${1})
+ SSID=$(cli_get_val "${1}")
;;
*)
warning "Unknown argument '${1}'"
while [ $# -gt 0 ]; do
case "${1}" in
--broadcast-ssid=*)
- BROADCAST_SSID=$(cli_get_val ${1})
+ BROADCAST_SSID=$(cli_get_val "${1}")
;;
--channel=*)
- CHANNEL=$(cli_get_val ${1})
+ CHANNEL=$(cli_get_val "${1}")
;;
--encryption=*)
- ENCRYPTION=$(cli_get_val ${1})
+ ENCRYPTION=$(cli_get_val "${1}")
;;
--key=*)
- KEY=$(cli_get_val ${1})
+ KEY=$(cli_get_val "${1}")
;;
--mac=*)
- ADDRESS=$(cli_get_val ${1})
+ ADDRESS=$(cli_get_val "${1}")
;;
--mode=*)
- MODE=$(cli_get_val ${1})
+ MODE=$(cli_get_val "${1}")
;;
--phy=*)
- PHY=$(cli_get_val ${1})
+ PHY=$(cli_get_val "${1}")
;;
--ssid=*)
- SSID=$(cli_get_val ${1})
+ SSID=$(cli_get_val "${1}")
;;
*)
warning "Ignoring unknown argument '${1}'"
local port=${1}
assert isset port
- if ! hook_default_edit $@; then
+ if ! hook_default_edit "$@"; then
return ${EXIT_ERROR}
fi
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_ADDRESS=$(cli_get_val ${1})
+ LOCAL_ADDRESS=$(cli_get_val "${1}")
;;
--local-ipv6-address=*)
- LOCAL_ADDRESS6=$(cli_get_val ${1})
+ LOCAL_ADDRESS6=$(cli_get_val "${1}")
;;
--auto-update-endpoint=*)
- local val="$(cli_get_val ${1})"
+ local val="$(cli_get_val "${1}")"
if enabled val; then
AUTO_UPDATE_ENDPOINT="true"
fi
;;
--tunnel-id=*)
- TUNNEL_ID="$(cli_get_val ${1})"
+ TUNNEL_ID="$(cli_get_val "${1}")"
;;
--username=*)
- USERNAME="$(cli_get_val ${1})"
+ USERNAME="$(cli_get_val "${1}")"
;;
--password=*)
- PASSWORD="$(cli_get_val ${1})"
+ PASSWORD="$(cli_get_val "${1}")"
;;
*)
echo "Unknown option: ${1}" >&2
PRIORITY="$(cli_get_val "${arg}")"
;;
esac
- done <<< "$(args $@)"
+ done <<< "$(args "$@")"
if ! zone_port_settings_write "${zone}" "${port}"; then
exit ${EXIT_ERROR}
}
hook_port_edit() {
- hook_port_attach $@
+ hook_port_attach "$@"
}
hook_port_up() {
while [ $# -gt 0 ]; do
case "${1}" in
--apn=*)
- APN=$(cli_get_val ${1})
+ APN=$(cli_get_val "${1}")
;;
--auth=*)
- AUTH=$(cli_get_val ${1})
+ AUTH=$(cli_get_val "${1}")
;;
--baudrate=*)
- BAUDRATE=$(cli_get_val ${1})
+ BAUDRATE=$(cli_get_val "${1}")
assert isoneif "${BAUDRATE}" ${SERIAL_BAUDRATES}
;;
--device=*)
- DEVICE=$(cli_get_val ${1})
+ DEVICE=$(cli_get_val "${1}")
;;
--imsi=*)
IMSI="$(cli_get_val "${1}")"
;;
--monitor-device=*)
- MONITOR_DEVICE=$(cli_get_val ${1})
+ MONITOR_DEVICE=$(cli_get_val "${1}")
;;
--mtu=*)
- MTU=$(cli_get_val ${1})
+ MTU=$(cli_get_val "${1}")
assert isinteger ${MTU}
;;
--password=*)
- PASSWORD=$(cli_get_val ${1})
+ PASSWORD=$(cli_get_val "${1}")
;;
--phone-number=*)
- PHONE_NUMBER=$(cli_get_val ${1})
+ PHONE_NUMBER=$(cli_get_val "${1}")
;;
--pin=*)
- PIN=$(cli_get_val ${1})
+ PIN=$(cli_get_val "${1}")
;;
--username=*)
- USERNAME=$(cli_get_val ${1})
+ USERNAME=$(cli_get_val "${1}")
;;
*)
echo "Unknown argument: ${1}" >&2
while [ $# -gt 0 ]; do
case "${1}" in
--access-concentrator=*)
- ACCESS_CONCENTRATOR=$(cli_get_val ${1})
+ ACCESS_CONCENTRATOR=$(cli_get_val "${1}")
;;
--auth=*)
- AUTH=$(cli_get_val ${1})
+ AUTH=$(cli_get_val "${1}")
;;
--ipv6=*)
local value="$(cli_get_val "${1}")"
fi
;;
--mtu=*)
- MTU=$(cli_get_val ${1})
+ MTU=$(cli_get_val "${1}")
;;
--password=*)
- PASSWORD=$(cli_get_val ${1})
+ PASSWORD=$(cli_get_val "${1}")
;;
--prefix-delegation=*)
PREFIX_DELEGATION="$(cli_get_bool "${1}")"
;;
--service-name=*)
- SERVICE_NAME=$(cli_get_val ${1})
+ SERVICE_NAME=$(cli_get_val "${1}")
;;
--username=*)
- USERNAME=$(cli_get_val ${1})
+ USERNAME=$(cli_get_val "${1}")
;;
*)
warning "Unknown argument: ${1}" >&2
while [ $# -gt 0 ]; do
case "${1}" in
--phy=*|--parent-device=*)
- PHY=$(cli_get_val ${1})
+ PHY=$(cli_get_val "${1}")
;;
--encryption-mode=*)
- ENCRYPTION_MODE=$(cli_get_val ${1})
+ ENCRYPTION_MODE=$(cli_get_val "${1}")
;;
--address=*)
- ADDRESS=$(cli_get_val ${1})
+ ADDRESS=$(cli_get_val "${1}")
;;
--ssid=*)
- SSID=$(cli_get_val ${1})
+ SSID=$(cli_get_val "${1}")
;;
--key=*)
- KEY=$(cli_get_val ${1})
+ KEY=$(cli_get_val "${1}")
;;
*)
warning "Unrecognized option: ${1}"
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
- network_settings_set $@
+ network_settings_set "$@"
network_settings_write
else
network_settings_print
}
cli_device() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-device
exit ${EXIT_OK}
fi
case "${action}" in
list)
- cli_device_list $@
+ cli_device_list "$@"
;;
*)
local device="${action}"
case "${action}" in
discover)
- cli_device_discover ${device} $@
+ cli_device_discover ${device} "$@"
;;
identify)
- device_identify "${device}" $@
+ device_identify "${device}" "$@"
;;
monitor)
- cli_device_monitor "${device}" $@
+ cli_device_monitor "${device}" "$@"
;;
status)
cli_device_status ${device}
;;
unlock)
- cli_device_serial_unlock ${device} $@
+ cli_device_serial_unlock ${device} "$@"
;;
ussd)
- cli_device_send_ussd_command "${device}" $@
+ cli_device_send_ussd_command "${device}" "$@"
;;
*)
cli_show_man network-device
}
cli_device_serial_unlock() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-device
exit ${EXIT_OK}
fi
}
cli_hostname() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network
exit ${EXIT_OK}
fi
}
cli_port() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-port
exit ${EXIT_OK}
fi
case "${action}" in
edit|create|remove|up|down|status|identify)
- port_${action} "${port}" $@
+ port_${action} "${port}" "$@"
;;
color)
- color_cli "port" "${port}" $@
+ color_cli "port" "${port}" "$@"
;;
description)
- description_cli "port" "${port}" $@
+ description_cli "port" "${port}" "$@"
;;
*)
error "Unrecognized argument: ${action}"
case "${action}" in
new|destroy)
- port_${action} $@
+ port_${action} "$@"
;;
*)
error "Unrecognized argument: ${action}"
}
cli_zone() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-zone
exit ${EXIT_OK}
fi
case "${action}" in
port)
- cli_zone_port "${zone}" $@
+ cli_zone_port "${zone}" "$@"
;;
rename)
- cli_zone_rename "${zone}" $@
+ cli_zone_rename "${zone}" "$@"
;;
config|disable|down|edit|enable|identify|status|up)
- zone_${action} ${zone} $@
+ zone_${action} ${zone} "$@"
;;
color)
- color_cli "zone" "${zone}" $@
+ color_cli "zone" "${zone}" "$@"
;;
description)
- description_cli "zone" ${zone} $@
+ description_cli "zone" ${zone} "$@"
;;
*)
error "Unrecognized argument: ${action}"
case "${action}" in
new)
- cli_zone_new $@
+ cli_zone_new "$@"
;;
destroy)
- cli_zone_destroy $@
+ cli_zone_destroy "$@"
;;
""|*)
if [ -n "${action}" ]; then
}
cli_zone_new() {
- if cli_help_requested $@ || [ $# -lt 2 ]; then
+ if cli_help_requested "$@" || [ $# -lt 2 ]; then
cli_show_man network-zone-new
exit ${EXIT_OK}
fi
- zone_new $@
+ zone_new "$@"
}
# 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_zone_port() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-zone-port
exit ${EXIT_OK}
fi
case "${action}" in
edit)
- zone_port_edit "${zone}" "${port}" $@
+ zone_port_edit "${zone}" "${port}" "$@"
;;
*)
error "Unrecognised argument: ${action}"
case "${action}" in
attach)
- zone_port_attach "${zone}" $@
+ zone_port_attach "${zone}" "$@"
;;
detach)
- zone_port_detach "${zone}" $@
+ zone_port_detach "${zone}" "$@"
;;
*)
error "Unrecognised argument: ${action}"
}
cli_zone_rename() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-zone
exit ${EXIT_OK}
fi
local type=${1}
shift
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-zone
exit ${EXIT_OK}
fi
local proto=${1}
shift
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-dhcp
exit ${EXIT_OK}
fi
case "${action}" in
edit)
- dhcpd_edit ${proto} $@
+ dhcpd_edit ${proto} "$@"
;;
start)
dhcpd_start ${proto}
dhcpd_reload ${proto}
;;
subnet)
- cli_dhcpd_subnet ${proto} $@
+ cli_dhcpd_subnet ${proto} "$@"
;;
show|"")
- cli_dhcpd_show ${proto} $@
+ cli_dhcpd_show ${proto} "$@"
;;
*)
error "Unrecognized action: ${action}"
local proto=${1}
shift
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-dhcp-subnet
exit ${EXIT_OK}
fi
case "${action}" in
new)
- dhcpd_subnet_new ${proto} $@
+ dhcpd_subnet_new ${proto} "$@"
;;
remove)
- dhcpd_subnet_remove ${proto} $@
+ dhcpd_subnet_remove ${proto} "$@"
;;
*:*/*|*.*.*.*/*)
local subnet=${action}
case "${action}" in
edit)
- dhcpd_subnet_edit ${proto} ${subnet} $@
+ dhcpd_subnet_edit ${proto} ${subnet} "$@"
local ret=$?
if [ ${ret} -eq ${EXIT_OK} ]; then
exit ${ret}
;;
range)
- cli_dhcpd_subnet_range ${proto} ${subnet} $@
+ cli_dhcpd_subnet_range ${proto} ${subnet} "$@"
exit $?
;;
show)
- cli_dhcpd_subnet_show ${proto} ${subnet} $@
+ cli_dhcpd_subnet_show ${proto} ${subnet} "$@"
exit $?
;;
options)
- cli_dhcpd_subnet_options ${proto} ${subnet} $@
+ cli_dhcpd_subnet_options ${proto} ${subnet} "$@"
exit $?
;;
*)
case "${action}" in
new)
- dhcpd_subnet_range_new ${proto} ${subnet} $@ || exit ${EXIT_ERROR}
+ dhcpd_subnet_range_new ${proto} ${subnet} "$@" || exit ${EXIT_ERROR}
;;
remove)
- dhcpd_subnet_range_remove ${proto} ${subnet} $@ || exit ${EXIT_ERROR}
+ dhcpd_subnet_range_remove ${proto} ${subnet} "$@" || exit ${EXIT_ERROR}
;;
*)
error "Unrecognized action: ${action}"
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
}
cli_start() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network
exit ${EXIT_OK}
fi
- local zones=$(zones_get $@)
+ local zones=$(zones_get "$@")
local zone
for zone in ${zones}; do
}
cli_stop() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network
exit ${EXIT_OK}
fi
- local zones=$(zones_get $@)
+ local zones=$(zones_get "$@")
local zone
for zone in ${zones}; do
}
cli_restart() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network
exit ${EXIT_OK}
fi
- cli_stop $@
+ cli_stop "$@"
# Give the system some time to calm down
sleep ${TIMEOUT_RESTART}
- cli_start $@
+ cli_start "$@"
}
cli_status() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network
exit ${EXIT_OK}
fi
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
}
cli_reset() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network
exit ${EXIT_OK}
fi
}
cli_dns_server() {
- if cli_help_requested $@; then
+ if cli_help_requested "$@"; then
cli_show_man network-dns-server
exit ${EXIT_OK}
fi
db_dump
;;
ipsec-connection-exists)
- ipsec_connection_exists $@
+ ipsec_connection_exists "$@"
;;
list-devices)
device_list
;;
list-dhcpd-ranges-of-subnet)
- dhcpd_subnet_range_list $@
+ dhcpd_subnet_range_list "$@"
;;
list-dhcpd-settings)
- dhcpd_global_settings_list $@
+ dhcpd_global_settings_list "$@"
;;
list-dhcpd-subnets)
- dhcpd_subnet_list $@
+ dhcpd_subnet_list "$@"
;;
list-dhcpd-subnet-options)
- dhcpd_subnet_options_list $@
+ dhcpd_subnet_options_list "$@"
;;
list-dns-servers)
dns_server_list
port_list_free
;;
list-hooks)
- hook_list $@
+ hook_list "$@"
;;
list-ipsec-connections)
ipsec_list_connections
port_list
;;
list-ports-of-zone)
- zone_get_ports $@
+ zone_get_ports "$@"
;;
list-vpn-security-policies-all)
vpn_security_policies_list_all
zones_get_next_free
;;
list-zone-config-ids)
- zone_config_list_ids $@
+ zone_config_list_ids "$@"
;;
list-zone-config-hids)
- zone_config_list_hids $@
+ zone_config_list_hids "$@"
;;
vpn-security-policy-exists)
- vpn_security_policy_exists $@
+ vpn_security_policy_exists "$@"
;;
zone-name-is-valid)
- zone_name_is_valid $@
+ zone_name_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 "$@"
;;
*)
error "No such command: ${cmd}"
;;
settings|hostname|port|device|zone|start|stop|restart|status|reset|route|vpn)
- cli_${action} $@
+ cli_${action} "$@"
;;
# 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)
- cli_dns_server $@
+ cli_dns_server "$@"
;;
""|help|--help|-h)
- cli_help $@
+ cli_help "$@"
;;
raw)
- cli_raw $@
+ cli_raw "$@"
;;
*)