[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH] ifupdown: post-down scripts don't get called when
From: Rob Landley <rob () landley ! net>
Date: 2010-04-27 4:49:08
Message-ID: 201004262349.10060.rob () landley ! net
[Download RAW message or body]
On Thursday 22 April 2010 03:08:28 Jeroen De Wachter wrote:
> Peter Korsgaard wrote:
> >>>>>> "Denys" == Denys Vlasenko <vda.linux@googlemail.com> writes:
> >
> > Hi,
> >
> > >> the post-down scripts are no longer executed, even though
> > >> nothing has actually gone wrong...
> >
> > Denys> I do not want to add more special cases to ifupdown.
> > Denys> There is a potentially infinite number of them.
> > Denys> Use something better than ifupdown.
> >
> > How about we just simplify the code instead then?
> >
> > >From 288af213589462228c860c88ed4a8c3ec9bf6777 Mon Sep 17 00:00:00 2001
> >
> > From: Peter Korsgaard <peter.korsgaard@barco.com>
> > Date: Thu, 22 Apr 2010 10:03:36 +0200
> > Subject: [PATCH] ifupdown: dhcp_down: ignore dhcp errors
> >
> > Perform full down sequence even if the dhcp client couldn't be killed
> > (already gone, using ipv4ll fallback, ..).
> >
> > Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
> > ---
> > networking/ifupdown.c | 6 ++----
> > 1 files changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/networking/ifupdown.c b/networking/ifupdown.c
> > index bf88b1c..f887001 100644
> > --- a/networking/ifupdown.c
> > +++ b/networking/ifupdown.c
> > @@ -572,8 +572,7 @@ static int FAST_FUNC dhcp_down(struct
> > interface_defn_t *ifd, execfn *exec) #elif ENABLE_UDHCPC
> > static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn
> > *exec) {
> > - int result;
> > - result = execute("kill "
> > + execute("kill "
> > "`cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd,
> > exec); /* Also bring the hardware interface down since
> > killing the dhcp client alone doesn't do it.
> > @@ -581,8 +580,7 @@ static int FAST_FUNC dhcp_down(struct
> > interface_defn_t *ifd, execfn *exec) /* Sleep a bit, otherwise
> > static_down tries to bring down interface too soon, and it may come back
> > up because udhcpc is still shutting down */ usleep(100000);
> > - result += static_down(ifd, exec);
> > - return ((result == 3) ? 3 : 0);
> > + return static_down(ifd, exec);
> > }
> > #else
> > static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd
> > UNUSED_PARAM,
>
> I thought about that too, but I wanted to avoid the 100 ms wait if possible
So move the usleep up to an if() case around the execute, ala:
// Shut down udhcp and give it 100ms to actually do so
if (!execute(...)) usleep(100000);
It's still a slight net simplification of the code, which probably makes it
worth doing. (Adding a large block of code for this special case was not.)
>
> DISCLAIMER:
> Unless indicated otherwise, the information contained in this message is
> privileged and confidential, and is intended only for the use of the
> addressee(s) named above and others who have been specifically authorized
> to receive it.
Oh, sorry. I won't reply to future messages from you I'm not explicitly cc'd
on then.
Rob
--
Latency is more important than throughput. It's that simple. - Linus Torvalds
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic