Your message dated Tue, 21 Aug 2012 08:50:26 +0200
with message-id <20120821085026.27947b4f@ileemo>
and subject line Re: Bug#685420: ifupdown fails to bring the interface up when 
doing networking restart and using  hotplug
has caused the Debian Bug report #685420,
regarding ifupdown fails to bring the interface up when doing networking 
restart and using  hotplug
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
685420: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=685420
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: ifupdown
Version: 0.7
Severity: important
Tags: patch


Hello,


Take the following /etc/network/interfaces:


$ cat /etc/network/interfaces 
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp



On a Debian Squeeze system doing:

$ service networking restart

fails to bring-up the interface eth0.

After digging into the init script I found a problem on the logic:

ifup_hotplug () {
    if [ -d /sys/class/net ]
    then
            ifaces=$(for iface in $(ifquery --list --allow=hotplug)
                            do
                                    if [ -e "/sys/class/net/$iface" -a "$(cat 
/sys/class/net/$iface/operstate)" = up ]
                                    then
                                            echo "$iface"
                                    fi
                            done)
            if [ -n "$ifaces" ]
            then
                ifup $ifaces || true
            fi
    fi
}


Is wrong, because it is checking if the interface is already up before doing 
the ifup.
And the interface will be of course down, because we have just did an ifdown 
previously.
... So we won't bring the interface up when restarting the network, which is a 
serious problem IMHO.


Instead of checking the interface status, is better idea to check if the 
interface is already
configured or not.

Just simply: if the interface is not already configured then do the ifup.


The attached patch solves this issue and allows to correctly restart the 
networking even for
interfaces configured with allow-hotplug

--- networking	2012-08-20 19:25:57.289873424 +0200
+++ networking.new	2012-08-20 19:24:21.333876444 +0200
@@ -80,7 +80,7 @@
     then
 	    ifaces=$(for iface in $(ifquery --list --allow=hotplug)
 			    do
-				    if [ -e "/sys/class/net/$iface" -a "$(cat /sys/class/net/$iface/operstate)" = up ]
+				    if [ -e "/sys/class/net/$iface" -a ! $(grep -q "$iface" /run/network/ifstate) ]
 				    then
 					    echo "$iface"
 				    fi

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message ---
Hello,

On Mon, 20 Aug 2012 19:34:37 +0200
Carlos Alberto Lopez Perez <[email protected]> wrote:

> Is wrong, because it is checking if the interface is already up
> before doing the ifup. And the interface will be of course down,
> because we have just did an ifdown previously. ... So we won't bring
> the interface up when restarting the network, which is a serious
> problem IMHO.

First of all, that's not just interface status, that's the status of
the link. If you have the cable plugged in, you'll have 'up' here, and
it will bring it up. However, if you want to just restart all the
interfaces you have currently up, you're supposed to use 'reload'
action, not 'restart' (probably, this has to be documented a bit more).

Restart action just puts all the interfaces down and brings up only
those which are supposed to be auto-started *or* those which are
usually brought up by hotplug and have a link at that moment.

-- 
WBR, Andrew

Attachment: signature.asc
Description: PGP signature


--- End Message ---

Reply via email to