Loading include/linux/nl80211.h +3 −0 Original line number Diff line number Diff line Loading @@ -387,6 +387,8 @@ * of any other interfaces, and other interfaces will again take * precedence when they are used. * * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface. * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */ Loading Loading @@ -489,6 +491,7 @@ enum nl80211_commands { NL80211_CMD_NOTIFY_CQM, NL80211_CMD_SET_CHANNEL, NL80211_CMD_SET_WDS_PEER, /* add new commands above here */ Loading net/wireless/nl80211.c +54 −0 Original line number Diff line number Diff line Loading @@ -603,6 +603,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, NLA_PUT_U32(msg, i, NL80211_CMD_SET_WIPHY_NETNS); } CMD(set_channel, SET_CHANNEL); CMD(set_wds_peer, SET_WDS_PEER); #undef CMD Loading Loading @@ -833,6 +834,53 @@ static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info) return result; } static int nl80211_set_wds_peer(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev; struct wireless_dev *wdev; struct net_device *dev; u8 *bssid; int err; if (!info->attrs[NL80211_ATTR_MAC]) return -EINVAL; rtnl_lock(); err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev); if (err) goto unlock_rtnl; wdev = dev->ieee80211_ptr; if (netif_running(dev)) { err = -EBUSY; goto out; } if (!rdev->ops->set_wds_peer) { err = -EOPNOTSUPP; goto out; } if (wdev->iftype != NL80211_IFTYPE_WDS) { err = -EOPNOTSUPP; goto out; } bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); err = rdev->ops->set_wds_peer(wdev->wiphy, dev, bssid); out: cfg80211_unlock_rdev(rdev); dev_put(dev); unlock_rtnl: rtnl_unlock(); return err; } static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev; Loading Loading @@ -5473,6 +5521,12 @@ static struct genl_ops nl80211_ops[] = { .policy = nl80211_policy, .flags = GENL_ADMIN_PERM, }, { .cmd = NL80211_CMD_SET_WDS_PEER, .doit = nl80211_set_wds_peer, .policy = nl80211_policy, .flags = GENL_ADMIN_PERM, }, }; static struct genl_multicast_group nl80211_mlme_mcgrp = { Loading Loading
include/linux/nl80211.h +3 −0 Original line number Diff line number Diff line Loading @@ -387,6 +387,8 @@ * of any other interfaces, and other interfaces will again take * precedence when they are used. * * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface. * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */ Loading Loading @@ -489,6 +491,7 @@ enum nl80211_commands { NL80211_CMD_NOTIFY_CQM, NL80211_CMD_SET_CHANNEL, NL80211_CMD_SET_WDS_PEER, /* add new commands above here */ Loading
net/wireless/nl80211.c +54 −0 Original line number Diff line number Diff line Loading @@ -603,6 +603,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, NLA_PUT_U32(msg, i, NL80211_CMD_SET_WIPHY_NETNS); } CMD(set_channel, SET_CHANNEL); CMD(set_wds_peer, SET_WDS_PEER); #undef CMD Loading Loading @@ -833,6 +834,53 @@ static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info) return result; } static int nl80211_set_wds_peer(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev; struct wireless_dev *wdev; struct net_device *dev; u8 *bssid; int err; if (!info->attrs[NL80211_ATTR_MAC]) return -EINVAL; rtnl_lock(); err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev); if (err) goto unlock_rtnl; wdev = dev->ieee80211_ptr; if (netif_running(dev)) { err = -EBUSY; goto out; } if (!rdev->ops->set_wds_peer) { err = -EOPNOTSUPP; goto out; } if (wdev->iftype != NL80211_IFTYPE_WDS) { err = -EOPNOTSUPP; goto out; } bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); err = rdev->ops->set_wds_peer(wdev->wiphy, dev, bssid); out: cfg80211_unlock_rdev(rdev); dev_put(dev); unlock_rtnl: rtnl_unlock(); return err; } static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev; Loading Loading @@ -5473,6 +5521,12 @@ static struct genl_ops nl80211_ops[] = { .policy = nl80211_policy, .flags = GENL_ADMIN_PERM, }, { .cmd = NL80211_CMD_SET_WDS_PEER, .doit = nl80211_set_wds_peer, .policy = nl80211_policy, .flags = GENL_ADMIN_PERM, }, }; static struct genl_multicast_group nl80211_mlme_mcgrp = { Loading