Lines Matching +full:rx +full:- +full:level +full:- +full:trig
1 // SPDX-License-Identifier: GPL-2.0-only
3 * This is the new netlink-based wireless configuration interface.
5 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
6 * Copyright 2013-2014 Intel Mobile Communications GmbH
7 * Copyright 2015-2017 Intel Deutschland GmbH
8 * Copyright (C) 2018-2023 Intel Corporation
32 #include "rdev-ops.h"
50 NL80211_MCGRP_TESTMODE /* keep last - ifdef! */
74 int wiphy_idx = -1; in __cfg80211_wdev_from_attrs()
75 int ifidx = -1; in __cfg80211_wdev_from_attrs()
78 return ERR_PTR(-EINVAL); in __cfg80211_wdev_from_attrs()
90 lockdep_assert_held(&rdev->wiphy.mtx); in __cfg80211_wdev_from_attrs()
92 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { in __cfg80211_wdev_from_attrs()
93 if (have_ifidx && wdev->netdev && in __cfg80211_wdev_from_attrs()
94 wdev->netdev->ifindex == ifidx) { in __cfg80211_wdev_from_attrs()
98 if (have_wdev_id && wdev->identifier == (u32)wdev_id) { in __cfg80211_wdev_from_attrs()
104 return result ?: ERR_PTR(-ENODEV); in __cfg80211_wdev_from_attrs()
112 if (wiphy_net(&rdev->wiphy) != netns) in __cfg80211_wdev_from_attrs()
115 if (have_wdev_id && rdev->wiphy_idx != wiphy_idx) in __cfg80211_wdev_from_attrs()
118 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { in __cfg80211_wdev_from_attrs()
119 if (have_ifidx && wdev->netdev && in __cfg80211_wdev_from_attrs()
120 wdev->netdev->ifindex == ifidx) { in __cfg80211_wdev_from_attrs()
124 if (have_wdev_id && wdev->identifier == (u32)wdev_id) { in __cfg80211_wdev_from_attrs()
136 return ERR_PTR(-ENODEV); in __cfg80211_wdev_from_attrs()
150 return ERR_PTR(-EINVAL); in __cfg80211_rdev_from_attrs()
164 list_for_each_entry(wdev, &tmp->wiphy.wdev_list, list) { in __cfg80211_rdev_from_attrs()
165 if (wdev->identifier != (u32)wdev_id) in __cfg80211_rdev_from_attrs()
175 return ERR_PTR(-EINVAL); in __cfg80211_rdev_from_attrs()
185 if (netdev->ieee80211_ptr) in __cfg80211_rdev_from_attrs()
187 netdev->ieee80211_ptr->wiphy); in __cfg80211_rdev_from_attrs()
191 /* not wireless device -- return error */ in __cfg80211_rdev_from_attrs()
193 return ERR_PTR(-EINVAL); in __cfg80211_rdev_from_attrs()
195 /* mismatch -- return error */ in __cfg80211_rdev_from_attrs()
197 return ERR_PTR(-EINVAL); in __cfg80211_rdev_from_attrs()
204 return ERR_PTR(-ENODEV); in __cfg80211_rdev_from_attrs()
206 if (netns != wiphy_net(&rdev->wiphy)) in __cfg80211_rdev_from_attrs()
207 return ERR_PTR(-ENODEV); in __cfg80211_rdev_from_attrs()
222 return __cfg80211_rdev_from_attrs(netns, info->attrs); in cfg80211_get_dev_from_info()
238 s1g_bcn = ieee80211_is_s1g_beacon(mgmt->frame_control); in validate_beacon_head()
252 if (ieee80211_hdrlen(mgmt->frame_control) != hdrlen) in validate_beacon_head()
256 len -= fixedlen; in validate_beacon_head()
267 return -EINVAL; in validate_beacon_head()
285 return -EINVAL; in validate_ie_attr()
292 return -EINVAL; in validate_he_capa()
475 .len = 20-1 },
501 [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 },
531 NLA_POLICY_MAX(NLA_U8, NUM_NL80211_PLINK_ACTIONS - 1),
543 /* allow 3 for NUL-termination, we used to declare this NLA_STRING */
610 NLA_POLICY_MAX(NLA_U8, NUM_NL80211_PLINK_STATES - 1),
706 [NL80211_ATTR_TSID] = NLA_POLICY_MAX(NLA_U8, IEEE80211_NUM_TIDS - 1),
708 NLA_POLICY_MAX(NLA_U8, IEEE80211_NUM_UPS - 1),
720 NLA_POLICY_MAX(NLA_U8, NUM_NL80211_P2P_PS_STATUS - 1),
767 [NL80211_ATTR_VLAN_ID] = NLA_POLICY_RANGE(NLA_U16, 1, VLAN_N_VID - 2),
831 [NL80211_KEY_TYPE] = NLA_POLICY_MAX(NLA_U32, NUM_NL80211_KEYTYPES - 1),
988 if (!cb->args[0]) { in nl80211_prepare_wdev_dump()
995 return -ENOMEM; in nl80211_prepare_wdev_dump()
999 err = nlmsg_parse_deprecated(cb->nlh, in nl80211_prepare_wdev_dump()
1009 *wdev = __cfg80211_wdev_from_attrs(NULL, sock_net(cb->skb->sk), in nl80211_prepare_wdev_dump()
1016 *rdev = wiphy_to_rdev((*wdev)->wiphy); in nl80211_prepare_wdev_dump()
1017 mutex_lock(&(*rdev)->wiphy.mtx); in nl80211_prepare_wdev_dump()
1019 /* 0 is the first index - add 1 to parse only once */ in nl80211_prepare_wdev_dump()
1020 cb->args[0] = (*rdev)->wiphy_idx + 1; in nl80211_prepare_wdev_dump()
1021 cb->args[1] = (*wdev)->identifier; in nl80211_prepare_wdev_dump()
1028 wiphy = wiphy_idx_to_wiphy(cb->args[0] - 1); in nl80211_prepare_wdev_dump()
1031 return -ENODEV; in nl80211_prepare_wdev_dump()
1036 list_for_each_entry(tmp, &(*rdev)->wiphy.wdev_list, list) { in nl80211_prepare_wdev_dump()
1037 if (tmp->identifier == cb->args[1]) { in nl80211_prepare_wdev_dump()
1045 return -ENODEV; in nl80211_prepare_wdev_dump()
1047 mutex_lock(&(*rdev)->wiphy.mtx); in nl80211_prepare_wdev_dump()
1079 rule->wmm_rule.client[j].cw_min) || in nl80211_msg_put_wmm_rules()
1081 rule->wmm_rule.client[j].cw_max) || in nl80211_msg_put_wmm_rules()
1083 rule->wmm_rule.client[j].aifsn) || in nl80211_msg_put_wmm_rules()
1085 rule->wmm_rule.client[j].cot)) in nl80211_msg_put_wmm_rules()
1095 return -ENOBUFS; in nl80211_msg_put_wmm_rules()
1103 * list to protect old user-space tools from breaking in nl80211_msg_put_channel()
1105 if (!large && chan->flags & in nl80211_msg_put_channel()
1108 if (!large && chan->freq_offset) in nl80211_msg_put_channel()
1112 chan->center_freq)) in nl80211_msg_put_channel()
1115 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_OFFSET, chan->freq_offset)) in nl80211_msg_put_channel()
1118 if ((chan->flags & IEEE80211_CHAN_DISABLED) && in nl80211_msg_put_channel()
1121 if (chan->flags & IEEE80211_CHAN_NO_IR) { in nl80211_msg_put_channel()
1127 if (chan->flags & IEEE80211_CHAN_RADAR) { in nl80211_msg_put_channel()
1133 time = elapsed_jiffies_msecs(chan->dfs_state_entered); in nl80211_msg_put_channel()
1136 chan->dfs_state)) in nl80211_msg_put_channel()
1143 chan->dfs_cac_ms)) in nl80211_msg_put_channel()
1149 if ((chan->flags & IEEE80211_CHAN_NO_HT40MINUS) && in nl80211_msg_put_channel()
1152 if ((chan->flags & IEEE80211_CHAN_NO_HT40PLUS) && in nl80211_msg_put_channel()
1155 if ((chan->flags & IEEE80211_CHAN_NO_80MHZ) && in nl80211_msg_put_channel()
1158 if ((chan->flags & IEEE80211_CHAN_NO_160MHZ) && in nl80211_msg_put_channel()
1161 if ((chan->flags & IEEE80211_CHAN_INDOOR_ONLY) && in nl80211_msg_put_channel()
1164 if ((chan->flags & IEEE80211_CHAN_IR_CONCURRENT) && in nl80211_msg_put_channel()
1167 if ((chan->flags & IEEE80211_CHAN_NO_20MHZ) && in nl80211_msg_put_channel()
1170 if ((chan->flags & IEEE80211_CHAN_NO_10MHZ) && in nl80211_msg_put_channel()
1173 if ((chan->flags & IEEE80211_CHAN_NO_HE) && in nl80211_msg_put_channel()
1176 if ((chan->flags & IEEE80211_CHAN_1MHZ) && in nl80211_msg_put_channel()
1179 if ((chan->flags & IEEE80211_CHAN_2MHZ) && in nl80211_msg_put_channel()
1182 if ((chan->flags & IEEE80211_CHAN_4MHZ) && in nl80211_msg_put_channel()
1185 if ((chan->flags & IEEE80211_CHAN_8MHZ) && in nl80211_msg_put_channel()
1188 if ((chan->flags & IEEE80211_CHAN_16MHZ) && in nl80211_msg_put_channel()
1191 if ((chan->flags & IEEE80211_CHAN_NO_320MHZ) && in nl80211_msg_put_channel()
1194 if ((chan->flags & IEEE80211_CHAN_NO_EHT) && in nl80211_msg_put_channel()
1200 DBM_TO_MBM(chan->max_power))) in nl80211_msg_put_channel()
1205 freq_reg_info(wiphy, MHZ_TO_KHZ(chan->center_freq)); in nl80211_msg_put_channel()
1207 if (!IS_ERR_OR_NULL(rule) && rule->has_wmm) { in nl80211_msg_put_channel()
1216 return -ENOBUFS; in nl80211_msg_put_channel()
1226 if (txqstats->filled & BIT(NL80211_TXQ_STATS_ ## attr) && \ in nl80211_put_txq_stats()
1227 nla_put_u32(msg, NL80211_TXQ_STATS_ ## attr, txqstats->memb)) \ in nl80211_put_txq_stats()
1255 * nl80211_link_id - return link ID
1280 return -1; in nl80211_link_id_or_invalid()
1299 info->extack); in nl80211_parse_key_new()
1303 k->def = !!tb[NL80211_KEY_DEFAULT]; in nl80211_parse_key_new()
1304 k->defmgmt = !!tb[NL80211_KEY_DEFAULT_MGMT]; in nl80211_parse_key_new()
1305 k->defbeacon = !!tb[NL80211_KEY_DEFAULT_BEACON]; in nl80211_parse_key_new()
1307 if (k->def) { in nl80211_parse_key_new()
1308 k->def_uni = true; in nl80211_parse_key_new()
1309 k->def_multi = true; in nl80211_parse_key_new()
1311 if (k->defmgmt || k->defbeacon) in nl80211_parse_key_new()
1312 k->def_multi = true; in nl80211_parse_key_new()
1315 k->idx = nla_get_u8(tb[NL80211_KEY_IDX]); in nl80211_parse_key_new()
1318 k->p.key = nla_data(tb[NL80211_KEY_DATA]); in nl80211_parse_key_new()
1319 k->p.key_len = nla_len(tb[NL80211_KEY_DATA]); in nl80211_parse_key_new()
1323 k->p.seq = nla_data(tb[NL80211_KEY_SEQ]); in nl80211_parse_key_new()
1324 k->p.seq_len = nla_len(tb[NL80211_KEY_SEQ]); in nl80211_parse_key_new()
1328 k->p.cipher = nla_get_u32(tb[NL80211_KEY_CIPHER]); in nl80211_parse_key_new()
1331 k->type = nla_get_u32(tb[NL80211_KEY_TYPE]); in nl80211_parse_key_new()
1337 NUM_NL80211_KEY_DEFAULT_TYPES - 1, in nl80211_parse_key_new()
1340 info->extack); in nl80211_parse_key_new()
1344 k->def_uni = kdt[NL80211_KEY_DEFAULT_TYPE_UNICAST]; in nl80211_parse_key_new()
1345 k->def_multi = kdt[NL80211_KEY_DEFAULT_TYPE_MULTICAST]; in nl80211_parse_key_new()
1349 k->p.mode = nla_get_u8(tb[NL80211_KEY_MODE]); in nl80211_parse_key_new()
1356 if (info->attrs[NL80211_ATTR_KEY_DATA]) { in nl80211_parse_key_old()
1357 k->p.key = nla_data(info->attrs[NL80211_ATTR_KEY_DATA]); in nl80211_parse_key_old()
1358 k->p.key_len = nla_len(info->attrs[NL80211_ATTR_KEY_DATA]); in nl80211_parse_key_old()
1361 if (info->attrs[NL80211_ATTR_KEY_SEQ]) { in nl80211_parse_key_old()
1362 k->p.seq = nla_data(info->attrs[NL80211_ATTR_KEY_SEQ]); in nl80211_parse_key_old()
1363 k->p.seq_len = nla_len(info->attrs[NL80211_ATTR_KEY_SEQ]); in nl80211_parse_key_old()
1366 if (info->attrs[NL80211_ATTR_KEY_IDX]) in nl80211_parse_key_old()
1367 k->idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]); in nl80211_parse_key_old()
1369 if (info->attrs[NL80211_ATTR_KEY_CIPHER]) in nl80211_parse_key_old()
1370 k->p.cipher = nla_get_u32(info->attrs[NL80211_ATTR_KEY_CIPHER]); in nl80211_parse_key_old()
1372 k->def = !!info->attrs[NL80211_ATTR_KEY_DEFAULT]; in nl80211_parse_key_old()
1373 k->defmgmt = !!info->attrs[NL80211_ATTR_KEY_DEFAULT_MGMT]; in nl80211_parse_key_old()
1375 if (k->def) { in nl80211_parse_key_old()
1376 k->def_uni = true; in nl80211_parse_key_old()
1377 k->def_multi = true; in nl80211_parse_key_old()
1379 if (k->defmgmt) in nl80211_parse_key_old()
1380 k->def_multi = true; in nl80211_parse_key_old()
1382 if (info->attrs[NL80211_ATTR_KEY_TYPE]) in nl80211_parse_key_old()
1383 k->type = nla_get_u32(info->attrs[NL80211_ATTR_KEY_TYPE]); in nl80211_parse_key_old()
1385 if (info->attrs[NL80211_ATTR_KEY_DEFAULT_TYPES]) { in nl80211_parse_key_old()
1388 NUM_NL80211_KEY_DEFAULT_TYPES - 1, in nl80211_parse_key_old()
1389 info->attrs[NL80211_ATTR_KEY_DEFAULT_TYPES], in nl80211_parse_key_old()
1391 info->extack); in nl80211_parse_key_old()
1395 k->def_uni = kdt[NL80211_KEY_DEFAULT_TYPE_UNICAST]; in nl80211_parse_key_old()
1396 k->def_multi = kdt[NL80211_KEY_DEFAULT_TYPE_MULTICAST]; in nl80211_parse_key_old()
1407 k->idx = -1; in nl80211_parse_key()
1408 k->type = -1; in nl80211_parse_key()
1410 if (info->attrs[NL80211_ATTR_KEY]) in nl80211_parse_key()
1411 err = nl80211_parse_key_new(info, info->attrs[NL80211_ATTR_KEY], k); in nl80211_parse_key()
1418 if ((k->def ? 1 : 0) + (k->defmgmt ? 1 : 0) + in nl80211_parse_key()
1419 (k->defbeacon ? 1 : 0) > 1) { in nl80211_parse_key()
1422 return -EINVAL; in nl80211_parse_key()
1425 if (k->defmgmt || k->defbeacon) { in nl80211_parse_key()
1426 if (k->def_uni || !k->def_multi) { in nl80211_parse_key()
1429 return -EINVAL; in nl80211_parse_key()
1433 if (k->idx != -1) { in nl80211_parse_key()
1434 if (k->defmgmt) { in nl80211_parse_key()
1435 if (k->idx < 4 || k->idx > 5) { in nl80211_parse_key()
1438 return -EINVAL; in nl80211_parse_key()
1440 } else if (k->defbeacon) { in nl80211_parse_key()
1441 if (k->idx < 6 || k->idx > 7) { in nl80211_parse_key()
1444 return -EINVAL; in nl80211_parse_key()
1446 } else if (k->def) { in nl80211_parse_key()
1447 if (k->idx < 0 || k->idx > 3) { in nl80211_parse_key()
1448 GENL_SET_ERR_MSG(info, "def key idx not 0-3"); in nl80211_parse_key()
1449 return -EINVAL; in nl80211_parse_key()
1452 if (k->idx < 0 || k->idx > 7) { in nl80211_parse_key()
1453 GENL_SET_ERR_MSG(info, "key idx not 0-7"); in nl80211_parse_key()
1454 return -EINVAL; in nl80211_parse_key()
1466 struct nlattr *keys = info->attrs[NL80211_ATTR_KEYS]; in nl80211_parse_connkeys()
1483 return ERR_PTR(-ENOMEM); in nl80211_parse_connkeys()
1485 result->def = -1; in nl80211_parse_connkeys()
1489 parse.idx = -1; in nl80211_parse_connkeys()
1494 err = -EINVAL; in nl80211_parse_connkeys()
1498 GENL_SET_ERR_MSG(info, "key index out of range [0-3]"); in nl80211_parse_connkeys()
1508 result->def = parse.idx; in nl80211_parse_connkeys()
1520 err = -EINVAL; in nl80211_parse_connkeys()
1523 result->params[parse.idx].cipher = parse.p.cipher; in nl80211_parse_connkeys()
1524 result->params[parse.idx].key_len = parse.p.key_len; in nl80211_parse_connkeys()
1525 result->params[parse.idx].key = result->data[parse.idx]; in nl80211_parse_connkeys()
1526 memcpy(result->data[parse.idx], parse.p.key, parse.p.key_len); in nl80211_parse_connkeys()
1533 if (result->def < 0) { in nl80211_parse_connkeys()
1534 err = -EINVAL; in nl80211_parse_connkeys()
1549 switch (wdev->iftype) { in nl80211_key_allowed()
1556 if (wdev->u.ibss.current_bss) in nl80211_key_allowed()
1558 return -ENOLINK; in nl80211_key_allowed()
1561 if (wdev->connected) in nl80211_key_allowed()
1563 return -ENOLINK; in nl80211_key_allowed()
1565 if (wiphy_ext_feature_isset(wdev->wiphy, in nl80211_key_allowed()
1568 return -EINVAL; in nl80211_key_allowed()
1575 return -EINVAL; in nl80211_key_allowed()
1587 if (!chan || chan->flags & IEEE80211_CHAN_DISABLED) in nl80211_get_valid_chan()
1612 return -ENOBUFS; in nl80211_put_iftypes()
1627 for (i = 0; i < wiphy->n_iface_combinations; i++) { in nl80211_put_iface_combinations()
1631 c = &wiphy->iface_combinations[i]; in nl80211_put_iface_combinations()
1642 for (j = 0; j < c->n_limits; j++) { in nl80211_put_iface_combinations()
1649 c->limits[j].max)) in nl80211_put_iface_combinations()
1652 c->limits[j].types)) in nl80211_put_iface_combinations()
1659 if (c->beacon_int_infra_match && in nl80211_put_iface_combinations()
1663 c->num_different_channels) || in nl80211_put_iface_combinations()
1665 c->max_interfaces)) in nl80211_put_iface_combinations()
1669 c->radar_detect_widths) || in nl80211_put_iface_combinations()
1671 c->radar_detect_regions))) in nl80211_put_iface_combinations()
1673 if (c->beacon_int_min_gcd && in nl80211_put_iface_combinations()
1675 c->beacon_int_min_gcd)) in nl80211_put_iface_combinations()
1685 return -ENOBUFS; in nl80211_put_iface_combinations()
1692 const struct wiphy_wowlan_tcp_support *tcp = rdev->wiphy.wowlan->tcp; in nl80211_send_wowlan_tcp_caps()
1701 return -ENOBUFS; in nl80211_send_wowlan_tcp_caps()
1704 tcp->data_payload_max)) in nl80211_send_wowlan_tcp_caps()
1705 return -ENOBUFS; in nl80211_send_wowlan_tcp_caps()
1708 tcp->data_payload_max)) in nl80211_send_wowlan_tcp_caps()
1709 return -ENOBUFS; in nl80211_send_wowlan_tcp_caps()
1711 if (tcp->seq && nla_put_flag(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ)) in nl80211_send_wowlan_tcp_caps()
1712 return -ENOBUFS; in nl80211_send_wowlan_tcp_caps()
1714 if (tcp->tok && nla_put(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN, in nl80211_send_wowlan_tcp_caps()
1715 sizeof(*tcp->tok), tcp->tok)) in nl80211_send_wowlan_tcp_caps()
1716 return -ENOBUFS; in nl80211_send_wowlan_tcp_caps()
1719 tcp->data_interval_max)) in nl80211_send_wowlan_tcp_caps()
1720 return -ENOBUFS; in nl80211_send_wowlan_tcp_caps()
1723 tcp->wake_payload_max)) in nl80211_send_wowlan_tcp_caps()
1724 return -ENOBUFS; in nl80211_send_wowlan_tcp_caps()
1736 if (!rdev->wiphy.wowlan) in nl80211_send_wowlan()
1742 return -ENOBUFS; in nl80211_send_wowlan()
1744 if (((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_ANY) && in nl80211_send_wowlan()
1746 ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_DISCONNECT) && in nl80211_send_wowlan()
1748 ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_MAGIC_PKT) && in nl80211_send_wowlan()
1750 ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY) && in nl80211_send_wowlan()
1752 ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) && in nl80211_send_wowlan()
1754 ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_EAP_IDENTITY_REQ) && in nl80211_send_wowlan()
1756 ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_4WAY_HANDSHAKE) && in nl80211_send_wowlan()
1758 ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_RFKILL_RELEASE) && in nl80211_send_wowlan()
1760 return -ENOBUFS; in nl80211_send_wowlan()
1762 if (rdev->wiphy.wowlan->n_patterns) { in nl80211_send_wowlan()
1764 .max_patterns = rdev->wiphy.wowlan->n_patterns, in nl80211_send_wowlan()
1765 .min_pattern_len = rdev->wiphy.wowlan->pattern_min_len, in nl80211_send_wowlan()
1766 .max_pattern_len = rdev->wiphy.wowlan->pattern_max_len, in nl80211_send_wowlan()
1767 .max_pkt_offset = rdev->wiphy.wowlan->max_pkt_offset, in nl80211_send_wowlan()
1772 return -ENOBUFS; in nl80211_send_wowlan()
1775 if ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_NET_DETECT) && in nl80211_send_wowlan()
1777 rdev->wiphy.wowlan->max_nd_match_sets)) in nl80211_send_wowlan()
1778 return -ENOBUFS; in nl80211_send_wowlan()
1781 return -ENOBUFS; in nl80211_send_wowlan()
1794 if (!rdev->wiphy.coalesce) in nl80211_send_coalesce()
1797 rule.max_rules = rdev->wiphy.coalesce->n_rules; in nl80211_send_coalesce()
1798 rule.max_delay = rdev->wiphy.coalesce->max_delay; in nl80211_send_coalesce()
1799 rule.pat.max_patterns = rdev->wiphy.coalesce->n_patterns; in nl80211_send_coalesce()
1800 rule.pat.min_pattern_len = rdev->wiphy.coalesce->pattern_min_len; in nl80211_send_coalesce()
1801 rule.pat.max_pattern_len = rdev->wiphy.coalesce->pattern_max_len; in nl80211_send_coalesce()
1802 rule.pat.max_pkt_offset = rdev->wiphy.coalesce->max_pkt_offset; in nl80211_send_coalesce()
1805 return -ENOBUFS; in nl80211_send_coalesce()
1815 const struct ieee80211_sta_he_cap *he_cap = &iftdata->he_cap; in nl80211_send_iftype_data()
1816 const struct ieee80211_sta_eht_cap *eht_cap = &iftdata->eht_cap; in nl80211_send_iftype_data()
1819 iftdata->types_mask)) in nl80211_send_iftype_data()
1820 return -ENOBUFS; in nl80211_send_iftype_data()
1822 if (he_cap->has_he) { in nl80211_send_iftype_data()
1824 sizeof(he_cap->he_cap_elem.mac_cap_info), in nl80211_send_iftype_data()
1825 he_cap->he_cap_elem.mac_cap_info) || in nl80211_send_iftype_data()
1827 sizeof(he_cap->he_cap_elem.phy_cap_info), in nl80211_send_iftype_data()
1828 he_cap->he_cap_elem.phy_cap_info) || in nl80211_send_iftype_data()
1830 sizeof(he_cap->he_mcs_nss_supp), in nl80211_send_iftype_data()
1831 &he_cap->he_mcs_nss_supp) || in nl80211_send_iftype_data()
1833 sizeof(he_cap->ppe_thres), he_cap->ppe_thres)) in nl80211_send_iftype_data()
1834 return -ENOBUFS; in nl80211_send_iftype_data()
1837 if (eht_cap->has_eht && he_cap->has_he) { in nl80211_send_iftype_data()
1842 is_ap = iftdata->types_mask & BIT(NL80211_IFTYPE_AP) || in nl80211_send_iftype_data()
1843 iftdata->types_mask & BIT(NL80211_IFTYPE_P2P_GO); in nl80211_send_iftype_data()
1846 ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, in nl80211_send_iftype_data()
1847 &eht_cap->eht_cap_elem, in nl80211_send_iftype_data()
1850 ppe_thres_hdr = get_unaligned_le16(&eht_cap->eht_ppe_thres[0]); in nl80211_send_iftype_data()
1853 eht_cap->eht_cap_elem.phy_cap_info); in nl80211_send_iftype_data()
1856 sizeof(eht_cap->eht_cap_elem.mac_cap_info), in nl80211_send_iftype_data()
1857 eht_cap->eht_cap_elem.mac_cap_info) || in nl80211_send_iftype_data()
1859 sizeof(eht_cap->eht_cap_elem.phy_cap_info), in nl80211_send_iftype_data()
1860 eht_cap->eht_cap_elem.phy_cap_info) || in nl80211_send_iftype_data()
1862 mcs_nss_size, &eht_cap->eht_mcs_nss_supp) || in nl80211_send_iftype_data()
1864 ppe_thresh_size, eht_cap->eht_ppe_thres)) in nl80211_send_iftype_data()
1865 return -ENOBUFS; in nl80211_send_iftype_data()
1868 if (sband->band == NL80211_BAND_6GHZ && in nl80211_send_iftype_data()
1870 sizeof(iftdata->he_6ghz_capa), in nl80211_send_iftype_data()
1871 &iftdata->he_6ghz_capa)) in nl80211_send_iftype_data()
1872 return -ENOBUFS; in nl80211_send_iftype_data()
1874 if (iftdata->vendor_elems.data && iftdata->vendor_elems.len && in nl80211_send_iftype_data()
1876 iftdata->vendor_elems.len, iftdata->vendor_elems.data)) in nl80211_send_iftype_data()
1877 return -ENOBUFS; in nl80211_send_iftype_data()
1891 if (sband->ht_cap.ht_supported && in nl80211_send_band_rateinfo()
1893 sizeof(sband->ht_cap.mcs), in nl80211_send_band_rateinfo()
1894 &sband->ht_cap.mcs) || in nl80211_send_band_rateinfo()
1896 sband->ht_cap.cap) || in nl80211_send_band_rateinfo()
1898 sband->ht_cap.ampdu_factor) || in nl80211_send_band_rateinfo()
1900 sband->ht_cap.ampdu_density))) in nl80211_send_band_rateinfo()
1901 return -ENOBUFS; in nl80211_send_band_rateinfo()
1904 if (sband->vht_cap.vht_supported && in nl80211_send_band_rateinfo()
1906 sizeof(sband->vht_cap.vht_mcs), in nl80211_send_band_rateinfo()
1907 &sband->vht_cap.vht_mcs) || in nl80211_send_band_rateinfo()
1909 sband->vht_cap.cap))) in nl80211_send_band_rateinfo()
1910 return -ENOBUFS; in nl80211_send_band_rateinfo()
1912 if (large && sband->n_iftype_data) { in nl80211_send_band_rateinfo()
1919 return -ENOBUFS; in nl80211_send_band_rateinfo()
1921 for (i = 0; i < sband->n_iftype_data; i++) { in nl80211_send_band_rateinfo()
1926 return -ENOBUFS; in nl80211_send_band_rateinfo()
1929 &sband->iftype_data[i]); in nl80211_send_band_rateinfo()
1940 if (large && sband->edmg_cap.channels && in nl80211_send_band_rateinfo()
1942 sband->edmg_cap.channels) || in nl80211_send_band_rateinfo()
1944 sband->edmg_cap.bw_config))) in nl80211_send_band_rateinfo()
1946 return -ENOBUFS; in nl80211_send_band_rateinfo()
1951 return -ENOBUFS; in nl80211_send_band_rateinfo()
1953 for (i = 0; i < sband->n_bitrates; i++) { in nl80211_send_band_rateinfo()
1956 return -ENOBUFS; in nl80211_send_band_rateinfo()
1958 rate = &sband->bitrates[i]; in nl80211_send_band_rateinfo()
1960 rate->bitrate)) in nl80211_send_band_rateinfo()
1961 return -ENOBUFS; in nl80211_send_band_rateinfo()
1962 if ((rate->flags & IEEE80211_RATE_SHORT_PREAMBLE) && in nl80211_send_band_rateinfo()
1965 return -ENOBUFS; in nl80211_send_band_rateinfo()
1973 if (sband->band == NL80211_BAND_S1GHZ && sband->s1g_cap.s1g && in nl80211_send_band_rateinfo()
1975 sizeof(sband->s1g_cap.cap), in nl80211_send_band_rateinfo()
1976 sband->s1g_cap.cap) || in nl80211_send_band_rateinfo()
1978 sizeof(sband->s1g_cap.nss_mcs), in nl80211_send_band_rateinfo()
1979 sband->s1g_cap.nss_mcs))) in nl80211_send_band_rateinfo()
1980 return -ENOBUFS; in nl80211_send_band_rateinfo()
1999 return -ENOBUFS; in nl80211_send_mgmt_stypes()
2004 return -ENOBUFS; in nl80211_send_mgmt_stypes()
2011 return -ENOBUFS; in nl80211_send_mgmt_stypes()
2022 return -ENOBUFS; in nl80211_send_mgmt_stypes()
2027 return -ENOBUFS; in nl80211_send_mgmt_stypes()
2029 stypes = mgmt_stypes[ift].rx; in nl80211_send_mgmt_stypes()
2034 return -ENOBUFS; in nl80211_send_mgmt_stypes()
2047 if (rdev->ops->op) { \
2081 if (rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) in nl80211_add_commands_unsplit()
2086 if (rdev->wiphy.flags & WIPHY_FLAG_NETNS_OK) { in nl80211_add_commands_unsplit()
2091 if (rdev->ops->set_monitor_channel || rdev->ops->start_ap || in nl80211_add_commands_unsplit()
2092 rdev->ops->join_mesh) { in nl80211_add_commands_unsplit()
2097 if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) { in nl80211_add_commands_unsplit()
2101 if (rdev->wiphy.max_sched_scan_reqs) in nl80211_add_commands_unsplit()
2105 if (rdev->wiphy.flags & WIPHY_FLAG_REPORTS_OBSS) { in nl80211_add_commands_unsplit()
2116 if (rdev->ops->connect || rdev->ops->auth) { in nl80211_add_commands_unsplit()
2122 if (rdev->ops->disconnect || rdev->ops->deauth) { in nl80211_add_commands_unsplit()
2130 return -ENOBUFS; in nl80211_add_commands_unsplit()
2139 if (!cap->ftm.supported) in nl80211_send_pmsr_ftm_capa()
2144 return -ENOBUFS; in nl80211_send_pmsr_ftm_capa()
2146 if (cap->ftm.asap && nla_put_flag(msg, NL80211_PMSR_FTM_CAPA_ATTR_ASAP)) in nl80211_send_pmsr_ftm_capa()
2147 return -ENOBUFS; in nl80211_send_pmsr_ftm_capa()
2148 if (cap->ftm.non_asap && in nl80211_send_pmsr_ftm_capa()
2150 return -ENOBUFS; in nl80211_send_pmsr_ftm_capa()
2151 if (cap->ftm.request_lci && in nl80211_send_pmsr_ftm_capa()
2153 return -ENOBUFS; in nl80211_send_pmsr_ftm_capa()
2154 if (cap->ftm.request_civicloc && in nl80211_send_pmsr_ftm_capa()
2156 return -ENOBUFS; in nl80211_send_pmsr_ftm_capa()
2158 cap->ftm.preambles)) in nl80211_send_pmsr_ftm_capa()
2159 return -ENOBUFS; in nl80211_send_pmsr_ftm_capa()
2161 cap->ftm.bandwidths)) in nl80211_send_pmsr_ftm_capa()
2162 return -ENOBUFS; in nl80211_send_pmsr_ftm_capa()
2163 if (cap->ftm.max_bursts_exponent >= 0 && in nl80211_send_pmsr_ftm_capa()
2165 cap->ftm.max_bursts_exponent)) in nl80211_send_pmsr_ftm_capa()
2166 return -ENOBUFS; in nl80211_send_pmsr_ftm_capa()
2167 if (cap->ftm.max_ftms_per_burst && in nl80211_send_pmsr_ftm_capa()
2169 cap->ftm.max_ftms_per_burst)) in nl80211_send_pmsr_ftm_capa()
2170 return -ENOBUFS; in nl80211_send_pmsr_ftm_capa()
2171 if (cap->ftm.trigger_based && in nl80211_send_pmsr_ftm_capa()
2173 return -ENOBUFS; in nl80211_send_pmsr_ftm_capa()
2174 if (cap->ftm.non_trigger_based && in nl80211_send_pmsr_ftm_capa()
2176 return -ENOBUFS; in nl80211_send_pmsr_ftm_capa()
2185 const struct cfg80211_pmsr_capabilities *cap = rdev->wiphy.pmsr_capa; in nl80211_send_pmsr_capa()
2198 return -ENOBUFS; in nl80211_send_pmsr_capa()
2200 if (nla_put_u32(msg, NL80211_PMSR_ATTR_MAX_PEERS, cap->max_peers)) in nl80211_send_pmsr_capa()
2201 return -ENOBUFS; in nl80211_send_pmsr_capa()
2203 if (cap->report_ap_tsf && in nl80211_send_pmsr_capa()
2205 return -ENOBUFS; in nl80211_send_pmsr_capa()
2207 if (cap->randomize_mac_addr && in nl80211_send_pmsr_capa()
2209 return -ENOBUFS; in nl80211_send_pmsr_capa()
2213 return -ENOBUFS; in nl80211_send_pmsr_capa()
2216 return -ENOBUFS; in nl80211_send_pmsr_capa()
2232 if (!rdev->wiphy.num_iftype_akm_suites || in nl80211_put_iftype_akm_suites()
2233 !rdev->wiphy.iftype_akm_suites) in nl80211_put_iftype_akm_suites()
2238 return -ENOBUFS; in nl80211_put_iftype_akm_suites()
2240 for (i = 0; i < rdev->wiphy.num_iftype_akm_suites; i++) { in nl80211_put_iftype_akm_suites()
2243 return -ENOBUFS; in nl80211_put_iftype_akm_suites()
2245 iftype_akms = &rdev->wiphy.iftype_akm_suites[i]; in nl80211_put_iftype_akm_suites()
2248 iftype_akms->iftypes_mask)) in nl80211_put_iftype_akm_suites()
2249 return -ENOBUFS; in nl80211_put_iftype_akm_suites()
2252 sizeof(u32) * iftype_akms->n_akm_suites, in nl80211_put_iftype_akm_suites()
2253 iftype_akms->akm_suites)) { in nl80211_put_iftype_akm_suites()
2254 return -ENOBUFS; in nl80211_put_iftype_akm_suites()
2270 if (!rdev->wiphy.tid_config_support.vif && in nl80211_put_tid_config_support()
2271 !rdev->wiphy.tid_config_support.peer) in nl80211_put_tid_config_support()
2276 return -ENOSPC; in nl80211_put_tid_config_support()
2278 if (rdev->wiphy.tid_config_support.vif && in nl80211_put_tid_config_support()
2280 rdev->wiphy.tid_config_support.vif, in nl80211_put_tid_config_support()
2284 if (rdev->wiphy.tid_config_support.peer && in nl80211_put_tid_config_support()
2286 rdev->wiphy.tid_config_support.peer, in nl80211_put_tid_config_support()
2292 rdev->wiphy.tid_config_support.max_retry)) in nl80211_put_tid_config_support()
2295 rdev->wiphy.tid_config_support.max_retry)) in nl80211_put_tid_config_support()
2303 return -ENOBUFS; in nl80211_put_tid_config_support()
2314 if (!rdev->wiphy.sar_capa) in nl80211_put_sar_specs()
2317 num_freq_ranges = rdev->wiphy.sar_capa->num_freq_ranges; in nl80211_put_sar_specs()
2321 return -ENOSPC; in nl80211_put_sar_specs()
2323 if (nla_put_u32(msg, NL80211_SAR_ATTR_TYPE, rdev->wiphy.sar_capa->type)) in nl80211_put_sar_specs()
2337 rdev->wiphy.sar_capa->freq_ranges[i].start_freq)) in nl80211_put_sar_specs()
2341 rdev->wiphy.sar_capa->freq_ranges[i].end_freq)) in nl80211_put_sar_specs()
2353 return -ENOBUFS; in nl80211_put_sar_specs()
2360 if (!wiphy->mbssid_max_interfaces) in nl80211_put_mbssid_support()
2365 return -ENOBUFS; in nl80211_put_mbssid_support()
2368 wiphy->mbssid_max_interfaces)) in nl80211_put_mbssid_support()
2371 if (wiphy->ema_max_profile_periodicity && in nl80211_put_mbssid_support()
2374 wiphy->ema_max_profile_periodicity)) in nl80211_put_mbssid_support()
2382 return -ENOBUFS; in nl80211_put_mbssid_support()
2405 rdev->wiphy.mgmt_stypes; in nl80211_send_wiphy()
2410 return -ENOBUFS; in nl80211_send_wiphy()
2413 return -EINVAL; in nl80211_send_wiphy()
2415 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_send_wiphy()
2417 wiphy_name(&rdev->wiphy)) || in nl80211_send_wiphy()
2425 switch (state->split_start) { in nl80211_send_wiphy()
2428 rdev->wiphy.retry_short) || in nl80211_send_wiphy()
2430 rdev->wiphy.retry_long) || in nl80211_send_wiphy()
2432 rdev->wiphy.frag_threshold) || in nl80211_send_wiphy()
2434 rdev->wiphy.rts_threshold) || in nl80211_send_wiphy()
2436 rdev->wiphy.coverage_class) || in nl80211_send_wiphy()
2438 rdev->wiphy.max_scan_ssids) || in nl80211_send_wiphy()
2440 rdev->wiphy.max_sched_scan_ssids) || in nl80211_send_wiphy()
2442 rdev->wiphy.max_scan_ie_len) || in nl80211_send_wiphy()
2444 rdev->wiphy.max_sched_scan_ie_len) || in nl80211_send_wiphy()
2446 rdev->wiphy.max_match_sets)) in nl80211_send_wiphy()
2449 if ((rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN) && in nl80211_send_wiphy()
2452 if ((rdev->wiphy.flags & WIPHY_FLAG_MESH_AUTH) && in nl80211_send_wiphy()
2455 if ((rdev->wiphy.flags & WIPHY_FLAG_AP_UAPSD) && in nl80211_send_wiphy()
2458 if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_FW_ROAM) && in nl80211_send_wiphy()
2461 if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) && in nl80211_send_wiphy()
2464 if ((rdev->wiphy.flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP) && in nl80211_send_wiphy()
2467 state->split_start++; in nl80211_send_wiphy()
2468 if (state->split) in nl80211_send_wiphy()
2473 sizeof(u32) * rdev->wiphy.n_cipher_suites, in nl80211_send_wiphy()
2474 rdev->wiphy.cipher_suites)) in nl80211_send_wiphy()
2478 rdev->wiphy.max_num_pmkids)) in nl80211_send_wiphy()
2481 if ((rdev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL) && in nl80211_send_wiphy()
2486 rdev->wiphy.available_antennas_tx) || in nl80211_send_wiphy()
2488 rdev->wiphy.available_antennas_rx)) in nl80211_send_wiphy()
2491 if ((rdev->wiphy.flags & WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD) && in nl80211_send_wiphy()
2493 rdev->wiphy.probe_resp_offload)) in nl80211_send_wiphy()
2496 if ((rdev->wiphy.available_antennas_tx || in nl80211_send_wiphy()
2497 rdev->wiphy.available_antennas_rx) && in nl80211_send_wiphy()
2498 rdev->ops->get_antenna) { in nl80211_send_wiphy()
2514 state->split_start++; in nl80211_send_wiphy()
2515 if (state->split) in nl80211_send_wiphy()
2520 rdev->wiphy.interface_modes)) in nl80211_send_wiphy()
2522 state->split_start++; in nl80211_send_wiphy()
2523 if (state->split) in nl80211_send_wiphy()
2532 for (band = state->band_start; in nl80211_send_wiphy()
2533 band < (state->split ? in nl80211_send_wiphy()
2540 if (band > NL80211_BAND_5GHZ && !state->split) in nl80211_send_wiphy()
2543 sband = rdev->wiphy.bands[band]; in nl80211_send_wiphy()
2552 switch (state->chan_start) { in nl80211_send_wiphy()
2555 state->split)) in nl80211_send_wiphy()
2557 state->chan_start++; in nl80211_send_wiphy()
2558 if (state->split) in nl80211_send_wiphy()
2568 for (i = state->chan_start - 1; in nl80211_send_wiphy()
2569 i < sband->n_channels; in nl80211_send_wiphy()
2576 chan = &sband->channels[i]; in nl80211_send_wiphy()
2579 msg, &rdev->wiphy, chan, in nl80211_send_wiphy()
2580 state->split)) in nl80211_send_wiphy()
2584 if (state->split) in nl80211_send_wiphy()
2587 if (i < sband->n_channels) in nl80211_send_wiphy()
2588 state->chan_start = i + 2; in nl80211_send_wiphy()
2590 state->chan_start = 0; in nl80211_send_wiphy()
2596 if (state->split) { in nl80211_send_wiphy()
2598 if (state->chan_start) in nl80211_send_wiphy()
2599 band--; in nl80211_send_wiphy()
2606 state->band_start = band + 1; in nl80211_send_wiphy()
2608 state->band_start = 0; in nl80211_send_wiphy()
2611 if (state->band_start == 0 && state->chan_start == 0) in nl80211_send_wiphy()
2612 state->split_start++; in nl80211_send_wiphy()
2613 if (state->split) in nl80211_send_wiphy()
2625 if (state->split) { in nl80211_send_wiphy()
2628 if (rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH) in nl80211_send_wiphy()
2631 if (rdev->wiphy.features & in nl80211_send_wiphy()
2637 if (rdev->wiphy.sar_capa) in nl80211_send_wiphy()
2643 state->split_start++; in nl80211_send_wiphy()
2644 if (state->split) in nl80211_send_wiphy()
2648 if (rdev->ops->remain_on_channel && in nl80211_send_wiphy()
2649 (rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) && in nl80211_send_wiphy()
2652 rdev->wiphy.max_remain_on_channel_duration)) in nl80211_send_wiphy()
2655 if ((rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX) && in nl80211_send_wiphy()
2659 state->split_start++; in nl80211_send_wiphy()
2660 if (state->split) in nl80211_send_wiphy()
2665 if (nl80211_send_wowlan(msg, rdev, state->split)) in nl80211_send_wiphy()
2667 state->split_start++; in nl80211_send_wiphy()
2668 if (state->split) in nl80211_send_wiphy()
2671 state->split_start++; in nl80211_send_wiphy()
2676 rdev->wiphy.software_iftypes)) in nl80211_send_wiphy()
2679 if (nl80211_put_iface_combinations(&rdev->wiphy, msg, in nl80211_send_wiphy()
2680 state->split)) in nl80211_send_wiphy()
2683 state->split_start++; in nl80211_send_wiphy()
2684 if (state->split) in nl80211_send_wiphy()
2688 if ((rdev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME) && in nl80211_send_wiphy()
2690 rdev->wiphy.ap_sme_capa)) in nl80211_send_wiphy()
2693 features = rdev->wiphy.features; in nl80211_send_wiphy()
2695 * We can only add the per-channel limit information if the in nl80211_send_wiphy()
2699 if (state->split) in nl80211_send_wiphy()
2704 if (rdev->wiphy.ht_capa_mod_mask && in nl80211_send_wiphy()
2706 sizeof(*rdev->wiphy.ht_capa_mod_mask), in nl80211_send_wiphy()
2707 rdev->wiphy.ht_capa_mod_mask)) in nl80211_send_wiphy()
2710 if (rdev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME && in nl80211_send_wiphy()
2711 rdev->wiphy.max_acl_mac_addrs && in nl80211_send_wiphy()
2713 rdev->wiphy.max_acl_mac_addrs)) in nl80211_send_wiphy()
2726 if (state->split) in nl80211_send_wiphy()
2727 state->split_start++; in nl80211_send_wiphy()
2729 state->split_start = 0; in nl80211_send_wiphy()
2736 rdev->wiphy.max_sched_scan_plans) || in nl80211_send_wiphy()
2738 rdev->wiphy.max_sched_scan_plan_interval) || in nl80211_send_wiphy()
2740 rdev->wiphy.max_sched_scan_plan_iterations)) in nl80211_send_wiphy()
2743 if (rdev->wiphy.extended_capabilities && in nl80211_send_wiphy()
2745 rdev->wiphy.extended_capabilities_len, in nl80211_send_wiphy()
2746 rdev->wiphy.extended_capabilities) || in nl80211_send_wiphy()
2748 rdev->wiphy.extended_capabilities_len, in nl80211_send_wiphy()
2749 rdev->wiphy.extended_capabilities_mask))) in nl80211_send_wiphy()
2752 if (rdev->wiphy.vht_capa_mod_mask && in nl80211_send_wiphy()
2754 sizeof(*rdev->wiphy.vht_capa_mod_mask), in nl80211_send_wiphy()
2755 rdev->wiphy.vht_capa_mod_mask)) in nl80211_send_wiphy()
2759 rdev->wiphy.perm_addr)) in nl80211_send_wiphy()
2762 if (!is_zero_ether_addr(rdev->wiphy.addr_mask) && in nl80211_send_wiphy()
2764 rdev->wiphy.addr_mask)) in nl80211_send_wiphy()
2767 if (rdev->wiphy.n_addresses > 1) { in nl80211_send_wiphy()
2774 for (i = 0; i < rdev->wiphy.n_addresses; i++) in nl80211_send_wiphy()
2776 rdev->wiphy.addresses[i].addr)) in nl80211_send_wiphy()
2782 state->split_start++; in nl80211_send_wiphy()
2788 if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_5_10_MHZ) && in nl80211_send_wiphy()
2793 if (rdev->wiphy.max_ap_assoc_sta && in nl80211_send_wiphy()
2795 rdev->wiphy.max_ap_assoc_sta)) in nl80211_send_wiphy()
2798 state->split_start++; in nl80211_send_wiphy()
2801 if (rdev->wiphy.n_vendor_commands) { in nl80211_send_wiphy()
2810 for (i = 0; i < rdev->wiphy.n_vendor_commands; i++) { in nl80211_send_wiphy()
2811 info = &rdev->wiphy.vendor_commands[i].info; in nl80211_send_wiphy()
2818 if (rdev->wiphy.n_vendor_events) { in nl80211_send_wiphy()
2827 for (i = 0; i < rdev->wiphy.n_vendor_events; i++) { in nl80211_send_wiphy()
2828 info = &rdev->wiphy.vendor_events[i]; in nl80211_send_wiphy()
2834 state->split_start++; in nl80211_send_wiphy()
2837 if (rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH && in nl80211_send_wiphy()
2839 rdev->wiphy.max_num_csa_counters)) in nl80211_send_wiphy()
2842 if (rdev->wiphy.regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED && in nl80211_send_wiphy()
2846 if (rdev->wiphy.max_sched_scan_reqs && in nl80211_send_wiphy()
2848 rdev->wiphy.max_sched_scan_reqs)) in nl80211_send_wiphy()
2852 sizeof(rdev->wiphy.ext_features), in nl80211_send_wiphy()
2853 rdev->wiphy.ext_features)) in nl80211_send_wiphy()
2856 if (rdev->wiphy.bss_select_support) { in nl80211_send_wiphy()
2858 u32 bss_select_support = rdev->wiphy.bss_select_support; in nl80211_send_wiphy()
2876 state->split_start++; in nl80211_send_wiphy()
2879 if (rdev->wiphy.num_iftype_ext_capab && in nl80211_send_wiphy()
2880 rdev->wiphy.iftype_ext_capab) { in nl80211_send_wiphy()
2888 for (i = state->capa_start; in nl80211_send_wiphy()
2889 i < rdev->wiphy.num_iftype_ext_capab; i++) { in nl80211_send_wiphy()
2892 capab = &rdev->wiphy.iftype_ext_capab[i]; in nl80211_send_wiphy()
2898 capab->iftype) || in nl80211_send_wiphy()
2900 capab->extended_capabilities_len, in nl80211_send_wiphy()
2901 capab->extended_capabilities) || in nl80211_send_wiphy()
2903 capab->extended_capabilities_len, in nl80211_send_wiphy()
2904 capab->extended_capabilities_mask)) in nl80211_send_wiphy()
2907 if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_MLO && in nl80211_send_wiphy()
2910 capab->eml_capabilities) || in nl80211_send_wiphy()
2913 capab->mld_capa_and_ops))) in nl80211_send_wiphy()
2917 if (state->split) in nl80211_send_wiphy()
2921 if (i < rdev->wiphy.num_iftype_ext_capab) { in nl80211_send_wiphy()
2922 state->capa_start = i + 1; in nl80211_send_wiphy()
2928 rdev->wiphy.nan_supported_bands)) in nl80211_send_wiphy()
2931 if (wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_send_wiphy()
2943 rdev->wiphy.txq_limit)) in nl80211_send_wiphy()
2946 rdev->wiphy.txq_memory_limit)) in nl80211_send_wiphy()
2949 rdev->wiphy.txq_quantum)) in nl80211_send_wiphy()
2953 state->split_start++; in nl80211_send_wiphy()
2959 state->split_start++; in nl80211_send_wiphy()
2962 if (rdev->wiphy.akm_suites && in nl80211_send_wiphy()
2964 sizeof(u32) * rdev->wiphy.n_akm_suites, in nl80211_send_wiphy()
2965 rdev->wiphy.akm_suites)) in nl80211_send_wiphy()
2973 state->split_start++; in nl80211_send_wiphy()
2979 if (nl80211_put_mbssid_support(&rdev->wiphy, msg)) in nl80211_send_wiphy()
2983 rdev->wiphy.max_num_akm_suites)) in nl80211_send_wiphy()
2986 if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_MLO) in nl80211_send_wiphy()
2989 if (rdev->wiphy.hw_timestamp_max_peers && in nl80211_send_wiphy()
2991 rdev->wiphy.hw_timestamp_max_peers)) in nl80211_send_wiphy()
2995 state->split_start = 0; in nl80211_send_wiphy()
3004 return -EMSGSIZE; in nl80211_send_wiphy()
3015 return -ENOMEM; in nl80211_dump_wiphy_parse()
3017 ret = nlmsg_parse_deprecated(cb->nlh, in nl80211_dump_wiphy_parse()
3027 state->split = tb[NL80211_ATTR_SPLIT_WIPHY_DUMP]; in nl80211_dump_wiphy_parse()
3029 state->filter_wiphy = nla_get_u32(tb[NL80211_ATTR_WIPHY]); in nl80211_dump_wiphy_parse()
3031 state->filter_wiphy = nla_get_u64(tb[NL80211_ATTR_WDEV]) >> 32; in nl80211_dump_wiphy_parse()
3037 netdev = __dev_get_by_index(sock_net(skb->sk), ifidx); in nl80211_dump_wiphy_parse()
3039 ret = -ENODEV; in nl80211_dump_wiphy_parse()
3042 if (netdev->ieee80211_ptr) { in nl80211_dump_wiphy_parse()
3044 netdev->ieee80211_ptr->wiphy); in nl80211_dump_wiphy_parse()
3045 state->filter_wiphy = rdev->wiphy_idx; in nl80211_dump_wiphy_parse()
3058 struct nl80211_dump_wiphy_state *state = (void *)cb->args[0]; in nl80211_dump_wiphy()
3066 return -ENOMEM; in nl80211_dump_wiphy()
3068 state->filter_wiphy = -1; in nl80211_dump_wiphy()
3075 cb->args[0] = (long)state; in nl80211_dump_wiphy()
3079 if (!net_eq(wiphy_net(&rdev->wiphy), sock_net(skb->sk))) in nl80211_dump_wiphy()
3081 if (++idx <= state->start) in nl80211_dump_wiphy()
3083 if (state->filter_wiphy != -1 && in nl80211_dump_wiphy()
3084 state->filter_wiphy != rdev->wiphy_idx) in nl80211_dump_wiphy()
3086 wiphy_lock(&rdev->wiphy); in nl80211_dump_wiphy()
3091 NETLINK_CB(cb->skb).portid, in nl80211_dump_wiphy()
3092 cb->nlh->nlmsg_seq, in nl80211_dump_wiphy()
3103 * This results in an empty message being RX'ed in nl80211_dump_wiphy()
3108 if ((ret == -ENOBUFS || ret == -EMSGSIZE) && in nl80211_dump_wiphy()
3109 !skb->len && !state->split && in nl80211_dump_wiphy()
3110 cb->min_dump_alloc < 4096) { in nl80211_dump_wiphy()
3111 cb->min_dump_alloc = 4096; in nl80211_dump_wiphy()
3112 state->split_start = 0; in nl80211_dump_wiphy()
3113 wiphy_unlock(&rdev->wiphy); in nl80211_dump_wiphy()
3117 idx--; in nl80211_dump_wiphy()
3120 } while (state->split_start > 0); in nl80211_dump_wiphy()
3121 wiphy_unlock(&rdev->wiphy); in nl80211_dump_wiphy()
3126 state->start = idx; in nl80211_dump_wiphy()
3128 return skb->len; in nl80211_dump_wiphy()
3133 kfree((void *)cb->args[0]); in nl80211_dump_wiphy_done()
3140 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_get_wiphy()
3145 return -ENOMEM; in nl80211_get_wiphy()
3148 info->snd_portid, info->snd_seq, 0, in nl80211_get_wiphy()
3151 return -ENOBUFS; in nl80211_get_wiphy()
3173 return -EINVAL; in parse_txq_params()
3176 txq_params->txop = nla_get_u16(tb[NL80211_TXQ_ATTR_TXOP]); in parse_txq_params()
3177 txq_params->cwmin = nla_get_u16(tb[NL80211_TXQ_ATTR_CWMIN]); in parse_txq_params()
3178 txq_params->cwmax = nla_get_u16(tb[NL80211_TXQ_ATTR_CWMAX]); in parse_txq_params()
3179 txq_params->aifs = nla_get_u8(tb[NL80211_TXQ_ATTR_AIFS]); in parse_txq_params()
3182 return -EINVAL; in parse_txq_params()
3183 txq_params->ac = array_index_nospec(ac, NL80211_NUM_ACS); in parse_txq_params()
3196 * low-level driver when the AP starts or the mesh is joined. in nl80211_can_set_dev_channel()
3198 * the channel in the start-ap or join-mesh commands instead. in nl80211_can_set_dev_channel()
3205 wdev->iftype == NL80211_IFTYPE_AP || in nl80211_can_set_dev_channel()
3206 wdev->iftype == NL80211_IFTYPE_MESH_POINT || in nl80211_can_set_dev_channel()
3207 wdev->iftype == NL80211_IFTYPE_MONITOR || in nl80211_can_set_dev_channel()
3208 wdev->iftype == NL80211_IFTYPE_P2P_GO; in nl80211_can_set_dev_channel()
3216 if (!wiphy_ext_feature_isset(&rdev->wiphy, NL80211_EXT_FEATURE_PUNCT)) in nl80211_parse_punct_bitmap()
3217 return -EINVAL; in nl80211_parse_punct_bitmap()
3219 *punct_bitmap = nla_get_u32(info->attrs[NL80211_ATTR_PUNCT_BITMAP]); in nl80211_parse_punct_bitmap()
3221 return -EINVAL; in nl80211_parse_punct_bitmap()
3230 struct netlink_ext_ack *extack = info->extack; in nl80211_parse_chandef()
3231 struct nlattr **attrs = info->attrs; in nl80211_parse_chandef()
3237 return -EINVAL; in nl80211_parse_chandef()
3241 nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ])); in nl80211_parse_chandef()
3242 if (info->attrs[NL80211_ATTR_WIPHY_FREQ_OFFSET]) in nl80211_parse_chandef()
3244 nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ_OFFSET]); in nl80211_parse_chandef()
3247 chandef->chan = ieee80211_get_channel_khz(&rdev->wiphy, control_freq); in nl80211_parse_chandef()
3248 chandef->width = NL80211_CHAN_WIDTH_20_NOHT; in nl80211_parse_chandef()
3249 chandef->center_freq1 = KHZ_TO_MHZ(control_freq); in nl80211_parse_chandef()
3250 chandef->freq1_offset = control_freq % 1000; in nl80211_parse_chandef()
3251 chandef->center_freq2 = 0; in nl80211_parse_chandef()
3254 if (!chandef->chan || chandef->chan->flags & IEEE80211_CHAN_DISABLED) { in nl80211_parse_chandef()
3257 return -EINVAL; in nl80211_parse_chandef()
3270 cfg80211_chandef_create(chandef, chandef->chan, in nl80211_parse_chandef()
3274 chandef->center_freq1 != nla_get_u32(attrs[NL80211_ATTR_CENTER_FREQ1])) { in nl80211_parse_chandef()
3278 return -EINVAL; in nl80211_parse_chandef()
3286 return -EINVAL; in nl80211_parse_chandef()
3293 return -EINVAL; in nl80211_parse_chandef()
3296 chandef->width = in nl80211_parse_chandef()
3298 if (chandef->chan->band == NL80211_BAND_S1GHZ) { in nl80211_parse_chandef()
3300 if (chandef->width != ieee80211_s1g_channel_width(chandef->chan)) { in nl80211_parse_chandef()
3304 return -EINVAL; in nl80211_parse_chandef()
3308 chandef->center_freq1 = in nl80211_parse_chandef()
3311 chandef->freq1_offset = nla_get_u32( in nl80211_parse_chandef()
3314 chandef->freq1_offset = 0; in nl80211_parse_chandef()
3317 chandef->center_freq2 = in nl80211_parse_chandef()
3321 if (info->attrs[NL80211_ATTR_WIPHY_EDMG_CHANNELS]) { in nl80211_parse_chandef()
3322 chandef->edmg.channels = in nl80211_parse_chandef()
3323 nla_get_u8(info->attrs[NL80211_ATTR_WIPHY_EDMG_CHANNELS]); in nl80211_parse_chandef()
3325 if (info->attrs[NL80211_ATTR_WIPHY_EDMG_BW_CONFIG]) in nl80211_parse_chandef()
3326 chandef->edmg.bw_config = in nl80211_parse_chandef()
3327 nla_get_u8(info->attrs[NL80211_ATTR_WIPHY_EDMG_BW_CONFIG]); in nl80211_parse_chandef()
3329 chandef->edmg.bw_config = 0; in nl80211_parse_chandef()
3330 chandef->edmg.channels = 0; in nl80211_parse_chandef()
3335 return -EINVAL; in nl80211_parse_chandef()
3338 if (!cfg80211_chandef_usable(&rdev->wiphy, chandef, in nl80211_parse_chandef()
3341 return -EINVAL; in nl80211_parse_chandef()
3344 if ((chandef->width == NL80211_CHAN_WIDTH_5 || in nl80211_parse_chandef()
3345 chandef->width == NL80211_CHAN_WIDTH_10) && in nl80211_parse_chandef()
3346 !(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_5_10_MHZ)) { in nl80211_parse_chandef()
3348 return -EINVAL; in nl80211_parse_chandef()
3366 wdev = dev->ieee80211_ptr; in __nl80211_set_channel()
3368 return -EOPNOTSUPP; in __nl80211_set_channel()
3370 iftype = wdev->iftype; in __nl80211_set_channel()
3373 if (wdev && wdev->valid_links) in __nl80211_set_channel()
3374 return -EINVAL; in __nl80211_set_channel()
3385 if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, &chandef, in __nl80211_set_channel()
3387 return -EINVAL; in __nl80211_set_channel()
3388 if (wdev->links[link_id].ap.beacon_interval) { in __nl80211_set_channel()
3391 if (!dev || !rdev->ops->set_ap_chanwidth || in __nl80211_set_channel()
3392 !(rdev->wiphy.features & in __nl80211_set_channel()
3394 return -EBUSY; in __nl80211_set_channel()
3397 cur_chan = wdev->links[link_id].ap.chandef.chan; in __nl80211_set_channel()
3399 return -EBUSY; in __nl80211_set_channel()
3405 wdev->links[link_id].ap.chandef = chandef; in __nl80211_set_channel()
3407 wdev->u.ap.preset_chandef = chandef; in __nl80211_set_channel()
3418 return -EINVAL; in __nl80211_set_channel()
3423 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_channel()
3424 int link_id = nl80211_link_id_or_invalid(info->attrs); in nl80211_set_channel()
3425 struct net_device *netdev = info->user_ptr[1]; in nl80211_set_channel()
3428 wdev_lock(netdev->ieee80211_ptr); in nl80211_set_channel()
3430 wdev_unlock(netdev->ieee80211_ptr); in nl80211_set_channel()
3452 * done for backward compatibility -- previously in nl80211_set_wiphy()
3459 if (info->attrs[NL80211_ATTR_IFINDEX]) { in nl80211_set_wiphy()
3460 int ifindex = nla_get_u32(info->attrs[NL80211_ATTR_IFINDEX]); in nl80211_set_wiphy()
3463 if (netdev && netdev->ieee80211_ptr) in nl80211_set_wiphy()
3464 rdev = wiphy_to_rdev(netdev->ieee80211_ptr->wiphy); in nl80211_set_wiphy()
3471 info->attrs); in nl80211_set_wiphy()
3480 wdev = netdev->ieee80211_ptr; in nl80211_set_wiphy()
3482 wiphy_lock(&rdev->wiphy); in nl80211_set_wiphy()
3489 if (info->attrs[NL80211_ATTR_WIPHY_NAME]) in nl80211_set_wiphy()
3491 rdev, nla_data(info->attrs[NL80211_ATTR_WIPHY_NAME])); in nl80211_set_wiphy()
3497 if (info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS]) { in nl80211_set_wiphy()
3501 if (!rdev->ops->set_txq_params) { in nl80211_set_wiphy()
3502 result = -EOPNOTSUPP; in nl80211_set_wiphy()
3507 result = -EINVAL; in nl80211_set_wiphy()
3511 if (netdev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && in nl80211_set_wiphy()
3512 netdev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) { in nl80211_set_wiphy()
3513 result = -EINVAL; in nl80211_set_wiphy()
3518 result = -ENETDOWN; in nl80211_set_wiphy()
3523 info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], in nl80211_set_wiphy()
3529 info->extack); in nl80211_set_wiphy()
3537 nl80211_link_id_or_invalid(info->attrs); in nl80211_set_wiphy()
3539 wdev_lock(netdev->ieee80211_ptr); in nl80211_set_wiphy()
3541 !(netdev->ieee80211_ptr->valid_links & in nl80211_set_wiphy()
3543 result = -ENOLINK; in nl80211_set_wiphy()
3545 !netdev->ieee80211_ptr->valid_links) in nl80211_set_wiphy()
3546 result = -EINVAL; in nl80211_set_wiphy()
3550 wdev_unlock(netdev->ieee80211_ptr); in nl80211_set_wiphy()
3556 if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { in nl80211_set_wiphy()
3557 int link_id = nl80211_link_id_or_invalid(info->attrs); in nl80211_set_wiphy()
3574 if (info->attrs[NL80211_ATTR_WIPHY_TX_POWER_SETTING]) { in nl80211_set_wiphy()
3579 if (!(rdev->wiphy.features & NL80211_FEATURE_VIF_TXPOWER)) in nl80211_set_wiphy()
3582 if (!rdev->ops->set_tx_power) { in nl80211_set_wiphy()
3583 result = -EOPNOTSUPP; in nl80211_set_wiphy()
3588 type = nla_get_u32(info->attrs[idx]); in nl80211_set_wiphy()
3590 if (!info->attrs[NL80211_ATTR_WIPHY_TX_POWER_LEVEL] && in nl80211_set_wiphy()
3592 result = -EINVAL; in nl80211_set_wiphy()
3598 mbm = nla_get_u32(info->attrs[idx]); in nl80211_set_wiphy()
3606 if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX] && in nl80211_set_wiphy()
3607 info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]) { in nl80211_set_wiphy()
3610 if ((!rdev->wiphy.available_antennas_tx && in nl80211_set_wiphy()
3611 !rdev->wiphy.available_antennas_rx) || in nl80211_set_wiphy()
3612 !rdev->ops->set_antenna) { in nl80211_set_wiphy()
3613 result = -EOPNOTSUPP; in nl80211_set_wiphy()
3617 tx_ant = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX]); in nl80211_set_wiphy()
3618 rx_ant = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]); in nl80211_set_wiphy()
3622 if ((~tx_ant && (tx_ant & ~rdev->wiphy.available_antennas_tx)) || in nl80211_set_wiphy()
3623 (~rx_ant && (rx_ant & ~rdev->wiphy.available_antennas_rx))) { in nl80211_set_wiphy()
3624 result = -EINVAL; in nl80211_set_wiphy()
3628 tx_ant = tx_ant & rdev->wiphy.available_antennas_tx; in nl80211_set_wiphy()
3629 rx_ant = rx_ant & rdev->wiphy.available_antennas_rx; in nl80211_set_wiphy()
3638 if (info->attrs[NL80211_ATTR_WIPHY_RETRY_SHORT]) { in nl80211_set_wiphy()
3640 info->attrs[NL80211_ATTR_WIPHY_RETRY_SHORT]); in nl80211_set_wiphy()
3645 if (info->attrs[NL80211_ATTR_WIPHY_RETRY_LONG]) { in nl80211_set_wiphy()
3647 info->attrs[NL80211_ATTR_WIPHY_RETRY_LONG]); in nl80211_set_wiphy()
3652 if (info->attrs[NL80211_ATTR_WIPHY_FRAG_THRESHOLD]) { in nl80211_set_wiphy()
3654 info->attrs[NL80211_ATTR_WIPHY_FRAG_THRESHOLD]); in nl80211_set_wiphy()
3656 result = -EINVAL; in nl80211_set_wiphy()
3660 if (frag_threshold != (u32) -1) { in nl80211_set_wiphy()
3672 if (info->attrs[NL80211_ATTR_WIPHY_RTS_THRESHOLD]) { in nl80211_set_wiphy()
3674 info->attrs[NL80211_ATTR_WIPHY_RTS_THRESHOLD]); in nl80211_set_wiphy()
3678 if (info->attrs[NL80211_ATTR_WIPHY_COVERAGE_CLASS]) { in nl80211_set_wiphy()
3679 if (info->attrs[NL80211_ATTR_WIPHY_DYN_ACK]) { in nl80211_set_wiphy()
3680 result = -EINVAL; in nl80211_set_wiphy()
3685 info->attrs[NL80211_ATTR_WIPHY_COVERAGE_CLASS]); in nl80211_set_wiphy()
3689 if (info->attrs[NL80211_ATTR_WIPHY_DYN_ACK]) { in nl80211_set_wiphy()
3690 if (!(rdev->wiphy.features & NL80211_FEATURE_ACKTO_ESTIMATION)) { in nl80211_set_wiphy()
3691 result = -EOPNOTSUPP; in nl80211_set_wiphy()
3698 if (info->attrs[NL80211_ATTR_TXQ_LIMIT]) { in nl80211_set_wiphy()
3699 if (!wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_set_wiphy()
3701 result = -EOPNOTSUPP; in nl80211_set_wiphy()
3705 info->attrs[NL80211_ATTR_TXQ_LIMIT]); in nl80211_set_wiphy()
3709 if (info->attrs[NL80211_ATTR_TXQ_MEMORY_LIMIT]) { in nl80211_set_wiphy()
3710 if (!wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_set_wiphy()
3712 result = -EOPNOTSUPP; in nl80211_set_wiphy()
3716 info->attrs[NL80211_ATTR_TXQ_MEMORY_LIMIT]); in nl80211_set_wiphy()
3720 if (info->attrs[NL80211_ATTR_TXQ_QUANTUM]) { in nl80211_set_wiphy()
3721 if (!wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_set_wiphy()
3723 result = -EOPNOTSUPP; in nl80211_set_wiphy()
3727 info->attrs[NL80211_ATTR_TXQ_QUANTUM]); in nl80211_set_wiphy()
3737 if (!rdev->ops->set_wiphy_params) { in nl80211_set_wiphy()
3738 result = -EOPNOTSUPP; in nl80211_set_wiphy()
3742 old_retry_short = rdev->wiphy.retry_short; in nl80211_set_wiphy()
3743 old_retry_long = rdev->wiphy.retry_long; in nl80211_set_wiphy()
3744 old_frag_threshold = rdev->wiphy.frag_threshold; in nl80211_set_wiphy()
3745 old_rts_threshold = rdev->wiphy.rts_threshold; in nl80211_set_wiphy()
3746 old_coverage_class = rdev->wiphy.coverage_class; in nl80211_set_wiphy()
3747 old_txq_limit = rdev->wiphy.txq_limit; in nl80211_set_wiphy()
3748 old_txq_memory_limit = rdev->wiphy.txq_memory_limit; in nl80211_set_wiphy()
3749 old_txq_quantum = rdev->wiphy.txq_quantum; in nl80211_set_wiphy()
3752 rdev->wiphy.retry_short = retry_short; in nl80211_set_wiphy()
3754 rdev->wiphy.retry_long = retry_long; in nl80211_set_wiphy()
3756 rdev->wiphy.frag_threshold = frag_threshold; in nl80211_set_wiphy()
3758 rdev->wiphy.rts_threshold = rts_threshold; in nl80211_set_wiphy()
3760 rdev->wiphy.coverage_class = coverage_class; in nl80211_set_wiphy()
3762 rdev->wiphy.txq_limit = txq_limit; in nl80211_set_wiphy()
3764 rdev->wiphy.txq_memory_limit = txq_memory_limit; in nl80211_set_wiphy()
3766 rdev->wiphy.txq_quantum = txq_quantum; in nl80211_set_wiphy()
3770 rdev->wiphy.retry_short = old_retry_short; in nl80211_set_wiphy()
3771 rdev->wiphy.retry_long = old_retry_long; in nl80211_set_wiphy()
3772 rdev->wiphy.frag_threshold = old_frag_threshold; in nl80211_set_wiphy()
3773 rdev->wiphy.rts_threshold = old_rts_threshold; in nl80211_set_wiphy()
3774 rdev->wiphy.coverage_class = old_coverage_class; in nl80211_set_wiphy()
3775 rdev->wiphy.txq_limit = old_txq_limit; in nl80211_set_wiphy()
3776 rdev->wiphy.txq_memory_limit = old_txq_memory_limit; in nl80211_set_wiphy()
3777 rdev->wiphy.txq_quantum = old_txq_quantum; in nl80211_set_wiphy()
3785 wiphy_unlock(&rdev->wiphy); in nl80211_set_wiphy()
3792 return -EINVAL; in nl80211_send_chandef()
3795 chandef->chan->center_freq)) in nl80211_send_chandef()
3796 return -ENOBUFS; in nl80211_send_chandef()
3798 chandef->chan->freq_offset)) in nl80211_send_chandef()
3799 return -ENOBUFS; in nl80211_send_chandef()
3800 switch (chandef->width) { in nl80211_send_chandef()
3806 return -ENOBUFS; in nl80211_send_chandef()
3811 if (nla_put_u32(msg, NL80211_ATTR_CHANNEL_WIDTH, chandef->width)) in nl80211_send_chandef()
3812 return -ENOBUFS; in nl80211_send_chandef()
3813 if (nla_put_u32(msg, NL80211_ATTR_CENTER_FREQ1, chandef->center_freq1)) in nl80211_send_chandef()
3814 return -ENOBUFS; in nl80211_send_chandef()
3815 if (chandef->center_freq2 && in nl80211_send_chandef()
3816 nla_put_u32(msg, NL80211_ATTR_CENTER_FREQ2, chandef->center_freq2)) in nl80211_send_chandef()
3817 return -ENOBUFS; in nl80211_send_chandef()
3827 struct net_device *dev = wdev->netdev; in nl80211_send_iface()
3836 return -1; in nl80211_send_iface()
3839 (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || in nl80211_send_iface()
3840 nla_put_string(msg, NL80211_ATTR_IFNAME, dev->name))) in nl80211_send_iface()
3843 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_send_iface()
3844 nla_put_u32(msg, NL80211_ATTR_IFTYPE, wdev->iftype) || in nl80211_send_iface()
3849 rdev->devlist_generation ^ in nl80211_send_iface()
3851 nla_put_u8(msg, NL80211_ATTR_4ADDR, wdev->use_4addr)) in nl80211_send_iface()
3854 if (rdev->ops->get_channel && !wdev->valid_links) { in nl80211_send_iface()
3863 if (rdev->ops->get_tx_power) { in nl80211_send_iface()
3874 switch (wdev->iftype) { in nl80211_send_iface()
3877 if (wdev->u.ap.ssid_len && in nl80211_send_iface()
3878 nla_put(msg, NL80211_ATTR_SSID, wdev->u.ap.ssid_len, in nl80211_send_iface()
3879 wdev->u.ap.ssid)) in nl80211_send_iface()
3884 if (wdev->u.client.ssid_len && in nl80211_send_iface()
3885 nla_put(msg, NL80211_ATTR_SSID, wdev->u.client.ssid_len, in nl80211_send_iface()
3886 wdev->u.client.ssid)) in nl80211_send_iface()
3890 if (wdev->u.ibss.ssid_len && in nl80211_send_iface()
3891 nla_put(msg, NL80211_ATTR_SSID, wdev->u.ibss.ssid_len, in nl80211_send_iface()
3892 wdev->u.ibss.ssid)) in nl80211_send_iface()
3901 if (rdev->ops->get_txq_stats) { in nl80211_send_iface()
3911 if (wdev->valid_links) { in nl80211_send_iface()
3930 wdev->links[link_id].addr)) in nl80211_send_iface()
3950 return -EMSGSIZE; in nl80211_send_iface()
3957 int wp_start = cb->args[0]; in nl80211_dump_interface()
3958 int if_start = cb->args[1]; in nl80211_dump_interface()
3959 int filter_wiphy = -1; in nl80211_dump_interface()
3965 if (!cb->args[2]) { in nl80211_dump_interface()
3967 .filter_wiphy = -1, in nl80211_dump_interface()
3977 * if filtering, set cb->args[2] to +1 since 0 is the default in nl80211_dump_interface()
3981 cb->args[2] = filter_wiphy + 1; in nl80211_dump_interface()
3983 cb->args[2] = -1; in nl80211_dump_interface()
3984 } else if (cb->args[2] > 0) { in nl80211_dump_interface()
3985 filter_wiphy = cb->args[2] - 1; in nl80211_dump_interface()
3989 if (!net_eq(wiphy_net(&rdev->wiphy), sock_net(skb->sk))) in nl80211_dump_interface()
3996 if (filter_wiphy >= 0 && filter_wiphy != rdev->wiphy_idx) in nl80211_dump_interface()
4001 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { in nl80211_dump_interface()
4006 if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).portid, in nl80211_dump_interface()
4007 cb->nlh->nlmsg_seq, NLM_F_MULTI, in nl80211_dump_interface()
4018 cb->args[0] = wp_idx; in nl80211_dump_interface()
4019 cb->args[1] = if_idx; in nl80211_dump_interface()
4021 ret = skb->len; in nl80211_dump_interface()
4031 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_get_interface()
4032 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_get_interface()
4036 return -ENOMEM; in nl80211_get_interface()
4038 if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0, in nl80211_get_interface()
4041 return -ENOBUFS; in nl80211_get_interface()
4064 return -EINVAL; in parse_monitor_flags()
4067 return -EINVAL; in parse_monitor_flags()
4086 if (info->attrs[NL80211_ATTR_MNTR_FLAGS]) { in nl80211_parse_mon_options()
4088 return -EINVAL; in nl80211_parse_mon_options()
4090 err = parse_monitor_flags(info->attrs[NL80211_ATTR_MNTR_FLAGS], in nl80211_parse_mon_options()
4091 ¶ms->flags); in nl80211_parse_mon_options()
4098 if (params->flags & MONITOR_FLAG_ACTIVE && in nl80211_parse_mon_options()
4099 !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR)) in nl80211_parse_mon_options()
4100 return -EOPNOTSUPP; in nl80211_parse_mon_options()
4102 if (info->attrs[NL80211_ATTR_MU_MIMO_GROUP_DATA]) { in nl80211_parse_mon_options()
4107 return -EINVAL; in nl80211_parse_mon_options()
4109 if (!wiphy_ext_feature_isset(&rdev->wiphy, cap_flag)) in nl80211_parse_mon_options()
4110 return -EOPNOTSUPP; in nl80211_parse_mon_options()
4113 nla_data(info->attrs[NL80211_ATTR_MU_MIMO_GROUP_DATA]); in nl80211_parse_mon_options()
4117 (mumimo_groups[VHT_MUMIMO_GROUPS_DATA_LEN - 1] & BIT(7))) in nl80211_parse_mon_options()
4118 return -EINVAL; in nl80211_parse_mon_options()
4120 params->vht_mumimo_groups = mumimo_groups; in nl80211_parse_mon_options()
4124 if (info->attrs[NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR]) { in nl80211_parse_mon_options()
4128 return -EINVAL; in nl80211_parse_mon_options()
4130 if (!wiphy_ext_feature_isset(&rdev->wiphy, cap_flag)) in nl80211_parse_mon_options()
4131 return -EOPNOTSUPP; in nl80211_parse_mon_options()
4133 params->vht_mumimo_follow_addr = in nl80211_parse_mon_options()
4134 nla_data(info->attrs[NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR]); in nl80211_parse_mon_options()
4147 return -EBUSY; in nl80211_valid_4addr()
4153 if (rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP) in nl80211_valid_4addr()
4157 if (rdev->wiphy.flags & WIPHY_FLAG_4ADDR_STATION) in nl80211_valid_4addr()
4164 return -EOPNOTSUPP; in nl80211_valid_4addr()
4169 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_interface()
4173 struct net_device *dev = info->user_ptr[1]; in nl80211_set_interface()
4178 otype = ntype = dev->ieee80211_ptr->iftype; in nl80211_set_interface()
4180 if (info->attrs[NL80211_ATTR_IFTYPE]) { in nl80211_set_interface()
4181 ntype = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]); in nl80211_set_interface()
4186 if (info->attrs[NL80211_ATTR_MESH_ID]) { in nl80211_set_interface()
4187 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_set_interface()
4190 return -EINVAL; in nl80211_set_interface()
4192 return -EBUSY; in nl80211_set_interface()
4197 wdev->u.mesh.id_up_len = in nl80211_set_interface()
4198 nla_len(info->attrs[NL80211_ATTR_MESH_ID]); in nl80211_set_interface()
4199 memcpy(wdev->u.mesh.id, in nl80211_set_interface()
4200 nla_data(info->attrs[NL80211_ATTR_MESH_ID]), in nl80211_set_interface()
4201 wdev->u.mesh.id_up_len); in nl80211_set_interface()
4205 if (info->attrs[NL80211_ATTR_4ADDR]) { in nl80211_set_interface()
4206 params.use_4addr = !!nla_get_u8(info->attrs[NL80211_ATTR_4ADDR]); in nl80211_set_interface()
4212 params.use_4addr = -1; in nl80211_set_interface()
4226 if (!err && params.use_4addr != -1) in nl80211_set_interface()
4227 dev->ieee80211_ptr->use_4addr = params.use_4addr; in nl80211_set_interface()
4230 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_set_interface()
4240 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in _nl80211_new_interface()
4249 if (!info->attrs[NL80211_ATTR_IFNAME]) in _nl80211_new_interface()
4250 return -EINVAL; in _nl80211_new_interface()
4252 if (info->attrs[NL80211_ATTR_IFTYPE]) in _nl80211_new_interface()
4253 type = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]); in _nl80211_new_interface()
4255 if (!rdev->ops->add_virtual_intf) in _nl80211_new_interface()
4256 return -EOPNOTSUPP; in _nl80211_new_interface()
4259 rdev->wiphy.features & NL80211_FEATURE_MAC_ON_CREATE) && in _nl80211_new_interface()
4260 info->attrs[NL80211_ATTR_MAC]) { in _nl80211_new_interface()
4261 nla_memcpy(params.macaddr, info->attrs[NL80211_ATTR_MAC], in _nl80211_new_interface()
4264 return -EADDRNOTAVAIL; in _nl80211_new_interface()
4267 if (info->attrs[NL80211_ATTR_4ADDR]) { in _nl80211_new_interface()
4268 params.use_4addr = !!nla_get_u8(info->attrs[NL80211_ATTR_4ADDR]); in _nl80211_new_interface()
4274 if (!cfg80211_iftype_allowed(&rdev->wiphy, type, params.use_4addr, 0)) in _nl80211_new_interface()
4275 return -EOPNOTSUPP; in _nl80211_new_interface()
4283 return -ENOMEM; in _nl80211_new_interface()
4286 nla_data(info->attrs[NL80211_ATTR_IFNAME]), in _nl80211_new_interface()
4290 return -EPROTO; in _nl80211_new_interface()
4296 if (info->attrs[NL80211_ATTR_SOCKET_OWNER]) in _nl80211_new_interface()
4297 wdev->owner_nlportid = info->snd_portid; in _nl80211_new_interface()
4301 if (!info->attrs[NL80211_ATTR_MESH_ID]) in _nl80211_new_interface()
4306 wdev->u.mesh.id_up_len = in _nl80211_new_interface()
4307 nla_len(info->attrs[NL80211_ATTR_MESH_ID]); in _nl80211_new_interface()
4308 memcpy(wdev->u.mesh.id, in _nl80211_new_interface()
4309 nla_data(info->attrs[NL80211_ATTR_MESH_ID]), in _nl80211_new_interface()
4310 wdev->u.mesh.id_up_len); in _nl80211_new_interface()
4326 if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0, in _nl80211_new_interface()
4329 return -ENOBUFS; in _nl80211_new_interface()
4337 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_new_interface()
4343 wiphy_lock(&rdev->wiphy); in nl80211_new_interface()
4345 wiphy_unlock(&rdev->wiphy); in nl80211_new_interface()
4352 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_del_interface()
4353 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_del_interface()
4355 if (!rdev->ops->del_virtual_intf) in nl80211_del_interface()
4356 return -EOPNOTSUPP; in nl80211_del_interface()
4367 mutex_unlock(&rdev->wiphy.mtx); in nl80211_del_interface()
4376 if (!wdev->netdev) in nl80211_del_interface()
4377 info->user_ptr[1] = NULL; in nl80211_del_interface()
4379 dev_close(wdev->netdev); in nl80211_del_interface()
4381 mutex_lock(&rdev->wiphy.mtx); in nl80211_del_interface()
4388 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_noack_map()
4389 struct net_device *dev = info->user_ptr[1]; in nl80211_set_noack_map()
4392 if (!info->attrs[NL80211_ATTR_NOACK_MAP]) in nl80211_set_noack_map()
4393 return -EINVAL; in nl80211_set_noack_map()
4395 if (!rdev->ops->set_noack_map) in nl80211_set_noack_map()
4396 return -EOPNOTSUPP; in nl80211_set_noack_map()
4398 noack_map = nla_get_u16(info->attrs[NL80211_ATTR_NOACK_MAP]); in nl80211_set_noack_map()
4408 if (link_id != -1) { in nl80211_validate_key_link_id()
4411 return -EINVAL; in nl80211_validate_key_link_id()
4417 if (wdev->valid_links) { in nl80211_validate_key_link_id()
4418 if (link_id == -1) { in nl80211_validate_key_link_id()
4421 return -EINVAL; in nl80211_validate_key_link_id()
4423 if (!(wdev->valid_links & BIT(link_id))) { in nl80211_validate_key_link_id()
4425 return -EINVAL; in nl80211_validate_key_link_id()
4427 } else if (link_id != -1) { in nl80211_validate_key_link_id()
4428 GENL_SET_ERR_MSG(info, "link ID not allowed for non-MLO group key"); in nl80211_validate_key_link_id()
4429 return -EINVAL; in nl80211_validate_key_link_id()
4446 if ((params->key && in get_key_callback()
4447 nla_put(cookie->msg, NL80211_ATTR_KEY_DATA, in get_key_callback()
4448 params->key_len, params->key)) || in get_key_callback()
4449 (params->seq && in get_key_callback()
4450 nla_put(cookie->msg, NL80211_ATTR_KEY_SEQ, in get_key_callback()
4451 params->seq_len, params->seq)) || in get_key_callback()
4452 (params->cipher && in get_key_callback()
4453 nla_put_u32(cookie->msg, NL80211_ATTR_KEY_CIPHER, in get_key_callback()
4454 params->cipher))) in get_key_callback()
4457 key = nla_nest_start_noflag(cookie->msg, NL80211_ATTR_KEY); in get_key_callback()
4461 if ((params->key && in get_key_callback()
4462 nla_put(cookie->msg, NL80211_KEY_DATA, in get_key_callback()
4463 params->key_len, params->key)) || in get_key_callback()
4464 (params->seq && in get_key_callback()
4465 nla_put(cookie->msg, NL80211_KEY_SEQ, in get_key_callback()
4466 params->seq_len, params->seq)) || in get_key_callback()
4467 (params->cipher && in get_key_callback()
4468 nla_put_u32(cookie->msg, NL80211_KEY_CIPHER, in get_key_callback()
4469 params->cipher))) in get_key_callback()
4472 if (nla_put_u8(cookie->msg, NL80211_KEY_IDX, cookie->idx)) in get_key_callback()
4475 nla_nest_end(cookie->msg, key); in get_key_callback()
4479 cookie->error = 1; in get_key_callback()
4484 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_get_key()
4486 struct net_device *dev = info->user_ptr[1]; in nl80211_get_key()
4496 int link_id = nl80211_link_id_or_invalid(info->attrs); in nl80211_get_key()
4497 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_get_key()
4499 if (wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_get_key()
4503 if ((wdev->iftype == NL80211_IFTYPE_STATION || in nl80211_get_key()
4504 wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) && in nl80211_get_key()
4505 wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_get_key()
4509 if (info->attrs[NL80211_ATTR_KEY_IDX]) { in nl80211_get_key()
4510 key_idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]); in nl80211_get_key()
4514 return -EINVAL; in nl80211_get_key()
4518 if (info->attrs[NL80211_ATTR_MAC]) in nl80211_get_key()
4519 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_get_key()
4522 if (info->attrs[NL80211_ATTR_KEY_TYPE]) { in nl80211_get_key()
4523 u32 kt = nla_get_u32(info->attrs[NL80211_ATTR_KEY_TYPE]); in nl80211_get_key()
4527 return -EINVAL; in nl80211_get_key()
4531 if (!rdev->ops->get_key) in nl80211_get_key()
4532 return -EOPNOTSUPP; in nl80211_get_key()
4534 if (!pairwise && mac_addr && !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) in nl80211_get_key()
4535 return -ENOENT; in nl80211_get_key()
4539 return -ENOMEM; in nl80211_get_key()
4541 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, in nl80211_get_key()
4549 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || in nl80211_get_key()
4573 err = -ENOBUFS; in nl80211_get_key()
4581 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_key()
4584 struct net_device *dev = info->user_ptr[1]; in nl80211_set_key()
4585 int link_id = nl80211_link_id_or_invalid(info->attrs); in nl80211_set_key()
4586 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_set_key()
4593 return -EINVAL; in nl80211_set_key()
4600 return -EINVAL; in nl80211_set_key()
4605 if (!rdev->ops->set_default_key) { in nl80211_set_key()
4606 err = -EOPNOTSUPP; in nl80211_set_key()
4625 wdev->wext.default_key = key.idx; in nl80211_set_key()
4629 err = -EINVAL; in nl80211_set_key()
4633 if (!rdev->ops->set_default_mgmt_key) { in nl80211_set_key()
4634 err = -EOPNOTSUPP; in nl80211_set_key()
4651 wdev->wext.default_mgmt_key = key.idx; in nl80211_set_key()
4655 err = -EINVAL; in nl80211_set_key()
4659 if (!rdev->ops->set_default_beacon_key) { in nl80211_set_key()
4660 err = -EOPNOTSUPP; in nl80211_set_key()
4676 wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_set_key()
4680 if (info->attrs[NL80211_ATTR_MAC]) in nl80211_set_key()
4681 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_set_key()
4684 err = -EINVAL; in nl80211_set_key()
4696 err = -EINVAL; in nl80211_set_key()
4706 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_new_key()
4708 struct net_device *dev = info->user_ptr[1]; in nl80211_new_key()
4711 int link_id = nl80211_link_id_or_invalid(info->attrs); in nl80211_new_key()
4712 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_new_key()
4720 return -EINVAL; in nl80211_new_key()
4723 if (info->attrs[NL80211_ATTR_MAC]) in nl80211_new_key()
4724 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_new_key()
4726 if (key.type == -1) { in nl80211_new_key()
4737 return -EINVAL; in nl80211_new_key()
4741 info->attrs[NL80211_ATTR_VLAN_ID]) in nl80211_new_key()
4742 key.p.vlan_id = nla_get_u16(info->attrs[NL80211_ATTR_VLAN_ID]); in nl80211_new_key()
4744 if (!rdev->ops->add_key) in nl80211_new_key()
4745 return -EOPNOTSUPP; in nl80211_new_key()
4751 return -EINVAL; in nl80211_new_key()
4777 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_del_key()
4779 struct net_device *dev = info->user_ptr[1]; in nl80211_del_key()
4782 int link_id = nl80211_link_id_or_invalid(info->attrs); in nl80211_del_key()
4783 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_del_key()
4789 if (info->attrs[NL80211_ATTR_MAC]) in nl80211_del_key()
4790 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_del_key()
4792 if (key.type == -1) { in nl80211_del_key()
4802 return -EINVAL; in nl80211_del_key()
4806 return -EINVAL; in nl80211_del_key()
4808 if (!rdev->ops->del_key) in nl80211_del_key()
4809 return -EOPNOTSUPP; in nl80211_del_key()
4815 !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) in nl80211_del_key()
4816 err = -ENOENT; in nl80211_del_key()
4829 if (key.idx == wdev->wext.default_key) in nl80211_del_key()
4830 wdev->wext.default_key = -1; in nl80211_del_key()
4831 else if (key.idx == wdev->wext.default_mgmt_key) in nl80211_del_key()
4832 wdev->wext.default_mgmt_key = -1; in nl80211_del_key()
4848 return -EINVAL; in validate_acl_mac_addrs()
4869 if (!wiphy->max_acl_mac_addrs) in parse_acl_data()
4870 return ERR_PTR(-EOPNOTSUPP); in parse_acl_data()
4872 if (!info->attrs[NL80211_ATTR_ACL_POLICY]) in parse_acl_data()
4873 return ERR_PTR(-EINVAL); in parse_acl_data()
4875 acl_policy = nla_get_u32(info->attrs[NL80211_ATTR_ACL_POLICY]); in parse_acl_data()
4878 return ERR_PTR(-EINVAL); in parse_acl_data()
4880 if (!info->attrs[NL80211_ATTR_MAC_ADDRS]) in parse_acl_data()
4881 return ERR_PTR(-EINVAL); in parse_acl_data()
4883 n_entries = validate_acl_mac_addrs(info->attrs[NL80211_ATTR_MAC_ADDRS]); in parse_acl_data()
4887 if (n_entries > wiphy->max_acl_mac_addrs) in parse_acl_data()
4888 return ERR_PTR(-ENOTSUPP); in parse_acl_data()
4892 return ERR_PTR(-ENOMEM); in parse_acl_data()
4893 acl->n_acl_entries = n_entries; in parse_acl_data()
4895 nla_for_each_nested(attr, info->attrs[NL80211_ATTR_MAC_ADDRS], tmp) { in parse_acl_data()
4896 memcpy(acl->mac_addrs[i].addr, nla_data(attr), ETH_ALEN); in parse_acl_data()
4899 acl->acl_policy = acl_policy; in parse_acl_data()
4906 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_mac_acl()
4907 struct net_device *dev = info->user_ptr[1]; in nl80211_set_mac_acl()
4911 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && in nl80211_set_mac_acl()
4912 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) in nl80211_set_mac_acl()
4913 return -EOPNOTSUPP; in nl80211_set_mac_acl()
4915 if (!dev->ieee80211_ptr->links[0].ap.beacon_interval) in nl80211_set_mac_acl()
4916 return -EINVAL; in nl80211_set_mac_acl()
4918 acl = parse_acl_data(&rdev->wiphy, info); in nl80211_set_mac_acl()
4939 for (ridx = 0; ridx < sband->n_bitrates; ridx++) { in rateset_to_mask()
4941 &sband->bitrates[ridx]; in rateset_to_mask()
4942 if (rate == srate->bitrate) { in rateset_to_mask()
4947 if (ridx == sband->n_bitrates) in rateset_to_mask()
4974 if (sband->ht_cap.mcs.rx_mask[ridx] & rbit) in ht_rateset_to_mask()
5021 u16 tx_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map); in vht_set_mcs_mask()
5025 if (!sband->vht_cap.vht_supported) in vht_set_mcs_mask()
5034 if ((tx_mcs_mask[i] & txrate->mcs[i]) == txrate->mcs[i]) in vht_set_mcs_mask()
5035 mcs[i] = txrate->mcs[i]; in vht_set_mcs_mask()
5074 struct net_device *dev = info->user_ptr[1]; in he_get_txmcsmap()
5075 struct wireless_dev *wdev = dev->ieee80211_ptr; in he_get_txmcsmap()
5085 return le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_80); in he_get_txmcsmap()
5088 switch (chandef->width) { in he_get_txmcsmap()
5090 tx_mcs = he_cap->he_mcs_nss_supp.tx_mcs_80p80; in he_get_txmcsmap()
5093 tx_mcs = he_cap->he_mcs_nss_supp.tx_mcs_160; in he_get_txmcsmap()
5096 tx_mcs = he_cap->he_mcs_nss_supp.tx_mcs_80; in he_get_txmcsmap()
5115 he_cap = ieee80211_get_he_iftype_cap(sband, wdev->iftype); in he_set_mcs_mask()
5127 if ((tx_mcs_mask[i] & txrate->mcs[i]) == txrate->mcs[i]) in he_set_mcs_mask()
5128 mcs[i] = txrate->mcs[i]; in he_set_mcs_mask()
5145 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_parse_tx_bitrate_mask()
5146 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_parse_tx_bitrate_mask()
5160 sband = rdev->wiphy.bands[i]; in nl80211_parse_tx_bitrate_mask()
5165 mask->control[i].legacy = (1 << sband->n_bitrates) - 1; in nl80211_parse_tx_bitrate_mask()
5166 memcpy(mask->control[i].ht_mcs, in nl80211_parse_tx_bitrate_mask()
5167 sband->ht_cap.mcs.rx_mask, in nl80211_parse_tx_bitrate_mask()
5168 sizeof(mask->control[i].ht_mcs)); in nl80211_parse_tx_bitrate_mask()
5170 if (sband->vht_cap.vht_supported) { in nl80211_parse_tx_bitrate_mask()
5171 vht_tx_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map); in nl80211_parse_tx_bitrate_mask()
5172 vht_build_mcs_mask(vht_tx_mcs_map, mask->control[i].vht_mcs); in nl80211_parse_tx_bitrate_mask()
5175 he_cap = ieee80211_get_he_iftype_cap(sband, wdev->iftype); in nl80211_parse_tx_bitrate_mask()
5180 he_build_mcs_mask(he_tx_mcs_map, mask->control[i].he_mcs); in nl80211_parse_tx_bitrate_mask()
5182 mask->control[i].he_gi = 0xFF; in nl80211_parse_tx_bitrate_mask()
5183 mask->control[i].he_ltf = 0xFF; in nl80211_parse_tx_bitrate_mask()
5199 return -EINVAL; in nl80211_parse_tx_bitrate_mask()
5200 sband = rdev->wiphy.bands[band]; in nl80211_parse_tx_bitrate_mask()
5202 return -EINVAL; in nl80211_parse_tx_bitrate_mask()
5206 info->extack); in nl80211_parse_tx_bitrate_mask()
5210 mask->control[band].legacy = rateset_to_mask( in nl80211_parse_tx_bitrate_mask()
5214 if ((mask->control[band].legacy == 0) && in nl80211_parse_tx_bitrate_mask()
5216 return -EINVAL; in nl80211_parse_tx_bitrate_mask()
5223 mask->control[band].ht_mcs)) in nl80211_parse_tx_bitrate_mask()
5224 return -EINVAL; in nl80211_parse_tx_bitrate_mask()
5231 mask->control[band].vht_mcs)) in nl80211_parse_tx_bitrate_mask()
5232 return -EINVAL; in nl80211_parse_tx_bitrate_mask()
5236 mask->control[band].gi = in nl80211_parse_tx_bitrate_mask()
5238 if (mask->control[band].gi > NL80211_TXRATE_FORCE_LGI) in nl80211_parse_tx_bitrate_mask()
5239 return -EINVAL; in nl80211_parse_tx_bitrate_mask()
5244 mask->control[band].he_mcs, in nl80211_parse_tx_bitrate_mask()
5246 return -EINVAL; in nl80211_parse_tx_bitrate_mask()
5249 mask->control[band].he_gi = in nl80211_parse_tx_bitrate_mask()
5252 mask->control[band].he_ltf = in nl80211_parse_tx_bitrate_mask()
5255 if (mask->control[band].legacy == 0) { in nl80211_parse_tx_bitrate_mask()
5259 if (!(rdev->wiphy.bands[band]->ht_cap.ht_supported || in nl80211_parse_tx_bitrate_mask()
5260 rdev->wiphy.bands[band]->vht_cap.vht_supported || in nl80211_parse_tx_bitrate_mask()
5261 ieee80211_get_he_iftype_cap(sband, wdev->iftype))) in nl80211_parse_tx_bitrate_mask()
5262 return -EINVAL; in nl80211_parse_tx_bitrate_mask()
5265 if (mask->control[band].ht_mcs[i]) in nl80211_parse_tx_bitrate_mask()
5269 if (mask->control[band].vht_mcs[i]) in nl80211_parse_tx_bitrate_mask()
5273 if (mask->control[band].he_mcs[i]) in nl80211_parse_tx_bitrate_mask()
5277 return -EINVAL; in nl80211_parse_tx_bitrate_mask()
5290 u32 rate = beacon_rate->control[band].legacy; in validate_beacon_tx_rate()
5294 return -EINVAL; in validate_beacon_tx_rate()
5298 if (hweight8(beacon_rate->control[band].ht_mcs[i]) > 1) { in validate_beacon_tx_rate()
5299 return -EINVAL; in validate_beacon_tx_rate()
5300 } else if (beacon_rate->control[band].ht_mcs[i]) { in validate_beacon_tx_rate()
5303 return -EINVAL; in validate_beacon_tx_rate()
5306 return -EINVAL; in validate_beacon_tx_rate()
5311 if (hweight16(beacon_rate->control[band].vht_mcs[i]) > 1) { in validate_beacon_tx_rate()
5312 return -EINVAL; in validate_beacon_tx_rate()
5313 } else if (beacon_rate->control[band].vht_mcs[i]) { in validate_beacon_tx_rate()
5316 return -EINVAL; in validate_beacon_tx_rate()
5319 return -EINVAL; in validate_beacon_tx_rate()
5324 if (hweight16(beacon_rate->control[band].he_mcs[i]) > 1) { in validate_beacon_tx_rate()
5325 return -EINVAL; in validate_beacon_tx_rate()
5326 } else if (beacon_rate->control[band].he_mcs[i]) { in validate_beacon_tx_rate()
5329 return -EINVAL; in validate_beacon_tx_rate()
5332 return -EINVAL; in validate_beacon_tx_rate()
5337 return -EINVAL; in validate_beacon_tx_rate()
5340 !wiphy_ext_feature_isset(&rdev->wiphy, in validate_beacon_tx_rate()
5342 return -EINVAL; in validate_beacon_tx_rate()
5344 !wiphy_ext_feature_isset(&rdev->wiphy, in validate_beacon_tx_rate()
5346 return -EINVAL; in validate_beacon_tx_rate()
5348 !wiphy_ext_feature_isset(&rdev->wiphy, in validate_beacon_tx_rate()
5350 return -EINVAL; in validate_beacon_tx_rate()
5352 !wiphy_ext_feature_isset(&rdev->wiphy, in validate_beacon_tx_rate()
5354 return -EINVAL; in validate_beacon_tx_rate()
5367 if (!wiphy->mbssid_max_interfaces) in nl80211_parse_mbssid_config()
5368 return -EOPNOTSUPP; in nl80211_parse_mbssid_config()
5373 return -EINVAL; in nl80211_parse_mbssid_config()
5375 config->ema = nla_get_flag(tb[NL80211_MBSSID_CONFIG_ATTR_EMA]); in nl80211_parse_mbssid_config()
5376 if (config->ema) { in nl80211_parse_mbssid_config()
5377 if (!wiphy->ema_max_profile_periodicity) in nl80211_parse_mbssid_config()
5378 return -EOPNOTSUPP; in nl80211_parse_mbssid_config()
5380 if (num_elems > wiphy->ema_max_profile_periodicity) in nl80211_parse_mbssid_config()
5381 return -EINVAL; in nl80211_parse_mbssid_config()
5384 config->index = nla_get_u8(tb[NL80211_MBSSID_CONFIG_ATTR_INDEX]); in nl80211_parse_mbssid_config()
5385 if (config->index >= wiphy->mbssid_max_interfaces || in nl80211_parse_mbssid_config()
5386 (!config->index && !num_elems)) in nl80211_parse_mbssid_config()
5387 return -EINVAL; in nl80211_parse_mbssid_config()
5393 if ((!config->index && tx_ifindex != dev->ifindex) || in nl80211_parse_mbssid_config()
5394 (config->index && tx_ifindex == dev->ifindex)) in nl80211_parse_mbssid_config()
5395 return -EINVAL; in nl80211_parse_mbssid_config()
5397 if (tx_ifindex != dev->ifindex) { in nl80211_parse_mbssid_config()
5401 if (!tx_netdev || !tx_netdev->ieee80211_ptr || in nl80211_parse_mbssid_config()
5402 tx_netdev->ieee80211_ptr->wiphy != wiphy || in nl80211_parse_mbssid_config()
5403 tx_netdev->ieee80211_ptr->iftype != in nl80211_parse_mbssid_config()
5406 return -EINVAL; in nl80211_parse_mbssid_config()
5409 config->tx_wdev = tx_netdev->ieee80211_ptr; in nl80211_parse_mbssid_config()
5411 config->tx_wdev = dev->ieee80211_ptr; in nl80211_parse_mbssid_config()
5413 } else if (!config->index) { in nl80211_parse_mbssid_config()
5414 config->tx_wdev = dev->ieee80211_ptr; in nl80211_parse_mbssid_config()
5416 return -EINVAL; in nl80211_parse_mbssid_config()
5430 if (!wiphy->mbssid_max_interfaces) in nl80211_parse_mbssid_elems()
5431 return ERR_PTR(-EINVAL); in nl80211_parse_mbssid_elems()
5435 return ERR_PTR(-EINVAL); in nl80211_parse_mbssid_elems()
5441 return ERR_PTR(-ENOMEM); in nl80211_parse_mbssid_elems()
5442 elems->cnt = num_elems; in nl80211_parse_mbssid_elems()
5445 elems->elem[i].data = nla_data(nl_elems); in nl80211_parse_mbssid_elems()
5446 elems->elem[i].len = nla_len(nl_elems); in nl80211_parse_mbssid_elems()
5473 return ERR_PTR(-ENOMEM); in nl80211_parse_rnr_elems()
5474 elems->cnt = num_elems; in nl80211_parse_rnr_elems()
5477 elems->elem[i].data = nla_data(nl_elems); in nl80211_parse_rnr_elems()
5478 elems->elem[i].len = nla_len(nl_elems); in nl80211_parse_rnr_elems()
5496 return -EINVAL; in nl80211_parse_he_bss_color()
5498 he_bss_color->color = in nl80211_parse_he_bss_color()
5500 he_bss_color->enabled = in nl80211_parse_he_bss_color()
5502 he_bss_color->partial = in nl80211_parse_he_bss_color()
5518 bcn->link_id = nl80211_link_id(attrs); in nl80211_parse_beacon()
5521 bcn->head = nla_data(attrs[NL80211_ATTR_BEACON_HEAD]); in nl80211_parse_beacon()
5522 bcn->head_len = nla_len(attrs[NL80211_ATTR_BEACON_HEAD]); in nl80211_parse_beacon()
5523 if (!bcn->head_len) in nl80211_parse_beacon()
5524 return -EINVAL; in nl80211_parse_beacon()
5529 bcn->tail = nla_data(attrs[NL80211_ATTR_BEACON_TAIL]); in nl80211_parse_beacon()
5530 bcn->tail_len = nla_len(attrs[NL80211_ATTR_BEACON_TAIL]); in nl80211_parse_beacon()
5535 return -EINVAL; in nl80211_parse_beacon()
5538 bcn->beacon_ies = nla_data(attrs[NL80211_ATTR_IE]); in nl80211_parse_beacon()
5539 bcn->beacon_ies_len = nla_len(attrs[NL80211_ATTR_IE]); in nl80211_parse_beacon()
5543 bcn->proberesp_ies = in nl80211_parse_beacon()
5545 bcn->proberesp_ies_len = in nl80211_parse_beacon()
5550 bcn->assocresp_ies = in nl80211_parse_beacon()
5552 bcn->assocresp_ies_len = in nl80211_parse_beacon()
5557 bcn->probe_resp = nla_data(attrs[NL80211_ATTR_PROBE_RESP]); in nl80211_parse_beacon()
5558 bcn->probe_resp_len = nla_len(attrs[NL80211_ATTR_PROBE_RESP]); in nl80211_parse_beacon()
5572 wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_parse_beacon()
5574 bcn->ftm_responder = 1; in nl80211_parse_beacon()
5576 return -EOPNOTSUPP; in nl80211_parse_beacon()
5579 bcn->lci = nla_data(tb[NL80211_FTM_RESP_ATTR_LCI]); in nl80211_parse_beacon()
5580 bcn->lci_len = nla_len(tb[NL80211_FTM_RESP_ATTR_LCI]); in nl80211_parse_beacon()
5584 bcn->civicloc = nla_data(tb[NL80211_FTM_RESP_ATTR_CIVICLOC]); in nl80211_parse_beacon()
5585 bcn->civicloc_len = nla_len(tb[NL80211_FTM_RESP_ATTR_CIVICLOC]); in nl80211_parse_beacon()
5588 bcn->ftm_responder = -1; in nl80211_parse_beacon()
5593 &bcn->he_bss_color); in nl80211_parse_beacon()
5596 bcn->he_bss_color_valid = true; in nl80211_parse_beacon()
5601 nl80211_parse_mbssid_elems(&rdev->wiphy, in nl80211_parse_beacon()
5607 bcn->mbssid_ies = mbssid; in nl80211_parse_beacon()
5609 if (bcn->mbssid_ies && attrs[NL80211_ATTR_EMA_RNR_ELEMS]) { in nl80211_parse_beacon()
5611 nl80211_parse_rnr_elems(&rdev->wiphy, in nl80211_parse_beacon()
5618 if (rnr && rnr->cnt < bcn->mbssid_ies->cnt) in nl80211_parse_beacon()
5619 return -EINVAL; in nl80211_parse_beacon()
5621 bcn->rnr_ies = rnr; in nl80211_parse_beacon()
5640 return -EINVAL; in nl80211_parse_he_obss_pd()
5642 he_obss_pd->sr_ctrl = nla_get_u8(tb[NL80211_HE_OBSS_PD_ATTR_SR_CTRL]); in nl80211_parse_he_obss_pd()
5645 he_obss_pd->min_offset = in nl80211_parse_he_obss_pd()
5648 he_obss_pd->max_offset = in nl80211_parse_he_obss_pd()
5651 he_obss_pd->non_srg_max_offset = in nl80211_parse_he_obss_pd()
5654 if (he_obss_pd->min_offset > he_obss_pd->max_offset) in nl80211_parse_he_obss_pd()
5655 return -EINVAL; in nl80211_parse_he_obss_pd()
5658 memcpy(he_obss_pd->bss_color_bitmap, in nl80211_parse_he_obss_pd()
5660 sizeof(he_obss_pd->bss_color_bitmap)); in nl80211_parse_he_obss_pd()
5663 memcpy(he_obss_pd->partial_bssid_bitmap, in nl80211_parse_he_obss_pd()
5665 sizeof(he_obss_pd->partial_bssid_bitmap)); in nl80211_parse_he_obss_pd()
5667 he_obss_pd->enable = true; in nl80211_parse_he_obss_pd()
5678 struct cfg80211_fils_discovery *fd = ¶ms->fils_discovery; in nl80211_parse_fils_discovery()
5680 if (!wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_parse_fils_discovery()
5682 return -EINVAL; in nl80211_parse_fils_discovery()
5692 return -EINVAL; in nl80211_parse_fils_discovery()
5694 fd->tmpl_len = nla_len(tb[NL80211_FILS_DISCOVERY_ATTR_TMPL]); in nl80211_parse_fils_discovery()
5695 fd->tmpl = nla_data(tb[NL80211_FILS_DISCOVERY_ATTR_TMPL]); in nl80211_parse_fils_discovery()
5696 fd->min_interval = nla_get_u32(tb[NL80211_FILS_DISCOVERY_ATTR_INT_MIN]); in nl80211_parse_fils_discovery()
5697 fd->max_interval = nla_get_u32(tb[NL80211_FILS_DISCOVERY_ATTR_INT_MAX]); in nl80211_parse_fils_discovery()
5710 ¶ms->unsol_bcast_probe_resp; in nl80211_parse_unsol_bcast_probe_resp()
5712 if (!wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_parse_unsol_bcast_probe_resp()
5714 return -EINVAL; in nl80211_parse_unsol_bcast_probe_resp()
5723 return -EINVAL; in nl80211_parse_unsol_bcast_probe_resp()
5725 presp->tmpl = nla_data(tb[NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_TMPL]); in nl80211_parse_unsol_bcast_probe_resp()
5726 presp->tmpl_len = nla_len(tb[NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_TMPL]); in nl80211_parse_unsol_bcast_probe_resp()
5727 presp->interval = nla_get_u32(tb[NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INT]); in nl80211_parse_unsol_bcast_probe_resp()
5739 for (i = 0; i < rates->datalen; i++) { in nl80211_check_ap_rate_selectors()
5740 if (rates->data[i] == BSS_MEMBERSHIP_SELECTOR_HT_PHY) in nl80211_check_ap_rate_selectors()
5741 params->ht_required = true; in nl80211_check_ap_rate_selectors()
5742 if (rates->data[i] == BSS_MEMBERSHIP_SELECTOR_VHT_PHY) in nl80211_check_ap_rate_selectors()
5743 params->vht_required = true; in nl80211_check_ap_rate_selectors()
5744 if (rates->data[i] == BSS_MEMBERSHIP_SELECTOR_HE_PHY) in nl80211_check_ap_rate_selectors()
5745 params->he_required = true; in nl80211_check_ap_rate_selectors()
5746 if (rates->data[i] == BSS_MEMBERSHIP_SELECTOR_SAE_H2E) in nl80211_check_ap_rate_selectors()
5747 params->sae_h2e_required = true; in nl80211_check_ap_rate_selectors()
5758 const struct cfg80211_beacon_data *bcn = ¶ms->beacon; in nl80211_calculate_ap_params()
5759 size_t ies_len = bcn->tail_len; in nl80211_calculate_ap_params()
5760 const u8 *ies = bcn->tail; in nl80211_calculate_ap_params()
5771 if (cap && cap->datalen >= sizeof(*params->ht_cap)) in nl80211_calculate_ap_params()
5772 params->ht_cap = (void *)cap->data; in nl80211_calculate_ap_params()
5774 if (cap && cap->datalen >= sizeof(*params->vht_cap)) in nl80211_calculate_ap_params()
5775 params->vht_cap = (void *)cap->data; in nl80211_calculate_ap_params()
5777 if (cap && cap->datalen >= sizeof(*params->he_cap) + 1) in nl80211_calculate_ap_params()
5778 params->he_cap = (void *)(cap->data + 1); in nl80211_calculate_ap_params()
5780 if (cap && cap->datalen >= sizeof(*params->he_oper) + 1) in nl80211_calculate_ap_params()
5781 params->he_oper = (void *)(cap->data + 1); in nl80211_calculate_ap_params()
5784 if (!cap->datalen) in nl80211_calculate_ap_params()
5785 return -EINVAL; in nl80211_calculate_ap_params()
5786 params->eht_cap = (void *)(cap->data + 1); in nl80211_calculate_ap_params()
5787 if (!ieee80211_eht_capa_size_ok((const u8 *)params->he_cap, in nl80211_calculate_ap_params()
5788 (const u8 *)params->eht_cap, in nl80211_calculate_ap_params()
5789 cap->datalen - 1, true)) in nl80211_calculate_ap_params()
5790 return -EINVAL; in nl80211_calculate_ap_params()
5794 if (!cap->datalen) in nl80211_calculate_ap_params()
5795 return -EINVAL; in nl80211_calculate_ap_params()
5796 params->eht_oper = (void *)(cap->data + 1); in nl80211_calculate_ap_params()
5797 if (!ieee80211_eht_oper_size_ok((const u8 *)params->eht_oper, in nl80211_calculate_ap_params()
5798 cap->datalen - 1)) in nl80211_calculate_ap_params()
5799 return -EINVAL; in nl80211_calculate_ap_params()
5809 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { in nl80211_get_ap_channel()
5810 if (wdev->iftype != NL80211_IFTYPE_AP && in nl80211_get_ap_channel()
5811 wdev->iftype != NL80211_IFTYPE_P2P_GO) in nl80211_get_ap_channel()
5814 if (!wdev->u.ap.preset_chandef.chan) in nl80211_get_ap_channel()
5817 params->chandef = wdev->u.ap.preset_chandef; in nl80211_get_ap_channel()
5833 if (!(rdev->wiphy.features & NL80211_FEATURE_SAE) && in nl80211_valid_auth_type()
5836 if (!wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_valid_auth_type()
5844 if (!(rdev->wiphy.features & NL80211_FEATURE_SAE) && in nl80211_valid_auth_type()
5845 !wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_valid_auth_type()
5855 &rdev->wiphy, in nl80211_valid_auth_type()
5861 if (!wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_valid_auth_type()
5879 struct wiphy *wiphy = wdev->wiphy; in nl80211_send_ap_started()
5892 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_send_ap_started()
5893 nla_put_u32(msg, NL80211_ATTR_IFINDEX, wdev->netdev->ifindex) || in nl80211_send_ap_started()
5896 (wdev->u.ap.ssid_len && in nl80211_send_ap_started()
5897 nla_put(msg, NL80211_ATTR_SSID, wdev->u.ap.ssid_len, in nl80211_send_ap_started()
5898 wdev->u.ap.ssid)) || in nl80211_send_ap_started()
5899 (wdev->valid_links && in nl80211_send_ap_started()
5914 struct ieee80211_channel *channel = params->chandef.chan; in nl80211_validate_ap_phy_operation()
5916 if ((params->he_cap || params->he_oper) && in nl80211_validate_ap_phy_operation()
5917 (channel->flags & IEEE80211_CHAN_NO_HE)) in nl80211_validate_ap_phy_operation()
5918 return -EOPNOTSUPP; in nl80211_validate_ap_phy_operation()
5920 if ((params->eht_cap || params->eht_oper) && in nl80211_validate_ap_phy_operation()
5921 (channel->flags & IEEE80211_CHAN_NO_EHT)) in nl80211_validate_ap_phy_operation()
5922 return -EOPNOTSUPP; in nl80211_validate_ap_phy_operation()
5929 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_start_ap()
5930 unsigned int link_id = nl80211_link_id(info->attrs); in nl80211_start_ap()
5931 struct net_device *dev = info->user_ptr[1]; in nl80211_start_ap()
5932 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_start_ap()
5936 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && in nl80211_start_ap()
5937 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) in nl80211_start_ap()
5938 return -EOPNOTSUPP; in nl80211_start_ap()
5940 if (!rdev->ops->start_ap) in nl80211_start_ap()
5941 return -EOPNOTSUPP; in nl80211_start_ap()
5943 if (wdev->links[link_id].ap.beacon_interval) in nl80211_start_ap()
5944 return -EALREADY; in nl80211_start_ap()
5947 if (!info->attrs[NL80211_ATTR_BEACON_INTERVAL] || in nl80211_start_ap()
5948 !info->attrs[NL80211_ATTR_DTIM_PERIOD] || in nl80211_start_ap()
5949 !info->attrs[NL80211_ATTR_BEACON_HEAD]) in nl80211_start_ap()
5950 return -EINVAL; in nl80211_start_ap()
5954 return -ENOMEM; in nl80211_start_ap()
5956 err = nl80211_parse_beacon(rdev, info->attrs, ¶ms->beacon, in nl80211_start_ap()
5957 info->extack); in nl80211_start_ap()
5961 params->beacon_interval = in nl80211_start_ap()
5962 nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]); in nl80211_start_ap()
5963 params->dtim_period = in nl80211_start_ap()
5964 nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]); in nl80211_start_ap()
5966 err = cfg80211_validate_beacon_int(rdev, dev->ieee80211_ptr->iftype, in nl80211_start_ap()
5967 params->beacon_interval); in nl80211_start_ap()
5976 * additional information -- drivers must check! in nl80211_start_ap()
5978 if (info->attrs[NL80211_ATTR_SSID]) { in nl80211_start_ap()
5979 params->ssid = nla_data(info->attrs[NL80211_ATTR_SSID]); in nl80211_start_ap()
5980 params->ssid_len = in nl80211_start_ap()
5981 nla_len(info->attrs[NL80211_ATTR_SSID]); in nl80211_start_ap()
5982 if (params->ssid_len == 0) { in nl80211_start_ap()
5983 err = -EINVAL; in nl80211_start_ap()
5987 if (wdev->u.ap.ssid_len && in nl80211_start_ap()
5988 (wdev->u.ap.ssid_len != params->ssid_len || in nl80211_start_ap()
5989 memcmp(wdev->u.ap.ssid, params->ssid, params->ssid_len))) { in nl80211_start_ap()
5991 err = -EINVAL; in nl80211_start_ap()
5994 } else if (wdev->valid_links) { in nl80211_start_ap()
5996 err = -EINVAL; in nl80211_start_ap()
6000 if (info->attrs[NL80211_ATTR_HIDDEN_SSID]) in nl80211_start_ap()
6001 params->hidden_ssid = nla_get_u32( in nl80211_start_ap()
6002 info->attrs[NL80211_ATTR_HIDDEN_SSID]); in nl80211_start_ap()
6004 params->privacy = !!info->attrs[NL80211_ATTR_PRIVACY]; in nl80211_start_ap()
6006 if (info->attrs[NL80211_ATTR_AUTH_TYPE]) { in nl80211_start_ap()
6007 params->auth_type = nla_get_u32( in nl80211_start_ap()
6008 info->attrs[NL80211_ATTR_AUTH_TYPE]); in nl80211_start_ap()
6009 if (!nl80211_valid_auth_type(rdev, params->auth_type, in nl80211_start_ap()
6011 err = -EINVAL; in nl80211_start_ap()
6015 params->auth_type = NL80211_AUTHTYPE_AUTOMATIC; in nl80211_start_ap()
6017 err = nl80211_crypto_settings(rdev, info, ¶ms->crypto, in nl80211_start_ap()
6022 if (info->attrs[NL80211_ATTR_INACTIVITY_TIMEOUT]) { in nl80211_start_ap()
6023 if (!(rdev->wiphy.features & NL80211_FEATURE_INACTIVITY_TIMER)) { in nl80211_start_ap()
6024 err = -EOPNOTSUPP; in nl80211_start_ap()
6027 params->inactivity_timeout = nla_get_u16( in nl80211_start_ap()
6028 info->attrs[NL80211_ATTR_INACTIVITY_TIMEOUT]); in nl80211_start_ap()
6031 if (info->attrs[NL80211_ATTR_P2P_CTWINDOW]) { in nl80211_start_ap()
6032 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) { in nl80211_start_ap()
6033 err = -EINVAL; in nl80211_start_ap()
6036 params->p2p_ctwindow = in nl80211_start_ap()
6037 nla_get_u8(info->attrs[NL80211_ATTR_P2P_CTWINDOW]); in nl80211_start_ap()
6038 if (params->p2p_ctwindow != 0 && in nl80211_start_ap()
6039 !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_CTWIN)) { in nl80211_start_ap()
6040 err = -EINVAL; in nl80211_start_ap()
6045 if (info->attrs[NL80211_ATTR_P2P_OPPPS]) { in nl80211_start_ap()
6048 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) { in nl80211_start_ap()
6049 err = -EINVAL; in nl80211_start_ap()
6052 tmp = nla_get_u8(info->attrs[NL80211_ATTR_P2P_OPPPS]); in nl80211_start_ap()
6053 params->p2p_opp_ps = tmp; in nl80211_start_ap()
6054 if (params->p2p_opp_ps != 0 && in nl80211_start_ap()
6055 !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_OPPPS)) { in nl80211_start_ap()
6056 err = -EINVAL; in nl80211_start_ap()
6061 if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { in nl80211_start_ap()
6062 err = nl80211_parse_chandef(rdev, info, ¶ms->chandef); in nl80211_start_ap()
6065 } else if (wdev->valid_links) { in nl80211_start_ap()
6067 err = -EINVAL; in nl80211_start_ap()
6069 } else if (wdev->u.ap.preset_chandef.chan) { in nl80211_start_ap()
6070 params->chandef = wdev->u.ap.preset_chandef; in nl80211_start_ap()
6072 err = -EINVAL; in nl80211_start_ap()
6076 if (info->attrs[NL80211_ATTR_PUNCT_BITMAP]) { in nl80211_start_ap()
6078 ¶ms->chandef, in nl80211_start_ap()
6079 ¶ms->punct_bitmap); in nl80211_start_ap()
6084 if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, ¶ms->chandef, in nl80211_start_ap()
6085 wdev->iftype)) { in nl80211_start_ap()
6086 err = -EINVAL; in nl80211_start_ap()
6092 if (info->attrs[NL80211_ATTR_TX_RATES]) { in nl80211_start_ap()
6093 err = nl80211_parse_tx_bitrate_mask(info, info->attrs, in nl80211_start_ap()
6095 ¶ms->beacon_rate, in nl80211_start_ap()
6100 err = validate_beacon_tx_rate(rdev, params->chandef.chan->band, in nl80211_start_ap()
6101 ¶ms->beacon_rate); in nl80211_start_ap()
6106 if (info->attrs[NL80211_ATTR_SMPS_MODE]) { in nl80211_start_ap()
6107 params->smps_mode = in nl80211_start_ap()
6108 nla_get_u8(info->attrs[NL80211_ATTR_SMPS_MODE]); in nl80211_start_ap()
6109 switch (params->smps_mode) { in nl80211_start_ap()
6113 if (!(rdev->wiphy.features & in nl80211_start_ap()
6115 err = -EINVAL; in nl80211_start_ap()
6120 if (!(rdev->wiphy.features & in nl80211_start_ap()
6122 err = -EINVAL; in nl80211_start_ap()
6127 err = -EINVAL; in nl80211_start_ap()
6131 params->smps_mode = NL80211_SMPS_OFF; in nl80211_start_ap()
6134 params->pbss = nla_get_flag(info->attrs[NL80211_ATTR_PBSS]); in nl80211_start_ap()
6135 if (params->pbss && !rdev->wiphy.bands[NL80211_BAND_60GHZ]) { in nl80211_start_ap()
6136 err = -EOPNOTSUPP; in nl80211_start_ap()
6140 if (info->attrs[NL80211_ATTR_ACL_POLICY]) { in nl80211_start_ap()
6141 params->acl = parse_acl_data(&rdev->wiphy, info); in nl80211_start_ap()
6142 if (IS_ERR(params->acl)) { in nl80211_start_ap()
6143 err = PTR_ERR(params->acl); in nl80211_start_ap()
6144 params->acl = NULL; in nl80211_start_ap()
6149 params->twt_responder = in nl80211_start_ap()
6150 nla_get_flag(info->attrs[NL80211_ATTR_TWT_RESPONDER]); in nl80211_start_ap()
6152 if (info->attrs[NL80211_ATTR_HE_OBSS_PD]) { in nl80211_start_ap()
6154 info->attrs[NL80211_ATTR_HE_OBSS_PD], in nl80211_start_ap()
6155 ¶ms->he_obss_pd); in nl80211_start_ap()
6160 if (info->attrs[NL80211_ATTR_FILS_DISCOVERY]) { in nl80211_start_ap()
6162 info->attrs[NL80211_ATTR_FILS_DISCOVERY], in nl80211_start_ap()
6168 if (info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP]) { in nl80211_start_ap()
6170 rdev, info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP], in nl80211_start_ap()
6176 if (info->attrs[NL80211_ATTR_MBSSID_CONFIG]) { in nl80211_start_ap()
6177 err = nl80211_parse_mbssid_config(&rdev->wiphy, dev, in nl80211_start_ap()
6178 info->attrs[NL80211_ATTR_MBSSID_CONFIG], in nl80211_start_ap()
6179 ¶ms->mbssid_config, in nl80211_start_ap()
6180 params->beacon.mbssid_ies ? in nl80211_start_ap()
6181 params->beacon.mbssid_ies->cnt : in nl80211_start_ap()
6187 if (!params->mbssid_config.ema && params->beacon.rnr_ies) { in nl80211_start_ap()
6188 err = -EINVAL; in nl80211_start_ap()
6200 if (info->attrs[NL80211_ATTR_AP_SETTINGS_FLAGS]) in nl80211_start_ap()
6201 params->flags = nla_get_u32( in nl80211_start_ap()
6202 info->attrs[NL80211_ATTR_AP_SETTINGS_FLAGS]); in nl80211_start_ap()
6203 else if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT]) in nl80211_start_ap()
6204 params->flags |= NL80211_AP_SETTINGS_EXTERNAL_AUTH_SUPPORT; in nl80211_start_ap()
6206 if (wdev->conn_owner_nlportid && in nl80211_start_ap()
6207 info->attrs[NL80211_ATTR_SOCKET_OWNER] && in nl80211_start_ap()
6208 wdev->conn_owner_nlportid != info->snd_portid) { in nl80211_start_ap()
6209 err = -EINVAL; in nl80211_start_ap()
6213 /* FIXME: validate MLO/link-id against driver capabilities */ in nl80211_start_ap()
6217 wdev->links[link_id].ap.beacon_interval = params->beacon_interval; in nl80211_start_ap()
6218 wdev->links[link_id].ap.chandef = params->chandef; in nl80211_start_ap()
6219 wdev->u.ap.ssid_len = params->ssid_len; in nl80211_start_ap()
6220 memcpy(wdev->u.ap.ssid, params->ssid, in nl80211_start_ap()
6221 params->ssid_len); in nl80211_start_ap()
6223 if (info->attrs[NL80211_ATTR_SOCKET_OWNER]) in nl80211_start_ap()
6224 wdev->conn_owner_nlportid = info->snd_portid; in nl80211_start_ap()
6231 kfree(params->acl); in nl80211_start_ap()
6232 kfree(params->beacon.mbssid_ies); in nl80211_start_ap()
6233 if (params->mbssid_config.tx_wdev && in nl80211_start_ap()
6234 params->mbssid_config.tx_wdev->netdev && in nl80211_start_ap()
6235 params->mbssid_config.tx_wdev->netdev != dev) in nl80211_start_ap()
6236 dev_put(params->mbssid_config.tx_wdev->netdev); in nl80211_start_ap()
6237 kfree(params->beacon.rnr_ies); in nl80211_start_ap()
6245 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_beacon()
6246 unsigned int link_id = nl80211_link_id(info->attrs); in nl80211_set_beacon()
6247 struct net_device *dev = info->user_ptr[1]; in nl80211_set_beacon()
6248 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_set_beacon()
6252 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && in nl80211_set_beacon()
6253 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) in nl80211_set_beacon()
6254 return -EOPNOTSUPP; in nl80211_set_beacon()
6256 if (!rdev->ops->change_beacon) in nl80211_set_beacon()
6257 return -EOPNOTSUPP; in nl80211_set_beacon()
6259 if (!wdev->links[link_id].ap.beacon_interval) in nl80211_set_beacon()
6260 return -EINVAL; in nl80211_set_beacon()
6262 err = nl80211_parse_beacon(rdev, info->attrs, ¶ms, info->extack); in nl80211_set_beacon()
6278 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_stop_ap()
6279 unsigned int link_id = nl80211_link_id(info->attrs); in nl80211_stop_ap()
6280 struct net_device *dev = info->user_ptr[1]; in nl80211_stop_ap()
6306 nla = info->attrs[NL80211_ATTR_STA_FLAGS2]; in parse_station_flags()
6311 params->sta_flags_mask = sta_flags->mask; in parse_station_flags()
6312 params->sta_flags_set = sta_flags->set; in parse_station_flags()
6313 params->sta_flags_set &= params->sta_flags_mask; in parse_station_flags()
6314 if ((params->sta_flags_mask | in parse_station_flags()
6315 params->sta_flags_set) & BIT(__NL80211_STA_FLAG_INVALID)) in parse_station_flags()
6316 return -EINVAL; in parse_station_flags()
6322 nla = info->attrs[NL80211_ATTR_STA_FLAGS]; in parse_station_flags()
6326 if (nla_parse_nested_deprecated(flags, NL80211_STA_FLAG_MAX, nla, sta_flags_policy, info->extack)) in parse_station_flags()
6327 return -EINVAL; in parse_station_flags()
6339 params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHORIZED) | in parse_station_flags()
6346 params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHORIZED) | in parse_station_flags()
6350 params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHENTICATED) | in parse_station_flags()
6355 return -EINVAL; in parse_station_flags()
6360 params->sta_flags_set |= (1<<flag); in parse_station_flags()
6364 return -EINVAL; in parse_station_flags()
6384 /* report 16-bit bitrate only if we can */ in nl80211_put_sta_rate()
6393 switch (info->bw) { in nl80211_put_sta_rate()
6432 WARN_ON(!(info->flags & RATE_INFO_FLAGS_HE_MCS)); in nl80211_put_sta_rate()
6439 WARN_ON(!(info->flags & RATE_INFO_FLAGS_EHT_MCS)); in nl80211_put_sta_rate()
6446 if (info->flags & RATE_INFO_FLAGS_MCS) { in nl80211_put_sta_rate()
6447 if (nla_put_u8(msg, NL80211_RATE_INFO_MCS, info->mcs)) in nl80211_put_sta_rate()
6449 if (info->flags & RATE_INFO_FLAGS_SHORT_GI && in nl80211_put_sta_rate()
6452 } else if (info->flags & RATE_INFO_FLAGS_VHT_MCS) { in nl80211_put_sta_rate()
6453 if (nla_put_u8(msg, NL80211_RATE_INFO_VHT_MCS, info->mcs)) in nl80211_put_sta_rate()
6455 if (nla_put_u8(msg, NL80211_RATE_INFO_VHT_NSS, info->nss)) in nl80211_put_sta_rate()
6457 if (info->flags & RATE_INFO_FLAGS_SHORT_GI && in nl80211_put_sta_rate()
6460 } else if (info->flags & RATE_INFO_FLAGS_HE_MCS) { in nl80211_put_sta_rate()
6461 if (nla_put_u8(msg, NL80211_RATE_INFO_HE_MCS, info->mcs)) in nl80211_put_sta_rate()
6463 if (nla_put_u8(msg, NL80211_RATE_INFO_HE_NSS, info->nss)) in nl80211_put_sta_rate()
6465 if (nla_put_u8(msg, NL80211_RATE_INFO_HE_GI, info->he_gi)) in nl80211_put_sta_rate()
6467 if (nla_put_u8(msg, NL80211_RATE_INFO_HE_DCM, info->he_dcm)) in nl80211_put_sta_rate()
6469 if (info->bw == RATE_INFO_BW_HE_RU && in nl80211_put_sta_rate()
6471 info->he_ru_alloc)) in nl80211_put_sta_rate()
6473 } else if (info->flags & RATE_INFO_FLAGS_S1G_MCS) { in nl80211_put_sta_rate()
6474 if (nla_put_u8(msg, NL80211_RATE_INFO_S1G_MCS, info->mcs)) in nl80211_put_sta_rate()
6476 if (nla_put_u8(msg, NL80211_RATE_INFO_S1G_NSS, info->nss)) in nl80211_put_sta_rate()
6478 if (info->flags & RATE_INFO_FLAGS_SHORT_GI && in nl80211_put_sta_rate()
6481 } else if (info->flags & RATE_INFO_FLAGS_EHT_MCS) { in nl80211_put_sta_rate()
6482 if (nla_put_u8(msg, NL80211_RATE_INFO_EHT_MCS, info->mcs)) in nl80211_put_sta_rate()
6484 if (nla_put_u8(msg, NL80211_RATE_INFO_EHT_NSS, info->nss)) in nl80211_put_sta_rate()
6486 if (nla_put_u8(msg, NL80211_RATE_INFO_EHT_GI, info->eht_gi)) in nl80211_put_sta_rate()
6488 if (info->bw == RATE_INFO_BW_EHT_RU && in nl80211_put_sta_rate()
6490 info->eht_ru_alloc)) in nl80211_put_sta_rate()
6536 return -1; in nl80211_send_station()
6539 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || in nl80211_send_station()
6541 nla_put_u32(msg, NL80211_ATTR_GENERATION, sinfo->generation)) in nl80211_send_station()
6550 if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_ ## attr) && \ in nl80211_send_station()
6552 sinfo->memb)) \ in nl80211_send_station()
6556 if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_ ## attr) && \ in nl80211_send_station()
6558 sinfo->memb, NL80211_STA_INFO_PAD)) \ in nl80211_send_station()
6566 if (sinfo->filled & (BIT_ULL(NL80211_STA_INFO_RX_BYTES) | in nl80211_send_station()
6569 (u32)sinfo->rx_bytes)) in nl80211_send_station()
6572 if (sinfo->filled & (BIT_ULL(NL80211_STA_INFO_TX_BYTES) | in nl80211_send_station()
6575 (u32)sinfo->tx_bytes)) in nl80211_send_station()
6586 if (wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_send_station()
6590 switch (rdev->wiphy.signal_type) { in nl80211_send_station()
6598 if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL)) { in nl80211_send_station()
6599 if (!nl80211_put_signal(msg, sinfo->chains, in nl80211_send_station()
6600 sinfo->chain_signal, in nl80211_send_station()
6604 if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG)) { in nl80211_send_station()
6605 if (!nl80211_put_signal(msg, sinfo->chains, in nl80211_send_station()
6606 sinfo->chain_signal_avg, in nl80211_send_station()
6610 if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE)) { in nl80211_send_station()
6611 if (!nl80211_put_sta_rate(msg, &sinfo->txrate, in nl80211_send_station()
6615 if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_RX_BITRATE)) { in nl80211_send_station()
6616 if (!nl80211_put_sta_rate(msg, &sinfo->rxrate, in nl80211_send_station()
6634 if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_BSS_PARAM)) { in nl80211_send_station()
6640 if (((sinfo->bss_param.flags & BSS_PARAM_FLAGS_CTS_PROT) && in nl80211_send_station()
6642 ((sinfo->bss_param.flags & BSS_PARAM_FLAGS_SHORT_PREAMBLE) && in nl80211_send_station()
6644 ((sinfo->bss_param.flags & BSS_PARAM_FLAGS_SHORT_SLOT_TIME) && in nl80211_send_station()
6647 sinfo->bss_param.dtim_period) || in nl80211_send_station()
6649 sinfo->bss_param.beacon_interval)) in nl80211_send_station()
6654 if ((sinfo->filled & BIT_ULL(NL80211_STA_INFO_STA_FLAGS)) && in nl80211_send_station()
6657 &sinfo->sta_flags)) in nl80211_send_station()
6666 if (wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_send_station()
6675 if (sinfo->pertid) { in nl80211_send_station()
6688 tidstats = &sinfo->pertid[tid]; in nl80211_send_station()
6690 if (!tidstats->filled) in nl80211_send_station()
6698 if (tidstats->filled & BIT(NL80211_TID_STATS_ ## attr) && \ in nl80211_send_station()
6700 tidstats->memb, NL80211_TID_STATS_PAD)) \ in nl80211_send_station()
6710 if ((tidstats->filled & in nl80211_send_station()
6712 !nl80211_put_txq_stats(msg, &tidstats->txq_stats, in nl80211_send_station()
6724 if (sinfo->assoc_req_ies_len && in nl80211_send_station()
6725 nla_put(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len, in nl80211_send_station()
6726 sinfo->assoc_req_ies)) in nl80211_send_station()
6729 if (sinfo->assoc_resp_ies_len && in nl80211_send_station()
6730 nla_put(msg, NL80211_ATTR_RESP_IE, sinfo->assoc_resp_ies_len, in nl80211_send_station()
6731 sinfo->assoc_resp_ies)) in nl80211_send_station()
6734 if (sinfo->mlo_params_valid) { in nl80211_send_station()
6736 sinfo->assoc_link_id)) in nl80211_send_station()
6739 if (!is_zero_ether_addr(sinfo->mld_addr) && in nl80211_send_station()
6741 sinfo->mld_addr)) in nl80211_send_station()
6752 return -EMSGSIZE; in nl80211_send_station()
6762 int sta_idx = cb->args[2]; in nl80211_dump_station()
6769 __acquire(&rdev->wiphy.mtx); in nl80211_dump_station()
6771 if (!wdev->netdev) { in nl80211_dump_station()
6772 err = -EINVAL; in nl80211_dump_station()
6776 if (!rdev->ops->dump_station) { in nl80211_dump_station()
6777 err = -EOPNOTSUPP; in nl80211_dump_station()
6783 err = rdev_dump_station(rdev, wdev->netdev, sta_idx, in nl80211_dump_station()
6785 if (err == -ENOENT) in nl80211_dump_station()
6791 NETLINK_CB(cb->skb).portid, in nl80211_dump_station()
6792 cb->nlh->nlmsg_seq, NLM_F_MULTI, in nl80211_dump_station()
6793 rdev, wdev->netdev, mac_addr, in nl80211_dump_station()
6801 cb->args[2] = sta_idx; in nl80211_dump_station()
6802 err = skb->len; in nl80211_dump_station()
6804 wiphy_unlock(&rdev->wiphy); in nl80211_dump_station()
6811 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_get_station()
6812 struct net_device *dev = info->user_ptr[1]; in nl80211_get_station()
6820 if (!info->attrs[NL80211_ATTR_MAC]) in nl80211_get_station()
6821 return -EINVAL; in nl80211_get_station()
6823 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_get_station()
6825 if (!rdev->ops->get_station) in nl80211_get_station()
6826 return -EOPNOTSUPP; in nl80211_get_station()
6835 return -ENOMEM; in nl80211_get_station()
6839 info->snd_portid, info->snd_seq, 0, in nl80211_get_station()
6842 return -ENOBUFS; in nl80211_get_station()
6852 if (params->listen_interval != -1 && in cfg80211_check_station_change()
6854 return -EINVAL; in cfg80211_check_station_change()
6856 if (params->support_p2p_ps != -1 && in cfg80211_check_station_change()
6858 return -EINVAL; in cfg80211_check_station_change()
6860 if (params->aid && in cfg80211_check_station_change()
6861 !(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) && in cfg80211_check_station_change()
6863 return -EINVAL; in cfg80211_check_station_change()
6872 * No ignoring the TDLS flag here -- the userspace mesh in cfg80211_check_station_change()
6876 if (params->sta_flags_mask & in cfg80211_check_station_change()
6880 return -EINVAL; in cfg80211_check_station_change()
6884 if (!(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))) in cfg80211_check_station_change()
6885 return -EINVAL; in cfg80211_check_station_change()
6887 params->sta_flags_mask &= ~BIT(NL80211_STA_FLAG_TDLS_PEER); in cfg80211_check_station_change()
6890 /* disallow mesh-specific things */ in cfg80211_check_station_change()
6891 if (params->plink_action != NL80211_PLINK_ACTION_NO_ACTION) in cfg80211_check_station_change()
6892 return -EINVAL; in cfg80211_check_station_change()
6893 if (params->local_pm) in cfg80211_check_station_change()
6894 return -EINVAL; in cfg80211_check_station_change()
6895 if (params->sta_modify_mask & STATION_PARAM_APPLY_PLINK_STATE) in cfg80211_check_station_change()
6896 return -EINVAL; in cfg80211_check_station_change()
6902 if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) in cfg80211_check_station_change()
6903 return -EINVAL; in cfg80211_check_station_change()
6906 * a hostapd/wpa_supplicant issue -- it always includes the in cfg80211_check_station_change()
6909 params->sta_flags_mask &= ~BIT(NL80211_STA_FLAG_TDLS_PEER); in cfg80211_check_station_change()
6915 if (params->sta_modify_mask & STATION_PARAM_APPLY_UAPSD) in cfg80211_check_station_change()
6916 return -EINVAL; in cfg80211_check_station_change()
6917 if (params->sta_modify_mask & STATION_PARAM_APPLY_CAPABILITY) in cfg80211_check_station_change()
6918 return -EINVAL; in cfg80211_check_station_change()
6919 if (params->link_sta_params.supported_rates) in cfg80211_check_station_change()
6920 return -EINVAL; in cfg80211_check_station_change()
6921 if (params->ext_capab || params->link_sta_params.ht_capa || in cfg80211_check_station_change()
6922 params->link_sta_params.vht_capa || in cfg80211_check_station_change()
6923 params->link_sta_params.he_capa || in cfg80211_check_station_change()
6924 params->link_sta_params.eht_capa) in cfg80211_check_station_change()
6925 return -EINVAL; in cfg80211_check_station_change()
6930 if (params->vlan) in cfg80211_check_station_change()
6931 return -EINVAL; in cfg80211_check_station_change()
6937 if (!(params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED))) in cfg80211_check_station_change()
6938 return -EOPNOTSUPP; in cfg80211_check_station_change()
6943 if (params->sta_flags_mask & in cfg80211_check_station_change()
6950 return -EINVAL; in cfg80211_check_station_change()
6953 if (!(wiphy->features & NL80211_FEATURE_FULL_AP_CLIENT_STATE) && in cfg80211_check_station_change()
6954 params->sta_flags_mask & in cfg80211_check_station_change()
6957 return -EINVAL; in cfg80211_check_station_change()
6962 if (params->sta_flags_mask & ~BIT(NL80211_STA_FLAG_AUTHORIZED)) in cfg80211_check_station_change()
6963 return -EINVAL; in cfg80211_check_station_change()
6967 if (params->sta_flags_mask & ~(BIT(NL80211_STA_FLAG_AUTHORIZED) | in cfg80211_check_station_change()
6969 return -EINVAL; in cfg80211_check_station_change()
6971 if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED) && in cfg80211_check_station_change()
6972 !params->link_sta_params.supported_rates) in cfg80211_check_station_change()
6973 return -EINVAL; in cfg80211_check_station_change()
6977 return -EINVAL; in cfg80211_check_station_change()
6979 if (params->sta_modify_mask & STATION_PARAM_APPLY_PLINK_STATE) in cfg80211_check_station_change()
6980 return -EINVAL; in cfg80211_check_station_change()
6983 if (params->plink_action != NL80211_PLINK_ACTION_NO_ACTION && in cfg80211_check_station_change()
6984 params->plink_action != NL80211_PLINK_ACTION_BLOCK) in cfg80211_check_station_change()
6985 return -EINVAL; in cfg80211_check_station_change()
6996 params->link_sta_params.opmode_notif_used = false; in cfg80211_check_station_change()
7008 struct nlattr *vlanattr = info->attrs[NL80211_ATTR_STA_VLAN]; in get_vlan()
7017 return ERR_PTR(-ENODEV); in get_vlan()
7019 if (!v->ieee80211_ptr || v->ieee80211_ptr->wiphy != &rdev->wiphy) { in get_vlan()
7020 ret = -EINVAL; in get_vlan()
7024 if (v->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && in get_vlan()
7025 v->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && in get_vlan()
7026 v->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) { in get_vlan()
7027 ret = -EINVAL; in get_vlan()
7032 ret = -ENETDOWN; in get_vlan()
7050 if (!info->attrs[NL80211_ATTR_STA_WME]) in nl80211_parse_sta_wme()
7053 nla = info->attrs[NL80211_ATTR_STA_WME]; in nl80211_parse_sta_wme()
7056 info->extack); in nl80211_parse_sta_wme()
7061 params->uapsd_queues = nla_get_u8( in nl80211_parse_sta_wme()
7063 if (params->uapsd_queues & ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK) in nl80211_parse_sta_wme()
7064 return -EINVAL; in nl80211_parse_sta_wme()
7067 params->max_sp = nla_get_u8(tb[NL80211_STA_WME_MAX_SP]); in nl80211_parse_sta_wme()
7069 if (params->max_sp & ~IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK) in nl80211_parse_sta_wme()
7070 return -EINVAL; in nl80211_parse_sta_wme()
7072 params->sta_modify_mask |= STATION_PARAM_APPLY_UAPSD; in nl80211_parse_sta_wme()
7080 if (info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]) { in nl80211_parse_sta_channel_info()
7081 params->supported_channels = in nl80211_parse_sta_channel_info()
7082 nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]); in nl80211_parse_sta_channel_info()
7083 params->supported_channels_len = in nl80211_parse_sta_channel_info()
7084 nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]); in nl80211_parse_sta_channel_info()
7090 if (params->supported_channels_len % 2) in nl80211_parse_sta_channel_info()
7091 return -EINVAL; in nl80211_parse_sta_channel_info()
7094 if (info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]) { in nl80211_parse_sta_channel_info()
7095 params->supported_oper_classes = in nl80211_parse_sta_channel_info()
7096 nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]); in nl80211_parse_sta_channel_info()
7097 params->supported_oper_classes_len = in nl80211_parse_sta_channel_info()
7098 nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]); in nl80211_parse_sta_channel_info()
7108 if (info->attrs[NL80211_ATTR_PEER_AID]) in nl80211_set_station_tdls()
7109 params->aid = nla_get_u16(info->attrs[NL80211_ATTR_PEER_AID]); in nl80211_set_station_tdls()
7110 if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) in nl80211_set_station_tdls()
7111 params->link_sta_params.ht_capa = in nl80211_set_station_tdls()
7112 nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]); in nl80211_set_station_tdls()
7113 if (info->attrs[NL80211_ATTR_VHT_CAPABILITY]) in nl80211_set_station_tdls()
7114 params->link_sta_params.vht_capa = in nl80211_set_station_tdls()
7115 nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY]); in nl80211_set_station_tdls()
7116 if (info->attrs[NL80211_ATTR_HE_CAPABILITY]) { in nl80211_set_station_tdls()
7117 params->link_sta_params.he_capa = in nl80211_set_station_tdls()
7118 nla_data(info->attrs[NL80211_ATTR_HE_CAPABILITY]); in nl80211_set_station_tdls()
7119 params->link_sta_params.he_capa_len = in nl80211_set_station_tdls()
7120 nla_len(info->attrs[NL80211_ATTR_HE_CAPABILITY]); in nl80211_set_station_tdls()
7122 if (info->attrs[NL80211_ATTR_EHT_CAPABILITY]) { in nl80211_set_station_tdls()
7123 params->link_sta_params.eht_capa = in nl80211_set_station_tdls()
7124 nla_data(info->attrs[NL80211_ATTR_EHT_CAPABILITY]); in nl80211_set_station_tdls()
7125 params->link_sta_params.eht_capa_len = in nl80211_set_station_tdls()
7126 nla_len(info->attrs[NL80211_ATTR_EHT_CAPABILITY]); in nl80211_set_station_tdls()
7128 if (!ieee80211_eht_capa_size_ok((const u8 *)params->link_sta_params.he_capa, in nl80211_set_station_tdls()
7129 (const u8 *)params->link_sta_params.eht_capa, in nl80211_set_station_tdls()
7130 params->link_sta_params.eht_capa_len, in nl80211_set_station_tdls()
7132 return -EINVAL; in nl80211_set_station_tdls()
7147 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_parse_sta_txpower_setting()
7150 if (info->attrs[NL80211_ATTR_STA_TX_POWER_SETTING]) { in nl80211_parse_sta_txpower_setting()
7151 if (!rdev->ops->set_tx_power || in nl80211_parse_sta_txpower_setting()
7152 !wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_parse_sta_txpower_setting()
7154 return -EOPNOTSUPP; in nl80211_parse_sta_txpower_setting()
7157 txpwr->type = nla_get_u8(info->attrs[idx]); in nl80211_parse_sta_txpower_setting()
7159 if (txpwr->type == NL80211_TX_POWER_LIMITED) { in nl80211_parse_sta_txpower_setting()
7162 if (info->attrs[idx]) in nl80211_parse_sta_txpower_setting()
7163 txpwr->power = nla_get_s16(info->attrs[idx]); in nl80211_parse_sta_txpower_setting()
7165 return -EINVAL; in nl80211_parse_sta_txpower_setting()
7178 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_station()
7179 struct net_device *dev = info->user_ptr[1]; in nl80211_set_station()
7186 if (!rdev->ops->change_station) in nl80211_set_station()
7187 return -EOPNOTSUPP; in nl80211_set_station()
7194 if (info->attrs[NL80211_ATTR_STA_AID]) in nl80211_set_station()
7195 params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]); in nl80211_set_station()
7197 if (info->attrs[NL80211_ATTR_VLAN_ID]) in nl80211_set_station()
7198 params.vlan_id = nla_get_u16(info->attrs[NL80211_ATTR_VLAN_ID]); in nl80211_set_station()
7200 if (info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]) in nl80211_set_station()
7202 nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); in nl80211_set_station()
7204 params.listen_interval = -1; in nl80211_set_station()
7206 if (info->attrs[NL80211_ATTR_STA_SUPPORT_P2P_PS]) in nl80211_set_station()
7208 nla_get_u8(info->attrs[NL80211_ATTR_STA_SUPPORT_P2P_PS]); in nl80211_set_station()
7210 params.support_p2p_ps = -1; in nl80211_set_station()
7212 if (!info->attrs[NL80211_ATTR_MAC]) in nl80211_set_station()
7213 return -EINVAL; in nl80211_set_station()
7216 nl80211_link_id_or_invalid(info->attrs); in nl80211_set_station()
7218 if (info->attrs[NL80211_ATTR_MLD_ADDR]) { in nl80211_set_station()
7225 return -EINVAL; in nl80211_set_station()
7227 mac_addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]); in nl80211_set_station()
7230 nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_set_station()
7232 return -EINVAL; in nl80211_set_station()
7234 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_set_station()
7238 if (info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]) { in nl80211_set_station()
7240 nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); in nl80211_set_station()
7242 nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); in nl80211_set_station()
7245 if (info->attrs[NL80211_ATTR_STA_CAPABILITY]) { in nl80211_set_station()
7247 nla_get_u16(info->attrs[NL80211_ATTR_STA_CAPABILITY]); in nl80211_set_station()
7251 if (info->attrs[NL80211_ATTR_STA_EXT_CAPABILITY]) { in nl80211_set_station()
7253 nla_data(info->attrs[NL80211_ATTR_STA_EXT_CAPABILITY]); in nl80211_set_station()
7255 nla_len(info->attrs[NL80211_ATTR_STA_EXT_CAPABILITY]); in nl80211_set_station()
7258 if (parse_station_flags(info, dev->ieee80211_ptr->iftype, ¶ms)) in nl80211_set_station()
7259 return -EINVAL; in nl80211_set_station()
7261 if (info->attrs[NL80211_ATTR_STA_PLINK_ACTION]) in nl80211_set_station()
7263 nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]); in nl80211_set_station()
7265 if (info->attrs[NL80211_ATTR_STA_PLINK_STATE]) { in nl80211_set_station()
7267 nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_STATE]); in nl80211_set_station()
7268 if (info->attrs[NL80211_ATTR_MESH_PEER_AID]) in nl80211_set_station()
7270 info->attrs[NL80211_ATTR_MESH_PEER_AID]); in nl80211_set_station()
7274 if (info->attrs[NL80211_ATTR_LOCAL_MESH_POWER_MODE]) in nl80211_set_station()
7276 info->attrs[NL80211_ATTR_LOCAL_MESH_POWER_MODE]); in nl80211_set_station()
7278 if (info->attrs[NL80211_ATTR_OPMODE_NOTIF]) { in nl80211_set_station()
7281 nla_get_u8(info->attrs[NL80211_ATTR_OPMODE_NOTIF]); in nl80211_set_station()
7284 if (info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY]) in nl80211_set_station()
7286 nla_data(info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY]); in nl80211_set_station()
7288 if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]) in nl80211_set_station()
7290 nla_get_u16(info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]); in nl80211_set_station()
7293 !wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_set_station()
7295 return -EOPNOTSUPP; in nl80211_set_station()
7312 switch (dev->ieee80211_ptr->iftype) { in nl80211_set_station()
7322 err = -EOPNOTSUPP; in nl80211_set_station()
7327 wdev_lock(dev->ieee80211_ptr); in nl80211_set_station()
7329 wdev_unlock(dev->ieee80211_ptr); in nl80211_set_station()
7339 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_new_station()
7341 struct net_device *dev = info->user_ptr[1]; in nl80211_new_station()
7342 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_new_station()
7350 if (!rdev->ops->add_station) in nl80211_new_station()
7351 return -EOPNOTSUPP; in nl80211_new_station()
7353 if (!info->attrs[NL80211_ATTR_MAC]) in nl80211_new_station()
7354 return -EINVAL; in nl80211_new_station()
7356 if (!info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]) in nl80211_new_station()
7357 return -EINVAL; in nl80211_new_station()
7359 if (!info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]) in nl80211_new_station()
7360 return -EINVAL; in nl80211_new_station()
7362 if (!info->attrs[NL80211_ATTR_STA_AID] && in nl80211_new_station()
7363 !info->attrs[NL80211_ATTR_PEER_AID]) in nl80211_new_station()
7364 return -EINVAL; in nl80211_new_station()
7367 nl80211_link_id_or_invalid(info->attrs); in nl80211_new_station()
7369 if (info->attrs[NL80211_ATTR_MLD_ADDR]) { in nl80211_new_station()
7370 mac_addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]); in nl80211_new_station()
7373 nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_new_station()
7375 return -EINVAL; in nl80211_new_station()
7377 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_new_station()
7381 nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); in nl80211_new_station()
7383 nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); in nl80211_new_station()
7385 nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); in nl80211_new_station()
7387 if (info->attrs[NL80211_ATTR_VLAN_ID]) in nl80211_new_station()
7388 params.vlan_id = nla_get_u16(info->attrs[NL80211_ATTR_VLAN_ID]); in nl80211_new_station()
7390 if (info->attrs[NL80211_ATTR_STA_SUPPORT_P2P_PS]) { in nl80211_new_station()
7392 nla_get_u8(info->attrs[NL80211_ATTR_STA_SUPPORT_P2P_PS]); in nl80211_new_station()
7399 dev->ieee80211_ptr->iftype == NL80211_IFTYPE_P2P_GO; in nl80211_new_station()
7402 if (info->attrs[NL80211_ATTR_PEER_AID]) in nl80211_new_station()
7403 params.aid = nla_get_u16(info->attrs[NL80211_ATTR_PEER_AID]); in nl80211_new_station()
7405 params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]); in nl80211_new_station()
7407 if (info->attrs[NL80211_ATTR_STA_CAPABILITY]) { in nl80211_new_station()
7409 nla_get_u16(info->attrs[NL80211_ATTR_STA_CAPABILITY]); in nl80211_new_station()
7413 if (info->attrs[NL80211_ATTR_STA_EXT_CAPABILITY]) { in nl80211_new_station()
7415 nla_data(info->attrs[NL80211_ATTR_STA_EXT_CAPABILITY]); in nl80211_new_station()
7417 nla_len(info->attrs[NL80211_ATTR_STA_EXT_CAPABILITY]); in nl80211_new_station()
7420 if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) in nl80211_new_station()
7422 nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]); in nl80211_new_station()
7424 if (info->attrs[NL80211_ATTR_VHT_CAPABILITY]) in nl80211_new_station()
7426 nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY]); in nl80211_new_station()
7428 if (info->attrs[NL80211_ATTR_HE_CAPABILITY]) { in nl80211_new_station()
7430 nla_data(info->attrs[NL80211_ATTR_HE_CAPABILITY]); in nl80211_new_station()
7432 nla_len(info->attrs[NL80211_ATTR_HE_CAPABILITY]); in nl80211_new_station()
7434 if (info->attrs[NL80211_ATTR_EHT_CAPABILITY]) { in nl80211_new_station()
7436 nla_data(info->attrs[NL80211_ATTR_EHT_CAPABILITY]); in nl80211_new_station()
7438 nla_len(info->attrs[NL80211_ATTR_EHT_CAPABILITY]); in nl80211_new_station()
7444 return -EINVAL; in nl80211_new_station()
7448 if (info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY]) in nl80211_new_station()
7450 nla_data(info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY]); in nl80211_new_station()
7452 if (info->attrs[NL80211_ATTR_OPMODE_NOTIF]) { in nl80211_new_station()
7455 nla_get_u8(info->attrs[NL80211_ATTR_OPMODE_NOTIF]); in nl80211_new_station()
7458 if (info->attrs[NL80211_ATTR_STA_PLINK_ACTION]) in nl80211_new_station()
7460 nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]); in nl80211_new_station()
7462 if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]) in nl80211_new_station()
7464 nla_get_u16(info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]); in nl80211_new_station()
7467 !wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_new_station()
7469 return -EOPNOTSUPP; in nl80211_new_station()
7485 if (parse_station_flags(info, dev->ieee80211_ptr->iftype, ¶ms)) in nl80211_new_station()
7486 return -EINVAL; in nl80211_new_station()
7501 return -EINVAL; in nl80211_new_station()
7507 return -EINVAL; in nl80211_new_station()
7512 switch (dev->ieee80211_ptr->iftype) { in nl80211_new_station()
7517 if (!(rdev->wiphy.flags & WIPHY_FLAG_AP_UAPSD) || in nl80211_new_station()
7523 info->attrs[NL80211_ATTR_PEER_AID]) in nl80211_new_station()
7524 return -EINVAL; in nl80211_new_station()
7529 if (!(rdev->wiphy.features & in nl80211_new_station()
7532 return -EINVAL; in nl80211_new_station()
7560 return -EINVAL; in nl80211_new_station()
7563 info->attrs[NL80211_ATTR_PEER_AID]) in nl80211_new_station()
7564 return -EINVAL; in nl80211_new_station()
7575 return -EINVAL; in nl80211_new_station()
7578 return -EINVAL; in nl80211_new_station()
7580 if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS)) in nl80211_new_station()
7581 return -EOPNOTSUPP; in nl80211_new_station()
7583 if (!(rdev->wiphy.flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP)) in nl80211_new_station()
7584 return -EOPNOTSUPP; in nl80211_new_station()
7592 return -EOPNOTSUPP; in nl80211_new_station()
7597 wdev_lock(dev->ieee80211_ptr); in nl80211_new_station()
7598 if (wdev->valid_links) { in nl80211_new_station()
7600 err = -EINVAL; in nl80211_new_station()
7603 if (!(wdev->valid_links & BIT(params.link_sta_params.link_id))) { in nl80211_new_station()
7604 err = -ENOLINK; in nl80211_new_station()
7609 err = -EINVAL; in nl80211_new_station()
7615 wdev_unlock(dev->ieee80211_ptr); in nl80211_new_station()
7622 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_del_station()
7623 struct net_device *dev = info->user_ptr[1]; in nl80211_del_station()
7629 if (info->attrs[NL80211_ATTR_MAC]) in nl80211_del_station()
7630 params.mac = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_del_station()
7632 switch (dev->ieee80211_ptr->iftype) { in nl80211_del_station()
7641 if (wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_del_station()
7644 return -EINVAL; in nl80211_del_station()
7646 return -EINVAL; in nl80211_del_station()
7649 if (!rdev->ops->del_station) in nl80211_del_station()
7650 return -EOPNOTSUPP; in nl80211_del_station()
7652 if (info->attrs[NL80211_ATTR_MGMT_SUBTYPE]) { in nl80211_del_station()
7654 nla_get_u8(info->attrs[NL80211_ATTR_MGMT_SUBTYPE]); in nl80211_del_station()
7657 return -EINVAL; in nl80211_del_station()
7663 if (info->attrs[NL80211_ATTR_REASON_CODE]) { in nl80211_del_station()
7665 nla_get_u16(info->attrs[NL80211_ATTR_REASON_CODE]); in nl80211_del_station()
7667 return -EINVAL; /* 0 is reserved */ in nl80211_del_station()
7673 wdev_lock(dev->ieee80211_ptr); in nl80211_del_station()
7675 wdev_unlock(dev->ieee80211_ptr); in nl80211_del_station()
7690 return -1; in nl80211_send_mpath()
7692 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || in nl80211_send_mpath()
7695 nla_put_u32(msg, NL80211_ATTR_GENERATION, pinfo->generation)) in nl80211_send_mpath()
7701 if ((pinfo->filled & MPATH_INFO_FRAME_QLEN) && in nl80211_send_mpath()
7703 pinfo->frame_qlen)) in nl80211_send_mpath()
7705 if (((pinfo->filled & MPATH_INFO_SN) && in nl80211_send_mpath()
7706 nla_put_u32(msg, NL80211_MPATH_INFO_SN, pinfo->sn)) || in nl80211_send_mpath()
7707 ((pinfo->filled & MPATH_INFO_METRIC) && in nl80211_send_mpath()
7709 pinfo->metric)) || in nl80211_send_mpath()
7710 ((pinfo->filled & MPATH_INFO_EXPTIME) && in nl80211_send_mpath()
7712 pinfo->exptime)) || in nl80211_send_mpath()
7713 ((pinfo->filled & MPATH_INFO_FLAGS) && in nl80211_send_mpath()
7715 pinfo->flags)) || in nl80211_send_mpath()
7716 ((pinfo->filled & MPATH_INFO_DISCOVERY_TIMEOUT) && in nl80211_send_mpath()
7718 pinfo->discovery_timeout)) || in nl80211_send_mpath()
7719 ((pinfo->filled & MPATH_INFO_DISCOVERY_RETRIES) && in nl80211_send_mpath()
7721 pinfo->discovery_retries)) || in nl80211_send_mpath()
7722 ((pinfo->filled & MPATH_INFO_HOP_COUNT) && in nl80211_send_mpath()
7724 pinfo->hop_count)) || in nl80211_send_mpath()
7725 ((pinfo->filled & MPATH_INFO_PATH_CHANGE) && in nl80211_send_mpath()
7727 pinfo->path_change_count))) in nl80211_send_mpath()
7737 return -EMSGSIZE; in nl80211_send_mpath()
7748 int path_idx = cb->args[2]; in nl80211_dump_mpath()
7755 __acquire(&rdev->wiphy.mtx); in nl80211_dump_mpath()
7757 if (!rdev->ops->dump_mpath) { in nl80211_dump_mpath()
7758 err = -EOPNOTSUPP; in nl80211_dump_mpath()
7762 if (wdev->iftype != NL80211_IFTYPE_MESH_POINT) { in nl80211_dump_mpath()
7763 err = -EOPNOTSUPP; in nl80211_dump_mpath()
7768 err = rdev_dump_mpath(rdev, wdev->netdev, path_idx, dst, in nl80211_dump_mpath()
7770 if (err == -ENOENT) in nl80211_dump_mpath()
7775 if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).portid, in nl80211_dump_mpath()
7776 cb->nlh->nlmsg_seq, NLM_F_MULTI, in nl80211_dump_mpath()
7777 wdev->netdev, dst, next_hop, in nl80211_dump_mpath()
7785 cb->args[2] = path_idx; in nl80211_dump_mpath()
7786 err = skb->len; in nl80211_dump_mpath()
7788 wiphy_unlock(&rdev->wiphy); in nl80211_dump_mpath()
7794 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_get_mpath()
7796 struct net_device *dev = info->user_ptr[1]; in nl80211_get_mpath()
7804 if (!info->attrs[NL80211_ATTR_MAC]) in nl80211_get_mpath()
7805 return -EINVAL; in nl80211_get_mpath()
7807 dst = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_get_mpath()
7809 if (!rdev->ops->get_mpath) in nl80211_get_mpath()
7810 return -EOPNOTSUPP; in nl80211_get_mpath()
7812 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) in nl80211_get_mpath()
7813 return -EOPNOTSUPP; in nl80211_get_mpath()
7821 return -ENOMEM; in nl80211_get_mpath()
7823 if (nl80211_send_mpath(msg, info->snd_portid, info->snd_seq, 0, in nl80211_get_mpath()
7826 return -ENOBUFS; in nl80211_get_mpath()
7834 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_mpath()
7835 struct net_device *dev = info->user_ptr[1]; in nl80211_set_mpath()
7839 if (!info->attrs[NL80211_ATTR_MAC]) in nl80211_set_mpath()
7840 return -EINVAL; in nl80211_set_mpath()
7842 if (!info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]) in nl80211_set_mpath()
7843 return -EINVAL; in nl80211_set_mpath()
7845 dst = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_set_mpath()
7846 next_hop = nla_data(info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]); in nl80211_set_mpath()
7848 if (!rdev->ops->change_mpath) in nl80211_set_mpath()
7849 return -EOPNOTSUPP; in nl80211_set_mpath()
7851 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) in nl80211_set_mpath()
7852 return -EOPNOTSUPP; in nl80211_set_mpath()
7859 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_new_mpath()
7860 struct net_device *dev = info->user_ptr[1]; in nl80211_new_mpath()
7864 if (!info->attrs[NL80211_ATTR_MAC]) in nl80211_new_mpath()
7865 return -EINVAL; in nl80211_new_mpath()
7867 if (!info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]) in nl80211_new_mpath()
7868 return -EINVAL; in nl80211_new_mpath()
7870 dst = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_new_mpath()
7871 next_hop = nla_data(info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]); in nl80211_new_mpath()
7873 if (!rdev->ops->add_mpath) in nl80211_new_mpath()
7874 return -EOPNOTSUPP; in nl80211_new_mpath()
7876 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) in nl80211_new_mpath()
7877 return -EOPNOTSUPP; in nl80211_new_mpath()
7884 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_del_mpath()
7885 struct net_device *dev = info->user_ptr[1]; in nl80211_del_mpath()
7888 if (info->attrs[NL80211_ATTR_MAC]) in nl80211_del_mpath()
7889 dst = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_del_mpath()
7891 if (!rdev->ops->del_mpath) in nl80211_del_mpath()
7892 return -EOPNOTSUPP; in nl80211_del_mpath()
7894 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) in nl80211_del_mpath()
7895 return -EOPNOTSUPP; in nl80211_del_mpath()
7902 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_get_mpp()
7904 struct net_device *dev = info->user_ptr[1]; in nl80211_get_mpp()
7912 if (!info->attrs[NL80211_ATTR_MAC]) in nl80211_get_mpp()
7913 return -EINVAL; in nl80211_get_mpp()
7915 dst = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_get_mpp()
7917 if (!rdev->ops->get_mpp) in nl80211_get_mpp()
7918 return -EOPNOTSUPP; in nl80211_get_mpp()
7920 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) in nl80211_get_mpp()
7921 return -EOPNOTSUPP; in nl80211_get_mpp()
7929 return -ENOMEM; in nl80211_get_mpp()
7931 if (nl80211_send_mpath(msg, info->snd_portid, info->snd_seq, 0, in nl80211_get_mpp()
7934 return -ENOBUFS; in nl80211_get_mpp()
7948 int path_idx = cb->args[2]; in nl80211_dump_mpp()
7955 __acquire(&rdev->wiphy.mtx); in nl80211_dump_mpp()
7957 if (!rdev->ops->dump_mpp) { in nl80211_dump_mpp()
7958 err = -EOPNOTSUPP; in nl80211_dump_mpp()
7962 if (wdev->iftype != NL80211_IFTYPE_MESH_POINT) { in nl80211_dump_mpp()
7963 err = -EOPNOTSUPP; in nl80211_dump_mpp()
7968 err = rdev_dump_mpp(rdev, wdev->netdev, path_idx, dst, in nl80211_dump_mpp()
7970 if (err == -ENOENT) in nl80211_dump_mpp()
7975 if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).portid, in nl80211_dump_mpp()
7976 cb->nlh->nlmsg_seq, NLM_F_MULTI, in nl80211_dump_mpp()
7977 wdev->netdev, dst, mpp, in nl80211_dump_mpp()
7985 cb->args[2] = path_idx; in nl80211_dump_mpp()
7986 err = skb->len; in nl80211_dump_mpp()
7988 wiphy_unlock(&rdev->wiphy); in nl80211_dump_mpp()
7994 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_bss()
7995 struct net_device *dev = info->user_ptr[1]; in nl80211_set_bss()
7996 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_set_bss()
8001 params.link_id = nl80211_link_id_or_invalid(info->attrs); in nl80211_set_bss()
8003 params.use_cts_prot = -1; in nl80211_set_bss()
8004 params.use_short_preamble = -1; in nl80211_set_bss()
8005 params.use_short_slot_time = -1; in nl80211_set_bss()
8006 params.ap_isolate = -1; in nl80211_set_bss()
8007 params.ht_opmode = -1; in nl80211_set_bss()
8008 params.p2p_ctwindow = -1; in nl80211_set_bss()
8009 params.p2p_opp_ps = -1; in nl80211_set_bss()
8011 if (info->attrs[NL80211_ATTR_BSS_CTS_PROT]) in nl80211_set_bss()
8013 nla_get_u8(info->attrs[NL80211_ATTR_BSS_CTS_PROT]); in nl80211_set_bss()
8014 if (info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]) in nl80211_set_bss()
8016 nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]); in nl80211_set_bss()
8017 if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]) in nl80211_set_bss()
8019 nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]); in nl80211_set_bss()
8020 if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) { in nl80211_set_bss()
8022 nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); in nl80211_set_bss()
8024 nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); in nl80211_set_bss()
8026 if (info->attrs[NL80211_ATTR_AP_ISOLATE]) in nl80211_set_bss()
8027 params.ap_isolate = !!nla_get_u8(info->attrs[NL80211_ATTR_AP_ISOLATE]); in nl80211_set_bss()
8028 if (info->attrs[NL80211_ATTR_BSS_HT_OPMODE]) in nl80211_set_bss()
8030 nla_get_u16(info->attrs[NL80211_ATTR_BSS_HT_OPMODE]); in nl80211_set_bss()
8032 if (info->attrs[NL80211_ATTR_P2P_CTWINDOW]) { in nl80211_set_bss()
8033 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) in nl80211_set_bss()
8034 return -EINVAL; in nl80211_set_bss()
8036 nla_get_u8(info->attrs[NL80211_ATTR_P2P_CTWINDOW]); in nl80211_set_bss()
8038 !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_CTWIN)) in nl80211_set_bss()
8039 return -EINVAL; in nl80211_set_bss()
8042 if (info->attrs[NL80211_ATTR_P2P_OPPPS]) { in nl80211_set_bss()
8045 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) in nl80211_set_bss()
8046 return -EINVAL; in nl80211_set_bss()
8047 tmp = nla_get_u8(info->attrs[NL80211_ATTR_P2P_OPPPS]); in nl80211_set_bss()
8050 !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_OPPPS)) in nl80211_set_bss()
8051 return -EINVAL; in nl80211_set_bss()
8054 if (!rdev->ops->change_bss) in nl80211_set_bss()
8055 return -EOPNOTSUPP; in nl80211_set_bss()
8057 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && in nl80211_set_bss()
8058 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) in nl80211_set_bss()
8059 return -EOPNOTSUPP; in nl80211_set_bss()
8077 * completely when built-in to the kernel right between the time in nl80211_req_set_reg()
8082 return -EINPROGRESS; in nl80211_req_set_reg()
8084 if (info->attrs[NL80211_ATTR_USER_REG_HINT_TYPE]) in nl80211_req_set_reg()
8086 nla_get_u32(info->attrs[NL80211_ATTR_USER_REG_HINT_TYPE]); in nl80211_req_set_reg()
8093 if (!info->attrs[NL80211_ATTR_REG_ALPHA2]) in nl80211_req_set_reg()
8094 return -EINVAL; in nl80211_req_set_reg()
8096 data = nla_data(info->attrs[NL80211_ATTR_REG_ALPHA2]); in nl80211_req_set_reg()
8099 if (info->attrs[NL80211_ATTR_SOCKET_OWNER]) { in nl80211_req_set_reg()
8100 owner_nlportid = info->snd_portid; in nl80211_req_set_reg()
8101 is_indoor = !!info->attrs[NL80211_ATTR_REG_INDOOR]; in nl80211_req_set_reg()
8109 return -EINVAL; in nl80211_req_set_reg()
8121 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_get_mesh_config()
8122 struct net_device *dev = info->user_ptr[1]; in nl80211_get_mesh_config()
8123 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_get_mesh_config()
8130 if (wdev->iftype != NL80211_IFTYPE_MESH_POINT) in nl80211_get_mesh_config()
8131 return -EOPNOTSUPP; in nl80211_get_mesh_config()
8133 if (!rdev->ops->get_mesh_config) in nl80211_get_mesh_config()
8134 return -EOPNOTSUPP; in nl80211_get_mesh_config()
8138 if (!wdev->u.mesh.id_len) in nl80211_get_mesh_config()
8150 return -ENOMEM; in nl80211_get_mesh_config()
8151 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, in nl80211_get_mesh_config()
8158 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || in nl80211_get_mesh_config()
8229 return -ENOBUFS; in nl80211_get_mesh_config()
8264 NLA_POLICY_RANGE(NLA_S32, -255, 0),
8307 cfg->param = fn(tb[attr]); \ in nl80211_parse_mesh_config()
8308 mask |= BIT((attr) - 1); \ in nl80211_parse_mesh_config()
8312 if (!info->attrs[NL80211_ATTR_MESH_CONFIG]) in nl80211_parse_mesh_config()
8313 return -EINVAL; in nl80211_parse_mesh_config()
8314 …ated(tb, NL80211_MESHCONF_ATTR_MAX, info->attrs[NL80211_ATTR_MESH_CONFIG], nl80211_meshconf_params… in nl80211_parse_mesh_config()
8315 return -EINVAL; in nl80211_parse_mesh_config()
8353 (cfg->path_refresh_time < 1 || cfg->path_refresh_time > 65535)) in nl80211_parse_mesh_config()
8354 return -EINVAL; in nl80211_parse_mesh_config()
8363 (cfg->dot11MeshHWMPactivePathTimeout < 1 || in nl80211_parse_mesh_config()
8364 cfg->dot11MeshHWMPactivePathTimeout > 65535)) in nl80211_parse_mesh_config()
8365 return -EINVAL; in nl80211_parse_mesh_config()
8397 * IEEE 802.11-2016 9.4.2.57 HT Operation element. in nl80211_parse_mesh_config()
8405 return -EINVAL; in nl80211_parse_mesh_config()
8410 cfg->ht_opmode = ht_opmode; in nl80211_parse_mesh_config()
8411 mask |= (1 << (NL80211_MESHCONF_HT_OPMODE - 1)); in nl80211_parse_mesh_config()
8418 (cfg->dot11MeshHWMPactivePathToRootTimeout < 1 || in nl80211_parse_mesh_config()
8419 cfg->dot11MeshHWMPactivePathToRootTimeout > 65535)) in nl80211_parse_mesh_config()
8420 return -EINVAL; in nl80211_parse_mesh_config()
8447 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_parse_mesh_setup()
8450 if (!info->attrs[NL80211_ATTR_MESH_SETUP]) in nl80211_parse_mesh_setup()
8451 return -EINVAL; in nl80211_parse_mesh_setup()
8452 …ed(tb, NL80211_MESH_SETUP_ATTR_MAX, info->attrs[NL80211_ATTR_MESH_SETUP], nl80211_mesh_setup_param… in nl80211_parse_mesh_setup()
8453 return -EINVAL; in nl80211_parse_mesh_setup()
8456 setup->sync_method = in nl80211_parse_mesh_setup()
8462 setup->path_sel_proto = in nl80211_parse_mesh_setup()
8468 setup->path_metric = in nl80211_parse_mesh_setup()
8476 setup->ie = nla_data(ieattr); in nl80211_parse_mesh_setup()
8477 setup->ie_len = nla_len(ieattr); in nl80211_parse_mesh_setup()
8480 !(rdev->wiphy.features & NL80211_FEATURE_USERSPACE_MPM)) in nl80211_parse_mesh_setup()
8481 return -EINVAL; in nl80211_parse_mesh_setup()
8482 setup->user_mpm = nla_get_flag(tb[NL80211_MESH_SETUP_USERSPACE_MPM]); in nl80211_parse_mesh_setup()
8483 setup->is_authenticated = nla_get_flag(tb[NL80211_MESH_SETUP_USERSPACE_AUTH]); in nl80211_parse_mesh_setup()
8484 setup->is_secure = nla_get_flag(tb[NL80211_MESH_SETUP_USERSPACE_AMPE]); in nl80211_parse_mesh_setup()
8485 if (setup->is_secure) in nl80211_parse_mesh_setup()
8486 setup->user_mpm = true; in nl80211_parse_mesh_setup()
8489 if (!setup->user_mpm) in nl80211_parse_mesh_setup()
8490 return -EINVAL; in nl80211_parse_mesh_setup()
8491 setup->auth_id = in nl80211_parse_mesh_setup()
8501 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_update_mesh_config()
8502 struct net_device *dev = info->user_ptr[1]; in nl80211_update_mesh_config()
8503 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_update_mesh_config()
8508 if (wdev->iftype != NL80211_IFTYPE_MESH_POINT) in nl80211_update_mesh_config()
8509 return -EOPNOTSUPP; in nl80211_update_mesh_config()
8511 if (!rdev->ops->update_mesh_config) in nl80211_update_mesh_config()
8512 return -EOPNOTSUPP; in nl80211_update_mesh_config()
8519 if (!wdev->u.mesh.id_len) in nl80211_update_mesh_config()
8520 err = -ENOLINK; in nl80211_update_mesh_config()
8536 if (nla_put_string(msg, NL80211_ATTR_REG_ALPHA2, regdom->alpha2) || in nl80211_put_regdom()
8537 (regdom->dfs_region && in nl80211_put_regdom()
8538 nla_put_u8(msg, NL80211_ATTR_DFS_REGION, regdom->dfs_region))) in nl80211_put_regdom()
8545 for (i = 0; i < regdom->n_reg_rules; i++) { in nl80211_put_regdom()
8552 reg_rule = ®dom->reg_rules[i]; in nl80211_put_regdom()
8553 freq_range = ®_rule->freq_range; in nl80211_put_regdom()
8554 power_rule = ®_rule->power_rule; in nl80211_put_regdom()
8560 max_bandwidth_khz = freq_range->max_bandwidth_khz; in nl80211_put_regdom()
8566 reg_rule->flags) || in nl80211_put_regdom()
8568 freq_range->start_freq_khz) || in nl80211_put_regdom()
8570 freq_range->end_freq_khz) || in nl80211_put_regdom()
8574 power_rule->max_antenna_gain) || in nl80211_put_regdom()
8576 power_rule->max_eirp) || in nl80211_put_regdom()
8578 reg_rule->dfs_cac_ms)) in nl80211_put_regdom()
8588 return -EMSGSIZE; in nl80211_put_regdom()
8597 int err = -EMSGSIZE; in nl80211_get_reg_do()
8602 return -ENOBUFS; in nl80211_get_reg_do()
8604 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, in nl80211_get_reg_do()
8611 if (info->attrs[NL80211_ATTR_WIPHY]) { in nl80211_get_reg_do()
8620 wiphy = &rdev->wiphy; in nl80211_get_reg_do()
8621 self_managed = wiphy->regulatory_flags & in nl80211_get_reg_do()
8628 /* a self-managed-reg device must have a private regdom */ in nl80211_get_reg_do()
8630 err = -EINVAL; in nl80211_get_reg_do()
8671 void *hdr = nl80211hdr_put(msg, NETLINK_CB(cb->skb).portid, seq, flags, in nl80211_send_regdom()
8675 return -1; in nl80211_send_regdom()
8691 if (wiphy && wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED && in nl80211_send_regdom()
8700 return -EMSGSIZE; in nl80211_send_regdom()
8708 int err, reg_idx, start = cb->args[2]; in nl80211_get_reg_dump()
8713 err = nl80211_send_regdom(skb, cb, cb->nlh->nlmsg_seq, in nl80211_get_reg_dump()
8723 regdom = get_wiphy_regdom(&rdev->wiphy); in nl80211_get_reg_dump()
8730 err = nl80211_send_regdom(skb, cb, cb->nlh->nlmsg_seq, in nl80211_get_reg_dump()
8731 NLM_F_MULTI, &rdev->wiphy, regdom); in nl80211_get_reg_dump()
8733 reg_idx--; in nl80211_get_reg_dump()
8738 cb->args[2] = reg_idx; in nl80211_get_reg_dump()
8739 err = skb->len; in nl80211_get_reg_dump()
8759 struct ieee80211_freq_range *freq_range = ®_rule->freq_range; in parse_reg_rule()
8760 struct ieee80211_power_rule *power_rule = ®_rule->power_rule; in parse_reg_rule()
8763 return -EINVAL; in parse_reg_rule()
8765 return -EINVAL; in parse_reg_rule()
8767 return -EINVAL; in parse_reg_rule()
8769 return -EINVAL; in parse_reg_rule()
8771 return -EINVAL; in parse_reg_rule()
8773 reg_rule->flags = nla_get_u32(tb[NL80211_ATTR_REG_RULE_FLAGS]); in parse_reg_rule()
8775 freq_range->start_freq_khz = in parse_reg_rule()
8777 freq_range->end_freq_khz = in parse_reg_rule()
8779 freq_range->max_bandwidth_khz = in parse_reg_rule()
8782 power_rule->max_eirp = in parse_reg_rule()
8786 power_rule->max_antenna_gain = in parse_reg_rule()
8790 reg_rule->dfs_cac_ms = in parse_reg_rule()
8806 if (!info->attrs[NL80211_ATTR_REG_ALPHA2]) in nl80211_set_reg()
8807 return -EINVAL; in nl80211_set_reg()
8809 if (!info->attrs[NL80211_ATTR_REG_RULES]) in nl80211_set_reg()
8810 return -EINVAL; in nl80211_set_reg()
8812 alpha2 = nla_data(info->attrs[NL80211_ATTR_REG_ALPHA2]); in nl80211_set_reg()
8814 if (info->attrs[NL80211_ATTR_DFS_REGION]) in nl80211_set_reg()
8815 dfs_region = nla_get_u8(info->attrs[NL80211_ATTR_DFS_REGION]); in nl80211_set_reg()
8817 nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES], in nl80211_set_reg()
8821 return -EINVAL; in nl80211_set_reg()
8826 r = -EINVAL; in nl80211_set_reg()
8832 r = -ENOMEM; in nl80211_set_reg()
8836 rd->n_reg_rules = num_rules; in nl80211_set_reg()
8837 rd->alpha2[0] = alpha2[0]; in nl80211_set_reg()
8838 rd->alpha2[1] = alpha2[1]; in nl80211_set_reg()
8845 rd->dfs_region = dfs_region; in nl80211_set_reg()
8847 nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES], in nl80211_set_reg()
8851 info->extack); in nl80211_set_reg()
8854 r = parse_reg_rule(tb, &rd->reg_rules[rule_idx]); in nl80211_set_reg()
8861 r = -EINVAL; in nl80211_set_reg()
8908 return b < NUM_NL80211_BANDS && wiphy->bands[b]; in is_band_valid()
8923 return -EINVAL; in parse_bss_select()
8935 return -EINVAL; in parse_bss_select()
8940 bss_select->behaviour = __NL80211_BSS_SELECT_ATTR_INVALID; in parse_bss_select()
8943 bss_select->behaviour = NL80211_BSS_SELECT_ATTR_RSSI; in parse_bss_select()
8946 bss_select->behaviour = NL80211_BSS_SELECT_ATTR_BAND_PREF; in parse_bss_select()
8947 bss_select->param.band_pref = in parse_bss_select()
8949 if (!is_band_valid(wiphy, bss_select->param.band_pref)) in parse_bss_select()
8950 return -EINVAL; in parse_bss_select()
8957 bss_select->behaviour = NL80211_BSS_SELECT_ATTR_RSSI_ADJUST; in parse_bss_select()
8958 bss_select->param.adjust.band = adj_param->band; in parse_bss_select()
8959 bss_select->param.adjust.delta = adj_param->delta; in parse_bss_select()
8960 if (!is_band_valid(wiphy, bss_select->param.adjust.band)) in parse_bss_select()
8961 return -EINVAL; in parse_bss_select()
8964 /* user-space did not provide behaviour attribute */ in parse_bss_select()
8965 if (bss_select->behaviour == __NL80211_BSS_SELECT_ATTR_INVALID) in parse_bss_select()
8966 return -EINVAL; in parse_bss_select()
8968 if (!(wiphy->bss_select_support & BIT(bss_select->behaviour))) in parse_bss_select()
8969 return -EINVAL; in parse_bss_select()
8990 return -EINVAL; in nl80211_parse_random_mac()
8998 return -EINVAL; in nl80211_parse_random_mac()
9034 if (!chandef || !chandef->chan) in cfg80211_off_channel_oper_allowed()
9041 * the off-channel operation. in cfg80211_off_channel_oper_allowed()
9044 if (chandef->chan->flags & IEEE80211_CHAN_RADAR) in cfg80211_off_channel_oper_allowed()
9051 return regulatory_pre_cac_allowed(wdev->wiphy); in cfg80211_off_channel_oper_allowed()
9082 flags = &req->flags; in nl80211_check_scan_flags()
9083 mac_addr = req->mac_addr; in nl80211_check_scan_flags()
9084 mac_addr_mask = req->mac_addr_mask; in nl80211_check_scan_flags()
9089 flags = &req->flags; in nl80211_check_scan_flags()
9090 mac_addr = req->mac_addr; in nl80211_check_scan_flags()
9091 mac_addr_mask = req->mac_addr_mask; in nl80211_check_scan_flags()
9097 !(wiphy->features & NL80211_FEATURE_LOW_PRIORITY_SCAN)) || in nl80211_check_scan_flags()
9125 return -EOPNOTSUPP; in nl80211_check_scan_flags()
9130 if (!(wiphy->features & randomness_flag) || in nl80211_check_scan_flags()
9131 (wdev && wdev->connected)) in nl80211_check_scan_flags()
9132 return -EOPNOTSUPP; in nl80211_check_scan_flags()
9144 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_trigger_scan()
9145 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_trigger_scan()
9154 wiphy = &rdev->wiphy; in nl80211_trigger_scan()
9156 if (wdev->iftype == NL80211_IFTYPE_NAN) in nl80211_trigger_scan()
9157 return -EOPNOTSUPP; in nl80211_trigger_scan()
9159 if (!rdev->ops->scan) in nl80211_trigger_scan()
9160 return -EOPNOTSUPP; in nl80211_trigger_scan()
9162 if (rdev->scan_req || rdev->scan_msg) in nl80211_trigger_scan()
9163 return -EBUSY; in nl80211_trigger_scan()
9165 if (info->attrs[NL80211_ATTR_SCAN_FREQ_KHZ]) { in nl80211_trigger_scan()
9168 return -EOPNOTSUPP; in nl80211_trigger_scan()
9169 scan_freqs = info->attrs[NL80211_ATTR_SCAN_FREQ_KHZ]; in nl80211_trigger_scan()
9171 } else if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) in nl80211_trigger_scan()
9172 scan_freqs = info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]; in nl80211_trigger_scan()
9177 return -EINVAL; in nl80211_trigger_scan()
9182 if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) in nl80211_trigger_scan()
9183 nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) in nl80211_trigger_scan()
9186 if (n_ssids > wiphy->max_scan_ssids) in nl80211_trigger_scan()
9187 return -EINVAL; in nl80211_trigger_scan()
9189 if (info->attrs[NL80211_ATTR_IE]) in nl80211_trigger_scan()
9190 ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); in nl80211_trigger_scan()
9194 if (ie_len > wiphy->max_scan_ie_len) in nl80211_trigger_scan()
9195 return -EINVAL; in nl80211_trigger_scan()
9198 size = size_add(size, array_size(sizeof(*request->ssids), n_ssids)); in nl80211_trigger_scan()
9202 return -ENOMEM; in nl80211_trigger_scan()
9205 request->ssids = (void *)&request->channels[n_channels]; in nl80211_trigger_scan()
9206 request->n_ssids = n_ssids; in nl80211_trigger_scan()
9209 request->ie = (void *)(request->ssids + n_ssids); in nl80211_trigger_scan()
9211 request->ie = (void *)(request->channels + n_channels); in nl80211_trigger_scan()
9226 err = -EINVAL; in nl80211_trigger_scan()
9231 if (chan->flags & IEEE80211_CHAN_DISABLED) in nl80211_trigger_scan()
9234 request->channels[i] = chan; in nl80211_trigger_scan()
9244 if (!wiphy->bands[band]) in nl80211_trigger_scan()
9246 for (j = 0; j < wiphy->bands[band]->n_channels; j++) { in nl80211_trigger_scan()
9249 chan = &wiphy->bands[band]->channels[j]; in nl80211_trigger_scan()
9251 if (chan->flags & IEEE80211_CHAN_DISABLED) in nl80211_trigger_scan()
9254 request->channels[i] = chan; in nl80211_trigger_scan()
9261 err = -EINVAL; in nl80211_trigger_scan()
9265 request->n_channels = i; in nl80211_trigger_scan()
9268 for (i = 0; i < request->n_channels; i++) { in nl80211_trigger_scan()
9269 struct ieee80211_channel *chan = request->channels[i]; in nl80211_trigger_scan()
9271 /* if we can go off-channel to the target channel we're good */ in nl80211_trigger_scan()
9277 err = -EBUSY; in nl80211_trigger_scan()
9285 nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) { in nl80211_trigger_scan()
9287 err = -EINVAL; in nl80211_trigger_scan()
9290 request->ssids[i].ssid_len = nla_len(attr); in nl80211_trigger_scan()
9291 memcpy(request->ssids[i].ssid, nla_data(attr), nla_len(attr)); in nl80211_trigger_scan()
9296 if (info->attrs[NL80211_ATTR_IE]) { in nl80211_trigger_scan()
9297 request->ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); in nl80211_trigger_scan()
9298 memcpy((void *)request->ie, in nl80211_trigger_scan()
9299 nla_data(info->attrs[NL80211_ATTR_IE]), in nl80211_trigger_scan()
9300 request->ie_len); in nl80211_trigger_scan()
9304 if (wiphy->bands[i]) in nl80211_trigger_scan()
9305 request->rates[i] = in nl80211_trigger_scan()
9306 (1 << wiphy->bands[i]->n_bitrates) - 1; in nl80211_trigger_scan()
9308 if (info->attrs[NL80211_ATTR_SCAN_SUPP_RATES]) { in nl80211_trigger_scan()
9310 info->attrs[NL80211_ATTR_SCAN_SUPP_RATES], in nl80211_trigger_scan()
9315 err = -EINVAL; in nl80211_trigger_scan()
9319 if (!wiphy->bands[band]) in nl80211_trigger_scan()
9322 err = ieee80211_get_ratemask(wiphy->bands[band], in nl80211_trigger_scan()
9325 &request->rates[band]); in nl80211_trigger_scan()
9331 if (info->attrs[NL80211_ATTR_MEASUREMENT_DURATION]) { in nl80211_trigger_scan()
9332 request->duration = in nl80211_trigger_scan()
9333 nla_get_u16(info->attrs[NL80211_ATTR_MEASUREMENT_DURATION]); in nl80211_trigger_scan()
9334 request->duration_mandatory = in nl80211_trigger_scan()
9335 nla_get_flag(info->attrs[NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY]); in nl80211_trigger_scan()
9338 err = nl80211_check_scan_flags(wiphy, wdev, request, info->attrs, in nl80211_trigger_scan()
9343 request->no_cck = in nl80211_trigger_scan()
9344 nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); in nl80211_trigger_scan()
9355 if (info->attrs[NL80211_ATTR_BSSID]) in nl80211_trigger_scan()
9356 memcpy(request->bssid, in nl80211_trigger_scan()
9357 nla_data(info->attrs[NL80211_ATTR_BSSID]), ETH_ALEN); in nl80211_trigger_scan()
9358 else if (!(request->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) && in nl80211_trigger_scan()
9359 info->attrs[NL80211_ATTR_MAC]) in nl80211_trigger_scan()
9360 memcpy(request->bssid, nla_data(info->attrs[NL80211_ATTR_MAC]), in nl80211_trigger_scan()
9363 eth_broadcast_addr(request->bssid); in nl80211_trigger_scan()
9365 request->wdev = wdev; in nl80211_trigger_scan()
9366 request->wiphy = &rdev->wiphy; in nl80211_trigger_scan()
9367 request->scan_start = jiffies; in nl80211_trigger_scan()
9369 rdev->scan_req = request; in nl80211_trigger_scan()
9376 dev_hold(wdev->netdev); in nl80211_trigger_scan()
9381 rdev->scan_req = NULL; in nl80211_trigger_scan()
9389 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_abort_scan()
9390 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_abort_scan()
9392 if (!rdev->ops->abort_scan) in nl80211_abort_scan()
9393 return -EOPNOTSUPP; in nl80211_abort_scan()
9395 if (rdev->scan_msg) in nl80211_abort_scan()
9398 if (!rdev->scan_req) in nl80211_abort_scan()
9399 return -ENOENT; in nl80211_abort_scan()
9424 return -EINVAL; in nl80211_parse_sched_scan_plans()
9426 request->scan_plans[0].interval = in nl80211_parse_sched_scan_plans()
9428 if (!request->scan_plans[0].interval) in nl80211_parse_sched_scan_plans()
9429 return -EINVAL; in nl80211_parse_sched_scan_plans()
9431 if (request->scan_plans[0].interval > in nl80211_parse_sched_scan_plans()
9432 wiphy->max_sched_scan_plan_interval) in nl80211_parse_sched_scan_plans()
9433 request->scan_plans[0].interval = in nl80211_parse_sched_scan_plans()
9434 wiphy->max_sched_scan_plan_interval; in nl80211_parse_sched_scan_plans()
9443 return -EINVAL; in nl80211_parse_sched_scan_plans()
9453 return -EINVAL; in nl80211_parse_sched_scan_plans()
9455 request->scan_plans[i].interval = in nl80211_parse_sched_scan_plans()
9457 if (!request->scan_plans[i].interval || in nl80211_parse_sched_scan_plans()
9458 request->scan_plans[i].interval > in nl80211_parse_sched_scan_plans()
9459 wiphy->max_sched_scan_plan_interval) in nl80211_parse_sched_scan_plans()
9460 return -EINVAL; in nl80211_parse_sched_scan_plans()
9463 request->scan_plans[i].iterations = in nl80211_parse_sched_scan_plans()
9465 if (!request->scan_plans[i].iterations || in nl80211_parse_sched_scan_plans()
9466 (request->scan_plans[i].iterations > in nl80211_parse_sched_scan_plans()
9467 wiphy->max_sched_scan_plan_iterations)) in nl80211_parse_sched_scan_plans()
9468 return -EINVAL; in nl80211_parse_sched_scan_plans()
9469 } else if (i < n_plans - 1) { in nl80211_parse_sched_scan_plans()
9474 return -EINVAL; in nl80211_parse_sched_scan_plans()
9484 if (request->scan_plans[n_plans - 1].iterations) in nl80211_parse_sched_scan_plans()
9485 return -EINVAL; in nl80211_parse_sched_scan_plans()
9502 ret = -EOPNOTSUPP; in nl80211_parse_sched_scan_per_band_rssi()
9505 match_sets->per_band_rssi_thold[i] = in nl80211_parse_sched_scan_per_band_rssi()
9511 match_sets->per_band_rssi_thold[i] = rssi_thold; in nl80211_parse_sched_scan_per_band_rssi()
9517 return -EINVAL; in nl80211_parse_sched_scan_per_band_rssi()
9519 match_sets->per_band_rssi_thold[band] = nla_get_s32(attr); in nl80211_parse_sched_scan_per_band_rssi()
9541 return ERR_PTR(-EINVAL); in nl80211_parse_sched_scan()
9551 if (n_ssids > wiphy->max_sched_scan_ssids) in nl80211_parse_sched_scan()
9552 return ERR_PTR(-EINVAL); in nl80211_parse_sched_scan()
9561 * global RSSI for all other matchsets - if there are other matchsets. in nl80211_parse_sched_scan()
9580 return ERR_PTR(-EINVAL); in nl80211_parse_sched_scan()
9599 return ERR_PTR(-EINVAL); in nl80211_parse_sched_scan()
9606 if (ie_len > wiphy->max_sched_scan_ie_len) in nl80211_parse_sched_scan()
9607 return ERR_PTR(-EINVAL); in nl80211_parse_sched_scan()
9615 return ERR_PTR(-EINVAL); in nl80211_parse_sched_scan()
9628 return ERR_PTR(-EINVAL); in nl80211_parse_sched_scan()
9633 if (!n_plans || n_plans > wiphy->max_sched_scan_plans) in nl80211_parse_sched_scan()
9634 return ERR_PTR(-EINVAL); in nl80211_parse_sched_scan()
9640 return ERR_PTR(-EINVAL); in nl80211_parse_sched_scan()
9643 size = size_add(size, array_size(sizeof(*request->ssids), n_ssids)); in nl80211_parse_sched_scan()
9644 size = size_add(size, array_size(sizeof(*request->match_sets), in nl80211_parse_sched_scan()
9646 size = size_add(size, array_size(sizeof(*request->scan_plans), in nl80211_parse_sched_scan()
9651 return ERR_PTR(-ENOMEM); in nl80211_parse_sched_scan()
9654 request->ssids = (void *)&request->channels[n_channels]; in nl80211_parse_sched_scan()
9655 request->n_ssids = n_ssids; in nl80211_parse_sched_scan()
9658 request->ie = (void *)(request->ssids + n_ssids); in nl80211_parse_sched_scan()
9660 request->ie = (void *)(request->channels + n_channels); in nl80211_parse_sched_scan()
9664 if (request->ie) in nl80211_parse_sched_scan()
9665 request->match_sets = (void *)(request->ie + ie_len); in nl80211_parse_sched_scan()
9667 request->match_sets = in nl80211_parse_sched_scan()
9668 (void *)(request->ssids + n_ssids); in nl80211_parse_sched_scan()
9670 request->match_sets = in nl80211_parse_sched_scan()
9671 (void *)(request->channels + n_channels); in nl80211_parse_sched_scan()
9673 request->n_match_sets = n_match_sets; in nl80211_parse_sched_scan()
9676 request->scan_plans = (void *)(request->match_sets + in nl80211_parse_sched_scan()
9678 else if (request->ie) in nl80211_parse_sched_scan()
9679 request->scan_plans = (void *)(request->ie + ie_len); in nl80211_parse_sched_scan()
9681 request->scan_plans = (void *)(request->ssids + n_ssids); in nl80211_parse_sched_scan()
9683 request->scan_plans = (void *)(request->channels + n_channels); in nl80211_parse_sched_scan()
9685 request->n_scan_plans = n_plans; in nl80211_parse_sched_scan()
9698 err = -EINVAL; in nl80211_parse_sched_scan()
9703 if (chan->flags & IEEE80211_CHAN_DISABLED) in nl80211_parse_sched_scan()
9706 request->channels[i] = chan; in nl80211_parse_sched_scan()
9714 if (!wiphy->bands[band]) in nl80211_parse_sched_scan()
9716 for (j = 0; j < wiphy->bands[band]->n_channels; j++) { in nl80211_parse_sched_scan()
9719 chan = &wiphy->bands[band]->channels[j]; in nl80211_parse_sched_scan()
9721 if (chan->flags & IEEE80211_CHAN_DISABLED) in nl80211_parse_sched_scan()
9724 request->channels[i] = chan; in nl80211_parse_sched_scan()
9731 err = -EINVAL; in nl80211_parse_sched_scan()
9735 request->n_channels = i; in nl80211_parse_sched_scan()
9742 err = -EINVAL; in nl80211_parse_sched_scan()
9745 request->ssids[i].ssid_len = nla_len(attr); in nl80211_parse_sched_scan()
9746 memcpy(request->ssids[i].ssid, nla_data(attr), in nl80211_parse_sched_scan()
9779 err = -EINVAL; in nl80211_parse_sched_scan()
9784 memcpy(request->match_sets[i].ssid.ssid, in nl80211_parse_sched_scan()
9786 request->match_sets[i].ssid.ssid_len = in nl80211_parse_sched_scan()
9790 memcpy(request->match_sets[i].bssid, in nl80211_parse_sched_scan()
9793 /* special attribute - old implementation w/a */ in nl80211_parse_sched_scan()
9794 request->match_sets[i].rssi_thold = default_match_rssi; in nl80211_parse_sched_scan()
9797 request->match_sets[i].rssi_thold = in nl80211_parse_sched_scan()
9802 &request->match_sets[i], in nl80211_parse_sched_scan()
9804 request->match_sets[i].rssi_thold); in nl80211_parse_sched_scan()
9813 request->match_sets[0].rssi_thold = default_match_rssi; in nl80211_parse_sched_scan()
9815 request->min_rssi_thold = INT_MAX; in nl80211_parse_sched_scan()
9817 request->min_rssi_thold = in nl80211_parse_sched_scan()
9818 min(request->match_sets[i].rssi_thold, in nl80211_parse_sched_scan()
9819 request->min_rssi_thold); in nl80211_parse_sched_scan()
9821 request->min_rssi_thold = NL80211_SCAN_RSSI_THOLD_OFF; in nl80211_parse_sched_scan()
9825 request->ie_len = ie_len; in nl80211_parse_sched_scan()
9826 memcpy((void *)request->ie, in nl80211_parse_sched_scan()
9828 request->ie_len); in nl80211_parse_sched_scan()
9836 request->delay = in nl80211_parse_sched_scan()
9840 request->relative_rssi = nla_get_s8( in nl80211_parse_sched_scan()
9842 request->relative_rssi_set = true; in nl80211_parse_sched_scan()
9845 if (request->relative_rssi_set && in nl80211_parse_sched_scan()
9851 request->rssi_adjust.band = rssi_adjust->band; in nl80211_parse_sched_scan()
9852 request->rssi_adjust.delta = rssi_adjust->delta; in nl80211_parse_sched_scan()
9853 if (!is_band_valid(wiphy, request->rssi_adjust.band)) { in nl80211_parse_sched_scan()
9854 err = -EINVAL; in nl80211_parse_sched_scan()
9863 request->scan_start = jiffies; in nl80211_parse_sched_scan()
9875 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_start_sched_scan()
9876 struct net_device *dev = info->user_ptr[1]; in nl80211_start_sched_scan()
9877 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_start_sched_scan()
9882 if (!rdev->wiphy.max_sched_scan_reqs || !rdev->ops->sched_scan_start) in nl80211_start_sched_scan()
9883 return -EOPNOTSUPP; in nl80211_start_sched_scan()
9885 want_multi = info->attrs[NL80211_ATTR_SCHED_SCAN_MULTI]; in nl80211_start_sched_scan()
9890 sched_scan_req = nl80211_parse_sched_scan(&rdev->wiphy, wdev, in nl80211_start_sched_scan()
9891 info->attrs, in nl80211_start_sched_scan()
9892 rdev->wiphy.max_match_sets); in nl80211_start_sched_scan()
9899 * or if driver does not support multi-scheduled scan in nl80211_start_sched_scan()
9901 if (want_multi && rdev->wiphy.max_sched_scan_reqs > 1) in nl80211_start_sched_scan()
9902 sched_scan_req->reqid = cfg80211_assign_cookie(rdev); in nl80211_start_sched_scan()
9908 sched_scan_req->dev = dev; in nl80211_start_sched_scan()
9909 sched_scan_req->wiphy = &rdev->wiphy; in nl80211_start_sched_scan()
9911 if (info->attrs[NL80211_ATTR_SOCKET_OWNER]) in nl80211_start_sched_scan()
9912 sched_scan_req->owner_nlportid = info->snd_portid; in nl80211_start_sched_scan()
9929 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_stop_sched_scan()
9932 if (!rdev->wiphy.max_sched_scan_reqs || !rdev->ops->sched_scan_stop) in nl80211_stop_sched_scan()
9933 return -EOPNOTSUPP; in nl80211_stop_sched_scan()
9935 if (info->attrs[NL80211_ATTR_COOKIE]) { in nl80211_stop_sched_scan()
9936 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]); in nl80211_stop_sched_scan()
9940 req = list_first_or_null_rcu(&rdev->sched_scan_req_list, in nl80211_stop_sched_scan()
9943 if (!req || req->reqid || in nl80211_stop_sched_scan()
9944 (req->owner_nlportid && in nl80211_stop_sched_scan()
9945 req->owner_nlportid != info->snd_portid)) in nl80211_stop_sched_scan()
9946 return -ENOENT; in nl80211_stop_sched_scan()
9954 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_start_radar_detection()
9955 struct net_device *dev = info->user_ptr[1]; in nl80211_start_radar_detection()
9956 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_start_radar_detection()
9957 struct wiphy *wiphy = wdev->wiphy; in nl80211_start_radar_detection()
9961 int err = -EINVAL; in nl80211_start_radar_detection()
9963 flush_delayed_work(&rdev->dfs_update_channels_wk); in nl80211_start_radar_detection()
9975 err = cfg80211_chandef_dfs_required(wiphy, &chandef, wdev->iftype); in nl80211_start_radar_detection()
9980 err = -EINVAL; in nl80211_start_radar_detection()
9985 err = -EINVAL; in nl80211_start_radar_detection()
9989 if (nla_get_flag(info->attrs[NL80211_ATTR_RADAR_BACKGROUND])) { in nl80211_start_radar_detection()
9996 err = -EBUSY; in nl80211_start_radar_detection()
10000 if (wdev->cac_started) { in nl80211_start_radar_detection()
10001 err = -EBUSY; in nl80211_start_radar_detection()
10007 err = -EOPNOTSUPP; in nl80211_start_radar_detection()
10011 if (!rdev->ops->start_radar_detection) { in nl80211_start_radar_detection()
10012 err = -EOPNOTSUPP; in nl80211_start_radar_detection()
10016 cac_time_ms = cfg80211_chandef_dfs_cac_time(&rdev->wiphy, &chandef); in nl80211_start_radar_detection()
10022 wdev->links[0].ap.chandef = chandef; in nl80211_start_radar_detection()
10023 wdev->cac_started = true; in nl80211_start_radar_detection()
10024 wdev->cac_start_time = jiffies; in nl80211_start_radar_detection()
10025 wdev->cac_time_ms = cac_time_ms; in nl80211_start_radar_detection()
10036 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_notify_radar_detection()
10037 struct net_device *dev = info->user_ptr[1]; in nl80211_notify_radar_detection()
10038 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_notify_radar_detection()
10039 struct wiphy *wiphy = wdev->wiphy; in nl80211_notify_radar_detection()
10048 return -EINVAL; in nl80211_notify_radar_detection()
10057 err = cfg80211_chandef_dfs_required(wiphy, &chandef, wdev->iftype); in nl80211_notify_radar_detection()
10066 return -EINVAL; in nl80211_notify_radar_detection()
10072 if (chandef.chan->dfs_state == NL80211_DFS_UNAVAILABLE) in nl80211_notify_radar_detection()
10079 rdev->radar_chandef = chandef; in nl80211_notify_radar_detection()
10082 queue_work(cfg80211_wq, &rdev->propagate_radar_detect_wk); in nl80211_notify_radar_detection()
10089 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_channel_switch()
10090 unsigned int link_id = nl80211_link_id(info->attrs); in nl80211_channel_switch()
10091 struct net_device *dev = info->user_ptr[1]; in nl80211_channel_switch()
10092 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_channel_switch()
10101 if (!rdev->ops->channel_switch || in nl80211_channel_switch()
10102 !(rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH)) in nl80211_channel_switch()
10103 return -EOPNOTSUPP; in nl80211_channel_switch()
10105 switch (dev->ieee80211_ptr->iftype) { in nl80211_channel_switch()
10117 if (!wdev->links[link_id].ap.beacon_interval) in nl80211_channel_switch()
10118 return -ENOTCONN; in nl80211_channel_switch()
10121 if (!wdev->u.ibss.ssid_len) in nl80211_channel_switch()
10122 return -ENOTCONN; in nl80211_channel_switch()
10125 if (!wdev->u.mesh.id_len) in nl80211_channel_switch()
10126 return -ENOTCONN; in nl80211_channel_switch()
10129 return -EOPNOTSUPP; in nl80211_channel_switch()
10133 params.beacon_csa.ftm_responder = -1; in nl80211_channel_switch()
10135 if (!info->attrs[NL80211_ATTR_WIPHY_FREQ] || in nl80211_channel_switch()
10136 !info->attrs[NL80211_ATTR_CH_SWITCH_COUNT]) in nl80211_channel_switch()
10137 return -EINVAL; in nl80211_channel_switch()
10140 if (need_new_beacon && !info->attrs[NL80211_ATTR_CSA_IES]) in nl80211_channel_switch()
10141 return -EINVAL; in nl80211_channel_switch()
10146 cs_count = nla_get_u32(info->attrs[NL80211_ATTR_CH_SWITCH_COUNT]); in nl80211_channel_switch()
10148 return -EINVAL; in nl80211_channel_switch()
10155 err = nl80211_parse_beacon(rdev, info->attrs, ¶ms.beacon_after, in nl80211_channel_switch()
10156 info->extack); in nl80211_channel_switch()
10163 err = -ENOMEM; in nl80211_channel_switch()
10168 info->attrs[NL80211_ATTR_CSA_IES], in nl80211_channel_switch()
10169 nl80211_policy, info->extack); in nl80211_channel_switch()
10174 info->extack); in nl80211_channel_switch()
10179 err = -EINVAL; in nl80211_channel_switch()
10185 err = -EINVAL; in nl80211_channel_switch()
10190 if (rdev->wiphy.max_num_csa_counters && in nl80211_channel_switch()
10192 rdev->wiphy.max_num_csa_counters)) { in nl80211_channel_switch()
10193 err = -EINVAL; in nl80211_channel_switch()
10200 /* sanity checks - counters should fit and be the same */ in nl80211_channel_switch()
10205 err = -EINVAL; in nl80211_channel_switch()
10210 err = -EINVAL; in nl80211_channel_switch()
10218 err = -EINVAL; in nl80211_channel_switch()
10223 if (rdev->wiphy.max_num_csa_counters && in nl80211_channel_switch()
10225 rdev->wiphy.max_num_csa_counters)) { in nl80211_channel_switch()
10226 err = -EINVAL; in nl80211_channel_switch()
10233 /* sanity checks - counters should fit and be the same */ in nl80211_channel_switch()
10238 err = -EINVAL; in nl80211_channel_switch()
10244 err = -EINVAL; in nl80211_channel_switch()
10255 if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, ¶ms.chandef, in nl80211_channel_switch()
10256 wdev->iftype)) { in nl80211_channel_switch()
10257 err = -EINVAL; in nl80211_channel_switch()
10261 err = cfg80211_chandef_dfs_required(wdev->wiphy, in nl80211_channel_switch()
10263 wdev->iftype); in nl80211_channel_switch()
10270 !nla_get_flag(info->attrs[NL80211_ATTR_HANDLE_DFS])) { in nl80211_channel_switch()
10271 err = -EINVAL; in nl80211_channel_switch()
10276 if (info->attrs[NL80211_ATTR_CH_SWITCH_BLOCK_TX]) in nl80211_channel_switch()
10279 if (info->attrs[NL80211_ATTR_PUNCT_BITMAP]) { in nl80211_channel_switch()
10306 struct cfg80211_bss *res = &intbss->pub; in nl80211_send_bss()
10314 hdr = nl80211hdr_put(msg, NETLINK_CB(cb->skb).portid, seq, flags, in nl80211_send_bss()
10317 return -1; in nl80211_send_bss()
10321 if (nla_put_u32(msg, NL80211_ATTR_GENERATION, rdev->bss_generation)) in nl80211_send_bss()
10323 if (wdev->netdev && in nl80211_send_bss()
10324 nla_put_u32(msg, NL80211_ATTR_IFINDEX, wdev->netdev->ifindex)) in nl80211_send_bss()
10333 if ((!is_zero_ether_addr(res->bssid) && in nl80211_send_bss()
10334 nla_put(msg, NL80211_BSS_BSSID, ETH_ALEN, res->bssid))) in nl80211_send_bss()
10339 if (rcu_access_pointer(res->proberesp_ies) && in nl80211_send_bss()
10346 ies = rcu_dereference(res->ies); in nl80211_send_bss()
10348 if (nla_put_u64_64bit(msg, NL80211_BSS_TSF, ies->tsf, in nl80211_send_bss()
10351 if (ies->len && nla_put(msg, NL80211_BSS_INFORMATION_ELEMENTS, in nl80211_send_bss()
10352 ies->len, ies->data)) in nl80211_send_bss()
10357 ies = rcu_dereference(res->beacon_ies); in nl80211_send_bss()
10358 if (ies && ies->from_beacon) { in nl80211_send_bss()
10359 if (nla_put_u64_64bit(msg, NL80211_BSS_BEACON_TSF, ies->tsf, in nl80211_send_bss()
10362 if (ies->len && nla_put(msg, NL80211_BSS_BEACON_IES, in nl80211_send_bss()
10363 ies->len, ies->data)) in nl80211_send_bss()
10368 if (res->beacon_interval && in nl80211_send_bss()
10369 nla_put_u16(msg, NL80211_BSS_BEACON_INTERVAL, res->beacon_interval)) in nl80211_send_bss()
10371 if (nla_put_u16(msg, NL80211_BSS_CAPABILITY, res->capability) || in nl80211_send_bss()
10372 nla_put_u32(msg, NL80211_BSS_FREQUENCY, res->channel->center_freq) || in nl80211_send_bss()
10374 res->channel->freq_offset) || in nl80211_send_bss()
10375 nla_put_u32(msg, NL80211_BSS_CHAN_WIDTH, res->scan_width) || in nl80211_send_bss()
10377 jiffies_to_msecs(jiffies - intbss->ts))) in nl80211_send_bss()
10380 if (intbss->parent_tsf && in nl80211_send_bss()
10382 intbss->parent_tsf, NL80211_BSS_PAD) || in nl80211_send_bss()
10384 intbss->parent_bssid))) in nl80211_send_bss()
10387 if (intbss->ts_boottime && in nl80211_send_bss()
10389 intbss->ts_boottime, NL80211_BSS_PAD)) in nl80211_send_bss()
10392 if (!nl80211_put_signal(msg, intbss->pub.chains, in nl80211_send_bss()
10393 intbss->pub.chain_signal, in nl80211_send_bss()
10397 switch (rdev->wiphy.signal_type) { in nl80211_send_bss()
10399 if (nla_put_u32(msg, NL80211_BSS_SIGNAL_MBM, res->signal)) in nl80211_send_bss()
10403 if (nla_put_u8(msg, NL80211_BSS_SIGNAL_UNSPEC, res->signal)) in nl80211_send_bss()
10410 switch (wdev->iftype) { in nl80211_send_bss()
10414 if (intbss == wdev->links[link_id].client.current_bss && in nl80211_send_bss()
10417 (wdev->valid_links && in nl80211_send_bss()
10421 wdev->u.client.connected_addr))))) in nl80211_send_bss()
10426 if (intbss == wdev->u.ibss.current_bss && in nl80211_send_bss()
10444 return -EMSGSIZE; in nl80211_send_bss()
10452 int start = cb->args[2], idx = 0; in nl80211_dump_scan()
10459 __acquire(&rdev->wiphy.mtx); in nl80211_dump_scan()
10462 spin_lock_bh(&rdev->bss_lock); in nl80211_dump_scan()
10466 * into multiple messages. It is unlikely that any more bss-es will be in nl80211_dump_scan()
10473 cb->seq = rdev->bss_generation; in nl80211_dump_scan()
10475 list_for_each_entry(scan, &rdev->bss_list, list) { in nl80211_dump_scan()
10479 cb->nlh->nlmsg_seq, NLM_F_MULTI, in nl80211_dump_scan()
10481 idx--; in nl80211_dump_scan()
10486 spin_unlock_bh(&rdev->bss_lock); in nl80211_dump_scan()
10489 cb->args[2] = idx; in nl80211_dump_scan()
10490 wiphy_unlock(&rdev->wiphy); in nl80211_dump_scan()
10492 return skb->len; in nl80211_dump_scan()
10504 if (!survey->channel && !allow_radio_stats) in nl80211_send_survey()
10510 return -ENOMEM; in nl80211_send_survey()
10512 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) in nl80211_send_survey()
10519 if (survey->channel && in nl80211_send_survey()
10521 survey->channel->center_freq)) in nl80211_send_survey()
10524 if (survey->channel && survey->channel->freq_offset && in nl80211_send_survey()
10526 survey->channel->freq_offset)) in nl80211_send_survey()
10529 if ((survey->filled & SURVEY_INFO_NOISE_DBM) && in nl80211_send_survey()
10530 nla_put_u8(msg, NL80211_SURVEY_INFO_NOISE, survey->noise)) in nl80211_send_survey()
10532 if ((survey->filled & SURVEY_INFO_IN_USE) && in nl80211_send_survey()
10535 if ((survey->filled & SURVEY_INFO_TIME) && in nl80211_send_survey()
10537 survey->time, NL80211_SURVEY_INFO_PAD)) in nl80211_send_survey()
10539 if ((survey->filled & SURVEY_INFO_TIME_BUSY) && in nl80211_send_survey()
10541 survey->time_busy, NL80211_SURVEY_INFO_PAD)) in nl80211_send_survey()
10543 if ((survey->filled & SURVEY_INFO_TIME_EXT_BUSY) && in nl80211_send_survey()
10545 survey->time_ext_busy, NL80211_SURVEY_INFO_PAD)) in nl80211_send_survey()
10547 if ((survey->filled & SURVEY_INFO_TIME_RX) && in nl80211_send_survey()
10549 survey->time_rx, NL80211_SURVEY_INFO_PAD)) in nl80211_send_survey()
10551 if ((survey->filled & SURVEY_INFO_TIME_TX) && in nl80211_send_survey()
10553 survey->time_tx, NL80211_SURVEY_INFO_PAD)) in nl80211_send_survey()
10555 if ((survey->filled & SURVEY_INFO_TIME_SCAN) && in nl80211_send_survey()
10557 survey->time_scan, NL80211_SURVEY_INFO_PAD)) in nl80211_send_survey()
10559 if ((survey->filled & SURVEY_INFO_TIME_BSS_RX) && in nl80211_send_survey()
10561 survey->time_bss_rx, NL80211_SURVEY_INFO_PAD)) in nl80211_send_survey()
10571 return -EMSGSIZE; in nl80211_send_survey()
10580 int survey_idx = cb->args[2]; in nl80211_dump_survey()
10586 return -ENOMEM; in nl80211_dump_survey()
10594 __acquire(&rdev->wiphy.mtx); in nl80211_dump_survey()
10599 if (!wdev->netdev) { in nl80211_dump_survey()
10600 res = -EINVAL; in nl80211_dump_survey()
10604 if (!rdev->ops->dump_survey) { in nl80211_dump_survey()
10605 res = -EOPNOTSUPP; in nl80211_dump_survey()
10611 res = rdev_dump_survey(rdev, wdev->netdev, survey_idx, &survey); in nl80211_dump_survey()
10613 if (res == -ENOENT) in nl80211_dump_survey()
10618 /* don't send disabled channels, but do send non-channel data */ in nl80211_dump_survey()
10620 survey.channel->flags & IEEE80211_CHAN_DISABLED) { in nl80211_dump_survey()
10626 NETLINK_CB(cb->skb).portid, in nl80211_dump_survey()
10627 cb->nlh->nlmsg_seq, NLM_F_MULTI, in nl80211_dump_survey()
10628 wdev->netdev, radio_stats, &survey) < 0) in nl80211_dump_survey()
10634 cb->args[2] = survey_idx; in nl80211_dump_survey()
10635 res = skb->len; in nl80211_dump_survey()
10638 wiphy_unlock(&rdev->wiphy); in nl80211_dump_survey()
10651 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_authenticate()
10652 struct net_device *dev = info->user_ptr[1]; in nl80211_authenticate()
10662 if (!info->attrs[NL80211_ATTR_MAC]) in nl80211_authenticate()
10663 return -EINVAL; in nl80211_authenticate()
10665 if (!info->attrs[NL80211_ATTR_AUTH_TYPE]) in nl80211_authenticate()
10666 return -EINVAL; in nl80211_authenticate()
10668 if (!info->attrs[NL80211_ATTR_SSID]) in nl80211_authenticate()
10669 return -EINVAL; in nl80211_authenticate()
10671 if (!info->attrs[NL80211_ATTR_WIPHY_FREQ]) in nl80211_authenticate()
10672 return -EINVAL; in nl80211_authenticate()
10679 if (key.type != -1 && key.type != NL80211_KEYTYPE_GROUP) in nl80211_authenticate()
10680 return -EINVAL; in nl80211_authenticate()
10682 return -EINVAL; in nl80211_authenticate()
10687 return -EINVAL; in nl80211_authenticate()
10689 return -EINVAL; in nl80211_authenticate()
10699 for (i = 0; i < rdev->wiphy.n_cipher_suites; i++) { in nl80211_authenticate()
10700 if (key.p.cipher == rdev->wiphy.cipher_suites[i]) { in nl80211_authenticate()
10706 return -EINVAL; in nl80211_authenticate()
10709 if (!rdev->ops->auth) in nl80211_authenticate()
10710 return -EOPNOTSUPP; in nl80211_authenticate()
10712 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && in nl80211_authenticate()
10713 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) in nl80211_authenticate()
10714 return -EOPNOTSUPP; in nl80211_authenticate()
10716 bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_authenticate()
10717 freq = MHZ_TO_KHZ(nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ])); in nl80211_authenticate()
10718 if (info->attrs[NL80211_ATTR_WIPHY_FREQ_OFFSET]) in nl80211_authenticate()
10720 nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ_OFFSET]); in nl80211_authenticate()
10722 chan = nl80211_get_valid_chan(&rdev->wiphy, freq); in nl80211_authenticate()
10724 return -EINVAL; in nl80211_authenticate()
10726 ssid = nla_data(info->attrs[NL80211_ATTR_SSID]); in nl80211_authenticate()
10727 ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); in nl80211_authenticate()
10729 if (info->attrs[NL80211_ATTR_IE]) { in nl80211_authenticate()
10730 req.ie = nla_data(info->attrs[NL80211_ATTR_IE]); in nl80211_authenticate()
10731 req.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); in nl80211_authenticate()
10734 auth_type = nla_get_u32(info->attrs[NL80211_ATTR_AUTH_TYPE]); in nl80211_authenticate()
10736 return -EINVAL; in nl80211_authenticate()
10742 !info->attrs[NL80211_ATTR_AUTH_DATA]) in nl80211_authenticate()
10743 return -EINVAL; in nl80211_authenticate()
10745 if (info->attrs[NL80211_ATTR_AUTH_DATA]) { in nl80211_authenticate()
10750 return -EINVAL; in nl80211_authenticate()
10751 req.auth_data = nla_data(info->attrs[NL80211_ATTR_AUTH_DATA]); in nl80211_authenticate()
10752 req.auth_data_len = nla_len(info->attrs[NL80211_ATTR_AUTH_DATA]); in nl80211_authenticate()
10755 local_state_change = !!info->attrs[NL80211_ATTR_LOCAL_STATE_CHANGE]; in nl80211_authenticate()
10768 req.link_id = nl80211_link_id_or_invalid(info->attrs); in nl80211_authenticate()
10770 if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_MLO)) in nl80211_authenticate()
10771 return -EINVAL; in nl80211_authenticate()
10772 if (!info->attrs[NL80211_ATTR_MLD_ADDR]) in nl80211_authenticate()
10773 return -EINVAL; in nl80211_authenticate()
10774 req.ap_mld_addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]); in nl80211_authenticate()
10776 return -EINVAL; in nl80211_authenticate()
10779 req.bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len, in nl80211_authenticate()
10783 return -ENOENT; in nl80211_authenticate()
10785 wdev_lock(dev->ieee80211_ptr); in nl80211_authenticate()
10787 wdev_unlock(dev->ieee80211_ptr); in nl80211_authenticate()
10789 cfg80211_put_bss(&rdev->wiphy, req.bss); in nl80211_authenticate()
10797 if (!info->attrs[NL80211_ATTR_SOCKET_OWNER]) { in validate_pae_over_nl80211()
10799 return -EINVAL; in validate_pae_over_nl80211()
10802 if (!rdev->ops->tx_control_port || in validate_pae_over_nl80211()
10803 !wiphy_ext_feature_isset(&rdev->wiphy, in validate_pae_over_nl80211()
10805 return -EOPNOTSUPP; in validate_pae_over_nl80211()
10817 settings->control_port = info->attrs[NL80211_ATTR_CONTROL_PORT]; in nl80211_crypto_settings()
10819 if (info->attrs[NL80211_ATTR_CONTROL_PORT_ETHERTYPE]) { in nl80211_crypto_settings()
10823 info->attrs[NL80211_ATTR_CONTROL_PORT_ETHERTYPE]); in nl80211_crypto_settings()
10824 settings->control_port_ethertype = cpu_to_be16(proto); in nl80211_crypto_settings()
10825 if (!(rdev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL) && in nl80211_crypto_settings()
10827 return -EINVAL; in nl80211_crypto_settings()
10828 if (info->attrs[NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT]) in nl80211_crypto_settings()
10829 settings->control_port_no_encrypt = true; in nl80211_crypto_settings()
10831 settings->control_port_ethertype = cpu_to_be16(ETH_P_PAE); in nl80211_crypto_settings()
10833 if (info->attrs[NL80211_ATTR_CONTROL_PORT_OVER_NL80211]) { in nl80211_crypto_settings()
10839 settings->control_port_over_nl80211 = true; in nl80211_crypto_settings()
10841 if (info->attrs[NL80211_ATTR_CONTROL_PORT_NO_PREAUTH]) in nl80211_crypto_settings()
10842 settings->control_port_no_preauth = true; in nl80211_crypto_settings()
10845 if (info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]) { in nl80211_crypto_settings()
10849 data = nla_data(info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]); in nl80211_crypto_settings()
10850 len = nla_len(info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]); in nl80211_crypto_settings()
10851 settings->n_ciphers_pairwise = len / sizeof(u32); in nl80211_crypto_settings()
10854 return -EINVAL; in nl80211_crypto_settings()
10856 if (settings->n_ciphers_pairwise > cipher_limit) in nl80211_crypto_settings()
10857 return -EINVAL; in nl80211_crypto_settings()
10859 memcpy(settings->ciphers_pairwise, data, len); in nl80211_crypto_settings()
10861 for (i = 0; i < settings->n_ciphers_pairwise; i++) in nl80211_crypto_settings()
10863 &rdev->wiphy, in nl80211_crypto_settings()
10864 settings->ciphers_pairwise[i])) in nl80211_crypto_settings()
10865 return -EINVAL; in nl80211_crypto_settings()
10868 if (info->attrs[NL80211_ATTR_CIPHER_SUITE_GROUP]) { in nl80211_crypto_settings()
10869 settings->cipher_group = in nl80211_crypto_settings()
10870 nla_get_u32(info->attrs[NL80211_ATTR_CIPHER_SUITE_GROUP]); in nl80211_crypto_settings()
10871 if (!cfg80211_supported_cipher_suite(&rdev->wiphy, in nl80211_crypto_settings()
10872 settings->cipher_group)) in nl80211_crypto_settings()
10873 return -EINVAL; in nl80211_crypto_settings()
10876 if (info->attrs[NL80211_ATTR_WPA_VERSIONS]) { in nl80211_crypto_settings()
10877 settings->wpa_versions = in nl80211_crypto_settings()
10878 nla_get_u32(info->attrs[NL80211_ATTR_WPA_VERSIONS]); in nl80211_crypto_settings()
10879 if (!nl80211_valid_wpa_versions(settings->wpa_versions)) in nl80211_crypto_settings()
10880 return -EINVAL; in nl80211_crypto_settings()
10883 if (info->attrs[NL80211_ATTR_AKM_SUITES]) { in nl80211_crypto_settings()
10887 data = nla_data(info->attrs[NL80211_ATTR_AKM_SUITES]); in nl80211_crypto_settings()
10888 len = nla_len(info->attrs[NL80211_ATTR_AKM_SUITES]); in nl80211_crypto_settings()
10889 settings->n_akm_suites = len / sizeof(u32); in nl80211_crypto_settings()
10892 return -EINVAL; in nl80211_crypto_settings()
10894 if (settings->n_akm_suites > rdev->wiphy.max_num_akm_suites) in nl80211_crypto_settings()
10895 return -EINVAL; in nl80211_crypto_settings()
10897 memcpy(settings->akm_suites, data, len); in nl80211_crypto_settings()
10900 if (info->attrs[NL80211_ATTR_PMK]) { in nl80211_crypto_settings()
10901 if (nla_len(info->attrs[NL80211_ATTR_PMK]) != WLAN_PMK_LEN) in nl80211_crypto_settings()
10902 return -EINVAL; in nl80211_crypto_settings()
10903 if (!wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_crypto_settings()
10905 !wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_crypto_settings()
10907 return -EINVAL; in nl80211_crypto_settings()
10908 settings->psk = nla_data(info->attrs[NL80211_ATTR_PMK]); in nl80211_crypto_settings()
10911 if (info->attrs[NL80211_ATTR_SAE_PASSWORD]) { in nl80211_crypto_settings()
10912 if (!wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_crypto_settings()
10914 !wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_crypto_settings()
10916 return -EINVAL; in nl80211_crypto_settings()
10917 settings->sae_pwd = in nl80211_crypto_settings()
10918 nla_data(info->attrs[NL80211_ATTR_SAE_PASSWORD]); in nl80211_crypto_settings()
10919 settings->sae_pwd_len = in nl80211_crypto_settings()
10920 nla_len(info->attrs[NL80211_ATTR_SAE_PASSWORD]); in nl80211_crypto_settings()
10923 if (info->attrs[NL80211_ATTR_SAE_PWE]) in nl80211_crypto_settings()
10924 settings->sae_pwe = in nl80211_crypto_settings()
10925 nla_get_u8(info->attrs[NL80211_ATTR_SAE_PWE]); in nl80211_crypto_settings()
10927 settings->sae_pwe = NL80211_SAE_PWE_UNSPECIFIED; in nl80211_crypto_settings()
10942 return ERR_PTR(-EINVAL); in nl80211_assoc_bss()
10950 chan = nl80211_get_valid_chan(&rdev->wiphy, freq); in nl80211_assoc_bss()
10952 return ERR_PTR(-EINVAL); in nl80211_assoc_bss()
10954 bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, in nl80211_assoc_bss()
10959 return ERR_PTR(-ENOENT); in nl80211_assoc_bss()
10966 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_associate()
10967 struct net_device *dev = info->user_ptr[1]; in nl80211_associate()
10974 if (dev->ieee80211_ptr->conn_owner_nlportid && in nl80211_associate()
10975 dev->ieee80211_ptr->conn_owner_nlportid != info->snd_portid) in nl80211_associate()
10976 return -EPERM; in nl80211_associate()
10978 if (!info->attrs[NL80211_ATTR_SSID]) in nl80211_associate()
10979 return -EINVAL; in nl80211_associate()
10981 if (!rdev->ops->assoc) in nl80211_associate()
10982 return -EOPNOTSUPP; in nl80211_associate()
10984 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && in nl80211_associate()
10985 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) in nl80211_associate()
10986 return -EOPNOTSUPP; in nl80211_associate()
10988 ssid = nla_data(info->attrs[NL80211_ATTR_SSID]); in nl80211_associate()
10989 ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); in nl80211_associate()
10991 if (info->attrs[NL80211_ATTR_IE]) { in nl80211_associate()
10992 req.ie = nla_data(info->attrs[NL80211_ATTR_IE]); in nl80211_associate()
10993 req.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); in nl80211_associate()
10998 "non-inheritance makes no sense"); in nl80211_associate()
10999 return -EINVAL; in nl80211_associate()
11003 if (info->attrs[NL80211_ATTR_USE_MFP]) { in nl80211_associate()
11005 nla_get_u32(info->attrs[NL80211_ATTR_USE_MFP]); in nl80211_associate()
11009 return -EINVAL; in nl80211_associate()
11012 if (info->attrs[NL80211_ATTR_PREV_BSSID]) in nl80211_associate()
11013 req.prev_bssid = nla_data(info->attrs[NL80211_ATTR_PREV_BSSID]); in nl80211_associate()
11015 if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_HT])) in nl80211_associate()
11018 if (info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) in nl80211_associate()
11020 nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]), in nl80211_associate()
11023 if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) { in nl80211_associate()
11024 if (!info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) in nl80211_associate()
11025 return -EINVAL; in nl80211_associate()
11027 nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]), in nl80211_associate()
11031 if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_VHT])) in nl80211_associate()
11034 if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_HE])) in nl80211_associate()
11037 if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_EHT])) in nl80211_associate()
11040 if (info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]) in nl80211_associate()
11042 nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]), in nl80211_associate()
11045 if (info->attrs[NL80211_ATTR_VHT_CAPABILITY]) { in nl80211_associate()
11046 if (!info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]) in nl80211_associate()
11047 return -EINVAL; in nl80211_associate()
11049 nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY]), in nl80211_associate()
11053 if (nla_get_flag(info->attrs[NL80211_ATTR_USE_RRM])) { in nl80211_associate()
11054 if (!((rdev->wiphy.features & in nl80211_associate()
11056 (rdev->wiphy.features & NL80211_FEATURE_QUIET)) && in nl80211_associate()
11057 !wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_associate()
11059 return -EINVAL; in nl80211_associate()
11063 if (info->attrs[NL80211_ATTR_FILS_KEK]) { in nl80211_associate()
11064 req.fils_kek = nla_data(info->attrs[NL80211_ATTR_FILS_KEK]); in nl80211_associate()
11065 req.fils_kek_len = nla_len(info->attrs[NL80211_ATTR_FILS_KEK]); in nl80211_associate()
11066 if (!info->attrs[NL80211_ATTR_FILS_NONCES]) in nl80211_associate()
11067 return -EINVAL; in nl80211_associate()
11069 nla_data(info->attrs[NL80211_ATTR_FILS_NONCES]); in nl80211_associate()
11072 if (info->attrs[NL80211_ATTR_S1G_CAPABILITY_MASK]) { in nl80211_associate()
11073 if (!info->attrs[NL80211_ATTR_S1G_CAPABILITY]) in nl80211_associate()
11074 return -EINVAL; in nl80211_associate()
11076 nla_data(info->attrs[NL80211_ATTR_S1G_CAPABILITY_MASK]), in nl80211_associate()
11080 if (info->attrs[NL80211_ATTR_S1G_CAPABILITY]) { in nl80211_associate()
11081 if (!info->attrs[NL80211_ATTR_S1G_CAPABILITY_MASK]) in nl80211_associate()
11082 return -EINVAL; in nl80211_associate()
11084 nla_data(info->attrs[NL80211_ATTR_S1G_CAPABILITY]), in nl80211_associate()
11088 req.link_id = nl80211_link_id_or_invalid(info->attrs); in nl80211_associate()
11090 if (info->attrs[NL80211_ATTR_MLO_LINKS]) { in nl80211_associate()
11096 return -EINVAL; in nl80211_associate()
11098 if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_MLO)) in nl80211_associate()
11099 return -EINVAL; in nl80211_associate()
11101 if (info->attrs[NL80211_ATTR_MAC] || in nl80211_associate()
11102 info->attrs[NL80211_ATTR_WIPHY_FREQ] || in nl80211_associate()
11103 !info->attrs[NL80211_ATTR_MLD_ADDR]) in nl80211_associate()
11104 return -EINVAL; in nl80211_associate()
11106 req.ap_mld_addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]); in nl80211_associate()
11111 return -ENOMEM; in nl80211_associate()
11114 info->attrs[NL80211_ATTR_MLO_LINKS], in nl80211_associate()
11122 err = -EINVAL; in nl80211_associate()
11129 err = -EINVAL; in nl80211_associate()
11151 err = -EINVAL; in nl80211_associate()
11159 "cannot deal with non-inheritance"); in nl80211_associate()
11160 err = -EINVAL; in nl80211_associate()
11170 err = -EINVAL; in nl80211_associate()
11176 "cannot have per-link elems on assoc link"); in nl80211_associate()
11177 err = -EINVAL; in nl80211_associate()
11184 err = -EINVAL; in nl80211_associate()
11192 return -EINVAL; in nl80211_associate()
11194 req.bss = nl80211_assoc_bss(rdev, ssid, ssid_len, info->attrs); in nl80211_associate()
11197 ap_addr = req.bss->bssid; in nl80211_associate()
11202 wdev_lock(dev->ieee80211_ptr); in nl80211_associate()
11206 if (!err && info->attrs[NL80211_ATTR_SOCKET_OWNER]) { in nl80211_associate()
11207 dev->ieee80211_ptr->conn_owner_nlportid = in nl80211_associate()
11208 info->snd_portid; in nl80211_associate()
11209 memcpy(dev->ieee80211_ptr->disconnect_bssid, in nl80211_associate()
11213 wdev_unlock(dev->ieee80211_ptr); in nl80211_associate()
11218 cfg80211_put_bss(&rdev->wiphy, req.links[link_id].bss); in nl80211_associate()
11219 cfg80211_put_bss(&rdev->wiphy, req.bss); in nl80211_associate()
11227 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_deauthenticate()
11228 struct net_device *dev = info->user_ptr[1]; in nl80211_deauthenticate()
11234 if (dev->ieee80211_ptr->conn_owner_nlportid && in nl80211_deauthenticate()
11235 dev->ieee80211_ptr->conn_owner_nlportid != info->snd_portid) in nl80211_deauthenticate()
11236 return -EPERM; in nl80211_deauthenticate()
11238 if (!info->attrs[NL80211_ATTR_MAC]) in nl80211_deauthenticate()
11239 return -EINVAL; in nl80211_deauthenticate()
11241 if (!info->attrs[NL80211_ATTR_REASON_CODE]) in nl80211_deauthenticate()
11242 return -EINVAL; in nl80211_deauthenticate()
11244 if (!rdev->ops->deauth) in nl80211_deauthenticate()
11245 return -EOPNOTSUPP; in nl80211_deauthenticate()
11247 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && in nl80211_deauthenticate()
11248 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) in nl80211_deauthenticate()
11249 return -EOPNOTSUPP; in nl80211_deauthenticate()
11251 bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_deauthenticate()
11253 reason_code = nla_get_u16(info->attrs[NL80211_ATTR_REASON_CODE]); in nl80211_deauthenticate()
11256 return -EINVAL; in nl80211_deauthenticate()
11259 if (info->attrs[NL80211_ATTR_IE]) { in nl80211_deauthenticate()
11260 ie = nla_data(info->attrs[NL80211_ATTR_IE]); in nl80211_deauthenticate()
11261 ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); in nl80211_deauthenticate()
11264 local_state_change = !!info->attrs[NL80211_ATTR_LOCAL_STATE_CHANGE]; in nl80211_deauthenticate()
11266 wdev_lock(dev->ieee80211_ptr); in nl80211_deauthenticate()
11269 wdev_unlock(dev->ieee80211_ptr); in nl80211_deauthenticate()
11275 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_disassociate()
11276 struct net_device *dev = info->user_ptr[1]; in nl80211_disassociate()
11282 if (dev->ieee80211_ptr->conn_owner_nlportid && in nl80211_disassociate()
11283 dev->ieee80211_ptr->conn_owner_nlportid != info->snd_portid) in nl80211_disassociate()
11284 return -EPERM; in nl80211_disassociate()
11286 if (!info->attrs[NL80211_ATTR_MAC]) in nl80211_disassociate()
11287 return -EINVAL; in nl80211_disassociate()
11289 if (!info->attrs[NL80211_ATTR_REASON_CODE]) in nl80211_disassociate()
11290 return -EINVAL; in nl80211_disassociate()
11292 if (!rdev->ops->disassoc) in nl80211_disassociate()
11293 return -EOPNOTSUPP; in nl80211_disassociate()
11295 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && in nl80211_disassociate()
11296 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) in nl80211_disassociate()
11297 return -EOPNOTSUPP; in nl80211_disassociate()
11299 bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_disassociate()
11301 reason_code = nla_get_u16(info->attrs[NL80211_ATTR_REASON_CODE]); in nl80211_disassociate()
11304 return -EINVAL; in nl80211_disassociate()
11307 if (info->attrs[NL80211_ATTR_IE]) { in nl80211_disassociate()
11308 ie = nla_data(info->attrs[NL80211_ATTR_IE]); in nl80211_disassociate()
11309 ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); in nl80211_disassociate()
11312 local_state_change = !!info->attrs[NL80211_ATTR_LOCAL_STATE_CHANGE]; in nl80211_disassociate()
11314 wdev_lock(dev->ieee80211_ptr); in nl80211_disassociate()
11317 wdev_unlock(dev->ieee80211_ptr); in nl80211_disassociate()
11326 struct wiphy *wiphy = &rdev->wiphy; in nl80211_parse_mcast_rate()
11333 sband = wiphy->bands[band]; in nl80211_parse_mcast_rate()
11337 for (i = 0; i < sband->n_bitrates; i++) { in nl80211_parse_mcast_rate()
11338 if (sband->bitrates[i].bitrate == rateval) { in nl80211_parse_mcast_rate()
11351 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_join_ibss()
11352 struct net_device *dev = info->user_ptr[1]; in nl80211_join_ibss()
11360 if (!info->attrs[NL80211_ATTR_SSID] || in nl80211_join_ibss()
11361 !nla_len(info->attrs[NL80211_ATTR_SSID])) in nl80211_join_ibss()
11362 return -EINVAL; in nl80211_join_ibss()
11366 if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) in nl80211_join_ibss()
11368 nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]); in nl80211_join_ibss()
11375 if (!rdev->ops->join_ibss) in nl80211_join_ibss()
11376 return -EOPNOTSUPP; in nl80211_join_ibss()
11378 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC) in nl80211_join_ibss()
11379 return -EOPNOTSUPP; in nl80211_join_ibss()
11381 wiphy = &rdev->wiphy; in nl80211_join_ibss()
11383 if (info->attrs[NL80211_ATTR_MAC]) { in nl80211_join_ibss()
11384 ibss.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_join_ibss()
11387 return -EINVAL; in nl80211_join_ibss()
11389 ibss.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]); in nl80211_join_ibss()
11390 ibss.ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); in nl80211_join_ibss()
11392 if (info->attrs[NL80211_ATTR_IE]) { in nl80211_join_ibss()
11393 ibss.ie = nla_data(info->attrs[NL80211_ATTR_IE]); in nl80211_join_ibss()
11394 ibss.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); in nl80211_join_ibss()
11401 if (!cfg80211_reg_can_beacon(&rdev->wiphy, &ibss.chandef, in nl80211_join_ibss()
11403 return -EINVAL; in nl80211_join_ibss()
11412 if (!(rdev->wiphy.features & NL80211_FEATURE_HT_IBSS)) in nl80211_join_ibss()
11413 return -EINVAL; in nl80211_join_ibss()
11418 if (!(rdev->wiphy.features & NL80211_FEATURE_HT_IBSS)) in nl80211_join_ibss()
11419 return -EINVAL; in nl80211_join_ibss()
11420 if (!wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_join_ibss()
11422 return -EINVAL; in nl80211_join_ibss()
11425 return -EINVAL; in nl80211_join_ibss()
11427 return -EINVAL; in nl80211_join_ibss()
11430 ibss.channel_fixed = !!info->attrs[NL80211_ATTR_FREQ_FIXED]; in nl80211_join_ibss()
11431 ibss.privacy = !!info->attrs[NL80211_ATTR_PRIVACY]; in nl80211_join_ibss()
11433 if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) { in nl80211_join_ibss()
11435 nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); in nl80211_join_ibss()
11437 nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); in nl80211_join_ibss()
11439 wiphy->bands[ibss.chandef.chan->band]; in nl80211_join_ibss()
11447 if (info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) in nl80211_join_ibss()
11449 nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]), in nl80211_join_ibss()
11452 if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) { in nl80211_join_ibss()
11453 if (!info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) in nl80211_join_ibss()
11454 return -EINVAL; in nl80211_join_ibss()
11456 nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]), in nl80211_join_ibss()
11460 if (info->attrs[NL80211_ATTR_MCAST_RATE] && in nl80211_join_ibss()
11462 nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE]))) in nl80211_join_ibss()
11463 return -EINVAL; in nl80211_join_ibss()
11465 if (ibss.privacy && info->attrs[NL80211_ATTR_KEYS]) { in nl80211_join_ibss()
11475 return -EINVAL; in nl80211_join_ibss()
11480 nla_get_flag(info->attrs[NL80211_ATTR_CONTROL_PORT]); in nl80211_join_ibss()
11482 if (info->attrs[NL80211_ATTR_CONTROL_PORT_OVER_NL80211]) { in nl80211_join_ibss()
11494 nla_get_flag(info->attrs[NL80211_ATTR_HANDLE_DFS]); in nl80211_join_ibss()
11496 wdev_lock(dev->ieee80211_ptr); in nl80211_join_ibss()
11500 else if (info->attrs[NL80211_ATTR_SOCKET_OWNER]) in nl80211_join_ibss()
11501 dev->ieee80211_ptr->conn_owner_nlportid = info->snd_portid; in nl80211_join_ibss()
11502 wdev_unlock(dev->ieee80211_ptr); in nl80211_join_ibss()
11509 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_leave_ibss()
11510 struct net_device *dev = info->user_ptr[1]; in nl80211_leave_ibss()
11512 if (!rdev->ops->leave_ibss) in nl80211_leave_ibss()
11513 return -EOPNOTSUPP; in nl80211_leave_ibss()
11515 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC) in nl80211_leave_ibss()
11516 return -EOPNOTSUPP; in nl80211_leave_ibss()
11523 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_mcast_rate()
11524 struct net_device *dev = info->user_ptr[1]; in nl80211_set_mcast_rate()
11528 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC && in nl80211_set_mcast_rate()
11529 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT && in nl80211_set_mcast_rate()
11530 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_OCB) in nl80211_set_mcast_rate()
11531 return -EOPNOTSUPP; in nl80211_set_mcast_rate()
11533 if (!rdev->ops->set_mcast_rate) in nl80211_set_mcast_rate()
11534 return -EOPNOTSUPP; in nl80211_set_mcast_rate()
11538 if (!info->attrs[NL80211_ATTR_MCAST_RATE]) in nl80211_set_mcast_rate()
11539 return -EINVAL; in nl80211_set_mcast_rate()
11541 nla_rate = nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE]); in nl80211_set_mcast_rate()
11543 return -EINVAL; in nl80211_set_mcast_rate()
11570 if (nla_put_u32(skb, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) in __cfg80211_alloc_vendor_skb()
11575 info->vendor_id)) in __cfg80211_alloc_vendor_skb()
11578 info->subcmd)) in __cfg80211_alloc_vendor_skb()
11586 if (wdev->netdev && in __cfg80211_alloc_vendor_skb()
11588 wdev->netdev->ifindex)) in __cfg80211_alloc_vendor_skb()
11596 ((void **)skb->cb)[0] = rdev; in __cfg80211_alloc_vendor_skb()
11597 ((void **)skb->cb)[1] = hdr; in __cfg80211_alloc_vendor_skb()
11598 ((void **)skb->cb)[2] = data; in __cfg80211_alloc_vendor_skb()
11620 if (WARN_ON(vendor_event_idx != -1)) in __cfg80211_alloc_event_skb()
11626 vendor_event_idx >= wiphy->n_vendor_events)) in __cfg80211_alloc_event_skb()
11628 info = &wiphy->vendor_events[vendor_event_idx]; in __cfg80211_alloc_event_skb()
11642 struct cfg80211_registered_device *rdev = ((void **)skb->cb)[0]; in __cfg80211_send_event_skb()
11643 void *hdr = ((void **)skb->cb)[1]; in __cfg80211_send_event_skb()
11645 struct nlattr *data = ((void **)skb->cb)[2]; in __cfg80211_send_event_skb()
11649 memset(skb->cb, 0, sizeof(skb->cb)); in __cfg80211_send_event_skb()
11654 if (nlhdr->nlmsg_pid) { in __cfg80211_send_event_skb()
11655 genlmsg_unicast(wiphy_net(&rdev->wiphy), skb, in __cfg80211_send_event_skb()
11656 nlhdr->nlmsg_pid); in __cfg80211_send_event_skb()
11658 if (data->nla_type == NL80211_ATTR_VENDOR_DATA) in __cfg80211_send_event_skb()
11661 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), in __cfg80211_send_event_skb()
11670 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_testmode_do()
11674 lockdep_assert_held(&rdev->wiphy.mtx); in nl80211_testmode_do()
11677 info->attrs); in nl80211_testmode_do()
11679 if (!rdev->ops->testmode_cmd) in nl80211_testmode_do()
11680 return -EOPNOTSUPP; in nl80211_testmode_do()
11684 if (err != -EINVAL) in nl80211_testmode_do()
11687 } else if (wdev->wiphy != &rdev->wiphy) { in nl80211_testmode_do()
11688 return -EINVAL; in nl80211_testmode_do()
11691 if (!info->attrs[NL80211_ATTR_TESTDATA]) in nl80211_testmode_do()
11692 return -EINVAL; in nl80211_testmode_do()
11694 rdev->cur_cmd_info = info; in nl80211_testmode_do()
11696 nla_data(info->attrs[NL80211_ATTR_TESTDATA]), in nl80211_testmode_do()
11697 nla_len(info->attrs[NL80211_ATTR_TESTDATA])); in nl80211_testmode_do()
11698 rdev->cur_cmd_info = NULL; in nl80211_testmode_do()
11715 if (cb->args[0]) { in nl80211_testmode_dump()
11720 phy_idx = cb->args[0] - 1; in nl80211_testmode_dump()
11724 err = -ENOENT; in nl80211_testmode_dump()
11731 err = -ENOMEM; in nl80211_testmode_dump()
11735 err = nlmsg_parse_deprecated(cb->nlh, in nl80211_testmode_dump()
11742 rdev = __cfg80211_rdev_from_attrs(sock_net(skb->sk), attrbuf); in nl80211_testmode_dump()
11747 phy_idx = rdev->wiphy_idx; in nl80211_testmode_dump()
11750 cb->args[1] = (long)attrbuf[NL80211_ATTR_TESTDATA]; in nl80211_testmode_dump()
11753 if (cb->args[1]) { in nl80211_testmode_dump()
11754 data = nla_data((void *)cb->args[1]); in nl80211_testmode_dump()
11755 data_len = nla_len((void *)cb->args[1]); in nl80211_testmode_dump()
11758 if (!rdev->ops->testmode_dump) { in nl80211_testmode_dump()
11759 err = -EOPNOTSUPP; in nl80211_testmode_dump()
11764 void *hdr = nl80211hdr_put(skb, NETLINK_CB(cb->skb).portid, in nl80211_testmode_dump()
11765 cb->nlh->nlmsg_seq, NLM_F_MULTI, in nl80211_testmode_dump()
11785 if (err == -ENOBUFS || err == -ENOENT) { in nl80211_testmode_dump()
11796 err = skb->len; in nl80211_testmode_dump()
11798 cb->args[0] = phy_idx + 1; in nl80211_testmode_dump()
11808 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_connect()
11809 struct net_device *dev = info->user_ptr[1]; in nl80211_connect()
11818 if (!info->attrs[NL80211_ATTR_SSID] || in nl80211_connect()
11819 !nla_len(info->attrs[NL80211_ATTR_SSID])) in nl80211_connect()
11820 return -EINVAL; in nl80211_connect()
11822 if (info->attrs[NL80211_ATTR_AUTH_TYPE]) { in nl80211_connect()
11824 nla_get_u32(info->attrs[NL80211_ATTR_AUTH_TYPE]); in nl80211_connect()
11827 return -EINVAL; in nl80211_connect()
11831 connect.privacy = info->attrs[NL80211_ATTR_PRIVACY]; in nl80211_connect()
11833 if (info->attrs[NL80211_ATTR_WANT_1X_4WAY_HS] && in nl80211_connect()
11834 !wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_connect()
11836 return -EINVAL; in nl80211_connect()
11837 connect.want_1x = info->attrs[NL80211_ATTR_WANT_1X_4WAY_HS]; in nl80211_connect()
11844 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && in nl80211_connect()
11845 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) in nl80211_connect()
11846 return -EOPNOTSUPP; in nl80211_connect()
11848 wiphy = &rdev->wiphy; in nl80211_connect()
11850 connect.bg_scan_period = -1; in nl80211_connect()
11851 if (info->attrs[NL80211_ATTR_BG_SCAN_PERIOD] && in nl80211_connect()
11852 (wiphy->flags & WIPHY_FLAG_SUPPORTS_FW_ROAM)) { in nl80211_connect()
11854 nla_get_u16(info->attrs[NL80211_ATTR_BG_SCAN_PERIOD]); in nl80211_connect()
11857 if (info->attrs[NL80211_ATTR_MAC]) in nl80211_connect()
11858 connect.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_connect()
11859 else if (info->attrs[NL80211_ATTR_MAC_HINT]) in nl80211_connect()
11861 nla_data(info->attrs[NL80211_ATTR_MAC_HINT]); in nl80211_connect()
11862 connect.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]); in nl80211_connect()
11863 connect.ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); in nl80211_connect()
11865 if (info->attrs[NL80211_ATTR_IE]) { in nl80211_connect()
11866 connect.ie = nla_data(info->attrs[NL80211_ATTR_IE]); in nl80211_connect()
11867 connect.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); in nl80211_connect()
11870 if (info->attrs[NL80211_ATTR_USE_MFP]) { in nl80211_connect()
11871 connect.mfp = nla_get_u32(info->attrs[NL80211_ATTR_USE_MFP]); in nl80211_connect()
11873 !wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_connect()
11875 return -EOPNOTSUPP; in nl80211_connect()
11880 if (info->attrs[NL80211_ATTR_PREV_BSSID]) in nl80211_connect()
11882 nla_data(info->attrs[NL80211_ATTR_PREV_BSSID]); in nl80211_connect()
11884 if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) in nl80211_connect()
11886 info->attrs[NL80211_ATTR_WIPHY_FREQ])); in nl80211_connect()
11887 if (info->attrs[NL80211_ATTR_WIPHY_FREQ_OFFSET]) in nl80211_connect()
11889 nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ_OFFSET]); in nl80211_connect()
11894 return -EINVAL; in nl80211_connect()
11895 } else if (info->attrs[NL80211_ATTR_WIPHY_FREQ_HINT]) { in nl80211_connect()
11896 freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ_HINT]); in nl80211_connect()
11900 return -EINVAL; in nl80211_connect()
11903 if (info->attrs[NL80211_ATTR_WIPHY_EDMG_CHANNELS]) { in nl80211_connect()
11905 nla_get_u8(info->attrs[NL80211_ATTR_WIPHY_EDMG_CHANNELS]); in nl80211_connect()
11907 if (info->attrs[NL80211_ATTR_WIPHY_EDMG_BW_CONFIG]) in nl80211_connect()
11909 nla_get_u8(info->attrs[NL80211_ATTR_WIPHY_EDMG_BW_CONFIG]); in nl80211_connect()
11912 if (connect.privacy && info->attrs[NL80211_ATTR_KEYS]) { in nl80211_connect()
11918 if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_HT])) in nl80211_connect()
11921 if (info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) in nl80211_connect()
11923 nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]), in nl80211_connect()
11926 if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) { in nl80211_connect()
11927 if (!info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) { in nl80211_connect()
11929 return -EINVAL; in nl80211_connect()
11932 nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]), in nl80211_connect()
11936 if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_VHT])) in nl80211_connect()
11939 if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_HE])) in nl80211_connect()
11942 if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_EHT])) in nl80211_connect()
11945 if (info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]) in nl80211_connect()
11947 nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]), in nl80211_connect()
11950 if (info->attrs[NL80211_ATTR_VHT_CAPABILITY]) { in nl80211_connect()
11951 if (!info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]) { in nl80211_connect()
11953 return -EINVAL; in nl80211_connect()
11956 nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY]), in nl80211_connect()
11960 if (nla_get_flag(info->attrs[NL80211_ATTR_USE_RRM])) { in nl80211_connect()
11961 if (!((rdev->wiphy.features & in nl80211_connect()
11963 (rdev->wiphy.features & NL80211_FEATURE_QUIET)) && in nl80211_connect()
11964 !wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_connect()
11967 return -EINVAL; in nl80211_connect()
11972 connect.pbss = nla_get_flag(info->attrs[NL80211_ATTR_PBSS]); in nl80211_connect()
11973 if (connect.pbss && !rdev->wiphy.bands[NL80211_BAND_60GHZ]) { in nl80211_connect()
11975 return -EOPNOTSUPP; in nl80211_connect()
11978 if (info->attrs[NL80211_ATTR_BSS_SELECT]) { in nl80211_connect()
11982 return -EINVAL; in nl80211_connect()
11985 err = parse_bss_select(info->attrs[NL80211_ATTR_BSS_SELECT], in nl80211_connect()
11993 if (wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_connect()
11995 info->attrs[NL80211_ATTR_FILS_ERP_USERNAME] && in nl80211_connect()
11996 info->attrs[NL80211_ATTR_FILS_ERP_REALM] && in nl80211_connect()
11997 info->attrs[NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM] && in nl80211_connect()
11998 info->attrs[NL80211_ATTR_FILS_ERP_RRK]) { in nl80211_connect()
12000 nla_data(info->attrs[NL80211_ATTR_FILS_ERP_USERNAME]); in nl80211_connect()
12002 nla_len(info->attrs[NL80211_ATTR_FILS_ERP_USERNAME]); in nl80211_connect()
12004 nla_data(info->attrs[NL80211_ATTR_FILS_ERP_REALM]); in nl80211_connect()
12006 nla_len(info->attrs[NL80211_ATTR_FILS_ERP_REALM]); in nl80211_connect()
12009 info->attrs[NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM]); in nl80211_connect()
12011 nla_data(info->attrs[NL80211_ATTR_FILS_ERP_RRK]); in nl80211_connect()
12013 nla_len(info->attrs[NL80211_ATTR_FILS_ERP_RRK]); in nl80211_connect()
12014 } else if (info->attrs[NL80211_ATTR_FILS_ERP_USERNAME] || in nl80211_connect()
12015 info->attrs[NL80211_ATTR_FILS_ERP_REALM] || in nl80211_connect()
12016 info->attrs[NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM] || in nl80211_connect()
12017 info->attrs[NL80211_ATTR_FILS_ERP_RRK]) { in nl80211_connect()
12019 return -EINVAL; in nl80211_connect()
12022 if (nla_get_flag(info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])) { in nl80211_connect()
12023 if (!info->attrs[NL80211_ATTR_SOCKET_OWNER]) { in nl80211_connect()
12027 return -EINVAL; in nl80211_connect()
12032 if (nla_get_flag(info->attrs[NL80211_ATTR_MLO_SUPPORT])) in nl80211_connect()
12035 wdev_lock(dev->ieee80211_ptr); in nl80211_connect()
12042 if (!err && info->attrs[NL80211_ATTR_SOCKET_OWNER]) { in nl80211_connect()
12043 dev->ieee80211_ptr->conn_owner_nlportid = info->snd_portid; in nl80211_connect()
12045 memcpy(dev->ieee80211_ptr->disconnect_bssid, in nl80211_connect()
12048 eth_zero_addr(dev->ieee80211_ptr->disconnect_bssid); in nl80211_connect()
12051 wdev_unlock(dev->ieee80211_ptr); in nl80211_connect()
12060 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_update_connect_params()
12061 struct net_device *dev = info->user_ptr[1]; in nl80211_update_connect_params()
12062 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_update_connect_params()
12068 if (!rdev->ops->update_connect_params) in nl80211_update_connect_params()
12069 return -EOPNOTSUPP; in nl80211_update_connect_params()
12071 if (info->attrs[NL80211_ATTR_IE]) { in nl80211_update_connect_params()
12072 connect.ie = nla_data(info->attrs[NL80211_ATTR_IE]); in nl80211_update_connect_params()
12073 connect.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); in nl80211_update_connect_params()
12077 fils_sk_offload = wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_update_connect_params()
12081 * when driver supports fils-sk offload all attributes must be in nl80211_update_connect_params()
12082 * provided. So the else covers "fils-sk-not-all" and in nl80211_update_connect_params()
12083 * "no-fils-sk-any". in nl80211_update_connect_params()
12086 info->attrs[NL80211_ATTR_FILS_ERP_USERNAME] && in nl80211_update_connect_params()
12087 info->attrs[NL80211_ATTR_FILS_ERP_REALM] && in nl80211_update_connect_params()
12088 info->attrs[NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM] && in nl80211_update_connect_params()
12089 info->attrs[NL80211_ATTR_FILS_ERP_RRK]) { in nl80211_update_connect_params()
12091 nla_data(info->attrs[NL80211_ATTR_FILS_ERP_USERNAME]); in nl80211_update_connect_params()
12093 nla_len(info->attrs[NL80211_ATTR_FILS_ERP_USERNAME]); in nl80211_update_connect_params()
12095 nla_data(info->attrs[NL80211_ATTR_FILS_ERP_REALM]); in nl80211_update_connect_params()
12097 nla_len(info->attrs[NL80211_ATTR_FILS_ERP_REALM]); in nl80211_update_connect_params()
12100 info->attrs[NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM]); in nl80211_update_connect_params()
12102 nla_data(info->attrs[NL80211_ATTR_FILS_ERP_RRK]); in nl80211_update_connect_params()
12104 nla_len(info->attrs[NL80211_ATTR_FILS_ERP_RRK]); in nl80211_update_connect_params()
12106 } else if (info->attrs[NL80211_ATTR_FILS_ERP_USERNAME] || in nl80211_update_connect_params()
12107 info->attrs[NL80211_ATTR_FILS_ERP_REALM] || in nl80211_update_connect_params()
12108 info->attrs[NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM] || in nl80211_update_connect_params()
12109 info->attrs[NL80211_ATTR_FILS_ERP_RRK]) { in nl80211_update_connect_params()
12110 return -EINVAL; in nl80211_update_connect_params()
12113 if (info->attrs[NL80211_ATTR_AUTH_TYPE]) { in nl80211_update_connect_params()
12114 auth_type = nla_get_u32(info->attrs[NL80211_ATTR_AUTH_TYPE]); in nl80211_update_connect_params()
12117 return -EINVAL; in nl80211_update_connect_params()
12121 return -EINVAL; in nl80211_update_connect_params()
12127 wdev_lock(dev->ieee80211_ptr); in nl80211_update_connect_params()
12128 if (!wdev->connected) in nl80211_update_connect_params()
12129 ret = -ENOLINK; in nl80211_update_connect_params()
12132 wdev_unlock(dev->ieee80211_ptr); in nl80211_update_connect_params()
12139 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_disconnect()
12140 struct net_device *dev = info->user_ptr[1]; in nl80211_disconnect()
12144 if (dev->ieee80211_ptr->conn_owner_nlportid && in nl80211_disconnect()
12145 dev->ieee80211_ptr->conn_owner_nlportid != info->snd_portid) in nl80211_disconnect()
12146 return -EPERM; in nl80211_disconnect()
12148 if (!info->attrs[NL80211_ATTR_REASON_CODE]) in nl80211_disconnect()
12151 reason = nla_get_u16(info->attrs[NL80211_ATTR_REASON_CODE]); in nl80211_disconnect()
12154 return -EINVAL; in nl80211_disconnect()
12156 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && in nl80211_disconnect()
12157 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) in nl80211_disconnect()
12158 return -EOPNOTSUPP; in nl80211_disconnect()
12160 wdev_lock(dev->ieee80211_ptr); in nl80211_disconnect()
12162 wdev_unlock(dev->ieee80211_ptr); in nl80211_disconnect()
12168 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_wiphy_netns()
12172 if (info->attrs[NL80211_ATTR_PID]) { in nl80211_wiphy_netns()
12173 u32 pid = nla_get_u32(info->attrs[NL80211_ATTR_PID]); in nl80211_wiphy_netns()
12176 } else if (info->attrs[NL80211_ATTR_NETNS_FD]) { in nl80211_wiphy_netns()
12177 u32 fd = nla_get_u32(info->attrs[NL80211_ATTR_NETNS_FD]); in nl80211_wiphy_netns()
12181 return -EINVAL; in nl80211_wiphy_netns()
12190 if (!net_eq(wiphy_net(&rdev->wiphy), net)) in nl80211_wiphy_netns()
12199 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_setdel_pmksa()
12202 struct net_device *dev = info->user_ptr[1]; in nl80211_setdel_pmksa()
12207 if (!info->attrs[NL80211_ATTR_PMKID]) in nl80211_setdel_pmksa()
12208 return -EINVAL; in nl80211_setdel_pmksa()
12210 pmksa.pmkid = nla_data(info->attrs[NL80211_ATTR_PMKID]); in nl80211_setdel_pmksa()
12212 if (info->attrs[NL80211_ATTR_MAC]) { in nl80211_setdel_pmksa()
12213 pmksa.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_setdel_pmksa()
12214 } else if (info->attrs[NL80211_ATTR_SSID] && in nl80211_setdel_pmksa()
12215 info->attrs[NL80211_ATTR_FILS_CACHE_ID] && in nl80211_setdel_pmksa()
12216 (info->genlhdr->cmd == NL80211_CMD_DEL_PMKSA || in nl80211_setdel_pmksa()
12217 info->attrs[NL80211_ATTR_PMK])) { in nl80211_setdel_pmksa()
12218 pmksa.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]); in nl80211_setdel_pmksa()
12219 pmksa.ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); in nl80211_setdel_pmksa()
12221 nla_data(info->attrs[NL80211_ATTR_FILS_CACHE_ID]); in nl80211_setdel_pmksa()
12223 return -EINVAL; in nl80211_setdel_pmksa()
12225 if (info->attrs[NL80211_ATTR_PMK]) { in nl80211_setdel_pmksa()
12226 pmksa.pmk = nla_data(info->attrs[NL80211_ATTR_PMK]); in nl80211_setdel_pmksa()
12227 pmksa.pmk_len = nla_len(info->attrs[NL80211_ATTR_PMK]); in nl80211_setdel_pmksa()
12230 if (info->attrs[NL80211_ATTR_PMK_LIFETIME]) in nl80211_setdel_pmksa()
12232 nla_get_u32(info->attrs[NL80211_ATTR_PMK_LIFETIME]); in nl80211_setdel_pmksa()
12234 if (info->attrs[NL80211_ATTR_PMK_REAUTH_THRESHOLD]) in nl80211_setdel_pmksa()
12237 info->attrs[NL80211_ATTR_PMK_REAUTH_THRESHOLD]); in nl80211_setdel_pmksa()
12239 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && in nl80211_setdel_pmksa()
12240 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT && in nl80211_setdel_pmksa()
12241 !(dev->ieee80211_ptr->iftype == NL80211_IFTYPE_AP && in nl80211_setdel_pmksa()
12242 wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_setdel_pmksa()
12244 return -EOPNOTSUPP; in nl80211_setdel_pmksa()
12246 switch (info->genlhdr->cmd) { in nl80211_setdel_pmksa()
12248 rdev_ops = rdev->ops->set_pmksa; in nl80211_setdel_pmksa()
12251 rdev_ops = rdev->ops->del_pmksa; in nl80211_setdel_pmksa()
12259 return -EOPNOTSUPP; in nl80211_setdel_pmksa()
12261 return rdev_ops(&rdev->wiphy, dev, &pmksa); in nl80211_setdel_pmksa()
12266 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_flush_pmksa()
12267 struct net_device *dev = info->user_ptr[1]; in nl80211_flush_pmksa()
12269 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && in nl80211_flush_pmksa()
12270 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) in nl80211_flush_pmksa()
12271 return -EOPNOTSUPP; in nl80211_flush_pmksa()
12273 if (!rdev->ops->flush_pmksa) in nl80211_flush_pmksa()
12274 return -EOPNOTSUPP; in nl80211_flush_pmksa()
12281 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_tdls_mgmt()
12282 struct net_device *dev = info->user_ptr[1]; in nl80211_tdls_mgmt()
12290 if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) || in nl80211_tdls_mgmt()
12291 !rdev->ops->tdls_mgmt) in nl80211_tdls_mgmt()
12292 return -EOPNOTSUPP; in nl80211_tdls_mgmt()
12294 if (!info->attrs[NL80211_ATTR_TDLS_ACTION] || in nl80211_tdls_mgmt()
12295 !info->attrs[NL80211_ATTR_STATUS_CODE] || in nl80211_tdls_mgmt()
12296 !info->attrs[NL80211_ATTR_TDLS_DIALOG_TOKEN] || in nl80211_tdls_mgmt()
12297 !info->attrs[NL80211_ATTR_IE] || in nl80211_tdls_mgmt()
12298 !info->attrs[NL80211_ATTR_MAC]) in nl80211_tdls_mgmt()
12299 return -EINVAL; in nl80211_tdls_mgmt()
12301 peer = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_tdls_mgmt()
12302 action_code = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_ACTION]); in nl80211_tdls_mgmt()
12303 status_code = nla_get_u16(info->attrs[NL80211_ATTR_STATUS_CODE]); in nl80211_tdls_mgmt()
12304 dialog_token = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_DIALOG_TOKEN]); in nl80211_tdls_mgmt()
12305 initiator = nla_get_flag(info->attrs[NL80211_ATTR_TDLS_INITIATOR]); in nl80211_tdls_mgmt()
12306 if (info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY]) in nl80211_tdls_mgmt()
12308 nla_get_u32(info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY]); in nl80211_tdls_mgmt()
12309 link_id = nl80211_link_id_or_invalid(info->attrs); in nl80211_tdls_mgmt()
12314 nla_data(info->attrs[NL80211_ATTR_IE]), in nl80211_tdls_mgmt()
12315 nla_len(info->attrs[NL80211_ATTR_IE])); in nl80211_tdls_mgmt()
12320 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_tdls_oper()
12321 struct net_device *dev = info->user_ptr[1]; in nl80211_tdls_oper()
12325 if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) || in nl80211_tdls_oper()
12326 !rdev->ops->tdls_oper) in nl80211_tdls_oper()
12327 return -EOPNOTSUPP; in nl80211_tdls_oper()
12329 if (!info->attrs[NL80211_ATTR_TDLS_OPERATION] || in nl80211_tdls_oper()
12330 !info->attrs[NL80211_ATTR_MAC]) in nl80211_tdls_oper()
12331 return -EINVAL; in nl80211_tdls_oper()
12333 operation = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_OPERATION]); in nl80211_tdls_oper()
12334 peer = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_tdls_oper()
12342 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_remain_on_channel()
12343 unsigned int link_id = nl80211_link_id(info->attrs); in nl80211_remain_on_channel()
12344 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_remain_on_channel()
12352 if (!info->attrs[NL80211_ATTR_WIPHY_FREQ] || in nl80211_remain_on_channel()
12353 !info->attrs[NL80211_ATTR_DURATION]) in nl80211_remain_on_channel()
12354 return -EINVAL; in nl80211_remain_on_channel()
12356 duration = nla_get_u32(info->attrs[NL80211_ATTR_DURATION]); in nl80211_remain_on_channel()
12358 if (!rdev->ops->remain_on_channel || in nl80211_remain_on_channel()
12359 !(rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL)) in nl80211_remain_on_channel()
12360 return -EOPNOTSUPP; in nl80211_remain_on_channel()
12367 duration > rdev->wiphy.max_remain_on_channel_duration) in nl80211_remain_on_channel()
12368 return -EINVAL; in nl80211_remain_on_channel()
12384 return -EBUSY; in nl80211_remain_on_channel()
12393 return -EBUSY; in nl80211_remain_on_channel()
12400 return -ENOMEM; in nl80211_remain_on_channel()
12402 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, in nl80211_remain_on_channel()
12405 err = -ENOBUFS; in nl80211_remain_on_channel()
12424 err = -ENOBUFS; in nl80211_remain_on_channel()
12433 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_cancel_remain_on_channel()
12434 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_cancel_remain_on_channel()
12437 if (!info->attrs[NL80211_ATTR_COOKIE]) in nl80211_cancel_remain_on_channel()
12438 return -EINVAL; in nl80211_cancel_remain_on_channel()
12440 if (!rdev->ops->cancel_remain_on_channel) in nl80211_cancel_remain_on_channel()
12441 return -EOPNOTSUPP; in nl80211_cancel_remain_on_channel()
12443 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]); in nl80211_cancel_remain_on_channel()
12452 unsigned int link_id = nl80211_link_id(info->attrs); in nl80211_set_tx_bitrate_mask()
12453 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_tx_bitrate_mask()
12454 struct net_device *dev = info->user_ptr[1]; in nl80211_set_tx_bitrate_mask()
12455 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_set_tx_bitrate_mask()
12458 if (!rdev->ops->set_bitrate_mask) in nl80211_set_tx_bitrate_mask()
12459 return -EOPNOTSUPP; in nl80211_set_tx_bitrate_mask()
12462 err = nl80211_parse_tx_bitrate_mask(info, info->attrs, in nl80211_set_tx_bitrate_mask()
12476 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_register_mgmt()
12477 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_register_mgmt()
12480 if (!info->attrs[NL80211_ATTR_FRAME_MATCH]) in nl80211_register_mgmt()
12481 return -EINVAL; in nl80211_register_mgmt()
12483 if (info->attrs[NL80211_ATTR_FRAME_TYPE]) in nl80211_register_mgmt()
12484 frame_type = nla_get_u16(info->attrs[NL80211_ATTR_FRAME_TYPE]); in nl80211_register_mgmt()
12486 switch (wdev->iftype) { in nl80211_register_mgmt()
12497 if (!wiphy_ext_feature_isset(wdev->wiphy, in nl80211_register_mgmt()
12499 return -EOPNOTSUPP; in nl80211_register_mgmt()
12502 return -EOPNOTSUPP; in nl80211_register_mgmt()
12506 if (!rdev->ops->mgmt_tx) in nl80211_register_mgmt()
12507 return -EOPNOTSUPP; in nl80211_register_mgmt()
12509 if (info->attrs[NL80211_ATTR_RECEIVE_MULTICAST] && in nl80211_register_mgmt()
12510 !wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_register_mgmt()
12513 "multicast RX registrations are not supported"); in nl80211_register_mgmt()
12514 return -EOPNOTSUPP; in nl80211_register_mgmt()
12517 return cfg80211_mlme_register_mgmt(wdev, info->snd_portid, frame_type, in nl80211_register_mgmt()
12518 nla_data(info->attrs[NL80211_ATTR_FRAME_MATCH]), in nl80211_register_mgmt()
12519 nla_len(info->attrs[NL80211_ATTR_FRAME_MATCH]), in nl80211_register_mgmt()
12520 info->attrs[NL80211_ATTR_RECEIVE_MULTICAST], in nl80211_register_mgmt()
12521 info->extack); in nl80211_register_mgmt()
12526 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_tx_mgmt()
12527 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_tx_mgmt()
12535 info->attrs[NL80211_ATTR_DONT_WAIT_FOR_ACK], in nl80211_tx_mgmt()
12538 if (!info->attrs[NL80211_ATTR_FRAME]) in nl80211_tx_mgmt()
12539 return -EINVAL; in nl80211_tx_mgmt()
12541 if (!rdev->ops->mgmt_tx) in nl80211_tx_mgmt()
12542 return -EOPNOTSUPP; in nl80211_tx_mgmt()
12544 switch (wdev->iftype) { in nl80211_tx_mgmt()
12546 if (!info->attrs[NL80211_ATTR_WIPHY_FREQ]) in nl80211_tx_mgmt()
12547 return -EINVAL; in nl80211_tx_mgmt()
12558 if (!wiphy_ext_feature_isset(wdev->wiphy, in nl80211_tx_mgmt()
12560 return -EOPNOTSUPP; in nl80211_tx_mgmt()
12563 return -EOPNOTSUPP; in nl80211_tx_mgmt()
12566 if (info->attrs[NL80211_ATTR_DURATION]) { in nl80211_tx_mgmt()
12567 if (!(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX)) in nl80211_tx_mgmt()
12568 return -EINVAL; in nl80211_tx_mgmt()
12569 params.wait = nla_get_u32(info->attrs[NL80211_ATTR_DURATION]); in nl80211_tx_mgmt()
12576 params.wait > rdev->wiphy.max_remain_on_channel_duration) in nl80211_tx_mgmt()
12577 return -EINVAL; in nl80211_tx_mgmt()
12580 params.offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK]; in nl80211_tx_mgmt()
12582 if (params.offchan && !(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX)) in nl80211_tx_mgmt()
12583 return -EINVAL; in nl80211_tx_mgmt()
12585 params.no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); in nl80211_tx_mgmt()
12591 if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { in nl80211_tx_mgmt()
12598 return -EINVAL; in nl80211_tx_mgmt()
12604 return -EBUSY; in nl80211_tx_mgmt()
12607 params.link_id = nl80211_link_id_or_invalid(info->attrs); in nl80211_tx_mgmt()
12614 !(wdev->valid_links & BIT(params.link_id))) { in nl80211_tx_mgmt()
12616 return -EINVAL; in nl80211_tx_mgmt()
12620 params.buf = nla_data(info->attrs[NL80211_ATTR_FRAME]); in nl80211_tx_mgmt()
12621 params.len = nla_len(info->attrs[NL80211_ATTR_FRAME]); in nl80211_tx_mgmt()
12623 if (info->attrs[NL80211_ATTR_CSA_C_OFFSETS_TX]) { in nl80211_tx_mgmt()
12624 int len = nla_len(info->attrs[NL80211_ATTR_CSA_C_OFFSETS_TX]); in nl80211_tx_mgmt()
12628 return -EINVAL; in nl80211_tx_mgmt()
12632 nla_data(info->attrs[NL80211_ATTR_CSA_C_OFFSETS_TX]); in nl80211_tx_mgmt()
12637 return -EINVAL; in nl80211_tx_mgmt()
12644 return -ENOMEM; in nl80211_tx_mgmt()
12646 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, in nl80211_tx_mgmt()
12649 err = -ENOBUFS; in nl80211_tx_mgmt()
12671 err = -ENOBUFS; in nl80211_tx_mgmt()
12679 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_tx_mgmt_cancel_wait()
12680 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_tx_mgmt_cancel_wait()
12683 if (!info->attrs[NL80211_ATTR_COOKIE]) in nl80211_tx_mgmt_cancel_wait()
12684 return -EINVAL; in nl80211_tx_mgmt_cancel_wait()
12686 if (!rdev->ops->mgmt_tx_cancel_wait) in nl80211_tx_mgmt_cancel_wait()
12687 return -EOPNOTSUPP; in nl80211_tx_mgmt_cancel_wait()
12689 switch (wdev->iftype) { in nl80211_tx_mgmt_cancel_wait()
12699 if (!wiphy_ext_feature_isset(wdev->wiphy, in nl80211_tx_mgmt_cancel_wait()
12701 return -EOPNOTSUPP; in nl80211_tx_mgmt_cancel_wait()
12704 return -EOPNOTSUPP; in nl80211_tx_mgmt_cancel_wait()
12707 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]); in nl80211_tx_mgmt_cancel_wait()
12714 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_power_save()
12716 struct net_device *dev = info->user_ptr[1]; in nl80211_set_power_save()
12721 if (!info->attrs[NL80211_ATTR_PS_STATE]) in nl80211_set_power_save()
12722 return -EINVAL; in nl80211_set_power_save()
12724 ps_state = nla_get_u32(info->attrs[NL80211_ATTR_PS_STATE]); in nl80211_set_power_save()
12726 wdev = dev->ieee80211_ptr; in nl80211_set_power_save()
12728 if (!rdev->ops->set_power_mgmt) in nl80211_set_power_save()
12729 return -EOPNOTSUPP; in nl80211_set_power_save()
12733 if (state == wdev->ps) in nl80211_set_power_save()
12736 err = rdev_set_power_mgmt(rdev, dev, state, wdev->ps_timeout); in nl80211_set_power_save()
12738 wdev->ps = state; in nl80211_set_power_save()
12744 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_get_power_save()
12747 struct net_device *dev = info->user_ptr[1]; in nl80211_get_power_save()
12752 wdev = dev->ieee80211_ptr; in nl80211_get_power_save()
12754 if (!rdev->ops->set_power_mgmt) in nl80211_get_power_save()
12755 return -EOPNOTSUPP; in nl80211_get_power_save()
12759 return -ENOMEM; in nl80211_get_power_save()
12761 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, in nl80211_get_power_save()
12764 err = -ENOBUFS; in nl80211_get_power_save()
12768 if (wdev->ps) in nl80211_get_power_save()
12780 err = -ENOBUFS; in nl80211_get_power_save()
12800 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_cqm_txe()
12801 struct net_device *dev = info->user_ptr[1]; in nl80211_set_cqm_txe()
12802 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_set_cqm_txe()
12805 return -EINVAL; in nl80211_set_cqm_txe()
12807 if (!rdev->ops->set_cqm_txe_config) in nl80211_set_cqm_txe()
12808 return -EOPNOTSUPP; in nl80211_set_cqm_txe()
12810 if (wdev->iftype != NL80211_IFTYPE_STATION && in nl80211_set_cqm_txe()
12811 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT) in nl80211_set_cqm_txe()
12812 return -EOPNOTSUPP; in nl80211_set_cqm_txe()
12821 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_cqm_rssi_update()
12837 if (!cqm_config->last_rssi_event_value && in cfg80211_cqm_rssi_update()
12838 wdev->links[0].client.current_bss && in cfg80211_cqm_rssi_update()
12839 rdev->ops->get_station) { in cfg80211_cqm_rssi_update()
12843 mac_addr = wdev->links[0].client.current_bss->pub.bssid; in cfg80211_cqm_rssi_update()
12851 cqm_config->last_rssi_event_value = in cfg80211_cqm_rssi_update()
12855 last = cqm_config->last_rssi_event_value; in cfg80211_cqm_rssi_update()
12856 hyst = cqm_config->rssi_hyst; in cfg80211_cqm_rssi_update()
12857 n = cqm_config->n_rssi_thresholds; in cfg80211_cqm_rssi_update()
12861 if (last < cqm_config->rssi_thresholds[i]) in cfg80211_cqm_rssi_update()
12865 low_index = i - 1; in cfg80211_cqm_rssi_update()
12868 low = cqm_config->rssi_thresholds[low_index] - hyst; in cfg80211_cqm_rssi_update()
12874 high = cqm_config->rssi_thresholds[i] + hyst - 1; in cfg80211_cqm_rssi_update()
12886 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_cqm_rssi()
12888 struct net_device *dev = info->user_ptr[1]; in nl80211_set_cqm_rssi()
12889 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_set_cqm_rssi()
12896 return -EINVAL; in nl80211_set_cqm_rssi()
12901 if (wdev->iftype != NL80211_IFTYPE_STATION && in nl80211_set_cqm_rssi()
12902 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT) in nl80211_set_cqm_rssi()
12903 return -EOPNOTSUPP; in nl80211_set_cqm_rssi()
12905 if (n_thresholds <= 1 && rdev->ops->set_cqm_rssi_config) { in nl80211_set_cqm_rssi()
12913 if (!wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_set_cqm_rssi()
12915 return -EOPNOTSUPP; in nl80211_set_cqm_rssi()
12921 old = rcu_dereference_protected(wdev->cqm_config, in nl80211_set_cqm_rssi()
12922 lockdep_is_held(&wdev->mtx)); in nl80211_set_cqm_rssi()
12929 err = -ENOMEM; in nl80211_set_cqm_rssi()
12933 cqm_config->rssi_hyst = hysteresis; in nl80211_set_cqm_rssi()
12934 cqm_config->n_rssi_thresholds = n_thresholds; in nl80211_set_cqm_rssi()
12935 memcpy(cqm_config->rssi_thresholds, thresholds, in nl80211_set_cqm_rssi()
12939 rcu_assign_pointer(wdev->cqm_config, cqm_config); in nl80211_set_cqm_rssi()
12941 RCU_INIT_POINTER(wdev->cqm_config, NULL); in nl80211_set_cqm_rssi()
12946 rcu_assign_pointer(wdev->cqm_config, old); in nl80211_set_cqm_rssi()
12963 cqm = info->attrs[NL80211_ATTR_CQM]; in nl80211_set_cqm()
12965 return -EINVAL; in nl80211_set_cqm()
12969 info->extack); in nl80211_set_cqm()
12981 return -EINVAL; in nl80211_set_cqm()
12997 return -EINVAL; in nl80211_set_cqm()
13002 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_join_ocb()
13003 struct net_device *dev = info->user_ptr[1]; in nl80211_join_ocb()
13016 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_leave_ocb()
13017 struct net_device *dev = info->user_ptr[1]; in nl80211_leave_ocb()
13024 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_join_mesh()
13025 struct net_device *dev = info->user_ptr[1]; in nl80211_join_mesh()
13034 if (info->attrs[NL80211_ATTR_MESH_CONFIG]) { in nl80211_join_mesh()
13041 if (!info->attrs[NL80211_ATTR_MESH_ID] || in nl80211_join_mesh()
13042 !nla_len(info->attrs[NL80211_ATTR_MESH_ID])) in nl80211_join_mesh()
13043 return -EINVAL; in nl80211_join_mesh()
13045 setup.mesh_id = nla_data(info->attrs[NL80211_ATTR_MESH_ID]); in nl80211_join_mesh()
13046 setup.mesh_id_len = nla_len(info->attrs[NL80211_ATTR_MESH_ID]); in nl80211_join_mesh()
13048 if (info->attrs[NL80211_ATTR_MCAST_RATE] && in nl80211_join_mesh()
13050 nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE]))) in nl80211_join_mesh()
13051 return -EINVAL; in nl80211_join_mesh()
13053 if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) { in nl80211_join_mesh()
13055 nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]); in nl80211_join_mesh()
13064 if (info->attrs[NL80211_ATTR_DTIM_PERIOD]) { in nl80211_join_mesh()
13066 nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]); in nl80211_join_mesh()
13068 return -EINVAL; in nl80211_join_mesh()
13071 if (info->attrs[NL80211_ATTR_MESH_SETUP]) { in nl80211_join_mesh()
13081 if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { in nl80211_join_mesh()
13090 if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) { in nl80211_join_mesh()
13091 u8 *rates = nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); in nl80211_join_mesh()
13093 nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); in nl80211_join_mesh()
13097 return -EINVAL; in nl80211_join_mesh()
13099 sband = rdev->wiphy.bands[setup.chandef.chan->band]; in nl80211_join_mesh()
13107 if (info->attrs[NL80211_ATTR_TX_RATES]) { in nl80211_join_mesh()
13108 err = nl80211_parse_tx_bitrate_mask(info, info->attrs, in nl80211_join_mesh()
13116 return -EINVAL; in nl80211_join_mesh()
13118 err = validate_beacon_tx_rate(rdev, setup.chandef.chan->band, in nl80211_join_mesh()
13125 nla_get_flag(info->attrs[NL80211_ATTR_HANDLE_DFS]); in nl80211_join_mesh()
13127 if (info->attrs[NL80211_ATTR_CONTROL_PORT_OVER_NL80211]) { in nl80211_join_mesh()
13136 wdev_lock(dev->ieee80211_ptr); in nl80211_join_mesh()
13138 if (!err && info->attrs[NL80211_ATTR_SOCKET_OWNER]) in nl80211_join_mesh()
13139 dev->ieee80211_ptr->conn_owner_nlportid = info->snd_portid; in nl80211_join_mesh()
13140 wdev_unlock(dev->ieee80211_ptr); in nl80211_join_mesh()
13147 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_leave_mesh()
13148 struct net_device *dev = info->user_ptr[1]; in nl80211_leave_mesh()
13157 struct cfg80211_wowlan *wowlan = rdev->wiphy.wowlan_config; in nl80211_send_wowlan_patterns()
13161 if (!wowlan->n_patterns) in nl80211_send_wowlan_patterns()
13166 return -ENOBUFS; in nl80211_send_wowlan_patterns()
13168 for (i = 0; i < wowlan->n_patterns; i++) { in nl80211_send_wowlan_patterns()
13171 return -ENOBUFS; in nl80211_send_wowlan_patterns()
13172 pat_len = wowlan->patterns[i].pattern_len; in nl80211_send_wowlan_patterns()
13174 wowlan->patterns[i].mask) || in nl80211_send_wowlan_patterns()
13176 wowlan->patterns[i].pattern) || in nl80211_send_wowlan_patterns()
13178 wowlan->patterns[i].pkt_offset)) in nl80211_send_wowlan_patterns()
13179 return -ENOBUFS; in nl80211_send_wowlan_patterns()
13198 return -ENOBUFS; in nl80211_send_wowlan_tcp()
13200 if (nla_put_in_addr(msg, NL80211_WOWLAN_TCP_SRC_IPV4, tcp->src) || in nl80211_send_wowlan_tcp()
13201 nla_put_in_addr(msg, NL80211_WOWLAN_TCP_DST_IPV4, tcp->dst) || in nl80211_send_wowlan_tcp()
13202 nla_put(msg, NL80211_WOWLAN_TCP_DST_MAC, ETH_ALEN, tcp->dst_mac) || in nl80211_send_wowlan_tcp()
13203 nla_put_u16(msg, NL80211_WOWLAN_TCP_SRC_PORT, tcp->src_port) || in nl80211_send_wowlan_tcp()
13204 nla_put_u16(msg, NL80211_WOWLAN_TCP_DST_PORT, tcp->dst_port) || in nl80211_send_wowlan_tcp()
13206 tcp->payload_len, tcp->payload) || in nl80211_send_wowlan_tcp()
13208 tcp->data_interval) || in nl80211_send_wowlan_tcp()
13210 tcp->wake_len, tcp->wake_data) || in nl80211_send_wowlan_tcp()
13212 DIV_ROUND_UP(tcp->wake_len, 8), tcp->wake_mask)) in nl80211_send_wowlan_tcp()
13213 return -ENOBUFS; in nl80211_send_wowlan_tcp()
13215 if (tcp->payload_seq.len && in nl80211_send_wowlan_tcp()
13217 sizeof(tcp->payload_seq), &tcp->payload_seq)) in nl80211_send_wowlan_tcp()
13218 return -ENOBUFS; in nl80211_send_wowlan_tcp()
13220 if (tcp->payload_tok.len && in nl80211_send_wowlan_tcp()
13222 sizeof(tcp->payload_tok) + tcp->tokens_size, in nl80211_send_wowlan_tcp()
13223 &tcp->payload_tok)) in nl80211_send_wowlan_tcp()
13224 return -ENOBUFS; in nl80211_send_wowlan_tcp()
13242 return -ENOBUFS; in nl80211_send_wowlan_nd()
13244 if (req->n_scan_plans == 1 && in nl80211_send_wowlan_nd()
13246 req->scan_plans[0].interval * 1000)) in nl80211_send_wowlan_nd()
13247 return -ENOBUFS; in nl80211_send_wowlan_nd()
13249 if (nla_put_u32(msg, NL80211_ATTR_SCHED_SCAN_DELAY, req->delay)) in nl80211_send_wowlan_nd()
13250 return -ENOBUFS; in nl80211_send_wowlan_nd()
13252 if (req->relative_rssi_set) { in nl80211_send_wowlan_nd()
13256 req->relative_rssi)) in nl80211_send_wowlan_nd()
13257 return -ENOBUFS; in nl80211_send_wowlan_nd()
13259 rssi_adjust.band = req->rssi_adjust.band; in nl80211_send_wowlan_nd()
13260 rssi_adjust.delta = req->rssi_adjust.delta; in nl80211_send_wowlan_nd()
13263 return -ENOBUFS; in nl80211_send_wowlan_nd()
13268 return -ENOBUFS; in nl80211_send_wowlan_nd()
13270 for (i = 0; i < req->n_channels; i++) { in nl80211_send_wowlan_nd()
13271 if (nla_put_u32(msg, i, req->channels[i]->center_freq)) in nl80211_send_wowlan_nd()
13272 return -ENOBUFS; in nl80211_send_wowlan_nd()
13277 if (req->n_match_sets) { in nl80211_send_wowlan_nd()
13281 return -ENOBUFS; in nl80211_send_wowlan_nd()
13283 for (i = 0; i < req->n_match_sets; i++) { in nl80211_send_wowlan_nd()
13286 return -ENOBUFS; in nl80211_send_wowlan_nd()
13289 req->match_sets[i].ssid.ssid_len, in nl80211_send_wowlan_nd()
13290 req->match_sets[i].ssid.ssid)) in nl80211_send_wowlan_nd()
13291 return -ENOBUFS; in nl80211_send_wowlan_nd()
13299 return -ENOBUFS; in nl80211_send_wowlan_nd()
13301 for (i = 0; i < req->n_scan_plans; i++) { in nl80211_send_wowlan_nd()
13304 return -ENOBUFS; in nl80211_send_wowlan_nd()
13307 req->scan_plans[i].interval) || in nl80211_send_wowlan_nd()
13308 (req->scan_plans[i].iterations && in nl80211_send_wowlan_nd()
13310 req->scan_plans[i].iterations))) in nl80211_send_wowlan_nd()
13311 return -ENOBUFS; in nl80211_send_wowlan_nd()
13323 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_get_wowlan()
13328 if (!rdev->wiphy.wowlan) in nl80211_get_wowlan()
13329 return -EOPNOTSUPP; in nl80211_get_wowlan()
13331 if (rdev->wiphy.wowlan_config && rdev->wiphy.wowlan_config->tcp) { in nl80211_get_wowlan()
13333 size += rdev->wiphy.wowlan_config->tcp->tokens_size + in nl80211_get_wowlan()
13334 rdev->wiphy.wowlan_config->tcp->payload_len + in nl80211_get_wowlan()
13335 rdev->wiphy.wowlan_config->tcp->wake_len + in nl80211_get_wowlan()
13336 rdev->wiphy.wowlan_config->tcp->wake_len / 8; in nl80211_get_wowlan()
13341 return -ENOMEM; in nl80211_get_wowlan()
13343 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, in nl80211_get_wowlan()
13348 if (rdev->wiphy.wowlan_config) { in nl80211_get_wowlan()
13356 if ((rdev->wiphy.wowlan_config->any && in nl80211_get_wowlan()
13358 (rdev->wiphy.wowlan_config->disconnect && in nl80211_get_wowlan()
13360 (rdev->wiphy.wowlan_config->magic_pkt && in nl80211_get_wowlan()
13362 (rdev->wiphy.wowlan_config->gtk_rekey_failure && in nl80211_get_wowlan()
13364 (rdev->wiphy.wowlan_config->eap_identity_req && in nl80211_get_wowlan()
13366 (rdev->wiphy.wowlan_config->four_way_handshake && in nl80211_get_wowlan()
13368 (rdev->wiphy.wowlan_config->rfkill_release && in nl80211_get_wowlan()
13376 rdev->wiphy.wowlan_config->tcp)) in nl80211_get_wowlan()
13381 rdev->wiphy.wowlan_config->nd_config)) in nl80211_get_wowlan()
13392 return -ENOBUFS; in nl80211_get_wowlan()
13397 struct cfg80211_wowlan *trig) in nl80211_parse_wowlan_tcp() argument
13407 if (!rdev->wiphy.wowlan->tcp) in nl80211_parse_wowlan_tcp()
13408 return -EINVAL; in nl80211_parse_wowlan_tcp()
13423 return -EINVAL; in nl80211_parse_wowlan_tcp()
13426 if (data_size > rdev->wiphy.wowlan->tcp->data_payload_max) in nl80211_parse_wowlan_tcp()
13427 return -EINVAL; in nl80211_parse_wowlan_tcp()
13430 rdev->wiphy.wowlan->tcp->data_interval_max || in nl80211_parse_wowlan_tcp()
13432 return -EINVAL; in nl80211_parse_wowlan_tcp()
13435 if (wake_size > rdev->wiphy.wowlan->tcp->wake_payload_max) in nl80211_parse_wowlan_tcp()
13436 return -EINVAL; in nl80211_parse_wowlan_tcp()
13440 return -EINVAL; in nl80211_parse_wowlan_tcp()
13446 tokens_size = tokln - sizeof(*tok); in nl80211_parse_wowlan_tcp()
13448 if (!tok->len || tokens_size % tok->len) in nl80211_parse_wowlan_tcp()
13449 return -EINVAL; in nl80211_parse_wowlan_tcp()
13450 if (!rdev->wiphy.wowlan->tcp->tok) in nl80211_parse_wowlan_tcp()
13451 return -EINVAL; in nl80211_parse_wowlan_tcp()
13452 if (tok->len > rdev->wiphy.wowlan->tcp->tok->max_len) in nl80211_parse_wowlan_tcp()
13453 return -EINVAL; in nl80211_parse_wowlan_tcp()
13454 if (tok->len < rdev->wiphy.wowlan->tcp->tok->min_len) in nl80211_parse_wowlan_tcp()
13455 return -EINVAL; in nl80211_parse_wowlan_tcp()
13456 if (tokens_size > rdev->wiphy.wowlan->tcp->tok->bufsize) in nl80211_parse_wowlan_tcp()
13457 return -EINVAL; in nl80211_parse_wowlan_tcp()
13458 if (tok->offset + tok->len > data_size) in nl80211_parse_wowlan_tcp()
13459 return -EINVAL; in nl80211_parse_wowlan_tcp()
13464 if (!rdev->wiphy.wowlan->tcp->seq) in nl80211_parse_wowlan_tcp()
13465 return -EINVAL; in nl80211_parse_wowlan_tcp()
13466 if (seq->len == 0 || seq->len > 4) in nl80211_parse_wowlan_tcp()
13467 return -EINVAL; in nl80211_parse_wowlan_tcp()
13468 if (seq->len + seq->offset > data_size) in nl80211_parse_wowlan_tcp()
13469 return -EINVAL; in nl80211_parse_wowlan_tcp()
13479 return -ENOMEM; in nl80211_parse_wowlan_tcp()
13480 cfg->src = nla_get_in_addr(tb[NL80211_WOWLAN_TCP_SRC_IPV4]); in nl80211_parse_wowlan_tcp()
13481 cfg->dst = nla_get_in_addr(tb[NL80211_WOWLAN_TCP_DST_IPV4]); in nl80211_parse_wowlan_tcp()
13482 memcpy(cfg->dst_mac, nla_data(tb[NL80211_WOWLAN_TCP_DST_MAC]), in nl80211_parse_wowlan_tcp()
13490 err = __sock_create(wiphy_net(&rdev->wiphy), PF_INET, SOCK_STREAM, in nl80211_parse_wowlan_tcp()
13491 IPPROTO_TCP, &cfg->sock, 1); in nl80211_parse_wowlan_tcp()
13496 if (inet_csk_get_port(cfg->sock->sk, port)) { in nl80211_parse_wowlan_tcp()
13497 sock_release(cfg->sock); in nl80211_parse_wowlan_tcp()
13499 return -EADDRINUSE; in nl80211_parse_wowlan_tcp()
13501 cfg->src_port = inet_sk(cfg->sock->sk)->inet_num; in nl80211_parse_wowlan_tcp()
13505 return -EINVAL; in nl80211_parse_wowlan_tcp()
13507 cfg->src_port = port; in nl80211_parse_wowlan_tcp()
13510 cfg->dst_port = nla_get_u16(tb[NL80211_WOWLAN_TCP_DST_PORT]); in nl80211_parse_wowlan_tcp()
13511 cfg->payload_len = data_size; in nl80211_parse_wowlan_tcp()
13512 cfg->payload = (u8 *)cfg + sizeof(*cfg) + tokens_size; in nl80211_parse_wowlan_tcp()
13513 memcpy((void *)cfg->payload, in nl80211_parse_wowlan_tcp()
13517 cfg->payload_seq = *seq; in nl80211_parse_wowlan_tcp()
13518 cfg->data_interval = nla_get_u32(tb[NL80211_WOWLAN_TCP_DATA_INTERVAL]); in nl80211_parse_wowlan_tcp()
13519 cfg->wake_len = wake_size; in nl80211_parse_wowlan_tcp()
13520 cfg->wake_data = (u8 *)cfg + sizeof(*cfg) + tokens_size + data_size; in nl80211_parse_wowlan_tcp()
13521 memcpy((void *)cfg->wake_data, in nl80211_parse_wowlan_tcp()
13524 cfg->wake_mask = (u8 *)cfg + sizeof(*cfg) + tokens_size + in nl80211_parse_wowlan_tcp()
13526 memcpy((void *)cfg->wake_mask, in nl80211_parse_wowlan_tcp()
13530 cfg->tokens_size = tokens_size; in nl80211_parse_wowlan_tcp()
13531 cfg->payload_tok = *tok; in nl80211_parse_wowlan_tcp()
13532 memcpy(cfg->payload_tok.token_stream, tok->token_stream, in nl80211_parse_wowlan_tcp()
13536 trig->tcp = cfg; in nl80211_parse_wowlan_tcp()
13544 struct cfg80211_wowlan *trig) in nl80211_parse_wowlan_nd() argument
13551 return -ENOMEM; in nl80211_parse_wowlan_nd()
13553 if (!(wowlan->flags & WIPHY_WOWLAN_NET_DETECT)) { in nl80211_parse_wowlan_nd()
13554 err = -EOPNOTSUPP; in nl80211_parse_wowlan_nd()
13563 trig->nd_config = nl80211_parse_sched_scan(&rdev->wiphy, NULL, tb, in nl80211_parse_wowlan_nd()
13564 wowlan->max_nd_match_sets); in nl80211_parse_wowlan_nd()
13565 err = PTR_ERR_OR_ZERO(trig->nd_config); in nl80211_parse_wowlan_nd()
13567 trig->nd_config = NULL; in nl80211_parse_wowlan_nd()
13576 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_wowlan()
13580 const struct wiphy_wowlan_support *wowlan = rdev->wiphy.wowlan; in nl80211_set_wowlan()
13582 bool prev_enabled = rdev->wiphy.wowlan_config; in nl80211_set_wowlan()
13586 return -EOPNOTSUPP; in nl80211_set_wowlan()
13588 if (!info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) { in nl80211_set_wowlan()
13590 rdev->wiphy.wowlan_config = NULL; in nl80211_set_wowlan()
13595 info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS], in nl80211_set_wowlan()
13596 nl80211_wowlan_policy, info->extack); in nl80211_set_wowlan()
13601 if (!(wowlan->flags & WIPHY_WOWLAN_ANY)) in nl80211_set_wowlan()
13602 return -EINVAL; in nl80211_set_wowlan()
13607 if (!(wowlan->flags & WIPHY_WOWLAN_DISCONNECT)) in nl80211_set_wowlan()
13608 return -EINVAL; in nl80211_set_wowlan()
13614 if (!(wowlan->flags & WIPHY_WOWLAN_MAGIC_PKT)) in nl80211_set_wowlan()
13615 return -EINVAL; in nl80211_set_wowlan()
13621 return -EINVAL; in nl80211_set_wowlan()
13624 if (!(wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE)) in nl80211_set_wowlan()
13625 return -EINVAL; in nl80211_set_wowlan()
13631 if (!(wowlan->flags & WIPHY_WOWLAN_EAP_IDENTITY_REQ)) in nl80211_set_wowlan()
13632 return -EINVAL; in nl80211_set_wowlan()
13638 if (!(wowlan->flags & WIPHY_WOWLAN_4WAY_HANDSHAKE)) in nl80211_set_wowlan()
13639 return -EINVAL; in nl80211_set_wowlan()
13645 if (!(wowlan->flags & WIPHY_WOWLAN_RFKILL_RELEASE)) in nl80211_set_wowlan()
13646 return -EINVAL; in nl80211_set_wowlan()
13662 if (n_patterns > wowlan->n_patterns) in nl80211_set_wowlan()
13663 return -EINVAL; in nl80211_set_wowlan()
13669 return -ENOMEM; in nl80211_set_wowlan()
13682 info->extack); in nl80211_set_wowlan()
13686 err = -EINVAL; in nl80211_set_wowlan()
13694 if (pat_len > wowlan->pattern_max_len || in nl80211_set_wowlan()
13695 pat_len < wowlan->pattern_min_len) in nl80211_set_wowlan()
13703 if (pkt_offset > wowlan->max_pkt_offset) in nl80211_set_wowlan()
13709 err = -ENOMEM; in nl80211_set_wowlan()
13745 * normal interrupts (like packet RX, ...) in nl80211_set_wowlan()
13750 err = -EINVAL; in nl80211_set_wowlan()
13756 err = -ENOMEM; in nl80211_set_wowlan()
13760 rdev->wiphy.wowlan_config = ntrig; in nl80211_set_wowlan()
13763 if (rdev->ops->set_wakeup && in nl80211_set_wowlan()
13764 prev_enabled != !!rdev->wiphy.wowlan_config) in nl80211_set_wowlan()
13765 rdev_set_wakeup(rdev, rdev->wiphy.wowlan_config); in nl80211_set_wowlan()
13772 if (new_triggers.tcp && new_triggers.tcp->sock) in nl80211_set_wowlan()
13773 sock_release(new_triggers.tcp->sock); in nl80211_set_wowlan()
13787 if (!rdev->coalesce->n_rules) in nl80211_send_coalesce_rules()
13792 return -ENOBUFS; in nl80211_send_coalesce_rules()
13794 for (i = 0; i < rdev->coalesce->n_rules; i++) { in nl80211_send_coalesce_rules()
13797 return -ENOBUFS; in nl80211_send_coalesce_rules()
13799 rule = &rdev->coalesce->rules[i]; in nl80211_send_coalesce_rules()
13801 rule->delay)) in nl80211_send_coalesce_rules()
13802 return -ENOBUFS; in nl80211_send_coalesce_rules()
13805 rule->condition)) in nl80211_send_coalesce_rules()
13806 return -ENOBUFS; in nl80211_send_coalesce_rules()
13811 return -ENOBUFS; in nl80211_send_coalesce_rules()
13813 for (j = 0; j < rule->n_patterns; j++) { in nl80211_send_coalesce_rules()
13816 return -ENOBUFS; in nl80211_send_coalesce_rules()
13817 pat_len = rule->patterns[j].pattern_len; in nl80211_send_coalesce_rules()
13820 rule->patterns[j].mask) || in nl80211_send_coalesce_rules()
13822 rule->patterns[j].pattern) || in nl80211_send_coalesce_rules()
13824 rule->patterns[j].pkt_offset)) in nl80211_send_coalesce_rules()
13825 return -ENOBUFS; in nl80211_send_coalesce_rules()
13838 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_get_coalesce()
13842 if (!rdev->wiphy.coalesce) in nl80211_get_coalesce()
13843 return -EOPNOTSUPP; in nl80211_get_coalesce()
13847 return -ENOMEM; in nl80211_get_coalesce()
13849 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, in nl80211_get_coalesce()
13854 if (rdev->coalesce && nl80211_send_coalesce_rules(msg, rdev)) in nl80211_get_coalesce()
13862 return -ENOBUFS; in nl80211_get_coalesce()
13867 struct cfg80211_coalesce *coalesce = rdev->coalesce; in cfg80211_rdev_free_coalesce()
13874 for (i = 0; i < coalesce->n_rules; i++) { in cfg80211_rdev_free_coalesce()
13875 rule = &coalesce->rules[i]; in cfg80211_rdev_free_coalesce()
13876 for (j = 0; j < rule->n_patterns; j++) in cfg80211_rdev_free_coalesce()
13877 kfree(rule->patterns[j].mask); in cfg80211_rdev_free_coalesce()
13878 kfree(rule->patterns); in cfg80211_rdev_free_coalesce()
13880 kfree(coalesce->rules); in cfg80211_rdev_free_coalesce()
13882 rdev->coalesce = NULL; in cfg80211_rdev_free_coalesce()
13890 const struct wiphy_coalesce_support *coalesce = rdev->wiphy.coalesce; in nl80211_parse_coalesce_rule()
13901 new_rule->delay = in nl80211_parse_coalesce_rule()
13903 if (new_rule->delay > coalesce->max_delay) in nl80211_parse_coalesce_rule()
13904 return -EINVAL; in nl80211_parse_coalesce_rule()
13907 new_rule->condition = in nl80211_parse_coalesce_rule()
13911 return -EINVAL; in nl80211_parse_coalesce_rule()
13916 if (n_patterns > coalesce->n_patterns) in nl80211_parse_coalesce_rule()
13917 return -EINVAL; in nl80211_parse_coalesce_rule()
13919 new_rule->patterns = kcalloc(n_patterns, sizeof(new_rule->patterns[0]), in nl80211_parse_coalesce_rule()
13921 if (!new_rule->patterns) in nl80211_parse_coalesce_rule()
13922 return -ENOMEM; in nl80211_parse_coalesce_rule()
13924 new_rule->n_patterns = n_patterns; in nl80211_parse_coalesce_rule()
13940 return -EINVAL; in nl80211_parse_coalesce_rule()
13944 return -EINVAL; in nl80211_parse_coalesce_rule()
13945 if (pat_len > coalesce->pattern_max_len || in nl80211_parse_coalesce_rule()
13946 pat_len < coalesce->pattern_min_len) in nl80211_parse_coalesce_rule()
13947 return -EINVAL; in nl80211_parse_coalesce_rule()
13953 if (pkt_offset > coalesce->max_pkt_offset) in nl80211_parse_coalesce_rule()
13954 return -EINVAL; in nl80211_parse_coalesce_rule()
13955 new_rule->patterns[i].pkt_offset = pkt_offset; in nl80211_parse_coalesce_rule()
13959 return -ENOMEM; in nl80211_parse_coalesce_rule()
13961 new_rule->patterns[i].mask = mask_pat; in nl80211_parse_coalesce_rule()
13966 new_rule->patterns[i].pattern = mask_pat; in nl80211_parse_coalesce_rule()
13967 new_rule->patterns[i].pattern_len = pat_len; in nl80211_parse_coalesce_rule()
13978 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_coalesce()
13979 const struct wiphy_coalesce_support *coalesce = rdev->wiphy.coalesce; in nl80211_set_coalesce()
13986 if (!rdev->wiphy.coalesce || !rdev->ops->set_coalesce) in nl80211_set_coalesce()
13987 return -EOPNOTSUPP; in nl80211_set_coalesce()
13989 if (!info->attrs[NL80211_ATTR_COALESCE_RULE]) { in nl80211_set_coalesce()
13995 nla_for_each_nested(rule, info->attrs[NL80211_ATTR_COALESCE_RULE], in nl80211_set_coalesce()
13998 if (n_rules > coalesce->n_rules) in nl80211_set_coalesce()
13999 return -EINVAL; in nl80211_set_coalesce()
14004 return -ENOMEM; in nl80211_set_coalesce()
14009 nla_for_each_nested(rule, info->attrs[NL80211_ATTR_COALESCE_RULE], in nl80211_set_coalesce()
14025 err = -ENOMEM; in nl80211_set_coalesce()
14029 rdev->coalesce = n_coalesce; in nl80211_set_coalesce()
14035 for (j = 0; j < tmp_rule->n_patterns; j++) in nl80211_set_coalesce()
14036 kfree(tmp_rule->patterns[j].mask); in nl80211_set_coalesce()
14037 kfree(tmp_rule->patterns); in nl80211_set_coalesce()
14046 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_rekey_data()
14047 struct net_device *dev = info->user_ptr[1]; in nl80211_set_rekey_data()
14048 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_set_rekey_data()
14053 if (!info->attrs[NL80211_ATTR_REKEY_DATA]) in nl80211_set_rekey_data()
14054 return -EINVAL; in nl80211_set_rekey_data()
14057 info->attrs[NL80211_ATTR_REKEY_DATA], in nl80211_set_rekey_data()
14058 nl80211_rekey_policy, info->extack); in nl80211_set_rekey_data()
14064 return -EINVAL; in nl80211_set_rekey_data()
14066 !(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK && in nl80211_set_rekey_data()
14068 return -ERANGE; in nl80211_set_rekey_data()
14070 !(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK && in nl80211_set_rekey_data()
14072 !(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_EXT_KCK_32 && in nl80211_set_rekey_data()
14074 return -ERANGE; in nl80211_set_rekey_data()
14085 if (!wdev->connected) { in nl80211_set_rekey_data()
14086 err = -ENOTCONN; in nl80211_set_rekey_data()
14090 if (!rdev->ops->set_rekey_data) { in nl80211_set_rekey_data()
14091 err = -EOPNOTSUPP; in nl80211_set_rekey_data()
14104 struct net_device *dev = info->user_ptr[1]; in nl80211_register_unexpected_frame()
14105 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_register_unexpected_frame()
14107 if (wdev->iftype != NL80211_IFTYPE_AP && in nl80211_register_unexpected_frame()
14108 wdev->iftype != NL80211_IFTYPE_P2P_GO) in nl80211_register_unexpected_frame()
14109 return -EINVAL; in nl80211_register_unexpected_frame()
14111 if (wdev->ap_unexpected_nlportid) in nl80211_register_unexpected_frame()
14112 return -EBUSY; in nl80211_register_unexpected_frame()
14114 wdev->ap_unexpected_nlportid = info->snd_portid; in nl80211_register_unexpected_frame()
14121 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_probe_client()
14122 struct net_device *dev = info->user_ptr[1]; in nl80211_probe_client()
14123 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_probe_client()
14130 if (wdev->iftype != NL80211_IFTYPE_AP && in nl80211_probe_client()
14131 wdev->iftype != NL80211_IFTYPE_P2P_GO) in nl80211_probe_client()
14132 return -EOPNOTSUPP; in nl80211_probe_client()
14134 if (!info->attrs[NL80211_ATTR_MAC]) in nl80211_probe_client()
14135 return -EINVAL; in nl80211_probe_client()
14137 if (!rdev->ops->probe_client) in nl80211_probe_client()
14138 return -EOPNOTSUPP; in nl80211_probe_client()
14142 return -ENOMEM; in nl80211_probe_client()
14144 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, in nl80211_probe_client()
14147 err = -ENOBUFS; in nl80211_probe_client()
14151 addr = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_probe_client()
14166 err = -ENOBUFS; in nl80211_probe_client()
14174 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_register_beacons()
14178 if (!(rdev->wiphy.flags & WIPHY_FLAG_REPORTS_OBSS)) in nl80211_register_beacons()
14179 return -EOPNOTSUPP; in nl80211_register_beacons()
14183 return -ENOMEM; in nl80211_register_beacons()
14186 spin_lock_bh(&rdev->beacon_registrations_lock); in nl80211_register_beacons()
14187 list_for_each_entry(reg, &rdev->beacon_registrations, list) { in nl80211_register_beacons()
14188 if (reg->nlportid == info->snd_portid) { in nl80211_register_beacons()
14189 rv = -EALREADY; in nl80211_register_beacons()
14194 nreg->nlportid = info->snd_portid; in nl80211_register_beacons()
14195 list_add(&nreg->list, &rdev->beacon_registrations); in nl80211_register_beacons()
14197 spin_unlock_bh(&rdev->beacon_registrations_lock); in nl80211_register_beacons()
14201 spin_unlock_bh(&rdev->beacon_registrations_lock); in nl80211_register_beacons()
14208 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_start_p2p_device()
14209 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_start_p2p_device()
14212 if (!rdev->ops->start_p2p_device) in nl80211_start_p2p_device()
14213 return -EOPNOTSUPP; in nl80211_start_p2p_device()
14215 if (wdev->iftype != NL80211_IFTYPE_P2P_DEVICE) in nl80211_start_p2p_device()
14216 return -EOPNOTSUPP; in nl80211_start_p2p_device()
14221 if (rfkill_blocked(rdev->wiphy.rfkill)) in nl80211_start_p2p_device()
14222 return -ERFKILL; in nl80211_start_p2p_device()
14228 wdev->is_running = true; in nl80211_start_p2p_device()
14229 rdev->opencount++; in nl80211_start_p2p_device()
14236 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_stop_p2p_device()
14237 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_stop_p2p_device()
14239 if (wdev->iftype != NL80211_IFTYPE_P2P_DEVICE) in nl80211_stop_p2p_device()
14240 return -EOPNOTSUPP; in nl80211_stop_p2p_device()
14242 if (!rdev->ops->stop_p2p_device) in nl80211_stop_p2p_device()
14243 return -EOPNOTSUPP; in nl80211_stop_p2p_device()
14252 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_start_nan()
14253 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_start_nan()
14257 if (wdev->iftype != NL80211_IFTYPE_NAN) in nl80211_start_nan()
14258 return -EOPNOTSUPP; in nl80211_start_nan()
14261 return -EEXIST; in nl80211_start_nan()
14263 if (rfkill_blocked(rdev->wiphy.rfkill)) in nl80211_start_nan()
14264 return -ERFKILL; in nl80211_start_nan()
14266 if (!info->attrs[NL80211_ATTR_NAN_MASTER_PREF]) in nl80211_start_nan()
14267 return -EINVAL; in nl80211_start_nan()
14270 nla_get_u8(info->attrs[NL80211_ATTR_NAN_MASTER_PREF]); in nl80211_start_nan()
14272 if (info->attrs[NL80211_ATTR_BANDS]) { in nl80211_start_nan()
14273 u32 bands = nla_get_u32(info->attrs[NL80211_ATTR_BANDS]); in nl80211_start_nan()
14275 if (bands & ~(u32)wdev->wiphy->nan_supported_bands) in nl80211_start_nan()
14276 return -EOPNOTSUPP; in nl80211_start_nan()
14279 return -EINVAL; in nl80211_start_nan()
14288 wdev->is_running = true; in nl80211_start_nan()
14289 rdev->opencount++; in nl80211_start_nan()
14296 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_stop_nan()
14297 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_stop_nan()
14299 if (wdev->iftype != NL80211_IFTYPE_NAN) in nl80211_stop_nan()
14300 return -EOPNOTSUPP; in nl80211_stop_nan()
14318 return -EINVAL; in validate_nan_filter()
14335 BUILD_BUG_ON(sizeof(*func->rx_filters) != sizeof(*func->tx_filters)); in handle_nan_filter()
14337 filter = kcalloc(n_entries, sizeof(*func->rx_filters), GFP_KERNEL); in handle_nan_filter()
14339 return -ENOMEM; in handle_nan_filter()
14351 func->num_tx_filters = n_entries; in handle_nan_filter()
14352 func->tx_filters = filter; in handle_nan_filter()
14354 func->num_rx_filters = n_entries; in handle_nan_filter()
14355 func->rx_filters = filter; in handle_nan_filter()
14367 return -ENOMEM; in handle_nan_filter()
14373 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_nan_add_func()
14374 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_nan_add_func()
14381 if (wdev->iftype != NL80211_IFTYPE_NAN) in nl80211_nan_add_func()
14382 return -EOPNOTSUPP; in nl80211_nan_add_func()
14385 return -ENOTCONN; in nl80211_nan_add_func()
14387 if (!info->attrs[NL80211_ATTR_NAN_FUNC]) in nl80211_nan_add_func()
14388 return -EINVAL; in nl80211_nan_add_func()
14391 info->attrs[NL80211_ATTR_NAN_FUNC], in nl80211_nan_add_func()
14393 info->extack); in nl80211_nan_add_func()
14399 return -ENOMEM; in nl80211_nan_add_func()
14401 func->cookie = cfg80211_assign_cookie(rdev); in nl80211_nan_add_func()
14404 err = -EINVAL; in nl80211_nan_add_func()
14409 func->type = nla_get_u8(tb[NL80211_NAN_FUNC_TYPE]); in nl80211_nan_add_func()
14412 err = -EINVAL; in nl80211_nan_add_func()
14416 memcpy(func->service_id, nla_data(tb[NL80211_NAN_FUNC_SERVICE_ID]), in nl80211_nan_add_func()
14417 sizeof(func->service_id)); in nl80211_nan_add_func()
14419 func->close_range = in nl80211_nan_add_func()
14423 func->serv_spec_info_len = in nl80211_nan_add_func()
14425 func->serv_spec_info = in nl80211_nan_add_func()
14427 func->serv_spec_info_len, in nl80211_nan_add_func()
14429 if (!func->serv_spec_info) { in nl80211_nan_add_func()
14430 err = -ENOMEM; in nl80211_nan_add_func()
14436 func->ttl = nla_get_u32(tb[NL80211_NAN_FUNC_TTL]); in nl80211_nan_add_func()
14438 switch (func->type) { in nl80211_nan_add_func()
14441 err = -EINVAL; in nl80211_nan_add_func()
14445 func->publish_type = in nl80211_nan_add_func()
14447 func->publish_bcast = in nl80211_nan_add_func()
14450 if ((!(func->publish_type & NL80211_NAN_SOLICITED_PUBLISH)) && in nl80211_nan_add_func()
14451 func->publish_bcast) { in nl80211_nan_add_func()
14452 err = -EINVAL; in nl80211_nan_add_func()
14457 func->subscribe_active = in nl80211_nan_add_func()
14464 err = -EINVAL; in nl80211_nan_add_func()
14468 func->followup_id = in nl80211_nan_add_func()
14470 func->followup_reqid = in nl80211_nan_add_func()
14472 memcpy(func->followup_dest.addr, in nl80211_nan_add_func()
14474 sizeof(func->followup_dest.addr)); in nl80211_nan_add_func()
14475 if (func->ttl) { in nl80211_nan_add_func()
14476 err = -EINVAL; in nl80211_nan_add_func()
14481 err = -EINVAL; in nl80211_nan_add_func()
14492 info->extack); in nl80211_nan_add_func()
14496 func->srf_include = in nl80211_nan_add_func()
14502 err = -EINVAL; in nl80211_nan_add_func()
14506 func->srf_bf_len = in nl80211_nan_add_func()
14508 func->srf_bf = in nl80211_nan_add_func()
14510 func->srf_bf_len, GFP_KERNEL); in nl80211_nan_add_func()
14511 if (!func->srf_bf) { in nl80211_nan_add_func()
14512 err = -ENOMEM; in nl80211_nan_add_func()
14516 func->srf_bf_idx = in nl80211_nan_add_func()
14524 err = -EINVAL; in nl80211_nan_add_func()
14530 err = -EINVAL; in nl80211_nan_add_func()
14534 func->srf_num_macs = n_entries; in nl80211_nan_add_func()
14535 func->srf_macs = in nl80211_nan_add_func()
14536 kcalloc(n_entries, sizeof(*func->srf_macs), in nl80211_nan_add_func()
14538 if (!func->srf_macs) { in nl80211_nan_add_func()
14539 err = -ENOMEM; in nl80211_nan_add_func()
14544 memcpy(func->srf_macs[i++].addr, nla_data(attr), in nl80211_nan_add_func()
14545 sizeof(*func->srf_macs)); in nl80211_nan_add_func()
14565 err = -ENOMEM; in nl80211_nan_add_func()
14569 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, in nl80211_nan_add_func()
14571 /* This can't really happen - we just allocated 4KB */ in nl80211_nan_add_func()
14573 err = -ENOMEM; in nl80211_nan_add_func()
14586 if (nla_put_u64_64bit(msg, NL80211_ATTR_COOKIE, func->cookie, in nl80211_nan_add_func()
14595 func->instance_id)) in nl80211_nan_add_func()
14605 return -ENOBUFS; in nl80211_nan_add_func()
14611 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_nan_del_func()
14612 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_nan_del_func()
14615 if (wdev->iftype != NL80211_IFTYPE_NAN) in nl80211_nan_del_func()
14616 return -EOPNOTSUPP; in nl80211_nan_del_func()
14619 return -ENOTCONN; in nl80211_nan_del_func()
14621 if (!info->attrs[NL80211_ATTR_COOKIE]) in nl80211_nan_del_func()
14622 return -EINVAL; in nl80211_nan_del_func()
14624 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]); in nl80211_nan_del_func()
14634 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_nan_change_config()
14635 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_nan_change_config()
14639 if (wdev->iftype != NL80211_IFTYPE_NAN) in nl80211_nan_change_config()
14640 return -EOPNOTSUPP; in nl80211_nan_change_config()
14643 return -ENOTCONN; in nl80211_nan_change_config()
14645 if (info->attrs[NL80211_ATTR_NAN_MASTER_PREF]) { in nl80211_nan_change_config()
14647 nla_get_u8(info->attrs[NL80211_ATTR_NAN_MASTER_PREF]); in nl80211_nan_change_config()
14649 return -EINVAL; in nl80211_nan_change_config()
14654 if (info->attrs[NL80211_ATTR_BANDS]) { in nl80211_nan_change_config()
14655 u32 bands = nla_get_u32(info->attrs[NL80211_ATTR_BANDS]); in nl80211_nan_change_config()
14657 if (bands & ~(u32)wdev->wiphy->nan_supported_bands) in nl80211_nan_change_config()
14658 return -EOPNOTSUPP; in nl80211_nan_change_config()
14661 return -EINVAL; in nl80211_nan_change_config()
14668 return -EINVAL; in nl80211_nan_change_config()
14676 struct wiphy *wiphy = wdev->wiphy; in cfg80211_nan_match()
14682 if (WARN_ON(!match->inst_id || !match->peer_inst_id || !match->addr)) in cfg80211_nan_match()
14695 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in cfg80211_nan_match()
14696 (wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX, in cfg80211_nan_match()
14697 wdev->netdev->ifindex)) || in cfg80211_nan_match()
14702 if (nla_put_u64_64bit(msg, NL80211_ATTR_COOKIE, match->cookie, in cfg80211_nan_match()
14704 nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, match->addr)) in cfg80211_nan_match()
14716 if (nla_put_u8(msg, NL80211_NAN_FUNC_INSTANCE_ID, match->inst_id)) in cfg80211_nan_match()
14726 if (nla_put_u8(msg, NL80211_NAN_FUNC_TYPE, match->type) || in cfg80211_nan_match()
14727 nla_put_u8(msg, NL80211_NAN_FUNC_INSTANCE_ID, match->peer_inst_id)) in cfg80211_nan_match()
14730 if (match->info && match->info_len && in cfg80211_nan_match()
14731 nla_put(msg, NL80211_NAN_FUNC_SERVICE_INFO, match->info_len, in cfg80211_nan_match()
14732 match->info)) in cfg80211_nan_match()
14739 if (!wdev->owner_nlportid) in cfg80211_nan_match()
14740 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), in cfg80211_nan_match()
14743 genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, in cfg80211_nan_match()
14744 wdev->owner_nlportid); in cfg80211_nan_match()
14758 struct wiphy *wiphy = wdev->wiphy; in cfg80211_nan_func_terminated()
14777 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in cfg80211_nan_func_terminated()
14778 (wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX, in cfg80211_nan_func_terminated()
14779 wdev->netdev->ifindex)) || in cfg80211_nan_func_terminated()
14799 if (!wdev->owner_nlportid) in cfg80211_nan_func_terminated()
14800 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), in cfg80211_nan_func_terminated()
14803 genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, in cfg80211_nan_func_terminated()
14804 wdev->owner_nlportid); in cfg80211_nan_func_terminated()
14821 return -ENOMEM; in nl80211_get_protocol_features()
14823 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, in nl80211_get_protocol_features()
14837 return -ENOBUFS; in nl80211_get_protocol_features()
14842 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_update_ft_ies()
14844 struct net_device *dev = info->user_ptr[1]; in nl80211_update_ft_ies()
14846 if (!rdev->ops->update_ft_ies) in nl80211_update_ft_ies()
14847 return -EOPNOTSUPP; in nl80211_update_ft_ies()
14849 if (!info->attrs[NL80211_ATTR_MDID] || in nl80211_update_ft_ies()
14850 !info->attrs[NL80211_ATTR_IE]) in nl80211_update_ft_ies()
14851 return -EINVAL; in nl80211_update_ft_ies()
14854 ft_params.md = nla_get_u16(info->attrs[NL80211_ATTR_MDID]); in nl80211_update_ft_ies()
14855 ft_params.ie = nla_data(info->attrs[NL80211_ATTR_IE]); in nl80211_update_ft_ies()
14856 ft_params.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); in nl80211_update_ft_ies()
14864 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_crit_protocol_start()
14865 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_crit_protocol_start()
14870 if (!rdev->ops->crit_proto_start) in nl80211_crit_protocol_start()
14871 return -EOPNOTSUPP; in nl80211_crit_protocol_start()
14873 if (WARN_ON(!rdev->ops->crit_proto_stop)) in nl80211_crit_protocol_start()
14874 return -EINVAL; in nl80211_crit_protocol_start()
14876 if (rdev->crit_proto_nlportid) in nl80211_crit_protocol_start()
14877 return -EBUSY; in nl80211_crit_protocol_start()
14880 if (info->attrs[NL80211_ATTR_CRIT_PROT_ID]) in nl80211_crit_protocol_start()
14881 proto = nla_get_u16(info->attrs[NL80211_ATTR_CRIT_PROT_ID]); in nl80211_crit_protocol_start()
14884 return -EINVAL; in nl80211_crit_protocol_start()
14887 if (!info->attrs[NL80211_ATTR_MAX_CRIT_PROT_DURATION]) in nl80211_crit_protocol_start()
14888 return -EINVAL; in nl80211_crit_protocol_start()
14891 nla_get_u16(info->attrs[NL80211_ATTR_MAX_CRIT_PROT_DURATION]); in nl80211_crit_protocol_start()
14895 rdev->crit_proto_nlportid = info->snd_portid; in nl80211_crit_protocol_start()
14903 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_crit_protocol_stop()
14904 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_crit_protocol_stop()
14906 if (!rdev->ops->crit_proto_stop) in nl80211_crit_protocol_stop()
14907 return -EOPNOTSUPP; in nl80211_crit_protocol_stop()
14909 if (rdev->crit_proto_nlportid) { in nl80211_crit_protocol_stop()
14910 rdev->crit_proto_nlportid = 0; in nl80211_crit_protocol_stop()
14920 if (vcmd->policy == VENDOR_CMD_RAW_DATA) { in nl80211_vendor_check_policy()
14921 if (attr->nla_type & NLA_F_NESTED) { in nl80211_vendor_check_policy()
14924 return -EINVAL; in nl80211_vendor_check_policy()
14930 if (!(attr->nla_type & NLA_F_NESTED)) { in nl80211_vendor_check_policy()
14932 return -EINVAL; in nl80211_vendor_check_policy()
14935 return nla_validate_nested(attr, vcmd->maxattr, vcmd->policy, extack); in nl80211_vendor_check_policy()
14940 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_vendor_cmd()
14943 info->attrs); in nl80211_vendor_cmd()
14947 if (!rdev->wiphy.vendor_commands) in nl80211_vendor_cmd()
14948 return -EOPNOTSUPP; in nl80211_vendor_cmd()
14952 if (err != -EINVAL) in nl80211_vendor_cmd()
14955 } else if (wdev->wiphy != &rdev->wiphy) { in nl80211_vendor_cmd()
14956 return -EINVAL; in nl80211_vendor_cmd()
14959 if (!info->attrs[NL80211_ATTR_VENDOR_ID] || in nl80211_vendor_cmd()
14960 !info->attrs[NL80211_ATTR_VENDOR_SUBCMD]) in nl80211_vendor_cmd()
14961 return -EINVAL; in nl80211_vendor_cmd()
14963 vid = nla_get_u32(info->attrs[NL80211_ATTR_VENDOR_ID]); in nl80211_vendor_cmd()
14964 subcmd = nla_get_u32(info->attrs[NL80211_ATTR_VENDOR_SUBCMD]); in nl80211_vendor_cmd()
14965 for (i = 0; i < rdev->wiphy.n_vendor_commands; i++) { in nl80211_vendor_cmd()
14970 vcmd = &rdev->wiphy.vendor_commands[i]; in nl80211_vendor_cmd()
14972 if (vcmd->info.vendor_id != vid || vcmd->info.subcmd != subcmd) in nl80211_vendor_cmd()
14975 if (vcmd->flags & (WIPHY_VENDOR_CMD_NEED_WDEV | in nl80211_vendor_cmd()
14978 return -EINVAL; in nl80211_vendor_cmd()
14979 if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_NETDEV && in nl80211_vendor_cmd()
14980 !wdev->netdev) in nl80211_vendor_cmd()
14981 return -EINVAL; in nl80211_vendor_cmd()
14983 if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_RUNNING) { in nl80211_vendor_cmd()
14985 return -ENETDOWN; in nl80211_vendor_cmd()
14991 if (!vcmd->doit) in nl80211_vendor_cmd()
14992 return -EOPNOTSUPP; in nl80211_vendor_cmd()
14994 if (info->attrs[NL80211_ATTR_VENDOR_DATA]) { in nl80211_vendor_cmd()
14995 data = nla_data(info->attrs[NL80211_ATTR_VENDOR_DATA]); in nl80211_vendor_cmd()
14996 len = nla_len(info->attrs[NL80211_ATTR_VENDOR_DATA]); in nl80211_vendor_cmd()
14999 info->attrs[NL80211_ATTR_VENDOR_DATA], in nl80211_vendor_cmd()
15000 info->extack); in nl80211_vendor_cmd()
15005 rdev->cur_cmd_info = info; in nl80211_vendor_cmd()
15006 err = vcmd->doit(&rdev->wiphy, wdev, data, len); in nl80211_vendor_cmd()
15007 rdev->cur_cmd_info = NULL; in nl80211_vendor_cmd()
15011 return -EOPNOTSUPP; in nl80211_vendor_cmd()
15022 int vcmd_idx = -1; in nl80211_prepare_vendor_dump()
15027 if (cb->args[0]) { in nl80211_prepare_vendor_dump()
15029 struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0] - 1); in nl80211_prepare_vendor_dump()
15033 return -ENODEV; in nl80211_prepare_vendor_dump()
15037 if (cb->args[1]) { in nl80211_prepare_vendor_dump()
15038 list_for_each_entry(tmp, &wiphy->wdev_list, list) { in nl80211_prepare_vendor_dump()
15039 if (tmp->identifier == cb->args[1] - 1) { in nl80211_prepare_vendor_dump()
15052 return -ENOMEM; in nl80211_prepare_vendor_dump()
15054 err = nlmsg_parse_deprecated(cb->nlh, in nl80211_prepare_vendor_dump()
15063 err = -EINVAL; in nl80211_prepare_vendor_dump()
15067 *wdev = __cfg80211_wdev_from_attrs(NULL, sock_net(skb->sk), attrbuf); in nl80211_prepare_vendor_dump()
15071 *rdev = __cfg80211_rdev_from_attrs(sock_net(skb->sk), attrbuf); in nl80211_prepare_vendor_dump()
15080 for (i = 0; i < (*rdev)->wiphy.n_vendor_commands; i++) { in nl80211_prepare_vendor_dump()
15083 vcmd = &(*rdev)->wiphy.vendor_commands[i]; in nl80211_prepare_vendor_dump()
15085 if (vcmd->info.vendor_id != vid || vcmd->info.subcmd != subcmd) in nl80211_prepare_vendor_dump()
15088 if (!vcmd->dumpit) { in nl80211_prepare_vendor_dump()
15089 err = -EOPNOTSUPP; in nl80211_prepare_vendor_dump()
15098 err = -EOPNOTSUPP; in nl80211_prepare_vendor_dump()
15107 &(*rdev)->wiphy.vendor_commands[vcmd_idx], in nl80211_prepare_vendor_dump()
15109 cb->extack); in nl80211_prepare_vendor_dump()
15114 /* 0 is the first index - add 1 to parse only once */ in nl80211_prepare_vendor_dump()
15115 cb->args[0] = (*rdev)->wiphy_idx + 1; in nl80211_prepare_vendor_dump()
15117 cb->args[1] = *wdev ? (*wdev)->identifier + 1 : 0; in nl80211_prepare_vendor_dump()
15118 cb->args[2] = vcmd_idx; in nl80211_prepare_vendor_dump()
15119 cb->args[3] = (unsigned long)data; in nl80211_prepare_vendor_dump()
15120 cb->args[4] = data_len; in nl80211_prepare_vendor_dump()
15146 vcmd_idx = cb->args[2]; in nl80211_vendor_cmd_dump()
15147 data = (void *)cb->args[3]; in nl80211_vendor_cmd_dump()
15148 data_len = cb->args[4]; in nl80211_vendor_cmd_dump()
15149 vcmd = &rdev->wiphy.vendor_commands[vcmd_idx]; in nl80211_vendor_cmd_dump()
15151 if (vcmd->flags & (WIPHY_VENDOR_CMD_NEED_WDEV | in nl80211_vendor_cmd_dump()
15154 err = -EINVAL; in nl80211_vendor_cmd_dump()
15157 if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_NETDEV && in nl80211_vendor_cmd_dump()
15158 !wdev->netdev) { in nl80211_vendor_cmd_dump()
15159 err = -EINVAL; in nl80211_vendor_cmd_dump()
15163 if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_RUNNING) { in nl80211_vendor_cmd_dump()
15165 err = -ENETDOWN; in nl80211_vendor_cmd_dump()
15172 void *hdr = nl80211hdr_put(skb, NETLINK_CB(cb->skb).portid, in nl80211_vendor_cmd_dump()
15173 cb->nlh->nlmsg_seq, NLM_F_MULTI, in nl80211_vendor_cmd_dump()
15178 if (nla_put_u32(skb, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_vendor_cmd_dump()
15193 err = vcmd->dumpit(&rdev->wiphy, wdev, skb, data, data_len, in nl80211_vendor_cmd_dump()
15194 (unsigned long *)&cb->args[5]); in nl80211_vendor_cmd_dump()
15197 if (err == -ENOBUFS || err == -ENOENT) { in nl80211_vendor_cmd_dump()
15208 err = skb->len; in nl80211_vendor_cmd_dump()
15221 if (WARN_ON(!rdev->cur_cmd_info)) in __cfg80211_alloc_reply_skb()
15225 rdev->cur_cmd_info->snd_portid, in __cfg80211_alloc_reply_skb()
15226 rdev->cur_cmd_info->snd_seq, in __cfg80211_alloc_reply_skb()
15233 struct cfg80211_registered_device *rdev = ((void **)skb->cb)[0]; in cfg80211_vendor_cmd_reply()
15234 void *hdr = ((void **)skb->cb)[1]; in cfg80211_vendor_cmd_reply()
15235 struct nlattr *data = ((void **)skb->cb)[2]; in cfg80211_vendor_cmd_reply()
15238 memset(skb->cb, 0, sizeof(skb->cb)); in cfg80211_vendor_cmd_reply()
15240 if (WARN_ON(!rdev->cur_cmd_info)) { in cfg80211_vendor_cmd_reply()
15242 return -EINVAL; in cfg80211_vendor_cmd_reply()
15247 return genlmsg_reply(skb, rdev->cur_cmd_info); in cfg80211_vendor_cmd_reply()
15255 if (WARN_ON(!rdev->cur_cmd_info)) in cfg80211_vendor_cmd_get_sender()
15258 return rdev->cur_cmd_info->snd_portid; in cfg80211_vendor_cmd_get_sender()
15265 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_qos_map()
15267 struct net_device *dev = info->user_ptr[1]; in nl80211_set_qos_map()
15271 if (!rdev->ops->set_qos_map) in nl80211_set_qos_map()
15272 return -EOPNOTSUPP; in nl80211_set_qos_map()
15274 if (info->attrs[NL80211_ATTR_QOS_MAP]) { in nl80211_set_qos_map()
15275 pos = nla_data(info->attrs[NL80211_ATTR_QOS_MAP]); in nl80211_set_qos_map()
15276 len = nla_len(info->attrs[NL80211_ATTR_QOS_MAP]); in nl80211_set_qos_map()
15279 return -EINVAL; in nl80211_set_qos_map()
15283 return -ENOMEM; in nl80211_set_qos_map()
15285 num_des = (len - IEEE80211_QOS_MAP_LEN_MIN) >> 1; in nl80211_set_qos_map()
15289 memcpy(qos_map->dscp_exception, pos, des_len); in nl80211_set_qos_map()
15290 qos_map->num_des = num_des; in nl80211_set_qos_map()
15292 if (qos_map->dscp_exception[des].up > 7) { in nl80211_set_qos_map()
15294 return -EINVAL; in nl80211_set_qos_map()
15299 memcpy(qos_map->up, pos, IEEE80211_QOS_MAP_LEN_MIN); in nl80211_set_qos_map()
15302 wdev_lock(dev->ieee80211_ptr); in nl80211_set_qos_map()
15303 ret = nl80211_key_allowed(dev->ieee80211_ptr); in nl80211_set_qos_map()
15306 wdev_unlock(dev->ieee80211_ptr); in nl80211_set_qos_map()
15314 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_add_tx_ts()
15315 struct net_device *dev = info->user_ptr[1]; in nl80211_add_tx_ts()
15316 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_add_tx_ts()
15322 if (!(rdev->wiphy.features & NL80211_FEATURE_SUPPORTS_WMM_ADMISSION)) in nl80211_add_tx_ts()
15323 return -EOPNOTSUPP; in nl80211_add_tx_ts()
15325 if (!info->attrs[NL80211_ATTR_TSID] || !info->attrs[NL80211_ATTR_MAC] || in nl80211_add_tx_ts()
15326 !info->attrs[NL80211_ATTR_USER_PRIO]) in nl80211_add_tx_ts()
15327 return -EINVAL; in nl80211_add_tx_ts()
15329 tsid = nla_get_u8(info->attrs[NL80211_ATTR_TSID]); in nl80211_add_tx_ts()
15330 up = nla_get_u8(info->attrs[NL80211_ATTR_USER_PRIO]); in nl80211_add_tx_ts()
15332 /* WMM uses TIDs 0-7 even for TSPEC */ in nl80211_add_tx_ts()
15338 return -EINVAL; in nl80211_add_tx_ts()
15341 peer = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_add_tx_ts()
15343 if (info->attrs[NL80211_ATTR_ADMITTED_TIME]) { in nl80211_add_tx_ts()
15345 nla_get_u16(info->attrs[NL80211_ATTR_ADMITTED_TIME]); in nl80211_add_tx_ts()
15347 return -EINVAL; in nl80211_add_tx_ts()
15351 switch (wdev->iftype) { in nl80211_add_tx_ts()
15354 if (wdev->connected) in nl80211_add_tx_ts()
15356 err = -ENOTCONN; in nl80211_add_tx_ts()
15359 err = -EOPNOTSUPP; in nl80211_add_tx_ts()
15372 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_del_tx_ts()
15373 struct net_device *dev = info->user_ptr[1]; in nl80211_del_tx_ts()
15374 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_del_tx_ts()
15379 if (!info->attrs[NL80211_ATTR_TSID] || !info->attrs[NL80211_ATTR_MAC]) in nl80211_del_tx_ts()
15380 return -EINVAL; in nl80211_del_tx_ts()
15382 tsid = nla_get_u8(info->attrs[NL80211_ATTR_TSID]); in nl80211_del_tx_ts()
15383 peer = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_del_tx_ts()
15395 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_tdls_channel_switch()
15396 struct net_device *dev = info->user_ptr[1]; in nl80211_tdls_channel_switch()
15397 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_tdls_channel_switch()
15403 if (!rdev->ops->tdls_channel_switch || in nl80211_tdls_channel_switch()
15404 !(rdev->wiphy.features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH)) in nl80211_tdls_channel_switch()
15405 return -EOPNOTSUPP; in nl80211_tdls_channel_switch()
15407 switch (dev->ieee80211_ptr->iftype) { in nl80211_tdls_channel_switch()
15412 return -EOPNOTSUPP; in nl80211_tdls_channel_switch()
15415 if (!info->attrs[NL80211_ATTR_MAC] || in nl80211_tdls_channel_switch()
15416 !info->attrs[NL80211_ATTR_OPER_CLASS]) in nl80211_tdls_channel_switch()
15417 return -EINVAL; in nl80211_tdls_channel_switch()
15424 * Don't allow wide channels on the 2.4Ghz band, as per IEEE802.11-2012 in nl80211_tdls_channel_switch()
15428 if (chandef.chan->band == NL80211_BAND_2GHZ && in nl80211_tdls_channel_switch()
15431 return -EINVAL; in nl80211_tdls_channel_switch()
15434 if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, &chandef, in nl80211_tdls_channel_switch()
15435 wdev->iftype)) in nl80211_tdls_channel_switch()
15436 return -EINVAL; in nl80211_tdls_channel_switch()
15439 if (cfg80211_chandef_dfs_required(wdev->wiphy, &chandef, wdev->iftype)) in nl80211_tdls_channel_switch()
15440 return -EINVAL; in nl80211_tdls_channel_switch()
15442 addr = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_tdls_channel_switch()
15443 oper_class = nla_get_u8(info->attrs[NL80211_ATTR_OPER_CLASS]); in nl80211_tdls_channel_switch()
15455 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_tdls_cancel_channel_switch()
15456 struct net_device *dev = info->user_ptr[1]; in nl80211_tdls_cancel_channel_switch()
15457 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_tdls_cancel_channel_switch()
15460 if (!rdev->ops->tdls_channel_switch || in nl80211_tdls_cancel_channel_switch()
15461 !rdev->ops->tdls_cancel_channel_switch || in nl80211_tdls_cancel_channel_switch()
15462 !(rdev->wiphy.features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH)) in nl80211_tdls_cancel_channel_switch()
15463 return -EOPNOTSUPP; in nl80211_tdls_cancel_channel_switch()
15465 switch (dev->ieee80211_ptr->iftype) { in nl80211_tdls_cancel_channel_switch()
15470 return -EOPNOTSUPP; in nl80211_tdls_cancel_channel_switch()
15473 if (!info->attrs[NL80211_ATTR_MAC]) in nl80211_tdls_cancel_channel_switch()
15474 return -EINVAL; in nl80211_tdls_cancel_channel_switch()
15476 addr = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_tdls_cancel_channel_switch()
15488 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_multicast_to_unicast()
15489 struct net_device *dev = info->user_ptr[1]; in nl80211_set_multicast_to_unicast()
15490 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_set_multicast_to_unicast()
15494 if (!rdev->ops->set_multicast_to_unicast) in nl80211_set_multicast_to_unicast()
15495 return -EOPNOTSUPP; in nl80211_set_multicast_to_unicast()
15497 if (wdev->iftype != NL80211_IFTYPE_AP && in nl80211_set_multicast_to_unicast()
15498 wdev->iftype != NL80211_IFTYPE_P2P_GO) in nl80211_set_multicast_to_unicast()
15499 return -EOPNOTSUPP; in nl80211_set_multicast_to_unicast()
15501 nla = info->attrs[NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED]; in nl80211_set_multicast_to_unicast()
15509 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_pmk()
15510 struct net_device *dev = info->user_ptr[1]; in nl80211_set_pmk()
15511 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_set_pmk()
15515 if (wdev->iftype != NL80211_IFTYPE_STATION && in nl80211_set_pmk()
15516 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT) in nl80211_set_pmk()
15517 return -EOPNOTSUPP; in nl80211_set_pmk()
15519 if (!wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_set_pmk()
15521 return -EOPNOTSUPP; in nl80211_set_pmk()
15523 if (!info->attrs[NL80211_ATTR_MAC] || !info->attrs[NL80211_ATTR_PMK]) in nl80211_set_pmk()
15524 return -EINVAL; in nl80211_set_pmk()
15527 if (!wdev->connected) { in nl80211_set_pmk()
15528 ret = -ENOTCONN; in nl80211_set_pmk()
15532 pmk_conf.aa = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_set_pmk()
15533 if (memcmp(pmk_conf.aa, wdev->u.client.connected_addr, ETH_ALEN)) { in nl80211_set_pmk()
15534 ret = -EINVAL; in nl80211_set_pmk()
15538 pmk_conf.pmk = nla_data(info->attrs[NL80211_ATTR_PMK]); in nl80211_set_pmk()
15539 pmk_conf.pmk_len = nla_len(info->attrs[NL80211_ATTR_PMK]); in nl80211_set_pmk()
15542 ret = -EINVAL; in nl80211_set_pmk()
15546 if (info->attrs[NL80211_ATTR_PMKR0_NAME]) in nl80211_set_pmk()
15548 nla_data(info->attrs[NL80211_ATTR_PMKR0_NAME]); in nl80211_set_pmk()
15558 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_del_pmk()
15559 struct net_device *dev = info->user_ptr[1]; in nl80211_del_pmk()
15560 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_del_pmk()
15564 if (wdev->iftype != NL80211_IFTYPE_STATION && in nl80211_del_pmk()
15565 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT) in nl80211_del_pmk()
15566 return -EOPNOTSUPP; in nl80211_del_pmk()
15568 if (!wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_del_pmk()
15570 return -EOPNOTSUPP; in nl80211_del_pmk()
15572 if (!info->attrs[NL80211_ATTR_MAC]) in nl80211_del_pmk()
15573 return -EINVAL; in nl80211_del_pmk()
15576 aa = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_del_pmk()
15585 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_external_auth()
15586 struct net_device *dev = info->user_ptr[1]; in nl80211_external_auth()
15589 if (!rdev->ops->external_auth) in nl80211_external_auth()
15590 return -EOPNOTSUPP; in nl80211_external_auth()
15592 if (!info->attrs[NL80211_ATTR_SSID] && in nl80211_external_auth()
15593 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && in nl80211_external_auth()
15594 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) in nl80211_external_auth()
15595 return -EINVAL; in nl80211_external_auth()
15597 if (!info->attrs[NL80211_ATTR_BSSID]) in nl80211_external_auth()
15598 return -EINVAL; in nl80211_external_auth()
15600 if (!info->attrs[NL80211_ATTR_STATUS_CODE]) in nl80211_external_auth()
15601 return -EINVAL; in nl80211_external_auth()
15605 if (info->attrs[NL80211_ATTR_SSID]) { in nl80211_external_auth()
15606 params.ssid.ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); in nl80211_external_auth()
15608 return -EINVAL; in nl80211_external_auth()
15610 nla_data(info->attrs[NL80211_ATTR_SSID]), in nl80211_external_auth()
15614 memcpy(params.bssid, nla_data(info->attrs[NL80211_ATTR_BSSID]), in nl80211_external_auth()
15617 params.status = nla_get_u16(info->attrs[NL80211_ATTR_STATUS_CODE]); in nl80211_external_auth()
15619 if (info->attrs[NL80211_ATTR_PMKID]) in nl80211_external_auth()
15620 params.pmkid = nla_data(info->attrs[NL80211_ATTR_PMKID]); in nl80211_external_auth()
15627 bool dont_wait_for_ack = info->attrs[NL80211_ATTR_DONT_WAIT_FOR_ACK]; in nl80211_tx_control_port()
15628 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_tx_control_port()
15629 struct net_device *dev = info->user_ptr[1]; in nl80211_tx_control_port()
15630 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_tx_control_port()
15640 if (!wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_tx_control_port()
15642 return -EOPNOTSUPP; in nl80211_tx_control_port()
15644 if (!rdev->ops->tx_control_port) in nl80211_tx_control_port()
15645 return -EOPNOTSUPP; in nl80211_tx_control_port()
15647 if (!info->attrs[NL80211_ATTR_FRAME] || in nl80211_tx_control_port()
15648 !info->attrs[NL80211_ATTR_MAC] || in nl80211_tx_control_port()
15649 !info->attrs[NL80211_ATTR_CONTROL_PORT_ETHERTYPE]) { in nl80211_tx_control_port()
15651 return -EINVAL; in nl80211_tx_control_port()
15656 switch (wdev->iftype) { in nl80211_tx_control_port()
15662 if (wdev->u.ibss.current_bss) in nl80211_tx_control_port()
15664 err = -ENOTCONN; in nl80211_tx_control_port()
15668 if (wdev->connected) in nl80211_tx_control_port()
15670 err = -ENOTCONN; in nl80211_tx_control_port()
15673 err = -EOPNOTSUPP; in nl80211_tx_control_port()
15679 buf = nla_data(info->attrs[NL80211_ATTR_FRAME]); in nl80211_tx_control_port()
15680 len = nla_len(info->attrs[NL80211_ATTR_FRAME]); in nl80211_tx_control_port()
15681 dest = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_tx_control_port()
15682 proto = nla_get_u16(info->attrs[NL80211_ATTR_CONTROL_PORT_ETHERTYPE]); in nl80211_tx_control_port()
15684 nla_get_flag(info->attrs[NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT]); in nl80211_tx_control_port()
15686 link_id = nl80211_link_id_or_invalid(info->attrs); in nl80211_tx_control_port()
15692 nl_set_extack_cookie_u64(info->extack, cookie); in nl80211_tx_control_port()
15702 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_get_ftm_responder_stats()
15703 struct net_device *dev = info->user_ptr[1]; in nl80211_get_ftm_responder_stats()
15704 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_get_ftm_responder_stats()
15706 unsigned int link_id = nl80211_link_id(info->attrs); in nl80211_get_ftm_responder_stats()
15712 if (wdev->iftype != NL80211_IFTYPE_AP || in nl80211_get_ftm_responder_stats()
15713 !wdev->links[link_id].ap.beacon_interval) in nl80211_get_ftm_responder_stats()
15714 return -EOPNOTSUPP; in nl80211_get_ftm_responder_stats()
15721 return -ENODATA; in nl80211_get_ftm_responder_stats()
15725 return -ENOMEM; in nl80211_get_ftm_responder_stats()
15727 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, in nl80211_get_ftm_responder_stats()
15732 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) in nl80211_get_ftm_responder_stats()
15769 return -ENOBUFS; in nl80211_get_ftm_responder_stats()
15774 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_update_owe_info()
15776 struct net_device *dev = info->user_ptr[1]; in nl80211_update_owe_info()
15778 if (!rdev->ops->update_owe_info) in nl80211_update_owe_info()
15779 return -EOPNOTSUPP; in nl80211_update_owe_info()
15781 if (!info->attrs[NL80211_ATTR_STATUS_CODE] || in nl80211_update_owe_info()
15782 !info->attrs[NL80211_ATTR_MAC]) in nl80211_update_owe_info()
15783 return -EINVAL; in nl80211_update_owe_info()
15786 owe_info.status = nla_get_u16(info->attrs[NL80211_ATTR_STATUS_CODE]); in nl80211_update_owe_info()
15787 nla_memcpy(owe_info.peer, info->attrs[NL80211_ATTR_MAC], ETH_ALEN); in nl80211_update_owe_info()
15789 if (info->attrs[NL80211_ATTR_IE]) { in nl80211_update_owe_info()
15790 owe_info.ie = nla_data(info->attrs[NL80211_ATTR_IE]); in nl80211_update_owe_info()
15791 owe_info.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); in nl80211_update_owe_info()
15799 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_probe_mesh_link()
15800 struct net_device *dev = info->user_ptr[1]; in nl80211_probe_mesh_link()
15801 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_probe_mesh_link()
15808 if (!rdev->ops->probe_mesh_link || !rdev->ops->get_station) in nl80211_probe_mesh_link()
15809 return -EOPNOTSUPP; in nl80211_probe_mesh_link()
15811 if (!info->attrs[NL80211_ATTR_MAC] || in nl80211_probe_mesh_link()
15812 !info->attrs[NL80211_ATTR_FRAME]) { in nl80211_probe_mesh_link()
15814 return -EINVAL; in nl80211_probe_mesh_link()
15817 if (wdev->iftype != NL80211_IFTYPE_MESH_POINT) in nl80211_probe_mesh_link()
15818 return -EOPNOTSUPP; in nl80211_probe_mesh_link()
15820 dest = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_probe_mesh_link()
15821 buf = nla_data(info->attrs[NL80211_ATTR_FRAME]); in nl80211_probe_mesh_link()
15822 len = nla_len(info->attrs[NL80211_ATTR_FRAME]); in nl80211_probe_mesh_link()
15825 return -EINVAL; in nl80211_probe_mesh_link()
15828 !ether_addr_equal(buf + ETH_ALEN, dev->dev_addr)) in nl80211_probe_mesh_link()
15829 return -EINVAL; in nl80211_probe_mesh_link()
15846 struct netlink_ext_ack *extack = info->extack; in parse_tid_conf()
15851 return -EINVAL; in parse_tid_conf()
15853 tid_conf->config_override = in parse_tid_conf()
15855 tid_conf->tids = nla_get_u16(attrs[NL80211_TID_CONFIG_ATTR_TIDS]); in parse_tid_conf()
15857 if (tid_conf->config_override) { in parse_tid_conf()
15858 if (rdev->ops->reset_tid_config) { in parse_tid_conf()
15860 tid_conf->tids); in parse_tid_conf()
15864 return -EINVAL; in parse_tid_conf()
15869 tid_conf->mask |= BIT(NL80211_TID_CONFIG_ATTR_NOACK); in parse_tid_conf()
15870 tid_conf->noack = in parse_tid_conf()
15875 tid_conf->mask |= BIT(NL80211_TID_CONFIG_ATTR_RETRY_SHORT); in parse_tid_conf()
15876 tid_conf->retry_short = in parse_tid_conf()
15879 if (tid_conf->retry_short > rdev->wiphy.max_data_retry_count) in parse_tid_conf()
15880 return -EINVAL; in parse_tid_conf()
15884 tid_conf->mask |= BIT(NL80211_TID_CONFIG_ATTR_RETRY_LONG); in parse_tid_conf()
15885 tid_conf->retry_long = in parse_tid_conf()
15888 if (tid_conf->retry_long > rdev->wiphy.max_data_retry_count) in parse_tid_conf()
15889 return -EINVAL; in parse_tid_conf()
15893 tid_conf->mask |= BIT(NL80211_TID_CONFIG_ATTR_AMPDU_CTRL); in parse_tid_conf()
15894 tid_conf->ampdu = in parse_tid_conf()
15899 tid_conf->mask |= BIT(NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL); in parse_tid_conf()
15900 tid_conf->rtscts = in parse_tid_conf()
15905 tid_conf->mask |= BIT(NL80211_TID_CONFIG_ATTR_AMSDU_CTRL); in parse_tid_conf()
15906 tid_conf->amsdu = in parse_tid_conf()
15913 tid_conf->txrate_type = nla_get_u8(attrs[idx]); in parse_tid_conf()
15915 if (tid_conf->txrate_type != NL80211_TX_RATE_AUTOMATIC) { in parse_tid_conf()
15918 &tid_conf->txrate_mask, dev, in parse_tid_conf()
15923 tid_conf->mask |= BIT(NL80211_TID_CONFIG_ATTR_TX_RATE); in parse_tid_conf()
15925 tid_conf->mask |= BIT(NL80211_TID_CONFIG_ATTR_TX_RATE_TYPE); in parse_tid_conf()
15929 mask = rdev->wiphy.tid_config_support.peer; in parse_tid_conf()
15931 mask = rdev->wiphy.tid_config_support.vif; in parse_tid_conf()
15933 if (tid_conf->mask & ~mask) { in parse_tid_conf()
15935 return -ENOTSUPP; in parse_tid_conf()
15944 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_tid_config()
15946 unsigned int link_id = nl80211_link_id(info->attrs); in nl80211_set_tid_config()
15947 struct net_device *dev = info->user_ptr[1]; in nl80211_set_tid_config()
15951 int ret = -EINVAL; in nl80211_set_tid_config()
15954 if (!info->attrs[NL80211_ATTR_TID_CONFIG]) in nl80211_set_tid_config()
15955 return -EINVAL; in nl80211_set_tid_config()
15957 if (!rdev->ops->set_tid_config) in nl80211_set_tid_config()
15958 return -EOPNOTSUPP; in nl80211_set_tid_config()
15960 nla_for_each_nested(tid, info->attrs[NL80211_ATTR_TID_CONFIG], in nl80211_set_tid_config()
15967 return -ENOMEM; in nl80211_set_tid_config()
15969 tid_config->n_tid_conf = num_conf; in nl80211_set_tid_config()
15971 if (info->attrs[NL80211_ATTR_MAC]) in nl80211_set_tid_config()
15972 tid_config->peer = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_set_tid_config()
15974 wdev_lock(dev->ieee80211_ptr); in nl80211_set_tid_config()
15976 nla_for_each_nested(tid, info->attrs[NL80211_ATTR_TID_CONFIG], in nl80211_set_tid_config()
15985 &tid_config->tid_conf[conf_idx], in nl80211_set_tid_config()
15986 info, tid_config->peer, link_id); in nl80211_set_tid_config()
15997 wdev_unlock(dev->ieee80211_ptr); in nl80211_set_tid_config()
16003 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_color_change()
16005 struct net_device *dev = info->user_ptr[1]; in nl80211_color_change()
16006 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_color_change()
16011 if (!rdev->ops->color_change) in nl80211_color_change()
16012 return -EOPNOTSUPP; in nl80211_color_change()
16014 if (!wiphy_ext_feature_isset(&rdev->wiphy, in nl80211_color_change()
16016 return -EOPNOTSUPP; in nl80211_color_change()
16018 if (wdev->iftype != NL80211_IFTYPE_AP) in nl80211_color_change()
16019 return -EOPNOTSUPP; in nl80211_color_change()
16021 if (!info->attrs[NL80211_ATTR_COLOR_CHANGE_COUNT] || in nl80211_color_change()
16022 !info->attrs[NL80211_ATTR_COLOR_CHANGE_COLOR] || in nl80211_color_change()
16023 !info->attrs[NL80211_ATTR_COLOR_CHANGE_ELEMS]) in nl80211_color_change()
16024 return -EINVAL; in nl80211_color_change()
16026 params.count = nla_get_u8(info->attrs[NL80211_ATTR_COLOR_CHANGE_COUNT]); in nl80211_color_change()
16027 params.color = nla_get_u8(info->attrs[NL80211_ATTR_COLOR_CHANGE_COLOR]); in nl80211_color_change()
16029 err = nl80211_parse_beacon(rdev, info->attrs, ¶ms.beacon_next, in nl80211_color_change()
16030 info->extack); in nl80211_color_change()
16036 return -ENOMEM; in nl80211_color_change()
16039 info->attrs[NL80211_ATTR_COLOR_CHANGE_ELEMS], in nl80211_color_change()
16040 nl80211_policy, info->extack); in nl80211_color_change()
16045 info->extack); in nl80211_color_change()
16050 err = -EINVAL; in nl80211_color_change()
16055 err = -EINVAL; in nl80211_color_change()
16061 err = -EINVAL; in nl80211_color_change()
16066 err = -EINVAL; in nl80211_color_change()
16075 err = -EINVAL; in nl80211_color_change()
16081 err = -EINVAL; in nl80211_color_change()
16087 err = -EINVAL; in nl80211_color_change()
16110 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_fils_aad()
16111 struct net_device *dev = info->user_ptr[1]; in nl80211_set_fils_aad()
16115 if (!info->attrs[NL80211_ATTR_MAC] || in nl80211_set_fils_aad()
16116 !info->attrs[NL80211_ATTR_FILS_KEK] || in nl80211_set_fils_aad()
16117 !info->attrs[NL80211_ATTR_FILS_NONCES]) in nl80211_set_fils_aad()
16118 return -EINVAL; in nl80211_set_fils_aad()
16120 fils_aad.macaddr = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_set_fils_aad()
16121 fils_aad.kek_len = nla_len(info->attrs[NL80211_ATTR_FILS_KEK]); in nl80211_set_fils_aad()
16122 fils_aad.kek = nla_data(info->attrs[NL80211_ATTR_FILS_KEK]); in nl80211_set_fils_aad()
16123 nonces = nla_data(info->attrs[NL80211_ATTR_FILS_NONCES]); in nl80211_set_fils_aad()
16132 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_add_link()
16133 unsigned int link_id = nl80211_link_id(info->attrs); in nl80211_add_link()
16134 struct net_device *dev = info->user_ptr[1]; in nl80211_add_link()
16135 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_add_link()
16138 if (!(wdev->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO)) in nl80211_add_link()
16139 return -EINVAL; in nl80211_add_link()
16141 switch (wdev->iftype) { in nl80211_add_link()
16145 return -EINVAL; in nl80211_add_link()
16148 if (!info->attrs[NL80211_ATTR_MAC] || in nl80211_add_link()
16149 !is_valid_ether_addr(nla_data(info->attrs[NL80211_ATTR_MAC]))) in nl80211_add_link()
16150 return -EINVAL; in nl80211_add_link()
16153 wdev->valid_links |= BIT(link_id); in nl80211_add_link()
16154 ether_addr_copy(wdev->links[link_id].addr, in nl80211_add_link()
16155 nla_data(info->attrs[NL80211_ATTR_MAC])); in nl80211_add_link()
16159 wdev->valid_links &= ~BIT(link_id); in nl80211_add_link()
16160 eth_zero_addr(wdev->links[link_id].addr); in nl80211_add_link()
16169 unsigned int link_id = nl80211_link_id(info->attrs); in nl80211_remove_link()
16170 struct net_device *dev = info->user_ptr[1]; in nl80211_remove_link()
16171 struct wireless_dev *wdev = dev->ieee80211_ptr; in nl80211_remove_link()
16174 if (!info->attrs[NL80211_ATTR_MLO_LINK_ID]) in nl80211_remove_link()
16175 return -EINVAL; in nl80211_remove_link()
16177 switch (wdev->iftype) { in nl80211_remove_link()
16181 return -EINVAL; in nl80211_remove_link()
16196 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_add_mod_link_station()
16197 struct net_device *dev = info->user_ptr[1]; in nl80211_add_mod_link_station()
16200 if ((add && !rdev->ops->add_link_station) || in nl80211_add_mod_link_station()
16201 (!add && !rdev->ops->mod_link_station)) in nl80211_add_mod_link_station()
16202 return -EOPNOTSUPP; in nl80211_add_mod_link_station()
16204 if (add && !info->attrs[NL80211_ATTR_MAC]) in nl80211_add_mod_link_station()
16205 return -EINVAL; in nl80211_add_mod_link_station()
16207 if (!info->attrs[NL80211_ATTR_MLD_ADDR]) in nl80211_add_mod_link_station()
16208 return -EINVAL; in nl80211_add_mod_link_station()
16210 if (add && !info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]) in nl80211_add_mod_link_station()
16211 return -EINVAL; in nl80211_add_mod_link_station()
16213 params.mld_mac = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]); in nl80211_add_mod_link_station()
16215 if (info->attrs[NL80211_ATTR_MAC]) { in nl80211_add_mod_link_station()
16216 params.link_mac = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_add_mod_link_station()
16218 return -EINVAL; in nl80211_add_mod_link_station()
16221 if (!info->attrs[NL80211_ATTR_MLO_LINK_ID]) in nl80211_add_mod_link_station()
16222 return -EINVAL; in nl80211_add_mod_link_station()
16224 params.link_id = nla_get_u8(info->attrs[NL80211_ATTR_MLO_LINK_ID]); in nl80211_add_mod_link_station()
16226 if (info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]) { in nl80211_add_mod_link_station()
16228 nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); in nl80211_add_mod_link_station()
16230 nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); in nl80211_add_mod_link_station()
16233 if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) in nl80211_add_mod_link_station()
16235 nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]); in nl80211_add_mod_link_station()
16237 if (info->attrs[NL80211_ATTR_VHT_CAPABILITY]) in nl80211_add_mod_link_station()
16239 nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY]); in nl80211_add_mod_link_station()
16241 if (info->attrs[NL80211_ATTR_HE_CAPABILITY]) { in nl80211_add_mod_link_station()
16243 nla_data(info->attrs[NL80211_ATTR_HE_CAPABILITY]); in nl80211_add_mod_link_station()
16245 nla_len(info->attrs[NL80211_ATTR_HE_CAPABILITY]); in nl80211_add_mod_link_station()
16247 if (info->attrs[NL80211_ATTR_EHT_CAPABILITY]) { in nl80211_add_mod_link_station()
16249 nla_data(info->attrs[NL80211_ATTR_EHT_CAPABILITY]); in nl80211_add_mod_link_station()
16251 nla_len(info->attrs[NL80211_ATTR_EHT_CAPABILITY]); in nl80211_add_mod_link_station()
16257 return -EINVAL; in nl80211_add_mod_link_station()
16261 if (info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY]) in nl80211_add_mod_link_station()
16263 nla_data(info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY]); in nl80211_add_mod_link_station()
16265 if (info->attrs[NL80211_ATTR_OPMODE_NOTIF]) { in nl80211_add_mod_link_station()
16268 nla_get_u8(info->attrs[NL80211_ATTR_OPMODE_NOTIF]); in nl80211_add_mod_link_station()
16276 wdev_lock(dev->ieee80211_ptr); in nl80211_add_mod_link_station()
16281 wdev_unlock(dev->ieee80211_ptr); in nl80211_add_mod_link_station()
16302 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_remove_link_station()
16303 struct net_device *dev = info->user_ptr[1]; in nl80211_remove_link_station()
16306 if (!rdev->ops->del_link_station) in nl80211_remove_link_station()
16307 return -EOPNOTSUPP; in nl80211_remove_link_station()
16309 if (!info->attrs[NL80211_ATTR_MLD_ADDR] || in nl80211_remove_link_station()
16310 !info->attrs[NL80211_ATTR_MLO_LINK_ID]) in nl80211_remove_link_station()
16311 return -EINVAL; in nl80211_remove_link_station()
16313 params.mld_mac = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]); in nl80211_remove_link_station()
16314 params.link_id = nla_get_u8(info->attrs[NL80211_ATTR_MLO_LINK_ID]); in nl80211_remove_link_station()
16316 wdev_lock(dev->ieee80211_ptr); in nl80211_remove_link_station()
16318 wdev_unlock(dev->ieee80211_ptr); in nl80211_remove_link_station()
16326 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_hw_timestamp()
16327 struct net_device *dev = info->user_ptr[1]; in nl80211_set_hw_timestamp()
16330 if (!rdev->wiphy.hw_timestamp_max_peers) in nl80211_set_hw_timestamp()
16331 return -EOPNOTSUPP; in nl80211_set_hw_timestamp()
16333 if (!info->attrs[NL80211_ATTR_MAC] && in nl80211_set_hw_timestamp()
16334 rdev->wiphy.hw_timestamp_max_peers != CFG80211_HW_TIMESTAMP_ALL_PEERS) in nl80211_set_hw_timestamp()
16335 return -EOPNOTSUPP; in nl80211_set_hw_timestamp()
16337 if (info->attrs[NL80211_ATTR_MAC]) in nl80211_set_hw_timestamp()
16338 hwts.macaddr = nla_data(info->attrs[NL80211_ATTR_MAC]); in nl80211_set_hw_timestamp()
16341 nla_get_flag(info->attrs[NL80211_ATTR_HW_TIMESTAMP_ENABLED]); in nl80211_set_hw_timestamp()
16444 if (WARN_ON(ops->internal_flags >= ARRAY_SIZE(nl80211_internal_flags))) in nl80211_pre_doit()
16445 return -EINVAL; in nl80211_pre_doit()
16447 internal_flags = nl80211_internal_flags[ops->internal_flags]; in nl80211_pre_doit()
16456 info->user_ptr[0] = rdev; in nl80211_pre_doit()
16460 info->attrs); in nl80211_pre_doit()
16466 dev = wdev->netdev; in nl80211_pre_doit()
16468 rdev = wiphy_to_rdev(wdev->wiphy); in nl80211_pre_doit()
16472 err = -EINVAL; in nl80211_pre_doit()
16476 info->user_ptr[1] = dev; in nl80211_pre_doit()
16478 info->user_ptr[1] = wdev; in nl80211_pre_doit()
16483 err = -ENETDOWN; in nl80211_pre_doit()
16487 info->user_ptr[0] = rdev; in nl80211_pre_doit()
16491 struct nlattr *link_id = info->attrs[NL80211_ATTR_MLO_LINK_ID]; in nl80211_pre_doit()
16494 err = -EINVAL; in nl80211_pre_doit()
16498 /* MLO -> require valid link ID */ in nl80211_pre_doit()
16499 if (wdev->valid_links && in nl80211_pre_doit()
16501 !(wdev->valid_links & BIT(nla_get_u8(link_id))))) { in nl80211_pre_doit()
16502 err = -EINVAL; in nl80211_pre_doit()
16506 /* non-MLO -> no link ID attribute accepted */ in nl80211_pre_doit()
16507 if (!wdev->valid_links && link_id) { in nl80211_pre_doit()
16508 err = -EINVAL; in nl80211_pre_doit()
16514 if (info->attrs[NL80211_ATTR_MLO_LINK_ID] || in nl80211_pre_doit()
16515 (wdev && wdev->valid_links)) { in nl80211_pre_doit()
16516 err = -EINVAL; in nl80211_pre_doit()
16522 wiphy_lock(&rdev->wiphy); in nl80211_pre_doit()
16524 __release(&rdev->wiphy.mtx); in nl80211_pre_doit()
16540 u32 internal_flags = nl80211_internal_flags[ops->internal_flags]; in nl80211_post_doit()
16542 if (info->user_ptr[1]) { in nl80211_post_doit()
16544 struct wireless_dev *wdev = info->user_ptr[1]; in nl80211_post_doit()
16546 dev_put(wdev->netdev); in nl80211_post_doit()
16548 dev_put(info->user_ptr[1]); in nl80211_post_doit()
16552 if (info->user_ptr[0] && in nl80211_post_doit()
16554 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_post_doit()
16557 __acquire(&rdev->wiphy.mtx); in nl80211_post_doit()
16558 wiphy_unlock(&rdev->wiphy); in nl80211_post_doit()
16583 return -EINVAL; in nl80211_set_sar_sub_specs()
16587 return -EINVAL; in nl80211_set_sar_sub_specs()
16592 if (range_index >= rdev->wiphy.sar_capa->num_freq_ranges) in nl80211_set_sar_sub_specs()
16593 return -EINVAL; in nl80211_set_sar_sub_specs()
16597 if (sar_specs->sub_specs[i].freq_range_index == range_index) in nl80211_set_sar_sub_specs()
16598 return -EINVAL; in nl80211_set_sar_sub_specs()
16601 sar_specs->sub_specs[index].power = in nl80211_set_sar_sub_specs()
16604 sar_specs->sub_specs[index].freq_range_index = range_index; in nl80211_set_sar_sub_specs()
16611 struct cfg80211_registered_device *rdev = info->user_ptr[0]; in nl80211_set_sar_specs()
16620 if (!rdev->wiphy.sar_capa || !rdev->ops->set_sar_specs) in nl80211_set_sar_specs()
16621 return -EOPNOTSUPP; in nl80211_set_sar_specs()
16623 if (!info->attrs[NL80211_ATTR_SAR_SPEC]) in nl80211_set_sar_specs()
16624 return -EINVAL; in nl80211_set_sar_specs()
16627 info->attrs[NL80211_ATTR_SAR_SPEC], in nl80211_set_sar_specs()
16631 return -EINVAL; in nl80211_set_sar_specs()
16634 if (type != rdev->wiphy.sar_capa->type) in nl80211_set_sar_specs()
16635 return -EINVAL; in nl80211_set_sar_specs()
16641 if (specs > rdev->wiphy.sar_capa->num_freq_ranges) in nl80211_set_sar_specs()
16642 return -EINVAL; in nl80211_set_sar_specs()
16646 return -ENOMEM; in nl80211_set_sar_specs()
16648 sar_spec->type = type; in nl80211_set_sar_specs()
16658 err = -EINVAL; in nl80211_set_sar_specs()
16663 err = -EINVAL; in nl80211_set_sar_specs()
16669 sar_spec->num_sub_specs = specs; in nl80211_set_sar_specs()
16671 rdev->cur_cmd_info = info; in nl80211_set_sar_specs()
16673 rdev->cur_cmd_info = NULL; in nl80211_set_sar_specs()
17569 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_notify_wiphy()
17588 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_notify_iface()
17595 struct cfg80211_scan_request *req = rdev->scan_req; in nl80211_add_scan_req()
17606 for (i = 0; i < req->n_ssids; i++) { in nl80211_add_scan_req()
17607 if (nla_put(msg, i, req->ssids[i].ssid_len, req->ssids[i].ssid)) in nl80211_add_scan_req()
17612 if (req->flags & NL80211_SCAN_FLAG_FREQ_KHZ) { in nl80211_add_scan_req()
17616 for (i = 0; i < req->n_channels; i++) { in nl80211_add_scan_req()
17618 ieee80211_channel_to_khz(req->channels[i]))) in nl80211_add_scan_req()
17627 for (i = 0; i < req->n_channels; i++) { in nl80211_add_scan_req()
17628 if (nla_put_u32(msg, i, req->channels[i]->center_freq)) in nl80211_add_scan_req()
17634 if (req->ie && in nl80211_add_scan_req()
17635 nla_put(msg, NL80211_ATTR_IE, req->ie_len, req->ie)) in nl80211_add_scan_req()
17638 if (req->flags && in nl80211_add_scan_req()
17639 nla_put_u32(msg, NL80211_ATTR_SCAN_FLAGS, req->flags)) in nl80211_add_scan_req()
17642 info = rdev->int_scan_req ? &rdev->int_scan_req->info : in nl80211_add_scan_req()
17643 &rdev->scan_req->info; in nl80211_add_scan_req()
17644 if (info->scan_start_tsf && in nl80211_add_scan_req()
17646 info->scan_start_tsf, NL80211_BSS_PAD) || in nl80211_add_scan_req()
17648 info->tsf_bssid))) in nl80211_add_scan_req()
17653 return -ENOBUFS; in nl80211_add_scan_req()
17666 return -1; in nl80211_prep_scan_msg()
17668 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_prep_scan_msg()
17669 (wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX, in nl80211_prep_scan_msg()
17670 wdev->netdev->ifindex)) || in nl80211_prep_scan_msg()
17683 return -EMSGSIZE; in nl80211_prep_scan_msg()
17694 return -1; in nl80211_prep_sched_scan_msg()
17697 wiphy_to_rdev(req->wiphy)->wiphy_idx) || in nl80211_prep_sched_scan_msg()
17698 nla_put_u32(msg, NL80211_ATTR_IFINDEX, req->dev->ifindex) || in nl80211_prep_sched_scan_msg()
17699 nla_put_u64_64bit(msg, NL80211_ATTR_COOKIE, req->reqid, in nl80211_prep_sched_scan_msg()
17708 return -EMSGSIZE; in nl80211_prep_sched_scan_msg()
17726 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_send_scan_start()
17756 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_send_scan_msg()
17773 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(req->wiphy), msg, 0, in nl80211_send_sched_scan()
17781 if (nla_put_u8(msg, NL80211_ATTR_REG_INITIATOR, request->initiator)) in nl80211_reg_change_event_fill()
17784 if (request->alpha2[0] == '0' && request->alpha2[1] == '0') { in nl80211_reg_change_event_fill()
17788 } else if (request->alpha2[0] == '9' && request->alpha2[1] == '9') { in nl80211_reg_change_event_fill()
17792 } else if ((request->alpha2[0] == '9' && request->alpha2[1] == '8') || in nl80211_reg_change_event_fill()
17793 request->intersect) { in nl80211_reg_change_event_fill()
17801 request->alpha2)) in nl80211_reg_change_event_fill()
17805 if (request->wiphy_idx != WIPHY_IDX_INVALID) { in nl80211_reg_change_event_fill()
17806 struct wiphy *wiphy = wiphy_idx_to_wiphy(request->wiphy_idx); in nl80211_reg_change_event_fill()
17809 nla_put_u32(msg, NL80211_ATTR_WIPHY, request->wiphy_idx)) in nl80211_reg_change_event_fill()
17813 wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED && in nl80211_reg_change_event_fill()
17878 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_send_mlme_event()
17879 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || in nl80211_send_mlme_event()
17903 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_send_mlme_event()
17916 NL80211_CMD_AUTHENTICATE, gfp, -1, NULL, 0, in nl80211_send_rx_auth()
17924 nl80211_send_mlme_event(rdev, netdev, data->buf, data->len, in nl80211_send_rx_assoc()
17926 data->uapsd_queues, in nl80211_send_rx_assoc()
17927 data->req_ies, data->req_ies_len, false); in nl80211_send_rx_assoc()
17935 NL80211_CMD_DEAUTHENTICATE, gfp, -1, NULL, 0, in nl80211_send_deauth()
17944 NL80211_CMD_DISASSOCIATE, gfp, -1, NULL, 0, in nl80211_send_disassoc()
17951 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_rx_unprot_mlme_mgmt()
17952 struct wiphy *wiphy = wdev->wiphy; in cfg80211_rx_unprot_mlme_mgmt()
17960 if (ieee80211_is_deauth(mgmt->frame_control)) { in cfg80211_rx_unprot_mlme_mgmt()
17962 } else if (ieee80211_is_disassoc(mgmt->frame_control)) { in cfg80211_rx_unprot_mlme_mgmt()
17964 } else if (ieee80211_is_beacon(mgmt->frame_control)) { in cfg80211_rx_unprot_mlme_mgmt()
17965 if (wdev->unprot_beacon_reported && in cfg80211_rx_unprot_mlme_mgmt()
17966 elapsed_jiffies_msecs(wdev->unprot_beacon_reported) < 10000) in cfg80211_rx_unprot_mlme_mgmt()
17969 wdev->unprot_beacon_reported = jiffies; in cfg80211_rx_unprot_mlme_mgmt()
17975 nl80211_send_mlme_event(rdev, dev, buf, len, cmd, GFP_ATOMIC, -1, in cfg80211_rx_unprot_mlme_mgmt()
17997 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_send_mlme_timeout()
17998 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || in nl80211_send_mlme_timeout()
18005 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_send_mlme_timeout()
18038 const u8 *connected_addr = cr->valid_links ? in nl80211_send_connect_result()
18039 cr->ap_mld_addr : cr->links[0].bssid; in nl80211_send_connect_result()
18041 if (cr->valid_links) { in nl80211_send_connect_result()
18047 link_info_size += cr->links[link].addr ? in nl80211_send_connect_result()
18049 link_info_size += (cr->links[link].bssid || in nl80211_send_connect_result()
18050 cr->links[link].bss) ? in nl80211_send_connect_result()
18056 msg = nlmsg_new(100 + cr->req_ie_len + cr->resp_ie_len + in nl80211_send_connect_result()
18057 cr->fils.kek_len + cr->fils.pmk_len + in nl80211_send_connect_result()
18058 (cr->fils.pmkid ? WLAN_PMKID_LEN : 0) + link_info_size, in nl80211_send_connect_result()
18069 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_send_connect_result()
18070 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || in nl80211_send_connect_result()
18074 cr->status < 0 ? WLAN_STATUS_UNSPECIFIED_FAILURE : in nl80211_send_connect_result()
18075 cr->status) || in nl80211_send_connect_result()
18076 (cr->status < 0 && in nl80211_send_connect_result()
18079 cr->timeout_reason))) || in nl80211_send_connect_result()
18080 (cr->req_ie && in nl80211_send_connect_result()
18081 nla_put(msg, NL80211_ATTR_REQ_IE, cr->req_ie_len, cr->req_ie)) || in nl80211_send_connect_result()
18082 (cr->resp_ie && in nl80211_send_connect_result()
18083 nla_put(msg, NL80211_ATTR_RESP_IE, cr->resp_ie_len, in nl80211_send_connect_result()
18084 cr->resp_ie)) || in nl80211_send_connect_result()
18085 (cr->fils.update_erp_next_seq_num && in nl80211_send_connect_result()
18087 cr->fils.erp_next_seq_num)) || in nl80211_send_connect_result()
18088 (cr->status == WLAN_STATUS_SUCCESS && in nl80211_send_connect_result()
18089 ((cr->fils.kek && in nl80211_send_connect_result()
18090 nla_put(msg, NL80211_ATTR_FILS_KEK, cr->fils.kek_len, in nl80211_send_connect_result()
18091 cr->fils.kek)) || in nl80211_send_connect_result()
18092 (cr->fils.pmk && in nl80211_send_connect_result()
18093 nla_put(msg, NL80211_ATTR_PMK, cr->fils.pmk_len, cr->fils.pmk)) || in nl80211_send_connect_result()
18094 (cr->fils.pmkid && in nl80211_send_connect_result()
18095 nla_put(msg, NL80211_ATTR_PMKID, WLAN_PMKID_LEN, cr->fils.pmkid))))) in nl80211_send_connect_result()
18098 if (cr->valid_links) { in nl80211_send_connect_result()
18108 const u8 *bssid = cr->links[link].bss ? in nl80211_send_connect_result()
18109 cr->links[link].bss->bssid : in nl80211_send_connect_result()
18110 cr->links[link].bssid; in nl80211_send_connect_result()
18119 (cr->links[link].addr && in nl80211_send_connect_result()
18121 cr->links[link].addr)) || in nl80211_send_connect_result()
18123 cr->links[link].status)) in nl80211_send_connect_result()
18134 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_send_connect_result()
18150 const u8 *connected_addr = info->ap_mld_addr ? in nl80211_send_roamed()
18151 info->ap_mld_addr : in nl80211_send_roamed()
18152 (info->links[0].bss ? in nl80211_send_roamed()
18153 info->links[0].bss->bssid : in nl80211_send_roamed()
18154 info->links[0].bssid); in nl80211_send_roamed()
18156 if (info->valid_links) { in nl80211_send_roamed()
18162 link_info_size += info->links[link].addr ? in nl80211_send_roamed()
18164 link_info_size += (info->links[link].bssid || in nl80211_send_roamed()
18165 info->links[link].bss) ? in nl80211_send_roamed()
18170 msg = nlmsg_new(100 + info->req_ie_len + info->resp_ie_len + in nl80211_send_roamed()
18171 info->fils.kek_len + info->fils.pmk_len + in nl80211_send_roamed()
18172 (info->fils.pmkid ? WLAN_PMKID_LEN : 0) + in nl80211_send_roamed()
18183 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_send_roamed()
18184 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || in nl80211_send_roamed()
18186 (info->req_ie && in nl80211_send_roamed()
18187 nla_put(msg, NL80211_ATTR_REQ_IE, info->req_ie_len, in nl80211_send_roamed()
18188 info->req_ie)) || in nl80211_send_roamed()
18189 (info->resp_ie && in nl80211_send_roamed()
18190 nla_put(msg, NL80211_ATTR_RESP_IE, info->resp_ie_len, in nl80211_send_roamed()
18191 info->resp_ie)) || in nl80211_send_roamed()
18192 (info->fils.update_erp_next_seq_num && in nl80211_send_roamed()
18194 info->fils.erp_next_seq_num)) || in nl80211_send_roamed()
18195 (info->fils.kek && in nl80211_send_roamed()
18196 nla_put(msg, NL80211_ATTR_FILS_KEK, info->fils.kek_len, in nl80211_send_roamed()
18197 info->fils.kek)) || in nl80211_send_roamed()
18198 (info->fils.pmk && in nl80211_send_roamed()
18199 nla_put(msg, NL80211_ATTR_PMK, info->fils.pmk_len, info->fils.pmk)) || in nl80211_send_roamed()
18200 (info->fils.pmkid && in nl80211_send_roamed()
18201 nla_put(msg, NL80211_ATTR_PMKID, WLAN_PMKID_LEN, info->fils.pmkid))) in nl80211_send_roamed()
18204 if (info->valid_links) { in nl80211_send_roamed()
18214 const u8 *bssid = info->links[link].bss ? in nl80211_send_roamed()
18215 info->links[link].bss->bssid : in nl80211_send_roamed()
18216 info->links[link].bssid; in nl80211_send_roamed()
18225 (info->links[link].addr && in nl80211_send_roamed()
18227 info->links[link].addr))) in nl80211_send_roamed()
18238 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_send_roamed()
18263 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_send_port_authorized()
18264 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || in nl80211_send_port_authorized()
18275 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_send_port_authorized()
18300 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_send_disconnected()
18301 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || in nl80211_send_disconnected()
18311 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_send_disconnected()
18321 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_links_removed()
18322 struct wiphy *wiphy = wdev->wiphy; in cfg80211_links_removed()
18331 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION && in cfg80211_links_removed()
18332 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)) in cfg80211_links_removed()
18335 if (WARN_ON(!wdev->valid_links || !link_mask || in cfg80211_links_removed()
18336 (wdev->valid_links & link_mask) != link_mask || in cfg80211_links_removed()
18337 wdev->valid_links == link_mask)) in cfg80211_links_removed()
18341 wdev->valid_links &= ~link_mask; in cfg80211_links_removed()
18353 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in cfg80211_links_removed()
18354 nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) in cfg80211_links_removed()
18380 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in cfg80211_links_removed()
18406 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_send_ibss_bssid()
18407 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || in nl80211_send_ibss_bssid()
18413 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_send_ibss_bssid()
18425 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_notify_new_peer_candidate()
18426 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_notify_new_peer_candidate()
18430 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_MESH_POINT)) in cfg80211_notify_new_peer_candidate()
18445 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in cfg80211_notify_new_peer_candidate()
18446 nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || in cfg80211_notify_new_peer_candidate()
18456 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in cfg80211_notify_new_peer_candidate()
18483 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_michael_mic_failure()
18484 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || in nl80211_michael_mic_failure()
18487 (key_id != -1 && in nl80211_michael_mic_failure()
18494 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_michael_mic_failure()
18577 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_send_remain_on_chan_event()
18578 (wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX, in nl80211_send_remain_on_chan_event()
18579 wdev->netdev->ifindex)) || in nl80211_send_remain_on_chan_event()
18582 nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq) || in nl80211_send_remain_on_chan_event()
18595 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_send_remain_on_chan_event()
18606 struct wireless_dev *wdev = netdev->ieee80211_ptr; in cfg80211_assoc_comeback()
18607 struct wiphy *wiphy = wdev->wiphy; in cfg80211_assoc_comeback()
18624 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in cfg80211_assoc_comeback()
18625 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || in cfg80211_assoc_comeback()
18632 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in cfg80211_assoc_comeback()
18645 struct wiphy *wiphy = wdev->wiphy; in cfg80211_ready_on_channel()
18659 struct wiphy *wiphy = wdev->wiphy; in cfg80211_remain_on_channel_expired()
18672 struct wiphy *wiphy = wdev->wiphy; in cfg80211_tx_mgmt_expired()
18684 struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; in cfg80211_new_sta()
18700 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in cfg80211_new_sta()
18708 struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; in cfg80211_del_sta_sinfo()
18730 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in cfg80211_del_sta_sinfo()
18739 struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; in cfg80211_conn_failed()
18754 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || in cfg80211_conn_failed()
18761 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in cfg80211_conn_failed()
18773 struct wireless_dev *wdev = dev->ieee80211_ptr; in __nl80211_unexpected_frame()
18774 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in __nl80211_unexpected_frame()
18777 u32 nlportid = READ_ONCE(wdev->ap_unexpected_nlportid); in __nl80211_unexpected_frame()
18792 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in __nl80211_unexpected_frame()
18793 nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || in __nl80211_unexpected_frame()
18798 genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid); in __nl80211_unexpected_frame()
18809 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_rx_spurious_frame()
18814 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_AP && in cfg80211_rx_spurious_frame()
18815 wdev->iftype != NL80211_IFTYPE_P2P_GO)) { in cfg80211_rx_spurious_frame()
18829 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_rx_unexpected_4addr_frame()
18834 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_AP && in cfg80211_rx_unexpected_4addr_frame()
18835 wdev->iftype != NL80211_IFTYPE_P2P_GO && in cfg80211_rx_unexpected_4addr_frame()
18836 wdev->iftype != NL80211_IFTYPE_AP_VLAN)) { in cfg80211_rx_unexpected_4addr_frame()
18852 struct net_device *netdev = wdev->netdev; in nl80211_send_mgmt()
18856 msg = nlmsg_new(100 + info->len, gfp); in nl80211_send_mgmt()
18858 return -ENOMEM; in nl80211_send_mgmt()
18863 return -ENOMEM; in nl80211_send_mgmt()
18866 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_send_mgmt()
18868 netdev->ifindex)) || in nl80211_send_mgmt()
18871 (info->have_link_id && in nl80211_send_mgmt()
18872 nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, info->link_id)) || in nl80211_send_mgmt()
18873 nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, KHZ_TO_MHZ(info->freq)) || in nl80211_send_mgmt()
18874 nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ_OFFSET, info->freq % 1000) || in nl80211_send_mgmt()
18875 (info->sig_dbm && in nl80211_send_mgmt()
18876 nla_put_u32(msg, NL80211_ATTR_RX_SIGNAL_DBM, info->sig_dbm)) || in nl80211_send_mgmt()
18877 nla_put(msg, NL80211_ATTR_FRAME, info->len, info->buf) || in nl80211_send_mgmt()
18878 (info->flags && in nl80211_send_mgmt()
18879 nla_put_u32(msg, NL80211_ATTR_RXMGMT_FLAGS, info->flags)) || in nl80211_send_mgmt()
18880 (info->rx_tstamp && nla_put_u64_64bit(msg, in nl80211_send_mgmt()
18882 info->rx_tstamp, in nl80211_send_mgmt()
18884 (info->ack_tstamp && nla_put_u64_64bit(msg, in nl80211_send_mgmt()
18886 info->ack_tstamp, in nl80211_send_mgmt()
18892 return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid); in nl80211_send_mgmt()
18896 return -ENOBUFS; in nl80211_send_mgmt()
18903 struct wiphy *wiphy = wdev->wiphy; in nl80211_frame_tx_status()
18905 struct net_device *netdev = wdev->netdev; in nl80211_frame_tx_status()
18910 trace_cfg80211_mgmt_tx_status(wdev, status->cookie, in nl80211_frame_tx_status()
18911 status->ack); in nl80211_frame_tx_status()
18913 trace_cfg80211_control_port_tx_status(wdev, status->cookie, in nl80211_frame_tx_status()
18914 status->ack); in nl80211_frame_tx_status()
18916 msg = nlmsg_new(100 + status->len, gfp); in nl80211_frame_tx_status()
18926 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_frame_tx_status()
18928 netdev->ifindex)) || in nl80211_frame_tx_status()
18931 nla_put(msg, NL80211_ATTR_FRAME, status->len, status->buf) || in nl80211_frame_tx_status()
18932 nla_put_u64_64bit(msg, NL80211_ATTR_COOKIE, status->cookie, in nl80211_frame_tx_status()
18934 (status->ack && nla_put_flag(msg, NL80211_ATTR_ACK)) || in nl80211_frame_tx_status()
18935 (status->tx_tstamp && in nl80211_frame_tx_status()
18937 status->tx_tstamp, NL80211_ATTR_PAD)) || in nl80211_frame_tx_status()
18938 (status->ack_tstamp && in nl80211_frame_tx_status()
18940 status->ack_tstamp, NL80211_ATTR_PAD))) in nl80211_frame_tx_status()
18945 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_frame_tx_status()
18982 struct wireless_dev *wdev = dev->ieee80211_ptr; in __nl80211_rx_control_port()
18983 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in __nl80211_rx_control_port()
18985 const u8 *addr = ehdr->h_source; in __nl80211_rx_control_port()
18986 u16 proto = be16_to_cpu(skb->protocol); in __nl80211_rx_control_port()
18991 u32 nlportid = READ_ONCE(wdev->conn_owner_nlportid); in __nl80211_rx_control_port()
18994 return -ENOENT; in __nl80211_rx_control_port()
18996 msg = nlmsg_new(100 + skb->len, gfp); in __nl80211_rx_control_port()
18998 return -ENOMEM; in __nl80211_rx_control_port()
19003 return -ENOBUFS; in __nl80211_rx_control_port()
19006 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in __nl80211_rx_control_port()
19007 nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || in __nl80211_rx_control_port()
19018 frame = nla_reserve(msg, NL80211_ATTR_FRAME, skb->len); in __nl80211_rx_control_port()
19022 skb_copy_bits(skb, 0, nla_data(frame), skb->len); in __nl80211_rx_control_port()
19025 return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid); in __nl80211_rx_control_port()
19029 return -ENOBUFS; in __nl80211_rx_control_port()
19048 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_prepare_cqm()
19049 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_prepare_cqm()
19056 cb = (void **)msg->cb; in cfg80211_prepare_cqm()
19064 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in cfg80211_prepare_cqm()
19065 nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) in cfg80211_prepare_cqm()
19085 void **cb = (void **)msg->cb; in cfg80211_send_cqm()
19091 memset(msg->cb, 0, sizeof(msg->cb)); in cfg80211_send_cqm()
19093 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in cfg80211_send_cqm()
19101 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_cqm_rssi_notify()
19111 cqm_config = rcu_dereference(wdev->cqm_config); in cfg80211_cqm_rssi_notify()
19113 cqm_config->last_rssi_event_value = rssi_level; in cfg80211_cqm_rssi_notify()
19114 cqm_config->last_rssi_event_type = rssi_event; in cfg80211_cqm_rssi_notify()
19115 wiphy_work_queue(wdev->wiphy, &wdev->cqm_rssi_work); in cfg80211_cqm_rssi_notify()
19132 cqm_config = rcu_dereference_protected(wdev->cqm_config, in cfg80211_cqm_rssi_notify_work()
19133 lockdep_is_held(&wdev->mtx)); in cfg80211_cqm_rssi_notify_work()
19134 if (!wdev->cqm_config) in cfg80211_cqm_rssi_notify_work()
19137 cfg80211_cqm_rssi_update(rdev, wdev->netdev, cqm_config); in cfg80211_cqm_rssi_notify_work()
19139 rssi_level = cqm_config->last_rssi_event_value; in cfg80211_cqm_rssi_notify_work()
19140 rssi_event = cqm_config->last_rssi_event_type; in cfg80211_cqm_rssi_notify_work()
19142 msg = cfg80211_prepare_cqm(wdev->netdev, NULL, GFP_KERNEL); in cfg80211_cqm_rssi_notify_work()
19250 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_gtk_rekey_notify()
19251 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || in nl80211_gtk_rekey_notify()
19267 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_gtk_rekey_notify()
19278 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_gtk_rekey_notify()
19279 struct wiphy *wiphy = wdev->wiphy; in cfg80211_gtk_rekey_notify()
19306 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_pmksa_candidate_notify()
19307 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) in nl80211_pmksa_candidate_notify()
19324 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_pmksa_candidate_notify()
19335 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_pmksa_candidate_notify()
19336 struct wiphy *wiphy = wdev->wiphy; in cfg80211_pmksa_candidate_notify()
19352 struct wireless_dev *wdev = netdev->ieee80211_ptr; in nl80211_ch_switch_notify()
19366 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) in nl80211_ch_switch_notify()
19369 if (wdev->valid_links && in nl80211_ch_switch_notify()
19389 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_ch_switch_notify()
19401 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_ch_switch_notify()
19402 struct wiphy *wiphy = wdev->wiphy; in cfg80211_ch_switch_notify()
19410 switch (wdev->iftype) { in cfg80211_ch_switch_notify()
19413 if (!WARN_ON(!wdev->links[link_id].client.current_bss)) in cfg80211_ch_switch_notify()
19415 chandef->chan); in cfg80211_ch_switch_notify()
19418 wdev->u.mesh.chandef = *chandef; in cfg80211_ch_switch_notify()
19419 wdev->u.mesh.preset_chandef = *chandef; in cfg80211_ch_switch_notify()
19423 wdev->links[link_id].ap.chandef = *chandef; in cfg80211_ch_switch_notify()
19426 wdev->u.ibss.chandef = *chandef; in cfg80211_ch_switch_notify()
19446 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_ch_switch_started_notify()
19447 struct wiphy *wiphy = wdev->wiphy; in cfg80211_ch_switch_started_notify()
19467 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_bss_color_notify()
19468 struct wiphy *wiphy = wdev->wiphy; in cfg80211_bss_color_notify()
19479 return -ENOMEM; in cfg80211_bss_color_notify()
19485 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) in cfg80211_bss_color_notify()
19499 return genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), in cfg80211_bss_color_notify()
19504 return -EINVAL; in cfg80211_bss_color_notify()
19527 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) in nl80211_radar_notify()
19532 struct wireless_dev *wdev = netdev->ieee80211_ptr; in nl80211_radar_notify()
19534 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || in nl80211_radar_notify()
19548 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in nl80211_radar_notify()
19561 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_sta_opmode_change_notify()
19562 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_sta_opmode_change_notify()
19578 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) in cfg80211_sta_opmode_change_notify()
19581 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) in cfg80211_sta_opmode_change_notify()
19587 if ((sta_opmode->changed & STA_OPMODE_SMPS_MODE_CHANGED) && in cfg80211_sta_opmode_change_notify()
19588 nla_put_u8(msg, NL80211_ATTR_SMPS_MODE, sta_opmode->smps_mode)) in cfg80211_sta_opmode_change_notify()
19591 if ((sta_opmode->changed & STA_OPMODE_MAX_BW_CHANGED) && in cfg80211_sta_opmode_change_notify()
19592 nla_put_u32(msg, NL80211_ATTR_CHANNEL_WIDTH, sta_opmode->bw)) in cfg80211_sta_opmode_change_notify()
19595 if ((sta_opmode->changed & STA_OPMODE_N_SS_CHANGED) && in cfg80211_sta_opmode_change_notify()
19596 nla_put_u8(msg, NL80211_ATTR_NSS, sta_opmode->rx_nss)) in cfg80211_sta_opmode_change_notify()
19601 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in cfg80211_sta_opmode_change_notify()
19615 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_probe_status()
19616 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_probe_status()
19633 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in cfg80211_probe_status()
19634 nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || in cfg80211_probe_status()
19645 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in cfg80211_probe_status()
19664 spin_lock_bh(&rdev->beacon_registrations_lock); in cfg80211_report_obss_beacon_khz()
19665 list_for_each_entry(reg, &rdev->beacon_registrations, list) { in cfg80211_report_obss_beacon_khz()
19668 spin_unlock_bh(&rdev->beacon_registrations_lock); in cfg80211_report_obss_beacon_khz()
19676 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in cfg80211_report_obss_beacon_khz()
19689 genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, reg->nlportid); in cfg80211_report_obss_beacon_khz()
19691 spin_unlock_bh(&rdev->beacon_registrations_lock); in cfg80211_report_obss_beacon_khz()
19695 spin_unlock_bh(&rdev->beacon_registrations_lock); in cfg80211_report_obss_beacon_khz()
19704 struct cfg80211_wowlan_nd_info *nd = wakeup->net_detect; in cfg80211_net_detect_results()
19711 return -EMSGSIZE; in cfg80211_net_detect_results()
19713 for (i = 0; i < nd->n_matches; i++) { in cfg80211_net_detect_results()
19714 struct cfg80211_wowlan_nd_match *match = nd->matches[i]; in cfg80211_net_detect_results()
19727 if (nla_put(msg, NL80211_ATTR_SSID, match->ssid.ssid_len, in cfg80211_net_detect_results()
19728 match->ssid.ssid)) { in cfg80211_net_detect_results()
19733 if (match->n_channels) { in cfg80211_net_detect_results()
19741 for (j = 0; j < match->n_channels; j++) { in cfg80211_net_detect_results()
19742 if (nla_put_u32(msg, j, match->channels[j])) { in cfg80211_net_detect_results()
19764 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_report_wowlan_wakeup()
19769 trace_cfg80211_report_wowlan_wakeup(wdev->wiphy, wdev, wakeup); in cfg80211_report_wowlan_wakeup()
19772 size += wakeup->packet_present_len; in cfg80211_report_wowlan_wakeup()
19782 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in cfg80211_report_wowlan_wakeup()
19787 if (wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX, in cfg80211_report_wowlan_wakeup()
19788 wdev->netdev->ifindex)) in cfg80211_report_wowlan_wakeup()
19799 if (wakeup->disconnect && in cfg80211_report_wowlan_wakeup()
19802 if (wakeup->magic_pkt && in cfg80211_report_wowlan_wakeup()
19805 if (wakeup->gtk_rekey_failure && in cfg80211_report_wowlan_wakeup()
19808 if (wakeup->eap_identity_req && in cfg80211_report_wowlan_wakeup()
19811 if (wakeup->four_way_handshake && in cfg80211_report_wowlan_wakeup()
19814 if (wakeup->rfkill_release && in cfg80211_report_wowlan_wakeup()
19818 if (wakeup->pattern_idx >= 0 && in cfg80211_report_wowlan_wakeup()
19820 wakeup->pattern_idx)) in cfg80211_report_wowlan_wakeup()
19823 if (wakeup->tcp_match && in cfg80211_report_wowlan_wakeup()
19827 if (wakeup->tcp_connlost && in cfg80211_report_wowlan_wakeup()
19831 if (wakeup->tcp_nomoretokens && in cfg80211_report_wowlan_wakeup()
19836 if (wakeup->packet) { in cfg80211_report_wowlan_wakeup()
19840 if (!wakeup->packet_80211) { in cfg80211_report_wowlan_wakeup()
19847 if (wakeup->packet_len && in cfg80211_report_wowlan_wakeup()
19848 nla_put_u32(msg, len_attr, wakeup->packet_len)) in cfg80211_report_wowlan_wakeup()
19851 if (nla_put(msg, pkt_attr, wakeup->packet_present_len, in cfg80211_report_wowlan_wakeup()
19852 wakeup->packet)) in cfg80211_report_wowlan_wakeup()
19856 if (wakeup->net_detect && in cfg80211_report_wowlan_wakeup()
19865 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in cfg80211_report_wowlan_wakeup()
19879 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_tdls_oper_request()
19880 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_tdls_oper_request()
19884 trace_cfg80211_tdls_oper_request(wdev->wiphy, dev, peer, oper, in cfg80211_tdls_oper_request()
19897 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in cfg80211_tdls_oper_request()
19898 nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || in cfg80211_tdls_oper_request()
19907 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in cfg80211_tdls_oper_request()
19925 if (state != NETLINK_URELEASE || notify->protocol != NETLINK_GENERIC) in nl80211_netlink_notify()
19934 &rdev->sched_scan_req_list, in nl80211_netlink_notify()
19936 if (sched_scan_req->owner_nlportid == notify->portid) { in nl80211_netlink_notify()
19937 sched_scan_req->nl_owner_dead = true; in nl80211_netlink_notify()
19938 wiphy_work_queue(&rdev->wiphy, in nl80211_netlink_notify()
19939 &rdev->sched_scan_stop_wk); in nl80211_netlink_notify()
19943 list_for_each_entry_rcu(wdev, &rdev->wiphy.wdev_list, list) { in nl80211_netlink_notify()
19944 cfg80211_mlme_unregister_socket(wdev, notify->portid); in nl80211_netlink_notify()
19946 if (wdev->owner_nlportid == notify->portid) { in nl80211_netlink_notify()
19947 wdev->nl_owner_dead = true; in nl80211_netlink_notify()
19948 schedule_work(&rdev->destroy_work); in nl80211_netlink_notify()
19949 } else if (wdev->conn_owner_nlportid == notify->portid) { in nl80211_netlink_notify()
19950 schedule_work(&wdev->disconnect_wk); in nl80211_netlink_notify()
19953 cfg80211_release_pmsr(wdev, notify->portid); in nl80211_netlink_notify()
19956 spin_lock_bh(&rdev->beacon_registrations_lock); in nl80211_netlink_notify()
19957 list_for_each_entry_safe(reg, tmp, &rdev->beacon_registrations, in nl80211_netlink_notify()
19959 if (reg->nlportid == notify->portid) { in nl80211_netlink_notify()
19960 list_del(®->list); in nl80211_netlink_notify()
19965 spin_unlock_bh(&rdev->beacon_registrations_lock); in nl80211_netlink_notify()
19974 regulatory_netlink_notify(notify->portid); in nl80211_netlink_notify()
19985 struct wiphy *wiphy = netdev->ieee80211_ptr->wiphy; in cfg80211_ft_event()
19992 if (!ft_event->target_ap) in cfg80211_ft_event()
19995 msg = nlmsg_new(100 + ft_event->ies_len + ft_event->ric_ies_len, in cfg80211_ft_event()
20004 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in cfg80211_ft_event()
20005 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || in cfg80211_ft_event()
20006 nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, ft_event->target_ap)) in cfg80211_ft_event()
20009 if (ft_event->ies && in cfg80211_ft_event()
20010 nla_put(msg, NL80211_ATTR_IE, ft_event->ies_len, ft_event->ies)) in cfg80211_ft_event()
20012 if (ft_event->ric_ies && in cfg80211_ft_event()
20013 nla_put(msg, NL80211_ATTR_IE_RIC, ft_event->ric_ies_len, in cfg80211_ft_event()
20014 ft_event->ric_ies)) in cfg80211_ft_event()
20019 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in cfg80211_ft_event()
20034 rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_crit_proto_stopped()
20035 if (!rdev->crit_proto_nlportid) in cfg80211_crit_proto_stopped()
20038 nlportid = rdev->crit_proto_nlportid; in cfg80211_crit_proto_stopped()
20039 rdev->crit_proto_nlportid = 0; in cfg80211_crit_proto_stopped()
20049 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in cfg80211_crit_proto_stopped()
20056 genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid); in cfg80211_crit_proto_stopped()
20066 struct wiphy *wiphy = wdev->wiphy; in nl80211_send_ap_stopped()
20079 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in nl80211_send_ap_stopped()
20080 nla_put_u32(msg, NL80211_ATTR_IFINDEX, wdev->netdev->ifindex) || in nl80211_send_ap_stopped()
20083 (wdev->valid_links && in nl80211_send_ap_stopped()
20100 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_external_auth_request()
20101 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_external_auth_request()
20105 if (!wdev->conn_owner_nlportid) in cfg80211_external_auth_request()
20106 return -EINVAL; in cfg80211_external_auth_request()
20110 return -ENOMEM; in cfg80211_external_auth_request()
20116 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in cfg80211_external_auth_request()
20117 nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || in cfg80211_external_auth_request()
20118 nla_put_u32(msg, NL80211_ATTR_AKM_SUITES, params->key_mgmt_suite) || in cfg80211_external_auth_request()
20120 params->action) || in cfg80211_external_auth_request()
20121 nla_put(msg, NL80211_ATTR_BSSID, ETH_ALEN, params->bssid) || in cfg80211_external_auth_request()
20122 nla_put(msg, NL80211_ATTR_SSID, params->ssid.ssid_len, in cfg80211_external_auth_request()
20123 params->ssid.ssid) || in cfg80211_external_auth_request()
20124 (!is_zero_ether_addr(params->mld_addr) && in cfg80211_external_auth_request()
20125 nla_put(msg, NL80211_ATTR_MLD_ADDR, ETH_ALEN, params->mld_addr))) in cfg80211_external_auth_request()
20129 genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, in cfg80211_external_auth_request()
20130 wdev->conn_owner_nlportid); in cfg80211_external_auth_request()
20135 return -ENOBUFS; in cfg80211_external_auth_request()
20143 struct wiphy *wiphy = netdev->ieee80211_ptr->wiphy; in cfg80211_update_owe_info_event()
20158 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || in cfg80211_update_owe_info_event()
20159 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || in cfg80211_update_owe_info_event()
20160 nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, owe_info->peer)) in cfg80211_update_owe_info_event()
20163 if (!owe_info->ie_len || in cfg80211_update_owe_info_event()
20164 nla_put(msg, NL80211_ATTR_IE, owe_info->ie_len, owe_info->ie)) in cfg80211_update_owe_info_event()
20167 if (owe_info->assoc_link_id != -1) { in cfg80211_update_owe_info_event()
20169 owe_info->assoc_link_id)) in cfg80211_update_owe_info_event()
20172 if (!is_zero_ether_addr(owe_info->peer_mld_addr) && in cfg80211_update_owe_info_event()
20174 owe_info->peer_mld_addr)) in cfg80211_update_owe_info_event()
20180 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, in cfg80211_update_owe_info_event()