hostapd: move the madwifi segfault fix to the right place
authorFelix Fietkau <nbd@openwrt.org>
Sun, 31 Oct 2010 13:49:34 +0000 (13:49 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 31 Oct 2010 13:49:34 +0000 (13:49 +0000)
SVN-Revision: 23738

package/hostapd/patches/330-madwifi_merge.patch
package/hostapd/patches/460-oper_state_fix.patch

index f35eab3..cddffe4 100644 (file)
 -      return 0;
 -}
 -
- static int
+-static int
 -set80211param(struct wpa_driver_madwifi_data *drv, int op, int arg,
 -            int show_err)
 -{
 -      return 0;
 -}
 -
--static int
+ static int
 -wpa_driver_madwifi_set_wpa_ie(struct wpa_driver_madwifi_data *drv,
 +wpa_driver_madwifi_set_wpa_ie(struct madwifi_driver_data *drv,
                              const u8 *wpa_ie, size_t wpa_ie_len)
        return wpa_driver_wext_get_ssid(drv->wext, ssid);
  }
  
-@@ -1705,14 +1481,14 @@ static int wpa_driver_madwifi_get_ssid(v
+@@ -1705,14 +1481,16 @@ static int wpa_driver_madwifi_get_ssid(v
  static struct wpa_scan_results *
  wpa_driver_madwifi_get_scan_results(void *priv)
  {
  {
 -      struct wpa_driver_madwifi_data *drv = priv;
 +      struct madwifi_driver_data *drv = priv;
++      if (!drv->wext)
++              return 0;
        return wpa_driver_wext_set_operstate(drv->wext, state);
  }
  
-@@ -1733,7 +1509,7 @@ static int wpa_driver_madwifi_set_probe_
+@@ -1733,7 +1511,7 @@ static int wpa_driver_madwifi_set_probe_
  
        ret = set80211priv(priv, IEEE80211_IOCTL_SET_APPIEBUF, probe_req_ie,
                           sizeof(struct ieee80211req_getset_appiebuf) +
  
        os_free(probe_req_ie);
  
-@@ -1743,7 +1519,7 @@ static int wpa_driver_madwifi_set_probe_
+@@ -1743,7 +1521,7 @@ static int wpa_driver_madwifi_set_probe_
  
  static void * wpa_driver_madwifi_init(void *ctx, const char *ifname)
  {
  
        drv = os_zalloc(sizeof(*drv));
        if (drv == NULL)
-@@ -1754,17 +1530,17 @@ static void * wpa_driver_madwifi_init(vo
+@@ -1754,17 +1532,17 @@ static void * wpa_driver_madwifi_init(vo
  
        drv->ctx = ctx;
        os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname));
                wpa_printf(MSG_DEBUG, "%s: failed to enable WPA support",
                           __FUNCTION__);
                goto fail3;
-@@ -1773,7 +1549,7 @@ static void * wpa_driver_madwifi_init(vo
+@@ -1773,7 +1551,7 @@ static void * wpa_driver_madwifi_init(vo
        return drv;
  
  fail3:
  fail2:
        wpa_driver_wext_deinit(drv->wext);
  fail:
-@@ -1784,38 +1560,37 @@ fail:
+@@ -1784,38 +1562,37 @@ fail:
  
  static void wpa_driver_madwifi_deinit(void *priv)
  {
  #ifdef HOSTAPD
        .hapd_init              = madwifi_init,
        .hapd_deinit            = madwifi_deinit,
-@@ -1835,7 +1610,8 @@ const struct wpa_driver_ops wpa_driver_m
+@@ -1835,7 +1612,8 @@ const struct wpa_driver_ops wpa_driver_m
        .sta_clear_stats        = madwifi_sta_clear_stats,
        .commit                 = madwifi_commit,
        .set_ap_wps_ie          = madwifi_set_ap_wps_ie,
        .get_bssid              = wpa_driver_madwifi_get_bssid,
        .get_ssid               = wpa_driver_madwifi_get_ssid,
        .init                   = wpa_driver_madwifi_init,
-@@ -1847,5 +1623,5 @@ const struct wpa_driver_ops wpa_driver_m
+@@ -1847,5 +1625,5 @@ const struct wpa_driver_ops wpa_driver_m
        .disassociate           = wpa_driver_madwifi_disassociate,
        .associate              = wpa_driver_madwifi_associate,
        .set_operstate          = wpa_driver_madwifi_set_operstate,
index 8ea0e12..5a685a2 100644 (file)
@@ -23,25 +23,3 @@ DORMANT state does not prevent normal operations after that.
        return 0;
  }
  
---- a/src/drivers/driver_wext.c
-+++ b/src/drivers/driver_wext.c
-@@ -2245,11 +2245,14 @@ int wpa_driver_wext_set_operstate(void *
- {
-       struct wpa_driver_wext_data *drv = priv;
--      wpa_printf(MSG_DEBUG, "%s: operstate %d->%d (%s)",
--                 __func__, drv->operstate, state, state ? "UP" : "DORMANT");
--      drv->operstate = state;
--      return netlink_send_oper_ifla(drv->netlink, drv->ifindex, -1,
--                                    state ? IF_OPER_UP : IF_OPER_DORMANT);
-+      if (drv != NULL)
-+      {
-+              wpa_printf(MSG_DEBUG, "%s: operstate %d->%d (%s)",
-+                         __func__, drv->operstate, state, state ? "UP" : "DORMANT");
-+              drv->operstate = state;
-+              return netlink_send_oper_ifla(drv->netlink, drv->ifindex, -1,
-+                                            state ? IF_OPER_UP : IF_OPER_DORMANT);
-+      }
- }