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 enum ieee80211_if_types
21 nl80211_type_to_mac80211_type(enum nl80211_iftype type
)
24 case NL80211_IFTYPE_UNSPECIFIED
:
25 return IEEE80211_IF_TYPE_STA
;
26 case NL80211_IFTYPE_ADHOC
:
27 return IEEE80211_IF_TYPE_IBSS
;
28 case NL80211_IFTYPE_STATION
:
29 return IEEE80211_IF_TYPE_STA
;
30 case NL80211_IFTYPE_MONITOR
:
31 return IEEE80211_IF_TYPE_MNTR
;
32 #ifdef CONFIG_MAC80211_MESH
33 case NL80211_IFTYPE_MESH_POINT
:
34 return IEEE80211_IF_TYPE_MESH_POINT
;
36 case NL80211_IFTYPE_WDS
:
37 return IEEE80211_IF_TYPE_WDS
;
39 return IEEE80211_IF_TYPE_INVALID
;
43 static int ieee80211_add_iface(struct wiphy
*wiphy
, char *name
,
44 enum nl80211_iftype type
, u32
*flags
,
45 struct vif_params
*params
)
47 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
48 enum ieee80211_if_types itype
;
49 struct net_device
*dev
;
50 struct ieee80211_sub_if_data
*sdata
;
53 itype
= nl80211_type_to_mac80211_type(type
);
54 if (itype
== IEEE80211_IF_TYPE_INVALID
)
57 err
= ieee80211_if_add(local
, name
, &dev
, itype
, params
);
58 if (err
|| itype
!= IEEE80211_IF_TYPE_MNTR
|| !flags
)
61 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
62 sdata
->u
.mntr_flags
= *flags
;
66 static int ieee80211_del_iface(struct wiphy
*wiphy
, int ifindex
)
68 struct net_device
*dev
;
70 /* we're under RTNL */
71 dev
= __dev_get_by_index(&init_net
, ifindex
);
75 ieee80211_if_remove(dev
);
80 static int ieee80211_change_iface(struct wiphy
*wiphy
, int ifindex
,
81 enum nl80211_iftype type
, u32
*flags
,
82 struct vif_params
*params
)
84 struct net_device
*dev
;
85 enum ieee80211_if_types itype
;
86 struct ieee80211_sub_if_data
*sdata
;
89 /* we're under RTNL */
90 dev
= __dev_get_by_index(&init_net
, ifindex
);
94 itype
= nl80211_type_to_mac80211_type(type
);
95 if (itype
== IEEE80211_IF_TYPE_INVALID
)
98 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
100 ret
= ieee80211_if_change_type(sdata
, itype
);
104 if (ieee80211_vif_is_mesh(&sdata
->vif
) && params
->mesh_id_len
)
105 ieee80211_if_sta_set_mesh_id(&sdata
->u
.sta
,
109 if (sdata
->vif
.type
!= IEEE80211_IF_TYPE_MNTR
|| !flags
)
112 sdata
->u
.mntr_flags
= *flags
;
116 static int ieee80211_add_key(struct wiphy
*wiphy
, struct net_device
*dev
,
117 u8 key_idx
, u8
*mac_addr
,
118 struct key_params
*params
)
120 struct ieee80211_sub_if_data
*sdata
;
121 struct sta_info
*sta
= NULL
;
122 enum ieee80211_key_alg alg
;
123 struct ieee80211_key
*key
;
126 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
128 switch (params
->cipher
) {
129 case WLAN_CIPHER_SUITE_WEP40
:
130 case WLAN_CIPHER_SUITE_WEP104
:
133 case WLAN_CIPHER_SUITE_TKIP
:
136 case WLAN_CIPHER_SUITE_CCMP
:
143 key
= ieee80211_key_alloc(alg
, key_idx
, params
->key_len
, params
->key
);
150 sta
= sta_info_get(sdata
->local
, mac_addr
);
152 ieee80211_key_free(key
);
158 ieee80211_key_link(key
, sdata
, sta
);
167 static int ieee80211_del_key(struct wiphy
*wiphy
, struct net_device
*dev
,
168 u8 key_idx
, u8
*mac_addr
)
170 struct ieee80211_sub_if_data
*sdata
;
171 struct sta_info
*sta
;
174 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
181 sta
= sta_info_get(sdata
->local
, mac_addr
);
186 ieee80211_key_free(sta
->key
);
194 if (!sdata
->keys
[key_idx
]) {
199 ieee80211_key_free(sdata
->keys
[key_idx
]);
200 WARN_ON(sdata
->keys
[key_idx
]);
209 static int ieee80211_get_key(struct wiphy
*wiphy
, struct net_device
*dev
,
210 u8 key_idx
, u8
*mac_addr
, void *cookie
,
211 void (*callback
)(void *cookie
,
212 struct key_params
*params
))
214 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
215 struct sta_info
*sta
= NULL
;
217 struct key_params params
;
218 struct ieee80211_key
*key
;
226 sta
= sta_info_get(sdata
->local
, mac_addr
);
232 key
= sdata
->keys
[key_idx
];
237 memset(¶ms
, 0, sizeof(params
));
239 switch (key
->conf
.alg
) {
241 params
.cipher
= WLAN_CIPHER_SUITE_TKIP
;
243 iv32
= key
->u
.tkip
.tx
.iv32
;
244 iv16
= key
->u
.tkip
.tx
.iv16
;
246 if (key
->flags
& KEY_FLAG_UPLOADED_TO_HARDWARE
&&
247 sdata
->local
->ops
->get_tkip_seq
)
248 sdata
->local
->ops
->get_tkip_seq(
249 local_to_hw(sdata
->local
),
250 key
->conf
.hw_key_idx
,
253 seq
[0] = iv16
& 0xff;
254 seq
[1] = (iv16
>> 8) & 0xff;
255 seq
[2] = iv32
& 0xff;
256 seq
[3] = (iv32
>> 8) & 0xff;
257 seq
[4] = (iv32
>> 16) & 0xff;
258 seq
[5] = (iv32
>> 24) & 0xff;
263 params
.cipher
= WLAN_CIPHER_SUITE_CCMP
;
264 seq
[0] = key
->u
.ccmp
.tx_pn
[5];
265 seq
[1] = key
->u
.ccmp
.tx_pn
[4];
266 seq
[2] = key
->u
.ccmp
.tx_pn
[3];
267 seq
[3] = key
->u
.ccmp
.tx_pn
[2];
268 seq
[4] = key
->u
.ccmp
.tx_pn
[1];
269 seq
[5] = key
->u
.ccmp
.tx_pn
[0];
274 if (key
->conf
.keylen
== 5)
275 params
.cipher
= WLAN_CIPHER_SUITE_WEP40
;
277 params
.cipher
= WLAN_CIPHER_SUITE_WEP104
;
281 params
.key
= key
->conf
.key
;
282 params
.key_len
= key
->conf
.keylen
;
284 callback(cookie
, ¶ms
);
292 static int ieee80211_config_default_key(struct wiphy
*wiphy
,
293 struct net_device
*dev
,
296 struct ieee80211_sub_if_data
*sdata
;
300 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
301 ieee80211_set_default_key(sdata
, key_idx
);
308 static void sta_set_sinfo(struct sta_info
*sta
, struct station_info
*sinfo
)
310 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
312 sinfo
->filled
= STATION_INFO_INACTIVE_TIME
|
313 STATION_INFO_RX_BYTES
|
314 STATION_INFO_TX_BYTES
;
316 sinfo
->inactive_time
= jiffies_to_msecs(jiffies
- sta
->last_rx
);
317 sinfo
->rx_bytes
= sta
->rx_bytes
;
318 sinfo
->tx_bytes
= sta
->tx_bytes
;
320 if (ieee80211_vif_is_mesh(&sdata
->vif
)) {
321 #ifdef CONFIG_MAC80211_MESH
322 sinfo
->filled
|= STATION_INFO_LLID
|
324 STATION_INFO_PLINK_STATE
;
326 sinfo
->llid
= le16_to_cpu(sta
->llid
);
327 sinfo
->plid
= le16_to_cpu(sta
->plid
);
328 sinfo
->plink_state
= sta
->plink_state
;
334 static int ieee80211_dump_station(struct wiphy
*wiphy
, struct net_device
*dev
,
335 int idx
, u8
*mac
, struct station_info
*sinfo
)
337 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
338 struct sta_info
*sta
;
343 sta
= sta_info_get_by_idx(local
, idx
, dev
);
346 memcpy(mac
, sta
->addr
, ETH_ALEN
);
347 sta_set_sinfo(sta
, sinfo
);
355 static int ieee80211_get_station(struct wiphy
*wiphy
, struct net_device
*dev
,
356 u8
*mac
, struct station_info
*sinfo
)
358 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
359 struct sta_info
*sta
;
364 /* XXX: verify sta->dev == dev */
366 sta
= sta_info_get(local
, mac
);
369 sta_set_sinfo(sta
, sinfo
);
378 * This handles both adding a beacon and setting new beacon info
380 static int ieee80211_config_beacon(struct ieee80211_sub_if_data
*sdata
,
381 struct beacon_parameters
*params
)
383 struct beacon_data
*new, *old
;
384 int new_head_len
, new_tail_len
;
388 old
= sdata
->u
.ap
.beacon
;
390 /* head must not be zero-length */
391 if (params
->head
&& !params
->head_len
)
395 * This is a kludge. beacon interval should really be part
396 * of the beacon information.
398 if (params
->interval
) {
399 sdata
->local
->hw
.conf
.beacon_int
= params
->interval
;
400 if (ieee80211_hw_config(sdata
->local
))
403 * We updated some parameter so if below bails out
409 /* Need to have a beacon head if we don't have one yet */
410 if (!params
->head
&& !old
)
413 /* sorry, no way to start beaconing without dtim period */
414 if (!params
->dtim_period
&& !old
)
417 /* new or old head? */
419 new_head_len
= params
->head_len
;
421 new_head_len
= old
->head_len
;
423 /* new or old tail? */
424 if (params
->tail
|| !old
)
425 /* params->tail_len will be zero for !params->tail */
426 new_tail_len
= params
->tail_len
;
428 new_tail_len
= old
->tail_len
;
430 size
= sizeof(*new) + new_head_len
+ new_tail_len
;
432 new = kzalloc(size
, GFP_KERNEL
);
436 /* start filling the new info now */
438 /* new or old dtim period? */
439 if (params
->dtim_period
)
440 new->dtim_period
= params
->dtim_period
;
442 new->dtim_period
= old
->dtim_period
;
445 * pointers go into the block we allocated,
446 * memory is | beacon_data | head | tail |
448 new->head
= ((u8
*) new) + sizeof(*new);
449 new->tail
= new->head
+ new_head_len
;
450 new->head_len
= new_head_len
;
451 new->tail_len
= new_tail_len
;
455 memcpy(new->head
, params
->head
, new_head_len
);
457 memcpy(new->head
, old
->head
, new_head_len
);
459 /* copy in optional tail */
461 memcpy(new->tail
, params
->tail
, new_tail_len
);
464 memcpy(new->tail
, old
->tail
, new_tail_len
);
466 rcu_assign_pointer(sdata
->u
.ap
.beacon
, new);
472 return ieee80211_if_config(sdata
, IEEE80211_IFCC_BEACON
);
475 static int ieee80211_add_beacon(struct wiphy
*wiphy
, struct net_device
*dev
,
476 struct beacon_parameters
*params
)
478 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
479 struct beacon_data
*old
;
481 if (sdata
->vif
.type
!= IEEE80211_IF_TYPE_AP
)
484 old
= sdata
->u
.ap
.beacon
;
489 return ieee80211_config_beacon(sdata
, params
);
492 static int ieee80211_set_beacon(struct wiphy
*wiphy
, struct net_device
*dev
,
493 struct beacon_parameters
*params
)
495 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
496 struct beacon_data
*old
;
498 if (sdata
->vif
.type
!= IEEE80211_IF_TYPE_AP
)
501 old
= sdata
->u
.ap
.beacon
;
506 return ieee80211_config_beacon(sdata
, params
);
509 static int ieee80211_del_beacon(struct wiphy
*wiphy
, struct net_device
*dev
)
511 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
512 struct beacon_data
*old
;
514 if (sdata
->vif
.type
!= IEEE80211_IF_TYPE_AP
)
517 old
= sdata
->u
.ap
.beacon
;
522 rcu_assign_pointer(sdata
->u
.ap
.beacon
, NULL
);
526 return ieee80211_if_config(sdata
, IEEE80211_IFCC_BEACON
);
529 /* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
530 struct iapp_layer2_update
{
531 u8 da
[ETH_ALEN
]; /* broadcast */
532 u8 sa
[ETH_ALEN
]; /* STA addr */
538 } __attribute__ ((packed
));
540 static void ieee80211_send_layer2_update(struct sta_info
*sta
)
542 struct iapp_layer2_update
*msg
;
545 /* Send Level 2 Update Frame to update forwarding tables in layer 2
548 skb
= dev_alloc_skb(sizeof(*msg
));
551 msg
= (struct iapp_layer2_update
*)skb_put(skb
, sizeof(*msg
));
553 /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID)
554 * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */
556 memset(msg
->da
, 0xff, ETH_ALEN
);
557 memcpy(msg
->sa
, sta
->addr
, ETH_ALEN
);
560 msg
->ssap
= 0x01; /* NULL LSAP, CR Bit: Response */
561 msg
->control
= 0xaf; /* XID response lsb.1111F101.
562 * F=0 (no poll command; unsolicited frame) */
563 msg
->xid_info
[0] = 0x81; /* XID format identifier */
564 msg
->xid_info
[1] = 1; /* LLC types/classes: Type 1 LLC */
565 msg
->xid_info
[2] = 0; /* XID sender's receive window size (RW) */
567 skb
->dev
= sta
->sdata
->dev
;
568 skb
->protocol
= eth_type_trans(skb
, sta
->sdata
->dev
);
569 memset(skb
->cb
, 0, sizeof(skb
->cb
));
573 static void sta_apply_parameters(struct ieee80211_local
*local
,
574 struct sta_info
*sta
,
575 struct station_parameters
*params
)
579 struct ieee80211_supported_band
*sband
;
580 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
583 * FIXME: updating the flags is racy when this function is
584 * called from ieee80211_change_station(), this will
585 * be resolved in a future patch.
588 if (params
->station_flags
& STATION_FLAG_CHANGED
) {
589 spin_lock_bh(&sta
->lock
);
590 sta
->flags
&= ~WLAN_STA_AUTHORIZED
;
591 if (params
->station_flags
& STATION_FLAG_AUTHORIZED
)
592 sta
->flags
|= WLAN_STA_AUTHORIZED
;
594 sta
->flags
&= ~WLAN_STA_SHORT_PREAMBLE
;
595 if (params
->station_flags
& STATION_FLAG_SHORT_PREAMBLE
)
596 sta
->flags
|= WLAN_STA_SHORT_PREAMBLE
;
598 sta
->flags
&= ~WLAN_STA_WME
;
599 if (params
->station_flags
& STATION_FLAG_WME
)
600 sta
->flags
|= WLAN_STA_WME
;
601 spin_unlock_bh(&sta
->lock
);
605 * FIXME: updating the following information is racy when this
606 * function is called from ieee80211_change_station().
607 * However, all this information should be static so
608 * maybe we should just reject attemps to change it.
612 sta
->aid
= params
->aid
;
613 if (sta
->aid
> IEEE80211_MAX_AID
)
614 sta
->aid
= 0; /* XXX: should this be an error? */
617 if (params
->listen_interval
>= 0)
618 sta
->listen_interval
= params
->listen_interval
;
620 if (params
->supported_rates
) {
622 sband
= local
->hw
.wiphy
->bands
[local
->oper_channel
->band
];
624 for (i
= 0; i
< params
->supported_rates_len
; i
++) {
625 int rate
= (params
->supported_rates
[i
] & 0x7f) * 5;
626 for (j
= 0; j
< sband
->n_bitrates
; j
++) {
627 if (sband
->bitrates
[j
].bitrate
== rate
)
631 sta
->supp_rates
[local
->oper_channel
->band
] = rates
;
634 if (ieee80211_vif_is_mesh(&sdata
->vif
) && params
->plink_action
) {
635 switch (params
->plink_action
) {
636 case PLINK_ACTION_OPEN
:
637 mesh_plink_open(sta
);
639 case PLINK_ACTION_BLOCK
:
640 mesh_plink_block(sta
);
646 static int ieee80211_add_station(struct wiphy
*wiphy
, struct net_device
*dev
,
647 u8
*mac
, struct station_parameters
*params
)
649 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
650 struct sta_info
*sta
;
651 struct ieee80211_sub_if_data
*sdata
;
654 /* Prevent a race with changing the rate control algorithm */
655 if (!netif_running(dev
))
659 sdata
= IEEE80211_DEV_TO_SUB_IF(params
->vlan
);
661 if (sdata
->vif
.type
!= IEEE80211_IF_TYPE_VLAN
&&
662 sdata
->vif
.type
!= IEEE80211_IF_TYPE_AP
)
665 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
667 if (compare_ether_addr(mac
, dev
->dev_addr
) == 0)
670 if (is_multicast_ether_addr(mac
))
673 sta
= sta_info_alloc(sdata
, mac
, GFP_KERNEL
);
677 sta
->flags
= WLAN_STA_AUTH
| WLAN_STA_ASSOC
;
679 sta_apply_parameters(local
, sta
, params
);
681 rate_control_rate_init(sta
, local
);
685 err
= sta_info_insert(sta
);
687 /* STA has been freed */
692 if (sdata
->vif
.type
== IEEE80211_IF_TYPE_VLAN
||
693 sdata
->vif
.type
== IEEE80211_IF_TYPE_AP
)
694 ieee80211_send_layer2_update(sta
);
701 static int ieee80211_del_station(struct wiphy
*wiphy
, struct net_device
*dev
,
704 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
705 struct ieee80211_local
*local
= sdata
->local
;
706 struct sta_info
*sta
;
711 /* XXX: get sta belonging to dev */
712 sta
= sta_info_get(local
, mac
);
718 sta_info_unlink(&sta
);
721 sta_info_destroy(sta
);
723 sta_info_flush(local
, sdata
);
728 static int ieee80211_change_station(struct wiphy
*wiphy
,
729 struct net_device
*dev
,
731 struct station_parameters
*params
)
733 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
734 struct sta_info
*sta
;
735 struct ieee80211_sub_if_data
*vlansdata
;
739 /* XXX: get sta belonging to dev */
740 sta
= sta_info_get(local
, mac
);
746 if (params
->vlan
&& params
->vlan
!= sta
->sdata
->dev
) {
747 vlansdata
= IEEE80211_DEV_TO_SUB_IF(params
->vlan
);
749 if (vlansdata
->vif
.type
!= IEEE80211_IF_TYPE_VLAN
&&
750 vlansdata
->vif
.type
!= IEEE80211_IF_TYPE_AP
) {
755 sta
->sdata
= IEEE80211_DEV_TO_SUB_IF(params
->vlan
);
756 ieee80211_send_layer2_update(sta
);
759 sta_apply_parameters(local
, sta
, params
);
766 #ifdef CONFIG_MAC80211_MESH
767 static int ieee80211_add_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
768 u8
*dst
, u8
*next_hop
)
770 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
771 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
772 struct mesh_path
*mpath
;
773 struct sta_info
*sta
;
776 if (!netif_running(dev
))
779 if (sdata
->vif
.type
!= IEEE80211_IF_TYPE_MESH_POINT
)
783 sta
= sta_info_get(local
, next_hop
);
789 err
= mesh_path_add(dst
, dev
);
795 mpath
= mesh_path_lookup(dst
, dev
);
800 mesh_path_fix_nexthop(mpath
, sta
);
806 static int ieee80211_del_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
810 return mesh_path_del(dst
, dev
);
812 mesh_path_flush(dev
);
816 static int ieee80211_change_mpath(struct wiphy
*wiphy
,
817 struct net_device
*dev
,
818 u8
*dst
, u8
*next_hop
)
820 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
821 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
822 struct mesh_path
*mpath
;
823 struct sta_info
*sta
;
825 if (!netif_running(dev
))
828 if (sdata
->vif
.type
!= IEEE80211_IF_TYPE_MESH_POINT
)
833 sta
= sta_info_get(local
, next_hop
);
839 mpath
= mesh_path_lookup(dst
, dev
);
845 mesh_path_fix_nexthop(mpath
, sta
);
851 static void mpath_set_pinfo(struct mesh_path
*mpath
, u8
*next_hop
,
852 struct mpath_info
*pinfo
)
855 memcpy(next_hop
, mpath
->next_hop
->addr
, ETH_ALEN
);
857 memset(next_hop
, 0, ETH_ALEN
);
859 pinfo
->filled
= MPATH_INFO_FRAME_QLEN
|
863 MPATH_INFO_DISCOVERY_TIMEOUT
|
864 MPATH_INFO_DISCOVERY_RETRIES
|
867 pinfo
->frame_qlen
= mpath
->frame_queue
.qlen
;
868 pinfo
->dsn
= mpath
->dsn
;
869 pinfo
->metric
= mpath
->metric
;
870 if (time_before(jiffies
, mpath
->exp_time
))
871 pinfo
->exptime
= jiffies_to_msecs(mpath
->exp_time
- jiffies
);
872 pinfo
->discovery_timeout
=
873 jiffies_to_msecs(mpath
->discovery_timeout
);
874 pinfo
->discovery_retries
= mpath
->discovery_retries
;
876 if (mpath
->flags
& MESH_PATH_ACTIVE
)
877 pinfo
->flags
|= NL80211_MPATH_FLAG_ACTIVE
;
878 if (mpath
->flags
& MESH_PATH_RESOLVING
)
879 pinfo
->flags
|= NL80211_MPATH_FLAG_RESOLVING
;
880 if (mpath
->flags
& MESH_PATH_DSN_VALID
)
881 pinfo
->flags
|= NL80211_MPATH_FLAG_DSN_VALID
;
882 if (mpath
->flags
& MESH_PATH_FIXED
)
883 pinfo
->flags
|= NL80211_MPATH_FLAG_FIXED
;
884 if (mpath
->flags
& MESH_PATH_RESOLVING
)
885 pinfo
->flags
|= NL80211_MPATH_FLAG_RESOLVING
;
887 pinfo
->flags
= mpath
->flags
;
890 static int ieee80211_get_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
891 u8
*dst
, u8
*next_hop
, struct mpath_info
*pinfo
)
894 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
895 struct mesh_path
*mpath
;
897 if (sdata
->vif
.type
!= IEEE80211_IF_TYPE_MESH_POINT
)
901 mpath
= mesh_path_lookup(dst
, dev
);
906 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
907 mpath_set_pinfo(mpath
, next_hop
, pinfo
);
912 static int ieee80211_dump_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
913 int idx
, u8
*dst
, u8
*next_hop
,
914 struct mpath_info
*pinfo
)
916 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
917 struct mesh_path
*mpath
;
919 if (sdata
->vif
.type
!= IEEE80211_IF_TYPE_MESH_POINT
)
923 mpath
= mesh_path_lookup_by_idx(idx
, dev
);
928 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
929 mpath_set_pinfo(mpath
, next_hop
, pinfo
);
935 struct cfg80211_ops mac80211_config_ops
= {
936 .add_virtual_intf
= ieee80211_add_iface
,
937 .del_virtual_intf
= ieee80211_del_iface
,
938 .change_virtual_intf
= ieee80211_change_iface
,
939 .add_key
= ieee80211_add_key
,
940 .del_key
= ieee80211_del_key
,
941 .get_key
= ieee80211_get_key
,
942 .set_default_key
= ieee80211_config_default_key
,
943 .add_beacon
= ieee80211_add_beacon
,
944 .set_beacon
= ieee80211_set_beacon
,
945 .del_beacon
= ieee80211_del_beacon
,
946 .add_station
= ieee80211_add_station
,
947 .del_station
= ieee80211_del_station
,
948 .change_station
= ieee80211_change_station
,
949 .get_station
= ieee80211_get_station
,
950 .dump_station
= ieee80211_dump_station
,
951 #ifdef CONFIG_MAC80211_MESH
952 .add_mpath
= ieee80211_add_mpath
,
953 .del_mpath
= ieee80211_del_mpath
,
954 .change_mpath
= ieee80211_change_mpath
,
955 .get_mpath
= ieee80211_get_mpath
,
956 .dump_mpath
= ieee80211_dump_mpath
,