Bug 152048 - option ETHTOOL_OPTS not used when set in /etc/sysconfig/network/ifcfg-* scripts
Summary: option ETHTOOL_OPTS not used when set in /etc/sysconfig/network/ifcfg-* scripts
Status: RESOLVED INVALID
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: Network (show other bugs)
Version: unspecified
Hardware: x86 SuSE Pro 9.3
: P5 - None : Minor
Target Milestone: ---
Assignee: E-mail List
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-18 14:53 UTC by a a
Modified: 2019-02-22 10:29 UTC (History)
2 users (show)

See Also:
Found By: Customer
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description a a 2006-02-18 14:53:46 UTC
Hi suse,

seems to me that 'ETHTOOL_OPTS' is not used, when set in /etc/sysconfig/network/ifcfg-* scripts. 
- is it a bug ?, because redhat seems to recognise the option...

Using a script like:
-------------------------------------------------
BOOTPROTO='static'
BROADCAST='172.16.50.255'
IPADDR='172.16.50.50'
MTU=''
NAME='NetGear NETGEAR FA120 Adapter'
NETMASK='255.255.255.0'
NETWORK='172.16.50.0'
REMOTE_IPADDR=''
STARTMODE='auto'
UNIQUE='Uc5H.N3lDIGuxQr2'
USERCONTROL='no'
_nm_name='bus-usb-1-4:1.0'
PREFIXLEN=''
ETHTOOL_OPTS='speed 100 duplex half autoneg off'
-------------------------------------------------
the 'ETHTOOL_OPTS' isn't used...
it should run: 
'ethtool -s ethX speed 100 duplex hal...' etc 
upon setting the interface up. It has to done manually from the command-line after starting the network (every time).


It seems like it's missing in /sbin/ifup, so I added these line to it - and it seem to work now. It is a rip from a redhat-fix from dec. 2004, perhaps you're not using the same code-base ?
-------------------------------------------------
...
if [ -n "$MTU" ] ; then
ip link set $INTERFACE mtu $MTU
fi

#### start my mod
#Added by ian.amess@o2.com to set device speed
#This could probably be done a better way but hey it works!!
# snipped from redhat: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=128714
# fixed in: http://rhn.redhat.com/errata/RHBA-2004-511.html
if [ -n "$ETHTOOL_OPTS" ] ; then
ethtool -s $INTERFACE $ETHTOOL_OPTS
echo "Executed: ethtool -s $INTERFACE $ETHTOOL_OPTS"
fi
#### end my mod

ADDRCOUNT=0
for IPVAR in ${!IPADDR*}; do
INDEX=${IPVAR#IPADDR}
if [ -n "$INDEX" ] ; then
eval REMOTE_IPADDR=\$REMOTE_IPADDR$INDEX
eval BROADCAST=\$BROADCAST$INDEX
eval LABEL=\$LABEL$INDEX
eval SCOPE=\$SCOPE$INDEX
eval NETMASK=\$NETMASK$INDEX
eval PREFIXLEN=\$PREFIXLEN$INDEX
eval IP_OPTIONS=\$IP_OPTIONS$INDEX
fi
...
-------------------------------------------------

I'm running suse 9.3, and haven't checked if it's fixed in 10.x (don't have a V10.x)

below is 1) the original ifup-script, 2) my modified ifup-script and 3) my network-config-script (from /etc/sysconfig/network/ifcfg-*)

i know it's a bit messy down below ;-) but attachments don't seem to be an option, so since i actually *did* patch a solution, i'd try and post it anyway... 
(drop me a mail, if it doesn't wrap correctly)

greets
sten

=============================================================
1) ORG ifup-script:
#!/bin/bash
#
# Network interface configuration
#
# Copyright (c) 2002-2003 SuSE Linux AG Nuernberg, Germany.
# All rights reserved.
#

..... SNIPED OUT DUE TO SIZE LIMIT ON DESCRIPTION (65535) ....

