From: Hareesh Nagarajan <hareesh.nagarajan@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: [gentoo-user] Bug in net.eth0?
Date: Thu, 17 Nov 2005 15:01:29 -0800 [thread overview]
Message-ID: <7728232c0511171501j53defd2bk7a26da4e22134f8d@mail.gmail.com> (raw)
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:
<script>
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
[...]
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
</script>
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
<interface> 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:
<patch>
--- /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\}\"
</patch>
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
next reply other threads:[~2005-11-17 23:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-17 23:01 Hareesh Nagarajan [this message]
2005-11-17 23:49 ` [gentoo-user] Bug in net.eth0? Neil Bothwick
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7728232c0511171501j53defd2bk7a26da4e22134f8d@mail.gmail.com \
--to=hareesh.nagarajan@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox