initial import
[libicd-wpa] / patches / osso-wlan-1.3.10.patch
diff --git a/patches/osso-wlan-1.3.10.patch b/patches/osso-wlan-1.3.10.patch
new file mode 100644 (file)
index 0000000..3ed92d1
--- /dev/null
@@ -0,0 +1,185 @@
+diff -rup osso-wlan-1.3.10/common.h osso-wlan-1.3.10+wpa/common.h
+--- osso-wlan-1.3.10/common.h  2007-12-20 07:20:35.000000000 +0100
++++ osso-wlan-1.3.10+wpa/common.h      2009-02-23 14:03:24.000000000 +0100
+@@ -202,6 +202,7 @@ gboolean set_power_state(guint state, in
+ int get_encryption_info(void);
+ void remove_connect_timer(void);
+ int disassociate_eap(void);
++int using_supplicant(void);
+ int get_mode(void);
+ DBusHandlerResult wlancond_req_handler(DBusConnection *connection,
+                                        DBusMessage *message, void *user_data);
+diff -rup osso-wlan-1.3.10/dbus-handler.c osso-wlan-1.3.10+wpa/dbus-handler.c
+--- osso-wlan-1.3.10/dbus-handler.c    2007-12-04 12:20:31.000000000 +0100
++++ osso-wlan-1.3.10+wpa/dbus-handler.c        2009-02-23 14:03:32.000000000 +0100
+@@ -37,6 +37,7 @@
+ #include <dbus/dbus.h>
+ #include <eap-dbus.h>
+ #include <wlancond-dbus.h>
++#include <wlancond-supp.h>
+ #ifdef USE_MCE_MODE
+ #include <mce/dbus-names.h>
+ #endif
+@@ -73,6 +74,9 @@ static gboolean power_down_after_scan = 
+ static gboolean scan_threshold_supported = FALSE;
+ static dbus_bool_t saved_inactivity = FALSE;
++/* Indicates if we are using wpa_supplicant for the job */
++static gboolean use_supplicant = FALSE;
++
+ /* Timer IDs */
+ static guint wlan_if_down_timer_id = 0;
+ static guint wlan_connect_timer_id = 0;
+@@ -605,14 +609,18 @@ static gboolean wlan_connect_timer_cb(vo
+ {
+         wlan_connect_timer_id = 0;
+         
+-        if (get_wlan_state() == WLAN_INITIALIZED && !get_mic_status()) {
+-                DLOG_DEBUG("Association timeout");
+-                set_wlan_state(WLAN_NOT_INITIALIZED, DISCONNECTED_SIGNAL, 
+-                               FORCE_YES);
+-                return FALSE;
++        if (get_wlan_state() == WLAN_INITIALIZED) {
++              if (use_supplicant) {
++                      DLOG_DEBUG("wpa_supplicant should do its job now"); 
++              } else if (!get_mic_status()) {
++                      DLOG_DEBUG("Association timeout");
++                      
++                      set_wlan_state(WLAN_NOT_INITIALIZED, DISCONNECTED_SIGNAL, 
++                                     FORCE_YES);
++              } else {      
++                      DLOG_DEBUG("Association OK"); 
++                }
+         }
+-        
+-        //DLOG_DEBUG("Association OK");        
+         return FALSE;
+ }
+@@ -1176,6 +1184,14 @@ static DBusHandlerResult settings_and_co
+                 powersave = WLANCOND_SHORT_CAM;
+         }
+         
++        if (flags & WLANCOND_USE_SUPPLICANT) {
++              DLOG_DEBUG("Using wpa_supplicant");
++              use_supplicant = TRUE;
++              encryption = WLANCOND_OPEN; // Don't handle it
++        } else {
++              use_supplicant = FALSE;
++      }
++        
+         if (power_level != WLANCOND_TX_POWER10 &&
+             power_level != WLANCOND_TX_POWER100) {
+                 DLOG_ERR("Invalid power level");
+@@ -2153,6 +2169,9 @@ int wpa_ie_push(unsigned char* ap_mac_ad
+         DBusMessage *msg;
+         DBusPendingCall *pending;
++        if (use_supplicant)
++              return 0;
++
+         if (wlan_status.wpa_ie.ie_valid == IE_NOT_VALID || 
+             selected_ssid == NULL) {
+                 DLOG_ERR("WPA IE / SSID (%s) not valid", selected_ssid);
+@@ -2205,6 +2224,9 @@ int wpa_mic_failure_event(dbus_bool_t ke
+         DBusMessage *reply;
+         DBusError derr;
++        if (use_supplicant)
++              return 0;
++
+         msg = dbus_message_new_method_call(
+                 EAP_SERVICE,
+                 EAP_REQ_PATH,
+@@ -2249,6 +2271,9 @@ int disassociate_eap(void) {
+         DBusMessage *reply;
+         DBusError derr;
+         
++        if (use_supplicant)
++              return 0;
++        
+         msg = dbus_message_new_method_call(
+                 EAP_SERVICE,
+                 EAP_REQ_PATH,
+@@ -2280,6 +2305,11 @@ int disassociate_eap(void) {
+         return 0;
+ }
++int using_supplicant(void)
++{
++      return use_supplicant;
++}
++
+ #ifdef USE_MCE_COVER
+ static DBusHandlerResult ignore_cover_request(DBusMessage    *message,
+                                               DBusConnection *connection)
+diff -rup osso-wlan-1.3.10/dbus-signal.c osso-wlan-1.3.10+wpa/dbus-signal.c
+--- osso-wlan-1.3.10/dbus-signal.c     2008-04-09 12:53:28.000000000 +0200
++++ osso-wlan-1.3.10+wpa/dbus-signal.c 2009-02-27 19:39:32.000000000 +0100
+@@ -274,7 +274,7 @@ static void handle_wap_event(struct scan
+                 if (state != WLAN_CONNECTED) {
+                         set_wlan_state(WLAN_NO_ADDRESS, NO_SIGNAL, FORCE_NO);
+                 }
+-        } else {
++        } else if (!using_supplicant()) {
+                 
+                 /* Set_wlan_state puts IF down */
+                 set_wlan_state(WLAN_NOT_INITIALIZED,
+@@ -488,7 +488,7 @@ static int handle_wpa_ie_assoc_event_bin
+         int ie_len;
+         int sock;
+-        if (get_wpa_mode() == FALSE)
++        if (!get_wpa_mode() || using_supplicant())
+                 return 0;
+         
+         // event is MAC:IE, do minimal sanity checking
+diff -rup osso-wlan-1.3.10/debian/changelog osso-wlan-1.3.10+wpa/debian/changelog
+--- osso-wlan-1.3.10/debian/changelog  2008-04-09 12:54:37.000000000 +0200
++++ osso-wlan-1.3.10+wpa/debian/changelog      2009-02-22 13:58:58.000000000 +0100
+@@ -1,3 +1,9 @@
++osso-wlan (1.3.10+wpa) unstable; urgency=low
++
++  * Added flag USE_SUPPLICANT (meaning "leave me alone") 
++
++ -- Javier <javier@javispedro.com>  Sun, 22 Feb 2009 13:58:22 +0100
++
+ osso-wlan (1.3.10) unstable; urgency=low
+   * Fix build issues for SDK. Fixes: NB#83881
+diff -rup osso-wlan-1.3.10/Makefile osso-wlan-1.3.10+wpa/Makefile
+--- osso-wlan-1.3.10/Makefile  2008-04-09 12:54:37.000000000 +0200
++++ osso-wlan-1.3.10+wpa/Makefile      2009-02-27 19:40:17.000000000 +0100
+@@ -25,7 +25,7 @@ CFLAGS += -DVERSION=\"$(VERSION)\" -D_GN
+ # Debug flags
+ #CFLAGS += -g -ggdb -DDEBUG -O0 -rdynamic 
+-CFLAGS += -DDEBUG
++#CFLAGS += -DDEBUG -DOSSOLOG_STDERR
+ CFLAGS += -DUSE_MCE_MODE -DACTIVITY_CHECK
+ # Library flags
+diff -rup osso-wlan-1.3.10/wpa.c osso-wlan-1.3.10+wpa/wpa.c
+--- osso-wlan-1.3.10/wpa.c     2007-06-08 09:14:17.000000000 +0200
++++ osso-wlan-1.3.10+wpa/wpa.c 2009-02-23 13:55:36.000000000 +0100
+@@ -188,6 +188,7 @@ static gboolean mic_failure_running_cb(v
+ gboolean get_mic_status(void) 
+ {        
++        DLOG_DEBUG("get_mic_status timer=%d", mic_failure_running_timer_id);
+         return (mic_failure_running_timer_id != 0 ? TRUE:FALSE);
+ }
+@@ -198,6 +199,12 @@ gboolean get_mic_status(void) 
+ */
+ int handle_mic_failure(gboolean key_type) 
+ {        
++        DLOG_WARN("MIC failure");
++        
++        if (using_supplicant()) {
++              DLOG_DEBUG("Using supplicant: ignoring MIC failure");
++              return 0;
++        }
+         
+         if (mic_failure_timer_id != 0) {