aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-04-19 15:24:32 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:57:17 -0400
commit04a773ade0680d862b479d7219973df60f7a3834 (patch)
treefc759eb79099fefd7f1329bcb2b703008cb0adfe /include
parent691597cb26f236ac7471f1adf925a134c86799d6 (diff)
cfg80211/nl80211: add IBSS API
This adds IBSS API along with (preliminary) wext handlers. The wext handlers can only do IBSS so you need to call them from your own wext handlers if the mode is IBSS. The nl80211 API requires * an SSID * a channel (frequency) for the case that a new IBSS has to be created It optionally supports * a flag to fix the channel * a fixed BSSID The cfg80211 code also takes care to leave the IBSS before the netdev is set down. If wireless extensions are used, it also caches values when the interface is down and instructs the driver to join when the interface is set up. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/nl80211.h18
-rw-r--r--include/net/cfg80211.h72
-rw-r--r--include/net/wireless.h14
3 files changed, 104 insertions, 0 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index c01423888db9..25ce3e42bd10 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -223,6 +223,15 @@
223 * %NL80211_ATTR_KEY_SEQ to indicate the TSC value of the frame; this 223 * %NL80211_ATTR_KEY_SEQ to indicate the TSC value of the frame; this
224 * event matches with MLME-MICHAELMICFAILURE.indication() primitive 224 * event matches with MLME-MICHAELMICFAILURE.indication() primitive
225 * 225 *
226 * @NL80211_CMD_JOIN_IBSS: Join a new IBSS -- given at least an SSID and a
227 * FREQ attribute (for the initial frequency if no peer can be found)
228 * and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those
229 * should be fixed rather than automatically determined. Can only be
230 * executed on a network interface that is UP, and fixed BSSID/FREQ
231 * may be rejected.
232 * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is
233 * determined by the network interface.
234 *
226 * @NL80211_CMD_MAX: highest used command number 235 * @NL80211_CMD_MAX: highest used command number
227 * @__NL80211_CMD_AFTER_LAST: internal use 236 * @__NL80211_CMD_AFTER_LAST: internal use
228 */ 237 */
@@ -288,6 +297,9 @@ enum nl80211_commands {
288 297
289 NL80211_CMD_REG_BEACON_HINT, 298 NL80211_CMD_REG_BEACON_HINT,
290 299
300 NL80211_CMD_JOIN_IBSS,
301 NL80211_CMD_LEAVE_IBSS,
302
291 /* add new commands above here */ 303 /* add new commands above here */
292 304
293 /* used to define NL80211_CMD_MAX below */ 305 /* used to define NL80211_CMD_MAX below */
@@ -456,6 +468,9 @@ enum nl80211_commands {
456 * @NL80211_ATTR_CIPHER_SUITES: a set of u32 values indicating the supported 468 * @NL80211_ATTR_CIPHER_SUITES: a set of u32 values indicating the supported
457 * cipher suites 469 * cipher suites
458 * 470 *
471 * @NL80211_ATTR_FREQ_FIXED: a flag indicating the IBSS should not try to look
472 * for other networks on different channels
473 *
459 * @NL80211_ATTR_MAX: highest attribute number currently defined 474 * @NL80211_ATTR_MAX: highest attribute number currently defined
460 * @__NL80211_ATTR_AFTER_LAST: internal use 475 * @__NL80211_ATTR_AFTER_LAST: internal use
461 */ 476 */
@@ -547,6 +562,9 @@ enum nl80211_attrs {
547 562
548 NL80211_ATTR_FREQ_BEFORE, 563 NL80211_ATTR_FREQ_BEFORE,
549 NL80211_ATTR_FREQ_AFTER, 564 NL80211_ATTR_FREQ_AFTER,
565
566 NL80211_ATTR_FREQ_FIXED,
567
550 /* add attributes here, update the policy in nl80211.c */ 568 /* add attributes here, update the policy in nl80211.c */
551 569
552 __NL80211_ATTR_AFTER_LAST, 570 __NL80211_ATTR_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 019a41efa0bb..5287a3e56e7c 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -658,6 +658,31 @@ struct cfg80211_disassoc_request {
658}; 658};
659 659
660/** 660/**
661 * struct cfg80211_ibss_params - IBSS parameters
662 *
663 * This structure defines the IBSS parameters for the join_ibss()
664 * method.
665 *
666 * @ssid: The SSID, will always be non-null.
667 * @ssid_len: The length of the SSID, will always be non-zero.
668 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
669 * search for IBSSs with a different BSSID.
670 * @channel: The channel to use if no IBSS can be found to join.
671 * @channel_fixed: The channel should be fixed -- do not search for
672 * IBSSs to join on other channels.
673 * @ie: information element(s) to include in the beacon
674 * @ie_len: length of that
675 */
676struct cfg80211_ibss_params {
677 u8 *ssid;
678 u8 *bssid;
679 struct ieee80211_channel *channel;
680 u8 *ie;
681 u8 ssid_len, ie_len;
682 bool channel_fixed;
683};
684
685/**
661 * struct cfg80211_ops - backend description for wireless configuration 686 * struct cfg80211_ops - backend description for wireless configuration
662 * 687 *
663 * This struct is registered by fullmac card drivers and/or wireless stacks 688 * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -732,6 +757,11 @@ struct cfg80211_disassoc_request {
732 * @assoc: Request to (re)associate with the specified peer 757 * @assoc: Request to (re)associate with the specified peer
733 * @deauth: Request to deauthenticate from the specified peer 758 * @deauth: Request to deauthenticate from the specified peer
734 * @disassoc: Request to disassociate from the specified peer 759 * @disassoc: Request to disassociate from the specified peer
760 *
761 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
762 * cfg80211_ibss_joined(), also call that function when changing BSSID due
763 * to a merge.
764 * @leave_ibss: Leave the IBSS.
735 */ 765 */
736struct cfg80211_ops { 766struct cfg80211_ops {
737 int (*suspend)(struct wiphy *wiphy); 767 int (*suspend)(struct wiphy *wiphy);
@@ -817,6 +847,10 @@ struct cfg80211_ops {
817 struct cfg80211_deauth_request *req); 847 struct cfg80211_deauth_request *req);
818 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 848 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
819 struct cfg80211_disassoc_request *req); 849 struct cfg80211_disassoc_request *req);
850
851 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
852 struct cfg80211_ibss_params *params);
853 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
820}; 854};
821 855
822/* temporary wext handlers */ 856/* temporary wext handlers */
@@ -839,6 +873,28 @@ int cfg80211_wext_siwmlme(struct net_device *dev,
839int cfg80211_wext_giwrange(struct net_device *dev, 873int cfg80211_wext_giwrange(struct net_device *dev,
840 struct iw_request_info *info, 874 struct iw_request_info *info,
841 struct iw_point *data, char *extra); 875 struct iw_point *data, char *extra);
876int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
877 struct iw_request_info *info,
878 struct iw_freq *freq, char *extra);
879int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
880 struct iw_request_info *info,
881 struct iw_freq *freq, char *extra);
882int cfg80211_ibss_wext_siwessid(struct net_device *dev,
883 struct iw_request_info *info,
884 struct iw_point *data, char *ssid);
885int cfg80211_ibss_wext_giwessid(struct net_device *dev,
886 struct iw_request_info *info,
887 struct iw_point *data, char *ssid);
888int cfg80211_ibss_wext_siwap(struct net_device *dev,
889 struct iw_request_info *info,
890 struct sockaddr *ap_addr, char *extra);
891int cfg80211_ibss_wext_giwap(struct net_device *dev,
892 struct iw_request_info *info,
893 struct sockaddr *ap_addr, char *extra);
894
895/* wext helper for now (to be removed) */
896struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
897 struct iw_freq *freq);
842 898
843/** 899/**
844 * cfg80211_scan_done - notify that scan finished 900 * cfg80211_scan_done - notify that scan finished
@@ -984,4 +1040,20 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
984 enum nl80211_key_type key_type, int key_id, 1040 enum nl80211_key_type key_type, int key_id,
985 const u8 *tsc); 1041 const u8 *tsc);
986 1042
1043/**
1044 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
1045 *
1046 * @dev: network device
1047 * @bssid: the BSSID of the IBSS joined
1048 * @gfp: allocation flags
1049 *
1050 * This function notifies cfg80211 that the device joined an IBSS or
1051 * switched to a different BSSID. Before this function can be called,
1052 * either a beacon has to have been received from the IBSS, or one of
1053 * the cfg80211_inform_bss{,_frame} functions must have been called
1054 * with the locally generated beacon -- this guarantees that there is
1055 * always a scan result for this IBSS. cfg80211 will handle the rest.
1056 */
1057void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
1058
987#endif /* __NET_CFG80211_H */ 1059#endif /* __NET_CFG80211_H */
diff --git a/include/net/wireless.h b/include/net/wireless.h
index 44c2642d3c06..abd27b033331 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -265,6 +265,8 @@ struct wiphy {
265 * 265 *
266 * @wiphy: pointer to hardware description 266 * @wiphy: pointer to hardware description
267 * @iftype: interface type 267 * @iftype: interface type
268 * @list: (private)
269 * @netdev (private)
268 */ 270 */
269struct wireless_dev { 271struct wireless_dev {
270 struct wiphy *wiphy; 272 struct wiphy *wiphy;
@@ -273,6 +275,18 @@ struct wireless_dev {
273 /* private to the generic wireless code */ 275 /* private to the generic wireless code */
274 struct list_head list; 276 struct list_head list;
275 struct net_device *netdev; 277 struct net_device *netdev;
278
279 /* currently used for IBSS - might be rearranged in the future */
280 struct cfg80211_bss *current_bss;
281 u8 bssid[ETH_ALEN];
282 u8 ssid[IEEE80211_MAX_SSID_LEN];
283 u8 ssid_len;
284
285#ifdef CONFIG_WIRELESS_EXT
286 /* wext data */
287 struct cfg80211_ibss_params wext;
288 u8 wext_bssid[ETH_ALEN];
289#endif
276}; 290};
277 291
278/** 292/**