[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: pcmcia-cs not to call ifup/ifdown by default?



On Fri, Jul 02, 2004 at 16:36 +0200, Thomas Hood wrote:
> That means you have to convert systems from using cardmgr-generated
> ifup/ifdown to using hotplug-generated ifup/ifdown.  This will not
> be easy.  You will have to parse /etc/network/interfaces to validate
> or add the hotplug mapping stanza.  Even then, some systems will
> probably break.

I wasn't planning to convert anything. Here's the relevant section of
the postinst:

    CFG=/etc/default/pcmcia
    PROBE=/sbin/pcic_probe
    if [ ! -f $CFG ] ; then
        echo '# Defaults for pcmcia (sourced by /etc/init.d/pcmcia)' > $CFG
        echo PCMCIA=yes >> $CFG
        PCIC=yenta_socket
        db_get pcmcia-cs/run_probe
        if [ "$RET" = "true" -a -x $PROBE ] ; then
            PCIC=`$PROBE -m -k || true` ; fi
        if [ -z "$PCIC" ] ; then PCIC=yenta_socket; fi
        echo "PCIC=$PCIC" >> $CFG
        echo "PCIC_OPTS=" >> $CFG
        echo "CORE_OPTS=" >> $CFG
        echo "CARDMGR_OPTS=" >> $CFG
    fi

By adding a 'echo "DONT_IFUP=yes" >> $CFG' here, it is only written if
/etc/default/pcmcia doesn't already exist. So new installations will
get the variable set and upgraded will not.

There's of course still the question of systems being upgraded -
ideally they should be able to set the variable as well. I think the
right thing to do here is to document the new behaviour somewhere and
let the user fix her /etc/network/interfaces by herself. Maybe a note
in NEWS.Debian.

> In contrast, hotplug can only run ifdown while the module is being
> removed (because hotplug is triggered by the disappearance of the
> interface, not by the removal of the hardware).

Shouldn't removal of the hardware trigger a disappearance of the
interface?

> Some drivers (e.g., airo_cs) are OK with this: you can "modprobe -r"
> the driver while the interface is configured; when that happens, the
> interface is forced to disappear and a hotplug event is generated
> which runs ifdown to clean up the ifstate file.  Other drivers
> (e.g., xirc2ps_cs) are not OK with this: if you "modprobe -r" the
> driver while the interface is configured then the "modprobe -r"
> fails, the driver is not removed and no hotplug event is generated.
> For the latter sort of drivers you have to run ifdown before
> "modprobe -r".

What if you have two cards of the same type and only remove one? Since
you can't remove the driver because it's needed by the other card,
will the interface of the first card not disappear then?

> Although it seems a bit ugly for cardmgr to run ifdown without
> running ifup, I think it's justified by what I've just said and by
> the appropriateness of letting hotplug handle ifup's for all hot
> pluggable interfaces.  Discussion welcome, of course.

This sounds like a bug in the drivers or in cardmgr to me, but I think
a workaround is acceptable if necessary.

-- 
Pelle



Reply to: