linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] cfg80211: patches to allow setting the WDS peer
@ 2010-09-30 22:21 Bill Jordan
  2010-09-30 22:29 ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Bill Jordan @ 2010-09-30 22:21 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, Luis R. Rodriguez, Johannes Berg

Added a nl interface to set the peer bssid of a WDS interface.

Signed-off-by: Bill Jordan <bjordan@rajant.com>
---
 include/linux/nl80211.h |    3 ++
 net/wireless/nl80211.c  |   49 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index f0518b0..35a9681 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -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
  */
@@ -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 */

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 9c84825..c401349 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -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

@@ -831,6 +832,48 @@ static int nl80211_set_channel(struct sk_buff
*skb, struct genl_info *info)
 	return result;
 }

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] cfg80211: patches to allow setting the WDS peer
  2010-09-30 22:21 [PATCH 2/3] cfg80211: patches to allow setting the WDS peer Bill Jordan
@ 2010-09-30 22:29 ` Johannes Berg
  2010-10-01  0:25   ` Luis R. Rodriguez
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2010-09-30 22:29 UTC (permalink / raw)
  To: Bill Jordan; +Cc: John W. Linville, linux-wireless, Luis R. Rodriguez

On Thu, 2010-09-30 at 18:21 -0400, Bill Jordan wrote:

>  net/wireless/nl80211.c  |   49 +++++++++++++++++++++++++++++++++++++++++++++++

> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -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
> 
> @@ -831,6 +832,48 @@ static int nl80211_set_channel(struct sk_buff
> *skb, struct genl_info *info)
>  	return result;
>  }
> 

This patch was somehow cut short.

Also, your patches are line-wrapped, which means they cannot be applied.

You can find information on fixing that in
Documentation/email-clients.txt, but gmail web interface simply cannot
work.

Finally, it'd be nice if you could thread your patches into the thread
opened by the 0/N patch. Maybe look at quilt?

johannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] cfg80211: patches to allow setting the WDS peer
  2010-09-30 22:29 ` Johannes Berg
@ 2010-10-01  0:25   ` Luis R. Rodriguez
  0 siblings, 0 replies; 7+ messages in thread
From: Luis R. Rodriguez @ 2010-10-01  0:25 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Bill Jordan, John W. Linville, linux-wireless@vger.kernel.org,
	Luis Rodriguez

On Thu, Sep 30, 2010 at 03:29:15PM -0700, Johannes Berg wrote:
> On Thu, 2010-09-30 at 18:21 -0400, Bill Jordan wrote:
> 
> >  net/wireless/nl80211.c  |   49 +++++++++++++++++++++++++++++++++++++++++++++++
> 
> > --- a/net/wireless/nl80211.c
> > +++ b/net/wireless/nl80211.c
> > @@ -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
> > 
> > @@ -831,6 +832,48 @@ static int nl80211_set_channel(struct sk_buff
> > *skb, struct genl_info *info)
> >  	return result;
> >  }
> > 
> 
> This patch was somehow cut short.
> 
> Also, your patches are line-wrapped, which means they cannot be applied.
> 
> You can find information on fixing that in
> Documentation/email-clients.txt, but gmail web interface simply cannot
> work.

You can use git sende-mail as documented on that link I gave you, Bill.
> 
> Finally, it'd be nice if you could thread your patches into the thread
> opened by the 0/N patch. Maybe look at quilt?

And this is accomplished with --no-chain-reply-to git send-email as
mentioned in the same guide.

  Luis

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/3] cfg80211: patches to allow setting the WDS peer
  2010-10-01 15:20 [PATCH 0/3] patches for WDS interfaces Bill Jordan
@ 2010-10-01 15:20 ` Bill Jordan
  2010-10-01 16:05   ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Bill Jordan @ 2010-10-01 15:20 UTC (permalink / raw)
  To: John W. Linville
  Cc: linux-wireless, Luis R. Rodriguez, Johannes Berg, Bill Jordan

Added a nl interface to set the peer bssid of a WDS interface.

Signed-off-by: Bill Jordan <bjordan@rajant.com>
---
 include/linux/nl80211.h |    3 ++
 net/wireless/nl80211.c  |   49 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index f0518b0..35a9681 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -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
  */
@@ -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 */
 
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 9c84825..c401349 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -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
 
@@ -831,6 +832,48 @@ 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 (!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;
@@ -5462,6 +5505,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 = {
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] cfg80211: patches to allow setting the WDS peer
  2010-10-01 15:20 ` [PATCH 2/3] cfg80211: patches to allow setting the WDS peer Bill Jordan
@ 2010-10-01 16:05   ` Johannes Berg
  2010-10-01 16:06     ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2010-10-01 16:05 UTC (permalink / raw)
  To: Bill Jordan; +Cc: John W. Linville, linux-wireless, Luis R. Rodriguez

On Fri, 2010-10-01 at 11:20 -0400, Bill Jordan wrote:

> +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;

I think this (or maybe the mac80211 bit, but I think here makes more
sense) needs to check !netif_running(), otherwise you can change the
peer without it taking effect, or something like that? Sorry, should've
noted that earlier.

johannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] cfg80211: patches to allow setting the WDS peer
  2010-10-01 16:05   ` Johannes Berg
@ 2010-10-01 16:06     ` Johannes Berg
  2010-10-01 17:45       ` Bill Jordan
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2010-10-01 16:06 UTC (permalink / raw)
  To: Bill Jordan; +Cc: John W. Linville, linux-wireless, Luis R. Rodriguez

On Fri, 2010-10-01 at 18:05 +0200, Johannes Berg wrote:
> On Fri, 2010-10-01 at 11:20 -0400, Bill Jordan wrote:
> 
> > +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;
> 
> I think this (or maybe the mac80211 bit, but I think here makes more
> sense) needs to check !netif_running(), otherwise you can change the
> peer without it taking effect, or something like that? Sorry, should've
> noted that earlier.

cfg80211_wds_wext_siwap does this.

johannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] cfg80211: patches to allow setting the WDS peer
  2010-10-01 16:06     ` Johannes Berg
@ 2010-10-01 17:45       ` Bill Jordan
  0 siblings, 0 replies; 7+ messages in thread
From: Bill Jordan @ 2010-10-01 17:45 UTC (permalink / raw)
  To: Johannes Berg; +Cc: John W. Linville, linux-wireless, Luis R. Rodriguez

On Fri, Oct 1, 2010 at 12:06 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Fri, 2010-10-01 at 18:05 +0200, Johannes Berg wrote:
>> On Fri, 2010-10-01 at 11:20 -0400, Bill Jordan wrote:
>>
>> > +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;
>>
>> I think this (or maybe the mac80211 bit, but I think here makes more
>> sense) needs to check !netif_running(), otherwise you can change the
>> peer without it taking effect, or something like that? Sorry, should've
>> noted that earlier.
>
> cfg80211_wds_wext_siwap does this.
>
> johannes

You are correct. I was able to change the peer while the interface was running.
I've updated the patch to fix this, and I'll resend it.

Bill

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-10-01 17:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-30 22:21 [PATCH 2/3] cfg80211: patches to allow setting the WDS peer Bill Jordan
2010-09-30 22:29 ` Johannes Berg
2010-10-01  0:25   ` Luis R. Rodriguez
  -- strict thread matches above, loose matches on Subject: below --
2010-10-01 15:20 [PATCH 0/3] patches for WDS interfaces Bill Jordan
2010-10-01 15:20 ` [PATCH 2/3] cfg80211: patches to allow setting the WDS peer Bill Jordan
2010-10-01 16:05   ` Johannes Berg
2010-10-01 16:06     ` Johannes Berg
2010-10-01 17:45       ` Bill Jordan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).