case "$BOOTPROTO$SKIP_MAIN_PART" in
	# Skip it
	*skip)
		:
		;;
	# Configure IPv6 6to4 tunnels.
	6to4)

		MESSAGE=`ip link set up dev $INTERFACE $LINK_OPTIONS 2>&1`
		if [ $? != 0 ] ; then
			logerror "failed to set up interface $INTERFACE"
			logerror "$MESSAGE"
			exit $R_ERROR
		fi

		if [ -n "$MTU" ] ; then
			MESSAGE=`ip link set $INTERFACE mtu $MTU 2>&1`
			if [ $? !=0 ] ; then
				logerror "failed to set MTU for interface $INTERFACE"
				logerror "$MESSAGE"
				exit $R_ERROR
			fi
		fi

		MESSAGE=`ip -6 addr add $TUNNEL_LOCAL_IPADDR_V6 dev $INTERFACE 2>&1`
		if [ $? != 0 ] ; then
			logerror "failed to add address $TUNNEL_LOCAL_IPADDR_V6 to" \
			         "interface $INTERFACE"
			logerror "$MESSAGE"
			exit $R_ERROR
		fi

		ifup-route $CONFIG $INTERFACE ${OPTIONS:+-o $OPTIONS}
		retcode=$?
	;;
	*)
		case $SCRIPTNAME in
			ifup)
				retcode=$R_SUCCESS
				if ! ip link set up dev $INTERFACE \
				        ${LLADDR:+address $LLADDR} $LINK_OPTIONS; then
					logerror "Cannot enable interface $INTERFACE."
					retcode=$R_NOTRUNNING
				else
					if [ -n "$MTU" ] ; then
						ip link set $INTERFACE mtu $MTU
					fi
					ADDRCOUNT=0
					for IPVAR in ${!IPADDR*}; do
						INDEX=${IPVAR#IPADDR}
						if [ -n "$INDEX" ] ; then
							eval REMOTE_IPADDR=\$REMOTE_IPADDR$INDEX
							eval BROADCAST=\$BROADCAST$INDEX
							eval LABEL=\$LABEL$INDEX
							eval SCOPE=\$SCOPE$INDEX
							eval NETMASK=\$NETMASK$INDEX
							eval PREFIXLEN=\$PREFIXLEN$INDEX
							eval IP_OPTIONS=\$IP_OPTIONS$INDEX
						fi
						IPADDR=${!IPVAR}
						test -z "$IPADDR" && continue
						if [ -z "$PREFIXLEN" ] ; then
							PREFIXLEN=`mask2pfxlen $NETMASK`
						fi
						case $IPADDR in
							*/*)
								PREFIXLEN=${IPADDR#*/}
								IPADDR=${IPADDR%/*}
								;;
							*) ;;         # IP=$IP${PREFIXLEN:+/$PREFIXLEN} ;;
						esac
						if [ -z "$NETMASK" ] ; then
							NETMASK=`pfxlen2mask $PREFIXLEN`
						fi
						if [ -z "$BROADCAST" ]; then
							BROADCAST=$DEFAULT_BROADCAST
						fi

..... SNIPED OUT DUE TO SIZE LIMIT ON DESCRIPTION (65535) ....

=============================================================
2) my mod ifup-script:
#!/bin/bash
#
# Network interface configuration
#
# Copyright (c) 2002-2003 SuSE Linux AG Nuernberg, Germany.
# All rights reserved.
#

..... SNIPED OUT DUE TO SIZE LIMIT ON DESCRIPTION (65535) ....

case "$BOOTPROTO$SKIP_MAIN_PART" in
	# Skip it
	*skip)
		:
		;;
	# Configure IPv6 6to4 tunnels.
	6to4)

		MESSAGE=`ip link set up dev $INTERFACE $LINK_OPTIONS 2>&1`
		if [ $? != 0 ] ; then
			logerror "failed to set up interface $INTERFACE"
			logerror "$MESSAGE"
			exit $R_ERROR
		fi

		if [ -n "$MTU" ] ; then
			MESSAGE=`ip link set $INTERFACE mtu $MTU 2>&1`
			if [ $? !=0 ] ; then
				logerror "failed to set MTU for interface $INTERFACE"
				logerror "$MESSAGE"
				exit $R_ERROR
			fi
		fi

		MESSAGE=`ip -6 addr add $TUNNEL_LOCAL_IPADDR_V6 dev $INTERFACE 2>&1`
		if [ $? != 0 ] ; then
			logerror "failed to add address $TUNNEL_LOCAL_IPADDR_V6 to" \
			         "interface $INTERFACE"
			logerror "$MESSAGE"
			exit $R_ERROR
		fi

		ifup-route $CONFIG $INTERFACE ${OPTIONS:+-o $OPTIONS}
		retcode=$?
	;;
	*)
		case $SCRIPTNAME in
			ifup)
				retcode=$R_SUCCESS
				if ! ip link set up dev $INTERFACE \
				        ${LLADDR:+address $LLADDR} $LINK_OPTIONS; then
					logerror "Cannot enable interface $INTERFACE."
					retcode=$R_NOTRUNNING
				else
					if [ -n "$MTU" ] ; then
						ip link set $INTERFACE mtu $MTU
					fi
					
					#### start my mod
					#Added by ian.amess@o2.com to set device speed
					#This could probably be done a better way but hey it works!!
					# snipped from redhat: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=128714
					# fixed in: http://rhn.redhat.com/errata/RHBA-2004-511.html
					if [ -n "$ETHTOOL_OPTS" ] ; then
						ethtool -s $INTERFACE $ETHTOOL_OPTS
						echo "Executed: ethtool -s $INTERFACE $ETHTOOL_OPTS"
					fi
					#### end my mod
					
					ADDRCOUNT=0
					for IPVAR in ${!IPADDR*}; do
						INDEX=${IPVAR#IPADDR}
						if [ -n "$INDEX" ] ; then
							eval REMOTE_IPADDR=\$REMOTE_IPADDR$INDEX
							eval BROADCAST=\$BROADCAST$INDEX
							eval LABEL=\$LABEL$INDEX
							eval SCOPE=\$SCOPE$INDEX
							eval NETMASK=\$NETMASK$INDEX
							eval PREFIXLEN=\$PREFIXLEN$INDEX
							eval IP_OPTIONS=\$IP_OPTIONS$INDEX
						fi
						IPADDR=${!IPVAR}
						test -z "$IPADDR" && continue
						if [ -z "$PREFIXLEN" ] ; then
							PREFIXLEN=`mask2pfxlen $NETMASK`
						fi

..... SNIPED OUT DUE TO SIZE LIMIT ON DESCRIPTION (65535) ....


=============================================================
3) my /etc/sysconfig/network/ifcfg-script:
BOOTPROTO='static'
BROADCAST='172.16.50.255'
IPADDR='172.16.50.50'
MTU=''
NAME='NetGear NETGEAR FA120 Adapter'
NETMASK='255.255.255.0'
NETWORK='172.16.50.0'
REMOTE_IPADDR=''
STARTMODE='auto'
UNIQUE='Uc5H.N3lDIGuxQr2'
USERCONTROL='no'
_nm_name='bus-usb-1-4:1.0'
PREFIXLEN=''
ETHTOOL_OPTS='speed 100 duplex half autoneg on'
=============================================================
Comment 1 Michael Gross 2006-02-20 14:03:28 UTC
Are you reporting this for SL 9.3?
Comment 2 Michael Gross 2006-02-21 12:03:35 UTC
OK, right at the moment I suppose so because of the OS-field.
SUSE Linux 9.3 is not supported in this way by the openSUSE project (only 10+).
As this would further be an enhancement for the boot scripts, I cannot reassign this at the moment, sorry.
Comment 3 a a 2006-02-26 13:52:49 UTC
Yep, it's on SL 9.3.
but I wasn't sure how to report bugs on 9.3 (novell.com is a big site - I got lost:-). So I figured it was similar to opensuse, and hence it ended up here.

But no need to be "..sorry..": if it ain't a bug - then it's a feature...
greets

(besides: i've got it the way i wanted - resolved on my host)
Comment 5 Farida Louacheni 2019-02-22 10:29:57 UTC
Sorry was wrong window, kindy ignore it.