Bug 519535

Summary: ifup script assumes -s option for any ETHTOOL_OPTS settings.
Product: Red Hat Enterprise Linux 5 Reporter: John Hanks <griznog>
Component: initscriptsAssignee: initscripts Maintenance Team <initscripts-maint-list>
Status: CLOSED WONTFIX QA Contact: BaseOS QE <qe-baseos-auto>
Severity: low Docs Contact:
Priority: low    
Version: 5.3CC: abd4arraafi, notting
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-08-27 03:11:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Description Flags
Add additional ETHTOOL_OPTS_* options to ifup script. none

Description John Hanks 2009-08-27 00:00:46 UTC
Description of problem:

I'm trying to use ETHTOOL_OPTS in /etc/sysconfig/network-scripts/ifcfg-eth1
to disable tcp offload using this value:

ETHTOOL_OPTS="-K eth1 tso off"

This fails because the ifup script assumes any options passed to ethtool
will be arguments of the "-s" option:

[root@perceus network-scripts]# grep ETHTOOL *
ifcfg-eth1:ETHTOOL_OPTS="-K eth1 tso off"
ifup-eth:    if [ -n "$ETHTOOL_OPTS" ] ; then
ifup-eth:        /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
ifup-eth:    if [ -n "$ETHTOOL_OPTS" ] ; then
ifup-eth:        /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
ifup-eth:        if [ -n "$ETHTOOL_OPTS" ] ; then
ifup-eth:               /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
ifup-eth:    if [ -n "$ETHTOOL_OPTS" ] ; then
ifup-eth:        /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS

Version-Release number of selected component (if applicable):

initscripts-8.45.25 (CentOS 5.3)
initscripts-8.95 (Fedora 11)

How reproducible:

Setting any option other than those for the -s flag of ethtool causes ethtool to silently (AFAICT) fail.

Steps to Reproduce:
1. Add any non -s options to ETHTOOL_OPTS
2. Restart network
3. Examine device settings with ethtool
Actual results:

   No settings change.

Expected results:

   Settings change to match ETHTOOL_OPTS

Additional info:

This is simple enough to workaround by placing an ethtool line in /etc/rc.local for extra device changes, but it would be nice for the sake of consistency if all ethtool options could be specified in one place and activated by the network startup scripts (not necessarily the ifcfg-$device file, it just happens to be the current documented place.)

Comment 1 John Hanks 2009-08-27 01:40:59 UTC
Created attachment 358796 [details]
Add additional ETHTOOL_OPTS_* options to ifup script.

This patch adds handling for 4 new variables in the ifcfg-eth* file:


If ETHTOOL_OPTS is defined, then the script behaves in the classic manner, passing those options to 'ethtool -s'. If ETHTOOL_OPTS is not defined, then the 4 new variables are checked and for each one that is defined, ethtool is called with the appropriate flag and the ETHTOOL_OPTS_* settings. So that for my case the following in ifcfg-eth1,


would result in 

ethtool -K eth1 tso off

I have only lightly tested this patch on one server, mainly for syntax, with the ETHTOOL_OPTS_OFFLOAD variable set, no bonding or any other special networking configurations. Just throwing out a possible idea for adding the functionality without breaking backward compatibility.

Comment 2 Bill Nottingham 2009-08-27 03:11:48 UTC
ethtool tweaking is the sort of device-specific configuration that really should be udev rules. For example, a sample /etc/udev/rules.d/50-ethtool.rules:

ACTION=="add", SUBSYSTEM=="net", NAME=="eth0", RUN+="/sbin/ethtool <your opts here>"

Since the base ETHTOOL_OPTS predates udev for device-specific configuration, we'll keep it around. But I'd prefer not to extend it any more.

Comment 3 Shatil Rafiullah 2013-10-30 00:33:43 UTC
Could we revisit this, please? 

RHEL6 correctly parses ETHTOOL_OPTS in the ifcfg-eth* files, but RHEL5 does not. 

Compare the OP's details to RHEL6 network-functions script: 
mock6 network-scripts]$ grep -A 8 ETHTOOL_OPTS *
network-functions:    for opts in $ETHTOOL_OPTS ; do
network-functions-	IFS=$oldifs;
network-functions-        if [[ "${opts}" =~ [[:space:]]*- ]]; then
network-functions-	    /sbin/ethtool $opts
network-functions-        else
network-functions-	    /sbin/ethtool -s ${REALDEVICE} $opts
network-functions-        fi
network-functions-	IFS=';';
network-functions-    done 

Could we have the behavior match?