[Pkg-utopia-maintainers] Bug#562811: Bug#562811: network-manager: if-down.d should be dispatched before interface goes down (phase is "pre-down")

Michael Biebl biebl at debian.org
Tue Feb 9 01:08:12 UTC 2010


clone 562811 -1
retitle 562811 ifupdown:down event should be mapped to post-down phase.
retitle -1 ifupdown: network-manager does not support pre-up/pre-down commands
forwarded -1 https://bugzilla.gnome.org/show_bug.cgi?id=387832
thanks
Mark Hedges wrote:
> 
> As a result, scripts in /etc/network/if-down.d do not have access to the
> network when they run.  (Try putting a script in the if-down.d directory that
> runs "logger 'NM DEBUG' `ifconfig $IFACE`" and you will see in the syslog that
> the interface is down.)
> 
> This is incorrect, because it does not conform to the behavior of ifupdown, and
> because many packages install scripts in if-down.d that expect the network to
> be available.  (For instance, I might want to install a script that sends my
> log-off time to a remote server, ships out logs of what I've been doing, etc.)
> 
> if-post-down.d is supposed to be for running the "post-down" phase.

So, we really have two separate issues here, thus I cloned the bug to handle
them separately:

1.) network-manager does not support pre-up/pre-down scripts
2.) the current 01ifupdown script incorrectly maps the NM "down" event to the
ifupdown pre-down PHASE (running scripts in if-down.d). It should map the "down"
event to PHASE=post-down" and run the script in if-post-down.d

I have something like this in mind, to address 2.)
01ifupdown:

# Run the right scripts
case "$2" in
    up)
        export MODE="start"
        export PHASE="post-up"
        exec run-parts /etc/network/if-up.d
        ;;
    down)
        export MODE="stop"
        export PHASE="post-down"
        exec run-parts /etc/network/if-post-down.d
        ;;
# pre-up/pre-down not implemented. See
# https://bugzilla.gnome.org/show_bug.cgi?id=387832
#    pre-up)
#       export MODE="start"
#       export PHASE="pre-up"
#       exec run-parts /etc/network/if-pre-up.d
#       ;;
#    pre-down)
#       export MODE="stop"
#       export PHASE="pre-down"
#       exec run-parts /etc/network/if-down.d
#       ;;
    *)
        echo "$0: called with unknown action \`$2'" 1>&2
        exit 1
        ;;
esac


So, regarding 2 resp. #562811, the fix is rather easy.
Regarding 1, support for pre-up/pre-down, it has to be noted that the version in
lenny shipped a custom patch, which basically changed NM's down event to
pre-down [2], and added a post-down and pre-up event.

Michael

[1]
http://patch-tracker.debian.org/patch/series/view/network-manager/0.6.6-3/06-dispatch_more_events.patch
[2] that's the reason why the current 01ifupdown script does not correctly map
the down event. The patch was dropped but 01ifupdown had not been updated
accordingly.

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-utopia-maintainers/attachments/20100209/bfcd4627/attachment.pgp>


More information about the Pkg-utopia-maintainers mailing list