aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r--net/wireless/nl80211.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 31d265f36d2c..7ee9af3283a8 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -908,7 +908,7 @@ nla_put_failure:
908static int nl80211_send_wowlan_tcp_caps(struct cfg80211_registered_device *rdev, 908static int nl80211_send_wowlan_tcp_caps(struct cfg80211_registered_device *rdev,
909 struct sk_buff *msg) 909 struct sk_buff *msg)
910{ 910{
911 const struct wiphy_wowlan_tcp_support *tcp = rdev->wiphy.wowlan.tcp; 911 const struct wiphy_wowlan_tcp_support *tcp = rdev->wiphy.wowlan->tcp;
912 struct nlattr *nl_tcp; 912 struct nlattr *nl_tcp;
913 913
914 if (!tcp) 914 if (!tcp)
@@ -951,37 +951,37 @@ static int nl80211_send_wowlan(struct sk_buff *msg,
951{ 951{
952 struct nlattr *nl_wowlan; 952 struct nlattr *nl_wowlan;
953 953
954 if (!dev->wiphy.wowlan.flags && !dev->wiphy.wowlan.n_patterns) 954 if (!dev->wiphy.wowlan)
955 return 0; 955 return 0;
956 956
957 nl_wowlan = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED); 957 nl_wowlan = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED);
958 if (!nl_wowlan) 958 if (!nl_wowlan)
959 return -ENOBUFS; 959 return -ENOBUFS;
960 960
961 if (((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_ANY) && 961 if (((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_ANY) &&
962 nla_put_flag(msg, NL80211_WOWLAN_TRIG_ANY)) || 962 nla_put_flag(msg, NL80211_WOWLAN_TRIG_ANY)) ||
963 ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_DISCONNECT) && 963 ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_DISCONNECT) &&
964 nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT)) || 964 nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT)) ||
965 ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_MAGIC_PKT) && 965 ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_MAGIC_PKT) &&
966 nla_put_flag(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT)) || 966 nla_put_flag(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT)) ||
967 ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY) && 967 ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY) &&
968 nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED)) || 968 nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED)) ||
969 ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) && 969 ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) &&
970 nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE)) || 970 nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE)) ||
971 ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_EAP_IDENTITY_REQ) && 971 ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_EAP_IDENTITY_REQ) &&
972 nla_put_flag(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST)) || 972 nla_put_flag(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST)) ||
973 ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_4WAY_HANDSHAKE) && 973 ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_4WAY_HANDSHAKE) &&
974 nla_put_flag(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE)) || 974 nla_put_flag(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE)) ||
975 ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_RFKILL_RELEASE) && 975 ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_RFKILL_RELEASE) &&
976 nla_put_flag(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE))) 976 nla_put_flag(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE)))
977 return -ENOBUFS; 977 return -ENOBUFS;
978 978
979 if (dev->wiphy.wowlan.n_patterns) { 979 if (dev->wiphy.wowlan->n_patterns) {
980 struct nl80211_wowlan_pattern_support pat = { 980 struct nl80211_wowlan_pattern_support pat = {
981 .max_patterns = dev->wiphy.wowlan.n_patterns, 981 .max_patterns = dev->wiphy.wowlan->n_patterns,
982 .min_pattern_len = dev->wiphy.wowlan.pattern_min_len, 982 .min_pattern_len = dev->wiphy.wowlan->pattern_min_len,
983 .max_pattern_len = dev->wiphy.wowlan.pattern_max_len, 983 .max_pattern_len = dev->wiphy.wowlan->pattern_max_len,
984 .max_pkt_offset = dev->wiphy.wowlan.max_pkt_offset, 984 .max_pkt_offset = dev->wiphy.wowlan->max_pkt_offset,
985 }; 985 };
986 986
987 if (nla_put(msg, NL80211_WOWLAN_TRIG_PKT_PATTERN, 987 if (nla_put(msg, NL80211_WOWLAN_TRIG_PKT_PATTERN,
@@ -7580,8 +7580,7 @@ static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info)
7580 void *hdr; 7580 void *hdr;
7581 u32 size = NLMSG_DEFAULT_SIZE; 7581 u32 size = NLMSG_DEFAULT_SIZE;
7582 7582
7583 if (!rdev->wiphy.wowlan.flags && !rdev->wiphy.wowlan.n_patterns && 7583 if (!rdev->wiphy.wowlan)
7584 !rdev->wiphy.wowlan.tcp)
7585 return -EOPNOTSUPP; 7584 return -EOPNOTSUPP;
7586 7585
7587 if (rdev->wiphy.wowlan_config && rdev->wiphy.wowlan_config->tcp) { 7586 if (rdev->wiphy.wowlan_config && rdev->wiphy.wowlan_config->tcp) {
@@ -7654,7 +7653,7 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev,
7654 u32 data_size, wake_size, tokens_size = 0, wake_mask_size; 7653 u32 data_size, wake_size, tokens_size = 0, wake_mask_size;
7655 int err, port; 7654 int err, port;
7656 7655
7657 if (!rdev->wiphy.wowlan.tcp) 7656 if (!rdev->wiphy.wowlan->tcp)
7658 return -EINVAL; 7657 return -EINVAL;
7659 7658
7660 err = nla_parse(tb, MAX_NL80211_WOWLAN_TCP, 7659 err = nla_parse(tb, MAX_NL80211_WOWLAN_TCP,
@@ -7674,16 +7673,16 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev,
7674 return -EINVAL; 7673 return -EINVAL;
7675 7674
7676 data_size = nla_len(tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD]); 7675 data_size = nla_len(tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD]);
7677 if (data_size > rdev->wiphy.wowlan.tcp->data_payload_max) 7676 if (data_size > rdev->wiphy.wowlan->tcp->data_payload_max)
7678 return -EINVAL; 7677 return -EINVAL;
7679 7678
7680 if (nla_get_u32(tb[NL80211_WOWLAN_TCP_DATA_INTERVAL]) > 7679 if (nla_get_u32(tb[NL80211_WOWLAN_TCP_DATA_INTERVAL]) >
7681 rdev->wiphy.wowlan.tcp->data_interval_max || 7680 rdev->wiphy.wowlan->tcp->data_interval_max ||
7682 nla_get_u32(tb[NL80211_WOWLAN_TCP_DATA_INTERVAL]) == 0) 7681 nla_get_u32(tb[NL80211_WOWLAN_TCP_DATA_INTERVAL]) == 0)
7683 return -EINVAL; 7682 return -EINVAL;
7684 7683
7685 wake_size = nla_len(tb[NL80211_WOWLAN_TCP_WAKE_PAYLOAD]); 7684 wake_size = nla_len(tb[NL80211_WOWLAN_TCP_WAKE_PAYLOAD]);
7686 if (wake_size > rdev->wiphy.wowlan.tcp->wake_payload_max) 7685 if (wake_size > rdev->wiphy.wowlan->tcp->wake_payload_max)
7687 return -EINVAL; 7686 return -EINVAL;
7688 7687
7689 wake_mask_size = nla_len(tb[NL80211_WOWLAN_TCP_WAKE_MASK]); 7688 wake_mask_size = nla_len(tb[NL80211_WOWLAN_TCP_WAKE_MASK]);
@@ -7698,13 +7697,13 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev,
7698 7697
7699 if (!tok->len || tokens_size % tok->len) 7698 if (!tok->len || tokens_size % tok->len)
7700 return -EINVAL; 7699 return -EINVAL;
7701 if (!rdev->wiphy.wowlan.tcp->tok) 7700 if (!rdev->wiphy.wowlan->tcp->tok)
7702 return -EINVAL; 7701 return -EINVAL;
7703 if (tok->len > rdev->wiphy.wowlan.tcp->tok->max_len) 7702 if (tok->len > rdev->wiphy.wowlan->tcp->tok->max_len)
7704 return -EINVAL; 7703 return -EINVAL;
7705 if (tok->len < rdev->wiphy.wowlan.tcp->tok->min_len) 7704 if (tok->len < rdev->wiphy.wowlan->tcp->tok->min_len)
7706 return -EINVAL; 7705 return -EINVAL;
7707 if (tokens_size > rdev->wiphy.wowlan.tcp->tok->bufsize) 7706 if (tokens_size > rdev->wiphy.wowlan->tcp->tok->bufsize)
7708 return -EINVAL; 7707 return -EINVAL;
7709 if (tok->offset + tok->len > data_size) 7708 if (tok->offset + tok->len > data_size)
7710 return -EINVAL; 7709 return -EINVAL;
@@ -7712,7 +7711,7 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev,
7712 7711
7713 if (tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ]) { 7712 if (tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ]) {
7714 seq = nla_data(tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ]); 7713 seq = nla_data(tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ]);
7715 if (!rdev->wiphy.wowlan.tcp->seq) 7714 if (!rdev->wiphy.wowlan->tcp->seq)
7716 return -EINVAL; 7715 return -EINVAL;
7717 if (seq->len == 0 || seq->len > 4) 7716 if (seq->len == 0 || seq->len > 4)
7718 return -EINVAL; 7717 return -EINVAL;
@@ -7793,12 +7792,11 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
7793 struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG]; 7792 struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG];
7794 struct cfg80211_wowlan new_triggers = {}; 7793 struct cfg80211_wowlan new_triggers = {};
7795 struct cfg80211_wowlan *ntrig; 7794 struct cfg80211_wowlan *ntrig;
7796 struct wiphy_wowlan_support *wowlan = &rdev->wiphy.wowlan; 7795 const struct wiphy_wowlan_support *wowlan = rdev->wiphy.wowlan;
7797 int err, i; 7796 int err, i;
7798 bool prev_enabled = rdev->wiphy.wowlan_config; 7797 bool prev_enabled = rdev->wiphy.wowlan_config;
7799 7798
7800 if (!rdev->wiphy.wowlan.flags && !rdev->wiphy.wowlan.n_patterns && 7799 if (!wowlan)
7801 !rdev->wiphy.wowlan.tcp)
7802 return -EOPNOTSUPP; 7800 return -EOPNOTSUPP;
7803 7801
7804 if (!info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) { 7802 if (!info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) {