diff -Nru ifupdown-0.8.17ubuntu1/archcommon.c ifupdown-0.8.32ubuntu1/archcommon.c --- ifupdown-0.8.17ubuntu1/archcommon.c 2016-11-25 11:16:17.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/archcommon.c 2018-04-24 22:47:12.000000000 +0000 @@ -8,6 +8,7 @@ #include #include #include +#include #include "archcommon.h" @@ -38,21 +39,19 @@ uint8_t mac[6]; int fd = open("/dev/urandom", O_RDONLY); if(!fd) { - perror("/dev/urandom"); + warn("/dev/urandom"); return; } if(read(fd, mac, sizeof mac) != sizeof mac) { - perror("/dev/urandom"); + warn("/dev/urandom"); return; } close(fd); mac[0] |= 0x2; // locally administered mac[0] &= ~0x1; // unicast *pparam = realloc(*pparam, 18); - if (!*pparam) { - perror("realloc"); - exit(1); - } + if (!*pparam) + err(1, "realloc"); snprintf(*pparam, 18, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); return; } @@ -239,13 +238,10 @@ strcpy(*pparam, token); } else { if (argc == 3) { - *pparam = realloc(*pparam, strlen(argv[2]) + 1); - if (*pparam == NULL) { - free(s); - return; - } - - strcpy(*pparam, argv[2]); + free(*pparam); + *pparam = strdup(argv[2]); + if (!*pparam) + err(1, "strdup"); } } diff -Nru ifupdown-0.8.17ubuntu1/archcommon.h ifupdown-0.8.32ubuntu1/archcommon.h --- ifupdown-0.8.17ubuntu1/archcommon.h 2016-11-25 11:16:17.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/archcommon.h 2018-04-24 22:47:12.000000000 +0000 @@ -17,3 +17,4 @@ void to_decimal(interface_defn *ifd, char **pparam, int argc, char **argv); void map_value(interface_defn *ifd, char **pparam, int argc, char **argv); void if_set(interface_defn *ifd, char **pparam, int argc, char **argv); +bool variable_match(const char *iface, const char *variable, const char *pattern); diff -Nru ifupdown-0.8.17ubuntu1/archhurd.c ifupdown-0.8.32ubuntu1/archhurd.c --- ifupdown-0.8.17ubuntu1/archhurd.c 2016-11-25 11:16:17.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/archhurd.c 2018-04-24 22:47:12.000000000 +0000 @@ -1 +1,15 @@ -/* No Hurd specific functions. */ +#define _GNU_SOURCE + +#include +#include +#include + +#include "archcommon.h" + +bool variable_match(const char *iface, const char *variable, const char *pattern) { + if (!strcasecmp(variable, "name")) + return fnmatch(pattern, iface, FNM_EXTMATCH) == 0; + + warnx("Unknown or unsupport pattern variable %s", variable); + return false; +} diff -Nru ifupdown-0.8.17ubuntu1/archkfreebsd.c ifupdown-0.8.32ubuntu1/archkfreebsd.c --- ifupdown-0.8.17ubuntu1/archkfreebsd.c 2016-11-25 11:16:17.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/archkfreebsd.c 2018-04-24 22:47:11.000000000 +0000 @@ -1 +1,42 @@ -/* No kFreeBSD specific functions. */ +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include + +#include "archcommon.h" + +static bool match_mac(const char *iface, const char *pattern) { + for (struct ifaddrs *ifa = ifap; ifa; ifa = ifa->ifa_next) { + if (ifa->ifa_addr->sa_family != AF_LINK) + continue; + + struct sockaddr_dl *dl = (struct sockaddr_dl *)ifa->ifa_addr; + if (dl->sdl_alen != 6) + continue; + + if (strcmp(ifa->ifa_name, iface)) + continue; + + unsigned char *ll = (unsigned char *)LLADDR(dl); + char buf[18]; + snprintf(buf, sizeof buf, "%02x:%02x:%02x:%02x:%02x:%02x", ll[0], ll[1], ll[2], ll[3], ll[4], ll[5]); + return fnmatch(pattern, buf, FNM_EXTMATCH) == 0; + } + + return false; +} + +bool variable_match(const char *iface, const char *variable, const char *pattern) { + if (!strcasecmp(variable, "mac")) + return match_mac(iface, pattern); + + if (!strcasecmp(variable, "name")) + return fnmatch(pattern, iface, FNM_EXTMATCH) == 0; + + warnx("Unknown or unsupported pattern variable %s", variable); + return false; +} diff -Nru ifupdown-0.8.17ubuntu1/archlinux.c ifupdown-0.8.32ubuntu1/archlinux.c --- ifupdown-0.8.17ubuntu1/archlinux.c 2016-11-25 11:16:17.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/archlinux.c 2018-04-24 22:47:11.000000000 +0000 @@ -1,33 +1,49 @@ +#define _GNU_SOURCE + #include #include #include #include #include +#include +#include -#include "archlinux.h" - -unsigned int mylinuxver(void) { - static int maj = -1, rev = 0, min = 0; +#include "archcommon.h" - if (maj == -1) { - struct utsname u; - char *pch; - - uname(&u); - maj = atoi(u.release); - pch = strchr(u.release, '.'); - if (pch) { - rev = atoi(pch + 1); - pch = strchr(pch + 1, '.'); - if (pch) { - min = atoi(pch + 1); - } +bool variable_match(const char *iface, const char *variable, const char *pattern) { + // Map platform-independent variables to sysfs names + if(!strcasecmp(variable, "mac")) + variable = "address"; + + // Open the corresponding sysfs file + char *filename = NULL; + if(asprintf(&filename, "/sys/class/net/%s/%s", iface, variable) == -1 || !filename) + errx(1, "asprintf"); + + // Shortcut: * tests for file presence + if(!strcmp(pattern, "*")) + return access(filename, F_OK); + + FILE *f = fopen(filename, "r"); + if(!f) + return false; + + // Match against any line + char buf[1024]; + bool found = false; + while(fgets(buf, sizeof buf, f)) { + // strip newline + size_t len = strlen(buf); + if(len && buf[len - 1] == '\n') + buf[len - 1] = 0; + + if(fnmatch(pattern, buf, FNM_EXTMATCH) == 0) { + found = true; + break; } } - return mylinux(maj, rev, min); -} + fclose(f); -unsigned int mylinux(int maj, int rev, int min) { - return min | rev << 10 | maj << 13; + return found; } diff -Nru ifupdown-0.8.17ubuntu1/config.c ifupdown-0.8.32ubuntu1/config.c --- ifupdown-0.8.17ubuntu1/config.c 2018-03-21 21:38:53.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/config.c 2018-04-24 22:47:12.000000000 +0000 @@ -12,6 +12,7 @@ #include #include #include +#include #include "header.h" @@ -168,9 +169,11 @@ if (*allowups == NULL) { *allowups = calloc(1, sizeof **allowups); if (*allowups == NULL) - return NULL; + err(1, "calloc"); (*allowups)->when = strdup(name); + if ((*allowups)->when == NULL) + err(1, "strdup"); } return *allowups; @@ -188,10 +191,8 @@ allow_up->max_interfaces++; tmp = realloc(allow_up->interfaces, sizeof(*tmp) * allow_up->max_interfaces); - if (tmp == NULL) { - perror(filename); - return NULL; - } + if (tmp == NULL) + err(1, "realloc"); allow_up->interfaces = tmp; } @@ -228,10 +229,8 @@ free((*var)[j].value); (*var)[j].value = strdup(value); - if (!(*var)[j].value) { - perror(argv0); - return NULL; - } + if (!(*var)[j].value) + err(1, "strdup"); return &((*var)[j]); } @@ -244,10 +243,8 @@ *max_vars += 10; new_var = realloc(*var, sizeof *new_var * *max_vars); - if (new_var == NULL) { - perror(argv0); - return NULL; - } + if (new_var == NULL) + err(1, "realloc"); *var = new_var; } @@ -255,15 +252,8 @@ (*var)[*n_vars].name = strndup(name, len); (*var)[*n_vars].value = strdup(value); - if (!(*var)[*n_vars].name) { - perror(argv0); - return NULL; - } - - if (!(*var)[*n_vars].value) { - perror(argv0); - return NULL; - } + if (!(*var)[*n_vars].name || !(*var)[*n_vars].value) + err(1, "strdup"); (*n_vars)++; return &((*var)[(*n_vars) - 1]); @@ -318,17 +308,12 @@ return true; struct seen_file *seen = malloc(sizeof *seen); - if(!seen) { - perror("malloc"); - return false; - } + if(!seen) + err(1, "malloc"); seen->filename = strdup(filename); - if(!seen->filename) { - free(seen); - perror("strdup"); - return false; - } + if(!seen->filename) + err(1, "strdup"); seen->next = seen_files; seen_files = seen; @@ -361,10 +346,8 @@ variable *new_option; new_option = realloc(destif->option, sizeof *new_option * srcif->n_options); - if (new_option == NULL) { - perror(argv0); - return NULL; - } + if (new_option == NULL) + err(1, "realloc"); destif->option = new_option; destif->max_options = srcif->n_options; @@ -372,16 +355,12 @@ for (int i = 0; i < srcif->n_options; i++) { destif->option[i].name = strdup(srcif->option[i].name); - if (!destif->option[i].name) { - perror(argv0); - return NULL; - } + if (!destif->option[i].name) + err(1, "strdup"); destif->option[i].value = strdup(srcif->option[i].value); - if (!destif->option[i].value) { - perror(argv0); - return NULL; - } + if (!destif->option[i].value) + err(1, "strdup"); } destif->n_options = srcif->n_options; @@ -391,15 +370,12 @@ static void add_to_list(char ***list, int *count, const char *item) { (*count)++; *list = realloc(*list, sizeof **list * *count); - if (!*list) { - perror("realloc"); - exit(1); - } + if (!*list) + err(1, "realloc"); + (*list)[*count - 1] = strdup(item); - if (!(*list)[*count - 1]) { - perror("strdup"); - exit(1); - } + if (!(*list)[*count - 1]) + err(1, "strdup"); } static interfaces_file *read_interfaces_defn(interfaces_file *defn, const char *filename) { @@ -418,7 +394,7 @@ f = fopen(filename, "r"); if (f == NULL) { - fprintf(stderr, "warning: couldn't open interfaces file \"%s\"\n", filename); + warn("couldn't open interfaces file \"%s\"", filename); return defn; } @@ -431,10 +407,8 @@ if (strcmp(firstword, "mapping") == 0) { currmap = calloc(1, sizeof *currmap); - if (currmap == NULL) { - perror(filename); - return NULL; - } + if (currmap == NULL) + err(1, "calloc"); while ((rest = next_word(rest, firstword, 80))) { if (currmap->max_matches == currmap->n_matches) { @@ -442,11 +416,8 @@ currmap->max_matches = currmap->max_matches * 2 + 1; tmp = realloc(currmap->match, sizeof(*tmp) * currmap->max_matches); - if (tmp == NULL) { - currmap->max_matches = (currmap->max_matches - 1) / 2; - perror(filename); - return NULL; - } + if (tmp == NULL) + err(1, "realloc"); currmap->match = tmp; } @@ -464,16 +435,12 @@ currently_processing = MAPPING; } else if (strcmp(firstword, "source") == 0) { char *filename_dup = strdup(filename); - if (filename_dup == NULL) { - perror(filename); - return NULL; - } + if (filename_dup == NULL) + err(1, "strdup"); char *dir = strdup(dirname(filename_dup)); - if (dir == NULL) { - perror(filename); - return NULL; - } + if (dir == NULL) + err(1, "strdup"); free(filename_dup); @@ -484,22 +451,16 @@ size_t s = strlen(rest) + 1; /* + NUL */ pattern = malloc(s); - if (pattern == NULL) { - free(dir); - perror(filename); - return NULL; - } + if (pattern == NULL) + err(1, "malloc"); pattern[0] = '\0'; } else { size_t s = l + strlen(rest) + 2; /* + slash + NUL */ pattern = malloc(s); - if (pattern == NULL) { - free(dir); - perror(filename); - return NULL; - } + if (pattern == NULL) + err(1, "malloc"); pattern[0] = '\0'; strcat(pattern, dir); @@ -523,7 +484,7 @@ continue; if (verbose) - fprintf(stderr, "Parsing file %s\n", w[i]); + warnx("parsing file %s", w[i]); read_interfaces_defn(defn, w[i]); } @@ -536,16 +497,12 @@ currently_processing = NONE; } else if (strlmatch(firstword, "source-dir") == 0) { char *filename_dup = strdup(filename); - if (filename_dup == NULL) { - perror(filename); - return NULL; - } + if (filename_dup == NULL) + err(1, "strdup"); char *dir = strdup(dirname(filename_dup)); - if (dir == NULL) { - perror(filename); - return NULL; - } + if (dir == NULL) + err(1, "strdup"); free(filename_dup); @@ -556,22 +513,16 @@ size_t s = strlen(rest) + 1; /* + NUL */ pattern = malloc(s); - if (pattern == NULL) { - free(dir); - perror(filename); - return NULL; - } + if (pattern == NULL) + err(1, "malloc"); pattern[0] = '\0'; } else { size_t s = l + strlen(rest) + 2; /* + slash + NUL */ pattern = malloc(s); - if (pattern == NULL) { - free(dir); - perror(filename); - return NULL; - } + if (pattern == NULL) + err(1, "malloc"); pattern[0] = '\0'; strcat(pattern, dir); @@ -591,7 +542,7 @@ if (n >= 0) { if (verbose) - fprintf(stderr, "Reading directory %s\n", w[i]); + warnx("reading directory %s", w[i]); size_t ll = strlen(w[i]); @@ -599,10 +550,8 @@ size_t s = ll + strlen(namelist[j]->d_name) + 2; /* + slash + NUL */ char *name = malloc(s); - if (name == NULL) { - perror(filename); - return NULL; - } + if (name == NULL) + err(1, "malloc"); name[0] = '\0'; strcat(name, w[i]); @@ -610,8 +559,7 @@ strcat(name, namelist[j]->d_name); if (verbose) - fprintf(stderr, "Parsing file %s\n", name); - + warnx("parsing file %s", name); read_interfaces_defn(defn, name); free(name); } @@ -633,10 +581,8 @@ keyword kw = NIL; currif = malloc(sizeof *currif); - if (!currif) { - perror(filename); - return NULL; - } + if (!currif) + err(1, "malloc"); *currif = (interface_defn) { .max_options = 0, @@ -646,7 +592,7 @@ rest = next_word(rest, iface_name, 80); if (rest == NULL) { - fprintf(stderr, "%s:%d: too few parameters for iface line\n", filename, line); + warnx("%s:%d: too few parameters for iface line", filename, line); free(currif); return NULL; } @@ -669,13 +615,13 @@ } if ((currif->address_family == NULL) && (kw == NIL)) { - fprintf(stderr, "%s:%d: unknown or no address type and no inherits keyword specified\n", filename, line); + warnx("%s:%d: unknown or no address type and no inherits keyword specified", filename, line); free(currif); return NULL; } if ((currif->method == NULL) && (kw == NIL)) { - fprintf(stderr, "%s:%d: unknown or no method and no inherits keyword specified\n", filename, line); + warnx("%s:%d: unknown or no method and no inherits keyword specified", filename, line); free(currif); return NULL; /* FIXME */ } @@ -685,7 +631,7 @@ if (rest != NULL) { kw = get_keyword(inherits); if (kw == NIL) { - fprintf(stderr, "%s:%d: extra parameter for the iface line not understood and ignored: %s\n", filename, line, inherits); + warnx("%s:%d: extra parameter for the iface line not understood and ignored: %s", filename, line, inherits); } } } @@ -693,14 +639,14 @@ if (kw != NIL) { rest = next_word(rest, inherits, 80); if (rest == NULL) { - fprintf(stderr, "%s:%d: '%s' keyword is missing a parameter\n", filename, line, keywords[kw]); + warnx("%s:%d: '%s' keyword is missing a parameter", filename, line, keywords[kw]); free(currif); return NULL; } if (kw == INHERITS) { interface_defn *otherif = get_interface(defn, inherits, currif->address_family ? address_family_name : NULL); if (otherif == NULL) { - fprintf(stderr, "%s:%d: unknown iface to inherit from: %s (%s)\n", filename, line, inherits, currif->address_family ? address_family_name : "*"); + warnx("%s:%d: unknown iface to inherit from: %s (%s)", filename, line, inherits, currif->address_family ? address_family_name : "*"); free(currif); return NULL; } @@ -721,11 +667,8 @@ } currif->logical_iface = strdup(iface_name); - if (!currif->logical_iface) { - perror(filename); - free(currif); - return NULL; - } + if (!currif->logical_iface) + err(1, "strdup"); if (((!strcmp(address_family_name, "inet")) || (!strcmp(address_family_name, "inet6"))) && (!strcmp(method_name, "loopback"))) no_loopback = true; @@ -742,37 +685,46 @@ } else if (strcmp(firstword, "auto") == 0) { allowup_defn *auto_ups = get_allowup(&defn->allowups, "auto"); - if (!auto_ups) { - perror(filename); - return NULL; - } - - while ((rest = next_word(rest, firstword, 80))) - if (!add_allow_up(filename, line, auto_ups, firstword)) - return NULL; + if ((!rest || !*rest) && currently_processing == IFACE) { + add_allow_up(filename, line, auto_ups, currif->logical_iface); + } else { + while ((rest = next_word(rest, firstword, 80))) + add_allow_up(filename, line, auto_ups, firstword); - currently_processing = NONE; + currently_processing = NONE; + } } else if (strncmp(firstword, "allow-", 6) == 0 && strlen(firstword) > 6) { allowup_defn *allow_ups = get_allowup(&defn->allowups, firstword + 6); - if (!allow_ups) { - perror(filename); - return NULL; - } - - while ((rest = next_word(rest, firstword, 80))) - if (!add_allow_up(filename, line, allow_ups, firstword)) - return NULL; + if ((!rest || !*rest) && currently_processing == IFACE) { + add_allow_up(filename, line, allow_ups, currif->logical_iface); + } else { + while ((rest = next_word(rest, firstword, 80))) + add_allow_up(filename, line, allow_ups, firstword); - currently_processing = NONE; + currently_processing = NONE; + } } else if (strcmp(firstword, "no-auto-down") == 0) { - while ((rest = next_word(rest, firstword, 80))) - add_to_list(&no_auto_down_int, &no_auto_down_ints, firstword); + if ((!rest || !*rest) && currently_processing == IFACE) { + add_to_list(&no_auto_down_int, &no_auto_down_ints, currif->logical_iface); + } else { + while ((rest = next_word(rest, firstword, 80))) + add_to_list(&no_auto_down_int, &no_auto_down_ints, firstword); - currently_processing = NONE; + currently_processing = NONE; + } } else if (strcmp(firstword, "no-scripts") == 0) { + if ((!rest || !*rest) && currently_processing == IFACE) { + add_to_list(&no_scripts_int, &no_scripts_ints, currif->logical_iface); + } else { + while ((rest = next_word(rest, firstword, 80))) + add_to_list(&no_scripts_int, &no_scripts_ints, firstword); + + currently_processing = NONE; + } + } else if (strcmp(firstword, "rename") == 0) { while ((rest = next_word(rest, firstword, 80))) - add_to_list(&no_scripts_int, &no_scripts_ints, firstword); + add_to_list(&rename_int, &rename_ints, firstword); currently_processing = NONE; } else { @@ -785,7 +737,7 @@ strcpy(firstword, "down"); if (strlen(rest) == 0) { - fprintf(stderr, "%s:%d: option with empty value\n", filename, line); + warnx("%s:%d: option with empty value", filename, line); return NULL; } @@ -795,10 +747,8 @@ size_t l = strlen(currif->option[i].value); currif->option[i].value = realloc(currif->option[i].value, l + strlen(rest) + 2); /* 2 for NL and NULL */ - if (!currif->option[i].value) { - perror(filename); - return NULL; - } + if (!currif->option[i].value) + err(1, "realloc"); currif->option[i].value[l] = '\n'; strcpy(&(currif->option[i].value[l + 1]), rest); @@ -813,7 +763,7 @@ case MAPPING: if (strcmp(firstword, "script") == 0) { if (currmap->script != NULL) { - fprintf(stderr, "%s:%d: duplicate script in mapping\n", filename, line); + warnx("%s:%d: duplicate script in mapping", filename, line); return NULL; } else { currmap->script = strdup(rest); @@ -824,10 +774,8 @@ currmap->max_mappings = currmap->max_mappings * 2 + 1; opt = realloc(currmap->mapping, sizeof(*opt) * currmap->max_mappings); - if (opt == NULL) { - perror(filename); - return NULL; - } + if (opt == NULL) + err(1, "realloc"); currmap->mapping = opt; } @@ -835,27 +783,29 @@ currmap->mapping[currmap->n_mappings] = strdup(rest); currmap->n_mappings++; } else { - fprintf(stderr, "%s:%d: misplaced option\n", filename, line); + warnx("%s:%d: misplaced option", filename, line); return NULL; } break; case NONE: default: - fprintf(stderr, "%s:%d: misplaced option\n", filename, line); + warnx("%s:%d: misplaced option", filename, line); return NULL; } } } if (ferror(f) != 0) { - perror(filename); + warn("%s", filename); return NULL; } fclose(f); line = -1; + free(buf); + return defn; } @@ -876,10 +826,8 @@ if (!no_loopback) { interface_defn *lo_if = malloc(sizeof *lo_if); - if (!lo_if) { - perror(filename); - return NULL; - } + if (!lo_if) + err(1, "malloc"); *lo_if = (interface_defn) { .logical_iface = strdup(LO_IFACE), diff -Nru ifupdown-0.8.17ubuntu1/debian/changelog ifupdown-0.8.32ubuntu1/debian/changelog --- ifupdown-0.8.17ubuntu1/debian/changelog 2018-03-21 21:53:25.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/debian/changelog 2018-05-15 04:17:23.000000000 +0000 @@ -1,3 +1,157 @@ +ifupdown (0.8.32ubuntu1) cosmic; urgency=low + + * Merge from Debian unstable. Remaining changes: + - Always call dhclient with -1, Ubuntu carries a patch so that renewal + won't time out. + - ifup@.service, ifupdown-hotplug: Additionally run for "auto" class. We + don't really support "allow-hotplug" in Ubuntu at the moment, so we need + to deal with "auto" devices appearing after the "networking" init script + already ran. + * Dropped changes, included in Debian: + - Drop obsolete upstart integration. + + -- Steve Langasek Mon, 14 May 2018 21:17:23 -0700 + +ifupdown (0.8.32) unstable; urgency=medium + + [ Guus Sliepen ] + * Fix check-mac-address.sh and get-mac-address.sh example scripts. + * Update the manpages and add an entry to NEWS about the possibility that + ifupdown runs in parallel. Closes: #894511 + * Migrate the VCS repository to Salsa. + * Allow ifquery to be run recursively from ifup and ifdown. Closes: #896433 + + [ Filipe Brandenburger ] + * Prevent ExecStartPre from exiting with non-zero status when not supposed + to do anything. Closes: #894759 + + -- Guus Sliepen Tue, 24 Apr 2018 18:15:34 +0200 + +ifupdown (0.8.31) unstable; urgency=medium + + * Do not enable ifupdown-wait-online.service by default. Closes: #891139 + * Drop Before=network.target from ifupdown-wait-online.service. + + -- Guus Sliepen Sat, 03 Mar 2018 17:49:51 +0100 + +ifupdown (0.8.30) unstable; urgency=medium + + [ Guus Sliepen ] + * Use >&2 instead of >/dev/stderr. Closes: #890988 + * Bump Standards-Version and debian/compat. + + [ Arthur Gautier ] + * Use ip instead of writing to /sys to better supported network namespaces. + + -- Guus Sliepen Wed, 21 Feb 2018 22:02:31 +0100 + +ifupdown (0.8.29) unstable; urgency=medium + + [ Sven Joachim ] + * Remove obsolete conffiles from the system. Closes: #879802 + + -- Guus Sliepen Thu, 26 Oct 2017 20:25:15 +0200 + +ifupdown (0.8.28) unstable; urgency=medium + + * Fix testsuite failure if ifupdown isn't already installed. + + -- Guus Sliepen Wed, 25 Oct 2017 21:38:16 +0200 + +ifupdown (0.8.27) unstable; urgency=medium + + [ Guus Sliepen ] + * Automatically bring up VLAN parent interfaces, and bring down VLAN slave + interfaces. Closes: #879518 + * Update testcases. + * Flush IP addresses when bringing down physical links. Closes: #845121 + * Add -v option to IPv6 dhclient. + * Let ifquery print all matching interface stanzas. Closes: #878836 + * Guessnet and network-manager do support the source directive nowadays. + Closes: #863135 + * Remove all references to upstart from scripts. Closes: #861164 + * Bump Standards-Version. + * Bump debian/compat and the minimum required debhelper version. + + [ Alex Fox ] + * Use a more reliable check for Infiniband interfaces. Closes: #857976 + + -- Guus Sliepen Wed, 25 Oct 2017 20:53:27 +0200 + +ifupdown (0.8.25) unstable; urgency=medium + + [ SATOH Fumiyasu] + * wait-online.sh: Evaluate "$WAIT_ONLINE_IFACE". Closes: #873475 + + [ Guus Sliepen ] + * Don't check for another instance of ifup running during hotplug. + Closes: #873110 + * Drop upstart system jobs. + + -- Guus Sliepen Wed, 30 Aug 2017 22:50:08 +0200 + +ifupdown (0.8.24) unstable; urgency=medium + + [ Svante Signell ] + * Fix FTBFS on hurd-i386 and kfreebsd-any. Closes: #869954 + + [ Guus Sliepen ] + * Don't interpret interface names starting with /dev/ as a pattern on + GNU/Hurd. + * Support MAC address matching on kFreeBSD. + + -- Guus Sliepen Fri, 28 Jul 2017 18:05:33 +0200 + +ifupdown (0.8.23) unstable; urgency=medium + + * Handle interface renaming in the ifupdown-hotplug script. Closes: #869275 + * Fix typo in the manpage. Closes: #869276 + + -- Guus Sliepen Mon, 24 Jul 2017 13:03:31 +0200 + +ifupdown (0.8.22) unstable; urgency=medium + + * Support interface renaming. + * Add ifupdown-wait-online.service. Closes: #868650 + + -- Guus Sliepen Sat, 22 Jul 2017 01:10:34 +0200 + +ifupdown (0.8.21) unstable; urgency=medium + + * Ensure allow-* also allows pattern matching. Closes: #868493 + + -- Guus Sliepen Sun, 16 Jul 2017 13:38:59 +0200 + +ifupdown (0.8.20) unstable; urgency=medium + + * Change udevadm path to /bin/udevadm. Closes: #852559 + * Add initial pattern matching support. + * Bump Standards-Version. + + -- Guus Sliepen Sat, 15 Jul 2017 22:01:17 +0200 + +ifupdown (0.8.19) unstable; urgency=medium + + * Fix exit code of ifquery --state. Closes: #852976 + + -- Guus Sliepen Mon, 30 Jan 2017 14:32:18 +0100 + +ifupdown (0.8.18) unstable; urgency=medium + + [ Svante Signell ] + * Makefile: Add removal of tests/*/state.* directories in the clean target. + * Update testcases for GNU/Hurd. + + [ Guus Sliepen ] + * Use dynamically allocated strings for filenames. This avoids using + PATH_MAX, which caused a FTBFS on Hurd. Based on Svante's patch. + Closes: #845140 + * Fix some memory leaks. + * Improve error messages. + * Always immediately quit when running out of memory. + + -- Guus Sliepen Wed, 11 Jan 2017 20:43:06 +0100 + ifupdown (0.8.17ubuntu1) bionic; urgency=medium * Merge from Debian unstable. diff -Nru ifupdown-0.8.17ubuntu1/debian/compat ifupdown-0.8.32ubuntu1/debian/compat --- ifupdown-0.8.17ubuntu1/debian/compat 2016-11-25 11:16:17.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/debian/compat 2018-04-24 22:47:13.000000000 +0000 @@ -1 +1 @@ -9 +11 diff -Nru ifupdown-0.8.17ubuntu1/debian/control ifupdown-0.8.32ubuntu1/debian/control --- ifupdown-0.8.17ubuntu1/debian/control 2018-03-21 21:38:53.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/debian/control 2018-05-15 04:17:23.000000000 +0000 @@ -3,10 +3,11 @@ Priority: important Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Guus Sliepen -Standards-Version: 3.9.8 -Build-Depends: debhelper (>= 9.20120410~), dh-systemd -Vcs-Git: https://anonscm.debian.org/git/collab-maint/ifupdown.git -Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/ifupdown.git +Standards-Version: 4.1.3 +Build-Depends: debhelper (>= 11) +Vcs-Git: https://salsa.debian.org/debian/ifupdown.git +Vcs-Browser: https://salsa.debian.org/debian/ifupdown +Rules-Requires-Root: no Package: ifupdown Architecture: any diff -Nru ifupdown-0.8.17ubuntu1/debian/ifupdown-hotplug ifupdown-0.8.32ubuntu1/debian/ifupdown-hotplug --- ifupdown-0.8.17ubuntu1/debian/ifupdown-hotplug 2016-11-28 13:40:17.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/debian/ifupdown-hotplug 2018-05-15 04:17:23.000000000 +0000 @@ -58,19 +58,17 @@ net_ifup() { check_program /sbin/ifup - # exit if the interface is not configured as allow-hotplug or auto - if ! (ifquery --allow hotplug -l; ifquery --allow auto -l) | grep -q "^${INTERFACE}\$"; then + # exit if the interface is not configured as allow-hotplug + TARGET_IFACE=$(/sbin/ifquery --allow hotplug -l "$INTERFACE" || true) + if [ -z "$TARGET_IFACE" ]; then + TARGET_IFACE=$(/sbin/ifquery --allow auto -l "$INTERFACE" || true) + fi + if [ -z "$TARGET_IFACE" ]; then exit 0 fi if [ -d /run/systemd/system ]; then - exec systemctl --no-block start $(systemd-escape --template ifup@.service $INTERFACE) - fi - - local out=$(ps -C ifup ho args) - if [ "${out%$INTERFACE*}" != "$out" ]; then - mesg "Already ifup-ing interface $INTERFACE" - exit 0 + exec systemctl --no-block start $(systemd-escape --template ifup@.service $TARGET_IFACE) fi wait_for_interface lo @@ -87,12 +85,6 @@ exit 0 fi - local out=$(ps -C ifdown ho args) - if [ "${out%$INTERFACE*}" != "$out" ]; then - mesg "Already ifdown-ing interface $INTERFACE" - exit 0 - fi - exec ifdown --allow=hotplug $INTERFACE } @@ -133,7 +125,7 @@ if [ -d /run/systemd/system ]; then do_everything else - # under sysvinit/upstart we need to fork as we start the long-running + # under sysvinit we need to fork as we start the long-running # "ifup". but there, forked processes won't get killed. # When udev_log="debug" stdout and stderr are pipes connected to udevd. # They need to be closed or udevd will wait for this process which will diff -Nru ifupdown-0.8.17ubuntu1/debian/ifupdown.lintian-overrides ifupdown-0.8.32ubuntu1/debian/ifupdown.lintian-overrides --- ifupdown-0.8.17ubuntu1/debian/ifupdown.lintian-overrides 2016-11-25 11:16:17.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/debian/ifupdown.lintian-overrides 2018-04-24 22:47:13.000000000 +0000 @@ -1 +1,3 @@ ifupdown: init.d-script-possible-missing-stop etc/init.d/networking 1 +ifupdown: systemd-service-file-refers-to-unusual-wantedby-target lib/systemd/system/networking.service network-online.target +ifupdown: systemd-service-file-refers-to-unusual-wantedby-target lib/systemd/system/ifupdown-wait-online.service network-online.target diff -Nru ifupdown-0.8.17ubuntu1/debian/ifupdown.maintscript ifupdown-0.8.32ubuntu1/debian/ifupdown.maintscript --- ifupdown-0.8.17ubuntu1/debian/ifupdown.maintscript 2017-08-14 17:39:01.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/debian/ifupdown.maintscript 2018-05-15 04:17:23.000000000 +0000 @@ -1,9 +1,9 @@ rm_conffile /etc/default/ifupdown 0.7~+ ifupdown rm_conffile /etc/init.d/ifupdown 0.7~+ ifupdown rm_conffile /etc/init.d/ifupdown-clean 0.7~beta1 ifupdown -rm_conffile /etc/init/network-interface-container.conf 0.8.16ubuntu2~ ifupdown -rm_conffile /etc/init/network-interface-security.conf 0.8.16ubuntu2~ ifupdown -rm_conffile /etc/init/network-interface.conf 0.8.16ubuntu2~ ifupdown -rm_conffile /etc/init/networking.conf 0.8.16ubuntu2~ ifupdown -rm_conffile /etc/network/if-down.d/upstart 0.8.16ubuntu2~ ifupdown -rm_conffile /etc/network/if-up.d/upstart 0.8.16ubuntu2~ ifupdown +rm_conffile /etc/init/networking.conf 0.8.25~ ifupdown +rm_conffile /etc/init/network-interface-container.conf 0.8.25~ ifupdown +rm_conffile /etc/init/network-interface-security.conf 0.8.25~ ifupdown +rm_conffile /etc/init/network-interface.conf 0.8.25~ ifupdown +rm_conffile /etc/network/if-up.d/upstart 0.8.29~ ifupdown +rm_conffile /etc/network/if-down.d/upstart 0.8.29~ ifupdown diff -Nru ifupdown-0.8.17ubuntu1/debian/ifupdown-wait-online.service ifupdown-0.8.32ubuntu1/debian/ifupdown-wait-online.service --- ifupdown-0.8.17ubuntu1/debian/ifupdown-wait-online.service 1970-01-01 00:00:00.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/debian/ifupdown-wait-online.service 2018-03-02 13:05:43.000000000 +0000 @@ -0,0 +1,13 @@ +[Unit] +Description=Wait for network to be configured by ifupdown +DefaultDependencies=no +Before=network-online.target +ConditionFileIsExecutable=/sbin/ifup + +[Service] +Type=oneshot +ExecStart=/lib/ifupdown/wait-online.sh +RemainAfterExit=yes + +[Install] +WantedBy=network-online.target diff -Nru ifupdown-0.8.17ubuntu1/debian/networking.defaults ifupdown-0.8.32ubuntu1/debian/networking.defaults --- ifupdown-0.8.17ubuntu1/debian/networking.defaults 2016-11-25 11:16:17.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/debian/networking.defaults 2018-04-24 22:47:13.000000000 +0000 @@ -9,3 +9,23 @@ # Set to 'yes' to enable additional verbosity #VERBOSE=no + +# Method to wait for the network to become online, +# for services that depend on a working network: +# - ifup: wait for ifup to have configured an interface. +# - route: wait for a route to a given address to appear. +# - ping/ping6: wait for a host to respond to ping packets. +# - none: don't wait. +#WAIT_ONLINE_METHOD=ifup + +# Which interface to wait for. +# If none given, wait for all auto interfaces, or if there are none, +# wait for at least one hotplug interface. +#WAIT_ONLINE_IFACE= + +# Which address to wait for for route, ping and ping6 methods. +# If none is given for route, it waits for a default gateway. +#WAIT_ONLINE_ADDRESS= + +# Timeout in seconds for waiting for the network to come online. +#WAIT_ONLINE_TIMEOUT=300 diff -Nru ifupdown-0.8.17ubuntu1/debian/networking.init ifupdown-0.8.32ubuntu1/debian/networking.init --- ifupdown-0.8.17ubuntu1/debian/networking.init 2016-11-25 11:16:17.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/debian/networking.init 2018-04-24 22:47:13.000000000 +0000 @@ -119,9 +119,6 @@ case "$1" in start) - if init_is_upstart; then - exit 1 - fi process_options check_ifstate @@ -133,9 +130,9 @@ set -f exclusions=$(process_exclusions) log_action_begin_msg "Configuring network interfaces" - if [ -x /sbin/udevadm ]; then + if [ -x /bin/udevadm ]; then if [ -n "$(ifquery --list --exclude=lo)" ] || [ -n "$(ifquery --list --allow=hotplug)" ]; then - udevadm settle || true + /bin/udevadm settle || true fi fi if ifup -a $exclusions $verbose && ifup_hotplug $exclusions $verbose @@ -147,9 +144,6 @@ ;; stop) - if init_is_upstart; then - exit 0 - fi check_network_file_systems check_network_swap @@ -162,9 +156,6 @@ ;; reload) - if init_is_upstart; then - exit 1 - fi process_options log_action_begin_msg "Reloading network interfaces configuration" @@ -178,9 +169,6 @@ ;; force-reload|restart) - if init_is_upstart; then - exit 1 - fi process_options log_warning_msg "Running $0 $1 is deprecated because it may not re-enable some interfaces" diff -Nru ifupdown-0.8.17ubuntu1/debian/networking.service ifupdown-0.8.32ubuntu1/debian/networking.service --- ifupdown-0.8.17ubuntu1/debian/networking.service 2016-11-25 11:16:17.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/debian/networking.service 2018-04-24 22:47:13.000000000 +0000 @@ -14,7 +14,7 @@ [Service] Type=oneshot EnvironmentFile=-/etc/default/networking -ExecStartPre=-/bin/sh -c '[ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ] && udevadm settle' +ExecStartPre=-/bin/sh -c 'if [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ]; then udevadm settle; fi' ExecStart=/sbin/ifup -a --read-environment ExecStop=/sbin/ifdown -a --read-environment --exclude=lo RemainAfterExit=true diff -Nru ifupdown-0.8.17ubuntu1/debian/NEWS ifupdown-0.8.32ubuntu1/debian/NEWS --- ifupdown-0.8.17ubuntu1/debian/NEWS 2018-03-21 21:38:53.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/debian/NEWS 2018-04-24 22:47:13.000000000 +0000 @@ -1,3 +1,25 @@ +ifupdown (0.8.32) unstable; urgency=medium + + Since version 0.8, ifupdown allows concurrent calls of ifup and ifdown. + While calls for the same interface will be serialized, calls for different + interfaces can run in parallel. This is especially important during boot + time, when the chance is high that multiple interfaces are being brought up + concurrently. Ensure that any if-pre/post-up/down.d scripts you use are safe + to run concurrently, as well as any pre/post-up/down commands in + /etc/network/interfaces. + + -- Guus Sliepen Wed, 04 Apr 2018 23:20:51 +0200 + +ifupdown (0.8.20) unstable; urgency=medium + + Ifupdown now supports pattern matching for interfaces. This will help + writing /etc/network/interfaces for systems with changing interface names, + or to simplify configuration for a large number of interfaces. The details + are in the interfaces(5) manual page, and examples are provided in + /usr/share/doc/ifupdown/examples/pattern-matching. + + -- Guus Sliepen Tue, 10 Jan 2017 17:20:09 +0100 + ifupdown (0.8.17) unstable; urgency=medium Ifupdown now also configures VLANs for bridge interfaces. (Previously, the diff -Nru ifupdown-0.8.17ubuntu1/debian/rules ifupdown-0.8.32ubuntu1/debian/rules --- ifupdown-0.8.17ubuntu1/debian/rules 2017-08-14 17:39:11.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/debian/rules 2018-05-15 04:17:23.000000000 +0000 @@ -14,22 +14,19 @@ endif %: - dh $@ --parallel --with systemd + dh $@ override_dh_installinit: dh_installinit --name=networking --no-start + dh_installinit --name=ifupdown-wait-online --no-start --no-scripts install -p -m 0644 debian/networking.defaults $(DESTDIR)/etc/default/networking - dh_installinit --name=network-interface-container --noscripts - dh_installinit --name=network-interface-security --noscripts - dh_installinit --name=network-interface --noscripts dh_installinit --name=networking --noscripts - dh_installinit --name=ifup@ --noscripts + dh_installsystemd --name=networking + dh_installsystemd --name=ifup@ + dh_installsystemd --no-enable --no-start --name=ifupdown-wait-online override_dh_auto_clean: $(MAKE) clean -override_dh_systemd_enable: - dh_systemd_enable --name=networking - override_dh_installudev: dh_installudev --priority=80 diff -Nru ifupdown-0.8.17ubuntu1/defn2c.pl ifupdown-0.8.32ubuntu1/defn2c.pl --- ifupdown-0.8.17ubuntu1/defn2c.pl 2016-11-25 11:16:17.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/defn2c.pl 2018-04-24 22:47:12.000000000 +0000 @@ -126,12 +126,17 @@ if (match($line, "up", $indent)) { get_commands(${method}, "up"); } else { - print "static int _${method}_up(interface_defn ifd) { return 0; }\n" + print "static int _${method}_up(interface_defn *ifd, execfn *exec) { return 0; }\n" } if (match($line, "down", $indent)) { get_commands(${method}, "down"); } else { - print "static int _${method}_down(interface_defn ifd) { return 0; }\n" + print "static int _${method}_down(interface_defn *ifd, execfn *exec) { return 0; }\n" + } + if (match($line, "rename", $indent)) { + get_commands(${method}, "rename"); + } else { + print "static int _${method}_rename(interface_defn *ifd, execfn *exec) { return 0; }\n" } } sub skip_section { @@ -216,8 +221,8 @@ print < #include #include @@ -8,6 +10,7 @@ #include #include #include +#include #include "header.h" @@ -20,28 +23,13 @@ static char *setlocalenv_nomangle(char *format, char *name, char *value) { char *result; - - result = malloc(strlen(format) + strlen(name) + strlen(value) + 1); /* -4 for the two %s's */ - if (!result) { - perror("malloc"); - exit(1); - } - - sprintf(result, format, name, value); - + if(asprintf(&result, format, name, value) == -1) + err(1, "asprintf"); return result; } static char *setlocalenv(char *format, char *name, char *value) { - char *result; - - result = malloc(strlen(format) + strlen(name) + strlen(value) + 1); /* -4 for the two %s's */ - if (!result) { - perror("malloc"); - exit(1); - } - - sprintf(result, format, name, value); + char *result = setlocalenv_nomangle(format, name, value); char *here, *there; @@ -127,7 +115,7 @@ if (verbose || no_act) fprintf(stderr, "%s\n", str); - if (!no_act) { + if (!no_act_commands) { pid_t child; int status; @@ -140,7 +128,7 @@ case 0: /* child */ execle("/bin/sh", "/bin/sh", "-c", str, NULL, localenv); - exit(127); + err(127, "executing '%s' failed", str); default: /* parent */ break; @@ -175,11 +163,14 @@ if (no_scripts_ints && match_patterns(ifd->logical_iface, no_scripts_ints, no_scripts_int)) return 1; - char buf[100]; - snprintf(buf, sizeof(buf), "/bin/run-parts %s%s/etc/network/if-%s.d", ignore_failures ? "" : "--exit-on-error ", verbose ? "--verbose " : "", opt); + char *command; + if(asprintf(&command, "/bin/run-parts %s%s/etc/network/if-%s.d", ignore_failures ? "" : "--exit-on-error ", verbose ? "--verbose " : "", opt) == -1) + err(1, "asprintf"); + + int result = (*exec) (command); - int result = (*exec) (buf); + free(command); return ignore_failures ? 1 : result; } @@ -225,9 +216,8 @@ int iface_predown(interface_defn *iface) { if (!no_act) { - char pidfilename[100]; + char *pidfilename = make_pidfile_name("ifup", iface); - make_pidfile_name(pidfilename, sizeof(pidfilename), "ifup", iface); FILE *pidfile = fopen(pidfilename, "r"); if (pidfile) { @@ -235,7 +225,7 @@ if (fscanf(pidfile, "%d", &pid) == 1) { if (verbose) - fprintf(stderr, "Terminating ifup (pid %d)\n", pid); + warnx("terminating ifup (pid %d)", pid); kill((pid_t) - pid, SIGTERM); } @@ -243,6 +233,8 @@ fclose(pidfile); unlink(pidfilename); } + + free(pidfilename); } set_environ(iface, "stop", "pre-down"); @@ -293,7 +285,7 @@ for (int i = 0; i < iface->n_options; i++) printf("%s: %s\n", iface->option[i].name, iface->option[i].value); - return 0; + return 1; } static void addstr(char **buf, size_t *len, size_t *pos, const char *str, size_t strlen) { @@ -304,10 +296,8 @@ char *newbuf; newbuf = realloc(*buf, *len * 2 + strlen + 1); - if (!newbuf) { - perror("realloc"); - exit(1); /* a little ugly */ - } + if (!newbuf) + err(1, "realloc"); *buf = newbuf; *len = *len * 2 + strlen + 1; @@ -407,7 +397,7 @@ free(varvalue); } else { if (opt_depth == 1) - fprintf(stderr, "Missing required variable: %.*s\n", (int)namelen, command); + warnx("missing required variable: %.*s", (int)namelen, command); okay[opt_depth - 1] = 0; } @@ -555,11 +545,10 @@ case 0: /* child */ /* release the current directory */ - if(chdir("/") == -1) { + if(chdir("/") == -1) // VERY unlikely, but if this fails we probably don't want to continue anyway. - fprintf(stderr, "Could not chdir to /: %s\n", strerror(errno)); - exit(127); - } + err(127, "could not chdir to /"); + dup2(infd[0], 0); dup2(outfd[1], 1); close(infd[0]); @@ -567,7 +556,7 @@ close(outfd[0]); close(outfd[1]); execvp(command, argv); - exit(127); + err(127, "executing \"%s\" failed", command); default: /* parent */ *in = fdopen(infd[1], "w"); @@ -588,7 +577,7 @@ pid = popen2(&in, &out, map->script, physical, NULL); if (pid == 0) { - fprintf(stderr, "Could not execute mapping script %s on %s: %s\n", map->script, physical, strerror(errno)); + warn("could not execute mapping script %s on %s", map->script, physical); return false; } @@ -612,10 +601,10 @@ result = true; } else { - fprintf(stderr, "No output from mapping script %s on %s\n", map->script, physical); + warnx("no output from mapping script %s on %s", map->script, physical); } } else { - fprintf(stderr, "Error trying to executing mapping script %s on %s\n", map->script, physical); + warnx("error trying to executing mapping script %s on %s", map->script, physical); } fclose(out); diff -Nru ifupdown-0.8.17ubuntu1/header.h ifupdown-0.8.32ubuntu1/header.h --- ifupdown-0.8.17ubuntu1/header.h 2016-11-25 11:16:17.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/header.h 2018-04-24 22:47:12.000000000 +0000 @@ -3,6 +3,7 @@ #include #include +#include typedef struct address_family address_family; typedef struct method method; @@ -24,7 +25,7 @@ struct method { char *name; - command_set *up, *down; + command_set *up, *down, *rename; conversion *conversions; option_default *defaults; }; @@ -104,6 +105,7 @@ #endif extern address_family *addr_fams[]; +extern struct ifaddrs *ifap; variable *set_variable(const char *name, const char *value, variable **var, int *n_vars, int *max_vars); void convert_variables(conversion *conversions, interface_defn *ifd); @@ -129,10 +131,10 @@ bool var_set(const char *id, interface_defn *ifd); bool var_set_anywhere(const char *id, interface_defn *ifd); bool run_mapping(const char *physical, char *logical, int len, mapping_defn *map); -bool make_pidfile_name(char *name, size_t size, const char *command, interface_defn *fd); +char *make_pidfile_name(const char *command, interface_defn *fd); -extern const char *argv0; extern bool no_act; +extern bool no_act_commands; extern bool do_all; extern bool verbose; extern bool run_scripts; @@ -151,5 +153,7 @@ extern int no_auto_down_ints; extern char **no_scripts_int; extern int no_scripts_ints; +extern char **rename_int; +extern int rename_ints; #endif /* HEADER_H */ diff -Nru ifupdown-0.8.17ubuntu1/iface.defn ifupdown-0.8.32ubuntu1/iface.defn --- ifupdown-0.8.17ubuntu1/iface.defn 1970-01-01 00:00:00.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/iface.defn 2017-07-31 19:51:08.000000000 +0000 @@ -0,0 +1,528 @@ +architecture linux + +method address + up + /bin/ip addr add dev %iface% %value% + down + /bin/ip addr del dev %iface% %value% + +method route + up + /bin/ip route add dev %iface% %value% + down + /bin/ip route del dev %iface% %value% + +method gateway + up + /bin/ip route add dev %iface% default via %value% + down + /bin/ip route del dev %iface% default via %value% + +method rule + up + /bin/ip rule add %value% + down + /bin/ip rule del %value% + +method hwaddress + pre-up + /bin/ip link set %iface% address %value% + +method mtu + pre-up + /bin/ip link set %iface% address %value% + + options + address address -- Address (dotted quad/netmask) *required* + netmask mask -- Netmask (dotted quad or CIDR) + broadcast broadcast_address -- Broadcast address (dotted quad, + or -) [+] + metric metric -- Routing metric for default gateway (integer) + gateway address -- Default gateway (dotted quad) + pointopoint address -- Address of other end point (dotted quad). \ + Note the spelling of "point-to". + hwaddress address -- Link local address or "random". + mtu size -- MTU size + scope -- Address validity scope. Possible values: \ + global, link, host + + conversion + hwaddress cleanup_hwaddress + address compute_v4_mask =netmask? + address compute_v4_addr + broadcast compute_v4_broadcast + + up + /bin/ip addr add %address%[[/%netmask%]] [[broadcast %broadcast%]] \ + [[peer %pointopoint%]] [[scope %scope%]] dev %iface% label %iface% + /bin/ip link set dev %iface% [[mtu %mtu%]] [[address %hwaddress%]] up + + [[ /bin/ip route add default via %gateway% [[metric %metric%]] dev %iface% onlink ]] + + down + [[ /bin/ip route del default via %gateway% [[metric %metric%]] dev %iface% 2>&1 1>/dev/null || true ]] + /bin/ip addr del %address%[[/%netmask%]] [[broadcast %broadcast%]] \ + [[peer %pointopoint%]] [[scope %scope%]] dev %iface% label %iface% + /bin/ip link set dev %iface% down \ + if (iface_is_link()) + +method manual + description + This method may be used to define interfaces for which no configuration + is done by default. Such interfaces can be configured manually by + means of *up* and *down* commands or /etc/network/if-*.d scripts. + + options + hwaddress address -- Link local address or "random". + mtu size -- MTU size + + conversion + hwaddress cleanup_hwaddress + + up + [[/bin/ip link set dev %iface% mtu %mtu%]] + [[/bin/ip link set dev %iface% address %hwaddress%]] + /bin/ip link set dev %iface% up 2>/dev/null || true + + down + /bin/ip link set dev %iface% down 2>/dev/null || true \ + if (iface_is_link() && !do_all) + +method dhcp + description + This method may be used to obtain an address via DHCP with any of + the tools: dhclient, pump, udhcpc, dhcpcd. + (They have been listed in their order of precedence.) + If you have a complicated DHCP setup you should + note that some of these clients use their own configuration files + and do not obtain their configuration information via *ifup*. + + options + hostname hostname -- Hostname to be requested (pump, dhcpcd, udhcpc) + metric metric -- Metric for added routes (dhclient) + leasehours leasehours -- Preferred lease time in hours (pump) + leasetime leasetime -- Preferred lease time in seconds (dhcpcd) + vendor vendor -- Vendor class identifier (dhcpcd) + client client -- Client identifier (dhcpcd) + hwaddress address -- Hardware address. + + conversion + hwaddress cleanup_hwaddress + + up + [[/bin/ip link set dev %iface% address %hwaddress%]] + /sbin/dhclient -4 -v -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \ + [[-e IF_METRIC=%metric%]] \ + if (execable("/sbin/dhclient")) + /sbin/pump -i %iface% [[-h %hostname%]] [[-l %leasehours%]] \ + elsif (execable("/sbin/pump")) + /sbin/udhcpc -n -p /run/udhcpc.%iface%.pid -i %iface% [[-x hostname:%hostname%]] \ + elsif (execable("/sbin/udhcpc")) + /sbin/dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \ + [[-l %leasetime%]] [[-m %metric%]] %iface% \ + elsif (execable("/sbin/dhcpcd")) + echo 'No DHCP client software found!' >/dev/stderr; false \ + elsif (1) + + down + /sbin/dhclient -4 -v -r -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \ + if (execable("/sbin/dhclient")) + /sbin/pump -i %iface% -r \ + elsif (execable("/sbin/pump")) + if test -f /run/udhcpc.%iface%.pid; then kill -USR2 $(/bin/cat /run/udhcpc.%iface%.pid); kill -TERM $(/bin/cat /run/udhcpc.%iface%.pid); fi \ + elsif (execable("/sbin/udhcpc")) + /sbin/dhcpcd -k %iface% \ + elsif (execable("/sbin/dhcpcd")) + echo 'No DHCP client software found!' >/dev/stderr; false \ + elsif (1) + + /bin/ip link set dev %iface% down \ + if (iface_is_link()) + +method bootp + description + This method may be used to obtain an address via bootp. + + options + bootfile file -- Tell the server to use /file/ as the bootfile. + server address -- Use the IP address /address/ to communicate with \ + the server. + hwaddr addr -- Use /addr/ as the hardware address instead of \ + whatever it really is. + + up + /sbin/bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] \ + [[--hwaddr %hwaddr%]] --returniffail --serverbcast + + down + /bin/ip link set dev %iface% down \ + if (iface_is_link()) + +method tunnel + description + This method is used to create GRE or IPIP tunnels. You need to have + the *ip* binary from the *iproute* package. For GRE tunnels, you + will need to load the ip_gre module and the ipip module for + IPIP tunnels. + options + address address -- Local address (dotted quad) *required* + mode type -- Tunnel type (either GRE or IPIP) *required* + endpoint address -- Address of other tunnel endpoint *required* + dstaddr address -- Remote address (remote address inside tunnel) + local address -- Address of the local endpoint + metric metric -- Routing metric for default gateway (integer) + gateway address -- Default gateway + ttl time -- TTL setting + mtu size -- MTU size + up + /bin/ip tunnel add %iface% mode %mode% remote %endpoint% [[local %local%]] \ + [[ttl %ttl%]] + /bin/ip link set %iface% up [[mtu %mtu%]] + /bin/ip addr add %address%/%netmask% dev %iface% [[peer %dstaddr%]] + [[ /bin/ip route add default via %gateway% [[metric %metric%]] dev %iface% onlink ]] + down + /bin/ip tunnel del %iface% + +method ppp + description + This method uses pon/poff to configure a PPP interface. See those + commands for details. + options + provider name -- Use /name/ as the provider (from /etc/ppp/peers). + unit number -- Use /number/ as the ppp unit number. + options string -- Pass /string/ as additional options to pon. + up + /usr/bin/pon [[%provider%]] [[unit %unit%]] [[%options%]] + down + /usr/bin/poff [[%provider%]] + +method wvdial + description + This method uses wvdial to configure a PPP interface. See that command + for more details. + options + provider name -- Use /name/ as the provider (from /etc/wvdial.conf). + up + /sbin/start-stop-daemon --start -x /usr/bin/wvdial \ + -p /run/wvdial.%iface%.pid -b -m -- [[ %provider% ]] + down + /sbin/start-stop-daemon --stop -x /usr/bin/wvdial \ + -p /run/wvdial.%iface%.pid -s 2 + + +method ipv4ll + description + This method uses avahi-autoipd to configure an interface with an + IPv4 Link-Layer address (169.254.0.0/16 family). This method is also + known as APIPA or IPAC, and often colloquially referred to + as "Zeroconf address". + up + /usr/sbin/avahi-autoipd -D %iface% + down + /usr/sbin/avahi-autoipd --kill %iface% + +architecture kfreebsd + +method loopback + description + This method may be used to define the IPv4 loopback interface. + + up + /sbin/ifconfig %iface% 127.0.0.1 up \ + if (!iface_is_lo()) + + down + /sbin/ifconfig %iface% down \ + if (!iface_is_lo()) + +method static + description + This method may be used to define Ethernet interfaces with statically + allocated IPv4 addresses. + + options + address address -- Address (dotted quad/netmask) *required* + netmask mask -- Netmask (dotted quad or CIDR) + broadcast broadcast_address -- Broadcast address (dotted quad) + metric metric -- Routing metric for default gateway (integer) + gateway address -- Default gateway (dotted quad) + pointopoint address -- Address of other end point (dotted quad). \ + Note the spelling of "point-to". + hwaddress address -- Link local address or "random". + mtu size -- MTU size + + conversion + hwaddress cleanup_hwaddress + + up + [[ /sbin/ifconfig %iface% link %hwaddress%]] + /sbin/ifconfig %iface% %address% [[netmask %netmask%]] [[broadcast %broadcast%]] \ + [[pointopoint %pointopoint%]] [[media %media%]] [[mtu %mtu%]] \ + up + [[ /sbin/route add default %gateway% ]] + + down + [[ /sbin/route del default %gateway% 2>&1 1>/dev/null || true ]] + /sbin/ifconfig %iface% down + +method manual + description + This method may be used to define interfaces for which no configuration + is done by default. Such interfaces can be configured manually by + means of *up* and *down* commands or /etc/network/if-*.d scripts. + + up + + down + +method dhcp + description + This method may be used to obtain an address via DHCP with any of + the tools: dhclient, udhcpc, dhcpcd. + (They have been listed in their order of precedence.) + If you have a complicated DHCP setup you should + note that some of these clients use their own configuration files + and do not obtain their configuration information via *ifup*. + + options + hostname hostname -- Hostname to be requested (dhcpcd, udhcpc) + metric metric -- Metric for added routes (dhclient) + leasetime leasetime -- Preferred lease time in seconds (dhcpcd) + vendor vendor -- Vendor class identifier (dhcpcd) + client client -- Client identifier (dhcpcd, udhcpc) + hwaddress address -- Hardware Address. + + conversion + hwaddress cleanup_hwaddress + + up + [[/sbin/ifconfig %iface% link %hwaddress%]] + /sbin/dhclient -4 -v -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \ + [[-e IF_METRIC=%metric%]] \ + if (execable("/sbin/dhclient")) + /sbin/udhcpc -n -p /run/udhcpc.%iface%.pid -i %iface% [[-H %hostname%]] \ + [[-c %client%]] \ + elsif (execable("/sbin/udhcpc")) + /sbin/dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \ + [[-l %leasetime%]] %iface% \ + elsif (execable("/sbin/dhcpcd")) + echo 'No DHCP client software found!' >/dev/stderr; false \ + elsif (1) + + down + /sbin/dhclient -4 -v -r -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \ + if (execable("/sbin/dhclient")) + if test -f /run/udhcpc.%iface%.pid; then kill -USR2 $(/bin/cat /run/udhcpc.%iface%.pid); kill -TERM $(/bin/cat /run/udhcpc.%iface%.pid); fi \ + elsif (execable("/sbin/udhcpc")) + /sbin/dhcpcd -k %iface% \ + elsif (execable("/sbin/dhcpcd")) + echo 'No DHCP client software found!' >/dev/stderr; false \ + elsif (1) + + /sbin/ifconfig %iface% down + +method bootp + description + This method may be used to obtain an address via bootp. + + options + bootfile file -- Tell the server to use /file/ as the bootfile. + server address -- Use the IP address /address/ to communicate with \ + the server. + hwaddr addr -- Use /addr/ as the hardware address instead of \ + whatever it really is. + + up + /sbin/bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] \ + [[--hwaddr %hwaddr%]] --returniffail --serverbcast + + down + /sbin/ifconfig %iface% down + +method ppp + description + This method uses pon/poff to configure a PPP interface. See those + commands for details. + options + provider name -- Use /name/ as the provider (from /etc/ppp/peers). + unit number -- Use /number/ as the ppp unit number. + options string -- Pass /string/ as additional options to pon. + up + /usr/bin/pon [[%provider%]] [[unit %unit%]] [[%options%]] + down + /usr/bin/poff [[%provider%]] + +method wvdial + description + This method uses wvdial to configure a PPP interface. See that command + for more details. + options + provider name -- Use /name/ as the provider (from /etc/wvdial.conf). + up + /sbin/start-stop-daemon --start -x /usr/bin/wvdial \ + -p /run/wvdial.%iface%.pid -b -m -- [[ %provider% ]] + down + /sbin/start-stop-daemon --stop -x /usr/bin/wvdial \ + -p /run/wvdial.%iface%.pid -s 2 + + +method ipv4ll + description + This method uses avahi-autoipd to configure an interface with an + IPv4 Link-Layer address (169.254.0.0/16 family). This method is also + known as APIPA or IPAC, and often colloquially referred to + as "Zeroconf address". + up + /usr/sbin/avahi-autoipd -D %iface% + down + /usr/sbin/avahi-autoipd --kill %iface% +architecture hurd + +method loopback + description + This method may be used to define the IPv4 loopback interface. + + up + inetutils-ifconfig --interface %iface% --address 127.0.0.1 --up \ + if (!iface_is_lo()) + + down + inetutils-ifconfig --interface %iface% --down \ + if (!iface_is_lo()) + +method static + description + This method may be used to define Ethernet interfaces with statically + allocated IPv4 addresses. + + options + address address -- Address (dotted quad/netmask) *required* + netmask mask -- Netmask (dotted quad or CIDR) + broadcast broadcast_address -- Broadcast address (dotted quad) + metric metric -- Routing metric for default gateway (integer) + gateway address -- Default gateway (dotted quad) + pointopoint address -- Address of other end point (dotted quad). \ + Note the spelling of "point-to". + hwaddress address -- Link local address (Not yet supported) + mtu size -- MTU size + + conversion + hwaddress cleanup_hwaddress + + up + [[Warning: Option hwaddress: %hwaddress% not yet supported]] + inetutils-ifconfig --interface %iface% --address %address% [[--netmask %netmask%]] \ + [[--broadcast %broadcast%]] [[--mtu %mtu%]] --up + [[fsysopts /servers/socket/2 $(fsysopts /servers/socket/2) --gateway %gateway% ]] + + down + inetutils-ifconfig --interface %iface% --down + +method manual + description + This method may be used to define interfaces for which no configuration + is done by default. Such interfaces can be configured manually by + means of *up* and *down* commands or /etc/network/if-*.d scripts. + + up + + down + +method dhcp + description + This method may be used to obtain an address via DHCP with any of + the tools: dhclient, udhcpc, dhcpcd. + (They have been listed in their order of precedence.) + If you have a complicated DHCP setup you should + note that some of these clients use their own configuration files + and do not obtain their configuration information via *ifup*. + + options + hostname hostname -- Hostname to be requested (dhcpcd, udhcpc) + leasetime leasetime -- Preferred lease time in seconds (dhcpcd) + vendor vendor -- Vendor class identifier (dhcpcd) + client client -- Client identifier (dhcpcd, udhcpc) + hwaddress address -- Hardware Address (Not yet supported) + + conversion + hwaddress cleanup_hwaddress + + up + [[Warning: Option hwaddress: %hwaddress% not yet supported]] + /sbin/dhclient -4 -v -pf /run/dhclient.%iface///.%.pid -lf /var/lib/dhcp/dhclient.%iface///.%.leases -I -df /var/lib/dhcp/dhclient6.%iface///.%.leases %iface% \ + if (execable("/sbin/dhclient")) + /sbin/udhcpc -n -p /run/udhcpc.%iface///.%.pid -i %iface% [[-H %hostname%]] \ + [[-c %client%]] \ + elsif (execable("/sbin/udhcpc")) + /sbin/dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \ + [[-l %leasetime%]] %iface% \ + elsif (execable("/sbin/dhcpcd")) + echo 'No DHCP client software found!' >/dev/stderr; false \ + elsif (1) + + down + /sbin/dhclient -4 -v -r -pf /run/dhclient.%iface///.%.pid -lf /var/lib/dhcp/dhclient.%iface///.%.leases -I -df /var/lib/dhcp/dhclient6.%iface///.%.leases %iface% \ + if (execable("/sbin/dhclient")) + if test -f /run/udhcpc.%iface///.%.pid; then kill -USR2 $(/bin/cat /run/udhcpc.%iface///.%.pid); kill -TERM $(/bin/cat /run/udhcpc.%iface///.%.pid); fi \ + elsif (execable("/sbin/udhcpc")) + /sbin/dhcpcd -k %iface% \ + elsif (execable("/sbin/dhcpcd")) + echo 'No DHCP client software found!' >/dev/stderr; false \ + elsif (1) + + inetutils-ifconfig --interface %iface% --down + +method bootp + description + This method may be used to obtain an address via bootp. + + options + bootfile file -- Tell the server to use /file/ as the bootfile. + server address -- Use the IP address /address/ to communicate with \ + the server. + hwaddr addr -- Use /addr/ as the hardware address instead of \ + whatever it really is. + + up + bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] \ + [[--hwaddr %hwaddr%]] --returniffail --serverbcast + + down + inetutils-ifconfig --interface %iface% --down + +method ppp + description + This method uses pon/poff to configure a PPP interface. See those + commands for details. + options + provider name -- Use /name/ as the provider (from /etc/ppp/peers). + unit number -- Use /number/ as the ppp unit number. + options string -- Pass /string/ as additional options to pon. + up + /usr/bin/pon [[%provider%]] [[unit %unit%]] [[%options%]] + down + /usr/bin/poff [[%provider%]] + +method wvdial + description + This method uses wvdial to configure a PPP interface. See that command + for more details. + options + provider name -- Use /name/ as the provider (from /etc/wvdial.conf). + up + /sbin/start-stop-daemon --start -x /usr/bin/wvdial \ + -p /run/wvdial.%iface///.%.pid -b -m -- [[ %provider% ]] + down + /sbin/start-stop-daemon --stop -x /usr/bin/wvdial \ + -p /run/wvdial.%iface///.%.pid -s 2 + + +method ipv4ll + description + This method uses avahi-autoipd to configure an interface with an + IPv4 Link-Layer address (169.254.0.0/16 family). This method is also + known as APIPA or IPAC, and often colloquially referred to + as "Zeroconf address". + up + /usr/sbin/avahi-autoipd -D %iface% + down + /usr/sbin/avahi-autoipd --kill %iface% diff -Nru ifupdown-0.8.17ubuntu1/ifup.8 ifupdown-0.8.32ubuntu1/ifup.8 --- ifupdown-0.8.17ubuntu1/ifup.8 2016-11-25 11:16:17.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/ifup.8 2018-04-24 22:47:12.000000000 +0000 @@ -1,4 +1,4 @@ -.TH ifup 8 "23 May 2014" IFUPDOWN "" +.TH ifup 8 "11 Jan 2017" IFUPDOWN "" .SH NAME ifup \- bring a network interface up .PP @@ -32,26 +32,26 @@ .PP .B ifquery [\fB\-nv\fR] -[\fB\-\-no\-act\fR] [\fB\-\-verbose\fR] [\fB\-i\fR \fIFILE\fR|\fB\-\-interfaces=\fR\fIFILE\fR] [\fB\-\-state-dir=\fR\fIDIR\fR] [\fB\-\-allow\fR \fICLASS\fR] -\fB\-a\fR|\fIIFACE\fR... +\fIIFACE\fR... .PP .B ifquery \fB\-l\fR|\fB\-\-list\fR [\fB\-nv\fR] -[\fB\-\-no\-act\fR] [\fB\-\-verbose\fR] [\fB\-i\fR \fIFILE\fR|\fB\-\-interfaces=\fR\fIFILE\fR] [\fB\-\-state-dir=\fR\fIDIR\fR] [\fB\-\-allow\fR \fICLASS\fR] -\fB\-a\fR|\fIIFACE\fR... +[\fB\-a\fR|\fIIFACE\fR...] .PP .B ifquery \fB\-\-state\fR -[\fIIFACE\fR...] +[\fB\-\-state-dir=\fR\fIDIR\fR] +[\fB\-\-allow\fR \fICLASS\fR] +[\fB\-a\fR|\fIIFACE\fR...] .SH DESCRIPTION The .BR ifup " and " ifdown @@ -97,7 +97,7 @@ instead of from .IR /etc/network/interfaces "." .TP -\fB\-\-interfaces=\fR\fIDIR\fR +\fB\-\-state\-dir=\fR\fIDIR\fR Keep interface state in .I DIR instead of in @@ -214,6 +214,25 @@ .TP .I /run/network/ifstate current state of network interfaces +.SH CONCURRENCY +Ifupdown uses per-interface locking to ensure that concurrent ifup and ifdown calls to the same interface are run in serial. +However, calls to different interfaces will be able to run in parallel. +.SH EXIT STATUS +For +.B ifup +and +.B ifdown\fR, +the exit status will be 0 if the given interface(s) have all been (de)configured succesfully, 1 if there was any error. +The result of these commands is idempotent; running +.B ifup +on an interface that is already up will result in an exit status of 0, and similarly running +.B ifdown +on an interface that is not up will also result in an exit status of 0. +.P +.B ifquery +will normally return with exit status 0 if an interface with a matching iface stanza, 1 if there is no matching stanza. +.B ifquery --state +will also return with exit status 1 if the given interface was known but was not up. .SH KNOWN BUGS/LIMITATIONS The program keeps records of whether network interfaces are up or down. Under exceptional circumstances these records can become @@ -262,8 +281,12 @@ .BR udev (7) or .BR ifplugd (8). -.SH AUTHOR -The ifupdown suite was written by Anthony Towns . +.SH AUTHORS +The ifupdown suite was created by Anthony Towns , +and is currently maintained by Guus Sliepen . +.P +Many others have helped develop ifupdown over time, see +/usr/share/doc/ifupdown/changelog.Debian.gz for a full history. .SH SEE ALSO .BR interfaces (5), .BR ip (8), diff -Nru ifupdown-0.8.17ubuntu1/inet6.defn ifupdown-0.8.32ubuntu1/inet6.defn --- ifupdown-0.8.17ubuntu1/inet6.defn 2016-11-28 13:40:17.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/inet6.defn 2018-05-15 04:17:23.000000000 +0000 @@ -29,11 +29,11 @@ if (var_set("accept_ra", ifd) && !var_true("accept_ra", ifd)) /bin/ip link set dev %iface% up /lib/ifupdown/wait-for-ll6.sh if (var_true("dhcp", ifd) && execable("/lib/ifupdown/wait-for-ll6.sh")) - /sbin/dhclient -1 -6 -P -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ + /sbin/dhclient -1 -6 -v -P -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ if (var_true("dhcp", ifd) && execable("/sbin/dhclient") && var_true("request_prefix", ifd)) - /sbin/dhclient -1 -6 -S -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ + /sbin/dhclient -1 -6 -v -S -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ elsif (var_true("dhcp", ifd) && execable("/sbin/dhclient")) - echo 'No DHCPv6 client software found!' >/dev/stderr; false \ + echo 'No DHCPv6 client software found!' >&2; false \ elsif (var_true("dhcp", ifd)) down @@ -95,11 +95,13 @@ /bin/ip -6 addr add %address%[[/%netmask%]] [[scope %scope%]] dev %iface% [[preferred_lft %preferred-lifetime%]] nodad \ if (var_set("dad-attempts", ifd) && !var_true("dad-attempts", ifd)) [[ /bin/ip -6 route add default via %gateway% [[metric %metric%]] dev %iface% onlink ]] - /lib/ifupdown/settle-dad.sh if (!no_act && execable("/lib/ifupdown/settle-dad.sh") && (var_true("dad-attempts", ifd))) + /lib/ifupdown/settle-dad.sh if (!no_act_commands && execable("/lib/ifupdown/settle-dad.sh") && (var_true("dad-attempts", ifd))) down [[ /bin/ip -6 route del default via %gateway% [[metric %metric%]] dev %iface% ]] /bin/ip -6 addr del %address%[[/%netmask%]] [[scope %scope%]] dev %iface% + /bin/ip -6 addr flush dev %iface% \ + if (iface_is_link()) /bin/ip link set dev %iface% down \ if (iface_is_link()) @@ -122,6 +124,8 @@ /bin/ip link set dev %iface% up 2>/dev/null || true down + /bin/ip -6 addr flush dev %iface% 2>/dev/null || true \ + if (iface_is_link()) /bin/ip link set dev %iface% down 2>/dev/null || true \ if (iface_is_link() || !do_all) @@ -150,17 +154,17 @@ if (var_set("accept_ra", ifd) && !var_true("accept_ra", ifd)) /bin/ip link set dev %iface% [[address %hwaddress%]] up /lib/ifupdown/wait-for-ll6.sh if (execable("/lib/ifupdown/wait-for-ll6.sh")) - /sbin/dhclient -1 -6 -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -P -N -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ + /sbin/dhclient -1 -6 -v -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -P -N -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ if (execable("/sbin/dhclient") && var_true("request_prefix", ifd)) - /sbin/dhclient -1 -6 -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ + /sbin/dhclient -1 -6 -v -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ elsif (execable("/sbin/dhclient")) - echo 'No DHCPv6 client software found!' >/dev/stderr; false \ + echo 'No DHCPv6 client software found!' >&2; false \ elsif (1) down - /sbin/dhclient -6 -r -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ + /sbin/dhclient -6 -v -r -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ if (execable("/sbin/dhclient")) - echo 'No DHCPv6 client software found!' >/dev/stderr; false \ + echo 'No DHCPv6 client software found!' >&2; false \ elsif (1) /bin/ip link set dev %iface% down \ @@ -299,7 +303,7 @@ /sbin/ifconfig %iface% inet6 accept_rtadv up /sbin/dhclient -1 -6 -S -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ if (var_true("dhcp", ifd) && execable("/sbin/dhclient")) - echo 'No DHCPv6 client software found!' >/dev/stderr; false \ + echo 'No DHCPv6 client software found!' >&2; false \ elsif (var_true("dhcp", ifd)) down @@ -323,13 +327,13 @@ /sbin/ifconfig %iface% [[link %hwaddress%]] up /sbin/dhclient -1 -6 -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ if (execable("/sbin/dhclient")) - echo 'No DHCPv6 client software found!' >/dev/stderr; false \ + echo 'No DHCPv6 client software found!' >&2; false \ elsif (1) down /sbin/dhclient -6 -r -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ if (execable("/sbin/dhclient")) - echo 'No DHCPv6 client software found!' >/dev/stderr; false \ + echo 'No DHCPv6 client software found!' >&2; false \ elsif (1) /sbin/ifconfig %iface% down @@ -395,13 +399,13 @@ inetutils-ifconfig --interface %iface% --up /sbin/dhclient -1 -6 -pf /run/dhclient6.%iface///.%.pid -lf /var/lib/dhcp/dhclient6.%iface///.%.leases -I -df /var/lib/dhcp/dhclient.%iface///.%.leases %iface% \ if (execable("/sbin/dhclient")) - echo 'No DHCPv6 client software found!' >/dev/stderr; false \ + echo 'No DHCPv6 client software found!' >&2; false \ elsif (1) down /sbin/dhclient -6 -r -pf /run/dhclient6.%iface///.%.pid -lf /var/lib/dhcp/dhclient6.%iface///.%.leases -I -df /var/lib/dhcp/dhclient.%iface///.%.leases %iface% \ if (execable("/sbin/dhclient")) - echo 'No DHCPv6 client software found!' >/dev/stderr; false \ + echo 'No DHCPv6 client software found!' >&2; false \ elsif (1) inetutils-ifconfig --interface %iface% --down diff -Nru ifupdown-0.8.17ubuntu1/inet.defn ifupdown-0.8.32ubuntu1/inet.defn --- ifupdown-0.8.17ubuntu1/inet.defn 2018-03-21 21:44:13.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/inet.defn 2018-04-24 22:47:11.000000000 +0000 @@ -46,6 +46,8 @@ [[ /bin/ip route del default via %gateway% [[metric %metric%]] dev %iface% 2>&1 1>/dev/null || true ]] /bin/ip addr del %address%[[/%netmask%]] [[broadcast %broadcast%]] \ [[peer %pointopoint%]] [[scope %scope%]] dev %iface% label %iface% + /bin/ip -4 addr flush dev %iface% \ + if (iface_is_link()) /bin/ip link set dev %iface% down \ if (iface_is_link()) @@ -68,6 +70,8 @@ /bin/ip link set dev %iface% up 2>/dev/null || true down + /bin/ip -4 addr flush dev %iface% 2>/dev/null || true \ + if (iface_is_link()) /bin/ip link set dev %iface% down 2>/dev/null || true \ if (iface_is_link() && !do_all) @@ -104,7 +108,7 @@ /sbin/dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \ [[-l %leasetime%]] [[-m %metric%]] %iface% \ elsif (execable("/sbin/dhcpcd")) - echo 'No DHCP client software found!' >/dev/stderr; false \ + echo 'No DHCP client software found!' >&2; false \ elsif (1) down @@ -116,7 +120,7 @@ elsif (execable("/sbin/udhcpc")) /sbin/dhcpcd -k %iface% \ elsif (execable("/sbin/dhcpcd")) - echo 'No DHCP client software found!' >/dev/stderr; false \ + echo 'No DHCP client software found!' >&2; false \ elsif (1) /bin/ip link set dev %iface% down \ @@ -289,7 +293,7 @@ /sbin/dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \ [[-l %leasetime%]] %iface% \ elsif (execable("/sbin/dhcpcd")) - echo 'No DHCP client software found!' >/dev/stderr; false \ + echo 'No DHCP client software found!' >&2; false \ elsif (1) down @@ -299,7 +303,7 @@ elsif (execable("/sbin/udhcpc")) /sbin/dhcpcd -k %iface% \ elsif (execable("/sbin/dhcpcd")) - echo 'No DHCP client software found!' >/dev/stderr; false \ + echo 'No DHCP client software found!' >&2; false \ elsif (1) /sbin/ifconfig %iface% down @@ -440,7 +444,7 @@ /sbin/dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \ [[-l %leasetime%]] %iface% \ elsif (execable("/sbin/dhcpcd")) - echo 'No DHCP client software found!' >/dev/stderr; false \ + echo 'No DHCP client software found!' >&2; false \ elsif (1) down @@ -450,7 +454,7 @@ elsif (execable("/sbin/udhcpc")) /sbin/dhcpcd -k %iface% \ elsif (execable("/sbin/dhcpcd")) - echo 'No DHCP client software found!' >/dev/stderr; false \ + echo 'No DHCP client software found!' >&2; false \ elsif (1) inetutils-ifconfig --interface %iface% --down diff -Nru ifupdown-0.8.17ubuntu1/interfaces.5.pre ifupdown-0.8.32ubuntu1/interfaces.5.pre --- ifupdown-0.8.17ubuntu1/interfaces.5.pre 2018-03-21 21:42:49.000000000 +0000 +++ ifupdown-0.8.32ubuntu1/interfaces.5.pre 2018-04-24 22:47:12.000000000 +0000 @@ -11,7 +11,7 @@ . fi . PP .. -.TH INTERFACES 5 "4 June 2016" "ifupdown" "File formats" +.TH INTERFACES 5 "24 July 2017" "ifupdown" "File formats" .SH NAME /etc/network/interfaces \- network interface configuration for ifup and ifdown .SH DESCRIPTION @@ -24,6 +24,7 @@ This is where you configure how your system is connected to the network. .SH EXAMPLE The following example configures two network interfaces: eth0 is brought up at boot, and uses DHCP for IPv4 and SLAAC for IPv6, whereas eth1 is brought up whenever the network hardware is detected, and is configured with static IPv4 and IPv6 addresses. +.P .EX auto eth0 allow-hotplug eth1 @@ -47,7 +48,7 @@ A line may be extended across multiple lines by making the last character a backslash. .P -The file consists of zero or more "iface", "mapping", "auto", "allow-", +The file consists of zero or more "iface", "mapping", "auto", "allow-", "rename", "source" and "source-directory" stanzas. These will be described in more detail in the following sections. .SH INTERFACE SELECTION Lines beginning with the word "auto" are used to identify the physical @@ -81,6 +82,31 @@ Lines beginning with "no-scripts" are used to identify interfaces for which scripts in .IR /etc/network/if\-*.d/ should not be run when those interfaces are brought up or down. +he above will match eth0 and eth1, and will bring up both interfaces using the "iface eth" stanza. +.SH INTERFACE RENAMING +Lines beginning with "rename" are used to rename interfaces. +It takes one or more arguments in the form of "CUR=NEW", where CUR is the name of an existing interface, and NEW is the new name. +This becomes very powerful when combined with pattern matching for the CUR interface. +.P +Interfaces are renamed whenever "ifup" is called. +Renaming logically happens before anything else is done. +So if an interface is started with the name "foo", and it has to be renamed to "bar" and brought up at boot time, +then one should use the following /etc/network/interfaces file: +.P +.EX +rename foo=bar +auto bar +iface bar ... +.EE +.P +However, if the interface is not renamed yet, it is possible to use both "ifup foo" and "ifup bar". +The former command will then automatically be converted to the latter. +This is mainly useful when ifup is called automatically whenever an interface is hotplugged. +.P +Interface renaming only works if the operating system supports it, +if an interface is not renamed to another existing interface, +and may require that the interface that is to be renamed has not been brought up yet. +If ifup tries to rename an interface and it fails, it will exit with an error. .SH INCLUDING OTHER FILES Lines beginning with "source" are used to include stanzas from other files, so configuration can be split into many files. The word "source" is @@ -105,10 +131,6 @@ paths to the included files are understood to be under .IR /etc/network\fR. .P -Currently, "source-directory" isn't supported by -.BR network-manager " and" -.BR guessnet . -.P By default, on a freshly installed Debian system, the interfaces file includes a line to source files in the .IR /etc/network/interfaces.d @@ -201,7 +223,61 @@ This may be useful to separate link-level settings shared by multiple interfaces from, for example, IP address settings specific to every interface. +.SH PATTERN MATCHING INTERFACES +It is possible to use patterns to match one or more real interfaces. +These patterns can currently appear in lines beginning with "auto", "allow-", "rename" and on the command line. +A pattern has the following format (see below for exceptions for GNU/Hurd): +.P +.EX +[VARIABLE]/VALUE[/[OPTIONS]][=LOGICAL] +.EE +.P +If no VARIABLE is given, this pattern will match interface names against the given VALUE. +VALUE can contain wildcard patterns such as ? and *, +see the +.BR fnmatch (3) +function. +When +.BR ifup +or +.BR ifdown +is run, patterns are replaces by all real interfaces that are currently known to the operating system kernel and whose names match the pattern. +For example, given the following line: +.P +.EX +auto /eth* +.EE +.P +If the kernel knows about the interfaces with names lo, eth0 and eth1, +then the above line is then interpreted as: +.P +.EX +auto eth0 eth1 +.EE .P +Note that there must still be valid "iface" stanzas for each matching interface. +However, it is possible to combine a pattern with a mapping to a logical interface, like so: +.P +.EX +auto /eth*=eth +iface eth inet dhcp +.EE +.P +Valid variable names are "mac", in which case value is matched against the interface's MAC address. +On Linux, the variable name can also be any filename in /sys/class/net//, +in which case the value is matched against the contents of the corresponding file. +.P +The OPTIONS field currently only supports a number. If given, only the n-th interface that has a matching value will actually be used, where n is the number given, starting at 1. So /eth*/1 will match the first interface whose name starts with eth. +.P +On GNU/Hurd, interface names start with /dev/, and this obviously clashes with the format for patterns. +To ensure an interface name like /dev/eth0 does not get interpreted as a pattern, +any pattern that starts with /dev/ is ignored, and instead interpreted as a literal interface name. +To make a pattern that matches interface names on GNU/Hurd, use something like: +.P +.EX +auto /?dev?eth*=eth +iface eth inet dhcp +.EE .SH VLAN INTERFACES To ease the configuration of VLAN interfaces, interfaces having .B . @@ -273,12 +349,33 @@ .BI description " name" Alias interface by .I name +.SH HOOK SCRIPTS +There are four directories in which scripts can be placed which will always be run +for any interface during certain phases of ifup and ifdown commands. These are: +.TP +.IR /etc/network/if-pre-up.d/ +Scripts in this directory are run before bringing the interface up. +.TP +.IR /etc/network/if-up.d/ +Scripts in this directory are run after bringing the interface up. +.TP +.IR /etc/network/if-down.d/ +Scripts in this directory are run before bringing the interface down. +.TP +.IR /etc/network/if-post-down.d/ +Scripts in this directory are run after bringing the interface down. .P -There exists for each of the above mentioned options a directory -.IR /etc/network/if\-\fB