From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.50) id 1EcssT-0003RH-CI for garchives@archives.gentoo.org; Thu, 17 Nov 2005 23:09:13 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.5/8.13.5) with SMTP id jAHN8GxX026534; Thu, 17 Nov 2005 23:08:16 GMT Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.192]) by robin.gentoo.org (8.13.5/8.13.5) with ESMTP id jAHN1TTl011936 for ; Thu, 17 Nov 2005 23:01:30 GMT Received: by xproxy.gmail.com with SMTP id s6so58547wxc for ; Thu, 17 Nov 2005 15:01:29 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=mxFSclSMiWnTzvGMnCKbA8lcZtHKl6h80Et6NNUnOfgozBoW8k5BGl5dZr2zIAn4oIY0wmF4Doz8NLv6fIB0rN1HMMtR9Htl36Qv6d4p2+DAbIRKq9DNklTh+OAL8WNYyTA8rt8DRd4xBEufZ6ZiC8vIDYhlHatZeqSEcz4MPwo= Received: by 10.11.98.79 with SMTP id v79mr125337cwb; Thu, 17 Nov 2005 15:01:29 -0800 (PST) Received: by 10.11.98.55 with HTTP; Thu, 17 Nov 2005 15:01:29 -0800 (PST) Message-ID: <7728232c0511171501j53defd2bk7a26da4e22134f8d@mail.gmail.com> Date: Thu, 17 Nov 2005 15:01:29 -0800 From: Hareesh Nagarajan To: gentoo-user@lists.gentoo.org Subject: [gentoo-user] Bug in net.eth0? Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by robin.gentoo.org id jAHN1TTl011936 X-Archives-Salt: 30e173e0-1e17-464c-8470-b35eda4a4269 X-Archives-Hash: 9d7254d241b21377cf2d4eae097c59bc Hi, Some verison info: Version: # $Header: /home/cvsroot/gentoo-src/rc-scripts/init.d/net.eth0,v 1.41 2004/05/10 14:16:35 agriffis Exp $ Some background info: I have my ethernet driver compiled into my kernel. hareesh: hareesh/ $ lspci | grep Ethernet 0000:00:12.0 Ethernet controller: National Semiconductor Corporation DP83815 (MacPhyter) Ethernet Controller The problem: After I shutdown my eth0 interface I see an UP in the ifconfig output. hareesh: hareesh/ $ s ifconfig eth0 down hareesh: hareesh/ $ ifconfig eth0 Link encap:Ethernet HWaddr 00:0F:20:C7:25:5C UP BROADCAST NOTRAILERS MULTICAST MTU:1500 Metric:1 RX packets:28225 errors:0 dropped:0 overruns:0 frame:0 TX packets:24421 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:22196299 (21.1 Mb) TX bytes:4732287 (4.5 Mb) Interrupt:11 The /etc/init.d/net.eth0 script does the following check: So when I do the following, I get: # /etc/init.d/net.eth0 start * Keeping kernel configuration for eth0 So as we can see, the script hasn't given my interface an IP. Obviously, when I do this, I get: hareesh: hareesh/ $ wget www.google.com --14:09:55-- http://www.google.com/ => `index.html' Resolving www.google.com... failed: Temporary failure in name resolution. So then, I do: # /etc/init.d/net.eth0 stop * Bringing eth0 down... So I guess, if you have the ethernet driver compiled in, ifconfig still seems to show UP, no idea why. So I think, the script needs to be modified to test if, ifconfig spits a line with 'inet', to truly test if the interface is up. More importantly, UP just says that the device is functioning correctly and does not say that interface actually has an IP address assigned to it. So we need something more to rely on, to actually test if the interface is up and running with an IP address assigned to it. My modifications are as follows. This script, is just a hack, so all you bash gurus please forgive me. Maybe there is a better way of doing all this with the help of the /proc interface: --- /etc/init.d/net.eth0.1 2005-11-17 12:55:47.000000000 -0800 +++ /etc/init.d/net.eth0 2005-11-17 14:09:33.000000000 -0800 @@ -50,8 +50,13 @@ # ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails) setup_vars() { local i iface="${1//\./_}" - - status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')" + #status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')" + temp_IFACE="$(ifconfig ${1} | gawk '{print $1}' | head -n 2 | tr '\n' '_')" + if [[ ${temp_IFACE} == "${1}_inet_" ]]; then + status_IFACE=up + else + status_IFACE= + fi eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\" eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" ) eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\" Now, when I execute the script, I get the following: # s /etc/init.d/net.eth0 start * Bringing eth0 up via DHCP...[ ok ] * eth0 received address 140.221.222.55 So is this a bug in net.eth0 or am I missing something obvious? Thanks, ./hareesh -- gentoo-user@gentoo.org mailing list