initial import
[libicd-wpa] / patches / osso-wlan-1.3.10.patch
1 diff -rup osso-wlan-1.3.10/common.h osso-wlan-1.3.10+wpa/common.h
2 --- osso-wlan-1.3.10/common.h   2007-12-20 07:20:35.000000000 +0100
3 +++ osso-wlan-1.3.10+wpa/common.h       2009-02-23 14:03:24.000000000 +0100
4 @@ -202,6 +202,7 @@ gboolean set_power_state(guint state, in
5  int get_encryption_info(void);
6  void remove_connect_timer(void);
7  int disassociate_eap(void);
8 +int using_supplicant(void);
9  int get_mode(void);
10  DBusHandlerResult wlancond_req_handler(DBusConnection *connection,
11                                         DBusMessage *message, void *user_data);
12 diff -rup osso-wlan-1.3.10/dbus-handler.c osso-wlan-1.3.10+wpa/dbus-handler.c
13 --- osso-wlan-1.3.10/dbus-handler.c     2007-12-04 12:20:31.000000000 +0100
14 +++ osso-wlan-1.3.10+wpa/dbus-handler.c 2009-02-23 14:03:32.000000000 +0100
15 @@ -37,6 +37,7 @@
16  #include <dbus/dbus.h>
17  #include <eap-dbus.h>
18  #include <wlancond-dbus.h>
19 +#include <wlancond-supp.h>
20  #ifdef USE_MCE_MODE
21  #include <mce/dbus-names.h>
22  #endif
23 @@ -73,6 +74,9 @@ static gboolean power_down_after_scan = 
24  static gboolean scan_threshold_supported = FALSE;
25  static dbus_bool_t saved_inactivity = FALSE;
26  
27 +/* Indicates if we are using wpa_supplicant for the job */
28 +static gboolean use_supplicant = FALSE;
29 +
30  /* Timer IDs */
31  static guint wlan_if_down_timer_id = 0;
32  static guint wlan_connect_timer_id = 0;
33 @@ -605,14 +609,18 @@ static gboolean wlan_connect_timer_cb(vo
34  {
35          wlan_connect_timer_id = 0;
36          
37 -        if (get_wlan_state() == WLAN_INITIALIZED && !get_mic_status()) {
38 -                DLOG_DEBUG("Association timeout");
39 -                set_wlan_state(WLAN_NOT_INITIALIZED, DISCONNECTED_SIGNAL, 
40 -                               FORCE_YES);
41 -                return FALSE;
42 +        if (get_wlan_state() == WLAN_INITIALIZED) {
43 +               if (use_supplicant) {
44 +                       DLOG_DEBUG("wpa_supplicant should do its job now"); 
45 +               } else if (!get_mic_status()) {
46 +                       DLOG_DEBUG("Association timeout");
47 +                       
48 +                       set_wlan_state(WLAN_NOT_INITIALIZED, DISCONNECTED_SIGNAL, 
49 +                                      FORCE_YES);
50 +               } else {      
51 +                       DLOG_DEBUG("Association OK"); 
52 +                }
53          }
54 -        
55 -        //DLOG_DEBUG("Association OK");        
56  
57          return FALSE;
58  }
59 @@ -1176,6 +1184,14 @@ static DBusHandlerResult settings_and_co
60                  powersave = WLANCOND_SHORT_CAM;
61          }
62          
63 +        if (flags & WLANCOND_USE_SUPPLICANT) {
64 +               DLOG_DEBUG("Using wpa_supplicant");
65 +               use_supplicant = TRUE;
66 +               encryption = WLANCOND_OPEN; // Don't handle it
67 +        } else {
68 +               use_supplicant = FALSE;
69 +       }
70 +        
71          if (power_level != WLANCOND_TX_POWER10 &&
72              power_level != WLANCOND_TX_POWER100) {
73                  DLOG_ERR("Invalid power level");
74 @@ -2153,6 +2169,9 @@ int wpa_ie_push(unsigned char* ap_mac_ad
75          DBusMessage *msg;
76          DBusPendingCall *pending;
77  
78 +        if (use_supplicant)
79 +               return 0;
80 +
81          if (wlan_status.wpa_ie.ie_valid == IE_NOT_VALID || 
82              selected_ssid == NULL) {
83                  DLOG_ERR("WPA IE / SSID (%s) not valid", selected_ssid);
84 @@ -2205,6 +2224,9 @@ int wpa_mic_failure_event(dbus_bool_t ke
85          DBusMessage *reply;
86          DBusError derr;
87  
88 +        if (use_supplicant)
89 +               return 0;
90 +
91          msg = dbus_message_new_method_call(
92                  EAP_SERVICE,
93                  EAP_REQ_PATH,
94 @@ -2249,6 +2271,9 @@ int disassociate_eap(void) {
95          DBusMessage *reply;
96          DBusError derr;
97          
98 +        if (use_supplicant)
99 +               return 0;
100 +        
101          msg = dbus_message_new_method_call(
102                  EAP_SERVICE,
103                  EAP_REQ_PATH,
104 @@ -2280,6 +2305,11 @@ int disassociate_eap(void) {
105          return 0;
106  }
107  
108 +int using_supplicant(void)
109 +{
110 +       return use_supplicant;
111 +}
112 +
113  #ifdef USE_MCE_COVER
114  static DBusHandlerResult ignore_cover_request(DBusMessage    *message,
115                                                DBusConnection *connection)
116 diff -rup osso-wlan-1.3.10/dbus-signal.c osso-wlan-1.3.10+wpa/dbus-signal.c
117 --- osso-wlan-1.3.10/dbus-signal.c      2008-04-09 12:53:28.000000000 +0200
118 +++ osso-wlan-1.3.10+wpa/dbus-signal.c  2009-02-27 19:39:32.000000000 +0100
119 @@ -274,7 +274,7 @@ static void handle_wap_event(struct scan
120                  if (state != WLAN_CONNECTED) {
121                          set_wlan_state(WLAN_NO_ADDRESS, NO_SIGNAL, FORCE_NO);
122                  }
123 -        } else {
124 +        } else if (!using_supplicant()) {
125                  
126                  /* Set_wlan_state puts IF down */
127                  set_wlan_state(WLAN_NOT_INITIALIZED,
128 @@ -488,7 +488,7 @@ static int handle_wpa_ie_assoc_event_bin
129          int ie_len;
130          int sock;
131  
132 -        if (get_wpa_mode() == FALSE)
133 +        if (!get_wpa_mode() || using_supplicant())
134                  return 0;
135          
136          // event is MAC:IE, do minimal sanity checking
137 diff -rup osso-wlan-1.3.10/debian/changelog osso-wlan-1.3.10+wpa/debian/changelog
138 --- osso-wlan-1.3.10/debian/changelog   2008-04-09 12:54:37.000000000 +0200
139 +++ osso-wlan-1.3.10+wpa/debian/changelog       2009-02-22 13:58:58.000000000 +0100
140 @@ -1,3 +1,9 @@
141 +osso-wlan (1.3.10+wpa) unstable; urgency=low
142 +
143 +  * Added flag USE_SUPPLICANT (meaning "leave me alone") 
144 +
145 + -- Javier <javier@javispedro.com>  Sun, 22 Feb 2009 13:58:22 +0100
146 +
147  osso-wlan (1.3.10) unstable; urgency=low
148  
149    * Fix build issues for SDK. Fixes: NB#83881
150 diff -rup osso-wlan-1.3.10/Makefile osso-wlan-1.3.10+wpa/Makefile
151 --- osso-wlan-1.3.10/Makefile   2008-04-09 12:54:37.000000000 +0200
152 +++ osso-wlan-1.3.10+wpa/Makefile       2009-02-27 19:40:17.000000000 +0100
153 @@ -25,7 +25,7 @@ CFLAGS += -DVERSION=\"$(VERSION)\" -D_GN
154  
155  # Debug flags
156  #CFLAGS += -g -ggdb -DDEBUG -O0 -rdynamic 
157 -CFLAGS += -DDEBUG
158 +#CFLAGS += -DDEBUG -DOSSOLOG_STDERR
159  CFLAGS += -DUSE_MCE_MODE -DACTIVITY_CHECK
160  
161  # Library flags
162 diff -rup osso-wlan-1.3.10/wpa.c osso-wlan-1.3.10+wpa/wpa.c
163 --- osso-wlan-1.3.10/wpa.c      2007-06-08 09:14:17.000000000 +0200
164 +++ osso-wlan-1.3.10+wpa/wpa.c  2009-02-23 13:55:36.000000000 +0100
165 @@ -188,6 +188,7 @@ static gboolean mic_failure_running_cb(v
166  
167  gboolean get_mic_status(void) 
168  {        
169 +        DLOG_DEBUG("get_mic_status timer=%d", mic_failure_running_timer_id);
170          return (mic_failure_running_timer_id != 0 ? TRUE:FALSE);
171  }
172  
173 @@ -198,6 +199,12 @@ gboolean get_mic_status(void) 
174  */
175  int handle_mic_failure(gboolean key_type) 
176  {        
177 +        DLOG_WARN("MIC failure");
178 +        
179 +        if (using_supplicant()) {
180 +               DLOG_DEBUG("Using supplicant: ignoring MIC failure");
181 +               return 0;
182 +        }
183          
184          if (mic_failure_timer_id != 0) {
185