summaryrefslogtreecommitdiffstats
path: root/rc.inet1
diff options
context:
space:
mode:
Diffstat (limited to 'rc.inet1')
-rw-r--r--rc.inet130
1 files changed, 15 insertions, 15 deletions
diff --git a/rc.inet1 b/rc.inet1
index b0ffb9a..c1df7a3 100644
--- a/rc.inet1
+++ b/rc.inet1
@@ -47,7 +47,7 @@ i=0
while [ $i -lt $MAXNICS ];
do
IFNAME[$i]=${IFNAME[$i]:=eth${i}}
- i=$(($i+1))
+ i=$((i+1))
done
debug_log "List of interfaces: ${IFNAME[*]}"
@@ -235,7 +235,7 @@ if_up() {
i=0
while [ $i -lt $MAXNICS ]; do
[ "${IFNAME[$i]}" = "${1}" ] && break
- i=$(($i+1))
+ i=$((i+1))
done
# If "i" is greater or equal to "MAXNICS" at this point, it means we didn't
# find an entry in IFNAME array corresponding to "${1}", which likely means
@@ -388,7 +388,7 @@ if_up() {
/sbin/ip -6 address show dynamic dev ${1} 2>/dev/null | grep -Ewq 'inet6' && { IF_UP=1; break; }
sleep 0.5
done
- if (($IF_UP != 1)); then
+ if ((IF_UP != 1)); then
echo "${1}: timed out"
info_log "${1}: failed to auto configure after ${SLAAC_TIMEOUT[$i]} seconds"
debug_log "/sbin/ip address flush dev ${1}"
@@ -422,7 +422,7 @@ if_up() {
IF_UP=1
else
info_log "${1}: failed to set IP $IP"
- if (($IF_UP != 1)); then # a v4 address was configured, don't flush it
+ if ((IF_UP != 1)); then # a v4 address was configured, don't flush it
debug_log "/sbin/ip address flush dev ${1}"
/sbin/ip address flush dev ${1}
debug_log "/sbin/ip link set dev ${1} down"
@@ -434,7 +434,7 @@ if_up() {
debug_log "${1}: resetting IPv6 DAD to default"
cat /proc/sys/net/ipv6/conf/default/accept_dad >/proc/sys/net/ipv6/conf/${1}/accept_dad
fi
- if [ -n "IPADDRS[$i]" ] || [ -n "IPADDR[$i]" ]; then # add v4 IPs
+ if [ -n "${IPADDRS[$i]}" ] || [ -n "${IPADDR[$i]}" ]; then # add v4 IPs
info_log "${1}: setting IPv4 addresses"
# Only use IPADDR if no dynamic configuration was done.
if [ "${USE_DHCP[$i]}" == "yes" ] || [ "${USE_DHCP6[$i]}" == "yes" ] || [ "${USE_SLAAC[$i]}" == "yes" ]; then
@@ -454,7 +454,7 @@ if_up() {
IF_UP=1
else
info_log "${1}: failed to set IP $IP"
- if (($IF_UP != 1)); then # if at least one address was configured, don't flush the device
+ if ((IF_UP != 1)); then # if at least one address was configured, don't flush the device
debug_log "/sbin/ip address flush dev ${1}"
/sbin/ip address flush dev ${1}
debug_log "/sbin/ip link set dev ${1} down"
@@ -463,7 +463,7 @@ if_up() {
fi
done
fi
- if (($IF_UP == 1)) && [ -n "${IPALIASES[$i]}" ]; then # Only apply IPALIASES onto an up interface
+ if ((IF_UP == 1)) && [ -n "${IPALIASES[$i]}" ]; then # Only apply IPALIASES onto an up interface
info_log "${1}: setting extra IPv4 addresses"
NUM=0
for EXTRAIP in ${IPALIASES[$i]}; do
@@ -475,13 +475,13 @@ if_up() {
fi
debug_log "/sbin/ip -4 address add $IP/$NM broadcast + dev ${1} label ${1}:$NUM"
if /sbin/ip -4 address add $IP/$NM broadcast + dev ${1} label ${1}:$NUM; then
- NUM=$(($NUM + 1))
+ NUM=$((NUM + 1))
else
info_log "${1}: failed to add alias IP $IP"
fi
done
fi
- if (($IF_UP == 1)); then
+ if ((IF_UP == 1)); then
# Force an MTU (possibly overriding that set by DHCP or RA):
if [ -n "${MTU[$i]}" ]; then
info_log "${1}: setting custom MTU"
@@ -513,7 +513,7 @@ if_down() {
i=0
while [ $i -lt $MAXNICS ]; do
[ "${IFNAME[$i]}" = "${1}" ] && break
- i=$(($i+1))
+ i=$((i+1))
done
if [ $i -ge $MAXNICS ]; then
info_log "${1}: skipping - you might need to increase MAXNICS"
@@ -525,12 +525,12 @@ if_down() {
info_log "${1}: stopping dhcpcd"
# When using -k, dhcpcd requires some command line options to match those used to invoke it:
if [ "${USE_DHCP[$i]}" = "yes" ] && [ "${USE_DHCP6[$i]}" != "yes" ]; then # only v4 dhcp
- DHCP_OPTIONS="-4"
+ DHCP_OPTIONS=( -4 )
elif [ "${USE_DHCP[$i]}" != "yes" ] && [ "${USE_DHCP6[$i]}" = "yes" ]; then # only v6 dhcp
- DHCP_OPTIONS="-6"
+ DHCP_OPTIONS=( -6 )
fi
- debug_log "/sbin/dhcpcd $DHCP_OPTIONS -k -d ${1}"
- /sbin/dhcpcd $DHCP_OPTIONS -k -d ${1} 2>/dev/null || info_log "${1}: failed to stop dhcpcd"
+ debug_log "/sbin/dhcpcd ${DHCP_OPTIONS[*]} -k -d ${1}"
+ /sbin/dhcpcd "${DHCP_OPTIONS[*]}" -k -d ${1} 2>/dev/null || info_log "${1}: failed to stop dhcpcd"
fi
# Disable v6 IP auto configuration and RA before trying to clear the IP from the interface:
if [ -e /proc/sys/net/ipv6 ]; then
@@ -625,7 +625,7 @@ start() {
stop() {
echo "Stopping the network interfaces..."
gateway_down
- for (( i = $MAXNICS - 1; i >= 0; i-- )); do
+ for (( i = MAXNICS - 1; i >= 0; i-- )); do
if_down ${IFNAME[$i]}
done
virtif_destroy