diff options
author | David S. Miller <davem@davemloft.net> | 2018-07-24 22:21:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-07-24 22:21:58 -0400 |
commit | 19725496da5602b401eae389736ab00d1817e264 (patch) | |
tree | 4c1a94bf0121769110f1b9c08ee337a55679a48a /net/wireless/nl80211.c | |
parent | aea5f654e6b78a0c976f7a25950155932c77a53f (diff) | |
parent | 9981b4fb8684883dcc0daf088891ff32260b9794 (diff) |
Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r-- | net/wireless/nl80211.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index e4e5f025d16b..5fb9b7dd9831 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -4466,6 +4466,7 @@ static int parse_station_flags(struct genl_info *info, | |||
4466 | params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHENTICATED) | | 4466 | params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHENTICATED) | |
4467 | BIT(NL80211_STA_FLAG_MFP) | | 4467 | BIT(NL80211_STA_FLAG_MFP) | |
4468 | BIT(NL80211_STA_FLAG_AUTHORIZED); | 4468 | BIT(NL80211_STA_FLAG_AUTHORIZED); |
4469 | break; | ||
4469 | default: | 4470 | default: |
4470 | return -EINVAL; | 4471 | return -EINVAL; |
4471 | } | 4472 | } |
@@ -15029,20 +15030,24 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, | |||
15029 | EXPORT_SYMBOL(cfg80211_mgmt_tx_status); | 15030 | EXPORT_SYMBOL(cfg80211_mgmt_tx_status); |
15030 | 15031 | ||
15031 | static int __nl80211_rx_control_port(struct net_device *dev, | 15032 | static int __nl80211_rx_control_port(struct net_device *dev, |
15032 | const u8 *buf, size_t len, | 15033 | struct sk_buff *skb, |
15033 | const u8 *addr, u16 proto, | ||
15034 | bool unencrypted, gfp_t gfp) | 15034 | bool unencrypted, gfp_t gfp) |
15035 | { | 15035 | { |
15036 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 15036 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
15037 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); | 15037 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
15038 | struct ethhdr *ehdr = eth_hdr(skb); | ||
15039 | const u8 *addr = ehdr->h_source; | ||
15040 | u16 proto = be16_to_cpu(skb->protocol); | ||
15038 | struct sk_buff *msg; | 15041 | struct sk_buff *msg; |
15039 | void *hdr; | 15042 | void *hdr; |
15043 | struct nlattr *frame; | ||
15044 | |||
15040 | u32 nlportid = READ_ONCE(wdev->conn_owner_nlportid); | 15045 | u32 nlportid = READ_ONCE(wdev->conn_owner_nlportid); |
15041 | 15046 | ||
15042 | if (!nlportid) | 15047 | if (!nlportid) |
15043 | return -ENOENT; | 15048 | return -ENOENT; |
15044 | 15049 | ||
15045 | msg = nlmsg_new(100 + len, gfp); | 15050 | msg = nlmsg_new(100 + skb->len, gfp); |
15046 | if (!msg) | 15051 | if (!msg) |
15047 | return -ENOMEM; | 15052 | return -ENOMEM; |
15048 | 15053 | ||
@@ -15056,13 +15061,17 @@ static int __nl80211_rx_control_port(struct net_device *dev, | |||
15056 | nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || | 15061 | nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || |
15057 | nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev), | 15062 | nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev), |
15058 | NL80211_ATTR_PAD) || | 15063 | NL80211_ATTR_PAD) || |
15059 | nla_put(msg, NL80211_ATTR_FRAME, len, buf) || | ||
15060 | nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) || | 15064 | nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) || |
15061 | nla_put_u16(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE, proto) || | 15065 | nla_put_u16(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE, proto) || |
15062 | (unencrypted && nla_put_flag(msg, | 15066 | (unencrypted && nla_put_flag(msg, |
15063 | NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT))) | 15067 | NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT))) |
15064 | goto nla_put_failure; | 15068 | goto nla_put_failure; |
15065 | 15069 | ||
15070 | frame = nla_reserve(msg, NL80211_ATTR_FRAME, skb->len); | ||
15071 | if (!frame) | ||
15072 | goto nla_put_failure; | ||
15073 | |||
15074 | skb_copy_bits(skb, 0, nla_data(frame), skb->len); | ||
15066 | genlmsg_end(msg, hdr); | 15075 | genlmsg_end(msg, hdr); |
15067 | 15076 | ||
15068 | return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid); | 15077 | return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid); |
@@ -15073,14 +15082,12 @@ static int __nl80211_rx_control_port(struct net_device *dev, | |||
15073 | } | 15082 | } |
15074 | 15083 | ||
15075 | bool cfg80211_rx_control_port(struct net_device *dev, | 15084 | bool cfg80211_rx_control_port(struct net_device *dev, |
15076 | const u8 *buf, size_t len, | 15085 | struct sk_buff *skb, bool unencrypted) |
15077 | const u8 *addr, u16 proto, bool unencrypted) | ||
15078 | { | 15086 | { |
15079 | int ret; | 15087 | int ret; |
15080 | 15088 | ||
15081 | trace_cfg80211_rx_control_port(dev, buf, len, addr, proto, unencrypted); | 15089 | trace_cfg80211_rx_control_port(dev, skb, unencrypted); |
15082 | ret = __nl80211_rx_control_port(dev, buf, len, addr, proto, | 15090 | ret = __nl80211_rx_control_port(dev, skb, unencrypted, GFP_ATOMIC); |
15083 | unencrypted, GFP_ATOMIC); | ||
15084 | trace_cfg80211_return_bool(ret == 0); | 15091 | trace_cfg80211_return_bool(ret == 0); |
15085 | return ret == 0; | 15092 | return ret == 0; |
15086 | } | 15093 | } |