diff options
Diffstat (limited to 'network-scripts/network-functions')
-rw-r--r-- | network-scripts/network-functions | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/network-scripts/network-functions b/network-scripts/network-functions index 99096bd8..c80467ab 100644 --- a/network-scripts/network-functions +++ b/network-scripts/network-functions @@ -195,25 +195,29 @@ nm_con_load () { array:string:"/etc/sysconfig/network-scripts/${1}" >/dev/null 2>&1 } -ethtool_set() +ethtool_set () { - oldifs=$IFS; - IFS=';'; - if [ -n "${ETHTOOL_DELAY}" ]; then - # Convert microseconds to seconds: - local ETHTOOL_DELAY_SEC=$(convert2sec ${ETHTOOL_DELAY} micro) - sleep ${ETHTOOL_DELAY_SEC} - fi - for opts in $ETHTOOL_OPTS ; do - IFS=$oldifs; - if [[ "${opts}" =~ [[:space:]]*- ]]; then - /sbin/ethtool $opts - else - /sbin/ethtool -s ${REALDEVICE} $opts - fi + if [ -n "${ETHTOOL_OPTS}" ] && [ ! -x /sbin/ethtool ] ; then + net_log "ethtool does not exist or is not executable." warning + else + oldifs=$IFS; IFS=';'; - done - IFS=$oldifs; + if [ -n "${ETHTOOL_DELAY}" ] ; then + # Convert microseconds to seconds: + local ETHTOOL_DELAY_SEC=$(convert2sec ${ETHTOOL_DELAY} micro) + sleep ${ETHTOOL_DELAY_SEC} + fi + for opts in $ETHTOOL_OPTS ; do + IFS=$oldifs; + if [[ "${opts}" =~ [[:space:]]*- ]] ; then + /sbin/ethtool $opts + else + /sbin/ethtool -s ${REALDEVICE} $opts + fi + IFS=';'; + done + IFS=$oldifs; + fi } expand_config () @@ -453,11 +457,16 @@ check_device_down () fi } -check_link_down () +set_link_up () { - if ! LC_ALL=C ip link show dev $1 2>/dev/null| grep -q ",UP" ; then + if [ "$LINKSTATUS" != up ]; then ip link set dev $1 up >/dev/null 2>&1 fi +} + +check_link_down () +{ + set_link_up $1 timeout=0 delay=10 [ -n "$LINKDELAY" ] && delay=$(($LINKDELAY * 2)) @@ -622,6 +631,8 @@ is_bonding_device () # Invoke this when /etc/resolv.conf has changed: change_resolv_conf () { + oldumask=$(umask) + umask 022 s=$(/bin/grep '^[\ \ ]*option' /etc/resolv.conf 2>/dev/null) if [ $# -gt 1 ]; then if [ "x$s" != "x" ]; then @@ -657,6 +668,7 @@ change_resolv_conf () /usr/bin/logger -p local7.notice -t "NET" -i "$0 : updated /etc/resolv.conf" [ -e /run/nscd/socket ] && /usr/sbin/nscd -i hosts # invalidate cache fi + umask "$oldumask" return $r } |