[pkg-wpa-devel] Bug#428304: Bug#428304: should reassociate when ifup fails

Kel Modderman kel at otaku42.de
Sat Nov 3 13:23:06 UTC 2007


tags 428304 pending
thanks

On Mon, 11 Jun 2007 02:31:44 am Elmar Hoffmann wrote:
> Package: wpasupplicant
> Version: 0.6.0~cvs20070224-3
> Severity: normal
> Tags: patch
>
> When ifup of the wireless interface after association fails,
> wpa-supplicant happily stays connected (which is useless with an
> unusable interface) instead of reassociating (having more luck next
> time or eventually choosing a different AP).
>
> The attached patch fixes this.
>
> The interesting case of ifup failure is when using the old dhcp-client
> or a dhcp3-client with #420784 fixed, that properly fail when unable
> to acquire a lease.
> I've been successfully  using the latter with this patch for a while
> now.
>
> elmar

Hi,

I'll probably apply a small adaptation of your patch. Please let me know
if you see something wrong.

Thanks, Kel.

Index: debian/ifupdown/functions.sh
===================================================================
--- debian/ifupdown/functions.sh        (revision 879)
+++ debian/ifupdown/functions.sh        (working copy)
@@ -749,6 +749,17 @@
        return 0
 }

+ifupdown_status () {
+       if grep -s -q "^${WPA_IFACE}=${WPA_LOGICAL_IFACE}" "$IFSTATE_FILE"; then
+               echo "Interface \"$WPA_IFACE\" connected successfully."
+               return 0
+       fi
+
+       echo "Interface \"$WPA_IFACE\" failed to establish a connection."
+       echo "Attempting reassociation..."
+       return 1
+}
+
 #####################################################################
 ## apply mapping logic and ifup logical interface
 # Apply mapping logic via id_str or external mapping script, check
Index: debian/ifupdown/wpa_action.sh
===================================================================
--- debian/ifupdown/wpa_action.sh       (revision 879)
+++ debian/ifupdown/wpa_action.sh       (working copy)
@@ -42,11 +42,10 @@
                wpa_hysteresis_check || exit 1
                wpa_log_action
                wpa_log_environment
-               if ifupdown_check; then
-                       ifup
-               fi
+               ifupdown_check && ifup
                wpa_hysteresis_event
                wpa_cli status
+               ifupdown_status || wpa_cli reassociate
                ;;

        "DISCONNECTED")
@@ -63,9 +62,7 @@
        "stop"|"down")
                test_wpa_supplicant || exit 1
                kill_wpa_cli
-               if ifupdown_check; then
-                       ifdown
-               fi
+               ifupdown_check && ifdown
                kill_wpa_supplicant
                wpa_log_init
                wpa_log_action





More information about the Pkg-wpa-devel mailing list