aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Macku <jamacku@redhat.com>2020-08-12 13:51:22 +0200
committerGitHub <noreply@github.com>2020-08-12 13:51:22 +0200
commit1ec2149386beca68792496b600a5cf71f4a36709 (patch)
tree49f585c4cdc04939e0c69489cfe81db2cd399d15
parentfc6164b75090f03eed7504195d1fa9f0915ea862 (diff)
downloadinitscripts-1ec2149386beca68792496b600a5cf71f4a36709.tar
initscripts-1ec2149386beca68792496b600a5cf71f4a36709.tar.gz
initscripts-1ec2149386beca68792496b600a5cf71f4a36709.tar.bz2
initscripts-1ec2149386beca68792496b600a5cf71f4a36709.tar.xz
initscripts-1ec2149386beca68792496b600a5cf71f4a36709.zip
Add warning to warn user when ETHTOOL_OPTS is set and ethtool binary is missing - Olav Vitters
-rw-r--r--network-scripts/network-functions38
1 files changed, 21 insertions, 17 deletions
diff --git a/network-scripts/network-functions b/network-scripts/network-functions
index 332115b8..42d01f31 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 ()