diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index d1ba9d759..c00f4db4d 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -309,6 +309,7 @@ struct ieee80211_mgmt { } STRUCT_PACKED auth; struct { le16 reason_code; + u8 variable[0]; } STRUCT_PACKED deauth; struct { le16 capab_info; @@ -332,6 +333,7 @@ struct ieee80211_mgmt { } STRUCT_PACKED reassoc_req; struct { le16 reason_code; + u8 variable[0]; } STRUCT_PACKED disassoc; struct { u8 timestamp[8]; diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 4e40a3839..029465201 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -476,6 +476,11 @@ struct wpa_driver_associate_params { * is being requested. Most drivers should not need ot use this. */ enum wps_mode wps; + + /** + * p2p - Whether this connection is a P2P group + */ + int p2p; }; /** @@ -518,6 +523,17 @@ struct wpa_driver_capa { #define WPA_DRIVER_FLAGS_AP 0x00000040 /* Driver needs static WEP key setup after association has been completed */ #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080 +/* Driver takes care of P2P management operations */ +#define WPA_DRIVER_FLAGS_P2P_MGMT 0x00000100 +/* Driver supports concurrent P2P operations */ +#define WPA_DRIVER_FLAGS_P2P_CONCURRENT 0x00000200 +/* + * Driver uses the initial interface as a dedicated management interface, i.e., + * it cannot be used for P2P group operations. + */ +#define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE 0x00000400 +/* This interface is P2P capable (P2P Device, GO, or P2P Client */ +#define WPA_DRIVER_FLAGS_P2P_CAPABLE 0x00000800 unsigned int flags; int max_scan_ssids; @@ -583,6 +599,22 @@ enum wpa_driver_if_type { * This interface has its own address and Beacon frame. */ WPA_IF_AP_BSS, + + /** + * WPA_IF_P2P_GO - P2P Group Owner + */ + WPA_IF_P2P_GO, + + /** + * WPA_IF_P2P_CLIENT - P2P Client + */ + WPA_IF_P2P_CLIENT, + + /** + * WPA_IF_P2P_GROUP - P2P Group interface (will become either + * WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known) + */ + WPA_IF_P2P_GROUP }; struct wpa_init_params { @@ -1618,6 +1650,14 @@ struct wpa_driver_ops { * Beacon and Probe Response frames. This can be left undefined (set * to %NULL) if the driver uses the Beacon template from set_beacon() * and does not process Probe Request frames. + * + * This will also be used to add P2P IE(s) into Beacon/Probe Response + * frames when operating as a GO. The driver is responsible for adding + * timing related attributes (e.g., NoA) in addition to the IEs + * included here by appending them after these buffers. This call is + * also used to provide Probe Response IEs for P2P Listen state + * operations for drivers that generate the Probe Response frames + * internally. */ int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon, const struct wpabuf *proberesp); @@ -1781,6 +1821,45 @@ struct wpa_driver_ops { */ int (*send_frame)(void *priv, const u8 *data, size_t data_len, int encrypt); + + /** + * shared_freq - Get operating frequency of shared interface(s) + * @priv: Private driver interface data + * Returns: Operating frequency in MHz, 0 if no shared operation in + * use, or -1 on failure + * + * This command can be used to request the current operating frequency + * of any virtual interface that shares the same radio to provide + * information for channel selection for other virtual interfaces. + */ + int (*shared_freq)(void *priv); + + /** + * get_noa - Get current Notice of Absence attribute payload + * @priv: Private driver interface data + * @buf: Buffer for returning NoA + * @buf_len: Buffer length in octets + * Returns: Number of octets used in buf, 0 to indicate no NoA is being + * advertized, or -1 on failure + * + * This function is used to fetch the current Notice of Absence + * attribute value from GO. + */ + int (*get_noa)(void *priv, u8 *buf, size_t buf_len); + + /** + * set_noa - Set Notice of Absence parameters for GO (testing) + * @priv: Private driver interface data + * @count: Count + * @start: Start time in ms from next TBTT + * @duration: Duration in ms + * Returns: 0 on success or -1 on failure + * + * This function is used to set Notice of Absence parameters for GO. It + * is used only for testing. To disable NoA, all parameters are set to + * 0. + */ + int (*set_noa)(void *priv, u8 count, int start, int duration); }; @@ -2178,6 +2257,16 @@ union wpa_event_data { * Deauthentication frame */ u16 reason_code; + + /** + * ie - Optional IE(s) in Disassociation frame + */ + const u8 *ie; + + /** + * ie_len - Length of ie buffer in octets + */ + size_t ie_len; } disassoc_info; /** @@ -2194,6 +2283,16 @@ union wpa_event_data { * Deauthentication frame */ u16 reason_code; + + /** + * ie - Optional IE(s) in Deauthentication frame + */ + const u8 *ie; + + /** + * ie_len - Length of ie buffer in octets + */ + size_t ie_len; } deauth_info; /** diff --git a/src/drivers/driver_ndis.c b/src/drivers/driver_ndis.c index 6ce4200a4..73f50df82 100644 --- a/src/drivers/driver_ndis.c +++ b/src/drivers/driver_ndis.c @@ -3303,5 +3303,8 @@ const struct wpa_driver_ops wpa_driver_ndis_ops = { NULL /* suspend */, NULL /* resume */, NULL /* signal_monitor */, - NULL /* send_frame */ + NULL /* send_frame */, + NULL /* shared_freq */, + NULL /* get_noa */, + NULL /* set_noa */ }; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 0590fed96..4ab6539ed 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4985,10 +4985,13 @@ static enum nl80211_iftype wpa_driver_nl80211_if_type( { switch (type) { case WPA_IF_STATION: + case WPA_IF_P2P_CLIENT: + case WPA_IF_P2P_GROUP: return NL80211_IFTYPE_STATION; case WPA_IF_AP_VLAN: return NL80211_IFTYPE_AP_VLAN; case WPA_IF_AP_BSS: + case WPA_IF_P2P_GO: return NL80211_IFTYPE_AP; } return -1; diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h index a70aa6a3e..80bff26a1 100644 --- a/wpa_supplicant/driver_i.h +++ b/wpa_supplicant/driver_i.h @@ -394,6 +394,14 @@ static inline int wpa_drv_send_action(struct wpa_supplicant *wpa_s, return -1; } +static inline int wpa_drv_set_freq(struct wpa_supplicant *wpa_s, + struct hostapd_freq_params *freq) +{ + if (wpa_s->driver->set_freq) + return wpa_s->driver->set_freq(wpa_s->drv_priv, freq); + return -1; +} + static inline int wpa_drv_if_add(struct wpa_supplicant *wpa_s, enum wpa_driver_if_type type, const char *ifname, const u8 *addr, @@ -491,4 +499,27 @@ static inline int wpa_drv_set_ap_wps_ie(struct wpa_supplicant *wpa_s, proberesp); } +static inline int wpa_drv_shared_freq(struct wpa_supplicant *wpa_s) +{ + if (!wpa_s->driver->shared_freq) + return -1; + return wpa_s->driver->shared_freq(wpa_s->drv_priv); +} + +static inline int wpa_drv_get_noa(struct wpa_supplicant *wpa_s, + u8 *buf, size_t buf_len) +{ + if (!wpa_s->driver->get_noa) + return -1; + return wpa_s->driver->get_noa(wpa_s->drv_priv, buf, buf_len); +} + +static inline int wpa_drv_set_noa(struct wpa_supplicant *wpa_s, u8 count, + int start, int duration) +{ + if (!wpa_s->driver->set_noa) + return -1; + return wpa_s->driver->set_noa(wpa_s->drv_priv, count, start, duration); +} + #endif /* DRIVER_I_H */