[PATCH] ifupdown and allow-hotplug
Bernhard Fischer
rep.dot.nop at gmail.com
Thu Aug 23 11:46:07 UTC 2007
On Thu, Aug 23, 2007 at 12:05:41PM +0200, simon at alcove.fr wrote:
>Hello,
>
>Here a small patch for the ifupdown applet. It add support for the
>allow-hotplug option.
>
>Simon
>diff -r a75029f7bc4b include/usage.h
>--- a/include/usage.h Thu Aug 23 11:47:23 2007 +0200
>+++ b/include/usage.h Thu Aug 23 11:47:40 2007 +0200
>@@ -1423,13 +1423,14 @@
> "[-ahinv] ifaces..."
> #define ifup_full_usage \
> "Options:\n" \
>- " -a De/configure all interfaces automatically\n" \
>- " -i FILE Use FILE for interface definitions\n" \
>- " -n Print out what would happen, but don't do it\n" \
>- " (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"
>+ " -a De/configure all interfaces automatically\n" \
>+ " -i FILE Use FILE for interface definitions\n" \
>+ " -n Print out what would happen, but don't do it\n" \
>+ " (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\n" \
>+ " --allow CLASS ignore non-\"allow-CLASS\" interfaces"
The long form should only be in the help-text if IFUPDOWN_LONG_OPTIONS
are set, -A otherwise (see below).
>
> #define ifdown_trivial_usage \
> "[-ahinv] ifaces..."
>@@ -1441,7 +1442,8 @@
> " (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\n" \
>+ " --allow CLASS ignore non-\"allow-CLASS\" interfaces"
Ditto.
>
> #define inetd_trivial_usage \
> "[-f] [-q len] [conf]"
>diff -r a75029f7bc4b networking/Config.in
>--- a/networking/Config.in Thu Aug 23 11:47:23 2007 +0200
>+++ b/networking/Config.in Thu Aug 23 11:47:40 2007 +0200
>@@ -333,6 +333,14 @@ config FEATURE_IFUPDOWN_EXTERNAL_DHCP
> Otherwise, if udhcpc applet is enabled, it is used.
> Otherwise, ifup/ifdown will have no support for DHCP.
>
>+config FEATURE_IFUPDOWN_LONG_OPTIONS
>+ bool "Enable long options support"
>+ default n
>+ depends on IFUPDOWN
depends on IFUPDOWN && GETOPT_LONG
Please add "-A" as short option for --allow here and to the upstream
version for consistency.
>+ help
>+ This enables the long options upport for the ifup and ifdown
>+ utilities.
>+
> config INETD
> bool "inetd"
> default n
>diff -r a75029f7bc4b networking/ifupdown.c
>--- a/networking/ifupdown.c Thu Aug 23 11:47:23 2007 +0200
>+++ b/networking/ifupdown.c Thu Aug 23 11:47:40 2007 +0200
>@@ -769,7 +783,7 @@ static struct interfaces_file_t *read_in
>
> debug_noise("iface %s %s %s\n", currif->iface, address_family_name, method_name);
> currently_processing = IFACE;
>- } else if (strcmp(firstword, "auto") == 0) {
>+ } else if ((strcmp(firstword, "auto") == 0) || (strcmp(firstword, "allow-auto") == 0)) {
Please convert all these strcmp to index_in_strings()
> while ((firstword = next_word(&buf_ptr)) != NULL) {
>
> /* Check the interface isnt already listed */
>@@ -1232,8 +1273,9 @@ int ifupdown_main(int argc, char **argv)
> }
> }
> #endif
>-
>+
The above adds superflous whitespace, please drop this.
> iface_list = defn->ifaces;
>+
> while (iface_list) {
> currif = (struct interface_defn_t *) iface_list->data;
> if (strcmp(liface, currif->iface) == 0) {
More information about the busybox
mailing list