From f1cdb01e3aea3984f3f7591dea086bab44a8bdd1 Mon Sep 17 00:00:00 2001 From: hrs Date: Sat, 12 Sep 2009 23:01:36 +0000 Subject: Add missing comments and whitespace clean-ups. --- etc/network.subr | 106 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 64 insertions(+), 42 deletions(-) (limited to 'etc/network.subr') diff --git a/etc/network.subr b/etc/network.subr index c9462fa..f9c10e8 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -31,8 +31,8 @@ # # ifn_start ifn -# Bring up and configure an interface. If some configuration is applied -# print the interface configuration. +# Bring up and configure an interface. If some configuration is +# applied print the interface configuration. # ifn_start() { @@ -53,8 +53,8 @@ ifn_start() } # ifn_stop ifn -# Shutdown and de-configure an interface. If action is taken print the -# interface name. +# Shutdown and de-configure an interface. If action is taken +# print the interface name. # ifn_stop() { @@ -176,11 +176,11 @@ ifconfig_down() } # get_if_var if var [default] -# Return the value of the pseudo-hash corresponding to $if where -# $var is a string containg the sub-string "IF" which will be -# replaced with $if after the characters defined in _punct are -# replaced with '_'. If the variable is unset, replace it with -# $default if given. +# Return the value of the pseudo-hash corresponding to $if where +# $var is a string containg the sub-string "IF" which will be +# replaced with $if after the characters defined in _punct are +# replaced with '_'. If the variable is unset, replace it with +# $default if given. get_if_var() { local _if _punct _var _default prefix suffix @@ -463,7 +463,7 @@ ifexists() } # ipv4_up if -# add IPv4 addresses to the interface $if +# add IPv4 addresses to the interface $if ipv4_up() { local _if _ret @@ -500,7 +500,7 @@ ipv6_up() } # ipv4_down if -# remove IPv4 addresses from the interface $if +# remove IPv4 addresses from the interface $if ipv4_down() { local _if _ifs _ret inetList oldifs _inet @@ -568,10 +568,10 @@ ipv6_down() } # ipv4_addrs_common if action -# Evaluate the ifconfig_if_ipv4 arguments for interface $if -# and use $action to add or remove IPv4 addresses from $if. +# Evaluate the ifconfig_if_ipv4 arguments for interface $if and +# use $action to add or remove IPv4 addresses from $if. ipv4_addrs_common() -{ +{ local _ret _if _action _cidr _cidr_addr local _ipaddr _netmask _range _ipnet _iplow _iphigh _ipcount _ret=1 @@ -652,7 +652,7 @@ ifalias_ipv4_up() break ;; esac - alias=$((${alias} + 1)) + alias=$((${alias} + 1)) done return $_ret @@ -701,7 +701,7 @@ ifalias_ipv6_up() return $_ret } -#ifalias_down if af +# ifalias_down if af # Remove aliases for network interface $if. # It returns 0 if at least one alias was removed or # 1 if there were none. @@ -723,7 +723,7 @@ ifalias_down() return $_ret } -#ifalias_ipv4_down if +# ifalias_ipv4_down if # Helper function for ifalias_down(). Handles IPv4. # ifalias_ipv4_down() @@ -743,13 +743,13 @@ ifalias_ipv4_down() break ;; esac - alias=$((${alias} + 1)) + alias=$((${alias} + 1)) done return $_ret } -#ifalias_ipv6_down if +# ifalias_ipv6_down if # Helper function for ifalias_down(). Handles IPv6. # ifalias_ipv6_down() @@ -869,7 +869,8 @@ ifscript_down() fi } -# Create cloneable interfaces. +# clone_up +# Create cloneable interfaces. # clone_up() { @@ -888,8 +889,9 @@ clone_up() debug "Cloned: ${_list}" } -# Destroy cloned interfaces. Destroyed interfaces are echoed -# to standard output. +# clone_down +# Destroy cloned interfaces. Destroyed interfaces are echoed to +# standard output. # clone_down() { @@ -907,8 +909,9 @@ clone_down() debug "Destroyed clones: ${_list}" } -# Create and configure child interfaces. -# Return 0 if child interfaces are created. +# childif_create +# Create and configure child interfaces. Return 0 if child +# interfaces are created. # childif_create() { @@ -943,7 +946,8 @@ childif_create() return ${cfg} } -# Destroy child interfaces. +# childif_destroy +# Destroy child interfaces. # childif_destroy() { @@ -958,16 +962,22 @@ childif_destroy() return ${cfg} } -# Create netgraph nodes. +# ng_mkpeer +# Create netgraph nodes. # -ng_mkpeer() { +ng_mkpeer() +{ ngctl -f - 2> /dev/null <