Package: ifupdown Version: 0.8.17 Severity: important Tags: patch User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu bionic ubuntu-patch
Dear Maintainer, Scripts in the if-pre-up.d and if-up.d dirs call ifquery directly, or call it indirectly through other scripts. However ifquery tries to lock each interface and exits with error if it's called from ifup or ifdown. Since ifquery doesn't change anything, there is no reason interface locks need to be taken; ifquery can be safely run recurseively from ifup/ifdown. In Ubuntu, the attached patch was applied to achieve the following: * Allow ifquery to be called recursively from ifup/ifdown. Many of the if-pre-up.d/if-up.d scripts call ifquery directly, or indirectly through other scripts they call; these ifquery calls will fail. This changes that to allow ifquery to run, since ifquery does not change anything, it can be safely called from ifup/ifdown. (LP: #1701023) Please see https://bugs.launchpad.net/ubuntu/bionic/+source/ifupdown/+bug/1701023 for details on why this patch is required. Thanks for considering the patch. -- System Information: Debian Release: buster/sid APT prefers bionic APT policy: (500, 'bionic') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.15.0-13-generic (SMP w/24 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled
diff -Nru ifupdown-0.8.17ubuntu1/debian/control ifupdown-0.8.17ubuntu1+hf1701023v20180420b1/debian/control --- ifupdown-0.8.17ubuntu1/debian/control 2018-03-21 17:38:53.000000000 -0400 +++ ifupdown-0.8.17ubuntu1+hf1701023v20180420b1/debian/control 2018-04-20 16:37:59.000000000 -0400 @@ -1,8 +1,7 @@ Source: ifupdown Section: admin Priority: important -Maintainer: Ubuntu Developers <ubuntu-devel-disc...@lists.ubuntu.com> -XSBC-Original-Maintainer: Guus Sliepen <g...@debian.org> +Maintainer: Guus Sliepen <g...@debian.org> Standards-Version: 3.9.8 Build-Depends: debhelper (>= 9.20120410~), dh-systemd Vcs-Git: https://anonscm.debian.org/git/collab-maint/ifupdown.git diff -Nru ifupdown-0.8.17ubuntu1/main.c ifupdown-0.8.17ubuntu1+hf1701023v20180420b1/main.c --- ifupdown-0.8.17ubuntu1/main.c 2016-11-25 06:16:17.000000000 -0500 +++ ifupdown-0.8.17ubuntu1+hf1701023v20180420b1/main.c 2018-04-20 16:37:55.000000000 -0400 @@ -785,6 +785,7 @@ /* Split into physical and logical interface */ char iface[80], liface[80]; + FILE *lock = NULL, *plock = NULL; strncpy(iface, target_iface, sizeof(iface)); iface[sizeof(iface) - 1] = '\0'; @@ -840,44 +841,44 @@ return false; } + if (!no_act) { + /* Bail out if we are being called recursively on the same interface */ - /* Bail out if we are being called recursively on the same interface */ - - char envname[160]; - char *siface = strdup(iface); - sanitize_file_name(siface); - snprintf(envname, sizeof envname, "IFUPDOWN_%s", siface); - free(siface); - char *envval = getenv(envname); - if(envval && is_locked(iface)) { - fprintf(stderr, "%s: recursion detected for interface %s in %s phase\n", argv0, iface, envval); - return false; - } - - /* Are we configuring a VLAN interface? If so, lock the parent interface as well. */ - - char piface[80]; - FILE *plock = NULL; - strncpy(piface, iface, sizeof piface); - if ((pch = strchr(piface, '.'))) { - *pch = '\0'; - snprintf(envname, sizeof envname, "IFUPDOWN_%s", piface); + char envname[160]; + char *siface = strdup(iface); + sanitize_file_name(siface); + snprintf(envname, sizeof envname, "IFUPDOWN_%s", siface); + free(siface); char *envval = getenv(envname); - if(envval && is_locked(piface)) { - fprintf(stderr, "%s: recursion detected for parent interface %s in %s phase\n", argv0, piface, envval); + if(envval && is_locked(iface)) { + fprintf(stderr, "%s: recursion detected for interface %s in %s phase\n", argv0, iface, envval); return false; } - plock = lock_interface(piface, NULL); + /* Are we configuring a VLAN interface? If so, lock the parent interface as well. */ + + char piface[80]; + strncpy(piface, iface, sizeof piface); + if ((pch = strchr(piface, '.'))) { + *pch = '\0'; + snprintf(envname, sizeof envname, "IFUPDOWN_%s", piface); + char *envval = getenv(envname); + if(envval && is_locked(piface)) { + fprintf(stderr, "%s: recursion detected for parent interface %s in %s phase\n", argv0, piface, envval); + return false; + } + + plock = lock_interface(piface, NULL); + } } /* Start by locking this interface */ bool success = false; - FILE *lock = NULL; char *current_state = NULL; - lock = lock_interface(iface, ¤t_state); + if (!no_act) + lock = lock_interface(iface, ¤t_state); /* If we are not forcing the command, then exit with success if it is a no-op */