Skip to content

Commit

Permalink
driver: add new NL80211 cmds to support mesh ifaces
Browse files Browse the repository at this point in the history
- Create mesh_join and mesh_leave actions to kernel.
- Handle new_peer_candidate events from kernel.
- Register to receive necessary frames.
- Add plink_action_field and mesh_power_mode to hostapd_sta_add_params

Signed-off-by: Javier Lopez <[email protected]>
Signed-off-by: Javier Cardona <[email protected]>
Signed-off-by: Jason Mobarak <[email protected]>
Signed-hostap: Bob Copeland <[email protected]>

---

v2: - Split out the widing of the drv_flags / flags into separate patch.
    - Squash with "Clarify comment on TODO" cozybit/wpa_s_mesh_android@9543020
    - Squash with "Add plink_action_field and mesh_power_mode to hostapd_sta_add_params" cozybit/wpa_s_mesh_android@89d29f6
    - Squash with "Clarify comment (issue #10)" cozybit/wpa_s_mesh_android@21734bc
    - Squash with "closes #12" cozybit/wpa_s_mesh_android@4d7209e
    - Squash with "Closes #16" cozybit/wpa_s_mesh_android@fa05631
    - Squash with "No default mesh frequency. Closes #18" cozybit/wpa_s_mesh_android@03f80b9
    - Squash with "Closes #19" cozybit/wpa_s_mesh_android@3cf9b4c
    - Squash with "Set mesh authentication protocol id in mesh config" cozybit/wpa_s_mesh_android@caaf6ee
    - Squash with "PLINK_CLOSE can have only MESHID and MPM IEs" cozybit/wpa_s_mesh_android@6c4fd81

v3: Remove workaround for NL80211_FEATURE_SK_TX_STATUS
v4: No changes
v5: Removed extraneous else for NL80211_FEATURE_SK_TX_STATUS change
v6: Updated email addresses, added signed-hostap for Bob
v7: remove blank lines
  • Loading branch information
