From 1c6a4e3050e4ea8baf1b57a73b411c631457794f Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 2 May 2015 16:06:07 +0000 Subject: [PATCH] Remove the function keyword which is a bashism --- src/bash-completion/network | 42 +++--- src/functions/functions.aiccu | 6 +- src/functions/functions.batman-adv | 34 ++--- src/functions/functions.bonding | 22 ++-- src/functions/functions.bridge | 14 +- src/functions/functions.cli | 46 +++---- src/functions/functions.cli.firewall | 12 +- src/functions/functions.config | 6 +- src/functions/functions.conntrack | 12 +- src/functions/functions.db | 8 +- src/functions/functions.device | 126 +++++++++--------- src/functions/functions.dhcpd | 92 +++++++------- src/functions/functions.dns | 24 ++-- src/functions/functions.dummy | 4 +- src/functions/functions.firewall | 34 ++--- src/functions/functions.firewall-policy | 14 +- src/functions/functions.firewall-zones | 16 +-- src/functions/functions.he | 2 +- src/functions/functions.hook | 34 ++--- src/functions/functions.hostapd | 6 +- src/functions/functions.hotplug | 16 +-- src/functions/functions.http | 6 +- src/functions/functions.in | 4 +- src/functions/functions.ip | 18 +-- src/functions/functions.ip-tunnel | 6 +- src/functions/functions.iptables | 34 ++--- src/functions/functions.ipv4 | 50 ++++---- src/functions/functions.ipv6 | 50 ++++---- src/functions/functions.list | 22 ++-- src/functions/functions.lock | 4 +- src/functions/functions.logging | 2 +- src/functions/functions.macros | 6 +- src/functions/functions.modem | 54 ++++---- src/functions/functions.phy | 12 +- src/functions/functions.ports | 72 +++++------ src/functions/functions.ppp | 26 ++-- src/functions/functions.pppoe-server | 10 +- src/functions/functions.radvd | 8 +- src/functions/functions.route | 30 ++--- src/functions/functions.routing | 24 ++-- src/functions/functions.serial | 12 +- src/functions/functions.service | 20 +-- src/functions/functions.settings | 30 ++--- src/functions/functions.stp | 60 ++++----- src/functions/functions.sysctl | 12 +- src/functions/functions.usb | 8 +- src/functions/functions.util | 124 +++++++++--------- src/functions/functions.vlan | 12 +- src/functions/functions.wireless | 22 ++-- src/functions/functions.wpa_supplicant | 26 ++-- src/functions/functions.zone | 162 ++++++++++++------------ src/header-port | 22 ++-- src/header-zone | 66 +++++----- src/helpers/pppd-angel | 2 +- src/hooks/configs/ipv4-dhcp | 10 +- src/hooks/configs/ipv4-static | 10 +- src/hooks/configs/ipv6-auto | 10 +- src/hooks/configs/ipv6-dhcp | 8 +- src/hooks/configs/ipv6-static | 10 +- src/hooks/configs/pppoe-server | 10 +- src/hooks/ports/batman-adv | 14 +- src/hooks/ports/bonding | 16 +-- src/hooks/ports/dummy | 16 +-- src/hooks/ports/ethernet | 10 +- src/hooks/ports/vlan | 10 +- src/hooks/ports/wireless-adhoc | 18 +-- src/hooks/ports/wireless-ap | 16 +-- src/hooks/zones/6rd | 10 +- src/hooks/zones/6to4-tunnel | 10 +- src/hooks/zones/aiccu | 10 +- src/hooks/zones/bridge | 26 ++-- src/hooks/zones/modem | 12 +- src/hooks/zones/pppoe | 26 ++-- src/hooks/zones/wireless | 10 +- src/network | 62 ++++----- src/ppp/dialer | 2 +- src/udev/network-hotplug-rename | 2 +- 77 files changed, 957 insertions(+), 957 deletions(-) diff --git a/src/bash-completion/network b/src/bash-completion/network index 143295c8..a95490dc 100644 --- a/src/bash-completion/network +++ b/src/bash-completion/network @@ -20,7 +20,7 @@ ############################################################################### # network(8) completion -function _network_find_on_cmdline () { +_network_find_on_cmdline () { local word subcommand c=0 while [ ${c} -lt ${cword} ]; do word="${words[c]}" @@ -34,21 +34,21 @@ function _network_find_on_cmdline () { done } -function _network_complete_hooks() { +_network_complete_hooks() { local type="${1}" COMPREPLY=( $(compgen -W "$(network raw list-hooks "${type}")" -- "${cur}") ) } -function _network_complete_ports() { +_network_complete_ports() { COMPREPLY=( $(compgen -W "$(network raw list-ports)" -- "${cur}") ) } -function _network_complete_zones() { +_network_complete_zones() { COMPREPLY=( $(compgen -W "$(network raw list-zones)" -- "${cur}") ) } -function _network_device() { +_network_device() { local words=( $@ ) local commands="list $(network raw list-devices)" @@ -69,7 +69,7 @@ function _network_device() { esac } -function _network_device_subcommand() { +_network_device_subcommand() { local words=( $@ ) local commands="discover monitor status unlock ussd" @@ -86,7 +86,7 @@ function _network_device_subcommand() { esac } -function _network_dhcpd() { +_network_dhcpd() { local proto="${1}" shift @@ -107,7 +107,7 @@ function _network_dhcpd() { esac } -function _network_dhcpd_subnet() { +_network_dhcpd_subnet() { local proto="${1}" shift @@ -135,7 +135,7 @@ function _network_dhcpd_subnet() { esac } -function _network_dhcpd_subnet_subcommand() { +_network_dhcpd_subnet_subcommand() { local proto="${1}" local subnet="${2}" shift 2 @@ -163,7 +163,7 @@ function _network_dhcpd_subnet_subcommand() { esac } -function _network_dhcpd_subnet_subcommand_options() { +_network_dhcpd_subnet_subcommand_options() { local proto="${1}" local subnet="${2}" shift 2 @@ -176,7 +176,7 @@ function _network_dhcpd_subnet_subcommand_options() { COMPREPLY=( $(compgen -W "${options}" -- "${cur}") ) } -function _network_dhcpd_subnet_subcommand_range() { +_network_dhcpd_subnet_subcommand_range() { local proto="${1}" local subnet="${2}" shift 2 @@ -201,7 +201,7 @@ function _network_dhcpd_subnet_subcommand_range() { esac } -function _network_dns_server() { +_network_dns_server() { local words=( $@ ) local commands="add list remove update" @@ -219,7 +219,7 @@ function _network_dns_server() { esac } -function _network_port() { +_network_port() { local words=( $@ ) local commands="new destroy $(network raw list-ports)" @@ -244,7 +244,7 @@ function _network_port() { esac } -function _network_port_subcommand() { +_network_port_subcommand() { local words=( $@ ) local commands="create down edit remove status up" @@ -255,7 +255,7 @@ function _network_port_subcommand() { fi } -function _network_route() { +_network_route() { local words=( $@ ) local commands="add list remove" @@ -279,7 +279,7 @@ function _network_route() { esac } -function _network_settings() { +_network_settings() { local words=( $@ ) local key keys @@ -289,7 +289,7 @@ function _network_settings() { COMPREPLY=( $(compgen -W "${keys}" -- "${cur}") ) } -function _network_zone() { +_network_zone() { local words=( $@ ) local commands="new destroy $(network raw list-zones)" @@ -316,7 +316,7 @@ function _network_zone() { esac } -function _network_zone_subcommand() { +_network_zone_subcommand() { local zone="${1}" shift @@ -340,7 +340,7 @@ function _network_zone_subcommand() { esac } -function _network_zone_subcommand_port() { +_network_zone_subcommand_port() { local zone="${1}" shift @@ -370,7 +370,7 @@ function _network_zone_subcommand_port() { esac } -function _network_zone_subcommand_port_subcommand() { +_network_zone_subcommand_port_subcommand() { local zone="${1}" local port="${2}" shift 2 @@ -391,7 +391,7 @@ function _network_zone_subcommand_port_subcommand() { esac } -function _network() { +_network() { local cur prev words cword _init_completion || return diff --git a/src/functions/functions.aiccu b/src/functions/functions.aiccu index f08bb688..a247503e 100644 --- a/src/functions/functions.aiccu +++ b/src/functions/functions.aiccu @@ -22,7 +22,7 @@ # Define protocols which are supported by aiccu. AICCU_SUPPORTED_PROTOCOLS="tic tsp l2tp" -function aiccu_start() { +aiccu_start() { local device=${1} assert isset device @@ -40,7 +40,7 @@ function aiccu_start() { return ${EXIT_OK} } -function aiccu_stop() { +aiccu_stop() { local device=${1} assert isset device @@ -48,7 +48,7 @@ function aiccu_stop() { service_stop "aiccu@${device}.service" } -function aiccu_write_config() { +aiccu_write_config() { local device=${1} local file=${2} shift 2 diff --git a/src/functions/functions.batman-adv b/src/functions/functions.batman-adv index 23ed6119..9fe74fd8 100644 --- a/src/functions/functions.batman-adv +++ b/src/functions/functions.batman-adv @@ -19,12 +19,12 @@ # # ############################################################################### -function batman_adv_start() { +batman_adv_start() { # Load the batman kernel module. module_load "batman-adv" } -function batman_adv_add() { +batman_adv_add() { local device="${1}" assert isset device @@ -41,14 +41,14 @@ function batman_adv_add() { return ${ret} } -function batman_adv_delete() { +batman_adv_delete() { local device="${1}" assert isset device device_delete "${device}" } -function batman_adv_attach() { +batman_adv_attach() { local device=${1} assert isset device @@ -61,14 +61,14 @@ function batman_adv_attach() { fwrite "${SYS_CLASS_NET}/${port}/batman_adv/mesh_iface" "${device}" } -function batman_adv_detach() { +batman_adv_detach() { local port=${1} assert isset port fwrite "${SYS_CLASS_NET}/${port}/batman_adv/mesh_iface" "none" } -function batman_adv_get_aggregated_ogms() { +batman_adv_get_aggregated_ogms() { local device=${1} assert isset device @@ -85,7 +85,7 @@ function batman_adv_get_aggregated_ogms() { return ${EXIT_ERROR} } -function batman_adv_get_ap_isolation() { +batman_adv_get_ap_isolation() { local device=${1} assert isset device @@ -102,7 +102,7 @@ function batman_adv_get_ap_isolation() { return ${EXIT_ERROR} } -function batman_adv_get_bonding_mode() { +batman_adv_get_bonding_mode() { local device=${1} assert isset device @@ -119,7 +119,7 @@ function batman_adv_get_bonding_mode() { return ${EXIT_ERROR} } -function batman_adv_get_distributed_arp_table() { +batman_adv_get_distributed_arp_table() { local device=${1} assert isset device @@ -136,7 +136,7 @@ function batman_adv_get_distributed_arp_table() { return ${EXIT_ERROR} } -function batman_adv_get_bridge_loop_avoidance() { +batman_adv_get_bridge_loop_avoidance() { local device=${1} assert isset device @@ -153,7 +153,7 @@ function batman_adv_get_bridge_loop_avoidance() { return ${EXIT_ERROR} } -function batman_adv_get_fragmentation() { +batman_adv_get_fragmentation() { local device=${1} assert isset device @@ -170,7 +170,7 @@ function batman_adv_get_fragmentation() { return ${EXIT_ERROR} } -function batman_adv_get_gateway_mode() { +batman_adv_get_gateway_mode() { local device=${1} assert isset device @@ -187,35 +187,35 @@ function batman_adv_get_gateway_mode() { return ${EXIT_ERROR} } -function batman_adv_get_gateway_bandwidth() { +batman_adv_get_gateway_bandwidth() { local device=${1} assert isset device fread "${SYS_CLASS_NET}/${device}/mesh/gw_bandwidth" } -function batman_adv_get_gateway_selection_class() { +batman_adv_get_gateway_selection_class() { local device=${1} assert isset device fread "${SYS_CLASS_NET}/${device}/mesh/gw_sel_class" } -function batman_adv_get_hop_penalty() { +batman_adv_get_hop_penalty() { local device=${1} assert isset device fread "${SYS_CLASS_NET}/${device}/mesh/hop_penalty" } -function batman_adv_get_originator_interval() { +batman_adv_get_originator_interval() { local device=${1} assert isset device fread "${SYS_CLASS_NET}/${device}/mesh/orig_interval" } -function batman_adv_get_routing_algorithm() { +batman_adv_get_routing_algorithm() { local device=${1} assert isset device diff --git a/src/functions/functions.bonding b/src/functions/functions.bonding index 495ad307..d9861e58 100644 --- a/src/functions/functions.bonding +++ b/src/functions/functions.bonding @@ -23,11 +23,11 @@ BONDING_ALLOWED_MODES="balance-rr active-backup balance-xor broadcast 802.3ad \ balance-tlb balance-alb" BONDING_MASTERS="/sys/class/net/bonding_masters" -function bonding_init() { +bonding_init() { module_load "bonding" } -function bonding_create() { +bonding_create() { local device=${1} assert isset device shift @@ -89,7 +89,7 @@ function bonding_create() { return ${EXIT_OK} } -function bonding_remove() { +bonding_remove() { local device=${1} assert isset device @@ -114,7 +114,7 @@ function bonding_remove() { return ${EXIT_OK} } -function bonding_get_mode() { +bonding_get_mode() { local device=${1} assert isset device @@ -123,7 +123,7 @@ function bonding_get_mode() { print "${mode}" } -function bonding_set_mode() { +bonding_set_mode() { assert [ $# -eq 2 ] local device="${1}" @@ -139,7 +139,7 @@ function bonding_set_mode() { return ${EXIT_OK} } -function bonding_enslave_device() { +bonding_enslave_device() { local device=${1} assert isset device @@ -170,7 +170,7 @@ function bonding_enslave_device() { return ${EXIT_OK} } -function bonding_get_slaves() { +bonding_get_slaves() { local device=${1} assert isset device shift @@ -194,7 +194,7 @@ function bonding_get_slaves() { return ${EXIT_OK} } -function bonding_get_lacp_rate() { +bonding_get_lacp_rate() { local device=${1} assert isset device @@ -206,14 +206,14 @@ function bonding_get_lacp_rate() { return ${EXIT_OK} } -function bonding_get_miimon() { +bonding_get_miimon() { local device=${1} assert isset device fread ${SYS_CLASS_NET}/${device}/bonding/miimon } -function bonding_set_miimon() { +bonding_set_miimon() { local device=${1} assert isset device @@ -223,7 +223,7 @@ function bonding_set_miimon() { print "${miimon}" > ${SYS_CLASS_NET}/${device}/bonding/miimon } -function bonding_slave_get_master() { +bonding_slave_get_master() { local slave=${1} assert isset slave diff --git a/src/functions/functions.bridge b/src/functions/functions.bridge index 3f14e387..46ca80c2 100644 --- a/src/functions/functions.bridge +++ b/src/functions/functions.bridge @@ -19,7 +19,7 @@ # # ############################################################################### -function bridge_create() { +bridge_create() { local bridge=${1} assert isset bridge shift @@ -77,14 +77,14 @@ function bridge_create() { return ${ret} } -function bridge_delete() { +bridge_delete() { local bridge=${1} assert isset bridge device_delete ${bridge} } -function bridge_attach_device() { +bridge_attach_device() { local bridge=${1} assert isset bridge @@ -125,7 +125,7 @@ function bridge_attach_device() { return ${ret} } -function bridge_detach_device() { +bridge_detach_device() { local bridge=${1} assert isset bridge @@ -161,7 +161,7 @@ function bridge_detach_device() { return ${ret} } -function bridge_get_members() { +bridge_get_members() { local bridge=${1} assert isset bridge @@ -175,7 +175,7 @@ function bridge_get_members() { done } -function bridge_is_forwarding() { +bridge_is_forwarding() { local seconds=45 local zone=${1} @@ -196,7 +196,7 @@ function bridge_is_forwarding() { return ${EXIT_ERROR} } -function bridge_has_carrier() { +bridge_has_carrier() { local zone=${1} local has_carrier=${EXIT_ERROR} diff --git a/src/functions/functions.cli b/src/functions/functions.cli index a3ee722b..15b5efad 100644 --- a/src/functions/functions.cli +++ b/src/functions/functions.cli @@ -21,7 +21,7 @@ IDENT=" " -function cli_help_requested() { +cli_help_requested() { local argument="${1}" if [ -n "${argument}" ]; then @@ -33,14 +33,14 @@ function cli_help_requested() { return ${EXIT_FALSE} } -function cli_run_help() { +cli_run_help() { local command="$@" print "Run \"${command} help\" to get more information." return ${EXIT_OK} } -function cli_device_headline() { +cli_device_headline() { local device=${1} assert isset device @@ -140,7 +140,7 @@ function cli_device_headline() { fi } -function cli_device_stats() { +cli_device_stats() { local level=${1} local device=${2} @@ -166,7 +166,7 @@ function cli_device_stats() { cli_space } -function cli_device_vlan() { +cli_device_vlan() { local device=${1} cli_headline 2 "VLAN" @@ -176,7 +176,7 @@ function cli_device_vlan() { cli_space } -function cli_device_bonded() { +cli_device_bonded() { local device=${1} cli_headline 2 "Bonding information" @@ -197,7 +197,7 @@ function cli_device_bonded() { cli_space } -function cli_device_bonding() { +cli_device_bonding() { local device=${1} assert isset device @@ -242,7 +242,7 @@ function cli_device_bonding() { cli_space } -function cli_headline() { +cli_headline() { local level=${1} local format=${2} shift 2 @@ -254,7 +254,7 @@ function cli_headline() { printf "${out}" } -function cli_statusline() { +cli_statusline() { local level=${1} shift @@ -264,7 +264,7 @@ function cli_statusline() { cli_print $(( ${level} - 1 )) "%-12s %s" "${head}" "$@" } -function cli_print() { +cli_print() { local level=${1} local format=${2} shift 2 @@ -276,7 +276,7 @@ function cli_print() { printf "${out}" } -function cli_print_fmt1() { +cli_print_fmt1() { local level=${1} shift @@ -286,7 +286,7 @@ function cli_print_fmt1() { cli_print ${level} "${format}" "$@" } -function cli_print_bool() { +cli_print_bool() { if [ "${1}" = "${EXIT_TRUE}" ]; then echo "true" else @@ -294,7 +294,7 @@ function cli_print_bool() { fi } -function cli_print_yesno() { +cli_print_yesno() { if [ "${1}" = "${EXIT_TRUE}" ]; then echo "yes" else @@ -302,24 +302,24 @@ function cli_print_yesno() { fi } -function cli_print_enabled() { +cli_print_enabled() { enabled ${1} cli_print_bool $? } -function cli_print_warning() { +cli_print_warning() { local level=${1} shift cli_print ${level} "${CLR_YELLOW_B}%s${CLR_RESET}" "$@" } -function cli_space() { +cli_space() { printf "\n" } -function cli_ident() { +cli_ident() { local level=${1} assert isinteger level @@ -332,7 +332,7 @@ function cli_ident() { print "${ident}" } -function cli_yesno() { +cli_yesno() { local message="$@ [y/n] " local yesno @@ -351,16 +351,16 @@ function cli_yesno() { done } -function cli_get_key() { +cli_get_key() { local key="${1%%=*}" echo "${key/--/}" } -function cli_get_val() { +cli_get_val() { echo "${@#*=}" } -function cli_get_bool() { +cli_get_bool() { local value="$(cli_get_val "$@")" if enabled value; then @@ -372,7 +372,7 @@ function cli_get_bool() { return ${EXIT_FALSE} } -function cli_usage() { +cli_usage() { local command="$@" local basename="$(basename ${0})" @@ -384,7 +384,7 @@ function cli_usage() { echo "Please run '${command}' for detailed help." >&2 } -function cli_show_man() { +cli_show_man() { local manpage=${1} assert isset manpage diff --git a/src/functions/functions.cli.firewall b/src/functions/functions.cli.firewall index 9e99f31a..ffd3a657 100644 --- a/src/functions/functions.cli.firewall +++ b/src/functions/functions.cli.firewall @@ -19,7 +19,7 @@ # # ############################################################################### -function firewall_cli() { +firewall_cli() { local protocol="${1}" assert isset protocol shift @@ -76,7 +76,7 @@ function firewall_cli() { exit ${EXIT_OK} } -function firewall_cli_panic() { +firewall_cli_panic() { local protocol="${1}" assert isset protocol shift @@ -103,7 +103,7 @@ function firewall_cli_panic() { firewall_panic ${admin_hosts} } -function firewall_cli_settings() { +firewall_cli_settings() { if cli_help_requested $@; then cli_show_man firewall-settings exit ${EXIT_OK} @@ -117,7 +117,7 @@ function firewall_cli_settings() { fi } -function firewall_cli_zone() { +firewall_cli_zone() { local protocol="${1}" assert isset protocol shift @@ -183,7 +183,7 @@ function firewall_cli_zone() { } # Show firewall zone conifguration. -function firewall_cli_zone_status() { +firewall_cli_zone_status() { local zone=${1} assert isset zone @@ -200,7 +200,7 @@ function firewall_cli_zone_status() { } # Edit firewall zone configuration. -function firewall_cli_zone_edit() { +firewall_cli_zone_edit() { firewall_zone_edit "$@" exit ${EXIT_OK} diff --git a/src/functions/functions.config b/src/functions/functions.config index ab1dadc4..854f4907 100644 --- a/src/functions/functions.config +++ b/src/functions/functions.config @@ -19,7 +19,7 @@ # # ############################################################################### -function config_header() { +config_header() { local what=${1} assert isset what @@ -34,7 +34,7 @@ function config_header() { echo } -function config_hostname() { +config_hostname() { local hostname=${1} if [ -n "${hostname}" ]; then @@ -44,7 +44,7 @@ function config_hostname() { fi } -function config_domainname() { +config_domainname() { local hostname=$(config_hostname) # Strip off the hostname part and just return diff --git a/src/functions/functions.conntrack b/src/functions/functions.conntrack index aa432efa..e4d1d444 100644 --- a/src/functions/functions.conntrack +++ b/src/functions/functions.conntrack @@ -21,11 +21,11 @@ # Accounting -function conntrack_get_accounting() { +conntrack_get_accounting() { sysctl_get "net.netfilter.nf_conntrack_acct" } -function conntrack_set_accounting() { +conntrack_set_accounting() { local value="${1}" assert isset value @@ -43,11 +43,11 @@ function conntrack_set_accounting() { # Max. connections -function conntrack_get_max_connections() { +conntrack_get_max_connections() { sysctl_get "net.netfilter.nf_conntrack_max" } -function conntrack_set_max_connections() { +conntrack_set_max_connections() { local value="${1}" assert isinteger value @@ -57,11 +57,11 @@ function conntrack_set_max_connections() { # UDP timeout -function conntrack_get_udp_timeout() { +conntrack_get_udp_timeout() { sysctl_get "net.netfilter.nf_conntrack_udp_timeout" } -function conntrack_set_udp_timeout() { +conntrack_set_udp_timeout() { local value="${1}" assert isinteger value diff --git a/src/functions/functions.db b/src/functions/functions.db index 23e0e359..251832cf 100644 --- a/src/functions/functions.db +++ b/src/functions/functions.db @@ -19,7 +19,7 @@ # # ############################################################################### -function db_connection_init() { +db_connection_init() { if [ -e "${DB_CONNECTION_FILE}" ]; then return ${EXIT_OK} fi @@ -40,7 +40,7 @@ CREATE VIEW current as EOF } -function db_connection_update() { +db_connection_update() { local zone=${1} local action=${2} shift 2 @@ -55,7 +55,7 @@ INSERT INTO log(zone, time, state) EOF } -function db_ppp_init() { +db_ppp_init() { local file=${1} if [ -e "${file}" ]; then @@ -75,7 +75,7 @@ CREATE TABLE accounting( EOF } -function db_ppp_update() { +db_ppp_update() { local zone=${1} shift diff --git a/src/functions/functions.device b/src/functions/functions.device index 8252991d..d5ff381d 100644 --- a/src/functions/functions.device +++ b/src/functions/functions.device @@ -19,7 +19,7 @@ # # ############################################################################### -function device_list() { +device_list() { local devices # Add all interfaces @@ -36,7 +36,7 @@ function device_list() { } # Check if the device exists -function device_exists() { +device_exists() { local device=${1} # If device name was not found, exit. @@ -54,7 +54,7 @@ function device_exists() { serial_exists ${device} } -function device_matches_pattern() { +device_matches_pattern() { local device="${1}" assert isset device @@ -67,7 +67,7 @@ function device_matches_pattern() { && return ${EXIT_TRUE} || return ${EXIT_FALSE} } -function device_delete() { +device_delete() { local device=${1} assert isset device @@ -86,7 +86,7 @@ function device_delete() { return ${ret} } -function device_has_flag() { +device_has_flag() { local device=${1} local flag=${2} @@ -100,7 +100,7 @@ function device_has_flag() { } # Check if the device is up -function device_is_up() { +device_is_up() { local device=${1} device_exists ${device} || return ${EXIT_ERROR} @@ -108,7 +108,7 @@ function device_is_up() { device_has_flag ${device} 0x1 } -function device_ifindex_to_name() { +device_ifindex_to_name() { local idx=${1} assert isset idx @@ -128,7 +128,7 @@ function device_ifindex_to_name() { return ${EXIT_ERROR} } -function device_get_ifindex() { +device_get_ifindex() { local device=${1} assert isset device @@ -141,12 +141,12 @@ function device_get_ifindex() { } # Check if the device is a batman-adv bridge -function device_is_batman_adv() { +device_is_batman_adv() { [ -d "${SYS_CLASS_NET}/${1}/mesh" ] } # Check if the device is a batman-adv slave port -function device_is_batman_adv_slave() { +device_is_batman_adv_slave() { local device="${1}" if [ -d "${SYS_CLASS_NET}/${device}/batman_adv" ]; then @@ -166,28 +166,28 @@ function device_is_batman_adv_slave() { } # Check if the device is a bonding device -function device_is_bonding() { +device_is_bonding() { [ -d "/sys/class/net/${1}/bonding" ] } # Check if the device bonded in a bonding device -function device_is_bonded() { +device_is_bonded() { local device=${1} [ -d "${SYS_CLASS_NET}/${device}/bonding_slave" ] } # Check if the device is a bridge -function device_is_bridge() { +device_is_bridge() { [ -d "/sys/class/net/${1}/bridge" ] } -function device_is_bridge_attached() { +device_is_bridge_attached() { local device=${1} [ -d "${SYS_CLASS_NET}/${device}/brport" ] } -function device_is_wireless_monitor() { +device_is_wireless_monitor() { local device="${1}" assert isset device @@ -195,7 +195,7 @@ function device_is_wireless_monitor() { device_matches_pattern "${device}" "${PORT_PATTERN_WIRELESS_MONITOR}" } -function device_is_wireless_adhoc() { +device_is_wireless_adhoc() { local device="${1}" assert isset device @@ -203,7 +203,7 @@ function device_is_wireless_adhoc() { device_matches_pattern "${device}" "${PORT_PATTERN_WIRELESS_ADHOC}" } -function device_get_bridge() { +device_get_bridge() { local device=${1} assert isset device @@ -220,7 +220,7 @@ function device_get_bridge() { } # Check if the device is a vlan device -function device_is_vlan() { +device_is_vlan() { local device=${1} assert isset device @@ -228,7 +228,7 @@ function device_is_vlan() { } # Check if the device has vlan devices -function device_has_vlans() { +device_has_vlans() { local device=${1} assert isset device @@ -240,7 +240,7 @@ function device_has_vlans() { [ -n "${vlans}" ] && return ${EXIT_OK} || return ${EXIT_ERROR} } -function device_get_vlans() { +device_get_vlans() { local device=${1} assert isset device @@ -257,7 +257,7 @@ function device_get_vlans() { } # Check if the device is a ppp device -function device_is_ppp() { +device_is_ppp() { local device=${1} local type=$(__device_get_file ${device} type) @@ -266,14 +266,14 @@ function device_is_ppp() { } # Check if the device is a pointopoint device. -function device_is_ptp() { +device_is_ptp() { local device=${1} device_has_flag ${device} 0x10 } # Check if the device is a loopback device -function device_is_loopback() { +device_is_loopback() { local device=${1} [ "${device}" = "lo" ] @@ -281,20 +281,20 @@ function device_is_loopback() { # Check if the device is a dummy device # This is the worst possible check, but all I could come up with -function device_is_dummy() { +device_is_dummy() { local device="${1}" [[ ${device} =~ ^dummy[0-9]+$ ]] } # Check if the device is a wireless device -function device_is_wireless() { +device_is_wireless() { local device=${1} [ -d "${SYS_CLASS_NET}/${device}/phy80211" ] } -function device_get_phy() { +device_get_phy() { local device="${1}" if device_is_wireless "${device}"; then @@ -305,16 +305,16 @@ function device_get_phy() { return ${EXIT_ERROR} } -function device_is_phy() { +device_is_phy() { phy_exists $@ } -function device_is_serial() { +device_is_serial() { serial_exists $@ } # Check if the device is a physical network interface -function device_is_ethernet() { +device_is_ethernet() { local device=${1} device_is_ethernet_compatible "${device}" || \ @@ -342,7 +342,7 @@ function device_is_ethernet() { } # Get the device type -function device_get_type() { +device_get_type() { local device=${1} # If the device does not exist (happens on udev remove events), @@ -391,7 +391,7 @@ function device_get_type() { fi } -function device_is_ethernet_compatible() { +device_is_ethernet_compatible() { local device="${1}" # /sys/class/net/*/type must equal 1 for ethernet compatible devices @@ -399,7 +399,7 @@ function device_is_ethernet_compatible() { [[ "${type}" = "1" ]] } -function device_get_status() { +device_get_status() { local device=${1} assert isset device @@ -416,13 +416,13 @@ function device_get_status() { echo "${status}" } -function device_get_address() { +device_get_address() { local device=${1} cat ${SYS_CLASS_NET}/${device}/address 2>/dev/null } -function device_set_address() { +device_set_address() { assert [ $# -eq 2 ] local device="${1}" @@ -461,7 +461,7 @@ function device_set_address() { return ${ret} } -function device_get() { +device_get() { local device local devices @@ -478,12 +478,12 @@ function device_get() { return ${EXIT_OK} } -function devices_get_all() { +devices_get_all() { device_get } # Check if a device has a cable plugged in -function device_has_carrier() { +device_has_carrier() { local device=${1} assert isset device @@ -491,13 +491,13 @@ function device_has_carrier() { [ "${carrier}" = "1" ] } -function device_is_promisc() { +device_is_promisc() { local device=${1} device_has_flag ${device} 0x200 } -function device_set_promisc() { +device_set_promisc() { local device=${1} local state=${2} @@ -509,12 +509,12 @@ function device_set_promisc() { } # Check if the device is free -function device_is_free() { +device_is_free() { ! device_is_used $@ } # Check if the device is used -function device_is_used() { +device_is_used() { local device=${1} device_has_vlans ${device} && \ @@ -528,7 +528,7 @@ function device_is_used() { } # Give the device a new name -function device_set_name() { +device_set_name() { local source=$1 local destination=${2} @@ -551,7 +551,7 @@ function device_set_name() { } # Set device up -function device_set_up() { +device_set_up() { local device=${1} # Silently fail if device was not found @@ -567,7 +567,7 @@ function device_set_up() { ip link set ${device} up } -function device_set_parent_up() { +device_set_parent_up() { local device=${1} local parent @@ -586,7 +586,7 @@ function device_set_parent_up() { } # Set device down -function device_set_down() { +device_set_down() { local device=${1} assert isset device @@ -604,7 +604,7 @@ function device_set_down() { return ${ret} } -function device_set_parent_down() { +device_set_parent_down() { local device=${1} local parent @@ -623,7 +623,7 @@ function device_set_parent_down() { return ${EXIT_OK} } -function device_get_mtu() { +device_get_mtu() { local device=${1} if ! device_exists ${device}; then @@ -635,7 +635,7 @@ function device_get_mtu() { } # Set mtu to a device -function device_set_mtu() { +device_set_mtu() { local device=${1} local mtu=${2} @@ -673,7 +673,7 @@ function device_set_mtu() { return ${ret} } -function device_adjust_mtu() { +device_adjust_mtu() { assert [ $# -eq 2 ] local device="${1}" @@ -683,7 +683,7 @@ function device_adjust_mtu() { device_set_mtu "${device}" "${mtu}" } -function device_discover() { +device_discover() { local device=${1} log INFO "Running discovery process on device '${device}'." @@ -694,7 +694,7 @@ function device_discover() { done } -function device_has_ip() { +device_has_ip() { local device=${1} local addr=${2} @@ -712,7 +712,7 @@ function device_has_ip() { listmatch ${addr} $(device_get_addresses ${device}) } -function device_get_addresses() { +device_get_addresses() { local device=${1} assert device_exists ${device} @@ -726,7 +726,7 @@ function device_get_addresses() { done } -function __device_get_file() { +__device_get_file() { local device=${1} local file=${2} @@ -739,7 +739,7 @@ function __device_get_file() { echo "$(<${path})" } -function __device_set_file() { +__device_set_file() { assert [ $# -eq 3 ] local device="${1}" @@ -755,55 +755,55 @@ function __device_set_file() { echo "${value}" > "${path}" } -function device_get_rx_bytes() { +device_get_rx_bytes() { local device=${1} __device_get_file ${device} statistics/rx_bytes } -function device_get_tx_bytes() { +device_get_tx_bytes() { local device=${1} __device_get_file ${device} statistics/tx_bytes } -function device_get_rx_packets() { +device_get_rx_packets() { local device=${1} __device_get_file ${device} statistics/rx_packets } -function device_get_tx_packets() { +device_get_tx_packets() { local device=${1} __device_get_file ${device} statistics/tx_packets } -function device_get_rx_errors() { +device_get_rx_errors() { local device=${1} __device_get_file ${device} statistics/rx_errors } -function device_get_tx_errors() { +device_get_tx_errors() { local device=${1} __device_get_file ${device} statistics/tx_errors } -function device_get_speed() { +device_get_speed() { local device=${1} __device_get_file ${device} speed } -function device_get_duplex() { +device_get_duplex() { local device=${1} __device_get_file ${device} duplex } -function device_get_link_string() { +device_get_link_string() { local device="${1}" assert isset device diff --git a/src/functions/functions.dhcpd b/src/functions/functions.dhcpd index 82698ff0..a3fd9060 100644 --- a/src/functions/functions.dhcpd +++ b/src/functions/functions.dhcpd @@ -97,7 +97,7 @@ DHCPV4D_DEFAULT_LEASE_TIME="43200" # 12h DHCPV4D_MAX_LEASE_TIME="86400" # 24h DHCPV4D_MIN_LEASE_TIME="" -function dhcpd_service() { +dhcpd_service() { case "${1}" in ipv6) print "dhcpd6.service" @@ -113,7 +113,7 @@ function dhcpd_service() { return ${EXIT_OK} } -function dhcpd_start() { +dhcpd_start() { local services=$(dhcpd_service $@) local service @@ -122,7 +122,7 @@ function dhcpd_start() { done } -function dhcpd_stop() { +dhcpd_stop() { local services=$(dhcpd_service $@) local service @@ -131,7 +131,7 @@ function dhcpd_stop() { done } -function dhcpd_restart() { +dhcpd_restart() { # DHCP does not support a reload, so # we retsart it. local services=$(dhcpd_service $@) @@ -142,11 +142,11 @@ function dhcpd_restart() { done } -function dhcpd_reload() { +dhcpd_reload() { dhcpd_restart $@ } -function dhcpd_edit() { +dhcpd_edit() { local proto=${1} assert isset proto shift @@ -169,7 +169,7 @@ function dhcpd_edit() { dhcpd_global_settings_write ${proto} } -function _dhcpd_edit_ipv4() { +_dhcpd_edit_ipv4() { local val while [ $# -gt 0 ]; do @@ -223,7 +223,7 @@ function _dhcpd_edit_ipv4() { fi } -function _dhcpd_edit_ipv6() { +_dhcpd_edit_ipv6() { while [ $# -gt 0 ]; do case "${1}" in --preferred-lifetime=*) @@ -251,7 +251,7 @@ function _dhcpd_edit_ipv6() { done } -function dhcpd_settings_file() { +dhcpd_settings_file() { local proto=${1} assert isset proto @@ -267,7 +267,7 @@ function dhcpd_settings_file() { return ${EXIT_OK} } -function dhcpd_settings() { +dhcpd_settings() { local proto=${1} assert isset proto @@ -283,7 +283,7 @@ function dhcpd_settings() { return ${EXIT_OK} } -function dhcpd_options_file() { +dhcpd_options_file() { local proto=${1} assert isset proto @@ -299,7 +299,7 @@ function dhcpd_options_file() { return ${EXIT_OK} } -function dhcpd_options_list() { +dhcpd_options_list() { local proto=${1} assert isset proto @@ -315,7 +315,7 @@ function dhcpd_options_list() { return ${EXIT_OK} } -function dhcpd_options() { +dhcpd_options() { local proto=${1} assert isset proto @@ -331,14 +331,14 @@ function dhcpd_options() { return ${EXIT_OK} } -function dhcpd_global_settings_list() { +dhcpd_global_settings_list() { local proto="${1}" assert isset proto dhcpd_settings "${proto}" } -function dhcpd_global_settings_defaults() { +dhcpd_global_settings_defaults() { local proto=${1} assert isset proto @@ -354,7 +354,7 @@ function dhcpd_global_settings_defaults() { done } -function dhcpd_global_settings_read() { +dhcpd_global_settings_read() { local proto=${1} assert isset proto @@ -368,7 +368,7 @@ function dhcpd_global_settings_read() { settings_read ${file} ${settings} } -function dhcpd_global_settings_write() { +dhcpd_global_settings_write() { local proto=${1} assert isset proto @@ -381,7 +381,7 @@ function dhcpd_global_settings_write() { settings_write ${file} ${settings} } -function dhcpd_global_options_read() { +dhcpd_global_options_read() { local proto=${1} assert isset proto @@ -396,7 +396,7 @@ function dhcpd_global_options_read() { fi } -function dhcpd_subnet_path() { +dhcpd_subnet_path() { local proto=${1} assert isset proto @@ -418,7 +418,7 @@ function dhcpd_subnet_path() { return ${EXIT_OK} } -function dhcpd_subnet_exists() { +dhcpd_subnet_exists() { local proto=${1} assert isset proto @@ -431,7 +431,7 @@ function dhcpd_subnet_exists() { [ -d "${path}" ] && return ${EXIT_TRUE} || return ${EXIT_FALSE} } -function dhcpd_subnet_match() { +dhcpd_subnet_match() { local proto=${1} assert isset proto @@ -452,7 +452,7 @@ function dhcpd_subnet_match() { return ${EXIT_FALSE} } -function dhcpd_new_subnet_id() { +dhcpd_new_subnet_id() { local proto=${1} assert isset proto @@ -469,7 +469,7 @@ function dhcpd_new_subnet_id() { return ${EXIT_ERROR} } -function dhcpd_subnet_new() { +dhcpd_subnet_new() { local proto=${1} assert isset proto shift @@ -495,7 +495,7 @@ function dhcpd_subnet_new() { fi } -function dhcpd_subnet_edit() { +dhcpd_subnet_edit() { local proto=${1} assert isset proto shift @@ -575,7 +575,7 @@ function dhcpd_subnet_edit() { settings_write ${file} ${settings} } -function dhcpd_subnet_remove() { +dhcpd_subnet_remove() { local proto=${1} assert isset proto @@ -589,7 +589,7 @@ function dhcpd_subnet_remove() { rm -rf ${path} } -function dhcpd_subnet_list() { +dhcpd_subnet_list() { local proto=${1} assert isset proto @@ -608,7 +608,7 @@ function dhcpd_subnet_list() { done } -function dhcpd_subnet_read() { +dhcpd_subnet_read() { local proto=${1} assert isset proto @@ -619,7 +619,7 @@ function dhcpd_subnet_read() { settings_read ${file} } -function dhcpd_subnet_range_path() { +dhcpd_subnet_range_path() { local proto=${1} assert isset proto @@ -633,7 +633,7 @@ function dhcpd_subnet_range_path() { return ${EXIT_OK} } -function dhcpd_subnet_range_settings() { +dhcpd_subnet_range_settings() { local proto=${1} case "${proto}" in @@ -648,7 +648,7 @@ function dhcpd_subnet_range_settings() { return ${EXIT_OK} } -function dhcpd_subnet_new_range_id() { +dhcpd_subnet_new_range_id() { local proto=${1} assert isset proto @@ -669,7 +669,7 @@ function dhcpd_subnet_new_range_id() { return ${EXIT_ERROR} } -function dhcpd_subnet_range_new() { +dhcpd_subnet_range_new() { local proto=${1} assert isset proto shift @@ -699,7 +699,7 @@ function dhcpd_subnet_range_new() { return ${EXIT_OK} } -function dhcpd_subnet_range_edit() { +dhcpd_subnet_range_edit() { local proto=${1} assert isset proto shift @@ -782,14 +782,14 @@ function dhcpd_subnet_range_edit() { settings_write ${file} ${settings} } -function dhcpd_subnet_range_remove() { +dhcpd_subnet_range_remove() { local path=$(dhcpd_subnet_range_path $@) assert isset path rm -f ${path} } -function dhcpd_subnet_range_list() { +dhcpd_subnet_range_list() { local proto=${1} assert isset proto @@ -810,7 +810,7 @@ function dhcpd_subnet_range_list() { return ${EXIT_OK} } -function dhcpd_subnet_range_read() { +dhcpd_subnet_range_read() { local proto=${1} assert isset proto @@ -824,7 +824,7 @@ function dhcpd_subnet_range_read() { settings_read ${file} } -function dhcpd_subnet_settings() { +dhcpd_subnet_settings() { local proto=${1} case "${proto}" in @@ -839,14 +839,14 @@ function dhcpd_subnet_settings() { return ${EXIT_OK} } -function dhcpd_subnet_options_file() { +dhcpd_subnet_options_file() { local path=$(dhcpd_subnet_path $@) assert isset path print "${path}/options" } -function dhcpd_subnet_options_list() { +dhcpd_subnet_options_list() { local proto=${1} assert isset proto @@ -862,7 +862,7 @@ function dhcpd_subnet_options_list() { return ${EXIT_OK} } -function dhcpd_subnet_options_read() { +dhcpd_subnet_options_read() { local proto=${1} assert isset proto @@ -876,7 +876,7 @@ function dhcpd_subnet_options_read() { } # Helper functions to create a DHCP configuration file. -function _dhcpd_write_options() { +_dhcpd_write_options() { local proto=${1} assert isset proto @@ -916,7 +916,7 @@ function _dhcpd_write_options() { fi } -function _dhcpd_read_options() { +_dhcpd_read_options() { local file=${1} assert isset file @@ -926,7 +926,7 @@ function _dhcpd_read_options() { settings_read_array ${file} options ${!options_list} } -function _dhcpd_write_subnet() { +_dhcpd_write_subnet() { local proto=${1} assert isset proto @@ -978,7 +978,7 @@ function _dhcpd_write_subnet() { return ${EXIT_OK} } -function _dhcpd_write_subnet_options() { +_dhcpd_write_subnet_options() { local proto=${1} assert isset proto @@ -1018,7 +1018,7 @@ function _dhcpd_write_subnet_options() { _dhcpd_write_options ${proto} ${file} ${options_list} "\t" } -function _dhcpd_search_routers() { +_dhcpd_search_routers() { local proto=${1} assert isset proto @@ -1043,7 +1043,7 @@ function _dhcpd_search_routers() { list_join routers ", " } -function _dhcpd_write_subnet_range() { +_dhcpd_write_subnet_range() { local proto=${1} assert isset proto @@ -1079,7 +1079,7 @@ function _dhcpd_write_subnet_range() { return ${EXIT_OK} } -function dhcpd_write_config() { +dhcpd_write_config() { local proto=${1} assert isset proto diff --git a/src/functions/functions.dns b/src/functions/functions.dns index 28db4b39..b3f42fd0 100644 --- a/src/functions/functions.dns +++ b/src/functions/functions.dns @@ -45,7 +45,7 @@ DNS_SERVER_DYNAMIC_PRIORITY="10" # Path to the configuration file of the DNS resolver. RESOLV_CONF="/etc/resolv.conf" -function dns_get_hostname() { +dns_get_hostname() { local address=${1} assert isset address @@ -56,7 +56,7 @@ function dns_get_hostname() { ) } -function dns_server_list() { +dns_server_list() { [ -r "${DNS_SERVER_CONFIG_FILE}" ] || return ${EXIT_OK} local line @@ -70,7 +70,7 @@ function dns_server_list() { return ${EXIT_OK} } -function dns_server_list_sorted() { +dns_server_list_sorted() { [ -r "${DNS_SERVER_CONFIG_FILE}" ] || return ${EXIT_OK} local servers=$( @@ -104,7 +104,7 @@ function dns_server_list_sorted() { return ${EXIT_OK} } -function dns_server_show() { +dns_server_show() { [ -r "${DNS_SERVER_CONFIG_FILE}" ] || return ${EXIT_OK} local line @@ -122,7 +122,7 @@ function dns_server_show() { return ${EXIT_OK} } -function dns_server_add() { +dns_server_add() { local server=${1} assert isset server @@ -139,7 +139,7 @@ function dns_server_add() { return ${EXIT_OK} } -function dns_server_exists() { +dns_server_exists() { local entry=${1} assert isset entry @@ -155,7 +155,7 @@ function dns_server_exists() { return ${EXIT_FALSE} } -function dns_server_remove() { +dns_server_remove() { local entry=${1} assert isset entry @@ -185,11 +185,11 @@ function dns_server_remove() { return ${EXIT_OK} } -function dns_server_flush() { +dns_server_flush() { : > ${DNS_SERVER_CONFIG_FILE} } -function dns_server_parse_line() { +dns_server_parse_line() { local arg for arg in ${NETWORK_CONFIG_DNS_SERVER_PARAMS}; do @@ -228,7 +228,7 @@ function dns_server_parse_line() { # Update resolv.conf(5) when initializing the network. init_register dns_generate_resolvconf -function dns_generate_resolvconf() { +dns_generate_resolvconf() { local file=${RESOLV_CONF} log INFO "Updating resolver configuration..." @@ -260,7 +260,7 @@ function dns_generate_resolvconf() { done >> ${file} } -function dns_get_search_domains() { +dns_get_search_domains() { # Add search domains. local search_domains="$(unquote ${DNS_SEARCH_DOMAINS})" @@ -280,7 +280,7 @@ function dns_get_search_domains() { list_unique ${search_domains} } -function dns_server_get_zone_name_servers() { +dns_server_get_zone_name_servers() { local priority proto server servers zone for zone in $(zones_get_all); do diff --git a/src/functions/functions.dummy b/src/functions/functions.dummy index 13c00694..eaaa51ab 100644 --- a/src/functions/functions.dummy +++ b/src/functions/functions.dummy @@ -21,7 +21,7 @@ DUMMY_PORT_PATTERN="dN" -function dummy_create() { +dummy_create() { local device=${1} assert isset device @@ -46,7 +46,7 @@ function dummy_create() { return ${ret} } -function dummy_remove() { +dummy_remove() { local device=${1} assert isset device diff --git a/src/functions/functions.firewall b/src/functions/functions.firewall index 494e3bb3..c484c2ac 100644 --- a/src/functions/functions.firewall +++ b/src/functions/functions.firewall @@ -21,7 +21,7 @@ # This function initializes all kernel parameters that need to be adjusted # to run this firewall properly. -function firewall_kernel_init() { +firewall_kernel_init() { log INFO "Configuring kernel parameters..." local option @@ -151,7 +151,7 @@ function firewall_kernel_init() { # High-level function which will create a ruleset for the current firewall # configuration and load it into the kernel. -function firewall_start() { +firewall_start() { local protocol="${1}" assert isset protocol shift @@ -215,7 +215,7 @@ function firewall_start() { firewall_lock_release } -function firewall_stop() { +firewall_stop() { local protocol="${1}" assert isset protocol @@ -231,7 +231,7 @@ function firewall_stop() { firewall_lock_release } -function firewall_show() { +firewall_show() { local protocol="${1}" assert isset protocol @@ -241,7 +241,7 @@ function firewall_show() { return ${EXIT_OK} } -function firewall_panic() { +firewall_panic() { local protocol="${1}" assert isset protocol shift @@ -267,7 +267,7 @@ function firewall_panic() { firewall_lock_release } -function firewall_lock_acquire() { +firewall_lock_acquire() { lock_acquire ${RUN_DIR}/.firewall_lock # Make sure the lock is released after the firewall @@ -279,7 +279,7 @@ function firewall_lock_acquire() { IPTABLES_TMPDIR=$(mktemp -d) } -function firewall_lock_release() { +firewall_lock_release() { if isset IPTABLES_TMPDIR; then # Remove all temporary data. rm -rf ${IPTABLES_TMPDIR} @@ -294,7 +294,7 @@ function firewall_lock_release() { lock_release ${RUN_DIR}/.firewall_lock } -function firewall_custom_chains() { +firewall_custom_chains() { local protocol="${1}" assert isset protocol @@ -323,7 +323,7 @@ function firewall_custom_chains() { iptables "${protocol}" -t nat -A OUTPUT -j CUSTOMOUTPUT } -function firewall_filter_invalid_packets() { +firewall_filter_invalid_packets() { local protocol="${1}" assert isset protocol @@ -464,7 +464,7 @@ function firewall_filter_invalid_packets() { iptables "${protocol}" -A FILTER_INVALID -m conntrack --ctstate INVALID -j DROP } -function firewall_tcp_clamp_mss() { +firewall_tcp_clamp_mss() { # Do nothing if this has been disabled. enabled FIREWALL_CLAMP_PATH_MTU || return ${EXIT_OK} @@ -477,7 +477,7 @@ function firewall_tcp_clamp_mss() { -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu } -function firewall_connection_tracking() { +firewall_connection_tracking() { local protocol="${1}" assert isset protocol @@ -493,7 +493,7 @@ function firewall_connection_tracking() { iptables "${protocol}" -A FORWARD -j CONNTRACK } -function firewall_localhost_create_chains() { +firewall_localhost_create_chains() { local protocol="${1}" assert isset protocol @@ -504,7 +504,7 @@ function firewall_localhost_create_chains() { iptables "${protocol}" -A OUTPUT -o lo -j ACCEPT } -function firewall_filter_rh0_headers() { +firewall_filter_rh0_headers() { local protocol="${1}" assert isset protocol @@ -521,7 +521,7 @@ function firewall_filter_rh0_headers() { iptables "${protocol}" -A OUTPUT -j FILTER_RH0 } -function firewall_filter_icmp() { +firewall_filter_icmp() { local protocol="${1}" assert isset protocol @@ -582,7 +582,7 @@ function firewall_filter_icmp() { return ${EXIT_OK} } -function firewall_zone_create_chains() { +firewall_zone_create_chains() { local protocol="${1}" assert isset protocol @@ -662,7 +662,7 @@ function firewall_zone_create_chains() { return ${EXIT_OK} } -function firewall_parse_rules() { +firewall_parse_rules() { local file=${1} assert isset file shift @@ -723,7 +723,7 @@ function firewall_parse_rules() { done < ${file} } -function _firewall_parse_rule_line() { +_firewall_parse_rule_line() { local arg # Clear all values. diff --git a/src/functions/functions.firewall-policy b/src/functions/functions.firewall-policy index e7b0cf1a..8ba55341 100644 --- a/src/functions/functions.firewall-policy +++ b/src/functions/functions.firewall-policy @@ -19,7 +19,7 @@ # # ############################################################################### -function policy_zone_add() { +policy_zone_add() { local zone=${1} assert isset zone @@ -42,7 +42,7 @@ function policy_zone_add() { done } -function policy_zone_masquerade4() { +policy_zone_masquerade4() { local zone=${1} assert isset zone @@ -52,7 +52,7 @@ function policy_zone_masquerade4() { -j MASQUERADE --random } -function policy_zone_allow_all() { +policy_zone_allow_all() { local zone=${1} assert isset zone @@ -65,7 +65,7 @@ function policy_zone_allow_all() { iptables -A "${chain}" -m conntrack --ctstate NEW -j ACCEPT } -function policy_zone_deny_all() { +policy_zone_deny_all() { local zone=${1} assert isset zone @@ -78,13 +78,13 @@ function policy_zone_deny_all() { iptables -A "${chain}" -j DROP } -function policy_drop_all() { +policy_drop_all() { # Nothing to do here, because that is the # default policy of the INPUT/OUTPUT/FORWARD chain. : } -function policy_import_all_rules() { +policy_import_all_rules() { # This will populate all chains with the rules # for the given zone. @@ -103,7 +103,7 @@ function policy_import_all_rules() { # -A ${chain}_RULES_INC } -function policy_load() { +policy_load() { local zone_from=${1} assert isset zone_from diff --git a/src/functions/functions.firewall-zones b/src/functions/functions.firewall-zones index 397b2bd0..a72bb8e0 100644 --- a/src/functions/functions.firewall-zones +++ b/src/functions/functions.firewall-zones @@ -19,7 +19,7 @@ # # ############################################################################### -function firewall_zone_create() { +firewall_zone_create() { local zone=${1} assert isset zone @@ -35,7 +35,7 @@ function firewall_zone_create() { return ${EXIT_OK} } -function firewall_zone_config() { +firewall_zone_config() { local zone=${1} assert isset zone @@ -43,13 +43,13 @@ function firewall_zone_config() { return ${EXIT_OK} } -function firewall_zone_exists() { +firewall_zone_exists() { local file=$(firewall_zone_config $@) [ -r "${file}" ] && return ${EXIT_TRUE} || return ${EXIT_FALSE} } -function firewall_zone_read() { +firewall_zone_read() { local zone=${1} assert isset zone @@ -69,7 +69,7 @@ function firewall_zone_read() { return ${EXIT_OK} } -function firewall_zone_write() { +firewall_zone_write() { local zone=${1} assert isset zone @@ -80,7 +80,7 @@ function firewall_zone_write() { return ${EXIT_OK} } -function firewall_zone_print() { +firewall_zone_print() { local zone=${1} assert isset zone @@ -92,7 +92,7 @@ function firewall_zone_print() { return ${EXIT_OK} } -function firewall_zone_edit() { +firewall_zone_edit() { local zone=${1} assert isset zone shift @@ -130,7 +130,7 @@ function firewall_zone_edit() { ) } -function firewall_zone_reset() { +firewall_zone_reset() { local zone=${1} assert isset zone diff --git a/src/functions/functions.he b/src/functions/functions.he index efd23c6a..205170cd 100644 --- a/src/functions/functions.he +++ b/src/functions/functions.he @@ -19,7 +19,7 @@ # # ############################################################################### -function he_tunnelbroker_endpoint_update() { +he_tunnelbroker_endpoint_update() { local username local password local tunnel_id diff --git a/src/functions/functions.hook b/src/functions/functions.hook index f8e2b6b5..88a99ff7 100644 --- a/src/functions/functions.hook +++ b/src/functions/functions.hook @@ -19,7 +19,7 @@ # # ############################################################################### -function hook_dir() { +hook_dir() { local type=${1} if [ -n "${type}" ]; then @@ -30,7 +30,7 @@ function hook_dir() { } NETWORK_HOOKS_DIR_ZONES="$(hook_dir zone)" -function hook_list() { +hook_list() { local type="${1}" assert isoneof type port zone @@ -46,7 +46,7 @@ function hook_list() { return ${EXIT_OK} } -function hook_exists() { +hook_exists() { local type=${1} local hook=${2} @@ -59,7 +59,7 @@ function hook_exists() { [ ! -d "${hook}" ] && [ -x "${hook}" ] } -function hook_exec() { +hook_exec() { local type="${1}" assert isset type @@ -113,7 +113,7 @@ function hook_exec() { return ${ret} } -function hook_list() { +hook_list() { local type="${1}" local dir="$(hook_dir "${type}")" @@ -130,7 +130,7 @@ function hook_list() { } # The default help function. -function hook_help() { +hook_help() { # If no man page has been configured, we print an error message. if [ -z "${HOOK_MANPAGE}" ]; then error "There is no help available for hook '${HOOK}'. Exiting." @@ -142,7 +142,7 @@ function hook_help() { exit $? } -function config_get_hook() { +config_get_hook() { local config=${1} assert isset config @@ -154,31 +154,31 @@ function config_get_hook() { ) } -function hook_zone_exists() { +hook_zone_exists() { hook_exists zone $@ } -function hook_zone_exec() { +hook_zone_exec() { hook_exec zone $@ } -function hook_zone_get_all() { +hook_zone_get_all() { hook_list zone } -function hook_config_exists() { +hook_config_exists() { hook_exists config $@ } -function hook_config_exec() { +hook_config_exec() { hook_exec config $@ } -function hook_config_get_all() { +hook_config_get_all() { hook_list config } -function hook_valid_command() { +hook_valid_command() { local type="${1}" local cmd="${2}" @@ -200,7 +200,7 @@ function hook_valid_command() { return ${EXIT_FALSE} } -function hook_valid_command_config() { +hook_valid_command_config() { local cmd="${1}" case "${cmd}" in @@ -212,7 +212,7 @@ function hook_valid_command_config() { return ${EXIT_FALSE} } -function hook_valid_command_port() { +hook_valid_command_port() { local cmd="${1}" case "${cmd}" in @@ -240,7 +240,7 @@ function hook_valid_command_port() { return ${EXIT_FALSE} } -function hook_valid_command_zone() { +hook_valid_command_zone() { local cmd="${1}" case "${cmd}" in diff --git a/src/functions/functions.hostapd b/src/functions/functions.hostapd index d98bf9fe..f7bf2fa5 100644 --- a/src/functions/functions.hostapd +++ b/src/functions/functions.hostapd @@ -21,7 +21,7 @@ HOSTAPD_CONTROL_INTERFACE_DIR="/run/hostapd/ctrl" -function hostapd_config_write() { +hostapd_config_write() { local device=${1} assert isset device @@ -191,7 +191,7 @@ function hostapd_config_write() { return ${EXIT_OK} } -function hostapd_start() { +hostapd_start() { local device=${1} assert isset device @@ -208,7 +208,7 @@ function hostapd_start() { return ${EXIT_OK} } -function hostapd_stop() { +hostapd_stop() { local device=${1} assert isset device diff --git a/src/functions/functions.hotplug b/src/functions/functions.hotplug index 80089ac3..8fccae4e 100644 --- a/src/functions/functions.hotplug +++ b/src/functions/functions.hotplug @@ -19,17 +19,17 @@ # # ############################################################################### -function hotplug_assert_in_hotplug_event() { +hotplug_assert_in_hotplug_event() { assert [ -n "${IN_HOTPLUG_EVENT}" ] } -function hotplug_action() { +hotplug_action() { hotplug_assert_in_hotplug_event echo "${ACTION}" } -function hotplug_propagate_all_ports() { +hotplug_propagate_all_ports() { hotplug_assert_in_hotplug_event # Create configured child devices. @@ -50,7 +50,7 @@ function hotplug_propagate_all_ports() { done } -function hotplug_propagate_all_zones() { +hotplug_propagate_all_zones() { hotplug_assert_in_hotplug_event local zone @@ -70,7 +70,7 @@ function hotplug_propagate_all_zones() { done } -function hotplug_event_port_is_interface() { +hotplug_event_port_is_interface() { hotplug_assert_in_hotplug_event local port="${1}" @@ -79,7 +79,7 @@ function hotplug_event_port_is_interface() { [ "${port}" = "${INTERFACE}" ] } -function hotplug_event_interface_is_slave_of_port() { +hotplug_event_interface_is_slave_of_port() { hotplug_assert_in_hotplug_event local port="${1}" @@ -92,7 +92,7 @@ function hotplug_event_interface_is_slave_of_port() { list_match "${INTERFACE}" ${slaves} } -function hotplug_event_interface_is_port_of_zone() { +hotplug_event_interface_is_port_of_zone() { hotplug_assert_in_hotplug_event local zone="${1}" @@ -105,7 +105,7 @@ function hotplug_event_interface_is_port_of_zone() { list_match "${INTERFACE}" ${ports} } -function hotplug_event_port_uses_phy() { +hotplug_event_port_uses_phy() { hotplug_assert_in_hotplug_event local port="${1}" diff --git a/src/functions/functions.http b/src/functions/functions.http index 1c61443c..693f9f87 100644 --- a/src/functions/functions.http +++ b/src/functions/functions.http @@ -19,13 +19,13 @@ # # ############################################################################### -function http_format_args() { +http_format_args() { local args="$@" list_join args "&" } -function http_GET() { +http_GET() { local username local password @@ -68,7 +68,7 @@ function http_GET() { http_call "${url}" } -function http_call() { +http_call() { # Argument list for invoking curl. local args diff --git a/src/functions/functions.in b/src/functions/functions.in index 61327d58..873b6bea 100644 --- a/src/functions/functions.in +++ b/src/functions/functions.in @@ -25,11 +25,11 @@ export PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/bin:/bin:${PATH}" INIT_FUNCTIONS="" -function init_register() { +init_register() { INIT_FUNCTIONS="${INIT_FUNCTIONS} $@" } -function init_run() { +init_run() { local init for init in ${INIT_FUNCTIONS}; do ${init} diff --git a/src/functions/functions.ip b/src/functions/functions.ip index 7e47d076..208488ff 100644 --- a/src/functions/functions.ip +++ b/src/functions/functions.ip @@ -22,14 +22,14 @@ # A list of supported versions of the IP protocol IP_SUPPORTED_PROTOCOLS="" -function ip_split_prefix() { +ip_split_prefix() { local address=${1} assert isset address echo "${address%%/*}" } -function ip_get_prefix() { +ip_get_prefix() { local address=${1} assert isset address @@ -39,7 +39,7 @@ function ip_get_prefix() { echo "${address##*/}" } -function ip_detect_protocol() { +ip_detect_protocol() { local address=${1} assert isset address @@ -55,7 +55,7 @@ function ip_detect_protocol() { return ${EXIT_ERROR} } -function ip_protocol_is_supported() { +ip_protocol_is_supported() { local proto=${1} assert isset proto @@ -63,7 +63,7 @@ function ip_protocol_is_supported() { listmatch ${proto} ${IP_SUPPORTED_PROTOCOLS} } -function ip_is_valid() { +ip_is_valid() { local address=${1} assert isset address @@ -71,7 +71,7 @@ function ip_is_valid() { isset proto && return ${EXIT_TRUE} || return ${EXIT_FALSE} } -function ip_is_network() { +ip_is_network() { local network=${1} assert isset network @@ -93,7 +93,7 @@ function ip_is_network() { return ${EXIT_TRUE} } -function ip_prefix_is_valid() { +ip_prefix_is_valid() { local proto=${1} assert isset proto @@ -113,7 +113,7 @@ function ip_prefix_is_valid() { assert ip_protocol_is_supported ${proto} } -function ip_address_add() { +ip_address_add() { local device=${1} local address=${2} @@ -157,7 +157,7 @@ function ip_address_add() { return ${EXIT_OK} } -function ip_address_del() { +ip_address_del() { local device=${1} local address=${2} diff --git a/src/functions/functions.ip-tunnel b/src/functions/functions.ip-tunnel index 342be3c3..36881f28 100644 --- a/src/functions/functions.ip-tunnel +++ b/src/functions/functions.ip-tunnel @@ -21,7 +21,7 @@ IP_TUNNEL_MODES="sit" -function ip_tunnel_add() { +ip_tunnel_add() { local device=${1} shift @@ -78,7 +78,7 @@ function ip_tunnel_add() { assert [ $? -eq 0 ] } -function ip_tunnel_del() { +ip_tunnel_del() { local device=${1} assert device_exists ${device} @@ -91,7 +91,7 @@ function ip_tunnel_del() { assert [ $? -eq 0 ] } -function ip_tunnel_6rd_set_prefix() { +ip_tunnel_6rd_set_prefix() { local device="${1}" assert isset device diff --git a/src/functions/functions.iptables b/src/functions/functions.iptables index fe519785..86627a42 100644 --- a/src/functions/functions.iptables +++ b/src/functions/functions.iptables @@ -21,7 +21,7 @@ IPTABLES_TABLES="filter mangle nat" -function iptables() { +iptables() { local protocol="${1}" assert isset protocol shift @@ -100,7 +100,7 @@ function iptables() { assert_check_retval $? } -function iptables_chain_create() { +iptables_chain_create() { local protocol="${1}" assert isset protocol shift @@ -136,7 +136,7 @@ function iptables_chain_create() { } # Calls the binary iptables command. -function _iptables() { +_iptables() { local protocol="${1}" assert isset protocol shift @@ -157,7 +157,7 @@ function _iptables() { return $? } -function iptables_status() { +iptables_status() { local protocol="${1}" assert isset protocol @@ -171,7 +171,7 @@ function iptables_status() { return ${EXIT_OK} } -function iptables_rulesfile() { +iptables_rulesfile() { local proto=${1} proto=${proto/ipv/} @@ -181,7 +181,7 @@ function iptables_rulesfile() { print "${IPTABLES_TMPDIR}/${chain}${proto}" } -function iptables_init() { +iptables_init() { local protocol="${1}" assert isset protocol @@ -210,7 +210,7 @@ function iptables_init() { } # Load the created ruleset into the kernel. -function iptables_commit () { +iptables_commit () { local protocol="${1}" assert isset protocol shift @@ -277,7 +277,7 @@ function iptables_commit () { return ${EXIT_OK} } -function _iptables_commit_cat_rulesfile() { +_iptables_commit_cat_rulesfile() { local protocol="${1}" assert isset protocol @@ -298,7 +298,7 @@ function _iptables_commit_cat_rulesfile() { assert [ -s "${rulesfile}" ] } -function _iptables_commit_load_rulesfile() { +_iptables_commit_load_rulesfile() { local protocol="${1}" assert isset protocol @@ -356,7 +356,7 @@ function _iptables_commit_load_rulesfile() { return ${ret} } -function iptables_dump() { +iptables_dump() { local protocol="${1}" assert isset protocol @@ -391,7 +391,7 @@ function iptables_dump() { done < "${rulesfile}" } -function iptables_LOG() { +iptables_LOG() { local prefix="${1}" local ret @@ -425,7 +425,7 @@ function iptables_LOG() { print "${ret}" } -function iptables_protocol() { +iptables_protocol() { local PROTO PROTO=$1 for proto in tcp udp esp ah; do @@ -440,15 +440,15 @@ IPTABLES_PORT=0 IPTABLES_MULTIPORT=1 IPTABLES_PORTRANGE=2 -function _iptables_port_range() { +_iptables_port_range() { grep -q ":" <<< $@ } -function _iptables_port_multiport() { +_iptables_port_multiport() { grep -q "," <<< $@ } -function _iptables_port() { +_iptables_port() { if _iptables_port_range "$@"; then echo $IPTABLES_PORTRANGE elif _iptables_port_multiport "$@"; then @@ -458,7 +458,7 @@ function _iptables_port() { fi } -function iptables_source_port() { +iptables_source_port() { [ -z "$@" ] && return local type type=$(_iptables_port $@) @@ -469,7 +469,7 @@ function iptables_source_port() { fi } -function iptables_destination_port() { +iptables_destination_port() { [ -z "$@" ] && return local type type=$(_iptables_port $@) diff --git a/src/functions/functions.ipv4 b/src/functions/functions.ipv4 index be836a28..d22b25f6 100644 --- a/src/functions/functions.ipv4 +++ b/src/functions/functions.ipv4 @@ -21,7 +21,7 @@ IP_SUPPORTED_PROTOCOLS="${IP_SUPPORTED_PROTOCOLS} ipv4" -function ipv4_is_valid() { +ipv4_is_valid() { ipcalc --ipv4 -c $@ >/dev/null 2>&1 case "$?" in @@ -34,7 +34,7 @@ function ipv4_is_valid() { esac } -function ipv4_prefix_is_valid() { +ipv4_prefix_is_valid() { local prefix=${1} isset prefix || return ${EXIT_FALSE} @@ -45,7 +45,7 @@ function ipv4_prefix_is_valid() { return ${EXIT_TRUE} } -function ipv4_netmask_is_valid() { +ipv4_netmask_is_valid() { local netmask="${1}" # XXX this check could be much better by checking @@ -54,7 +54,7 @@ function ipv4_netmask_is_valid() { ipv4_is_valid "${netmask}" } -function ipv4_detect_duplicate() { +ipv4_detect_duplicate() { local device=${1} local address=${2} @@ -73,7 +73,7 @@ function ipv4_detect_duplicate() { return ${EXIT_ERROR} } -function ipv4_update_neighbours() { +ipv4_update_neighbours() { local device=${1} local address=${2} @@ -84,7 +84,7 @@ function ipv4_update_neighbours() { ( sleep 2; arping -q -U -c 1 -I ${device} ${address} ) >/dev/null 2>&1 /dev/null 2>&1 case "$?" in @@ -95,7 +95,7 @@ function ipv6_is_valid() { esac } -function ipv6_prefix_is_valid() { +ipv6_prefix_is_valid() { local prefix=${1} assert isset prefix @@ -105,15 +105,15 @@ function ipv6_prefix_is_valid() { return ${EXIT_TRUE} } -function ipv6_get_prefix() { +ipv6_get_prefix() { ip_get_prefix "$@" } -function ipv6_split_prefix() { +ipv6_split_prefix() { ip_split_prefix "$@" } -function ipv6_address_add() { +ipv6_address_add() { local address="${1}" assert isset address @@ -191,14 +191,14 @@ function ipv6_address_add() { return ${EXIT_OK} } -function ipv6_address_del() { +ipv6_address_del() { local address="${1}" local device="${2}" ip_address_del "${device}" "${address}" } -function ipv6_address_flush() { +ipv6_address_flush() { local device="${1}" assert isset device @@ -208,7 +208,7 @@ function ipv6_address_flush() { cmd_quiet ip -6 addr flush dev "${device}" scope global permanent } -function ipv6_address_change_lifetime() { +ipv6_address_change_lifetime() { local address="${1}" assert isset address @@ -258,7 +258,7 @@ function ipv6_address_change_lifetime() { return ${EXIT_OK} } -function ipv6_get_dad_status() { +ipv6_get_dad_status() { local address="${1}" assert isset address @@ -287,7 +287,7 @@ function ipv6_get_dad_status() { return ${EXIT_DAD_OK} } -function ipv6_wait_for_dad() { +ipv6_wait_for_dad() { local address="${1}" assert isset address @@ -320,7 +320,7 @@ function ipv6_wait_for_dad() { return ${EXIT_ERROR} } -function ipv6_device_get_addresses() { +ipv6_device_get_addresses() { local device="${1}" assert isset device shift @@ -359,7 +359,7 @@ function ipv6_device_get_addresses() { list_sort ${addresses} } -function ipv6_implode() { +ipv6_implode() { local address=${1} assert isset address @@ -370,7 +370,7 @@ function ipv6_implode() { print "${ADDRESS6_IMPL}" } -function ipv6_explode() { +ipv6_explode() { local address=${1} assert isset address @@ -387,7 +387,7 @@ function ipv6_explode() { print "${ADDRESS6_EXPL}" } -function ipv6_addr_eq() { +ipv6_addr_eq() { local addr1=${1} assert isset addr1 @@ -403,7 +403,7 @@ function ipv6_addr_eq() { && return ${EXIT_TRUE} || return ${EXIT_FALSE} } -function ipv6_addr_gt() { +ipv6_addr_gt() { local addr1=${1} assert isset addr1 @@ -426,7 +426,7 @@ function ipv6_addr_gt() { return ${EXIT_FALSE} } -function ipv6_hash() { +ipv6_hash() { local address=${1} assert isset address @@ -437,7 +437,7 @@ function ipv6_hash() { echo "${address//:/}" } -function ipv6_get_network() { +ipv6_get_network() { local addr=${1} assert isset addr @@ -452,7 +452,7 @@ function ipv6_get_network() { print "${PREFIX6}/${prefix}" } -function ipv6_6rd_format_address() { +ipv6_6rd_format_address() { local isp_prefix="${1}" assert ipv6_is_valid "${isp_prefix}" @@ -518,7 +518,7 @@ function ipv6_6rd_format_address() { print "${formatted_address}/${prefix}" } -function ipv6_6rd_format_client_address() { +ipv6_6rd_format_client_address() { local address="${1}" assert isset address diff --git a/src/functions/functions.list b/src/functions/functions.list index 5515edb7..70691685 100644 --- a/src/functions/functions.list +++ b/src/functions/functions.list @@ -22,7 +22,7 @@ # Functions for nice handling of lists. # -function list_append() { +list_append() { local list=${1} assert isset list shift @@ -33,7 +33,7 @@ function list_append() { done } -function list_append_one() { +list_append_one() { assert [ $# -eq 2 ] local list="${1}" @@ -48,7 +48,7 @@ function list_append_one() { fi } -function list_remove() { +list_remove() { local list=${1} shift @@ -64,7 +64,7 @@ function list_remove() { eval "${list}=\"${_list}\"" } -function list_sort() { +list_sort() { local i for i in $@; do print "${i}" @@ -72,7 +72,7 @@ function list_sort() { print } -function list_unique() { +list_unique() { local items item for item in $@; do # Check if the item has already been processed. @@ -83,7 +83,7 @@ function list_unique() { done } -function list_match() { +list_match() { local match=${1} shift @@ -95,7 +95,7 @@ function list_match() { return ${EXIT_ERROR} } -function list_length() { +list_length() { local length=0 local i @@ -107,7 +107,7 @@ function list_length() { } # Count how often $1 occurs in the list. -function list_count() { +list_count() { local what=${1} shift @@ -123,7 +123,7 @@ function list_count() { print "${counter}" } -function list_join() { +list_join() { local list=${1} local delim=${2} @@ -133,7 +133,7 @@ function list_join() { print "${ret:${#delim}}" } -function list_reverse() { +list_reverse() { local reversed arg for arg in $@; do reversed="${arg} ${reversed}" @@ -143,7 +143,7 @@ function list_reverse() { return ${EXIT_OK} } -function list_head() { +list_head() { local arg for arg in $@; do print "${arg}" diff --git a/src/functions/functions.lock b/src/functions/functions.lock index 72414054..136a223c 100644 --- a/src/functions/functions.lock +++ b/src/functions/functions.lock @@ -19,7 +19,7 @@ # # ############################################################################### -function lock_acquire() { +lock_acquire() { local lockfile="${1}" assert isset lockfile @@ -48,7 +48,7 @@ function lock_acquire() { chmod 600 ${lockfile} } -function lock_release() { +lock_release() { local lockfile="${1}" log DEBUG "Releasing lock '${lockfile}'." diff --git a/src/functions/functions.logging b/src/functions/functions.logging index eefa3c41..07698160 100644 --- a/src/functions/functions.logging +++ b/src/functions/functions.logging @@ -29,7 +29,7 @@ if [ -z "${LOG_DISABLE_STDOUT}" ]; then LOG_DISABLE_STDOUT=false fi -function log() { +log() { local level=${1} shift local message="$@" diff --git a/src/functions/functions.macros b/src/functions/functions.macros index 785e5719..bfa3d1a3 100644 --- a/src/functions/functions.macros +++ b/src/functions/functions.macros @@ -19,7 +19,7 @@ # # ############################################################################### -function macro_file() { +macro_file() { local macro=${1} assert isset macro @@ -40,7 +40,7 @@ function macro_file() { return ${EXIT_ERROR} } -function macro_exists() { +macro_exists() { local macro=${1} assert isset macro @@ -48,7 +48,7 @@ function macro_exists() { && return ${EXIT_TRUE} || return ${EXIT_FALSE} } -function macro_read() { +macro_read() { local macro=${1} assert isset macro diff --git a/src/functions/functions.modem b/src/functions/functions.modem index 8d96b1ab..d85fdd39 100644 --- a/src/functions/functions.modem +++ b/src/functions/functions.modem @@ -25,7 +25,7 @@ CHAT_INVALID=1 CHAT_ERROR=2 CHAT_TIMEOUT=3 -function modem_chat() { +modem_chat() { local answer="OK" local device local timeout=2 @@ -91,7 +91,7 @@ function modem_chat() { return ${EXIT_ERROR} } -function __modem_chat_process_output() { +__modem_chat_process_output() { local answer=${1} local quiet=${2} @@ -125,7 +125,7 @@ function __modem_chat_process_output() { done } -function modem_initialize() { +modem_initialize() { local device="${1}" assert isset device shift @@ -164,7 +164,7 @@ EXIT_SIM_PIN=1 EXIT_SIM_PUK=2 EXIT_SIM_UNKNOWN=3 -function modem_sim_status() { +modem_sim_status() { local device=${1} assert isset device @@ -194,7 +194,7 @@ function modem_sim_status() { return ${EXIT_SIM_UNKNOWN} } -function modem_sim_unlocked() { +modem_sim_unlocked() { local device=${1} assert isset device @@ -204,11 +204,11 @@ function modem_sim_unlocked() { [ ${ret} -eq ${EXIT_SIM_READY} ] && return ${EXIT_TRUE} || return ${EXIT_FALSE} } -function modem_sim_locked() { +modem_sim_locked() { modem_sim_unlocked $@ && return ${EXIT_FALSE} || return ${EXIT_TRUE} } -function modem_sim_unlock() { +modem_sim_unlock() { local device=${1} assert isset device @@ -238,7 +238,7 @@ function modem_sim_unlock() { return ${ret} } -function modem_sim_auto_unlock() { +modem_sim_auto_unlock() { local device="${1}" assert isset device @@ -274,7 +274,7 @@ function modem_sim_auto_unlock() { # Returns the vendor of the modem. # For example: "huawei" -function modem_get_manufacturer() { +modem_get_manufacturer() { local device=${1} assert isset device @@ -288,7 +288,7 @@ function modem_get_manufacturer() { print "${output}" } -function modem_get_model() { +modem_get_model() { local device=${1} assert isset device @@ -302,7 +302,7 @@ function modem_get_model() { print "${output}" } -function modem_get_software_version() { +modem_get_software_version() { local device=${1} assert isset device @@ -316,7 +316,7 @@ function modem_get_software_version() { print "${output}" } -function modem_get_sim_imsi() { +modem_get_sim_imsi() { local device=${1} assert isset device @@ -326,7 +326,7 @@ function modem_get_sim_imsi() { modem_chat ${device} "AT+CIMI" } -function modem_get_device_imei() { +modem_get_device_imei() { local device=${1} assert isset device @@ -341,7 +341,7 @@ function modem_get_device_imei() { return ${ret} } -function modem_is_mobile() { +modem_is_mobile() { local device=${1} assert isset device @@ -360,7 +360,7 @@ EXIT_REG_REGISTRATION_DENIED=3 EXIT_REG_REGISTERED_ROAMING=4 EXIT_REG_UNKNOWN=5 -function modem_get_network_registration() { +modem_get_network_registration() { local device=${1} assert isset device @@ -413,7 +413,7 @@ function modem_get_network_registration() { modem_get_network_registration ${device} } -function modem_set_network_registration() { +modem_set_network_registration() { local device=${1} assert isset device @@ -426,7 +426,7 @@ function modem_set_network_registration() { modem_chat ${device} "AT+CREG=${mode}" } -function modem_scan_networks() { +modem_scan_networks() { local device=${1} assert isset device @@ -442,7 +442,7 @@ function modem_scan_networks() { # XXX the output is not very nice to parse. } -function __modem_get_network_operator() { +__modem_get_network_operator() { local device=${1} assert isset device @@ -486,7 +486,7 @@ function __modem_get_network_operator() { return ${EXIT_OK} } -function modem_get_network_operator() { +modem_get_network_operator() { local device=${1} assert isset device @@ -503,7 +503,7 @@ EXIT_OPMODE_UMTS_WITH_HSUPA=5 EXIT_OPMODE_UMTS_WITH_HSDPA_AND_HSUPA=6 EXIT_OPMODE_UNKNOWN=7 -function modem_get_network_mode() { +modem_get_network_mode() { local device=${1} assert isset device @@ -543,7 +543,7 @@ function modem_get_network_mode() { esac } -function __modem_get_signal_quality() { +__modem_get_signal_quality() { local device=${1} assert isset device @@ -575,7 +575,7 @@ function __modem_get_signal_quality() { return ${EXIT_ERROR} } -function modem_get_signal_quality() { +modem_get_signal_quality() { local device=${1} assert isset device @@ -595,7 +595,7 @@ function modem_get_signal_quality() { return ${EXIT_OK} } -function modem_get_bit_error_rate() { +modem_get_bit_error_rate() { local device=${1} assert isset device @@ -615,7 +615,7 @@ function modem_get_bit_error_rate() { # USDD stuff -function modem_ussd_send_command() { +modem_ussd_send_command() { local device="${1}" assert isset device @@ -658,7 +658,7 @@ function modem_ussd_send_command() { return ${ret} } -function __modem_ussd_parse_output() { +__modem_ussd_parse_output() { local line while read -r line; do # Find the expected answer. @@ -717,7 +717,7 @@ function __modem_ussd_parse_output() { return ${EXIT_ERROR} } -function modem_ussd_encode() { +modem_ussd_encode() { local string="${1}" assert isset string @@ -744,7 +744,7 @@ function modem_ussd_encode() { print "${output}" } -function modem_ussd_decode() { +modem_ussd_decode() { local string="${1}" assert isset string diff --git a/src/functions/functions.phy b/src/functions/functions.phy index 90288f76..f79cb95f 100644 --- a/src/functions/functions.phy +++ b/src/functions/functions.phy @@ -21,20 +21,20 @@ PHY_DIR="/sys/class/ieee80211" -function phy_dir() { +phy_dir() { local phy=${1} echo "${PHY_DIR}/${phy}" } -function phy_exists() { +phy_exists() { local phy=${1} assert isset phy [ -d "$(phy_dir ${phy})" ] } -function phy_list() { +phy_list() { local phy for phy in $(phy_dir)/*; do @@ -44,7 +44,7 @@ function phy_list() { done } -function phy_get() { +phy_get() { local info="${1}" local phy @@ -81,7 +81,7 @@ function phy_get() { return ${EXIT_OK} } -function phy_get_address() { +phy_get_address() { local phy=${1} assert isset phy @@ -91,7 +91,7 @@ function phy_get_address() { print "$(<${path})" } -function phy_get_devices() { +phy_get_devices() { local phy="${1}" assert isset phy diff --git a/src/functions/functions.ports b/src/functions/functions.ports index e3ea1f61..39c7fb66 100644 --- a/src/functions/functions.ports +++ b/src/functions/functions.ports @@ -19,11 +19,11 @@ # # ############################################################################### -function port_dir() { +port_dir() { echo "${NETWORK_CONFIG_DIR}/ports" } -function port_list() { +port_list() { local port for port in $(port_dir)/*; do port="$(basename "${port}")" @@ -33,7 +33,7 @@ function port_list() { done } -function port_list_in_use() { +port_list_in_use() { local ports_in_use # Collect all ports that are attached to a zone @@ -51,7 +51,7 @@ function port_list_in_use() { list_sort ${ports_in_use} } -function port_list_free() { +port_list_free() { local ports_in_use="$(port_list_in_use)" local port @@ -64,21 +64,21 @@ function port_list_free() { return ${EXIT_OK} } -function port_get_hook() { +port_get_hook() { local port=${1} assert isset port config_get_hook $(port_file ${port}) } -function port_config_dir() { +port_config_dir() { local port=${1} print "${RUN_DIR}/ports/${port}" return ${EXIT_OK} } -function port_settings_read() { +port_settings_read() { local port="${1}" assert isset port @@ -91,7 +91,7 @@ function port_settings_read() { HOOK="${hook}" } -function port_settings_write() { +port_settings_write() { local port="${1}" assert isset port shift @@ -105,24 +105,24 @@ function port_settings_write() { settings_write "$(port_file "${port}")" ${args} } -function ports_get_all() { +ports_get_all() { port_list } -function port_file() { +port_file() { local port="${1}" assert isset port echo "$(port_dir)/${port}" } -function port_exists() { +port_exists() { local port=${1} [ -f "${NETWORK_CONFIG_DIR}/ports/${port}" ] } -function port_get_hook() { +port_get_hook() { local port=${1} assert isset port @@ -130,7 +130,7 @@ function port_get_hook() { config_get_hook $(port_file ${port}) } -function port_is_attached() { +port_is_attached() { local port=${1} shift @@ -151,11 +151,11 @@ function port_is_attached() { return ${EXIT_ERROR} } -function port_is_up() { +port_is_up() { device_is_up $@ } -function port_new() { +port_new() { #local port=${1} #shift # @@ -181,7 +181,7 @@ function port_new() { hook_exec port ${hook} new $@ } -function port_destroy() { +port_destroy() { local port=${1} assert isset port @@ -224,11 +224,11 @@ function port_destroy() { rm -f $(port_file ${port}) } -function port_create() { +port_create() { port_cmd "create" $@ } -function port_remove() { +port_remove() { local port="${1}" assert isset port @@ -240,27 +240,27 @@ function port_remove() { port_cmd "remove" "${port}" } -function port_edit() { +port_edit() { port_cmd edit $@ } -function port_up() { +port_up() { port_cmd up $@ } -function port_down() { +port_down() { port_cmd down $@ } -function port_status() { +port_status() { port_cmd status $@ } -function port_info() { +port_info() { port_cmd info $@ } -function port_cmd() { +port_cmd() { local cmd=${1} local port=${2} shift 2 @@ -275,7 +275,7 @@ function port_cmd() { hook_exec port ${hook} ${cmd} ${port} $@ } -function ports_get() { +ports_get() { local port for port in $(port_dir)/*; do port=$(basename ${port}) @@ -285,7 +285,7 @@ function ports_get() { done } -function port_find_free() { +port_find_free() { local pattern=${1} assert isset pattern @@ -305,7 +305,7 @@ function port_find_free() { return ${EXIT_ERROR} } -function port_get_info() { +port_get_info() { local port=${1} local key=${2} @@ -319,19 +319,19 @@ function port_get_info() { ) } -function port_get_parents() { +port_get_parents() { local port=${1} port_get_info ${port} PORT_PARENTS } -function port_get_children() { +port_get_children() { local port=${1} port_get_info ${port} PORT_CHILDREN } -function port_zone() { +port_zone() { # Get name of the zones, this port is configured in. local port=${1} shift @@ -349,7 +349,7 @@ function port_zone() { return ${EXIT_OK} } -function port_hotplug_event() { +port_hotplug_event() { local port="${1}" assert isset port @@ -358,7 +358,7 @@ function port_hotplug_event() { port_cmd "hotplug" "${port}" } -function port_get_slaves() { +port_get_slaves() { local port="${1}" port_settings_read "${port}" \ @@ -366,7 +366,7 @@ function port_get_slaves() { print "${SLAVES}" } -function port_device_is_slave() { +port_device_is_slave() { assert [ $# -eq 2 ] local port="${1}" @@ -379,7 +379,7 @@ function port_device_is_slave() { list_match "${device}" ${slaves} } -function port_get_phy() { +port_get_phy() { local port="${1}" port_settings_read "${port}" \ @@ -387,7 +387,7 @@ function port_get_phy() { print "${PHY}" } -function port_uses_phy() { +port_uses_phy() { assert [ $# -eq 2 ] local port="${1}" @@ -404,7 +404,7 @@ function port_uses_phy() { [ "${port_phy}" = "${phy}" ] } -function ports_lowest_address() { +ports_lowest_address() { local address local addresses diff --git a/src/functions/functions.ppp b/src/functions/functions.ppp index 58463d6f..92ff3536 100644 --- a/src/functions/functions.ppp +++ b/src/functions/functions.ppp @@ -26,7 +26,7 @@ EXIT_PPPD_ERROR_FATAL=$(( ${EXIT_ERROR} + 1 )) # This function monitors the pppd activity. -function pppd_angel() { +pppd_angel() { local device="${1}" assert isset device @@ -86,7 +86,7 @@ function pppd_angel() { done } -function pppd_exec() { +pppd_exec() { local device="${1}" assert isset device @@ -229,7 +229,7 @@ function pppd_exec() { esac } -function pppd_start() { +pppd_start() { local device="${1}" assert isset device @@ -238,21 +238,21 @@ function pppd_start() { service_start "pppd@${device}.service" } -function pppd_stop() { +pppd_stop() { local device="${1}" assert isset device service_stop "pppd@${device}.service" } -function pppd_status() { +pppd_status() { local device="${1}" assert isset device service_status "pppd@${device}.service" } -function ppp_common_ip_pre_up() { +ppp_common_ip_pre_up() { local zone=${1} shift @@ -266,7 +266,7 @@ function ppp_common_ip_pre_up() { return ${EXIT_OK} } -function ppp_common_ipv4_up() { +ppp_common_ipv4_up() { local zone=${1} shift @@ -282,7 +282,7 @@ function ppp_common_ipv4_up() { return ${EXIT_OK} } -function ppp_common_ipv4_down() { +ppp_common_ipv4_down() { local zone=${1} shift @@ -303,7 +303,7 @@ function ppp_common_ipv4_down() { return ${EXIT_OK} } -function ppp_common_ipv6_up() { +ppp_common_ipv6_up() { local zone=${1} shift @@ -322,7 +322,7 @@ function ppp_common_ipv6_up() { return ${EXIT_OK} } -function ppp_common_ipv6_down() { +ppp_common_ipv6_down() { local zone=${1} shift @@ -343,7 +343,7 @@ function ppp_common_ipv6_down() { return ${EXIT_OK} } -function ppp_secret() { +ppp_secret() { local USER=${1} local SECRET=${2} local a @@ -362,7 +362,7 @@ function ppp_secret() { rm -f ${PPP_SECRETS}.tmp } -function ppp_accounting() { +ppp_accounting() { local zone=${1} shift @@ -370,7 +370,7 @@ function ppp_accounting() { --rcvd="${BYTES_RCVD}" --sent="${BYTES_SENT}" } -function pppd_write_config() { +pppd_write_config() { local file=${1}; shift assert isset file diff --git a/src/functions/functions.pppoe-server b/src/functions/functions.pppoe-server index 37c3fdb0..fe0fc5c4 100644 --- a/src/functions/functions.pppoe-server +++ b/src/functions/functions.pppoe-server @@ -19,28 +19,28 @@ # # ############################################################################### -function pppoe_server_start() { +pppoe_server_start() { local zone=${1} assert isset zone service_start "pppoe-server@${zone}.service" } -function pppoe_server_stop() { +pppoe_server_stop() { local zone=${1} assert isset zone service_stop "pppoe-server@${zone}.service" } -function pppoe_server_status() { +pppoe_server_status() { local zone=${1} assert isset zone service_status "pppoe-server@${zone}.service" } -function pppoe_server_options() { +pppoe_server_options() { local file=${1} assert isset file @@ -161,7 +161,7 @@ function pppoe_server_options() { return ${EXIT_OK} } -function pppoe_server_poolfile() { +pppoe_server_poolfile() { local file=${1} assert isset file diff --git a/src/functions/functions.radvd b/src/functions/functions.radvd index 7970a54b..21fd1e47 100644 --- a/src/functions/functions.radvd +++ b/src/functions/functions.radvd @@ -21,7 +21,7 @@ RADVD_CONFIGFILE="/etc/radvd.conf" -function radvd_update() { +radvd_update() { # (Re-)write the configuration file radvd_write_config @@ -29,7 +29,7 @@ function radvd_update() { service_reload radvd } -function radvd_write_config() { +radvd_write_config() { config_header "radv daemon configuration file" > ${RADVD_CONFIGFILE} # Write the configuration for all zones. @@ -42,7 +42,7 @@ function radvd_write_config() { return ${EXIT_OK} } -function __radvd_config_interface() { +__radvd_config_interface() { local zone=${1} assert isset zone @@ -104,7 +104,7 @@ function __radvd_config_interface() { print } -function __radvd_config_dns() { +__radvd_config_dns() { local zone=${1} # Do nothing, when this option is not enabled. diff --git a/src/functions/functions.route b/src/functions/functions.route index d72a1071..1870f964 100644 --- a/src/functions/functions.route +++ b/src/functions/functions.route @@ -22,14 +22,14 @@ # Functions for static routing. # -function route_init() { +route_init() { # Apply configured static routes. route_apply } init_register route_init -function route_add() { +route_add() { local ${NETWORK_CONFIG_ROUTES_PARAMS} while [ $# -gt 0 ]; do @@ -141,7 +141,7 @@ function route_add() { return ${EXIT_OK} } -function route_remove() { +route_remove() { local _network=${1} assert isset _network @@ -173,7 +173,7 @@ function route_remove() { return ${EXIT_OK} } -function route_list() { +route_list() { local protocol while [ $# -gt 0 ]; do @@ -225,7 +225,7 @@ function route_list() { done < ${NETWORK_CONFIG_ROUTES} } -function route_find_duplicate() { +route_find_duplicate() { local _network=${1} [ -r "${NETWORK_CONFIG_ROUTES}" ] || return ${EXIT_FALSE} @@ -243,7 +243,7 @@ function route_find_duplicate() { return ${EXIT_FALSE} } -function route_parse_line() { +route_parse_line() { local arg # Reset all possible settings. @@ -303,7 +303,7 @@ function route_parse_line() { return ${EXIT_OK} } -function route_apply() { +route_apply() { local table="static" local type @@ -341,7 +341,7 @@ function route_apply() { route_rule_add --lookup="static" --priority=1000 } -function route_entry_add() { +route_entry_add() { local gateway local network local proto @@ -432,7 +432,7 @@ function route_entry_add() { cmd_quiet "${command}" } -function route_table_create() { +route_table_create() { local table=${1} assert isset table @@ -452,7 +452,7 @@ function route_table_create() { return ${EXIT_OK} } -function _route_table_next_id() { +_route_table_next_id() { # The Linux kernel is able to manage 255 routing tables (1-255). # This function returns the next free id, starting from 255. local next_id @@ -467,7 +467,7 @@ function _route_table_next_id() { return ${EXIT_FALSE} } -function route_table_flush() { +route_table_flush() { local protocol local table @@ -515,7 +515,7 @@ function route_table_flush() { return ${EXIT_OK} } -function route_table_exists() { +route_table_exists() { local _id _table while [ $# -gt 0 ]; do @@ -545,7 +545,7 @@ function route_table_exists() { return ${EXIT_FALSE} } -function route_rule_add() { +route_rule_add() { local priority local protocols=${IP_SUPPORTED_PROTOCOLS} local lookup @@ -608,7 +608,7 @@ function route_rule_add() { done } -function route_rule_exists() { +route_rule_exists() { local from local lookup local proto @@ -669,7 +669,7 @@ function route_rule_exists() { return ${EXIT_FALSE} } -function _route_rule_exists_parse() { +_route_rule_exists_parse() { # Reset all variables. _lookup= _from= diff --git a/src/functions/functions.routing b/src/functions/functions.routing index d60b7f76..d65506aa 100644 --- a/src/functions/functions.routing +++ b/src/functions/functions.routing @@ -19,11 +19,11 @@ # # ############################################################################### -function routing_has_default() { +routing_has_default() { ip route | grep -q "^default" } -function routing_default_update() { +routing_default_update() { local routes local zones=$(zones_get_nonlocal) @@ -105,16 +105,16 @@ function routing_default_update() { } # XXX deprecated function -function routing_table_exists() { +routing_table_exists() { route_table_exists $@ } # XXX deprecated function -function routing_table_create() { +routing_table_create() { route_table_create $@ } -function routing_db_path() { +routing_db_path() { local zone=${1} local proto=${2} @@ -125,21 +125,21 @@ function routing_db_path() { echo "${ROUTING_DB_DIR}/${zone}/${proto}" } -function routing_db_exists() { +routing_db_exists() { [ -d "$(routing_db_path $@)" ] } -function routing_db_create() { +routing_db_create() { routing_db_exists $@ && return ${EXIT_OK} mkdir -p $(routing_db_path $@) } -function routing_db_remove() { +routing_db_remove() { rm -rf $(routing_db_path $@) } -function routing_db_set() { +routing_db_set() { local zone=${1} local proto=${2} local parameter=${3} @@ -154,7 +154,7 @@ function routing_db_set() { echo "${value}" > $(routing_db_path ${zone} ${proto})/${parameter} } -function routing_db_get() { +routing_db_get() { local zone=${1} local proto=${2} local parameter=${3} @@ -163,7 +163,7 @@ function routing_db_get() { cat $(routing_db_path ${zone} ${proto})/${parameter} 2>/dev/null } -function routing_db_from_ppp() { +routing_db_from_ppp() { local zone=${1} local proto=${2} @@ -186,7 +186,7 @@ function routing_db_from_ppp() { routing_db_set ${zone} ${proto} remote-address ${PPP_MACREMOTE,,} } -function routing_update() { +routing_update() { local zone=${1} assert isset zone diff --git a/src/functions/functions.serial b/src/functions/functions.serial index 170305b3..db6e48c6 100644 --- a/src/functions/functions.serial +++ b/src/functions/functions.serial @@ -22,7 +22,7 @@ # This is a list of baudrates that are supported. SERIAL_BAUDRATES="921600 460800 230400 115200 57600 38400 19200 9600" -function serial_list() { +serial_list() { local device for device in /dev/ttyUSB*; do if serial_exists "${device}"; then @@ -31,13 +31,13 @@ function serial_list() { done } -function serial_exists() { +serial_exists() { local device=${1} [ -c "${device}" ] } -function serial_is_locked() { +serial_is_locked() { local device=${1} assert isset device @@ -52,12 +52,12 @@ function serial_is_locked() { return ${EXIT_FALSE} } -function serial_is_unlocked() { +serial_is_unlocked() { serial_is_locked ${device} \ && return ${EXIT_FALSE} || return ${EXIT_TRUE} } -function serial_is_modem() { +serial_is_modem() { local device=${1} assert isset device @@ -77,7 +77,7 @@ function serial_is_modem() { esac } -function serial_get_bus_type() { +serial_get_bus_type() { local device="${1}" assert isset device diff --git a/src/functions/functions.service b/src/functions/functions.service index 81c0fae4..7a12ffd5 100644 --- a/src/functions/functions.service +++ b/src/functions/functions.service @@ -19,7 +19,7 @@ # # ############################################################################### -function service_start() { +service_start() { local name=${1} assert isset name @@ -40,21 +40,21 @@ function service_start() { return ${ret} } -function service_stop() { +service_stop() { local name="${1}" assert isset name systemctl stop "${name}" } -function service_restart() { +service_restart() { local name="${1}" assert isset name systemctl restart "${name}" } -function service_reload() { +service_reload() { local name="${1}" assert isset name @@ -66,7 +66,7 @@ function service_reload() { fi } -function service_status() { +service_status() { local name="${1}" assert isset name @@ -77,7 +77,7 @@ function service_status() { # This function calls the "enable" command from systemd, # to mark services to be automatically started during # boot up. -function service_enable() { +service_enable() { local name="${1}" assert isset name @@ -87,7 +87,7 @@ function service_enable() { # This function calls the "disable" command of systemd, # to drop the autostart ability of the service during the # boot up. -function service_disable() { +service_disable() { local name="${1}" assert isset name @@ -96,7 +96,7 @@ function service_disable() { # This function uses the systemd command "is-enabled" to check, # if a service has been enabled or not. -function service_is_enabled() { +service_is_enabled() { local name="${1}" assert isset name @@ -104,7 +104,7 @@ function service_is_enabled() { return $? } -function service_is_active() { +service_is_active() { local name="${1}" assert isset name @@ -112,7 +112,7 @@ function service_is_active() { return $? } -function service_get_exitcode() { +service_get_exitcode() { local name=${1} assert isset name diff --git a/src/functions/functions.settings b/src/functions/functions.settings index 9e78858f..a50042cc 100644 --- a/src/functions/functions.settings +++ b/src/functions/functions.settings @@ -19,7 +19,7 @@ # # ############################################################################### -function settings_read() { +settings_read() { local file="${1}" assert isset file shift @@ -77,7 +77,7 @@ function settings_read() { done < ${file} } -function settings_read_array() { +settings_read_array() { local file=${1} assert isset file shift @@ -119,7 +119,7 @@ function settings_read_array() { } # Strip leading and trailing "s. -function settings_strip() { +settings_strip() { local var="$@" # Do nothing for strings that contain spaces. @@ -131,7 +131,7 @@ function settings_strip() { unquote "${var}" } -function settings_write() { +settings_write() { local settings_file="${1}" assert isset settings_file shift @@ -170,7 +170,7 @@ function settings_write() { done } -function settings_remove() { +settings_remove() { local settings_file="${1}" local abspath="$(readlink -e "${settings_file}")" @@ -182,7 +182,7 @@ function settings_remove() { rm -f "${settings_file}" } -function settings_print() { +settings_print() { local param for param in $(listsort $@); do @@ -190,7 +190,7 @@ function settings_print() { done } -function settings_check() { +settings_check() { local check_func="${1}" # Execute the check function @@ -221,7 +221,7 @@ function settings_check() { return ${EXIT_ERROR} } -function settings_set() { +settings_set() { while [ $# -gt 0 ]; do case "${1}" in *=*) @@ -240,7 +240,7 @@ function settings_set() { done } -function network_settings_read() { +network_settings_read() { local options="${NETWORK_SETTINGS_FILE_PARAMS}" # If the DEBUG variable has already been set, @@ -252,29 +252,29 @@ function network_settings_read() { settings_read "${NETWORK_SETTINGS_FILE}" ${options} } -function network_settings_write() { +network_settings_write() { settings_write "${NETWORK_SETTINGS_FILE}" ${NETWORK_SETTINGS_FILE_PARAMS} # Update DNS configuration. dns_generate_resolvconf } -function network_settings_print() { +network_settings_print() { settings_print ${NETWORK_SETTINGS_FILE_PARAMS} } -function network_settings_list() { +network_settings_list() { print "${NETWORK_SETTINGS_FILE_PARAMS}" } -function firewall_settings_read() { +firewall_settings_read() { settings_read "${FIREWALL_SETTINGS_FILE}" "${FIREWALL_SETTINGS_PARAMS}" } -function firewall_settings_write() { +firewall_settings_write() { settings_write "${FIREWALL_SETTINGS_FILE}" "${FIREWALL_SETTINGS_PARAMS}" } -function firewall_settings_print() { +firewall_settings_print() { settings_print "${FIREWALL_SETTINGS_PARAMS}" } diff --git a/src/functions/functions.stp b/src/functions/functions.stp index 2dd6f8d0..0e6ae392 100644 --- a/src/functions/functions.stp +++ b/src/functions/functions.stp @@ -28,7 +28,7 @@ STP_DEFAULT_MODE="rstp" # Allowed modes of the spanning tree protocol. STP_ALLOWED_MODES="rstp stp" -function stp_enable() { +stp_enable() { local bridge=${1} assert isset bridge @@ -36,7 +36,7 @@ function stp_enable() { print 1 > ${SYS_CLASS_NET}/${bridge}/bridge/stp_state } -function stp_disable() { +stp_disable() { local bridge=${1} assert isset bridge @@ -44,7 +44,7 @@ function stp_disable() { print 0 > ${SYS_CLASS_NET}/${bridge}/bridge/stp_state } -function stp_is_enabled() { +stp_is_enabled() { local bridge=${1} assert isset bridge @@ -60,7 +60,7 @@ function stp_is_enabled() { esac } -function stp_is_userspace() { +stp_is_userspace() { local bridge=${1} assert isset bridge @@ -75,7 +75,7 @@ function stp_is_userspace() { esac } -function stp_get_name() { +stp_get_name() { local proto=${1} case "${proto}" in @@ -93,7 +93,7 @@ function stp_get_name() { return ${EXIT_OK} } -function stp_bridge_set_protocol() { +stp_bridge_set_protocol() { local bridge=${1} assert isset bridge @@ -111,7 +111,7 @@ function stp_bridge_set_protocol() { assert [ $? -eq 0 ] } -function stp_bridge_get_protocol() { +stp_bridge_get_protocol() { local bridge=${1} assert isset bridge @@ -146,7 +146,7 @@ function stp_bridge_get_protocol() { return ${EXIT_OK} } -function stp_bridge_get_id() { +stp_bridge_get_id() { local bridge=${1} assert isset bridge @@ -155,7 +155,7 @@ function stp_bridge_get_id() { return $? } -function stp_bridge_get_forward_delay() { +stp_bridge_get_forward_delay() { local bridge=${1} assert isset bridge @@ -169,7 +169,7 @@ function stp_bridge_get_forward_delay() { return ${EXIT_OK} } -function stp_bridge_set_forward_delay() { +stp_bridge_set_forward_delay() { local bridge=${1} assert isset bridge @@ -192,7 +192,7 @@ function stp_bridge_set_forward_delay() { return ${EXIT_OK} } -function stp_bridge_get_hello_time() { +stp_bridge_get_hello_time() { local bridge=${1} assert isset bridge @@ -202,7 +202,7 @@ function stp_bridge_get_hello_time() { return ${EXIT_OK} } -function stp_bridge_set_hello_time() { +stp_bridge_set_hello_time() { local bridge=${1} assert isset bridge @@ -220,7 +220,7 @@ function stp_bridge_set_hello_time() { return ${EXIT_OK} } -function stp_bridge_get_max_age() { +stp_bridge_get_max_age() { local bridge=${1} assert isset bridge @@ -230,7 +230,7 @@ function stp_bridge_get_max_age() { return ${EXIT_OK} } -function stp_bridge_set_max_age() { +stp_bridge_set_max_age() { local bridge=${1} assert isset bridge @@ -248,7 +248,7 @@ function stp_bridge_set_max_age() { return ${EXIT_OK} } -function stp_bridge_get_priority() { +stp_bridge_get_priority() { local bridge=${1} assert isset bridge @@ -256,7 +256,7 @@ function stp_bridge_get_priority() { return ${EXIT_OK} } -function stp_bridge_set_priority() { +stp_bridge_set_priority() { local bridge=${1} assert isset bridge @@ -274,7 +274,7 @@ function stp_bridge_set_priority() { return ${EXIT_OK} } -function stp_bridge_get_designated_root() { +stp_bridge_get_designated_root() { local bridge=${1} assert isset bridge @@ -297,7 +297,7 @@ function stp_bridge_get_designated_root() { fi } -function stp_bridge_get_root_path_cost() { +stp_bridge_get_root_path_cost() { local bridge=${1} assert isset bridge @@ -310,7 +310,7 @@ function stp_bridge_get_root_path_cost() { return ${EXIT_OK} } -function stp_bridge_get_root_port_id() { +stp_bridge_get_root_port_id() { local bridge=${1} assert isset bridge @@ -330,7 +330,7 @@ function stp_bridge_get_root_port_id() { return ${EXIT_OK} } -function stp_bridge_get_root_port() { +stp_bridge_get_root_port() { local bridge=${1} assert isset bridge @@ -349,7 +349,7 @@ function stp_bridge_get_root_port() { return ${EXIT_ERROR} } -function stp_bridge_is_root() { +stp_bridge_is_root() { local bridge=${1} assert isset bridge @@ -362,7 +362,7 @@ function stp_bridge_is_root() { return ${EXIT_FALSE} } -function stp_bridge_get_topology_change_count() { +stp_bridge_get_topology_change_count() { local bridge=${1} assert isset bridge @@ -375,7 +375,7 @@ function stp_bridge_get_topology_change_count() { return ${EXIT_OK} } -function stp_bridge_get_topology_change_timer() { +stp_bridge_get_topology_change_timer() { local bridge=${1} assert isset bridge @@ -388,7 +388,7 @@ function stp_bridge_get_topology_change_timer() { return ${EXIT_OK} } -function stp_bridge_get_topology_change_detected() { +stp_bridge_get_topology_change_detected() { local bridge=${1} assert isset bridge @@ -409,7 +409,7 @@ function stp_bridge_get_topology_change_detected() { fi } -function stp_port_get_state() { +stp_port_get_state() { local bridge=${1} assert isset bridge @@ -448,7 +448,7 @@ function stp_port_get_state() { return ${EXIT_OK} } -function stp_port_get_id() { +stp_port_get_id() { local bridge=${1} assert isset bridge @@ -459,7 +459,7 @@ function stp_port_get_id() { return ${EXIT_OK} } -function stp_port_get_cost() { +stp_port_get_cost() { local bridge=${1} assert isset bridge @@ -475,7 +475,7 @@ function stp_port_get_cost() { return ${EXIT_ERROR} } -function stp_port_set_cost() { +stp_port_set_cost() { assert [ $# -eq 3 ] local bridge="${1}" @@ -496,7 +496,7 @@ function stp_port_set_cost() { fi } -function stp_port_get_designated_root() { +stp_port_get_designated_root() { local bridge=${1} assert isset bridge @@ -521,7 +521,7 @@ function stp_port_get_designated_root() { return ${EXIT_ERROR} } -function __stp_div_100() { +__stp_div_100() { local val=${1} local split=$((${#val} - 2)) diff --git a/src/functions/functions.sysctl b/src/functions/functions.sysctl index 79b9ce9b..5d77b8e9 100644 --- a/src/functions/functions.sysctl +++ b/src/functions/functions.sysctl @@ -21,7 +21,7 @@ SYSCTL_PATH="/proc/sys" -function sysctl_key_to_path() { +sysctl_key_to_path() { local key="${1}" assert isset key @@ -30,7 +30,7 @@ function sysctl_key_to_path() { return ${EXIT_OK} } -function sysctl_key_exists() { +sysctl_key_exists() { local key="${1}" assert isset key @@ -40,7 +40,7 @@ function sysctl_key_exists() { return ${EXIT_ERROR} } -function sysctl_get() { +sysctl_get() { local key="${1}" assert isset key @@ -48,7 +48,7 @@ function sysctl_get() { return ${EXIT_OK} } -function sysctl_set() { +sysctl_set() { local key="${1}" assert isset key @@ -58,7 +58,7 @@ function sysctl_set() { return ${EXIT_OK} } -function sysctl_set_bool() { +sysctl_set_bool() { local key="${1}" local value="${2}" @@ -71,7 +71,7 @@ function sysctl_set_bool() { sysctl_set "${key}" "${value}" } -function sysctl_set_recursively() { +sysctl_set_recursively() { local basekey="${1}" assert isset basekey diff --git a/src/functions/functions.usb b/src/functions/functions.usb index 2c6cc00e..47268e5e 100644 --- a/src/functions/functions.usb +++ b/src/functions/functions.usb @@ -19,7 +19,7 @@ # # ############################################################################### -function usb_device_find_by_tty() { +usb_device_find_by_tty() { local tty="${1}" assert isset tty @@ -35,7 +35,7 @@ function usb_device_find_by_tty() { return ${EXIT_OK} } -function usb_device_list_interfaces() { +usb_device_list_interfaces() { local path="${1}" assert [ -d "${path}" ] @@ -48,14 +48,14 @@ function usb_device_list_interfaces() { return ${EXIT_OK} } -function usb_device_get_interface_type() { +usb_device_get_interface_type() { local interface="${1}" assert isset interface fread "${interface}/type" } -function usb_device_has_interface_type_interrupt() { +usb_device_has_interface_type_interrupt() { local device="${1}" assert isset device diff --git a/src/functions/functions.util b/src/functions/functions.util index 18a8f184..aff803a9 100644 --- a/src/functions/functions.util +++ b/src/functions/functions.util @@ -20,7 +20,7 @@ ############################################################################### # A simple print statement -function print() { +print() { local fmt=${1}; shift printf -- "${fmt}\n" "$@" @@ -29,11 +29,11 @@ function print() { # The args() function takes a number of arguments like # var1="abc d" var2="abc" var3="abcd e" # and splits them into several arguments, devided by newline -function args() { +args() { echo "$@" | xargs printf "%s\n" } -function unquote() { +unquote() { local var="$@" if [ "${var:0:1}" = "\"" ]; then @@ -48,11 +48,11 @@ function unquote() { print "${var}" } -function quote() { +quote() { print "\"%s\"" "$@" } -function strip() { +strip() { local value="$@" # remove leading whitespace characters @@ -65,43 +65,43 @@ function strip() { } # Print a pretty error message -function error() { +error() { echo -e " ${CLR_RED_B}ERROR${CLR_RESET} : $@" >&2 } -function error_log() { +error_log() { log ERROR "$@" } # Print a pretty warn message -function warning() { +warning() { echo -e " ${CLR_YELLOW_B}WARNING${CLR_RESET}: $@" >&2 } -function warning_log() { +warning_log() { log WARNING "$@" } # The next three functions are kept for backwards # compatibility. The need to be dropped at some time. -function listsort() { +listsort() { list_sort $@ } -function listmatch() { +listmatch() { list_match $@ } -function listlength() { +listlength() { list_length $@ } # Speedup function to avoid a call of the basename binary -function basename() { +basename() { echo "${1##*/}" } -function format() { +format() { local key=${1} assert isset key @@ -113,7 +113,7 @@ function format() { printf -v "${key}" "${format}" "$@" } -function assign() { +assign() { local key=${1} assert isset key shift @@ -121,7 +121,7 @@ function assign() { format "${key}" "%s" "$@" } -function fread() { +fread() { local file=${1} assert isset file @@ -130,7 +130,7 @@ function fread() { print "$(<${file})" } -function fwrite() { +fwrite() { local file=${1} assert isset file shift @@ -143,13 +143,13 @@ function fwrite() { print "%s" "$@" >> ${file} 2>/dev/null } -function enabled() { +enabled() { local param=${1} list_match "${!param}" yes on true 1 } -function mac_generate() { +mac_generate() { # Get a bunch of random hex digits # and remove all dashes from the input. local random=$(/dev/null } -function cmd_exec() { +cmd_exec() { local cmd=$@ log DEBUG "Exec'ing command: ${cmd}" @@ -352,16 +352,16 @@ function cmd_exec() { exit ${EXIT_ERROR} } -function cmd_not_implemented() { +cmd_not_implemented() { assert false "not implemented" } # Increase security of the read command -function read() { +read() { builtin read -r $@ } -function seq() { +seq() { if [ $# -eq 2 ]; then eval echo {${1}..${2}} elif [ $# -eq 3 ]; then @@ -369,16 +369,16 @@ function seq() { fi } -function which() { +which() { type -P $@ } # Prints the number of seconds since epoch. -function timestamp() { +timestamp() { date -u "+%s" } -function beautify_time() { +beautify_time() { local value=${1} local unit @@ -404,7 +404,7 @@ function beautify_time() { echo "${value}${unit}" } -function beautify_bytes() { +beautify_bytes() { local value=${1} local unit @@ -417,7 +417,7 @@ function beautify_bytes() { echo "${value}${unit}" } -function module_load() { +module_load() { local module=${1} if ! grep -q "^${module}" /proc/modules; then @@ -426,7 +426,7 @@ function module_load() { fi } -function binary_exists() { +binary_exists() { local binary=${1} if [ -n "$(type -p ${binary})" ]; then @@ -436,7 +436,7 @@ function binary_exists() { return ${EXIT_ERROR} } -function function_exists() { +function_exists() { local function="${1}" if [ "$(type -t "${function}")" = "function" ]; then @@ -446,7 +446,7 @@ function function_exists() { return ${EXIT_FALSE} } -function process_kill() { +process_kill() { local process=${1} if ! isinteger process; then @@ -465,7 +465,7 @@ function process_kill() { done } -function dec() { +dec() { local hex=${1} if [ "${hex:0:2}" != "0x" ]; then @@ -475,7 +475,7 @@ function dec() { printf "%d\n" "${hex}" } -function chr() { +chr() { local char="${1}" [ ${char} -lt 256 ] || return ${EXIT_ERROR} @@ -483,20 +483,20 @@ function chr() { printf "\\$(( ${char} / 64 * 100 + ${char} % 64 / 8 * 10 + ${char} % 8 ))\n" } -function ord() { +ord() { LC_CTYPE="C" printf "%d\n" "'${1}" } -function hex() { +hex() { printf "%X\n" "${1}" } -function network_is_running() { +network_is_running() { # Check, if the network service is running. service_is_active network } -function contains_spaces() { +contains_spaces() { local var="$@" # Eliminate spaces. @@ -509,7 +509,7 @@ function contains_spaces() { return ${EXIT_FALSE} } -function string_split() { +string_split() { local string="$@" local pos=0 @@ -521,7 +521,7 @@ function string_split() { return ${EXIT_OK} } -function string_reverse() { +string_reverse() { local string="$@" local output @@ -535,7 +535,7 @@ function string_reverse() { return ${EXIT_OK} } -function dec2bin() { +dec2bin() { local number="${1}" local output @@ -561,7 +561,7 @@ function dec2bin() { print "${output}" } -function bin2dec() { +bin2dec() { local string="${1}" local number=0 @@ -587,31 +587,31 @@ function bin2dec() { return ${EXIT_OK} } -function char2bin() { +char2bin() { local dec="$(ord "${1}")" dec2bin "${dec}" } -function bin2char() { +bin2char() { local dec="$(bin2dec "$@")" chr "${dec}" } -function bin2hex() { +bin2hex() { local dec="$(bin2dec "$@")" dec2hex "${dec}" } -function hex2bin() { +hex2bin() { local dec="$(hex2dec "$@")" dec2bin "${dec}" } -function hex2dec() { +hex2dec() { local hex="${1}" # Prepend 0x if necessary. @@ -620,6 +620,6 @@ function hex2dec() { printf "%d\n" "${hex}" } -function dec2hex() { +dec2hex() { printf "%02x\n" "${1}" } diff --git a/src/functions/functions.vlan b/src/functions/functions.vlan index 8bcf169d..97028b0a 100644 --- a/src/functions/functions.vlan +++ b/src/functions/functions.vlan @@ -24,7 +24,7 @@ PROC_NET_VLAN_CONFIG="${PROC_NET_VLAN}/config" VLAN_PORT_INTERFIX="v" -function vlan_init() { +vlan_init() { ebtables-restore < } -function hook_ppp_ip_pre_up() { +hook_ppp_ip_pre_up() { local zone="${1}" assert isset zone shift @@ -237,7 +237,7 @@ function hook_ppp_ip_pre_up() { exit $? } -function hook_ppp_ipv4_up() { +hook_ppp_ipv4_up() { local zone="${1}" assert isset zone shift @@ -251,7 +251,7 @@ function hook_ppp_ipv4_up() { exit $? } -function hook_ppp_ipv4_down() { +hook_ppp_ipv4_down() { local zone="${1}" assert isset zone shift @@ -265,7 +265,7 @@ function hook_ppp_ipv4_down() { exit $? } -function hook_ppp_ipv6_up() { +hook_ppp_ipv6_up() { local zone="${1}" assert isset zone shift @@ -279,7 +279,7 @@ function hook_ppp_ipv6_up() { exit $? } -function hook_ppp_ipv6_down() { +hook_ppp_ipv6_down() { local zone="${1}" assert isset zone shift diff --git a/src/helpers/pppd-angel b/src/helpers/pppd-angel index 678bf919..4c214766 100644 --- a/src/helpers/pppd-angel +++ b/src/helpers/pppd-angel @@ -24,7 +24,7 @@ # Read network settings network_settings_read -function main() { +main() { local zone="${1}" assert isset zone diff --git a/src/hooks/configs/ipv4-dhcp b/src/hooks/configs/ipv4-dhcp index b24cb11c..ea78d096 100644 --- a/src/hooks/configs/ipv4-dhcp +++ b/src/hooks/configs/ipv4-dhcp @@ -26,12 +26,12 @@ HOOK_SETTINGS="HOOK DELAY" # Default settings. DELAY=0 -function hook_check() { +hook_check() { assert isset DELAY assert isinteger DELAY } -function hook_create() { +hook_create() { local zone=${1} shift @@ -49,7 +49,7 @@ function hook_create() { exit ${EXIT_OK} } -function hook_up() { +hook_up() { local zone=${1} local config=${2} shift 2 @@ -65,7 +65,7 @@ function hook_up() { exit ${EXIT_OK} } -function hook_down() { +hook_down() { local zone=${1} local config=${2} shift 2 @@ -81,7 +81,7 @@ function hook_down() { exit ${EXIT_OK} } -function hook_status() { +hook_status() { local zone=${1} local config=${2} shift 2 diff --git a/src/hooks/configs/ipv4-static b/src/hooks/configs/ipv4-static index 6ffb0bcf..f8a21b83 100644 --- a/src/hooks/configs/ipv4-static +++ b/src/hooks/configs/ipv4-static @@ -25,7 +25,7 @@ HOOK_MANPAGE="network-config-ipv4-static" HOOK_SETTINGS="HOOK ADDRESS PREFIX GATEWAY" -function hook_check() { +hook_check() { assert isset ADDRESS assert isinteger PREFIX @@ -35,7 +35,7 @@ function hook_check() { fi } -function hook_create() { +hook_create() { local zone="${1}" assert zone_exists "${zone}" shift @@ -112,7 +112,7 @@ function hook_create() { exit ${EXIT_OK} } -function hook_up() { +hook_up() { local zone=${1} local config=${2} shift 2 @@ -138,7 +138,7 @@ function hook_up() { exit ${EXIT_OK} } -function hook_down() { +hook_down() { local zone=${1} local config=${2} shift 2 @@ -158,7 +158,7 @@ function hook_down() { exit ${EXIT_OK} } -function hook_status() { +hook_status() { local zone="${1}" assert isset zone diff --git a/src/hooks/configs/ipv6-auto b/src/hooks/configs/ipv6-auto index 6cb5ed30..b2c398f1 100644 --- a/src/hooks/configs/ipv6-auto +++ b/src/hooks/configs/ipv6-auto @@ -26,11 +26,11 @@ HOOK_CONFIG_SETTINGS="HOOK PRIVACY_EXTENSIONS" # Privacy Extensions are disabled by default PRIVACY_EXTENSIONS="off" -function hook_check_config_settings() { +hook_check_config_settings() { assert isbool PRIVACY_EXTENSIONS } -function hook_create() { +hook_create() { local zone="${1}" shift @@ -53,7 +53,7 @@ function hook_create() { exit ${EXIT_OK} } -function hook_up() { +hook_up() { local zone=${1} shift @@ -77,7 +77,7 @@ function hook_up() { exit ${EXIT_OK} } -function hook_down() { +hook_down() { local zone=${1} local config=${2} shift 2 @@ -93,7 +93,7 @@ function hook_down() { exit ${EXIT_OK} } -function hook_status() { +hook_status() { local zone=${1} local config=${2} shift 2 diff --git a/src/hooks/configs/ipv6-dhcp b/src/hooks/configs/ipv6-dhcp index 77437752..29a5f792 100644 --- a/src/hooks/configs/ipv6-dhcp +++ b/src/hooks/configs/ipv6-dhcp @@ -23,7 +23,7 @@ HOOK_CONFIG_SETTINGS="HOOK" -function hook_create() { +hook_create() { local zone="${1}" shift @@ -32,7 +32,7 @@ function hook_create() { exit ${EXIT_OK} } -function hook_up() { +hook_up() { local zone="${1}" local config="${2}" shift 2 @@ -48,7 +48,7 @@ function hook_up() { exit ${EXIT_OK} } -function hook_down() { +hook_down() { local zone="${1}" local config="${2}" shift 2 @@ -64,7 +64,7 @@ function hook_down() { exit ${EXIT_OK} } -function hook_status() { +hook_status() { local zone="${1}" local config="${2}" shift 2 diff --git a/src/hooks/configs/ipv6-static b/src/hooks/configs/ipv6-static index c64ec8b0..f4f9ddf4 100644 --- a/src/hooks/configs/ipv6-static +++ b/src/hooks/configs/ipv6-static @@ -23,7 +23,7 @@ HOOK_SETTINGS="HOOK ADDRESS PREFIX GATEWAY" -function hook_check() { +hook_check() { assert isset ADDRESS assert isinteger PREFIX @@ -33,7 +33,7 @@ function hook_check() { fi } -function hook_create() { +hook_create() { local zone=${1} shift @@ -64,7 +64,7 @@ function hook_create() { exit ${EXIT_OK} } -function hook_up() { +hook_up() { local zone=${1} local config=${2} shift 2 @@ -86,7 +86,7 @@ function hook_up() { exit ${EXIT_OK} } -function hook_down() { +hook_down() { local zone=${1} local config=${2} shift 2 @@ -109,7 +109,7 @@ function hook_down() { exit ${EXIT_OK} } -function hook_status() { +hook_status() { local zone=${1} local config=${2} shift 2 diff --git a/src/hooks/configs/pppoe-server b/src/hooks/configs/pppoe-server index f50ffbeb..84148ddd 100644 --- a/src/hooks/configs/pppoe-server +++ b/src/hooks/configs/pppoe-server @@ -37,13 +37,13 @@ SUBNET= # 0 = unlimited. MAX_SESSIONS=0 -function hook_check() { +hook_check() { assert isset MTU assert isset SUBNET assert isset MAX_SESSIONS } -function hook_create() { +hook_create() { local zone=${1} shift @@ -70,7 +70,7 @@ function hook_create() { exit ${EXIT_OK} } -function hook_up() { +hook_up() { local zone=${1} local config=${2} shift 2 @@ -81,7 +81,7 @@ function hook_up() { exit ${EXIT_OK} } -function hook_down() { +hook_down() { local zone=${1} local config=${2} shift 2 @@ -97,7 +97,7 @@ function hook_down() { exit ${EXIT_OK} } -function hook_status() { +hook_status() { local zone=${1} local config=${2} shift 2 diff --git a/src/hooks/ports/batman-adv b/src/hooks/ports/batman-adv index 40b9735f..4f162019 100644 --- a/src/hooks/ports/batman-adv +++ b/src/hooks/ports/batman-adv @@ -28,12 +28,12 @@ PORT_CHILDREN_VAR="SLAVES" ADDRESS=$(mac_generate) SLAVES= -function hook_check_settings() { +hook_check_settings() { assert isset ADDRESS assert ismac ADDRESS } -function hook_new() { +hook_new() { while [ $# -gt 0 ]; do case "${1}" in --address=*) @@ -57,7 +57,7 @@ function hook_new() { exit ${EXIT_OK} } -function hook_edit() { +hook_edit() { local port=${1} assert isset port shift @@ -94,7 +94,7 @@ function hook_edit() { exit ${EXIT_OK} } -function hook_create() { +hook_create() { local port="${1}" assert isset port @@ -109,7 +109,7 @@ function hook_create() { exit ${EXIT_OK} } -function hook_remove() { +hook_remove() { local port="${1}" assert isset port @@ -121,7 +121,7 @@ function hook_remove() { exit ${EXIT_OK} } -function hook_hotplug() { +hook_hotplug() { local port="${1}" assert isset port @@ -168,7 +168,7 @@ function hook_hotplug() { exit ${EXIT_NOT_HANDLED} } -function hook_status() { +hook_status() { local port=${1} assert isset port diff --git a/src/hooks/ports/bonding b/src/hooks/ports/bonding index b554c44b..6e3f62ee 100644 --- a/src/hooks/ports/bonding +++ b/src/hooks/ports/bonding @@ -28,7 +28,7 @@ SLAVES="" MIIMON=100 MODE="balance-rr" -function hook_check_settings() { +hook_check_settings() { assert isset ADDRESS assert ismac ADDRESS @@ -36,11 +36,11 @@ function hook_check_settings() { assert isinteger MIIMON } -function hook_new() { +hook_new() { hook_edit $@ } -function hook_edit() { +hook_edit() { local port=${1} assert isset port shift @@ -96,7 +96,7 @@ function hook_edit() { exit ${EXIT_OK} } -function hook_create() { +hook_create() { local port="${1}" assert isset port @@ -115,7 +115,7 @@ function hook_create() { exit ${EXIT_OK} } -function hook_remove() { +hook_remove() { local port="${1}" assert isset port @@ -127,7 +127,7 @@ function hook_remove() { fi } -function hook_up() { +hook_up() { local port="${1}" assert isset port @@ -143,7 +143,7 @@ function hook_up() { done } -function hook_down() { +hook_down() { local port="${1}" assert isset port @@ -159,7 +159,7 @@ function hook_down() { hook_default_down "${port}" } -function hook_hotplug() { +hook_hotplug() { local port="${1}" assert isset port diff --git a/src/hooks/ports/dummy b/src/hooks/ports/dummy index 617084e4..aa313c01 100644 --- a/src/hooks/ports/dummy +++ b/src/hooks/ports/dummy @@ -23,11 +23,11 @@ HOOK_SETTINGS="HOOK ADDRESS" -function hook_check_settings() { +hook_check_settings() { assert ismac ADDRESS } -function hook_new() { +hook_new() { while [ $# -gt 0 ]; do case "${1}" in --address=*) @@ -55,7 +55,7 @@ function hook_new() { exit ${EXIT_OK} } -function hook_edit() { +hook_edit() { local port=${1} assert isset port shift @@ -79,7 +79,7 @@ function hook_edit() { exit ${EXIT_OK} } -function hook_create() { +hook_create() { local port="${1}" assert isset port @@ -92,7 +92,7 @@ function hook_create() { exit ${EXIT_OK} } -function hook_remove() { +hook_remove() { local port="${1}" assert isset port @@ -100,7 +100,7 @@ function hook_remove() { dummy_remove "${port}" } -function hook_up() { +hook_up() { local port="${1}" assert isset port @@ -110,7 +110,7 @@ function hook_up() { exit ${EXIT_OK} } -function hook_down() { +hook_down() { local port="${1}" assert isset port @@ -120,7 +120,7 @@ function hook_down() { exit ${EXIT_OK} } -function hook_hotplug_rename() { +hook_hotplug_rename() { local port=${1} assert isset port diff --git a/src/hooks/ports/ethernet b/src/hooks/ports/ethernet index 783e0fc7..f33777a7 100644 --- a/src/hooks/ports/ethernet +++ b/src/hooks/ports/ethernet @@ -26,7 +26,7 @@ HOOK_SETTINGS="HOOK ADDRESS DEVICE" -function hook_check_settings() { +hook_check_settings() { assert ismac DEVICE if isset ADDRESS; then @@ -34,7 +34,7 @@ function hook_check_settings() { fi } -function hook_new() { +hook_new() { local port=${1} assert isset port shift @@ -47,17 +47,17 @@ function hook_new() { exit ${EXIT_OK} } -function hook_create() { +hook_create() { # Nothing to do here. Real ethernet devices cannot # be created. They are just there. exit ${EXIT_OK} } -function hook_remove() { +hook_remove() { exit ${EXIT_OK} } -function hook_hotplug_rename() { +hook_hotplug_rename() { local port=${1} assert isset port diff --git a/src/hooks/ports/vlan b/src/hooks/ports/vlan index b95f6a98..34436148 100644 --- a/src/hooks/ports/vlan +++ b/src/hooks/ports/vlan @@ -25,7 +25,7 @@ HOOK_SETTINGS="HOOK ADDRESS PARENT_DEVICE TAG" PORT_PARENTS_VAR="PARENT" -function hook_check_settings() { +hook_check_settings() { assert isset PARENT_DEVICE assert isinteger TAG @@ -47,7 +47,7 @@ function hook_check_settings() { done } -function hook_new() { +hook_new() { while [ $# -gt 0 ]; do case "${1}" in --parent-device=*) @@ -73,7 +73,7 @@ function hook_new() { exit ${EXIT_OK} } -function hook_edit() { +hook_edit() { local port=${1} assert isset port shift @@ -97,7 +97,7 @@ function hook_edit() { exit ${EXIT_OK} } -function hook_create() { +hook_create() { local port="${1}" assert isset port @@ -112,7 +112,7 @@ function hook_create() { exit ${EXIT_OK} } -function hook_remove() { +hook_remove() { local port="${1}" assert isset port diff --git a/src/hooks/ports/wireless-adhoc b/src/hooks/ports/wireless-adhoc index 7ab63981..09ab4028 100644 --- a/src/hooks/ports/wireless-adhoc +++ b/src/hooks/ports/wireless-adhoc @@ -30,7 +30,7 @@ MTU=1500 PHY= SSID= -function hook_check_settings() { +hook_check_settings() { assert isset ADDRESS assert ismac ADDRESS assert isset CHANNEL @@ -41,7 +41,7 @@ function hook_check_settings() { assert isset SSID } -function hook_new() { +hook_new() { while [ $# -gt 0 ]; do case "${1}" in --address=*) @@ -81,7 +81,7 @@ function hook_new() { exit ${EXIT_OK} } -function hook_edit() { +hook_edit() { local port=${1} assert isset port shift @@ -114,7 +114,7 @@ function hook_edit() { exit ${EXIT_OK} } -function hook_create() { +hook_create() { local port="${1}" assert isset port @@ -138,7 +138,7 @@ function hook_create() { exit ${EXIT_OK} } -function hook_remove() { +hook_remove() { local port="${1}" assert isset port @@ -149,7 +149,7 @@ function hook_remove() { exit ${EXIT_OK} } -function hook_up() { +hook_up() { local port=${1} assert isset port @@ -171,7 +171,7 @@ function hook_up() { exit ${EXIT_OK} } -function hook_down() { +hook_down() { local port="${1}" assert isset port @@ -186,7 +186,7 @@ function hook_down() { exit ${EXIT_OK} } -function hook_hotplug() { +hook_hotplug() { local port="${1}" assert isset port @@ -219,7 +219,7 @@ function hook_hotplug() { exit ${EXIT_OK} } -function hook_find_parent() { +hook_find_parent() { local port=${1} assert isset port diff --git a/src/hooks/ports/wireless-ap b/src/hooks/ports/wireless-ap index 3ff80d06..dffae405 100644 --- a/src/hooks/ports/wireless-ap +++ b/src/hooks/ports/wireless-ap @@ -32,7 +32,7 @@ KEY="" MODE="g" SSID= -function hook_check_settings() { +hook_check_settings() { assert isset ADDRESS assert ismac ADDRESS assert isset BROADCAST_SSID @@ -53,7 +53,7 @@ function hook_check_settings() { fi } -function hook_new() { +hook_new() { while [ $# -gt 0 ]; do case "${1}" in --broadcast-ssid=*) @@ -99,7 +99,7 @@ function hook_new() { exit ${EXIT_OK} } -function hook_edit() { +hook_edit() { local port=${1} shift @@ -139,7 +139,7 @@ function hook_edit() { exit ${EXIT_OK} } -function hook_create() { +hook_create() { local port="${1}" assert isset port @@ -163,7 +163,7 @@ function hook_create() { exit ${EXIT_OK} } -function hook_remove() { +hook_remove() { local port="${1}" assert isset port @@ -175,7 +175,7 @@ function hook_remove() { exit ${EXIT_OK} } -function hook_up() { +hook_up() { local port="${1}" assert isset port @@ -187,14 +187,14 @@ function hook_up() { hostapd_start "${port}" } -function hook_down() { +hook_down() { local port="${1}" assert isset port hostapd_stop "${port}" } -function hook_hotplug() { +hook_hotplug() { local port="${1}" assert isset port diff --git a/src/hooks/zones/6rd b/src/hooks/zones/6rd index a0a9bf95..6ab94ad9 100644 --- a/src/hooks/zones/6rd +++ b/src/hooks/zones/6rd @@ -36,7 +36,7 @@ SERVER_ADDRESS="" # The public IPv4 address of the tunnel client. PUBLIC_ADDRESS="" -function hook_check_settings() { +hook_check_settings() { assert isset SIX_RD_PREFIX assert isset PUBLIC_ADDRESS assert isset SERVER_ADDRESS @@ -70,7 +70,7 @@ function hook_check_settings() { fi } -function hook_parse_cmdline() { +hook_parse_cmdline() { local value while [ $# -gt 0 ]; do @@ -96,7 +96,7 @@ function hook_parse_cmdline() { done } -function hook_up() { +hook_up() { local zone="${1}" assert isset zone @@ -129,7 +129,7 @@ function hook_up() { exit ${EXIT_OK} } -function hook_down() { +hook_down() { local zone=${1} assert isset zone @@ -144,7 +144,7 @@ function hook_down() { exit ${EXIT_OK} } -function hook_status() { +hook_status() { local zone=${1} assert isset zone diff --git a/src/hooks/zones/6to4-tunnel b/src/hooks/zones/6to4-tunnel index 2fc91ad2..fb8c449b 100644 --- a/src/hooks/zones/6to4-tunnel +++ b/src/hooks/zones/6to4-tunnel @@ -44,7 +44,7 @@ TUNNEL_ID= USERNAME= PASSWORD= -function hook_check_settings() { +hook_check_settings() { assert isset SERVER_ADDRESS assert isset LOCAL_ADDRESS assert isset LOCAL_ADDRESS6 @@ -56,7 +56,7 @@ function hook_check_settings() { fi } -function hook_parse_cmdline() { +hook_parse_cmdline() { local value while [ $# -gt 0 ]; do @@ -97,7 +97,7 @@ function hook_parse_cmdline() { done } -function hook_up() { +hook_up() { local zone=${1} assert isset zone @@ -135,7 +135,7 @@ function hook_up() { exit ${EXIT_OK} } -function hook_down() { +hook_down() { local zone=${1} assert isset zone @@ -150,7 +150,7 @@ function hook_down() { exit ${EXIT_OK} } -function hook_status() { +hook_status() { local zone=${1} assert isset zone diff --git a/src/hooks/zones/aiccu b/src/hooks/zones/aiccu index d8852ebf..d6f1e432 100644 --- a/src/hooks/zones/aiccu +++ b/src/hooks/zones/aiccu @@ -30,7 +30,7 @@ PROTOCOL="tic" TUNNEL_ID= REQUIRE_TLS="true" -function hook_check_settings() { +hook_check_settings() { assert isset USERNAME assert isset PASSWORD assert isset SERVER @@ -45,7 +45,7 @@ function hook_check_settings() { fi } -function hook_parse_cmdline() { +hook_parse_cmdline() { local value while [ $# -gt 0 ]; do @@ -83,7 +83,7 @@ function hook_parse_cmdline() { done } -function hook_up() { +hook_up() { local zone=${1} assert isset zone @@ -93,7 +93,7 @@ function hook_up() { exit ${EXIT_OK} } -function hook_down() { +hook_down() { local zone=${1} assert isset zone @@ -103,7 +103,7 @@ function hook_down() { exit ${EXIT_OK} } -function hook_status() { +hook_status() { local zone=${1} assert isset zone diff --git a/src/hooks/zones/bridge b/src/hooks/zones/bridge index c672e737..7b4e7a4e 100644 --- a/src/hooks/zones/bridge +++ b/src/hooks/zones/bridge @@ -38,7 +38,7 @@ STP_HELLO=2 STP_MAXAGE=20 STP_PRIORITY=512 -function hook_check_settings() { +hook_check_settings() { assert ismac MAC assert isbool STP assert isoneof STP_MODE stp rstp @@ -48,7 +48,7 @@ function hook_check_settings() { assert isinteger MTU } -function hook_parse_cmdline() { +hook_parse_cmdline() { while [ $# -gt 0 ]; do case "${1}" in --stp=*) @@ -80,7 +80,7 @@ function hook_parse_cmdline() { done } -function hook_up() { +hook_up() { local zone=${1} assert isset zone @@ -132,7 +132,7 @@ function hook_up() { exit ${EXIT_OK} } -function hook_hotplug() { +hook_hotplug() { local zone="${1}" assert isset zone @@ -162,7 +162,7 @@ function hook_hotplug() { exit ${EXIT_OK} } -function hook_down() { +hook_down() { local zone="${1}" assert isset zone @@ -185,7 +185,7 @@ function hook_down() { exit ${EXIT_OK} } -function hook_status() { +hook_status() { local zone="${1}" assert isset zone @@ -240,7 +240,7 @@ function hook_status() { exit ${EXIT_OK} } -function hook_check_port_settings() { +hook_check_port_settings() { if isset COST; then assert isinteger COST fi @@ -250,7 +250,7 @@ function hook_check_port_settings() { fi } -function hook_port_attach() { +hook_port_attach() { # Excepting at least two arguments here assert [ $# -ge 2 ] @@ -282,7 +282,7 @@ function hook_port_attach() { exit ${EXIT_OK} } -function hook_port_detach() { +hook_port_detach() { assert [ $# -eq 2 ] local zone="${1}" @@ -298,11 +298,11 @@ function hook_port_detach() { exit ${EXIT_OK} } -function hook_port_edit() { +hook_port_edit() { hook_port_attach $@ } -function hook_port_up() { +hook_port_up() { assert [ $# -eq 2 ] local zone="${1}" @@ -337,7 +337,7 @@ function hook_port_up() { exit ${EXIT_OK} } -function hook_port_down() { +hook_port_down() { assert [ $# -eq 2 ] local zone="${1}" @@ -352,7 +352,7 @@ function hook_port_down() { exit ${EXIT_OK} } -function hook_port_status() { +hook_port_status() { assert [ $# -eq 2 ] local zone="${1}" diff --git a/src/hooks/zones/modem b/src/hooks/zones/modem index 441e95e2..db5e309d 100644 --- a/src/hooks/zones/modem +++ b/src/hooks/zones/modem @@ -70,7 +70,7 @@ HOOK_SETTINGS="${HOOK_SETTINGS} PHONE_NUMBER" IMSI= HOOK_SETTINGS="${HOOK_SETTINGS} IMSI" -function hook_check_settings() { +hook_check_settings() { assert isset DEVICE assert isset PHONE_NUMBER @@ -86,7 +86,7 @@ function hook_check_settings() { isset AUTH && assert isoneof AUTH ${MODEM_ALLOWED_AUTH_METHODS} } -function hook_parse_cmdline() { +hook_parse_cmdline() { local value while [ $# -gt 0 ]; do @@ -135,7 +135,7 @@ function hook_parse_cmdline() { done } -function hook_up() { +hook_up() { local zone=${1} assert isset zone @@ -163,7 +163,7 @@ function hook_up() { exit ${EXIT_OK} } -function hook_down() { +hook_down() { local zone=${1} assert isset zone @@ -173,7 +173,7 @@ function hook_down() { exit ${EXIT_OK} } -function hook_status() { +hook_status() { local zone=${1} assert isset zone @@ -264,7 +264,7 @@ function hook_status() { exit ${EXIT_OK} } -function hook_ppp_write_config() { +hook_ppp_write_config() { local zone=${1} assert isset zone diff --git a/src/hooks/zones/pppoe b/src/hooks/zones/pppoe index fa3f4ed6..b2d0a950 100644 --- a/src/hooks/zones/pppoe +++ b/src/hooks/zones/pppoe @@ -51,7 +51,7 @@ IPV6="true" # Use IPv6 prefix delegation. PREFIX_DELEGATION="true" -function hook_check_settings() { +hook_check_settings() { assert isset USERNAME assert isset PASSWORD @@ -61,7 +61,7 @@ function hook_check_settings() { assert isset PREFIX_DELEGATION } -function hook_parse_cmdline() { +hook_parse_cmdline() { while [ $# -gt 0 ]; do case "${1}" in --access-concentrator=*) @@ -101,7 +101,7 @@ function hook_parse_cmdline() { done } -function hook_up() { +hook_up() { local zone=${1} assert isset zone @@ -125,7 +125,7 @@ function hook_up() { exit ${EXIT_OK} } -function hook_down() { +hook_down() { local zone=${1} assert isset zone @@ -141,7 +141,7 @@ function hook_down() { exit ${EXIT_OK} } -function hook_hotplug() { +hook_hotplug() { local zone="${1}" case "$(hotplug_action)" in @@ -168,7 +168,7 @@ function hook_hotplug() { exit ${EXIT_NOT_HANDLED} } -function hook_discover() { +hook_discover() { local device=${1} # This obviously only works on ethernet (or compatible) devices @@ -199,7 +199,7 @@ function hook_discover() { exit ${DISCOVER_OK} } -function hook_status() { +hook_status() { local zone=${1} assert isset zone @@ -255,7 +255,7 @@ function hook_status() { exit ${EXIT_OK} } -function hook_ppp_write_config() { +hook_ppp_write_config() { local zone=${1} assert isset zone @@ -302,7 +302,7 @@ function hook_ppp_write_config() { exit ${EXIT_OK} } -function __hook_get_port() { +__hook_get_port() { local zone="${1}" local port @@ -314,7 +314,7 @@ function __hook_get_port() { return ${EXIT_ERROR} } -function hook_port_attach() { +hook_port_attach() { # Excepting at least two arguments here assert [ $# -ge 2 ] @@ -338,7 +338,7 @@ function hook_port_attach() { exit ${EXIT_OK} } -function hook_port_detach() { +hook_port_detach() { assert [ $# -eq 2 ] local zone="${1}" @@ -357,7 +357,7 @@ function hook_port_detach() { exit ${EXIT_OK} } -function hook_ppp_ipv6_up() { +hook_ppp_ipv6_up() { local zone="${1}" ppp_common_ipv6_up "${zone}" @@ -372,7 +372,7 @@ function hook_ppp_ipv6_up() { exit ${EXIT_OK} } -function hook_ppp_ipv6_down() { +hook_ppp_ipv6_down() { local zone="${1}" ppp_common_ipv6_down "${zone}" diff --git a/src/hooks/zones/wireless b/src/hooks/zones/wireless index 52a3da30..05c9a797 100644 --- a/src/hooks/zones/wireless +++ b/src/hooks/zones/wireless @@ -31,7 +31,7 @@ SSID= KEY= ENCRYPTION_MODE= -function hook_check_settings() { +hook_check_settings() { assert isset SSID if isset ADDRESS; then @@ -46,7 +46,7 @@ function hook_check_settings() { fi } -function hook_parse_cmdline() { +hook_parse_cmdline() { while [ $# -gt 0 ]; do case "${1}" in --phy=*|--parent-device=*) @@ -76,7 +76,7 @@ function hook_parse_cmdline() { PHY=$(phy_get_address ${PHY}) } -function hook_up() { +hook_up() { local zone=${1} assert isset zone @@ -100,7 +100,7 @@ function hook_up() { exit ${EXIT_OK} } -function hook_down() { +hook_down() { local zone=${1} shift @@ -118,7 +118,7 @@ function hook_down() { exit ${EXIT_OK} } -function hook_status() { +hook_status() { local zone=${1} assert isset zone diff --git a/src/network b/src/network index 867e3a8b..e5a71db9 100644 --- a/src/network +++ b/src/network @@ -38,7 +38,7 @@ done # Read network settings network_settings_read -function cli_settings() { +cli_settings() { if cli_help_requested $@; then cli_show_man network-settings exit ${EXIT_OK} @@ -52,7 +52,7 @@ function cli_settings() { fi } -function cli_device() { +cli_device() { if cli_help_requested $@; then cli_show_man network-device exit ${EXIT_OK} @@ -103,7 +103,7 @@ function cli_device() { return ${EXIT_OK} } -function cli_device_status() { +cli_device_status() { local device="${1}" assert isset device @@ -202,7 +202,7 @@ function cli_device_status() { LOG_DISABLE_STDOUT=${log_disable_stdout} } -function cli_device_status_serial() { +cli_device_status_serial() { local device=${1} assert device_is_serial ${device} @@ -263,7 +263,7 @@ function cli_device_status_serial() { cli_space } -function cli_device_status_phy() { +cli_device_status_phy() { local phy="${1}" assert phy_exists "${phy}" @@ -285,7 +285,7 @@ function cli_device_status_phy() { return ${EXIT_OK} } -function cli_device_discover() { +cli_device_discover() { local device=${1} shift @@ -356,7 +356,7 @@ function cli_device_discover() { [ "${up}" = "1" ] || device_set_down ${device} } -function cli_device_serial_unlock() { +cli_device_serial_unlock() { if cli_help_requested $@; then cli_show_man network-device exit ${EXIT_OK} @@ -442,7 +442,7 @@ function cli_device_serial_unlock() { exit $? } -function cli_device_send_ussd_command() { +cli_device_send_ussd_command() { local device="${1}" assert isset device shift @@ -477,7 +477,7 @@ function cli_device_send_ussd_command() { exit $? } -function cli_device_monitor() { +cli_device_monitor() { local device="${1}" assert isset device @@ -490,7 +490,7 @@ function cli_device_monitor() { exit $? } -function cli_device_list() { +cli_device_list() { local device for device in $(device_list); do cli_device_status "${device}" @@ -499,7 +499,7 @@ function cli_device_list() { exit ${EXIT_OK} } -function cli_hostname() { +cli_hostname() { if cli_help_requested $@; then cli_show_man network exit ${EXIT_OK} @@ -518,7 +518,7 @@ function cli_hostname() { exit ${EXIT_OK} } -function cli_port() { +cli_port() { if cli_help_requested $@; then cli_show_man network-port exit ${EXIT_OK} @@ -557,7 +557,7 @@ function cli_port() { fi } -function cli_zone() { +cli_zone() { if cli_help_requested $@; then cli_show_man network-zone exit ${EXIT_OK} @@ -627,7 +627,7 @@ function cli_zone() { # 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. -function cli_zone_destroy() { +cli_zone_destroy() { if cli_help_requested $@; then cli_show_man network-zone exit ${EXIT_OK} @@ -647,7 +647,7 @@ function cli_zone_destroy() { exit ${EXIT_OK} } -function cli_zone_port() { +cli_zone_port() { if cli_help_requested $@; then cli_show_man network-zone-port exit ${EXIT_OK} @@ -691,7 +691,7 @@ function cli_zone_port() { exit ${EXIT_OK} } -function cli_list_hooks() { +cli_list_hooks() { local type=${1} shift @@ -711,7 +711,7 @@ function cli_list_hooks() { done | sort -u } -function cli_route() { +cli_route() { if cli_help_requested $@; then cli_show_man network-route exit ${EXIT_OK} @@ -748,7 +748,7 @@ function cli_route() { exit ${EXIT_OK} } -function cli_dhcpd() { +cli_dhcpd() { local proto=${1} shift @@ -790,7 +790,7 @@ function cli_dhcpd() { exit ${EXIT_OK} } -function cli_dhcpd_show() { +cli_dhcpd_show() { local proto=${1} assert isset proto @@ -860,7 +860,7 @@ function cli_dhcpd_show() { fi } -function cli_dhcpd_subnet() { +cli_dhcpd_subnet() { local proto=${1} shift @@ -937,7 +937,7 @@ function cli_dhcpd_subnet() { exit ${EXIT_OK} } -function cli_dhcpd_subnet_range() { +cli_dhcpd_subnet_range() { local proto=${1} assert isset proto shift @@ -966,7 +966,7 @@ function cli_dhcpd_subnet_range() { esac } -function cli_dhcpd_subnet_show() { +cli_dhcpd_subnet_show() { local proto=${1} assert isset proto @@ -1024,7 +1024,7 @@ function cli_dhcpd_subnet_show() { cli_space } -function cli_dhcpd_subnet_options() { +cli_dhcpd_subnet_options() { local proto=${1} assert isset proto shift @@ -1045,7 +1045,7 @@ function cli_dhcpd_subnet_options() { done } -function cli_start() { +cli_start() { if cli_help_requested $@; then cli_show_man network exit ${EXIT_OK} @@ -1061,7 +1061,7 @@ function cli_start() { wait # until everything is settled } -function cli_stop() { +cli_stop() { if cli_help_requested $@; then cli_show_man network exit ${EXIT_OK} @@ -1077,7 +1077,7 @@ function cli_stop() { wait # until everything is settled } -function cli_restart() { +cli_restart() { if cli_help_requested $@; then cli_show_man network exit ${EXIT_OK} @@ -1091,7 +1091,7 @@ function cli_restart() { cli_start $@ } -function cli_status() { +cli_status() { if cli_help_requested $@; then cli_show_man network exit ${EXIT_OK} @@ -1114,7 +1114,7 @@ function cli_status() { LOG_DISABLE_STDOUT=${log_disable_stdout} } -function cli_reset() { +cli_reset() { if cli_help_requested $@; then cli_show_man network exit ${EXIT_OK} @@ -1164,7 +1164,7 @@ function cli_reset() { # Help function: will show the default man page to the user. # Optionally, there are two arguments taken, the type of hook # and which hook should be shown. -function cli_help() { +cli_help() { local type=${1} local what=${2} @@ -1187,7 +1187,7 @@ function cli_help() { hook_exec ${type} ${what} help } -function cli_dns_server() { +cli_dns_server() { if cli_help_requested $@; then cli_show_man network-dns-server exit ${EXIT_OK} @@ -1242,7 +1242,7 @@ function cli_dns_server() { exit ${EXIT_OK} } -function cli_raw() { +cli_raw() { local cmd="${1}" assert isset cmd shift diff --git a/src/ppp/dialer b/src/ppp/dialer index 640ad74b..5d8be0c3 100644 --- a/src/ppp/dialer +++ b/src/ppp/dialer @@ -62,7 +62,7 @@ commandline="${commandline} -f ${file}" # Helper function to write beatiful lines to # the chat scripts. -function println() { +println() { printf "%-30s %s\n" "$@" >> ${file} } diff --git a/src/udev/network-hotplug-rename b/src/udev/network-hotplug-rename index a206e67d..c56c70d1 100644 --- a/src/udev/network-hotplug-rename +++ b/src/udev/network-hotplug-rename @@ -30,7 +30,7 @@ network_settings_read # Setup the locking. LOCKFILE="${RUN_DIR}/.rename_lock" -function cleanup() { +cleanup() { lock_release ${LOCKFILE} } trap cleanup EXIT TERM KILL -- 2.39.2