libiwinfo: properly detect wep and unencrypted wifi iface state on madwifi
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 7 Nov 2011 05:38:09 +0000 (05:38 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 7 Nov 2011 05:38:09 +0000 (05:38 +0000)
contrib/package/iwinfo/src/iwinfo_madwifi.c

index 54a77cd4dc5643dac0950bd24decb969aedaab46..be899789991c1b6f04b5fb1db4e794328b6b2d2b 100644 (file)
@@ -641,6 +641,9 @@ int madwifi_get_encryption(const char *ifname, char *buf)
                                        c->pair_ciphers |= IWINFO_CIPHER_WEP40;
                                        break;
 
+                               case 0:
+                                       break;
+
                                default:
                                        c->pair_ciphers = IWINFO_CIPHER_WEP40 |
                                                IWINFO_CIPHER_WEP104;
@@ -699,7 +702,7 @@ int madwifi_get_encryption(const char *ifname, char *buf)
                }
        }
 
-       c->enabled = (c->wpa_version || c->auth_algs) ? 1 : 0;
+       c->enabled = (c->wpa_version || (c->auth_algs && c->pair_ciphers)) ? 1 : 0;
 
        return 0;
 }