2 * mac80211 configuration hooks for cfg80211
4 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
6 * This file is GPLv2 as found in COPYING.
9 #include <linux/ieee80211.h>
10 #include <linux/nl80211.h>
11 #include <linux/rtnetlink.h>
12 #include <net/net_namespace.h>
13 #include <linux/rcupdate.h>
14 #include <net/cfg80211.h>
15 #include "ieee80211_i.h"
20 static bool nl80211_type_check(enum nl80211_iftype type
)
23 case NL80211_IFTYPE_ADHOC
:
24 case NL80211_IFTYPE_STATION
:
25 case NL80211_IFTYPE_MONITOR
:
26 #ifdef CONFIG_MAC80211_MESH
27 case NL80211_IFTYPE_MESH_POINT
:
29 case NL80211_IFTYPE_WDS
:
36 static int ieee80211_add_iface(struct wiphy
*wiphy
, char *name
,
37 enum nl80211_iftype type
, u32
*flags
,
38 struct vif_params
*params
)
40 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
41 struct net_device
*dev
;
42 struct ieee80211_sub_if_data
*sdata
;
45 if (!nl80211_type_check(type
))
48 err
= ieee80211_if_add(local
, name
, &dev
, type
, params
);
49 if (err
|| type
!= NL80211_IFTYPE_MONITOR
|| !flags
)
52 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
53 sdata
->u
.mntr_flags
= *flags
;
57 static int ieee80211_del_iface(struct wiphy
*wiphy
, int ifindex
)
59 struct net_device
*dev
;
60 struct ieee80211_sub_if_data
*sdata
;
62 /* we're under RTNL */
63 dev
= __dev_get_by_index(&init_net
, ifindex
);
67 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
69 ieee80211_if_remove(sdata
);
74 static int ieee80211_change_iface(struct wiphy
*wiphy
, int ifindex
,
75 enum nl80211_iftype type
, u32
*flags
,
76 struct vif_params
*params
)
78 struct net_device
*dev
;
79 struct ieee80211_sub_if_data
*sdata
;
82 /* we're under RTNL */
83 dev
= __dev_get_by_index(&init_net
, ifindex
);
87 if (!nl80211_type_check(type
))
90 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
92 ret
= ieee80211_if_change_type(sdata
, type
);
96 if (netif_running(sdata
->dev
))
99 if (ieee80211_vif_is_mesh(&sdata
->vif
) && params
->mesh_id_len
)
100 ieee80211_sdata_set_mesh_id(sdata
,
104 if (sdata
->vif
.type
!= NL80211_IFTYPE_MONITOR
|| !flags
)
107 sdata
->u
.mntr_flags
= *flags
;
111 static int ieee80211_add_key(struct wiphy
*wiphy
, struct net_device
*dev
,
112 u8 key_idx
, u8
*mac_addr
,
113 struct key_params
*params
)
115 struct ieee80211_sub_if_data
*sdata
;
116 struct sta_info
*sta
= NULL
;
117 enum ieee80211_key_alg alg
;
118 struct ieee80211_key
*key
;
121 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
123 switch (params
->cipher
) {
124 case WLAN_CIPHER_SUITE_WEP40
:
125 case WLAN_CIPHER_SUITE_WEP104
:
128 case WLAN_CIPHER_SUITE_TKIP
:
131 case WLAN_CIPHER_SUITE_CCMP
:
138 key
= ieee80211_key_alloc(alg
, key_idx
, params
->key_len
, params
->key
);
145 sta
= sta_info_get(sdata
->local
, mac_addr
);
147 ieee80211_key_free(key
);
153 ieee80211_key_link(key
, sdata
, sta
);
162 static int ieee80211_del_key(struct wiphy
*wiphy
, struct net_device
*dev
,
163 u8 key_idx
, u8
*mac_addr
)
165 struct ieee80211_sub_if_data
*sdata
;
166 struct sta_info
*sta
;
169 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
176 sta
= sta_info_get(sdata
->local
, mac_addr
);
181 ieee80211_key_free(sta
->key
);
189 if (!sdata
->keys
[key_idx
]) {
194 ieee80211_key_free(sdata
->keys
[key_idx
]);
195 WARN_ON(sdata
->keys
[key_idx
]);
204 static int ieee80211_get_key(struct wiphy
*wiphy
, struct net_device
*dev
,
205 u8 key_idx
, u8
*mac_addr
, void *cookie
,
206 void (*callback
)(void *cookie
,
207 struct key_params
*params
))
209 struct ieee80211_sub_if_data
*sdata
;
210 struct sta_info
*sta
= NULL
;
212 struct key_params params
;
213 struct ieee80211_key
*key
;
218 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
223 sta
= sta_info_get(sdata
->local
, mac_addr
);
229 key
= sdata
->keys
[key_idx
];
234 memset(¶ms
, 0, sizeof(params
));
236 switch (key
->conf
.alg
) {
238 params
.cipher
= WLAN_CIPHER_SUITE_TKIP
;
240 iv32
= key
->u
.tkip
.tx
.iv32
;
241 iv16
= key
->u
.tkip
.tx
.iv16
;
243 if (key
->flags
& KEY_FLAG_UPLOADED_TO_HARDWARE
&&
244 sdata
->local
->ops
->get_tkip_seq
)
245 sdata
->local
->ops
->get_tkip_seq(
246 local_to_hw(sdata
->local
),
247 key
->conf
.hw_key_idx
,
250 seq
[0] = iv16
& 0xff;
251 seq
[1] = (iv16
>> 8) & 0xff;
252 seq
[2] = iv32
& 0xff;
253 seq
[3] = (iv32
>> 8) & 0xff;
254 seq
[4] = (iv32
>> 16) & 0xff;
255 seq
[5] = (iv32
>> 24) & 0xff;
260 params
.cipher
= WLAN_CIPHER_SUITE_CCMP
;
261 seq
[0] = key
->u
.ccmp
.tx_pn
[5];
262 seq
[1] = key
->u
.ccmp
.tx_pn
[4];
263 seq
[2] = key
->u
.ccmp
.tx_pn
[3];
264 seq
[3] = key
->u
.ccmp
.tx_pn
[2];
265 seq
[4] = key
->u
.ccmp
.tx_pn
[1];
266 seq
[5] = key
->u
.ccmp
.tx_pn
[0];
271 if (key
->conf
.keylen
== 5)
272 params
.cipher
= WLAN_CIPHER_SUITE_WEP40
;
274 params
.cipher
= WLAN_CIPHER_SUITE_WEP104
;
278 params
.key
= key
->conf
.key
;
279 params
.key_len
= key
->conf
.keylen
;
281 callback(cookie
, ¶ms
);
289 static int ieee80211_config_default_key(struct wiphy
*wiphy
,
290 struct net_device
*dev
,
293 struct ieee80211_sub_if_data
*sdata
;
297 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
298 ieee80211_set_default_key(sdata
, key_idx
);
305 static void sta_set_sinfo(struct sta_info
*sta
, struct station_info
*sinfo
)
307 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
309 sinfo
->filled
= STATION_INFO_INACTIVE_TIME
|
310 STATION_INFO_RX_BYTES
|
311 STATION_INFO_TX_BYTES
;
313 sinfo
->inactive_time
= jiffies_to_msecs(jiffies
- sta
->last_rx
);
314 sinfo
->rx_bytes
= sta
->rx_bytes
;
315 sinfo
->tx_bytes
= sta
->tx_bytes
;
317 if (ieee80211_vif_is_mesh(&sdata
->vif
)) {
318 #ifdef CONFIG_MAC80211_MESH
319 sinfo
->filled
|= STATION_INFO_LLID
|
321 STATION_INFO_PLINK_STATE
;
323 sinfo
->llid
= le16_to_cpu(sta
->llid
);
324 sinfo
->plid
= le16_to_cpu(sta
->plid
);
325 sinfo
->plink_state
= sta
->plink_state
;
331 static int ieee80211_dump_station(struct wiphy
*wiphy
, struct net_device
*dev
,
332 int idx
, u8
*mac
, struct station_info
*sinfo
)
334 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
335 struct sta_info
*sta
;
340 sta
= sta_info_get_by_idx(local
, idx
, dev
);
343 memcpy(mac
, sta
->sta
.addr
, ETH_ALEN
);
344 sta_set_sinfo(sta
, sinfo
);
352 static int ieee80211_get_station(struct wiphy
*wiphy
, struct net_device
*dev
,
353 u8
*mac
, struct station_info
*sinfo
)
355 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
356 struct sta_info
*sta
;
361 /* XXX: verify sta->dev == dev */
363 sta
= sta_info_get(local
, mac
);
366 sta_set_sinfo(sta
, sinfo
);
375 * This handles both adding a beacon and setting new beacon info
377 static int ieee80211_config_beacon(struct ieee80211_sub_if_data
*sdata
,
378 struct beacon_parameters
*params
)
380 struct beacon_data
*new, *old
;
381 int new_head_len
, new_tail_len
;
385 old
= sdata
->u
.ap
.beacon
;
387 /* head must not be zero-length */
388 if (params
->head
&& !params
->head_len
)
392 * This is a kludge. beacon interval should really be part
393 * of the beacon information.
395 if (params
->interval
) {
396 sdata
->local
->hw
.conf
.beacon_int
= params
->interval
;
397 ieee80211_hw_config(sdata
->local
,
398 IEEE80211_CONF_CHANGE_BEACON_INTERVAL
);
400 * We updated some parameter so if below bails out
406 /* Need to have a beacon head if we don't have one yet */
407 if (!params
->head
&& !old
)
410 /* sorry, no way to start beaconing without dtim period */
411 if (!params
->dtim_period
&& !old
)
414 /* new or old head? */
416 new_head_len
= params
->head_len
;
418 new_head_len
= old
->head_len
;
420 /* new or old tail? */
421 if (params
->tail
|| !old
)
422 /* params->tail_len will be zero for !params->tail */
423 new_tail_len
= params
->tail_len
;
425 new_tail_len
= old
->tail_len
;
427 size
= sizeof(*new) + new_head_len
+ new_tail_len
;
429 new = kzalloc(size
, GFP_KERNEL
);
433 /* start filling the new info now */
435 /* new or old dtim period? */
436 if (params
->dtim_period
)
437 new->dtim_period
= params
->dtim_period
;
439 new->dtim_period
= old
->dtim_period
;
442 * pointers go into the block we allocated,
443 * memory is | beacon_data | head | tail |
445 new->head
= ((u8
*) new) + sizeof(*new);
446 new->tail
= new->head
+ new_head_len
;
447 new->head_len
= new_head_len
;
448 new->tail_len
= new_tail_len
;
452 memcpy(new->head
, params
->head
, new_head_len
);
454 memcpy(new->head
, old
->head
, new_head_len
);
456 /* copy in optional tail */
458 memcpy(new->tail
, params
->tail
, new_tail_len
);
461 memcpy(new->tail
, old
->tail
, new_tail_len
);
463 rcu_assign_pointer(sdata
->u
.ap
.beacon
, new);
469 return ieee80211_if_config(sdata
, IEEE80211_IFCC_BEACON
);
472 static int ieee80211_add_beacon(struct wiphy
*wiphy
, struct net_device
*dev
,
473 struct beacon_parameters
*params
)
475 struct ieee80211_sub_if_data
*sdata
;
476 struct beacon_data
*old
;
478 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
480 if (sdata
->vif
.type
!= NL80211_IFTYPE_AP
)
483 old
= sdata
->u
.ap
.beacon
;
488 return ieee80211_config_beacon(sdata
, params
);
491 static int ieee80211_set_beacon(struct wiphy
*wiphy
, struct net_device
*dev
,
492 struct beacon_parameters
*params
)
494 struct ieee80211_sub_if_data
*sdata
;
495 struct beacon_data
*old
;
497 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
499 if (sdata
->vif
.type
!= NL80211_IFTYPE_AP
)
502 old
= sdata
->u
.ap
.beacon
;
507 return ieee80211_config_beacon(sdata
, params
);
510 static int ieee80211_del_beacon(struct wiphy
*wiphy
, struct net_device
*dev
)
512 struct ieee80211_sub_if_data
*sdata
;
513 struct beacon_data
*old
;
515 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
517 if (sdata
->vif
.type
!= NL80211_IFTYPE_AP
)
520 old
= sdata
->u
.ap
.beacon
;
525 rcu_assign_pointer(sdata
->u
.ap
.beacon
, NULL
);
529 return ieee80211_if_config(sdata
, IEEE80211_IFCC_BEACON
);
532 /* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
533 struct iapp_layer2_update
{
534 u8 da
[ETH_ALEN
]; /* broadcast */
535 u8 sa
[ETH_ALEN
]; /* STA addr */
541 } __attribute__ ((packed
));
543 static void ieee80211_send_layer2_update(struct sta_info
*sta
)
545 struct iapp_layer2_update
*msg
;
548 /* Send Level 2 Update Frame to update forwarding tables in layer 2
551 skb
= dev_alloc_skb(sizeof(*msg
));
554 msg
= (struct iapp_layer2_update
*)skb_put(skb
, sizeof(*msg
));
556 /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID)
557 * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */
559 memset(msg
->da
, 0xff, ETH_ALEN
);
560 memcpy(msg
->sa
, sta
->sta
.addr
, ETH_ALEN
);
563 msg
->ssap
= 0x01; /* NULL LSAP, CR Bit: Response */
564 msg
->control
= 0xaf; /* XID response lsb.1111F101.
565 * F=0 (no poll command; unsolicited frame) */
566 msg
->xid_info
[0] = 0x81; /* XID format identifier */
567 msg
->xid_info
[1] = 1; /* LLC types/classes: Type 1 LLC */
568 msg
->xid_info
[2] = 0; /* XID sender's receive window size (RW) */
570 skb
->dev
= sta
->sdata
->dev
;
571 skb
->protocol
= eth_type_trans(skb
, sta
->sdata
->dev
);
572 memset(skb
->cb
, 0, sizeof(skb
->cb
));
576 static void sta_apply_parameters(struct ieee80211_local
*local
,
577 struct sta_info
*sta
,
578 struct station_parameters
*params
)
582 struct ieee80211_supported_band
*sband
;
583 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
586 * FIXME: updating the flags is racy when this function is
587 * called from ieee80211_change_station(), this will
588 * be resolved in a future patch.
591 if (params
->station_flags
& STATION_FLAG_CHANGED
) {
592 spin_lock_bh(&sta
->lock
);
593 sta
->flags
&= ~WLAN_STA_AUTHORIZED
;
594 if (params
->station_flags
& STATION_FLAG_AUTHORIZED
)
595 sta
->flags
|= WLAN_STA_AUTHORIZED
;
597 sta
->flags
&= ~WLAN_STA_SHORT_PREAMBLE
;
598 if (params
->station_flags
& STATION_FLAG_SHORT_PREAMBLE
)
599 sta
->flags
|= WLAN_STA_SHORT_PREAMBLE
;
601 sta
->flags
&= ~WLAN_STA_WME
;
602 if (params
->station_flags
& STATION_FLAG_WME
)
603 sta
->flags
|= WLAN_STA_WME
;
604 spin_unlock_bh(&sta
->lock
);
608 * FIXME: updating the following information is racy when this
609 * function is called from ieee80211_change_station().
610 * However, all this information should be static so
611 * maybe we should just reject attemps to change it.
615 sta
->sta
.aid
= params
->aid
;
616 if (sta
->sta
.aid
> IEEE80211_MAX_AID
)
617 sta
->sta
.aid
= 0; /* XXX: should this be an error? */
620 if (params
->listen_interval
>= 0)
621 sta
->listen_interval
= params
->listen_interval
;
623 if (params
->supported_rates
) {
625 sband
= local
->hw
.wiphy
->bands
[local
->oper_channel
->band
];
627 for (i
= 0; i
< params
->supported_rates_len
; i
++) {
628 int rate
= (params
->supported_rates
[i
] & 0x7f) * 5;
629 for (j
= 0; j
< sband
->n_bitrates
; j
++) {
630 if (sband
->bitrates
[j
].bitrate
== rate
)
634 sta
->sta
.supp_rates
[local
->oper_channel
->band
] = rates
;
638 ieee80211_ht_cap_ie_to_sta_ht_cap(params
->ht_capa
,
641 if (ieee80211_vif_is_mesh(&sdata
->vif
) && params
->plink_action
) {
642 switch (params
->plink_action
) {
643 case PLINK_ACTION_OPEN
:
644 mesh_plink_open(sta
);
646 case PLINK_ACTION_BLOCK
:
647 mesh_plink_block(sta
);
653 static int ieee80211_add_station(struct wiphy
*wiphy
, struct net_device
*dev
,
654 u8
*mac
, struct station_parameters
*params
)
656 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
657 struct sta_info
*sta
;
658 struct ieee80211_sub_if_data
*sdata
;
661 /* Prevent a race with changing the rate control algorithm */
662 if (!netif_running(dev
))
666 sdata
= IEEE80211_DEV_TO_SUB_IF(params
->vlan
);
668 if (sdata
->vif
.type
!= NL80211_IFTYPE_AP_VLAN
&&
669 sdata
->vif
.type
!= NL80211_IFTYPE_AP
)
672 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
674 if (compare_ether_addr(mac
, dev
->dev_addr
) == 0)
677 if (is_multicast_ether_addr(mac
))
680 sta
= sta_info_alloc(sdata
, mac
, GFP_KERNEL
);
684 sta
->flags
= WLAN_STA_AUTH
| WLAN_STA_ASSOC
;
686 sta_apply_parameters(local
, sta
, params
);
688 rate_control_rate_init(sta
);
692 err
= sta_info_insert(sta
);
694 /* STA has been freed */
699 if (sdata
->vif
.type
== NL80211_IFTYPE_AP_VLAN
||
700 sdata
->vif
.type
== NL80211_IFTYPE_AP
)
701 ieee80211_send_layer2_update(sta
);
708 static int ieee80211_del_station(struct wiphy
*wiphy
, struct net_device
*dev
,
711 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
712 struct ieee80211_sub_if_data
*sdata
;
713 struct sta_info
*sta
;
715 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
720 /* XXX: get sta belonging to dev */
721 sta
= sta_info_get(local
, mac
);
727 sta_info_unlink(&sta
);
730 sta_info_destroy(sta
);
732 sta_info_flush(local
, sdata
);
737 static int ieee80211_change_station(struct wiphy
*wiphy
,
738 struct net_device
*dev
,
740 struct station_parameters
*params
)
742 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
743 struct sta_info
*sta
;
744 struct ieee80211_sub_if_data
*vlansdata
;
748 /* XXX: get sta belonging to dev */
749 sta
= sta_info_get(local
, mac
);
755 if (params
->vlan
&& params
->vlan
!= sta
->sdata
->dev
) {
756 vlansdata
= IEEE80211_DEV_TO_SUB_IF(params
->vlan
);
758 if (vlansdata
->vif
.type
!= NL80211_IFTYPE_AP_VLAN
&&
759 vlansdata
->vif
.type
!= NL80211_IFTYPE_AP
) {
764 sta
->sdata
= vlansdata
;
765 ieee80211_send_layer2_update(sta
);
768 sta_apply_parameters(local
, sta
, params
);
775 #ifdef CONFIG_MAC80211_MESH
776 static int ieee80211_add_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
777 u8
*dst
, u8
*next_hop
)
779 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
780 struct ieee80211_sub_if_data
*sdata
;
781 struct mesh_path
*mpath
;
782 struct sta_info
*sta
;
785 if (!netif_running(dev
))
788 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
790 if (sdata
->vif
.type
!= NL80211_IFTYPE_MESH_POINT
)
794 sta
= sta_info_get(local
, next_hop
);
800 err
= mesh_path_add(dst
, sdata
);
806 mpath
= mesh_path_lookup(dst
, sdata
);
811 mesh_path_fix_nexthop(mpath
, sta
);
817 static int ieee80211_del_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
820 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
823 return mesh_path_del(dst
, sdata
);
825 mesh_path_flush(sdata
);
829 static int ieee80211_change_mpath(struct wiphy
*wiphy
,
830 struct net_device
*dev
,
831 u8
*dst
, u8
*next_hop
)
833 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
834 struct ieee80211_sub_if_data
*sdata
;
835 struct mesh_path
*mpath
;
836 struct sta_info
*sta
;
838 if (!netif_running(dev
))
841 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
843 if (sdata
->vif
.type
!= NL80211_IFTYPE_MESH_POINT
)
848 sta
= sta_info_get(local
, next_hop
);
854 mpath
= mesh_path_lookup(dst
, sdata
);
860 mesh_path_fix_nexthop(mpath
, sta
);
866 static void mpath_set_pinfo(struct mesh_path
*mpath
, u8
*next_hop
,
867 struct mpath_info
*pinfo
)
870 memcpy(next_hop
, mpath
->next_hop
->sta
.addr
, ETH_ALEN
);
872 memset(next_hop
, 0, ETH_ALEN
);
874 pinfo
->filled
= MPATH_INFO_FRAME_QLEN
|
878 MPATH_INFO_DISCOVERY_TIMEOUT
|
879 MPATH_INFO_DISCOVERY_RETRIES
|
882 pinfo
->frame_qlen
= mpath
->frame_queue
.qlen
;
883 pinfo
->dsn
= mpath
->dsn
;
884 pinfo
->metric
= mpath
->metric
;
885 if (time_before(jiffies
, mpath
->exp_time
))
886 pinfo
->exptime
= jiffies_to_msecs(mpath
->exp_time
- jiffies
);
887 pinfo
->discovery_timeout
=
888 jiffies_to_msecs(mpath
->discovery_timeout
);
889 pinfo
->discovery_retries
= mpath
->discovery_retries
;
891 if (mpath
->flags
& MESH_PATH_ACTIVE
)
892 pinfo
->flags
|= NL80211_MPATH_FLAG_ACTIVE
;
893 if (mpath
->flags
& MESH_PATH_RESOLVING
)
894 pinfo
->flags
|= NL80211_MPATH_FLAG_RESOLVING
;
895 if (mpath
->flags
& MESH_PATH_DSN_VALID
)
896 pinfo
->flags
|= NL80211_MPATH_FLAG_DSN_VALID
;
897 if (mpath
->flags
& MESH_PATH_FIXED
)
898 pinfo
->flags
|= NL80211_MPATH_FLAG_FIXED
;
899 if (mpath
->flags
& MESH_PATH_RESOLVING
)
900 pinfo
->flags
|= NL80211_MPATH_FLAG_RESOLVING
;
902 pinfo
->flags
= mpath
->flags
;
905 static int ieee80211_get_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
906 u8
*dst
, u8
*next_hop
, struct mpath_info
*pinfo
)
909 struct ieee80211_sub_if_data
*sdata
;
910 struct mesh_path
*mpath
;
912 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
914 if (sdata
->vif
.type
!= NL80211_IFTYPE_MESH_POINT
)
918 mpath
= mesh_path_lookup(dst
, sdata
);
923 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
924 mpath_set_pinfo(mpath
, next_hop
, pinfo
);
929 static int ieee80211_dump_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
930 int idx
, u8
*dst
, u8
*next_hop
,
931 struct mpath_info
*pinfo
)
933 struct ieee80211_sub_if_data
*sdata
;
934 struct mesh_path
*mpath
;
936 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
938 if (sdata
->vif
.type
!= NL80211_IFTYPE_MESH_POINT
)
942 mpath
= mesh_path_lookup_by_idx(idx
, sdata
);
947 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
948 mpath_set_pinfo(mpath
, next_hop
, pinfo
);
954 static int ieee80211_change_bss(struct wiphy
*wiphy
,
955 struct net_device
*dev
,
956 struct bss_parameters
*params
)
958 struct ieee80211_sub_if_data
*sdata
;
961 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
963 if (sdata
->vif
.type
!= NL80211_IFTYPE_AP
)
966 if (params
->use_cts_prot
>= 0) {
967 sdata
->bss_conf
.use_cts_prot
= params
->use_cts_prot
;
968 changed
|= BSS_CHANGED_ERP_CTS_PROT
;
970 if (params
->use_short_preamble
>= 0) {
971 sdata
->bss_conf
.use_short_preamble
=
972 params
->use_short_preamble
;
973 changed
|= BSS_CHANGED_ERP_PREAMBLE
;
975 if (params
->use_short_slot_time
>= 0) {
976 sdata
->bss_conf
.use_short_slot
=
977 params
->use_short_slot_time
;
978 changed
|= BSS_CHANGED_ERP_SLOT
;
981 ieee80211_bss_info_change_notify(sdata
, changed
);
986 struct cfg80211_ops mac80211_config_ops
= {
987 .add_virtual_intf
= ieee80211_add_iface
,
988 .del_virtual_intf
= ieee80211_del_iface
,
989 .change_virtual_intf
= ieee80211_change_iface
,
990 .add_key
= ieee80211_add_key
,
991 .del_key
= ieee80211_del_key
,
992 .get_key
= ieee80211_get_key
,
993 .set_default_key
= ieee80211_config_default_key
,
994 .add_beacon
= ieee80211_add_beacon
,
995 .set_beacon
= ieee80211_set_beacon
,
996 .del_beacon
= ieee80211_del_beacon
,
997 .add_station
= ieee80211_add_station
,
998 .del_station
= ieee80211_del_station
,
999 .change_station
= ieee80211_change_station
,
1000 .get_station
= ieee80211_get_station
,
1001 .dump_station
= ieee80211_dump_station
,
1002 #ifdef CONFIG_MAC80211_MESH
1003 .add_mpath
= ieee80211_add_mpath
,
1004 .del_mpath
= ieee80211_del_mpath
,
1005 .change_mpath
= ieee80211_change_mpath
,
1006 .get_mpath
= ieee80211_get_mpath
,
1007 .dump_mpath
= ieee80211_dump_mpath
,
1009 .change_bss
= ieee80211_change_bss
,