aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rc.d/init.d/netconsole3
-rwxr-xr-xsysconfig/network-scripts/ifdown-routes4
-rwxr-xr-xsysconfig/network-scripts/ifup6
-rwxr-xr-xsysconfig/network-scripts/ifup-aliases3
-rwxr-xr-xsysconfig/network-scripts/ifup-routes6
5 files changed, 15 insertions, 7 deletions
diff --git a/rc.d/init.d/netconsole b/rc.d/init.d/netconsole
index b25fed81..1a6edc82 100644
--- a/rc.d/init.d/netconsole
+++ b/rc.d/init.d/netconsole
@@ -67,7 +67,8 @@ start ()
SYSLOGOPTS=
# syslogd server, if any
if [ -n "$SYSLOGADDR" ]; then
- if ! [[ "$SYSLOGADDR" =~ "^([0-9]{1,3}\.){3}[0-9]{1,3}$" ]]; then
+ MATCH="^([0-9]{1,3}\.){3}[0-9]{1,3}$"
+ if ! [[ "$SYSLOGADDR" =~ $MATCH ]]; then
SYSLOGADDR=$(LANG=C host $SYSLOGADDR 2>/dev/null | awk '/has address / { print $NF }')
fi
fi
diff --git a/sysconfig/network-scripts/ifdown-routes b/sysconfig/network-scripts/ifdown-routes
index fef0ec3b..00e592f7 100755
--- a/sysconfig/network-scripts/ifdown-routes
+++ b/sysconfig/network-scripts/ifdown-routes
@@ -9,6 +9,8 @@ fi
# The routes are actually dropped just by setting the link down, so nothing
# needs to be done
+MATCH='^[[:space:]]*(\#.*)?$'
+
# Routing rules
FILES="/etc/sysconfig/network-scripts/rule-$1"
if [ -n "$2" -a "$2" != "$1" ]; then
@@ -18,7 +20,7 @@ fi
for file in $FILES; do
if [ -f "$file" ]; then
{ cat "$file" ; echo ; } | while read line; do
- if [[ ! "$line" =~ '^[[:space:]]*(\#.*)?$' ]]; then
+ if [[ ! "$line" =~ $MATCH ]]; then
/sbin/ip rule del $line
fi
done
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index 89e963dc..3553f45b 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -68,11 +68,13 @@ fi
# Ethernet 802.1Q VLAN support
if [ -x /sbin/vconfig -a "${VLAN}" = "yes" -a "$ISALIAS" = "no" ]; then
VID=""
- if [[ "${DEVICE}" =~ '^(eth|bond)[0-9]+\.[0-9]{1,4}$' ]]; then
+ MATCH='^(eth|bond)[0-9]+\.[0-9]{1,4}$'
+ if [[ "${DEVICE}" =~ $MATCH ]]; then
VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^[a-z0-9]*\.0*//')
PHYSDEV=${DEVICE%.*}
fi
- if [[ "${DEVICE}" =~ '^vlan[0-9]{1,4}?' ]]; then
+ MATCH='^vlan[0-9]{1,4}?'
+ if [[ "${DEVICE}" =~ $MATCH ]]; then
VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^vlan0*//')
# PHYSDEV should be set in ifcfg-vlan* file
if test -z "$PHYSDEV"; then
diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases
index 8b2dc732..4c03941e 100755
--- a/sysconfig/network-scripts/ifup-aliases
+++ b/sysconfig/network-scripts/ifup-aliases
@@ -167,7 +167,8 @@ function new_interface ()
IPGLOP="${ipa%%.*}_${ipb%%.*}_${ipc%%.*}_${ipc#*.}";
DEVNUM=${DEVICE#*:}
- if (LC_ALL=C; [[ ! "$DEVNUM" =~ '^[0-9A-Za-z_]*$' ]]); then
+ MATCH='^[0-9A-Za-z_]*$'
+ if (LC_ALL=C; [[ ! "$DEVNUM" =~ $MATCH ]]); then
echo $"error in $FILE: invalid alias number" >&2
return 1
fi
diff --git a/sysconfig/network-scripts/ifup-routes b/sysconfig/network-scripts/ifup-routes
index d065aaf9..83a7adc3 100755
--- a/sysconfig/network-scripts/ifup-routes
+++ b/sysconfig/network-scripts/ifup-routes
@@ -26,6 +26,8 @@ if [ -n "$2" -a "$2" != "$1" ]; then
FILES="$FILES /etc/sysconfig/network-scripts/route-$2"
fi
+MATCH='^[[:space:]]*(\#.*)?$'
+
for file in $FILES; do
if [ -f "$file" ]; then
if egrep -q '^[[:space:]]*ADDRESS[0-9]+=' $file ; then
@@ -34,7 +36,7 @@ for file in $FILES; do
else
# older format
{ cat "$file" ; echo ; } | while read line; do
- if [[ ! "$line" =~ '^[[:space:]]*(\#.*)?$' ]]; then
+ if [[ ! "$line" =~ $MATCH ]]; then
/sbin/ip route add $line
fi
done
@@ -58,7 +60,7 @@ fi
for file in $FILES; do
if [ -f "$file" ]; then
{ cat "$file" ; echo ; } | while read line; do
- if [[ ! "$line" =~ '^[[:space:]]*(\#.*)?$' ]]; then
+ if [[ ! "$line" =~ $MATCH ]]; then
/sbin/ip rule add $line
fi
done