Skip to content
Browse files

WEXT: Add "HANGED" processing

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
  • Loading branch information...
1 parent 68b591f commit aea96d8d72b9ced7f60b9de38e2e87e6a4a6125a Dmitry Shmidt committed Nov 24, 2009
Showing with 17 additions and 3 deletions.
  1. +16 −3 driver_wext.c
  2. +1 −0 driver_wext.h
View
19 driver_wext.c
@@ -84,6 +84,7 @@ struct wpa_driver_wext_data {
char mlmedev[IFNAMSIZ + 1];
int scan_complete_events;
+ int errors;
};
@@ -1001,6 +1002,7 @@ void * wpa_driver_wext_init(void *ctx, const char *ifname)
drv->mlme_sock = -1;
+ drv->errors = 0;
wpa_driver_wext_finish_drv_init(drv);
return drv;
@@ -2542,11 +2544,15 @@ static int wpa_driver_priv_driver_cmd(void *priv, char *cmd, char *buf, size_t b
else if (os_strcasecmp(cmd, "STOP") == 0) {
if ((wpa_driver_wext_get_ifflags(drv, &flags) == 0) &&
(flags & IFF_UP)) {
- wpa_printf(MSG_ERROR, "WEXT: %s when iface is UP",
- cmd);
+ wpa_printf(MSG_ERROR, "WEXT: %s when iface is UP", cmd);
wpa_driver_wext_set_ifflags(drv, flags & ~IFF_UP);
}
}
+ else if( os_strcasecmp(cmd, "RELOAD") == 0 ) {
+ wpa_printf(MSG_DEBUG,"Reload command");
+ wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "HANGED");
+ return ret;
+ }
os_memset(&iwr, 0, sizeof(iwr));
os_strncpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
@@ -2558,9 +2564,16 @@ static int wpa_driver_priv_driver_cmd(void *priv, char *cmd, char *buf, size_t b
perror("ioctl[SIOCSIWPRIV]");
}
- if (ret < 0)
+ if (ret < 0) {
wpa_printf(MSG_ERROR, "%s failed", __func__);
+ drv->errors++;
+ if (drv->errors > WEXT_NUMBER_SEQUENTIAL_ERRORS) {
+ drv->errors = 0;
+ wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "HANGED");
+ }
+ }
else {
+ drv->errors = 0;
ret = 0;
if ((os_strcasecmp(cmd, "RSSI") == 0) ||
(os_strcasecmp(cmd, "LINKSPEED") == 0) ||
View
1 driver_wext.h
@@ -52,6 +52,7 @@ int wpa_driver_wext_get_version(struct wpa_driver_wext_data *drv);
#define WPA_DRIVER_WEXT_WAIT_US 400000
#define MAX_DRV_CMD_SIZE 248
+#define WEXT_NUMBER_SEQUENTIAL_ERRORS 4
#endif
#endif /* DRIVER_WEXT_H */

0 comments on commit aea96d8

Please sign in to comment.
Something went wrong with that request. Please try again.