fix wificonf segfault when maclist is enabled
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Fri, 17 Jun 2005 08:54:36 +0000 (08:54 +0000)
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Fri, 17 Jun 2005 08:54:36 +0000 (08:54 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@1270 3c298f89-4303-0410-b956-a3cf2f4a3e73

openwrt/package/wificonf/wificonf.c

index f96ef15..44ca8a4 100644 (file)
@@ -92,12 +92,12 @@ char *wl_var(char *name)
 
 int nvram_enabled(char *name)
 {
 
 int nvram_enabled(char *name)
 {
-       return (nvram_match(name, "1") || nvram_match(name, "on") || nvram_match(name, "enabled") ? 1 : 0);
+       return (nvram_match(name, "1") || nvram_match(name, "on") || nvram_match(name, "enabled") || nvram_match(name, "true") || nvram_match(name, "yes") ? 1 : 0);
 }
 
 int nvram_disabled(char *name)
 {
 }
 
 int nvram_disabled(char *name)
 {
-       return (nvram_match(name, "0") || nvram_match(name, "off") || nvram_match(name, "disabled") ? 1 : 0);
+       return (nvram_match(name, "0") || nvram_match(name, "off") || nvram_match(name, "disabled") || nvram_match(name, "false") || nvram_match(name, "no") ? 1 : 0);
 }
 
 
 }
 
 
@@ -195,6 +195,7 @@ void setup_bcom(int skfd, char *ifname)
 
        val = nvram_enabled(wl_var("ap_isolate"));
        bcom_set_int(skfd, ifname, "ap_isolate", val);
 
        val = nvram_enabled(wl_var("ap_isolate"));
        bcom_set_int(skfd, ifname, "ap_isolate", val);
+
        val = nvram_enabled(wl_var("frameburst"));
        bcom_ioctl(skfd, ifname, WLC_SET_FAKEFRAG, &val, sizeof(val));
 
        val = nvram_enabled(wl_var("frameburst"));
        bcom_ioctl(skfd, ifname, WLC_SET_FAKEFRAG, &val, sizeof(val));
 
@@ -215,13 +216,15 @@ void setup_bcom(int skfd, char *ifname)
                memset(buf, 0, 8192);
                mac_list = (struct maclist *) buf;
                addr = mac_list->ea;
                memset(buf, 0, 8192);
                mac_list = (struct maclist *) buf;
                addr = mac_list->ea;
-
+               
+               v = malloc(80);
                foreach(v, nvram_safe_get(wl_var("maclist")), next) {
                        if (ether_atoe(v, addr->ether_addr_octet)) {
                                mac_list->count++;
                                addr++;
                        }
                }
                foreach(v, nvram_safe_get(wl_var("maclist")), next) {
                        if (ether_atoe(v, addr->ether_addr_octet)) {
                                mac_list->count++;
                                addr++;
                        }
                }
+               free(v);
                bcom_ioctl(skfd, ifname, WLC_SET_MACLIST, buf, sizeof(buf));
        } else {
                val = WLC_MACMODE_DISABLED;
                bcom_ioctl(skfd, ifname, WLC_SET_MACLIST, buf, sizeof(buf));
        } else {
                val = WLC_MACMODE_DISABLED;
@@ -385,7 +388,6 @@ static int setup_interfaces(int skfd, char *ifname, char *args[], int count)
 int main(int argc, char **argv)
 {
        int skfd;
 int main(int argc, char **argv)
 {
        int skfd;
-
        if((skfd = iw_sockets_open()) < 0) {
                perror("socket");
                exit(-1);
        if((skfd = iw_sockets_open()) < 0) {
                perror("socket");
                exit(-1);
This page took 0.028976 seconds and 4 git commands to generate.