Your message dated Thu, 23 Jan 2025 18:36:10 +0100 with message-id <[email protected]> and subject line Re: Bug#322893: add a --no-state option to ifupdown to avoid writing the interface state has caused the Debian Bug report #322893, regarding add a --no-state option to ifupdown to avoid writing the interface state to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact [email protected] immediately.) -- 322893: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=322893 Debian Bug Tracking System Contact [email protected] with problems
--- Begin Message ---Package: ifupdown Version: 0.6.7 Severity: wishlist Tags: patch I'm using ifupdown's mapping feature to map interface profiles to physical interfaces, and I'd like to let it autodetect my current network environment and configure interfaces accordingly. This is achieved by a customized version of ping-places.sh in the examples directory of the original source. However that script configures interfaces prior to ping other hosts via ip/route, but configuring a wireless interface is much more sophisticated (setting essid, channels, etc). As I don't want to replicate all information into my version of ping-places.sh I'd like to recurse ifup/ifdown to perform configuration of a specified interface scheme, but this is not allowed as ifup locks on its state file hard, and the ifup command deadlocks. My solution was to add a --no-state command line option to ifup/ifdown, which instructs ifup not to save the interface state, thus no locking is necessary either. This makes my setup work nicely. Please consider applying the patch, also included in this bugreport. For your information here's the script I'm using: #!/bin/sh if [ d -u -ne 0 ] || [ "$1" = "" ]; then exit 1; fi if [ -x /usr/bin/fping ]; then PING="/usr/bin/fping" else PING="/bin/ping -c 2" fi iface="$1" which="" logger -t detectif "Trying to detect IP for $iface" while read pingme scheme; do if [ "$which" ]; then continue; fi logger -t detectif " Trying $pingme ($scheme)" # flush any routes/ip configuration ip route flush dev $iface >/dev/null 2>&1 ifconfig $iface down ifup --no-state $iface=$scheme >&2 logger -t detectif " Interface configured for scheme $scheme, starting ping" if $PING $pingme >/dev/null 2>&1; then ifdown --force --no-state $iface=$scheme >&2 which="$scheme" break fi logger -t detectif " Ping failed for scheme $scheme, trying next" ifdown --force --no-state $iface=$scheme >&2 done if [ "$which" ]; then echo $which; exit 0; fi exit 1 And here's the set of mapping lines I'm using with that script: mapping eth1 script /usr/local/bin/ping-places.sh map 192.168.13.254 wifi-szekszard map 192.168.1.1 wifi-home And here's the patch: --- ifupdown-0.6.7/ifupdown.nw 2005-04-05 19:31:29.000000000 +0200 +++ ifupdown-0.6.7-bazsi/ifupdown.nw 2005-08-13 13:10:34.000000000 +0200 @@ -3146,6 +3146,7 @@ struct option long_opts[] = { {"allow", required_argument, NULL, 3 }, {"interfaces", required_argument, NULL, 'i'}, {"exclude", required_argument, NULL, 'e'}, + {"no-state", no_argument, NULL, 4 }, {"no-act", no_argument, NULL, 'n'}, {"no-mappings", no_argument, NULL, 1 }, {"force", no_argument, NULL, 2 }, @@ -3159,11 +3160,13 @@ the various things. The only special not <<exported symbols>>= extern int no_act; +extern int no_state; extern int verbose; @ <<main global variables>>= int no_act = 0; +int no_state = 0; int verbose = 0; @ @@ -3222,6 +3225,7 @@ static void help(char *execname) { printf("\t\t\t\t(note that this option doesn't disable mappings)\n"); printf("\t-v, --verbose\t\tprint out what would happen before doing it\n"); printf("\t--no-mappings\t\tdon't run any mappings\n"); + printf("\t--no-state\t\t\tdon't record/lock/check interface state\n"); printf("\t--force\t\t\tforce de/configuration\n"); exit(0); } @@ -3282,6 +3286,11 @@ case 1: case 2: force = 1; break; +@ +<<[[getopt]] possibilities>>= +case 4: + no_state = 1; + break; @ <<[[getopt]] possibilities>>= case 'e': @@ -3630,8 +3639,8 @@ static FILE *state_fp = NULL; <<lock 'n load ifupdown state>>= { - state_fp = fopen(statefile, no_act ? "r" : "a+"); - if (state_fp == NULL && !no_act) { + state_fp = fopen(statefile, (no_act || no_state) ? "r" : "a+"); + if (state_fp == NULL && (!no_act && !no_state)) { fprintf(stderr, "%s: failed to open statefile %s: %s\n", argv[0], statefile, strerror(errno)); @@ -3642,7 +3651,7 @@ static FILE *state_fp = NULL; char buf[80]; char *p; - if (!no_act) { + if (!no_act && !no_state) { int flags; if ((flags = fcntl(fileno(state_fp), F_GETFD)) < 0 @@ -3688,7 +3697,7 @@ if (state_fp != NULL) { <<commit ifupdown state>>= -if (state_fp != NULL && !no_act) { +if (state_fp != NULL && (!no_act && !no_state)) { int i; if (ftruncate(fileno(state_fp), 0) < 0) -- System Information: Debian Release: 3.1 Architecture: i386 (i686) Kernel: Linux 2.6.12 Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Versions of packages ifupdown depends on: ii debconf [debconf-2.0] 1.4.30.13 Debian configuration management sy ii libc6 2.3.2.ds1-22 GNU C Library: Shared libraries an ii net-tools 1.60-10 The NET-3 networking toolkit -- debconf information: ifupdown/convert-interfaces: true
--- End Message ---
--- Begin Message ---On Thu, Sep 28, 2006 at 09:08:11PM +0200, Petter Reinholdtsen wrote: > > I just uploaded ifupdown 0.6.8 which is changed to avoid locking the > state file while it runs, and this making it possible to run several > of them concurrently. Can you test and see if it solve your problem? > If it does, I believe the patch in this bug is obsolete and this bug > should be closed as fixed. Lets assume it was good. Chris
--- End Message ---

