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.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 62bdb1adaa4d..ba4f1723c83a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1226,6 +1226,7 @@ struct nl80211_dump_wiphy_state {
1226}; 1226};
1227 1227
1228static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, 1228static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
1229 enum nl80211_commands cmd,
1229 struct sk_buff *msg, u32 portid, u32 seq, 1230 struct sk_buff *msg, u32 portid, u32 seq,
1230 int flags, struct nl80211_dump_wiphy_state *state) 1231 int flags, struct nl80211_dump_wiphy_state *state)
1231{ 1232{
@@ -1240,7 +1241,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
1240 rdev->wiphy.mgmt_stypes; 1241 rdev->wiphy.mgmt_stypes;
1241 u32 features; 1242 u32 features;
1242 1243
1243 hdr = nl80211hdr_put(msg, portid, seq, flags, NL80211_CMD_NEW_WIPHY); 1244 hdr = nl80211hdr_put(msg, portid, seq, flags, cmd);
1244 if (!hdr) 1245 if (!hdr)
1245 return -ENOBUFS; 1246 return -ENOBUFS;
1246 1247
@@ -1254,6 +1255,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
1254 cfg80211_rdev_list_generation)) 1255 cfg80211_rdev_list_generation))
1255 goto nla_put_failure; 1256 goto nla_put_failure;
1256 1257
1258 if (cmd != NL80211_CMD_NEW_WIPHY)
1259 goto finish;
1260
1257 switch (state->split_start) { 1261 switch (state->split_start) {
1258 case 0: 1262 case 0:
1259 if (nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_SHORT, 1263 if (nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_SHORT,
@@ -1682,6 +1686,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
1682 state->split_start = 0; 1686 state->split_start = 0;
1683 break; 1687 break;
1684 } 1688 }
1689 finish:
1685 return genlmsg_end(msg, hdr); 1690 return genlmsg_end(msg, hdr);
1686 1691
1687 nla_put_failure: 1692 nla_put_failure:
@@ -1756,7 +1761,8 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb)
1756 continue; 1761 continue;
1757 /* attempt to fit multiple wiphy data chunks into the skb */ 1762 /* attempt to fit multiple wiphy data chunks into the skb */
1758 do { 1763 do {
1759 ret = nl80211_send_wiphy(rdev, skb, 1764 ret = nl80211_send_wiphy(rdev, NL80211_CMD_NEW_WIPHY,
1765 skb,
1760 NETLINK_CB(cb->skb).portid, 1766 NETLINK_CB(cb->skb).portid,
1761 cb->nlh->nlmsg_seq, 1767 cb->nlh->nlmsg_seq,
1762 NLM_F_MULTI, state); 1768 NLM_F_MULTI, state);
@@ -1811,7 +1817,8 @@ static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info)
1811 if (!msg) 1817 if (!msg)
1812 return -ENOMEM; 1818 return -ENOMEM;
1813 1819
1814 if (nl80211_send_wiphy(rdev, msg, info->snd_portid, info->snd_seq, 0, 1820 if (nl80211_send_wiphy(rdev, NL80211_CMD_NEW_WIPHY, msg,
1821 info->snd_portid, info->snd_seq, 0,
1815 &state) < 0) { 1822 &state) < 0) {
1816 nlmsg_free(msg); 1823 nlmsg_free(msg);
1817 return -ENOBUFS; 1824 return -ENOBUFS;
@@ -10101,16 +10108,20 @@ static const struct genl_ops nl80211_ops[] = {
10101 10108
10102/* notification functions */ 10109/* notification functions */
10103 10110
10104void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev) 10111void nl80211_notify_wiphy(struct cfg80211_registered_device *rdev,
10112 enum nl80211_commands cmd)
10105{ 10113{
10106 struct sk_buff *msg; 10114 struct sk_buff *msg;
10107 struct nl80211_dump_wiphy_state state = {}; 10115 struct nl80211_dump_wiphy_state state = {};
10108 10116
10117 WARN_ON(cmd != NL80211_CMD_NEW_WIPHY &&
10118 cmd != NL80211_CMD_DEL_WIPHY);
10119
10109 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); 10120 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
10110 if (!msg) 10121 if (!msg)
10111 return; 10122 return;
10112 10123
10113 if (nl80211_send_wiphy(rdev, msg, 0, 0, 0, &state) < 0) { 10124 if (nl80211_send_wiphy(rdev, cmd, msg, 0, 0, 0, &state) < 0) {
10114 nlmsg_free(msg); 10125 nlmsg_free(msg);
10115 return; 10126 return;
10116 } 10127 }