implement wlc call to read wds endpoint mac
authorFelix Fietkau <nbd@openwrt.org>
Sun, 15 Oct 2006 16:56:09 +0000 (16:56 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 15 Oct 2006 16:56:09 +0000 (16:56 +0000)
SVN-Revision: 5121

package/broadcom-wl/src/wlc/wlc.c

index 09cbb845384e5e91e1c20802b20a5ca21ce4d386..2d6b846a0935075395fec98df5beb2f30482b4a0 100644 (file)
@@ -644,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",
@@ -666,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,
@@ -956,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,