add repeater mode for IWMODE
authorFelix Fietkau <nbd@openwrt.org>
Fri, 8 Apr 2005 17:15:40 +0000 (17:15 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 8 Apr 2005 17:15:40 +0000 (17:15 +0000)
SVN-Revision: 587

openwrt/package/openwrt/wlcompat.c

index ebed8c365419d797fc8572ef8fb620cf02c0e079..53cedd8ba1a4ff905fd031699742489af3365c21 100644 (file)
@@ -203,37 +203,39 @@ static int wlcompat_ioctl(struct net_device *dev,
                }
                case SIOCSIWMODE:
                {
-                       int ap = -1, infra = -1, passive = -1;
+                       int ap = -1, infra = -1, passive = 0, wet = 0;
                        
                        switch (wrqu->mode) {
                                case IW_MODE_MONITOR:
                                        passive = 1;
                                        break;
                                case IW_MODE_ADHOC:
-                                       passive = 0;
                                        infra = 0;
                                        ap = 0;
                                        break;
                                case IW_MODE_MASTER:
-                                       passive = 0;
                                        infra = 1;
                                        ap = 1;
                                        break;
                                case IW_MODE_INFRA:
-                                       passive = 0;
                                        infra = 1;
                                        ap = 0;
                                        break;
+                               case IW_MODE_REPEAT:
+                                       infra = 1;
+                                       ap = 0;
+                                       wet = 1;
+                                       break;
                                default:
                                        return -EINVAL;
                        }
                        
-                       if (passive >= 0) {
-                               if (wl_ioctl(dev, WLC_SET_PASSIVE, &passive, sizeof(passive)) < 0)
-                                       return -EINVAL;
-                               if (wl_ioctl(dev, WLC_SET_MONITOR, &passive, sizeof(passive)) < 0)
-                                       return -EINVAL;
-                       }
+                       if (wl_ioctl(dev, WLC_SET_PASSIVE, &passive, sizeof(passive)) < 0)
+                               return -EINVAL;
+                       if (wl_ioctl(dev, WLC_SET_MONITOR, &passive, sizeof(passive)) < 0)
+                               return -EINVAL;
+                       if (wl_ioctl(dev, WLC_SET_WET, &wet, sizeof(wet)) < 0)
+                               return -EINVAL;
                        if (ap >= 0)
                                if (wl_ioctl(dev, WLC_SET_AP, &ap, sizeof(ap)) < 0)
                                        return -EINVAL;
@@ -246,16 +248,16 @@ static int wlcompat_ioctl(struct net_device *dev,
                }
                case SIOCGIWMODE:
                {
-                       int ap, infra, passive;
+                       int ap, infra, wet, passive;
 
                        if (wl_ioctl(dev, WLC_GET_AP, &ap, sizeof(ap)) < 0)
                                return -EINVAL;
-
                        if (wl_ioctl(dev, WLC_GET_INFRA, &infra, sizeof(infra)) < 0)
                                return -EINVAL;
-
                        if (wl_ioctl(dev, WLC_GET_PASSIVE, &passive, sizeof(passive)) < 0)
                                return -EINVAL;
+                       if (wl_ioctl(dev, WLC_GET_WET, &wet, sizeof(wet)) < 0)
+                               return -EINVAL;
 
                        if (passive) {
                                wrqu->mode = IW_MODE_MONITOR;
@@ -265,7 +267,11 @@ static int wlcompat_ioctl(struct net_device *dev,
                                if (ap) {
                                        wrqu->mode = IW_MODE_MASTER;
                                } else {
-                                       wrqu->mode = IW_MODE_INFRA;
+                                       if (wet) {
+                                               wrqu->mode = IW_MODE_REPEAT;
+                                       } else {
+                                               wrqu->mode = IW_MODE_INFRA;
+                                       }
                                }
                        }
                        break;