Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 47713 - hotplug net.agent fails to handle events from a usbnet device
Summary: hotplug net.agent fails to handle events from a usbnet device
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High minor
Assignee: Greg Kroah-Hartman (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-13 09:09 UTC by Mike Lamb
Modified: 2004-04-16 16:55 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Lamb 2004-04-13 09:09:53 UTC
I have an ipaq running familiar linux and an IBM T30 laptop.  I connect an empty USB cradle into the laptop.  When I insert the ipaq into the cradle, or remove it, for the purpose of using a network connection, net.agent fails.

Insertion: net.agent executes but exits because /var/lock/subsys/network does not exist.
Removal: net.agent executes but the ACTION variable is set to "remove" which is not handled by the script.

As a work-around, I patched net.agent like this:

--- net.agent.bak	2004-03-24 02:14:45.000000000 -0600
+++ net.agent	2004-04-13 09:36:33.587781052 -0500
@@ -31,11 +31,6 @@
 
 case $ACTION in
 add|register)
-    # Don't do anything if the network is stopped
-    if [ ! -f /var/lock/subsys/network ]; then
-       exit 0
-    fi
-
     case $INTERFACE in
 	# interfaces that are registered after being "up" (?)
 	ppp*|ippp*|isdn*|plip*|lo*|irda*|dummy*|ipsec*|tun*|tap*)
@@ -55,7 +50,7 @@
     mesg $1 $ACTION event not handled
     ;;
 
-unregister)
+unregister|remove)
     case $INTERFACE in
 	# interfaces that are unregistered after being "down" (?)
 	ppp*|ippp*|isdn*|plip*|lo*|irda*)

I also cobbled together an ugly a /etc/init.d/net.usb0 script with a start() and stop() to modprobe usbnet and set up/tear down the interface configuration:

#!/sbin/runscript

# MRL 2004-03-24 hacked together for ipaq ptp link (based on net.lo)
# MRL FIXME This is a really ugly hack! especially the MASQ stuff!!

start() {
	ebegin "Bringing ${IFACE} up"
	modprobe usbnet
	/sbin/ifconfig ${IFACE} 10.0.0.1 netmask 255.255.255.255 pointopoint 10.0.0.2
	/root/bin/fw-masq
	eend 0
}

stop() {
	ebegin "Bringing ${IFACE} down"
	/sbin/ifconfig ${IFACE} down
	/root/bin/fw
	eend 0
}



Reproducible: Always
Steps to Reproduce:
1.Plug USB cradle into laptop without the ipaq
2.Insert ipaq into cradle
3.Remove ipaq from cradle

Actual Results:  
In both cases, net.agent exited without attempting to run /etc/net.usb0 

Expected Results:  
Insertion: execute "/etc/net.usb0 --quite start" 
Removal: execute "/etc/net.usb0 --quite stop" 
 

Gentoo Base System version 1.4.3.13 
Portage 2.0.50-r5 (default-x86-1.4, gcc-3.3.2, glibc-2.3.2-r9, 2.6.5) 
================================================================= 
System uname: 2.6.5 i686 Mobile Intel(R) Pentium(R) 4 - M CPU 2.00GHz 
Autoconf: sys-devel/autoconf-2.58-r1 
Automake: sys-devel/automake-1.8.3 
ACCEPT_KEYWORDS="x86" 
AUTOCLEAN="yes" 
CFLAGS="-march=pentium3 -mcpu=pentium4 -O2 -pipe -fomit-frame-pointer" 
CHOST="i686-pc-linux-gnu" 
COMPILER="gcc3" 
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" 
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" 
CXXFLAGS="-march=pentium3 -mcpu=pentium4 -O2 -pipe -fomit-frame-pointer" 
DISTDIR="/usr/portage/distfiles" 
FEATURES="autoaddcvs ccache sandbox" 
GENTOO_MIRRORS="http://mirrors.tds.net/gentoo 
http://mirror.tucdemonic.org/gentoo/ 
http://mirror.clarkson.edu/pub/distributions/gentoo/ 
http://www.ibiblio.org/pub/Linux/distributions/gentoo" 
MAKEOPTS="-j1" 
PKGDIR="/usr/portage/packages" 
PORTAGE_TMPDIR="/var/tmp" 
PORTDIR="/usr/portage" 
PORTDIR_OVERLAY="" 
SYNC="rsync://rsync.gentoo.org/gentoo-portage" 
USE="X apm arts avi berkdb bonobo cdr crypt cups encode esd ethereal 
foomaticdb gdbm gif gnome gpm gps gtk gtk2 gtkhtml guile imlib java jpeg kde 
libg++ libwww mad mikmod motif mozilla mpeg ncurses nls oggvorbis opengl oss 
pam pcmcia pdflib perl png python qt quicktime readline sdl slang spell ssl 
svga tcltk tcpd tetex tiff truetype usb vim-with-x x86 xml2 xmms xv zlib"
Comment 1 Greg Kroah-Hartman (RETIRED) gentoo-dev 2004-04-13 10:59:01 UTC
What version of hotplug are you using?  This should be all working in the latest version.
Comment 2 Greg Kroah-Hartman (RETIRED) gentoo-dev 2004-04-13 12:17:49 UTC
Also, if you are using udev, the latest version will allow you to rename
network interfaces, and the proper /etc/init.d/net* file will be called when
the device is brought up and down.

So I really think this is solved...
Comment 3 Mike Lamb 2004-04-13 15:10:23 UTC
Well, I was using sys-apps/hotplug-20040105 right up until the point I filed the bug report.

You are quite correct.  I just performed emerge sync which built sys-apps/hotplug-20040401 and sys-apps/hotplug-base-20040401.  net.agent now works and I can see that it is fixed in pretty much the same way as my work-around.  I cannot believe my timing with this!

I do plan on using udev as soon as time permits.  However, I don't understand how renaming interfaces would help in this case.  Currently, net.agent tries execute net.usb0, which seems correct to me.  What would be the "proper proper /etc/init.d/net* file"?

Thanks.
Comment 4 Mike Lamb 2004-04-13 15:41:12 UTC
Hmm...  I guess Bugzilla doesn't wrap comment lines.  Sorry about that.
Comment 5 Greg Kroah-Hartman (RETIRED) gentoo-dev 2004-04-16 16:55:39 UTC
Sorry, renaming interfaces would not help, but if you want to do that, it
will work now :)