[PATCH] ifupdown: support post-up / pre-down hooks
Ralf Friedl
Ralf.Friedl at online.de
Thu Oct 6 15:02:36 UTC 2011
Peter Korsgaard wrote:
> diff --git a/networking/ifupdown.c b/networking/ifupdown.c
> index 3820330..abc6b58 100644
> --- a/networking/ifupdown.c
> +++ b/networking/ifupdown.c
> @@ -891,6 +891,8 @@ static struct interfaces_file_t *read_interfaces(const char *filename)
> if (strcmp(first_word, "up") != 0
> && strcmp(first_word, "down") != 0
> && strcmp(first_word, "pre-up") != 0
> + && strcmp(first_word, "pre-down") != 0
> + && strcmp(first_word, "post-up") != 0
> && strcmp(first_word, "post-down") != 0
> ) {
> int i;
> @@ -987,6 +989,8 @@ static void set_environ(struct interface_defn_t *iface, const char *mode)
> if (strcmp(iface->option[i].name, "up") == 0
> || strcmp(iface->option[i].name, "down") == 0
> || strcmp(iface->option[i].name, "pre-up") == 0
> + || strcmp(iface->option[i].name, "pre-down") == 0
> + || strcmp(iface->option[i].name, "post-up") == 0
> || strcmp(iface->option[i].name, "post-down") == 0
> ) {
> continue;
>
This seems to be a good candidate for:
static const char keywords_up_down[] ALIGN1 = "up\0" "down\0" "pre-up\0"
"pre-down\0" "post-up\0" "post-down\0" ;
if (index_in_substrings(keywords_up_down, first_word) < 0)
if (index_in_substrings(keywords_up_down, iface->option[i].name >= 0)
Ralf
More information about the busybox
mailing list