Actually, I think I know what's causing this. Consider the function
iface_down() in execute.c:

int iface_down(interface_defn *iface) {
        if (!iface->method->down(iface,check)) return -1;

        set_environ(iface, "stop", "pre-down");
        if (!execute_all(iface,doit,"down")) return 0;

        if (!iface->method->down(iface,doit)) return 0;

        set_environ(iface, "stop", "post-down");
        if (!execute_all(iface,doit,"post-down")) return 0;

        return 1;
}

  Bringing down the interface probably fails when the card has been
ejected, because by the time ifdown is called the interface does not
exist anymore. So the function returns and the post-down scripts never
get the chance to execute.

  So how can this be solved? Obviously, an easy solution would be to
ignore the success or failure of bringing down the interface, i.e.
instead of:

        if (!iface->method->down(iface,doit)) return 0;

have:

        iface->method->down(iface,doit);

  But then failure to bring down the interface wouldn't be reported at
all. Instead, how about having the function like this:

int iface_down(interface_defn *iface) {
        int status = 1;

        if (!iface->method->down(iface,check)) return -1;

        set_environ(iface, "stop", "pre-down");
        if (!execute_all(iface,doit,"down")) status = 0;

        if (!iface->method->down(iface,doit)) status = 0;

        set_environ(iface, "stop", "post-down");
        if (!execute_all(iface,doit,"post-down")) status = 0;

        return status;
}

  In fact, I've just made this change to ifupdown on my laptop (and a
similar change to the iface_up() function) and now it seems to work as
intended. But of course it'll need some more testing. Can the package
maintainer comment on this in the meantime?

Thanks,
Vasilis

-- 
Vasilis Vasaitis
"A man is well or woe as he thinks himself so."




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to