ie = mgmt->u.probe_req.variable;
ie_len = len - (IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req));
- hostapd_wps_probe_req_rx(hapd, mgmt->sa, ie, ie_len);
+ hostapd_probe_req_rx(hapd, mgmt->sa, ie, ie_len);
if (!hapd->iconf->send_probe_response)
return;
void hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa,
const u8 *ie, size_t ie_len)
{
- hostapd_wps_probe_req_rx(hapd, sa, ie, ie_len);
+ size_t i;
+
+ for (i = 0; hapd->probereq_cb && i < hapd->num_probereq_cb; i++)
+ hapd->probereq_cb[i].cb(hapd->probereq_cb[i].ctx,
+ sa, ie, ie_len);
}
wpa_printf(MSG_WARNING, "Failed to remove BSS interface %s",
hapd->conf->iface);
}
+
+ os_free(hapd->probereq_cb);
+ hapd->probereq_cb = NULL;
}
os_free(iface->bss[j]);
hostapd_cleanup_iface(iface);
}
+
+
+int hostapd_register_probereq_cb(struct hostapd_data *hapd,
+ void (*cb)(void *ctx, const u8 *sa,
+ const u8 *ie, size_t ie_len),
+ void *ctx)
+{
+ struct hostapd_probereq_cb *n;
+
+ n = os_realloc(hapd->probereq_cb, (hapd->num_probereq_cb + 1) *
+ sizeof(struct hostapd_probereq_cb));
+ if (n == NULL)
+ return -1;
+
+ hapd->probereq_cb = n;
+ n = &hapd->probereq_cb[hapd->num_probereq_cb];
+ hapd->num_probereq_cb++;
+
+ n->cb = cb;
+ n->ctx = ctx;
+
+ return 0;
+}
struct full_dynamic_vlan;
#endif /* CONFIG_FULL_DYNAMIC_VLAN */
+struct hostapd_probereq_cb {
+ void (*cb)(void *ctx, const u8 *sa, const u8 *ie, size_t ie_len);
+ void *ctx;
+};
+
/**
* struct hostapd_data - hostapd per-BSS data structure
*/
unsigned int ap_pin_failures;
struct upnp_wps_device_sm *wps_upnp;
#endif /* CONFIG_WPS */
+
+ struct hostapd_probereq_cb *probereq_cb;
+ size_t num_probereq_cb;
};
int hostapd_for_each_interface(int (*cb)(struct hostapd_iface *iface,
void *ctx), void *ctx);
+int hostapd_register_probereq_cb(struct hostapd_data *hapd,
+ void (*cb)(void *ctx, const u8 *sa,
+ const u8 *ie, size_t ie_len),
+ void *ctx);
+
#endif /* HOSTAPD_H */
static void hostapd_wps_upnp_deinit(struct hostapd_data *hapd);
#endif /* CONFIG_WPS_UPNP */
+static void hostapd_wps_probe_req_rx(void *ctx, const u8 *addr,
+ const u8 *ie, size_t ie_len);
+
static int hostapd_wps_new_psk_cb(void *ctx, const u8 *mac_addr, const u8 *psk,
size_t psk_len)
}
#endif /* CONFIG_WPS_UPNP */
+ hostapd_register_probereq_cb(hapd, hostapd_wps_probe_req_rx, hapd);
+
hapd->wps = wps;
return 0;
#endif /* CONFIG_WPS_OOB */
-void hostapd_wps_probe_req_rx(struct hostapd_data *hapd, const u8 *addr,
- const u8 *ie, size_t ie_len)
+static void hostapd_wps_probe_req_rx(void *ctx, const u8 *addr,
+ const u8 *ie, size_t ie_len)
{
+ struct hostapd_data *hapd = ctx;
struct wpabuf *wps_ie;
const u8 *end, *pos, *wps;
int hostapd_wps_button_pushed(struct hostapd_data *hapd);
int hostapd_wps_start_oob(struct hostapd_data *hapd, char *device_type,
char *path, char *method, char *name);
-void hostapd_wps_probe_req_rx(struct hostapd_data *hapd, const u8 *addr,
- const u8 *ie, size_t ie_len);
#else /* CONFIG_WPS */
{
}
-static inline void hostapd_wps_probe_req_rx(struct hostapd_data *hapd,
- const u8 *addr,
- const u8 *ie, size_t ie_len)
-{
-}
#endif /* CONFIG_WPS */
#endif /* WPS_HOSTAPD_H */