Message ID | 1370444989-2095-4-git-send-email-ordex@autistici.org (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On Wed, 2013-06-05 at 17:09 +0200, Antonio Quartulli wrote: > From: Antonio Quartulli <antonio@open-mesh.com> > > Users may want to send a frame on the current channel > without specifying it. > > This is particularly useful for the correct implementation > of the IBSS/RSN support in wpa_supplicant which requires to > receive and send AUTH frames. > > Make mgmt_tx pass a NULL channel to the driver if none has > been specified by the user. > > Signed-off-by: Antonio Quartulli <antonio@open-mesh.com> > --- > > v3: > - moved from 1/4 to 4/4 > > > net/wireless/nl80211.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c > index 88e820b..06af395 100644 > --- a/net/wireless/nl80211.c > +++ b/net/wireless/nl80211.c > @@ -7139,6 +7139,9 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) > return -EOPNOTSUPP; > > switch (wdev->iftype) { > + case NL80211_IFTYPE_P2P_DEVICE: > + if (!info->attrs[NL80211_ATTR_WIPHY_FREQ]) > + return -EINVAL; > case NL80211_IFTYPE_STATION: > case NL80211_IFTYPE_ADHOC: > case NL80211_IFTYPE_P2P_CLIENT: > @@ -7146,7 +7149,6 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) > case NL80211_IFTYPE_AP_VLAN: > case NL80211_IFTYPE_MESH_POINT: > case NL80211_IFTYPE_P2P_GO: > - case NL80211_IFTYPE_P2P_DEVICE: > break; > default: > return -EOPNOTSUPP; > @@ -7174,9 +7176,15 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) > > no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); > > - err = nl80211_parse_chandef(rdev, info, &chandef); > - if (err) > - return err; > + /* get the channel if any has been specified, otherwise pass NULL to > + * the driver. The latter will use the current one > + */ > + chandef.chan = NULL; > + if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { > + err = nl80211_parse_chandef(rdev, info, &chandef); > + if (err) > + return err; > + } I think not specifying a channel but setting NL80211_ATTR_OFFCHANNEL_TX_OK must be an error. johannes -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Jun 11, 2013 at 01:53:18PM +0200, Johannes Berg wrote: > > + /* get the channel if any has been specified, otherwise pass NULL to > > + * the driver. The latter will use the current one > > + */ > > + chandef.chan = NULL; > > + if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { > > + err = nl80211_parse_chandef(rdev, info, &chandef); > > + if (err) > > + return err; > > + } > > I think not specifying a channel but setting > NL80211_ATTR_OFFCHANNEL_TX_OK must be an error. You are right. Indeed this check is done in mac80211. Other drivers do not use NL80211_ATTR_OFFCHANNEL_TX_OK at all. But for consistency I guess it would be correct to do the check here too. I'll send a new version including this change. Cheers,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 88e820b..06af395 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -7139,6 +7139,9 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) return -EOPNOTSUPP; switch (wdev->iftype) { + case NL80211_IFTYPE_P2P_DEVICE: + if (!info->attrs[NL80211_ATTR_WIPHY_FREQ]) + return -EINVAL; case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_P2P_CLIENT: @@ -7146,7 +7149,6 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) case NL80211_IFTYPE_AP_VLAN: case NL80211_IFTYPE_MESH_POINT: case NL80211_IFTYPE_P2P_GO: - case NL80211_IFTYPE_P2P_DEVICE: break; default: return -EOPNOTSUPP; @@ -7174,9 +7176,15 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); - err = nl80211_parse_chandef(rdev, info, &chandef); - if (err) - return err; + /* get the channel if any has been specified, otherwise pass NULL to + * the driver. The latter will use the current one + */ + chandef.chan = NULL; + if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { + err = nl80211_parse_chandef(rdev, info, &chandef); + if (err) + return err; + } if (!dont_wait_for_ack) { msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);