Re: [patch 3/5] d80211: fix interface removal

2006-08-23 Thread Jiri Benc
On Wed, 23 Aug 2006 09:20:28 +0200, Johannes Berg wrote:
> On Tue, 2006-08-22 at 10:33 -0700, David Kimdon wrote:
> > +   if (param->u.if_info.type == HOSTAP_IF_WDS) {
> > +   type = IEEE80211_IF_TYPE_WDS;
> > +   } else if (param->u.if_info.type == HOSTAP_IF_VLAN) {
> > +   type = IEEE80211_IF_TYPE_VLAN;
> > +   } else if (param->u.if_info.type == HOSTAP_IF_BSS) {
> > +   type = IEEE80211_IF_TYPE_AP;
> > +   } else if (param->u.if_info.type == HOSTAP_IF_STA) {
> > +   type = IEEE80211_IF_TYPE_STA;
> > +   } else {
> > +return -EINVAL;
> > }
> 
> IMHO that'd look better as a switch(). Or maybe even a small static
> array to map them and just some bounds checking code?

You're right, but I'm taking the patch anyway. It's resembling the code
of ieee80211_ioctl_add_if. Both of these function can be converted to
use switches later by one patch.

Thanks,

 Jiri

-- 
Jiri Benc
SUSE Labs
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch 3/5] d80211: fix interface removal

2006-08-23 Thread Johannes Berg
On Tue, 2006-08-22 at 10:33 -0700, David Kimdon wrote:
> + if (param->u.if_info.type == HOSTAP_IF_WDS) {
> + type = IEEE80211_IF_TYPE_WDS;
> + } else if (param->u.if_info.type == HOSTAP_IF_VLAN) {
> + type = IEEE80211_IF_TYPE_VLAN;
> + } else if (param->u.if_info.type == HOSTAP_IF_BSS) {
> + type = IEEE80211_IF_TYPE_AP;
> + } else if (param->u.if_info.type == HOSTAP_IF_STA) {
> + type = IEEE80211_IF_TYPE_STA;
> + } else {
> +return -EINVAL;
>   }

IMHO that'd look better as a switch(). Or maybe even a small static
array to map them and just some bounds checking code?

Also, spaces instead of tab on the last added line.

johannes
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 3/5] d80211: fix interface removal

2006-08-22 Thread David Kimdon
Calls to ieee80211_if_remove() should use the ieee80211 interface types.
Convert interface type from hostapd to ieee80211 format.

Signed-off-by: David Kimdon <[EMAIL PROTECTED]>

Index: wireless-dev/net/d80211/ieee80211_ioctl.c
===
--- wireless-dev.orig/net/d80211/ieee80211_ioctl.c
+++ wireless-dev/net/d80211/ieee80211_ioctl.c
@@ -1076,14 +1076,21 @@ static int ieee80211_ioctl_add_if(struct
 static int ieee80211_ioctl_remove_if(struct net_device *dev,
 struct prism2_hostapd_param *param)
 {
-   if (param->u.if_info.type != HOSTAP_IF_WDS &&
-   param->u.if_info.type != HOSTAP_IF_VLAN &&
-   param->u.if_info.type != HOSTAP_IF_BSS &&
-   param->u.if_info.type != HOSTAP_IF_STA) {
-return -EINVAL;
+   unsigned int type;
+
+   if (param->u.if_info.type == HOSTAP_IF_WDS) {
+   type = IEEE80211_IF_TYPE_WDS;
+   } else if (param->u.if_info.type == HOSTAP_IF_VLAN) {
+   type = IEEE80211_IF_TYPE_VLAN;
+   } else if (param->u.if_info.type == HOSTAP_IF_BSS) {
+   type = IEEE80211_IF_TYPE_AP;
+   } else if (param->u.if_info.type == HOSTAP_IF_STA) {
+   type = IEEE80211_IF_TYPE_STA;
+   } else {
+return -EINVAL;
}
-   return ieee80211_if_remove(dev, param->u.if_info.name,
-  param->u.if_info.type);
+
+   return ieee80211_if_remove(dev, param->u.if_info.name, type);
 }
 
 

--
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html