diff options
author | Roy Marples <roy@marples.name> | 2007-11-28 15:45:03 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-11-28 15:45:03 +0000 |
commit | ac9279cc0d5a00bc17908b2914941186020cd3ce (patch) | |
tree | 850a4fe19917113e75bfd2e79d00b58208468503 /net.Linux/ifconfig.sh | |
parent | 444f23e2d158389b22d40537fc9b027d9f575229 (diff) |
Massive whitespace cleanup
Diffstat (limited to 'net.Linux/ifconfig.sh')
-rw-r--r-- | net.Linux/ifconfig.sh | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/net.Linux/ifconfig.sh b/net.Linux/ifconfig.sh index 2b1465a2..04a9ec1e 100644 --- a/net.Linux/ifconfig.sh +++ b/net.Linux/ifconfig.sh @@ -42,7 +42,7 @@ _exists() { _ifindex() { local line= i=-2 - while read line ; do + while read line; do i=$((${i} + 1)) [ ${i} -lt 1 ] && continue case "${line}" in @@ -74,11 +74,11 @@ _get_mac_address() { case "${mac}" in - 00:00:00:00:00:00) ;; - 44:44:44:44:44:44) ;; - FF:FF:FF:FF:FF:FF) ;; - "") ;; - *) echo "${mac}"; return 0 ;; + 00:00:00:00:00:00);; + 44:44:44:44:44:44);; + FF:FF:FF:FF:FF:FF);; + "");; + *) echo "${mac}"; return 0;; esac return 1 @@ -102,7 +102,7 @@ _get_inet_addresses() { local iface=${IFACE} i=0 local addrs="$(_get_inet_address)" - while true ; do + while true; do local IFACE="${iface}:${i}" _exists || break local addr="$(_get_inet_address)" @@ -118,14 +118,14 @@ _cidr2netmask() { local octets=$((${cidr} / 8)) local frac=$((${cidr} % 8)) - while [ ${octets} -gt 0 ] ; do + while [ ${octets} -gt 0 ]; do netmask="${netmask}.255" octets=$((${octets} - 1)) done=$((${done} + 1)) done - if [ ${done} -lt 4 ] ; then - while [ ${i} -lt ${frac} ] ; do + if [ ${done} -lt 4 ]; then + while [ ${i} -lt ${frac} ]; do sum=$((${sum} + ${cur})) cur=$((${cur} / 2)) i=$((${i} + 1)) @@ -133,7 +133,7 @@ _cidr2netmask() { netmask="${netmask}.${sum}" done=$((${done} + 1)) - while [ ${done} -lt 4 ] ; do + while [ ${done} -lt 4 ]; do netmask="${netmask}.0" done=$((${done} + 1)) done @@ -143,7 +143,7 @@ _cidr2netmask() { } _add_address() { - if [ "$1" = "127.0.0.1/8" -a "${IFACE}" = "lo" ] ; then + if [ "$1" = "127.0.0.1/8" -a "${IFACE}" = "lo" ]; then ifconfig "${IFACE}" "$@" 2>/dev/null return 0 fi @@ -155,7 +155,7 @@ _add_address() { # IPv4 is tricky - ifconfig requires an aliased device # for multiple addresses local iface="${IFACE}" - if LC_ALL=C ifconfig "${iface}" | grep -Eq "\<inet addr:.*" ; then + if LC_ALL=C ifconfig "${iface}" | grep -Eq "\<inet addr:.*"; then # Get the last alias made for the interface and add 1 to it i=$(ifconfig | sed '1!G;h;$!d' | grep -m 1 -o "^${iface}:[0-9]*" \ | sed -n -e 's/'"${iface}"'://p') @@ -172,17 +172,17 @@ _add_address() { fi local arg= cmd= - while [ -n "$1" ] ; do + while [ -n "$1" ]; do case "$1" in brd) - if [ "$2" = "+" ] ; then + if [ "$2" = "+" ]; then shift else cmd="${cmd} broadcast" fi ;; peer) cmd="${cmd} pointtopoint";; - *) cmd="${cmd} $1" ;; + *) cmd="${cmd} $1";; esac shift done @@ -193,15 +193,15 @@ _add_address() { _add_route() { local inet6= - if [ -n "${metric}" ] ; then + if [ -n "${metric}" ]; then set -- "$@" metric ${metric} fi - if [ $# -eq 3 ] ; then + if [ $# -eq 3 ]; then set -- "$1" "$2" gw "$3" - elif [ "$3" = "via" ] ; then + elif [ "$3" = "via" ]; then local one=$1 two=$2 - shift ; shift; shift + shift; shift; shift set -- "${one}" "${two}" gw "$@" fi @@ -218,7 +218,7 @@ _add_route() { _delete_addresses() { # We don't remove addresses from aliases case "${IFACE}" in - *:*) return 0 ;; + *:*) return 0;; esac einfo "Removing addresses" @@ -227,11 +227,11 @@ _delete_addresses() { # iproute2 added addresses cause problems for ifconfig # as we delete an address, a new one appears, so we have to # keep polling - while true ; do + while true; do local addr=$(_get_inet_address) [ -z "${addr}" ] && break - if [ "${addr}" = "127.0.0.1/8" ] ; then + if [ "${addr}" = "127.0.0.1/8" ]; then # Don't delete the loopback address [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] && break fi @@ -242,7 +242,7 @@ _delete_addresses() { # Remove IPv6 addresses local addr= for addr in $(LC_ALL=C ifconfig "${IFACE}" | \ - sed -n -e 's/^.*inet6 addr: \([^ ]*\) Scope:[^L].*/\1/p') ; do + sed -n -e 's/^.*inet6 addr: \([^ ]*\) Scope:[^L].*/\1/p'); do [ "${addr}" = "::1/128" -a "${IFACE}" = "lo" ] && continue einfo "${addr}" ifconfig "${IFACE}" inet6 del "${addr}" |