Skip to contentSkip to conversation

ifdown on unregister for debian system

PATCH Fumitoshi UKAI 3 participants 6 messages Jan 7, 2002

lore
Share & tools
lore
#0 lore raw

Hi, I'm linux-hotplug debian package maintainer.

On debian system, ifup/ifdown keep status of interface status (up/down) in ifstate database, so ifdown is necessary when network interface unregistered. Unless ifdown is called, next registering net device will fail because it was already up in ifstate database.

etc/hotplug/net.agent +16 -1
@@ -9,6 +9,7 @@
 #
 # HISTORY:
 #
+# 30-Sep-2001	ifdown on unregister for debian system 
 # 25-Feb-2001	Special case ppp and similar (redhat)
 # 23-Jan-2001	Log invocation of "ifup" if debugging
 # 04-Jan-2001	Initial version of "new" hotplug agent.
@@ -45,13 +46,27 @@
 		debug_mesg invoke ifup $INTERFACE
 		exec /sbin/ifup $INTERFACE
 	    else
-		mesg "how do I bring interfaces up on this distro?"
+		# mesg "how do I bring interfaces up on this distro?"
+		mesg "E: /sbin/ifup not found. You need to install ifupdown package"
 	    fi
 	    ;;
     esac
     mesg $1 $ACTION event not handled
     ;;
 
+unregister)
+    # Assume that we want to run ifdown no matter what,  
+    # because it's not going to remove the data from the 
+    # ifstate database otherwise.
+    if [ -x /sbin/ifdown ]; then
+	debug_mesg invoke ifdown $INTERFACE
+        exec /sbin/ifdown $INTERFACE
+    else
+	# mesg "how do I bring interfaces up on this distro?"
+	mesg "E: /sbin/ifdown not found. You need to install ifupdown package"
+    fi
+    mesg $1 $ACTION event not handled
+    ;;
 *)
     debug_mesg NET $ACTION event not supported
     exit 1 ;;

Regards,
Fumitoshi UKAI

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 4 lines · Fumitoshi UKAI

On debian system, ifup/ifdown keep status of interface status (up/down) in ifstate database, so ifdown is necessary when network interface unregistered. Unless ifdown is called, next registering net device will fail because it was already up in ifstate database.

This patch:
a) refers to a debian-specific package
b) refers to debian-specific ifdown behavior

Is there any chance it could be cleaned up, or kept as a debian-specifc diff?

Bill

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Fumitoshi UKAI

At Mon, 7 Jan 2002 12:36:05 -0500,

Quoted 7 lines · Bill Nottingham
Quoted 4 lines · Fumitoshi UKAI

On debian system, ifup/ifdown keep status of interface status (up/down) in ifstate database, so ifdown is necessary when network interface unregistered. Unless ifdown is called, next registering net device will fail because it was already up in ifstate database.

Quoted 6 lines

This patch:
a) refers to a debian-specific package
b) refers to debian-specific ifdown behavior

Is there any chance it could be cleaned up, or kept as a debian-specifc diff?

debian's ifup/ifdown uses /etc/network/ifstate for status database. How about checking the /etc/network/ifstate file existance to run ifdown?

Regards,
Fumitoshi UKAI

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw
In reply to Fumitoshi UKAI
Quoted 9 lines · Fumitoshi UKAI
Quoted 6 lines

This patch:
a) refers to a debian-specific package
b) refers to debian-specific ifdown behavior

Is there any chance it could be cleaned up, or kept as a debian-specifc diff?

debian's ifup/ifdown uses /etc/network/ifstate for status database. How about checking the /etc/network/ifstate file existance to run ifdown?

That could work, I suppose.

The situation on Red Hat is that ifdown is used to bring down the network interface; if you've gotten the unregister event from the driver, that means the network interface is already down, so running ifdown doesn't gain you much.

Bill

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#4 lore raw
In reply to Fumitoshi UKAI

That sounds about right.

My understanding -- please correct if appropriate! -- is that for the moment, distros have "agreed to disagree" about details of network administration, at this level,

So I believe that logic along the lines of "if [ distro is X] ..." is unfortunately appropriate in these cases. Maybe in a few years we'll have more convergence, which hotplug can be a part of ... :)

- Dave

----- Original Message -----
From: "Fumitoshi UKAI" <[email protected]>
To: "Bill Nottingham" <[email protected]>
Cc: <[email protected]>
Sent: Monday, January 07, 2002 9:41 AM
Subject: Re: ifdown on unregister for debian system

Quoted 13 lines

At Mon, 7 Jan 2002 12:36:05 -0500,

Quoted 11 lines · Bill Nottingham
Quoted 4 lines · Fumitoshi UKAI

On debian system, ifup/ifdown keep status of interface status (up/down) in ifstate database, so ifdown is necessary when network interface unregistered. Unless ifdown is called, next registering net device will fail because it was already up in ifstate database.

This patch:
a) refers to a debian-specific package
b) refers to debian-specific ifdown behavior

Quoted 9 lines
Quoted 2 lines

Is there any chance it could be cleaned up, or kept as a debian-specifc diff?

debian's ifup/ifdown uses /etc/network/ifstate for status database. How about checking the /etc/network/ifstate file existance to run ifdown?

Regards,
Fumitoshi UKAI

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#5 lore raw
In reply to Fumitoshi UKAI
Quoted 2 lines

The situation on Red Hat is that ifdown is used to bring down the network interface;

... or hardware level actions like usb disconnect and cardbus eject.

Quoted 3 lines

if you've gotten the unregister event from the
driver, that means the network interface is already down, so running ifdown doesn't gain you much.

Actually for the 2.5 series I'd like to see someone look at some of these issue some more ... there's inconsistency in how the various network interfaces behave, as shown by all the name-based special cases. History ... :)

- Dave

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel