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;
69 struct ieee80211_sub_if_data *sdata;
71 /* we're under RTNL */
72 dev = __dev_get_by_index(&init_net, ifindex);
76 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
78 ieee80211_if_remove(sdata);
83 static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
84 enum nl80211_iftype type, u32 *flags,
85 struct vif_params *params)
87 struct ieee80211_local *local = wiphy_priv(wiphy);
88 struct net_device *dev;
89 enum ieee80211_if_types itype;
90 struct ieee80211_sub_if_data *sdata;
93 /* we're under RTNL */
94 dev = __dev_get_by_index(&init_net, ifindex);
98 itype = nl80211_type_to_mac80211_type(type);
99 if (itype == IEEE80211_IF_TYPE_INVALID)
102 if (dev == local->mdev)
105 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
107 ret = ieee80211_if_change_type(sdata, itype);
111 if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len)
112 ieee80211_if_sta_set_mesh_id(&sdata->u.sta,
116 if (sdata->vif.type != IEEE80211_IF_TYPE_MNTR || !flags)
119 sdata->u.mntr_flags = *flags;
123 static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
124 u8 key_idx, u8 *mac_addr,
125 struct key_params *params)
127 struct ieee80211_local *local = wiphy_priv(wiphy);
128 struct ieee80211_sub_if_data *sdata;
129 struct sta_info *sta = NULL;
130 enum ieee80211_key_alg alg;
131 struct ieee80211_key *key;
134 if (dev == local->mdev)
137 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
139 switch (params->cipher) {
140 case WLAN_CIPHER_SUITE_WEP40:
141 case WLAN_CIPHER_SUITE_WEP104:
144 case WLAN_CIPHER_SUITE_TKIP:
147 case WLAN_CIPHER_SUITE_CCMP:
154 key = ieee80211_key_alloc(alg, key_idx, params->key_len, params->key);
161 sta = sta_info_get(sdata->local, mac_addr);
163 ieee80211_key_free(key);
169 ieee80211_key_link(key, sdata, sta);
178 static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
179 u8 key_idx, u8 *mac_addr)
181 struct ieee80211_local *local = wiphy_priv(wiphy);
182 struct ieee80211_sub_if_data *sdata;
183 struct sta_info *sta;
186 if (dev == local->mdev)
189 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
196 sta = sta_info_get(sdata->local, mac_addr);
201 ieee80211_key_free(sta->key);
209 if (!sdata->keys[key_idx]) {
214 ieee80211_key_free(sdata->keys[key_idx]);
215 WARN_ON(sdata->keys[key_idx]);
224 static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
225 u8 key_idx, u8 *mac_addr, void *cookie,
226 void (*callback)(void *cookie,
227 struct key_params *params))
229 struct ieee80211_local *local = wiphy_priv(wiphy);
230 struct ieee80211_sub_if_data *sdata;
231 struct sta_info *sta = NULL;
233 struct key_params params;
234 struct ieee80211_key *key;
239 if (dev == local->mdev)
242 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
247 sta = sta_info_get(sdata->local, mac_addr);
253 key = sdata->keys[key_idx];
258 memset(¶ms, 0, sizeof(params));
260 switch (key->conf.alg) {
262 params.cipher = WLAN_CIPHER_SUITE_TKIP;
264 iv32 = key->u.tkip.tx.iv32;
265 iv16 = key->u.tkip.tx.iv16;
267 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE &&
268 sdata->local->ops->get_tkip_seq)
269 sdata->local->ops->get_tkip_seq(
270 local_to_hw(sdata->local),
271 key->conf.hw_key_idx,
274 seq[0] = iv16 & 0xff;
275 seq[1] = (iv16 >> 8) & 0xff;
276 seq[2] = iv32 & 0xff;
277 seq[3] = (iv32 >> 8) & 0xff;
278 seq[4] = (iv32 >> 16) & 0xff;
279 seq[5] = (iv32 >> 24) & 0xff;
284 params.cipher = WLAN_CIPHER_SUITE_CCMP;
285 seq[0] = key->u.ccmp.tx_pn[5];
286 seq[1] = key->u.ccmp.tx_pn[4];
287 seq[2] = key->u.ccmp.tx_pn[3];
288 seq[3] = key->u.ccmp.tx_pn[2];
289 seq[4] = key->u.ccmp.tx_pn[1];
290 seq[5] = key->u.ccmp.tx_pn[0];
295 if (key->conf.keylen == 5)
296 params.cipher = WLAN_CIPHER_SUITE_WEP40;
298 params.cipher = WLAN_CIPHER_SUITE_WEP104;
302 params.key = key->conf.key;
303 params.key_len = key->conf.keylen;
305 callback(cookie, ¶ms);
313 static int ieee80211_config_default_key(struct wiphy *wiphy,
314 struct net_device *dev,
317 struct ieee80211_local *local = wiphy_priv(wiphy);
318 struct ieee80211_sub_if_data *sdata;
320 if (dev == local->mdev)
325 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
326 ieee80211_set_default_key(sdata, key_idx);
333 static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
335 struct ieee80211_sub_if_data *sdata = sta->sdata;
337 sinfo->filled = STATION_INFO_INACTIVE_TIME |
338 STATION_INFO_RX_BYTES |
339 STATION_INFO_TX_BYTES;
341 sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
342 sinfo->rx_bytes = sta->rx_bytes;
343 sinfo->tx_bytes = sta->tx_bytes;
345 if (ieee80211_vif_is_mesh(&sdata->vif)) {
346 #ifdef CONFIG_MAC80211_MESH
347 sinfo->filled |= STATION_INFO_LLID |
349 STATION_INFO_PLINK_STATE;
351 sinfo->llid = le16_to_cpu(sta->llid);
352 sinfo->plid = le16_to_cpu(sta->plid);
353 sinfo->plink_state = sta->plink_state;
359 static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
360 int idx, u8 *mac, struct station_info *sinfo)
362 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
363 struct sta_info *sta;
368 sta = sta_info_get_by_idx(local, idx, dev);
371 memcpy(mac, sta->addr, ETH_ALEN);
372 sta_set_sinfo(sta, sinfo);
380 static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
381 u8 *mac, struct station_info *sinfo)
383 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
384 struct sta_info *sta;
389 /* XXX: verify sta->dev == dev */
391 sta = sta_info_get(local, mac);
394 sta_set_sinfo(sta, sinfo);
403 * This handles both adding a beacon and setting new beacon info
405 static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
406 struct beacon_parameters *params)
408 struct beacon_data *new, *old;
409 int new_head_len, new_tail_len;
413 old = sdata->u.ap.beacon;
415 /* head must not be zero-length */
416 if (params->head && !params->head_len)
420 * This is a kludge. beacon interval should really be part
421 * of the beacon information.
423 if (params->interval) {
424 sdata->local->hw.conf.beacon_int = params->interval;
425 if (ieee80211_hw_config(sdata->local))
428 * We updated some parameter so if below bails out
434 /* Need to have a beacon head if we don't have one yet */
435 if (!params->head && !old)
438 /* sorry, no way to start beaconing without dtim period */
439 if (!params->dtim_period && !old)
442 /* new or old head? */
444 new_head_len = params->head_len;
446 new_head_len = old->head_len;
448 /* new or old tail? */
449 if (params->tail || !old)
450 /* params->tail_len will be zero for !params->tail */
451 new_tail_len = params->tail_len;
453 new_tail_len = old->tail_len;
455 size = sizeof(*new) + new_head_len + new_tail_len;
457 new = kzalloc(size, GFP_KERNEL);
461 /* start filling the new info now */
463 /* new or old dtim period? */
464 if (params->dtim_period)
465 new->dtim_period = params->dtim_period;
467 new->dtim_period = old->dtim_period;
470 * pointers go into the block we allocated,
471 * memory is | beacon_data | head | tail |
473 new->head = ((u8 *) new) + sizeof(*new);
474 new->tail = new->head + new_head_len;
475 new->head_len = new_head_len;
476 new->tail_len = new_tail_len;
480 memcpy(new->head, params->head, new_head_len);
482 memcpy(new->head, old->head, new_head_len);
484 /* copy in optional tail */
486 memcpy(new->tail, params->tail, new_tail_len);
489 memcpy(new->tail, old->tail, new_tail_len);
491 rcu_assign_pointer(sdata->u.ap.beacon, new);
497 return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON);
500 static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
501 struct beacon_parameters *params)
503 struct ieee80211_local *local = wiphy_priv(wiphy);
504 struct ieee80211_sub_if_data *sdata;
505 struct beacon_data *old;
507 if (dev == local->mdev)
510 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
512 if (sdata->vif.type != IEEE80211_IF_TYPE_AP)
515 old = sdata->u.ap.beacon;
520 return ieee80211_config_beacon(sdata, params);
523 static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
524 struct beacon_parameters *params)
526 struct ieee80211_local *local = wiphy_priv(wiphy);
527 struct ieee80211_sub_if_data *sdata;
528 struct beacon_data *old;
530 if (dev == local->mdev)
533 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
535 if (sdata->vif.type != IEEE80211_IF_TYPE_AP)
538 old = sdata->u.ap.beacon;
543 return ieee80211_config_beacon(sdata, params);
546 static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
548 struct ieee80211_local *local = wiphy_priv(wiphy);
549 struct ieee80211_sub_if_data *sdata;
550 struct beacon_data *old;
552 if (dev == local->mdev)
555 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
557 if (sdata->vif.type != IEEE80211_IF_TYPE_AP)
560 old = sdata->u.ap.beacon;
565 rcu_assign_pointer(sdata->u.ap.beacon, NULL);
569 return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON);
572 /* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
573 struct iapp_layer2_update {
574 u8 da[ETH_ALEN]; /* broadcast */
575 u8 sa[ETH_ALEN]; /* STA addr */
581 } __attribute__ ((packed));
583 static void ieee80211_send_layer2_update(struct sta_info *sta)
585 struct iapp_layer2_update *msg;
588 /* Send Level 2 Update Frame to update forwarding tables in layer 2
591 skb = dev_alloc_skb(sizeof(*msg));
594 msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg));
596 /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID)
597 * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */
599 memset(msg->da, 0xff, ETH_ALEN);
600 memcpy(msg->sa, sta->addr, ETH_ALEN);
603 msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */
604 msg->control = 0xaf; /* XID response lsb.1111F101.
605 * F=0 (no poll command; unsolicited frame) */
606 msg->xid_info[0] = 0x81; /* XID format identifier */
607 msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */
608 msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */
610 skb->dev = sta->sdata->dev;
611 skb->protocol = eth_type_trans(skb, sta->sdata->dev);
612 memset(skb->cb, 0, sizeof(skb->cb));
616 static void sta_apply_parameters(struct ieee80211_local *local,
617 struct sta_info *sta,
618 struct station_parameters *params)
622 struct ieee80211_supported_band *sband;
623 struct ieee80211_sub_if_data *sdata = sta->sdata;
626 * FIXME: updating the flags is racy when this function is
627 * called from ieee80211_change_station(), this will
628 * be resolved in a future patch.
631 if (params->station_flags & STATION_FLAG_CHANGED) {
632 spin_lock_bh(&sta->lock);
633 sta->flags &= ~WLAN_STA_AUTHORIZED;
634 if (params->station_flags & STATION_FLAG_AUTHORIZED)
635 sta->flags |= WLAN_STA_AUTHORIZED;
637 sta->flags &= ~WLAN_STA_SHORT_PREAMBLE;
638 if (params->station_flags & STATION_FLAG_SHORT_PREAMBLE)
639 sta->flags |= WLAN_STA_SHORT_PREAMBLE;
641 sta->flags &= ~WLAN_STA_WME;
642 if (params->station_flags & STATION_FLAG_WME)
643 sta->flags |= WLAN_STA_WME;
644 spin_unlock_bh(&sta->lock);
648 * FIXME: updating the following information is racy when this
649 * function is called from ieee80211_change_station().
650 * However, all this information should be static so
651 * maybe we should just reject attemps to change it.
655 sta->aid = params->aid;
656 if (sta->aid > IEEE80211_MAX_AID)
657 sta->aid = 0; /* XXX: should this be an error? */
660 if (params->listen_interval >= 0)
661 sta->listen_interval = params->listen_interval;
663 if (params->supported_rates) {
665 sband = local->hw.wiphy->bands[local->oper_channel->band];
667 for (i = 0; i < params->supported_rates_len; i++) {
668 int rate = (params->supported_rates[i] & 0x7f) * 5;
669 for (j = 0; j < sband->n_bitrates; j++) {
670 if (sband->bitrates[j].bitrate == rate)
674 sta->supp_rates[local->oper_channel->band] = rates;
677 if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) {
678 switch (params->plink_action) {
679 case PLINK_ACTION_OPEN:
680 mesh_plink_open(sta);
682 case PLINK_ACTION_BLOCK:
683 mesh_plink_block(sta);
689 static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
690 u8 *mac, struct station_parameters *params)
692 struct ieee80211_local *local = wiphy_priv(wiphy);
693 struct sta_info *sta;
694 struct ieee80211_sub_if_data *sdata;
697 if (dev == local->mdev || params->vlan == local->mdev)
700 /* Prevent a race with changing the rate control algorithm */
701 if (!netif_running(dev))
705 sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
707 if (sdata->vif.type != IEEE80211_IF_TYPE_VLAN &&
708 sdata->vif.type != IEEE80211_IF_TYPE_AP)
711 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
713 if (compare_ether_addr(mac, dev->dev_addr) == 0)
716 if (is_multicast_ether_addr(mac))
719 sta = sta_info_alloc(sdata, mac, GFP_KERNEL);
723 sta->flags = WLAN_STA_AUTH | WLAN_STA_ASSOC;
725 sta_apply_parameters(local, sta, params);
727 rate_control_rate_init(sta, local);
731 err = sta_info_insert(sta);
733 /* STA has been freed */
738 if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN ||
739 sdata->vif.type == IEEE80211_IF_TYPE_AP)
740 ieee80211_send_layer2_update(sta);
747 static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
750 struct ieee80211_local *local = wiphy_priv(wiphy);
751 struct ieee80211_sub_if_data *sdata;
752 struct sta_info *sta;
754 if (dev == local->mdev)
757 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
762 /* XXX: get sta belonging to dev */
763 sta = sta_info_get(local, mac);
769 sta_info_unlink(&sta);
772 sta_info_destroy(sta);
774 sta_info_flush(local, sdata);
779 static int ieee80211_change_station(struct wiphy *wiphy,
780 struct net_device *dev,
782 struct station_parameters *params)
784 struct ieee80211_local *local = wiphy_priv(wiphy);
785 struct sta_info *sta;
786 struct ieee80211_sub_if_data *vlansdata;
788 if (dev == local->mdev || params->vlan == local->mdev)
793 /* XXX: get sta belonging to dev */
794 sta = sta_info_get(local, mac);
800 if (params->vlan && params->vlan != sta->sdata->dev) {
801 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
803 if (vlansdata->vif.type != IEEE80211_IF_TYPE_VLAN &&
804 vlansdata->vif.type != IEEE80211_IF_TYPE_AP) {
809 sta->sdata = vlansdata;
810 ieee80211_send_layer2_update(sta);
813 sta_apply_parameters(local, sta, params);
820 #ifdef CONFIG_MAC80211_MESH
821 static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
822 u8 *dst, u8 *next_hop)
824 struct ieee80211_local *local = wiphy_priv(wiphy);
825 struct ieee80211_sub_if_data *sdata;
826 struct mesh_path *mpath;
827 struct sta_info *sta;
830 if (dev == local->mdev)
833 if (!netif_running(dev))
836 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
838 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
842 sta = sta_info_get(local, next_hop);
848 err = mesh_path_add(dst, sdata);
854 mpath = mesh_path_lookup(dst, sdata);
859 mesh_path_fix_nexthop(mpath, sta);
865 static int ieee80211_del_mpath(struct wiphy *wiphy, struct net_device *dev,
868 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
871 return mesh_path_del(dst, sdata);
873 mesh_path_flush(sdata);
877 static int ieee80211_change_mpath(struct wiphy *wiphy,
878 struct net_device *dev,
879 u8 *dst, u8 *next_hop)
881 struct ieee80211_local *local = wiphy_priv(wiphy);
882 struct ieee80211_sub_if_data *sdata;
883 struct mesh_path *mpath;
884 struct sta_info *sta;
886 if (dev == local->mdev)
889 if (!netif_running(dev))
892 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
894 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
899 sta = sta_info_get(local, next_hop);
905 mpath = mesh_path_lookup(dst, sdata);
911 mesh_path_fix_nexthop(mpath, sta);
917 static void mpath_set_pinfo(struct mesh_path *mpath, u8 *next_hop,
918 struct mpath_info *pinfo)
921 memcpy(next_hop, mpath->next_hop->addr, ETH_ALEN);
923 memset(next_hop, 0, ETH_ALEN);
925 pinfo->filled = MPATH_INFO_FRAME_QLEN |
929 MPATH_INFO_DISCOVERY_TIMEOUT |
930 MPATH_INFO_DISCOVERY_RETRIES |
933 pinfo->frame_qlen = mpath->frame_queue.qlen;
934 pinfo->dsn = mpath->dsn;
935 pinfo->metric = mpath->metric;
936 if (time_before(jiffies, mpath->exp_time))
937 pinfo->exptime = jiffies_to_msecs(mpath->exp_time - jiffies);
938 pinfo->discovery_timeout =
939 jiffies_to_msecs(mpath->discovery_timeout);
940 pinfo->discovery_retries = mpath->discovery_retries;
942 if (mpath->flags & MESH_PATH_ACTIVE)
943 pinfo->flags |= NL80211_MPATH_FLAG_ACTIVE;
944 if (mpath->flags & MESH_PATH_RESOLVING)
945 pinfo->flags |= NL80211_MPATH_FLAG_RESOLVING;
946 if (mpath->flags & MESH_PATH_DSN_VALID)
947 pinfo->flags |= NL80211_MPATH_FLAG_DSN_VALID;
948 if (mpath->flags & MESH_PATH_FIXED)
949 pinfo->flags |= NL80211_MPATH_FLAG_FIXED;
950 if (mpath->flags & MESH_PATH_RESOLVING)
951 pinfo->flags |= NL80211_MPATH_FLAG_RESOLVING;
953 pinfo->flags = mpath->flags;
956 static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev,
957 u8 *dst, u8 *next_hop, struct mpath_info *pinfo)
960 struct ieee80211_local *local = wiphy_priv(wiphy);
961 struct ieee80211_sub_if_data *sdata;
962 struct mesh_path *mpath;
964 if (dev == local->mdev)
967 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
969 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
973 mpath = mesh_path_lookup(dst, sdata);
978 memcpy(dst, mpath->dst, ETH_ALEN);
979 mpath_set_pinfo(mpath, next_hop, pinfo);
984 static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
985 int idx, u8 *dst, u8 *next_hop,
986 struct mpath_info *pinfo)
988 struct ieee80211_local *local = wiphy_priv(wiphy);
989 struct ieee80211_sub_if_data *sdata;
990 struct mesh_path *mpath;
992 if (dev == local->mdev)
995 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
997 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
1001 mpath = mesh_path_lookup_by_idx(idx, sdata);
1006 memcpy(dst, mpath->dst, ETH_ALEN);
1007 mpath_set_pinfo(mpath, next_hop, pinfo);
1013 struct cfg80211_ops mac80211_config_ops = {
1014 .add_virtual_intf = ieee80211_add_iface,
1015 .del_virtual_intf = ieee80211_del_iface,
1016 .change_virtual_intf = ieee80211_change_iface,
1017 .add_key = ieee80211_add_key,
1018 .del_key = ieee80211_del_key,
1019 .get_key = ieee80211_get_key,
1020 .set_default_key = ieee80211_config_default_key,
1021 .add_beacon = ieee80211_add_beacon,
1022 .set_beacon = ieee80211_set_beacon,
1023 .del_beacon = ieee80211_del_beacon,
1024 .add_station = ieee80211_add_station,
1025 .del_station = ieee80211_del_station,
1026 .change_station = ieee80211_change_station,
1027 .get_station = ieee80211_get_station,
1028 .dump_station = ieee80211_dump_station,
1029 #ifdef CONFIG_MAC80211_MESH
1030 .add_mpath = ieee80211_add_mpath,
1031 .del_mpath = ieee80211_del_mpath,
1032 .change_mpath = ieee80211_change_mpath,
1033 .get_mpath = ieee80211_get_mpath,
1034 .dump_mpath = ieee80211_dump_mpath,