Package: laptop-net
Version: 2.26-7
Severity: wishlist
Tags: patch

I wanna use laptop-net integrated with wpa_supplicant
wireless configuration tool.
At this time, laptop-net does not support wireless configuration like SSID
to detect connection.
This is wishlist for new feature  'integration with wireles configuration'
and proposal for new patch.

Please find attachment that is a patch for shared.sh and
sample script wpacli-action-laptop-net for wpa_supplicant package.

User can config /etc/network/interfaces like as;

iface ath0 inet manual
   wpa-conf  /etc/wpa_supplicant/wpa_supplicant.conf
   wpa-action /etc/wpa_supplicant/wpacli-action-laptop-net

There is a script that calls laptop-net in wpacli-action-laptop-net.
After user do 'ifup ath0' and launch wpa_supplicant automatically,
wpa_supplicant may compete wireless configuration,
then execute wpacli-action-laptop-net.

wpacli-action-laptop-net script detect the status of wireless configuration
and try to bring up IP configuration using laptop-net.
laptop-net's bringup() calls choose_scheme().
choose_scheme() checks wireless device and existence of wpa_cli utility,
then try determining a scheme using SSID.
If interface is not wireless device,  try arp_discovery as same as before.

Users who want to auto-configure WEP and IP settings by
detecting SSID  can use 'guessnet' package, which support
wep. But it does not support WPA/IEEE802.1x now.

This proposal is alternative to guessnet. An integration
laptop-net and wpa-supplicant helps users who need to use recent
wireless technology and auto network configuration.

-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.6.14.4
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)

--
HIroshi Miura
--- scripts/shared.sh.in.orig	2006-12-15 15:34:38.779739336 +0900
+++ scripts/shared.sh.in	2006-12-15 15:37:07.135185880 +0900
@@ -47,6 +47,9 @@
 MKTONE_DOWN=2000
 MKTONE_ERROR=4000
 
+PROC_WIRELESS="/proc/net/wireless"
+WPA_CLI="/sbin/wpa_cli"
+
 LINUX_VERSION=$(uname --release | awk -F. '{ print $1 }')
 LINUX_PATCHLEVEL=$(uname --release | awk -F. '{ print $2 }')
 LINUX_SUBLEVEL=$(uname --release | awk -F. '
@@ -242,6 +245,28 @@
 choose_scheme ()
 (
     INTERFACE="${1}"
+
+    # detect wireless device and wpa_supplicant utility.
+    WIRELESS=
+    if [ -e "${PROC_WIRELESS}" ]; then
+    	for WIRELESS_DEV in $( tail -n +3 "${PROC_WIRELESS}" |cut -c 3-6); do
+	    if [ "${WIRELESS_DEV}" = "${INTERFACE}" ] ; then
+	    	if [ -x ${WPA_CLI} ]; then
+	            WIRELESS="y"
+		fi
+	    fi
+	done
+    fi
+    if [ "${WIRELESS}" = "y" ]; then
+        WPA_STATE="$( ${WPA_CLI} -i ${IFACE} status | sed -n -e 's/^wpa_state=//p')"
+	if [ "${WPA_STATE}" = "COMPLETED"  ]; then
+    	    WPA_SSID="$( ${WPA_CLI} -i ${IFACE} status | sed -n -e 's/^ssid=//p' )"
+	    write_scheme "${IFACE}" "${WPA_SSID}" "wpasupplicant"
+    	    return 0;
+	fi
+    fi
+
+    # wired and fail-safe
     TEMP="$(state_dir_name "${1}")/scheme.tmp"
     rm -f "${TEMP}"
     if "${ARP_DISCOVERY}" "${INTERFACE}" "${IP_MAP_FILE}" > "${TEMP}"

Attachment: wpacli-action-laptop-net
Description: Binary data

Reply via email to