nl80211: Add SOCKET_OWNER support to JOIN_MESH
Signed-off-by: Denis Kenzior <denkenz@gmail.com> [johannes: fix race with wdev lock/unlock by just acquiring once] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
f8d16d3edb
commit
188c1b3c04
|
@ -1964,6 +1964,8 @@ enum nl80211_commands {
|
||||||
* station will deauthenticate when the socket is closed.
|
* station will deauthenticate when the socket is closed.
|
||||||
* If set during %NL80211_CMD_JOIN_IBSS the IBSS will be automatically
|
* If set during %NL80211_CMD_JOIN_IBSS the IBSS will be automatically
|
||||||
* torn down when the socket is closed.
|
* torn down when the socket is closed.
|
||||||
|
* If set during %NL80211_CMD_JOIN_MESH the mesh setup will be
|
||||||
|
* automatically torn down when the socket is closed.
|
||||||
*
|
*
|
||||||
* @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
|
* @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
|
||||||
* the TDLS link initiator.
|
* the TDLS link initiator.
|
||||||
|
|
|
@ -303,10 +303,6 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
struct mesh_setup *setup,
|
struct mesh_setup *setup,
|
||||||
const struct mesh_config *conf);
|
const struct mesh_config *conf);
|
||||||
int cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
|
|
||||||
struct net_device *dev,
|
|
||||||
struct mesh_setup *setup,
|
|
||||||
const struct mesh_config *conf);
|
|
||||||
int __cfg80211_leave_mesh(struct cfg80211_registered_device *rdev,
|
int __cfg80211_leave_mesh(struct cfg80211_registered_device *rdev,
|
||||||
struct net_device *dev);
|
struct net_device *dev);
|
||||||
int cfg80211_leave_mesh(struct cfg80211_registered_device *rdev,
|
int cfg80211_leave_mesh(struct cfg80211_registered_device *rdev,
|
||||||
|
|
|
@ -217,21 +217,6 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
|
|
||||||
struct net_device *dev,
|
|
||||||
struct mesh_setup *setup,
|
|
||||||
const struct mesh_config *conf)
|
|
||||||
{
|
|
||||||
struct wireless_dev *wdev = dev->ieee80211_ptr;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
wdev_lock(wdev);
|
|
||||||
err = __cfg80211_join_mesh(rdev, dev, setup, conf);
|
|
||||||
wdev_unlock(wdev);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cfg80211_set_mesh_channel(struct cfg80211_registered_device *rdev,
|
int cfg80211_set_mesh_channel(struct cfg80211_registered_device *rdev,
|
||||||
struct wireless_dev *wdev,
|
struct wireless_dev *wdev,
|
||||||
struct cfg80211_chan_def *chandef)
|
struct cfg80211_chan_def *chandef)
|
||||||
|
@ -286,6 +271,7 @@ int __cfg80211_leave_mesh(struct cfg80211_registered_device *rdev,
|
||||||
|
|
||||||
err = rdev_leave_mesh(rdev, dev);
|
err = rdev_leave_mesh(rdev, dev);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
|
wdev->conn_owner_nlportid = 0;
|
||||||
wdev->mesh_id_len = 0;
|
wdev->mesh_id_len = 0;
|
||||||
wdev->beacon_interval = 0;
|
wdev->beacon_interval = 0;
|
||||||
memset(&wdev->chandef, 0, sizeof(wdev->chandef));
|
memset(&wdev->chandef, 0, sizeof(wdev->chandef));
|
||||||
|
|
|
@ -10092,7 +10092,7 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
} else {
|
} else {
|
||||||
/* cfg80211_join_mesh() will sort it out */
|
/* __cfg80211_join_mesh() will sort it out */
|
||||||
setup.chandef.chan = NULL;
|
setup.chandef.chan = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10130,7 +10130,13 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
|
||||||
setup.userspace_handles_dfs =
|
setup.userspace_handles_dfs =
|
||||||
nla_get_flag(info->attrs[NL80211_ATTR_HANDLE_DFS]);
|
nla_get_flag(info->attrs[NL80211_ATTR_HANDLE_DFS]);
|
||||||
|
|
||||||
return cfg80211_join_mesh(rdev, dev, &setup, &cfg);
|
wdev_lock(dev->ieee80211_ptr);
|
||||||
|
err = __cfg80211_join_mesh(rdev, dev, &setup, &cfg);
|
||||||
|
if (!err && info->attrs[NL80211_ATTR_SOCKET_OWNER])
|
||||||
|
dev->ieee80211_ptr->conn_owner_nlportid = info->snd_portid;
|
||||||
|
wdev_unlock(dev->ieee80211_ptr);
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nl80211_leave_mesh(struct sk_buff *skb, struct genl_info *info)
|
static int nl80211_leave_mesh(struct sk_buff *skb, struct genl_info *info)
|
||||||
|
|
Loading…
Reference in New Issue