nl80211: Share monitor mode filtering and reading functions
[wpasupplicant] / src / drivers / driver_privsep.c
index e329a74..2ea6766 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * WPA Supplicant - privilege separated driver interface
- * Copyright (c) 2007, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -443,6 +443,22 @@ static void wpa_driver_privsep_event_rx_eapol(void *ctx, u8 *buf, size_t len)
 }
 
 
+static void wpa_driver_privsep_event_sta_rx(void *ctx, u8 *buf, size_t len)
+{
+#ifdef CONFIG_CLIENT_MLME
+       struct ieee80211_rx_status *rx_status;
+
+       if (len < sizeof(*rx_status))
+               return;
+       rx_status = (struct ieee80211_rx_status *) buf;
+       buf += sizeof(*rx_status);
+       len -= sizeof(*rx_status);
+
+       wpa_supplicant_sta_rx(ctx, buf, len, rx_status);
+#endif /* CONFIG_CLIENT_MLME */
+}
+
+
 static void wpa_driver_privsep_receive(int sock, void *eloop_ctx,
                                       void *sock_ctx)
 {
@@ -518,6 +534,11 @@ static void wpa_driver_privsep_receive(int sock, void *eloop_ctx,
        case PRIVSEP_EVENT_RX_EAPOL:
                wpa_driver_privsep_event_rx_eapol(drv->ctx, event_buf,
                                                  event_len);
+               break;
+       case PRIVSEP_EVENT_STA_RX:
+               wpa_driver_privsep_event_sta_rx(drv->ctx, event_buf,
+                                               event_len);
+               break;
        }
 
        os_free(buf);
@@ -735,6 +756,15 @@ static int wpa_driver_privsep_set_mode(void *priv, int mode)
 }
 
 
+static int wpa_driver_privsep_set_country(void *priv, const char *alpha2)
+{
+       struct wpa_driver_privsep_data *drv = priv;
+       wpa_printf(MSG_DEBUG, "%s country='%s'", __func__, alpha2);
+       return wpa_priv_cmd(drv, PRIVSEP_CMD_SET_COUNTRY, alpha2,
+                           os_strlen(alpha2), NULL, NULL);
+}
+
+
 struct wpa_driver_ops wpa_driver_privsep_ops = {
        "privsep",
        "wpa_supplicant privilege separated driver",
@@ -775,15 +805,68 @@ struct wpa_driver_ops wpa_driver_privsep_ops = {
        wpa_driver_privsep_get_scan_results2,
        NULL /* set_probe_req_ie */,
        wpa_driver_privsep_set_mode,
-       NULL /* set_country */,
+       wpa_driver_privsep_set_country,
        NULL /* global_init */,
        NULL /* global_deinit */,
        NULL /* init2 */,
-       NULL /* get_interfaces */
+       NULL /* get_interfaces */,
+       NULL /* scan2 */,
+       NULL /* authenticate */,
+       NULL /* set_beacon */,
+       NULL /* set_beacon_int */,
+       NULL /* set_ieee8021x */,
+       NULL /* set_privacy */,
+       NULL /* hapd_set_key */,
+       NULL /* get_seqnum */,
+       NULL /* get_seqnum_igtk */,
+       NULL /* flush */,
+       NULL /* set_generic_elem */,
+       NULL /* read_sta_data */,
+       NULL /* hapd_send_eapol */,
+       NULL /* sta_deauth */,
+       NULL /* sta_disassoc */,
+       NULL /* sta_remove */,
+       NULL /* hapd_get_ssid */,
+       NULL /* hapd_set_ssid */,
+       NULL /* hapd_set_countermeasures */,
+       NULL /* sta_add */,
+       NULL /* get_inact_sec */,
+       NULL /* sta_clear_stats */,
+       NULL /* set_freq */,
+       NULL /* set_rts */,
+       NULL /* set_frag */,
+       NULL /* set_retry */,
+       NULL /* sta_set_flags */,
+       NULL /* set_rate_sets */,
+       NULL /* set_ieee80211d */,
+       NULL /* hapd_set_beacon */,
+       NULL /* set_internal_bridge */,
+       NULL /* hapd_set_beacon_int */,
+       NULL /* set_broadcast_ssid */,
+       NULL /* set_cts_protect */,
+       NULL /* set_preamble */,
+       NULL /* set_short_slot_time */,
+       NULL /* set_tx_queue_params */,
+       NULL /* bss_add */,
+       NULL /* bss_remove */,
+       NULL /* valid_bss_mask */,
+       NULL /* passive_scan */,
+       NULL /* if_add */,
+       NULL /* if_update */,
+       NULL /* if_remove */,
+       NULL /* set_sta_vlan */,
+       NULL /* commit */,
+       NULL /* send_ether */,
+       NULL /* set_radius_acl_auth */,
+       NULL /* set_radius_acl_expire */,
+       NULL /* set_ht_params */,
+       NULL /* set_wps_beacon_ie */,
+       NULL /* set_wps_probe_resp_ie */,
+       NULL /* get_neighbor_bss */
 };
 
 
-struct wpa_driver_ops *wpa_supplicant_drivers[] =
+struct wpa_driver_ops *wpa_drivers[] =
 {
        &wpa_driver_privsep_ops,
        NULL