add support for wds vifs for broadcom wl
[openwrt.git] / package / broadcom-wl / src / wlc / wlc.c
index 99237c0..2d6b846 100644 (file)
@@ -128,7 +128,7 @@ static int ptable_init(void)
        if (ptable[0] == PTABLE_MAGIC)
                return 0;
        
-       glob("/lib/modules/2.4.*/wl.o", 0, NULL, &globbuf);
+       glob("/lib/modules/2.4.*/wl.o.patch", 0, NULL, &globbuf);
        
        if (globbuf.gl_pathv[0] == NULL)
                return -1;
@@ -139,13 +139,8 @@ static int ptable_init(void)
        if (fstat(fd, &statbuf) < 0)
                goto failed;
 
-       if (statbuf.st_size <= 512)
+       if (statbuf.st_size < 512)
                goto failed;
-       
-       if (lseek(fd, statbuf.st_size - 512, SEEK_SET) < 0) {
-               perror("lseek");
-               goto failed;
-       }
 
        if (read(fd, ptable, 512) < 512)
                goto failed;
@@ -649,6 +644,36 @@ static int wlc_wme_ac(wlc_param param, void *data, void *value)
        return ret;
 }
 
+static int wlc_ifname(wlc_param param, void *data, void *value)
+{
+       char *val = (char *) value;
+       int ret = 0;
+       
+       if (param & SET) {
+               if (strlen(val) < 16)
+                       strcpy(interface, val);
+               else ret = -1;
+       }
+       if (param & GET) {
+               strcpy(val, interface);
+       }
+
+       return ret;
+}
+
+static int wlc_wdsmac(wlc_param param, void *data, void *value)
+{
+       static struct ether_addr mac;
+       int ret = 0;
+       
+       ret = wl_ioctl(interface, WLC_WDS_GET_REMOTE_HWADDR, &mac, 6);
+       if (ret == 0) {
+               strcpy((char *) value, ether_ntoa(&mac));
+       }
+
+       return ret;
+}
+
 static const struct wlc_call wlc_calls[] = {
        {
                .name = "version",
@@ -671,6 +696,12 @@ static const struct wlc_call wlc_calls[] = {
                .data.ptr = &fromstdin,
                .desc = "Accept input from stdin"
        },
+       {
+               .name = "ifname",
+               .param = STRING,
+               .handler = wlc_ifname,
+               .desc = "interface to send commands to"
+       },
        {
                .name = "up",
                .param = NOARG,
@@ -747,6 +778,13 @@ static const struct wlc_call wlc_calls[] = {
                .data.num = ((WLC_GET_CHANNEL << 16) | WLC_SET_CHANNEL),
                .desc = "Channel",
        },
+       {
+               .name = "vlan_mode",
+               .param = INT,
+               .handler = wlc_bssiovar,
+               .data.str = "vlan_mode",
+               .desc = "Parse 802.1Q tags",
+       },
        {
                .name = "vif",
                .param = INT,
@@ -954,6 +992,12 @@ static const struct wlc_call wlc_calls[] = {
                .data.str = "wdstimeout",
                .desc = "WDS link detection timeout"
        },
+       {
+               .name = "wdsmac",
+               .param = STRING|NOARG,
+               .handler = wlc_wdsmac,
+               .desc = "MAC of the remote WDS endpoint (only with wds0.* interfaces)"
+       },
        {
                .name = "afterburner",
                .param = INT,
This page took 0.027647 seconds and 4 git commands to generate.