aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig/network-scripts')
-rwxr-xr-xsysconfig/network-scripts/ifdown-ipv64
-rwxr-xr-xsysconfig/network-scripts/ifdown-sit2
-rwxr-xr-xsysconfig/network-scripts/ifup-ipv610
-rwxr-xr-xsysconfig/network-scripts/ifup-ipx2
-rwxr-xr-xsysconfig/network-scripts/ifup-sit4
-rw-r--r--sysconfig/network-scripts/network-functions5
-rw-r--r--sysconfig/network-scripts/network-functions-ipv612
7 files changed, 19 insertions, 20 deletions
diff --git a/sysconfig/network-scripts/ifdown-ipv6 b/sysconfig/network-scripts/ifdown-ipv6
index 9f04531a..51c4028f 100755
--- a/sysconfig/network-scripts/ifdown-ipv6
+++ b/sysconfig/network-scripts/ifdown-ipv6
@@ -46,7 +46,7 @@ CONFIG=$1
source_config
# IPv6 don't need aliases anymore, config is skipped
-REALDEVICE=$(echo ${DEVICE} | sed 's/:.*//g')
+REALDEVICE=${DEVICE%%:*}
[ "$DEVICE" != "$REALDEVICE" ] && exit 0
[ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1
@@ -120,7 +120,7 @@ if [ "$valid6to4config" = "yes" ]; then
if [ -n "$IPV6TO4_ROUTING" ]; then
# Delete routes to local networks
for devsuf in $IPV6TO4_ROUTING; do
- dev="$(echo $devsuf | awk -F- '{ print $1 }')"
+ dev="${devsuf%%-*}"
ipv6_cleanup_6to4_device $dev
done
fi
diff --git a/sysconfig/network-scripts/ifdown-sit b/sysconfig/network-scripts/ifdown-sit
index 041dc3cd..314b91f1 100755
--- a/sysconfig/network-scripts/ifdown-sit
+++ b/sysconfig/network-scripts/ifdown-sit
@@ -28,7 +28,7 @@ CONFIG=$1
source_config
# IPv6 don't need aliases anymore, config is skipped
-REALDEVICE=$(echo ${DEVICE} | sed 's/:.*//g')
+REALDEVICE=${DEVICE%%:*}
[ "$DEVICE" != "$REALDEVICE" ] && exit 0
[ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1
diff --git a/sysconfig/network-scripts/ifup-ipv6 b/sysconfig/network-scripts/ifup-ipv6
index da1062ec..6f104dc5 100755
--- a/sysconfig/network-scripts/ifup-ipv6
+++ b/sysconfig/network-scripts/ifup-ipv6
@@ -63,7 +63,7 @@ CONFIG=$1
source_config
# IPv6 don't need aliases anymore, config is skipped
-REALDEVICE=$(echo ${DEVICE} | sed 's/:.*//g')
+REALDEVICE=${DEVICE%%:*}
[ "$DEVICE" != "$REALDEVICE" ] && exit 0
# Test whether IPv6 configuration is enabled for this interface, else stop
@@ -162,7 +162,7 @@ fi
# Setup additional static IPv6 routes (newer config style)
if [ -f "/etc/sysconfig/network-scripts/route6-$DEVICE" ]; then
- cat "/etc/sysconfig/network-scripts/route6-$DEVICE" | sed 's/#.*//g' | grep -v '^[[:space:]]*$' | while read line; do
+ sed -ne 's/#.*//' -e '/[^[:space:]]/p' "/etc/sysconfig/network-scripts/route6-$DEVICE" | while read line; do
/sbin/ip -6 route add $line
done
fi
@@ -222,7 +222,7 @@ if [ "$IPV6TO4INIT" = "yes" ]; then
# Setup 6to4 tunnel (hardwired name is "tun6to4"), if config is valid
if [ "$valid6to4config" = "yes" ]; then
# Get MTU of master device
- ipv4mtu="$(/sbin/ip link show dev $DEVICE | grep -w "mtu" | awk '{ print $5 }')"
+ ipv4mtu="$(/sbin/ip link show dev $DEVICE | awk '/\<mtu\>/ { print $5 }')"
if [ -n "$ipv4mtu" ]; then
# IPv6 tunnel MTU is IPv4 MTU minus 20 for IPv4 header
tunnelmtu=$(($ipv4mtu-20))
@@ -264,7 +264,7 @@ if [ "$IPV6TO4INIT" = "yes" ]; then
# Setup additional static IPv6 routes (newer config style)
if [ -f "/etc/sysconfig/network-scripts/route6-tun6to4" ]; then
- cat "/etc/sysconfig/network-scripts/route6-tun6to4" | sed 's/#.*//g' | LC_ALL=C grep -v '^[[:space:]]*$' | while read line; do
+ sed -ne 's/#.*//' -e '/[^[:space:]]/p' /etc/sysconfig/network-scripts/route6-tun6to4 | while read line; do
if echo "$line" | LC_ALL=C grep -vq 'via'; then
# Add gateway if missing
line="$line via $ipv6to4_relay"
@@ -288,7 +288,7 @@ if [ "$IPV6TO4INIT" = "yes" ]; then
if [ -n "$ipv6to4prefix" ]; then
# Add route to local networks
for devsuf in $IPV6TO4_ROUTING; do
- dev="$(echo $devsuf | awk -F- '{ print $1 }')"
+ dev="${devsuf%%-*}"
suf="$(echo $devsuf | awk -F- '{ print $2 }')"
ipv6_add_addr_on_device ${dev} ${ipv6to4prefix}${suf}
done
diff --git a/sysconfig/network-scripts/ifup-ipx b/sysconfig/network-scripts/ifup-ipx
index a5693cfe..dbd294a8 100755
--- a/sysconfig/network-scripts/ifup-ipx
+++ b/sysconfig/network-scripts/ifup-ipx
@@ -23,7 +23,7 @@ CONFIG=$1
source_config
for frametype in 802.2 802.3 ETHERII SNAP ; do
- framename=$(echo $frametype | sed 's/\./_/')
+ framename=${frametype/./_}
eval ACT=\$IPXACTIVE_$framename
case $ACT in
yes|true)
diff --git a/sysconfig/network-scripts/ifup-sit b/sysconfig/network-scripts/ifup-sit
index f593a677..6d1a8c79 100755
--- a/sysconfig/network-scripts/ifup-sit
+++ b/sysconfig/network-scripts/ifup-sit
@@ -40,7 +40,7 @@ CONFIG=$1
source_config
# IPv6 don't need aliases anymore, config is skipped
-REALDEVICE=$(echo ${DEVICE} | sed 's/:.*//g')
+REALDEVICE=${DEVICE%%:*}
[ "$DEVICE" != "$REALDEVICE" ] && exit 0
# Test whether IPv6 configuration is enabled for this interface, else stop
@@ -106,7 +106,7 @@ fi
# Setup additional static IPv6 routes (newer config style)
if [ -f "/etc/sysconfig/network-scripts/route6-$REALDEVICE" ]; then
- cat "/etc/sysconfig/network-scripts/route6-$REALDEVICE" | sed 's/#.*//g' | grep -v '^[[:space:]]*$' | while read line; do
+ sed -ne 's/#.*//' -e '/[^[:space:]]/p' "/etc/sysconfig/network-scripts/route6-$REALDEVICE" | while read line; do
/sbin/ip -6 route add $line
done
fi
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 562fe7cb..0d2528ee 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -51,7 +51,7 @@ get_config_by_name ()
get_device_by_hwaddr ()
{
- LANG=C ip -o link | grep -v link/ieee802.11 | awk -F ': ' -vIGNORECASE=1 "/$1/ { print \$2 }"
+ LANG=C ip -o link | awk -F ': ' -vIGNORECASE=1 '!/link\/ieee802\.11/ && /'"$1"'/ { print $2 }'
}
get_uuid_by_config ()
@@ -207,9 +207,8 @@ do_netreport ()
( cd /var/run/netreport || exit
for i in * ; do
if [ -f $i ]; then
- OWNER=$(ls -l $i | awk '{ print $3 }')
-
if [ "$(id -u)" = "0" ]; then
+ OWNER=$(stat -c %U $i)
su -s /bin/bash $OWNER -c "kill -SIGIO $i >/dev/null 2>&1 || rm -f $i >/dev/null 2>&1" > /dev/null 2>&1
else
kill -SIGIO $i >/dev/null 2>&1 || rm -f $i >/dev/null 2>&1
diff --git a/sysconfig/network-scripts/network-functions-ipv6 b/sysconfig/network-scripts/network-functions-ipv6
index 24100cba..64b9b593 100644
--- a/sysconfig/network-scripts/network-functions-ipv6
+++ b/sysconfig/network-scripts/network-functions-ipv6
@@ -322,7 +322,7 @@ ipv6_add_addr_on_device() {
# Extract address parts
local prefixlength_implicit="$(echo $address | awk -F/ '{ print $2 }')"
- local address_implicit="$(echo $address | awk -F/ '{ print $1 }')"
+ local address_implicit="${address%%/*}"
# Check prefix length and using '64' as default
if [ -z "$prefixlength_implicit" ]; then
@@ -389,7 +389,7 @@ ipv6_cleanup_6to4_device() {
ipv6_test testonly || return 2
# Cleanup 6to4 addresses on this device
- /sbin/ip -6 addr show dev $dev scope global permanent | LC_ALL=C grep -w inet6 | awk '{ print $2}' | LC_ALL=C grep "^2002:" | while read addr; do
+ /sbin/ip -6 addr show dev $dev scope global permanent | awk '/\<inet6\>/ && $2 ~ /^2002:/ { print $2 }' | while read addr; do
/sbin/ip -6 addr del ${addr} dev ${dev}
done
@@ -496,7 +496,7 @@ ipv6_create_6to4_prefix() {
ipv6_log $"Missing parameter 'IPv4 address' (arg 1)" stderr.err $fn
fi
- local major1="$(echo $ipv4addr | awk -F. '{ print $1 }')"
+ local major1="${ipv4addr%%.*}"
local minor1="$(echo $ipv4addr | awk -F. '{ print $2 }')"
local major2="$(echo $ipv4addr | awk -F. '{ print $3 }')"
local minor2="$(echo $ipv4addr | awk -F. '{ print $4 }')"
@@ -654,7 +654,7 @@ ipv6_cleanup_6to4_tunnels() {
ipv6_del_tunnel_device tun6to4
# Remove all unspecific unreachable routes for local 6to4 address space
- /sbin/ip -6 route | LC_ALL=C grep "^unreachable 2002:" | LC_ALL=C grep "/48 dev lo" | while read token net rest; do
+ /sbin/ip -6 route | LC_ALL=C grep "^unreachable 2002:.*/48 dev lo" | while read token net rest; do
/sbin/ip route del unreach $net
done
@@ -831,7 +831,7 @@ ipv6_cleanup_tunnel_devices() {
# Find still existing tunnel devices and shutdown and delete them
- /sbin/ip tunnel show | LC_ALL=C grep -w "ipv6/ip" | awk -F: '{ print $1 }' | while read device; do
+ /sbin/ip tunnel show | awk -F: '/\<ipv6\/ip\>/ { print $1 }' | while read device; do
ipv6_del_tunnel_device $device
done
@@ -987,7 +987,7 @@ ipv6_set_default_route() {
fi
if [ -n "$address" ]; then
- local addressgw=$(echo $address | awk -F% '{ print $1 }')
+ local addressgw=${address%%%*}
local device_scope=$(echo $address | awk -F% '{ print $2 }')
if [ -z "$addressgw" ]; then