diff options
author | Bill Nottingham <notting@redhat.com> | 2011-06-28 14:40:13 -0400 |
---|---|---|
committer | Petr Lautrbach <plautrba@redhat.com> | 2011-08-15 10:22:12 +0200 |
commit | c631361f3ef4857fc322374bdc78ed6388f97f12 (patch) | |
tree | 7dd53b388909d39ec6f31b4654aef105300e926b | |
parent | 9dec8afc7fab4d52b6031491506af043d32abfb1 (diff) | |
download | initscripts-c631361f3ef4857fc322374bdc78ed6388f97f12.tar initscripts-c631361f3ef4857fc322374bdc78ed6388f97f12.tar.gz initscripts-c631361f3ef4857fc322374bdc78ed6388f97f12.tar.bz2 initscripts-c631361f3ef4857fc322374bdc78ed6388f97f12.tar.xz initscripts-c631361f3ef4857fc322374bdc78ed6388f97f12.zip |
Allow non-'-s' options in ETHTOOL_OPTS, and allow multiple option types. (#692410, #693583)
-rwxr-xr-x | sysconfig/network-scripts/ifup-eth | 20 | ||||
-rw-r--r-- | sysconfig/network-scripts/network-functions | 16 |
2 files changed, 20 insertions, 16 deletions
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index d8397602..83333b6e 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -104,9 +104,7 @@ if [ "${SLAVE}" = yes -a "${ISALIAS}" = no -a "${MASTER}" != "" ]; then /sbin/ip link set dev ${DEVICE} down echo "+${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null } - if [ -n "$ETHTOOL_OPTS" ] ; then - /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS - fi + ethtool_set exit 0 fi @@ -163,9 +161,7 @@ if [ -n "${BRIDGE}" -a -x /usr/sbin/brctl ]; then fi /sbin/ip addr flush dev ${DEVICE} 2>/dev/null /sbin/ip link set dev ${DEVICE} up - if [ -n "$ETHTOOL_OPTS" ] ; then - /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS - fi + ethtool_set [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} /usr/sbin/brctl addif ${BRIDGE} ${DEVICE} # Upon adding a device to a bridge, @@ -204,9 +200,7 @@ if [ -n "${DYNCONFIG}" -a -x /sbin/dhclient ]; then exit 1 fi - if [ -n "$ETHTOOL_OPTS" ] ; then - /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS - fi + ethtool_set if /sbin/dhclient ${DHCLIENTARGS} ${DEVICE} ; then echo $" done." @@ -219,9 +213,7 @@ else if [ -z "${IPADDR}" -a -z "${IPADDR0}" -a -z "${IPADDR1}" -a -z "${IPADDR2}" ]; then # enable device without IP, useful for e.g. PPPoE ip link set dev ${REALDEVICE} up - if [ -n "$ETHTOOL_OPTS" ] ; then - /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS - fi + ethtool_set [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} else @@ -235,9 +227,7 @@ else exit 1 fi - if [ -n "$ETHTOOL_OPTS" ] ; then - /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS - fi + ethtool_set [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index c84bb08d..22eb580b 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -147,7 +147,21 @@ source_config () fi } - +ethtool_set() +{ + oldifs=$IFS; + IFS=';'; + 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; +} expand_config () { |