summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-scripts/net.modules.d/ifconfig')
-rw-r--r--net-scripts/net.modules.d/ifconfig30
1 files changed, 15 insertions, 15 deletions
diff --git a/net-scripts/net.modules.d/ifconfig b/net-scripts/net.modules.d/ifconfig
index a7bbff8..966f817 100644
--- a/net-scripts/net.modules.d/ifconfig
+++ b/net-scripts/net.modules.d/ifconfig
@@ -40,7 +40,7 @@ ifconfig_check_installed() {
#
# Returns 1 if the interface exists, otherwise 0
ifconfig_exists() {
- local e=$( ifconfig -a | grep -o "^$1" ) report="${2:-false}"
+ local e="$(ifconfig -a | grep -o "^$1")" report="${2:-false}"
[[ -n ${e} ]] && return 0
if ${report} ; then
@@ -93,7 +93,7 @@ ifconfig_set_flag() {
ifconfig_get_address() {
local -a x=( $( ifconfig "$1" \
| sed -n -e 's/.*inet addr:\([^ ]*\).*Mask:\([^ ]*\).*/\1 \2/p' ) )
- x[1]=$( netmask2cidr "${x[1]}" )
+ x[1]="$(netmask2cidr "${x[1]}")"
[[ -n ${x[0]} ]] && echo "${x[0]}/${x[1]}"
}
@@ -108,8 +108,8 @@ ifconfig_is_ethernet() {
#
# Fetch the mac address assingned to the network card
ifconfig_get_mac_address() {
- local mac=$( ifconfig "$1" | sed -n -e \
- 's/.*HWaddr[ \t]*\<\(..:..:..:..:..:..\)\>.*/\U\1/p' )
+ local mac="$(ifconfig "$1" | sed -n -e \
+ 's/.*HWaddr[ \t]*\<\(..:..:..:..:..:..\)\>.*/\U\1/p')"
[[ ${mac} != '00:00:00:00:00:00' \
&& ${mac} != '44:44:44:44:44:44' \
&& ${mac} != 'FF:FF:FF:FF:FF:FF' ]] \
@@ -131,7 +131,7 @@ ifconfig_set_name() {
[[ -z $2 ]] && return 1
local current="$1" new="$2"
- local mac=$( ifconfig_get_mac_address "${current}" )
+ local mac="$(ifconfig_get_mac_address "${current}")"
if [[ -z ${mac} ]]; then
eerror "${iface} does not have a MAC address"
return 1
@@ -185,7 +185,7 @@ ifconfig_del_addresses() {
#
# Returns config and config_fallback for the given interface
ifconfig_get_old_config() {
- local iface="$1" ifvar=$( bash_variable "$1" ) i inet6
+ local iface="$1" ifvar="$(bash_variable "$1")" i inet6
config="ifconfig_${ifvar}[@]"
config=( "${!config}" )
@@ -256,7 +256,7 @@ ifconfig_pre_start() {
interface_exists "${iface}" || return 0
- local ifvar=$( bash_variable "$1" ) mtu
+ local ifvar="$(bash_variable "$1")" mtu
# MTU support
mtu="mtu_${ifvar}"
@@ -275,7 +275,7 @@ ifconfig_pre_start() {
# fail, the routine should still return success to indicate that
# net.eth0 was successful
ifconfig_post_start() {
- local iface="$1" ifvar=$( bash_variable "$1" ) routes x metric mtu cidr
+ local iface="$1" ifvar="$(bash_variable "$1")" routes x metric mtu cidr
metric="metric_${ifvar}"
ifconfig_exists "${iface}" || return 0
@@ -338,7 +338,7 @@ ifconfig_post_start() {
#
# Adds the given address to the interface
ifconfig_add_address() {
- local iface="$1" i=0 r e real_iface=$(interface_device "$1")
+ local iface="$1" i=0 r e real_iface="$(interface_device "$1")"
ifconfig_exists "${real_iface}" true || return 1
@@ -354,8 +354,8 @@ ifconfig_add_address() {
# for multiple addresses
if ifconfig "${iface}" | grep -Eq "\<inet addr:.*" ; then
# Get the last alias made for the interface and add 1 to it
- i=$( ifconfig | tac | grep -m 1 -o "^${iface}:[0-9]*" \
- | sed -n -e 's/'"${iface}"'://p' )
+ i="$(ifconfig | tac | grep -m 1 -o "^${iface}:[0-9]*" \
+ | sed -n -e 's/'"${iface}"'://p')"
i="${i:-0}"
(( i++ ))
iface="${iface}:${i}"
@@ -364,7 +364,7 @@ ifconfig_add_address() {
# ifconfig doesn't like CIDR addresses
local ip="${config[0]%%/*}" cidr="${config[0]##*/}" netmask
if [[ -n ${cidr} && ${cidr} != "${ip}" ]]; then
- netmask=$( cidr2netmask "${cidr}" )
+ netmask="$(cidr2netmask "${cidr}")"
config[0]="${ip} netmask ${netmask}"
fi
@@ -387,7 +387,7 @@ ifconfig_add_address() {
r="$?"
[[ ${r} != "0" ]] && return ${r}
- local metric ifvar=$(bash_variable "${real_iface}")
+ local metric ifvar="$(bash_variable "${real_iface}")"
# Remove the newly added route and replace with our metric
metric="metric_${ifvar}"
[[ ${!metric:-0} == "0" ]] && return ${r}
@@ -396,14 +396,14 @@ ifconfig_add_address() {
for (( i=1; i<${#config[@]}-1; i++ )); do
if [[ ${config[i]} == "netmask" ]]; then
netmask="${config[i+1]}"
- cidr=$( netmask2cidr "${netmask}" )
+ cidr="$(netmask2cidr "${netmask}")"
break
fi
done
[[ -z ${netmask} ]] && return ${r}
fi
- local network=$( ip_network "${ip}" "${netmask}" )
+ local network="$(ip_network "${ip}" "${netmask}")"
if route del -net "${network}/${cidr}" metric 0 dev "${iface}" \
2>/dev/null ; then