Package: wpasupplicant
Version: 0.4.7-4
Severity: normal
Tags: patch

Hello,

After upgrading from wpasupplicant version 0.4.7-3 to 0.4.7-4, 
ifplugd is not working correctly any more for my wlan interface.

The problem is (see: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=348698)
that ifplugd needs wpa_supplicant running - ALWAYS = system daemon, 
before configuring interfaces - for detecting link-beats on a wlan 
interface, if your wireless network is WPA-PSK (as is my case).

With current wpasupplicant start/stop scheme - using if-pre-up / 
if-post-down scripts - ifplugd never detects link-beats, because 
in this case wpa_supplicant would start running after interface 
configuration, which in turn should be initiated by ifplugd. Thus,
we have a cycle dependency which is never met.

Therefore, current wpasupplicant start/stop scheme should be 
flexible enough to allow start/stop at if-pre-up / if-post-down, 
as well as system start and system stop (shutdown). That is, 
the user should be able to choose wpa_supplicant behaviour from 
these 2 options:

- Run wpa_supplicant as a system daemon (rcNUMBER.d mode)
- Run wpa_supplicant only while interface is configured 
  (if-pre-up / if-post-down)

I have found an easy solution for this issue, which I explain below:

- In /etc/default/wpasupplicant add a new flag RUN_AS_SYSDAEMON to 
  choose from one of those behaviours above:

  * If RUN_AS_SYSDAEMON=0 then /etc/init.d/wpasupplicant only completes
    execution if called from ifupdown script (it checks a stamp file 
    created by the ifupdown script), otherwise it aborts.
  * If RUN_AS_SYSDAEMON=1 then ifupdown script never completes execution
    in this case /etc/init.d/wpassupplicant runs as usual.

- I have modified the if-pre-up.d / if-post-down.d scripts: I have 
  merged them into a single one. This new ifupdown script checks for
  RUN_AS_SYSDAEMON variable in /etc/default/wpasupplicant, and behaves
  as described above. 
  
  The ifupdown script creates a stamp file in /var/run to "tell" 
  /etc/init.d/wpasupplicant that it can execute despite having 
  RUN_AS_SYSDAEMON=0, then it calls /etc/init.d/wpasupplicant, and after
  this has been executed, it (ifupdown script) deletes the stamp file.

- The last modification goes to /etc/init.d/wpasupplicant, which 
  also checks RUN_AS_SYSDAEMON variable and behaves accordingly.

With this setup /etc/init.d/wpasupplicant can (in fact must) be 
registered into rc* directories as it was in previous versions 
(e.g. 0.4.7-3).

I include attached the files described above. In this order:

/etc/default/wpasupplicant
/etc/network/if-pre-up.d/wpasupplicant-ifupdown 
  (also valid for if-post-down.d/)
/etc/init.d/wpasupplicant


-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-1-686
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages wpasupplicant depends on:
ii  libc6                         2.3.5-13   GNU C Library: Shared libraries an
ii  libncurses5                   5.5-1      Shared libraries for terminal hand
ii  libreadline5                  5.1-6      GNU readline and history libraries
ii  libssl0.9.8                   0.9.8a-7   SSL shared libraries

wpasupplicant recommends no packages.

-- no debconf information
# /etc/default/wpasupplicant

# WARNING! Make sure you have a configuration file!

ENABLED=1
RUN_AS_SYSDAEMON=1

# This field sets the driver that wpa_supplicant will use to communicate
# with the hardware.
#
# IPW users will want to use wext (if they have a modern kernel) or ipw
#   if they have an older kernel (older than 2.6.14)
#
# Other possibilities are hostap, ndiswrapper, madwifi, ...
DRIVER=wext

# This field must be set to your wireless interface. If it's hotpluggable
# and can change names, consider using something like ifrename to set it
# to something static.
#
# The interface is typically ethX, or wlanX, or athX.
INTERFACE=eth1

# Path to the configuration file, typically /etc/wpa_supplicant.conf
CONFIG=/etc/wpa_supplicant.conf

# See the manual page wpa_supplicant(1) for more options and information.

#OPTIONS="-w"
OPTIONS="-w -i ${INTERFACE} -D ${DRIVER} -c ${CONFIG}"

# EXAMPLES:

# OPTIONS="-i wlan0 -D hostap -c /etc/wpa_supplicant.conf"
# OPTIONS="-i ath0 -D madwifi -c /etc/wpa_supplicant.conf"

Attachment: wpasupplicant-ifupdown
Description: application/shellscript

Attachment: wpasupplicant
Description: application/shellscript

Reply via email to