bcopeland committed May 7, 2014
1 parent 8a0f3bf commit 89a6d39
Show file tree
Hide file tree
Showing 6 changed files with 378 additions and 15 deletions.
25 changes: 25 additions & 0 deletions src/common/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,29 @@ enum wpa_ctrl_req_type {
/* Maximum number of EAP methods to store for EAP server user information */
#define EAP_MAX_METHODS 8

#ifdef CONFIG_MESH
enum mesh_plink_state {
PLINK_LISTEN = 1,
PLINK_OPEN_SENT,
PLINK_OPEN_RCVD,
PLINK_CNF_RCVD,
PLINK_ESTAB,
PLINK_HOLDING,
PLINK_BLOCKED,
};

enum mesh_power_mode {
MESH_POWER_ACTIVE = 1,
MESH_POWER_LIGHT_SLEEP,
MESH_POWER_DEEP_SLEEP,
};

enum plink_action_field {
PLINK_OPEN = 1,
PLINK_CONFIRM,
PLINK_CLOSE
};

#endif /* CONFIG_MESH */

#endif /* DEFS_H */
78 changes: 75 additions & 3 deletions src/drivers/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ struct hostapd_hw_modes {
#define IEEE80211_MODE_INFRA 0
#define IEEE80211_MODE_IBSS 1
#define IEEE80211_MODE_AP 2
#define IEEE80211_MODE_MESH 5

#define IEEE80211_CAP_ESS 0x0001
#define IEEE80211_CAP_IBSS 0x0002
Expand Down Expand Up @@ -870,6 +871,29 @@ struct wpa_driver_ap_params {
int osen;
};

struct wpa_driver_mesh_bss_params {
#define WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS 0x00000001
/* TODO: Other mesh configuration parameters would go here. See
* NL80211_MESHCONF_* in nl80211.h for all the mesh config parameters. */
unsigned int flags;
};

struct wpa_driver_mesh_join_params {
const u8 *meshid;
int meshid_len;
int *basic_rates;
int mcast_rate;
u8 *ies;
int ie_len;
int freq;
struct wpa_driver_mesh_bss_params conf;
#define WPA_DRIVER_MESH_FLAG_USER_MPM 0x00000001
#define WPA_DRIVER_MESH_FLAG_DRIVER_MPM 0x00000002
#define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004
#define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008
unsigned int flags;
};

/**
* struct wpa_driver_capa - Driver capability information
*/
Expand Down Expand Up @@ -1055,6 +1079,12 @@ struct hostapd_sta_add_params {
int vht_opmode_enabled;
u8 vht_opmode;
u32 flags; /* bitmask of WPA_STA_* flags */
u32 flags_mask; /* unset bits in flags */
#ifdef CONFIG_MESH
enum mesh_plink_state plink_state;
enum plink_action_field plink_action;
enum mesh_power_mode power_mode;
#endif /* CONFIG_MESH */
int set; /* Set STA parameters instead of add */
u8 qosinfo;
const u8 *ext_capab;
Expand Down Expand Up @@ -1135,7 +1165,11 @@ enum wpa_driver_if_type {
* WPA_IF_P2P_DEVICE - P2P Device interface is used to indentify the
* abstracted P2P Device function in the driver
*/
WPA_IF_P2P_DEVICE
WPA_IF_P2P_DEVICE,
/*
* WPA_IF_MESH - Mesh interface
*/
WPA_IF_MESH
};

struct wpa_init_params {
Expand Down Expand Up @@ -1173,6 +1207,7 @@ struct wpa_bss_params {
#define WPA_STA_SHORT_PREAMBLE BIT(2)
#define WPA_STA_MFP BIT(3)
#define WPA_STA_TDLS_PEER BIT(4)
#define WPA_STA_AUTHENTICATED BIT(5)

enum tdls_oper {
TDLS_DISCOVERY_REQ,
Expand Down Expand Up @@ -2164,7 +2199,7 @@ struct wpa_driver_ops {
* @session_timeout: Session timeout for the station
* Returns: 0 on success, -1 on failure
*/
int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
u32 session_timeout);

/**
Expand Down Expand Up @@ -2761,6 +2796,21 @@ struct wpa_driver_ops {
* Returns: Length of written status information or -1 on failure
*/
int (*status)(void *priv, char *buf, size_t buflen);

/**
* join_mesh - Join a mesh network
* @priv: Private driver interface data
* @params: Mesh configuration parameters
* Returns: 0 on success, -1 on failure
*/
int (*join_mesh)(void *priv, struct wpa_driver_mesh_join_params *params);

/**
* leave_mesh - Leave a mesh network
* @priv: Private driver interface data
* Returns 0 on success, -1 on failure
*/
int (*leave_mesh)(void *priv);
};


Expand Down Expand Up @@ -3235,7 +3285,13 @@ enum wpa_event_type {
* to reduce issues due to interference or internal co-existence
* information in the driver.
*/
EVENT_AVOID_FREQUENCIES
EVENT_AVOID_FREQUENCIES,

/**
* EVENT_NEW_PEER_CANDIDATE - new (unknown) mesh peer notification
*/
EVENT_NEW_PEER_CANDIDATE

};


Expand Down Expand Up @@ -3874,6 +3930,22 @@ union wpa_event_data {
* This is used as the data with EVENT_AVOID_FREQUENCIES.
*/
struct wpa_freq_range_list freq_range;

/**
* struct mesh_peer
*
* @peer: peer address
* @ies: beacon IEs
* @ie_len: length of @ies
*
* Notification of new candidate mesh peer.
*/
struct mesh_peer {
u8 peer[ETH_ALEN];
u8 *ies;
int ie_len;
} mesh_peer;

};

/**
Expand Down
1 change: 1 addition & 0 deletions src/drivers/driver_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const char * event_to_string(enum wpa_event_type event)
E2S(DRIVER_CLIENT_POLL_OK);
E2S(EAPOL_TX_STATUS);
E2S(CH_SWITCH);
E2S(NEW_PEER_CANDIDATE);
E2S(WNM);
E2S(CONNECT_FAILED_REASON);
E2S(DFS_RADAR_DETECTED);
Expand Down
Loading

0 comments on commit 89a6d39

Please sign in to comment.