Re: ifupdown scripts
Following up with this too. Dave On 9/20/16, David Henderson wrote: > Does BB require certain permissions or ownership of the > scripts/directories for this to get called? > > Dave > > > On 9/20/16, David Henderson wrote: >> Hey Martin, thanks for your help! I tried renaming the file as you >> requested, but it is still not being called. I did just submit a new >> post regarding additional problems with ifup/down. Perhaps something >> in there can help with a resolution here - in short running an 'ifup >> -v eth0' doesn't appear to ever get to looking inside the if-up.d >> directory, only if-pre-up.d. >> >> Thanks, >> Dave >> >> >> On 9/20/16, Martin Townsend wrote: >>> Hi David, >>> >>> Does it work if you drop the .conf? >>> /etc/network/if-up.d/000_resolv >>> >>> -Martin >>> >>> On Mon, Sep 19, 2016 at 9:59 PM, David Henderson >>> wrote: Good afternoon all! I have been continuing to work with the networking in BB and have added a single script '/etc/network/if-up.d/000_resolv.conf' that does not seem to be called when 'ifup -a' is called during the boot process. The script has a permission of 755 and ownership of root:root. The contents are as follows: #!/bin/sh echo 'resolv.conf' > /tmp/debug.txt env >> /tmp/debug.txt Any thoughts on what is going on? Thanks, Dave ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox >>> >> > ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: ifupdown scripts
Does BB require certain permissions or ownership of the scripts/directories for this to get called? Dave On 9/20/16, David Henderson wrote: > Hey Martin, thanks for your help! I tried renaming the file as you > requested, but it is still not being called. I did just submit a new > post regarding additional problems with ifup/down. Perhaps something > in there can help with a resolution here - in short running an 'ifup > -v eth0' doesn't appear to ever get to looking inside the if-up.d > directory, only if-pre-up.d. > > Thanks, > Dave > > > On 9/20/16, Martin Townsend wrote: >> Hi David, >> >> Does it work if you drop the .conf? >> /etc/network/if-up.d/000_resolv >> >> -Martin >> >> On Mon, Sep 19, 2016 at 9:59 PM, David Henderson >> wrote: >>> Good afternoon all! I have been continuing to work with the >>> networking in BB and have added a single script >>> '/etc/network/if-up.d/000_resolv.conf' that does not seem to be called >>> when 'ifup -a' is called during the boot process. The script has a >>> permission of 755 and ownership of root:root. The contents are as >>> follows: >>> >>> #!/bin/sh >>> echo 'resolv.conf' > /tmp/debug.txt >>> env >> /tmp/debug.txt >>> >>> >>> Any thoughts on what is going on? >>> >>> Thanks, >>> Dave >>> ___ >>> busybox mailing list >>> busybox@busybox.net >>> http://lists.busybox.net/mailman/listinfo/busybox >> > ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: ifupdown scripts
Hey Martin, thanks for your help! I tried renaming the file as you requested, but it is still not being called. I did just submit a new post regarding additional problems with ifup/down. Perhaps something in there can help with a resolution here - in short running an 'ifup -v eth0' doesn't appear to ever get to looking inside the if-up.d directory, only if-pre-up.d. Thanks, Dave On 9/20/16, Martin Townsend wrote: > Hi David, > > Does it work if you drop the .conf? > /etc/network/if-up.d/000_resolv > > -Martin > > On Mon, Sep 19, 2016 at 9:59 PM, David Henderson > wrote: >> Good afternoon all! I have been continuing to work with the >> networking in BB and have added a single script >> '/etc/network/if-up.d/000_resolv.conf' that does not seem to be called >> when 'ifup -a' is called during the boot process. The script has a >> permission of 755 and ownership of root:root. The contents are as >> follows: >> >> #!/bin/sh >> echo 'resolv.conf' > /tmp/debug.txt >> env >> /tmp/debug.txt >> >> >> Any thoughts on what is going on? >> >> Thanks, >> Dave >> ___ >> busybox mailing list >> busybox@busybox.net >> http://lists.busybox.net/mailman/listinfo/busybox > ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: ifupdown scripts
Hi David, Does it work if you drop the .conf? /etc/network/if-up.d/000_resolv -Martin On Mon, Sep 19, 2016 at 9:59 PM, David Henderson wrote: > Good afternoon all! I have been continuing to work with the > networking in BB and have added a single script > '/etc/network/if-up.d/000_resolv.conf' that does not seem to be called > when 'ifup -a' is called during the boot process. The script has a > permission of 755 and ownership of root:root. The contents are as > follows: > > #!/bin/sh > echo 'resolv.conf' > /tmp/debug.txt > env >> /tmp/debug.txt > > > Any thoughts on what is going on? > > Thanks, > Dave > ___ > busybox mailing list > busybox@busybox.net > http://lists.busybox.net/mailman/listinfo/busybox ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: ifupdown scripts
And with this. Thanks, Dave On 9/19/16, David Henderson wrote: > Good afternoon all! I have been continuing to work with the > networking in BB and have added a single script > '/etc/network/if-up.d/000_resolv.conf' that does not seem to be called > when 'ifup -a' is called during the boot process. The script has a > permission of 755 and ownership of root:root. The contents are as > follows: > > #!/bin/sh > echo 'resolv.conf' > /tmp/debug.txt > env >> /tmp/debug.txt > > > Any thoughts on what is going on? > > Thanks, > Dave > ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: ifupdown scripts (1.7.2 patch)
On Wednesday 10 October 2007 18:44, Daniel Mierswa wrote: > Hey guys, > i felt the need to provide a patch since probably some won't use those > scripts called if an interface comes up/down maybe because it also pulls > in run-parts (which wasn't selected in 1.7.2 anyway). So i provided a > patch which makes it all optional. Hope you guys can do something useful > with it. The patch applies fine to version 1.7.1 and 1.7.2. Other > versions weren't tested. Are these changes add something which is present in "standard" ifup (and what is "standard" ifup, anyway? URL to homepage will be nice). If you are not simply adding functionality which exists in mainstream version, but instead are trying ot extent ifup to handle more cases, Please read this: http://busybox.net/~vda/no_ifup.txt then talk to me and try to convince me that I am missing something and ifup is actually not hopeless by design. -- vda ___ busybox mailing list busybox@busybox.net http://busybox.net/cgi-bin/mailman/listinfo/busybox
Re: ifupdown scripts (1.7.2 patch)
I forgot some tabs and added an extra whitespace in usage.h. I re-submitted the patch with fixed whitespacing. -- Mierswa, Daniel If you still don't like it, that's ok: that's why I'm boss. I simply know better than you do. --- Linus Torvalds, comp.os.linux.advocacy, 1996/07/22 diff -Nur ../busybox-1.7.1.orig/include/usage.h ./include/usage.h --- ../busybox-1.7.1.orig/include/usage.h 2007-09-03 11:48:46 + +++ ./include/usage.h 2007-10-10 17:12:21 + @@ -1420,7 +1420,7 @@ " [up|down] ..." #define ifup_trivial_usage \ - "[-ahinv] ifaces..." + "[-ahinv"USE_FEATURE_IFUPDOWN_SCRIPTS("Pp")"] ifaces..." #define ifup_full_usage \ "Options:\n" \ " -a De/configure all interfaces automatically\n" \ @@ -1429,10 +1429,13 @@ " (note that this option doesn't disable mappings)\n" \ " -v Print out what would happen before doing it\n" \ " -m Don't run any mappings\n" \ - " -f Force de/configuration" + " -f Force de/configuration" \ + USE_FEATURE_IFUPDOWN_SCRIPTS( \ + "\n -P FILE Script to run before bringing the interface up (default: none)" \ + "\n -p FILE Script to run after bringing the interface up (default: none)") #define ifdown_trivial_usage \ - "[-ahinv] ifaces..." + "[-ahinv"USE_FEATURE_IFUPDOWN_SCRIPTS("Pp")"] ifaces..." #define ifdown_full_usage \ "Options:\n" \ " -a De/configure all interfaces automatically\n" \ @@ -1441,7 +1444,10 @@ " (note that this option doesn't disable mappings)\n" \ " -v Print out what would happen before doing it\n" \ " -m Don't run any mappings\n" \ - " -f Force de/configuration" + " -f Force de/configuration" \ + USE_FEATURE_IFUPDOWN_SCRIPTS( \ + "\n -P FILE Script to run before bringing the interface down (default: none)" \ + "\n -p FILE Script to run after bringing the interface down (default: none)") #define inetd_trivial_usage \ "[-f] [-q len] [conf]" diff -Nur ../busybox-1.7.1.orig/networking/Config.in ./networking/Config.in --- ../busybox-1.7.1.orig/networking/Config.in 2007-09-03 11:48:27 + +++ ./networking/Config.in 2007-10-10 17:00:16 + @@ -323,6 +323,15 @@ This enables support for the "mapping" stanza, unless you have a weird network setup you don't need it. +config FEATURE_IFUPDOWN_SCRIPTS + bool "Enable ifup/ifdown scripts" + default n + depends on IFUPDOWN + select RUN_PARTS + help + This enables support for scripts which can be called + once an interface comes up/down. + config FEATURE_IFUPDOWN_EXTERNAL_DHCP bool "Enable support for external dhcp clients" default n diff -Nur ../busybox-1.7.1.orig/networking/ifupdown.c ./networking/ifupdown.c --- ../busybox-1.7.1.orig/networking/ifupdown.c 2007-09-03 11:48:27 + +++ ./networking/ifupdown.c 2007-10-10 16:49:04 + @@ -86,7 +86,7 @@ struct mapping_defn_t *mappings; }; -#define OPTION_STR "anvf" USE_FEATURE_IFUPDOWN_MAPPING("m") "i:" +#define OPTION_STR "anvf" USE_FEATURE_IFUPDOWN_MAPPING("m") USE_FEATURE_IFUPDOWN_SCRIPTS("P:p:") "i:" enum { OPT_do_all = 0x1, OPT_no_act = 0x2, @@ -950,6 +950,7 @@ return 1; } +#ifdef ENABLE_FEATURE_IFUPDOWN_SCRIPTS static int execute_all(struct interface_defn_t *ifd, const char *opt) { int i; @@ -962,33 +963,58 @@ } } - buf = xasprintf("run-parts /etc/network/if-%s.d", opt); + buf = xasprintf("run-parts %s", opt); /* heh, we don't bother free'ing it */ return doit(buf); } +#endif static int check(char *str) { return str != NULL; } +#ifdef ENABLE_FEATURE_IFUPDOWN_SCRIPTS +static int iface_up(struct interface_defn_t *iface, const char *pre_up_script, const char *up_script) +#else static int iface_up(struct interface_defn_t *iface) +#endif { if (!iface->method->up(iface, check)) return -1; set_environ(iface, "start"); - if (!execute_all(iface, "pre-up")) return 0; +#ifdef ENABLE_FEATURE_IFUPDOWN_SCRIPTS + if (pre_up_script) { + if (!execute_all(iface, pre_up_script)) return 0; + } +#endif if (!iface->method->up(iface, doit)) return 0; - if (!execute_all(iface, "up")) return 0; +#ifdef ENABLE_FEATURE_IFUPDOWN_SCRIPTS + if (up_script) { + if (!execute_all(iface, up_script)) return 0; + } +#endif return 1; } +#ifdef ENABLE_FEATURE_IFUPDOWN_SCRIPTS +static int iface_down(struct interface_defn_t *iface, const char *down_script, const char *post_down_script) +#else static int iface_down(struct interface_defn_t *iface) +#endif { if (!iface->method->down(iface,check)) return -1