Bug 10623 - No consideration of options (ETHTOOL_OPTS ) for the NIC by the network scripts
Summary: No consideration of options (ETHTOOL_OPTS ) for the NIC by the network scripts
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 2
Hardware: All Linux
Priority: High major
Target Milestone: Mageia 2
Assignee: Dan Fandrich
QA Contact:
URL:
Whiteboard: has_procedure
Keywords: Triaged
Depends on:
Blocks:
 
Reported: 2013-06-26 12:33 CEST by Franck BOUIJOUX
Modified: 2013-08-18 15:22 CEST (History)
7 users (show)

See Also:
Source RPM: initscripts-9.34-20.mga2.rpm
CVE:
Status comment:


Attachments

Description Franck BOUIJOUX 2013-06-26 12:33:56 CEST
Description of problem:

When I want to give parameters to the NIC (ETHTOOL_OPTS), these are not taken into account by the ifup and ifdown network scripts. (Ditto for the network startup script).

In the function ethtool_set line 153 in the file </etc/sysconfig/network-scripts/network-functions> launching the ethtool command is performed in absolute path /sbin/ethtool whereas the command is present only in /usr/sbin/ethtool.

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;
}


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


How reproducible:

Every time I attempt to add NIC PARAMETERS and use network scripts.

Steps to Reproduce:
1.add  <ETHTOOL_OPTS="autoneg off speed 100 duplex full"> in /etc/sysconfig/network-scripts/ifcfg-eth0
2. <ifdown eth0> and <ifup eth0> or service network restart 
3. see the rejection

Note that the ethtool command works with  <ethtool -s eth0 autoneg off> or other  parameters.    

Reproducible: 

Steps to Reproduce:
Franck BOUIJOUX 2013-06-26 18:04:57 CEST

CC: (none) => 3abtux

Manuel Hiebel 2013-07-03 09:59:06 CEST

Keywords: (none) => Triaged
CC: (none) => mageia

Comment 1 rexy 2013-07-05 00:16:20 CEST
I confirm this bug.

The solution is to rewrite the two calls to "ethtool" at lines 160 and 162 ("/usr/sbin/ethtool" insteed of "/sbin/ethtool")

CC: (none) => richard

Comment 2 crox 2013-07-05 18:17:55 CEST
I confirm this bug too!

The problem is indeed a wrong path at lines 160 and 162 in the conf file to reach the ethtool binary : /etc/sysconfig/network-functions

CC: (none) => crox53

Comment 3 rexy 2013-07-06 07:47:52 CEST
I confirm also that this bug is also present in Mageia3.

Priority: Normal => High
Hardware: x86_64 => All
Version: 2 => 3
Target Milestone: --- => Mageia 3
Source RPM: initscripts-9.34-20.mga2.src.rpm => initscripts-9.34-20.mga2.rpm initscripts-9.41-14.mga3

Comment 4 crox 2013-07-08 09:49:55 CEST
And is still present in Cauldron ...
claire robinson 2013-07-08 11:11:06 CEST

CC: (none) => mageia

Comment 5 claire robinson 2013-07-08 11:22:58 CEST
Could you please show the output of 

# ll -d /sbin

It should be a symlink to /usr/sbin

CC: (none) => eeeemail

Comment 6 rexy 2013-07-08 23:08:00 CEST
Indeed on mageia3 :
$ cat /etc/version 
3 1 cauldron
$ ll -d /sbin
lrwxrwxrwx 1 root root 8 mai   25 00:30 /sbin -> usr/sbin/

But not on mageia2
$ cat /etc/version 
2 4 cauldron
$ ls -d /sbin
/sbin/

The need of fix is only for mageia2

Version: 3 => 2
Target Milestone: Mageia 3 => Mageia 2

Comment 7 claire robinson 2013-07-09 08:21:11 CEST
May sound silly but do you have ethtool installed ?

$ rpm -q ethtool

Mageia 2 had a legacy /sbin directory which was moved, along with /bin & /lib(64), into /usr as part of the /usrmove feature for Mageia 3.
https://wiki.mageia.org/en/Feature:UsrMove
Comment 8 crox 2013-07-09 15:45:17 CEST
May not :  
---------------------------
>> rpm -qil ethtool
Name        : ethtool
Epoch       : 1
Version     : 3.2
Release     : 1.mga2
Architecture: x86_64
Install Date: mer. 12 juin 2013 09:55:51 CEST
Group       : System/Configuration/Networking
Size        : 234868
License     : GPL
Signature   : RSA/SHA1, dim. 19 févr. 2012 04:23:11 CET, Key ID b742fa8b80420f66
Source RPM  : ethtool-3.2-1.mga2.src.rpm
Build Date  : dim. 19 févr. 2012 04:22:02 CET
Build Host  : jonund.mageia.org
Relocations : (not relocatable)
Packager    : luigiwalser <luigiwalser>
Vendor      : Mageia.Org
URL         : https://ftp.kernel.org/pub/software/network/ethtool/
Summary     : Ethernet settings tool for network cards
Description :
This utility allows querying and changing of ethernet
card settings, such as speed, port, and autonegotiation.
/usr/sbin/ethtool
/usr/share/doc/ethtool
/usr/share/doc/ethtool/AUTHORS
/usr/share/doc/ethtool/NEWS
/usr/share/man/man8/ethtool.8.xz
---------------

>> grep ethtool /etc/sysconfig/network-scripts/network-functions
ethtool_set()
	    /sbin/ethtool $opts
	    /sbin/ethtool -s ${REALDEVICE} $opts
-----------------
>>ls -ld /sbin/
drwxr-xr-x 2 root root 4096 juil.  9 15:09 /sbin/
Dan Fandrich 2013-07-23 08:48:12 CEST

CC: (none) => dan
Assignee: bugsquad => dan

Comment 9 Dan Fandrich 2013-07-24 09:26:50 CEST
I've checked in a fix for this to the Mageia 2 branch, but haven't submitted it to the build system. There are a number of other initscripts bugs open right now, and it would be nice to push some of those fixes at the same time.

Here's a QA test case (it assumes eth0 is the Ethernet device in use on the computer under test):

Run this to baseline the Ethernet settings:
  ethtool eth0 2>/dev/null |grep Duplex

It should say:
        Duplex: Full

If not, the test case isn't going to be valid on this computer. Now run:

  sudo sh -c 'echo ETHTOOL_OPTS=\"duplex half\" >> /etc/sysconfig/network-scripts/ifcfg-eth0'

and test the old initscripts by bringing the network device down then back up:

  sudo ifdown eth0; sudo ifup eth0

You should see the following error, confirming this bug:

Determining IP information for eth0..../network-functions: line 162: /sbin/ethtool: No such file or directory

The duplex setting won't have changed:

  ethtool eth0 2>/dev/null |grep Duplex

will still say:
        Duplex: Full

Now, install the fixed RPM and do the above again. The final result should be either:

        Duplex: Half

showing that the settings are working, or, if the Ethernet configuration doesn't support half duplex, the result after bringing the network up again will be:

Determining IP information for eth3...Cannot advertise duplex half
 done.

Either result is correct and proves the fix works. Undo the changes once the test is complete by running the following:

  sudo sh -c 'echo ETHTOOL_OPTS=\"duplex full\" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
  sudo ifdown eth0; sudo ifup eth0
  sudo sed -i /^ETHTOOL_OPTS/d /etc/sysconfig/network-scripts/ifcfg-eth0

Whiteboard: (none) => has_procedure

Comment 10 rexy 2013-07-26 18:43:12 CEST
Where is the "fixed RPM" you are speaking about ?
I can't see it on "distrib/2/x86_64/media/core/updates_testing/" repository.
Comment 11 Dan Fandrich 2013-07-26 20:59:28 CEST
I very carefully didn't say "fixed RPM", but rather "haven't submitted it to the build system". I wanted to gather a few more initscripts patches that have been languishing first. I think I've now gathered the ones that are ready, but I'll double check first and probably submit a fixed RPM in a day or two.
Comment 12 Dan Fandrich 2013-08-03 00:56:56 CEST
initscripts-9.34-20.1.mga2 is in updates_testing and available to test.
Comment 13 rexy 2013-08-18 15:22:31 CEST
The "initscripts-9.34-20.2.mga2" RPM available on "distrib/2/x86_64/media/core/updates" repository resolv this bug. Thanks Dan.

Status: NEW => RESOLVED
Resolution: (none) => FIXED
Source RPM: initscripts-9.34-20.mga2.rpm initscripts-9.41-14.mga3 => initscripts-9.34-20.mga2.rpm


Note You need to log in before you can comment on or make changes to this bug.