Vincent Danjean wrote:
> So, I think you must revert to the settings (scripts in pre-up.d and not in
> up.d). For network cards requiring the interface to be up, there are two
> possibility:
> - the user add a line in its stanza in /e/n/i:
>   pre-up ifconfig $IFACE up
> - you add such a line in your pre-up.d script (here, you might wish to
>   do that only if the interface is not already up AND if you have to do some
>   settings so that you do not conflict with other kind of interface setup.
>   You might also want to offer a option so the user can explicitely decide
>   if he wants its interface set up or not) 

Here is in attachment a example of what can be done (just written, not tested)

>   For other users hit by this bug, a simple workaround is to make a symlink
> from up.d/wireless to pre-up.d/wireless

In fact, it is /etc/network/if-up.d/wireless-tools and
/etc/network/if-pre-up.d/wireless-tools

> [it means you will have to deals with such kind of local config when you
> restore the old behavior]

  Regards,
    Vincent

-- 
Vincent Danjean       GPG key ID 0x9D025E87         [email protected]
GPG key fingerprint: FC95 08A6 854D DB48 4B9A  8A94 0BF7 7867 9D02 5E87
Unofficial packages: http://moais.imag.fr/membres/vincent.danjean/deb.html
APT repo:  deb http://perso.debian.org/~vdanjean/debian unstable main

#!/bin/sh

IWCONFIG_REAL=/sbin/iwconfig

_IF_WIRELESS_IFACE=

up-iface() {
  if [ -x /bin/ip ]; then
    /bin/ip link set "$1" up
  elif [ -x /sbin/ifconfig ]; then
    /sbin/ifconfig "$1" up
  else
    echo 1>&2 "Warning: cannot up $1: no ip nor ifconfig command available"
  fi
}

setup-iface() {
  if [ -z "$IFACE" ]; then
    echo 1>&2 "Warning: IFACE variable not set"
    _IF_WIRELESS_IFACE="done"
    return
  fi
  case "$IF_WIRELESS_UP_IFACE" in
  [Aa][Uu][Tt][Oo]|"")
    if [ "$1" = "force-auto" ]; then
      IF_WIRELESS_UP_IFACE=yes
    else
      return
    fi
    ;;
  esac
  case "$IF_WIRELESS_UP_IFACE" in
  [Yy]*) up-iface "$IFACE" ;;
  [Nn]*) ;;
  *) echo 1>&2 "Warning: Invalid value '$IF_WIRELESS_UP_IFACE' for 
wireless-up-iface" ;;
  esac
  _IF_WIRELESS_IFACE="done"
}

local-iwconfig() {
  if [ -z "_IF_WIRELESS_IFACE" ]; then
    setup-iface force-auto
  fi  
  $IWCONFIG_REAL "$@"
}
IWCONFIG=local-iwconfig

setup-iface

if [ ! -x $IWCONFIG_REAL ]; then
  exit 0
fi

if [ -n "$IF_WIRELESS_SENS" ]; then
  $IWCONFIG "$IFACE" sens $IF_WIRELESS_SENS
fi

if [ -n "$IF_WIRELESS_MODE" ]; then
  $IWCONFIG "$IFACE" mode $IF_WIRELESS_MODE
fi

if [ -n "$IF_WIRELESS_AP" ]; then
  $IWCONFIG "$IFACE" ap $IF_WIRELESS_AP
fi

if [ -n "$IF_WIRELESS_RATE" ]; then
  $IWCONFIG "$IFACE" rate $IF_WIRELESS_RATE
fi

if [ -n "$IF_WIRELESS_RTS" ]; then
  $IWCONFIG "$IFACE" rts $IF_WIRELESS_RTS
fi

if [ -n "$IF_WIRELESS_FRAG" ]; then
  $IWCONFIG "$IFACE" frag $IF_WIRELESS_FRAG
fi

if [ -n "$IF_WIRELESS_POWER" ]; then
  $IWCONFIG "$IFACE" power $IF_WIRELESS_POWER
fi

if [ -n "$IF_WIRELESS_POWERPERIOD" ]; then
  $IWCONFIG "$IFACE" power period $IF_WIRELESS_POWERPERIOD
fi

if [ -n "$IF_WIRELESS_POWERTIMEOUT" ]; then
  $IWCONFIG "$IFACE" power timeout $IF_WIRELESS_POWERTIMEOUT
fi

if [ -n "$IF_WIRELESS_TXPOWER" ]; then
  $IWCONFIG "$IFACE" txpower $IF_WIRELESS_TXPOWER
fi

if [ -n "$IF_WIRELESS_RETRY" ]; then
  $IWCONFIG "$IFACE" retry $IF_WIRELESS_RETRY
fi

if [ -n "$IF_WIRELESS_ENC" ]; then
  eval $IWCONFIG "$IFACE" enc $IF_WIRELESS_ENC
fi

if [ -n "$IF_WIRELESS_KEY" ]; then
  eval $IWCONFIG "$IFACE" key $IF_WIRELESS_KEY
fi

if [ -n "$IF_WIRELESS_KEY1" ]; then
  $IWCONFIG "$IFACE" key [1] "$IF_WIRELESS_KEY1"
fi

if [ -n "$IF_WIRELESS_KEY2" ]; then
  $IWCONFIG "$IFACE" key [2] "$IF_WIRELESS_KEY2"
fi

if [ -n "$IF_WIRELESS_KEY3" ]; then
  $IWCONFIG "$IFACE" key [3] "$IF_WIRELESS_KEY3"
fi

if [ -n "$IF_WIRELESS_KEY4" ]; then
  $IWCONFIG "$IFACE" key [4] "$IF_WIRELESS_KEY4"
fi

if [ -n "$IF_WIRELESS_DEFAULTKEY" ]; then
  $IWCONFIG "$IFACE" key ["$IF_WIRELESS_DEFAULTKEY"]
fi

if [ -n "$IF_WIRELESS_KEYMODE" ]; then
  $IWCONFIG "$IFACE" key "$IF_WIRELESS_KEYMODE"
fi

if [ -n "$IF_WIRELESS_FREQ" ]; then
  $IWCONFIG "$IFACE" freq $IF_WIRELESS_FREQ
fi

if [ -n "$IF_WIRELESS_CHANNEL" ]; then
  $IWCONFIG "$IFACE" channel $IF_WIRELESS_CHANNEL
fi

if [ -n "$IF_WIRELESS_NICK" ]; then
  $IWCONFIG "$IFACE" nick "$IF_WIRELESS_NICK"
fi

if [ -n "$IF_WIRELESS_NWID" ]; then
  $IWCONFIG "$IFACE" nwid "$IF_WIRELESS_NWID"
fi

if [ -n "$IF_WIRELESS_ESSID" ]; then
  $IWCONFIG "$IFACE" essid "$IF_WIRELESS_ESSID"
fi

if [ -n "$IF_WIRELESS_COMMIT" ]; then
  $IWCONFIG "$IFACE" commit
fi

Reply via email to