patch wlc and scripts to control wl's builtin wpa supplicant
authorMike Baker <mbm@openwrt.org>
Wed, 4 Jul 2007 16:49:08 +0000 (16:49 +0000)
committerMike Baker <mbm@openwrt.org>
Wed, 4 Jul 2007 16:49:08 +0000 (16:49 +0000)
SVN-Revision: 7875

package/broadcom-wl/files/lib/wifi/broadcom.sh
package/broadcom-wl/src/wlc/wlc.c

index 4f11a515916bef955376f61b36c94073a66440d0..c6444d67253cc5b083cef2d8b1cf1ea2b188308b 100644 (file)
@@ -201,7 +201,15 @@ enable_broadcom() {
                [ -z "$nasopts" ] || {
                        eval "${vif}_ssid=\"\$ssid\""
                        mode="-A"
-                       [ "$vif" = "$sta_if" ] && mode="-S"
+                       [ "$ap" = "0" ] && {
+                               mode="-S"
+                               [ -z "$bridge" ] || {
+                                       append vif_pre_up "supplicant 1" "$N"
+                                       append vif_pre_up "passphrase $key" "$N"
+                                       
+                                       nas=""
+                               }
+                       }
                        [ -z "$nas" ] || nas_cmd="${nas_cmd:+$nas_cmd$N}$nas -P /var/run/nas.$ifname.pid -H 34954 ${bridge:+ -l $bridge} -i $ifname $mode -m $auth -w $wsec -s \"\$${vif}_ssid\" -g 3600 $nasopts &"
                }
                _c=$(($_c + 1))
index 382e83a7b7643cc48f4f2cfa580b1cede2283f91..f5db9a76380b57785a4eef36b2a814cff7ab5acf 100644 (file)
@@ -679,6 +679,29 @@ static int wlc_wdsmac(wlc_param param, void *data, void *value)
        return ret;
 }
 
+static int wlc_pmk(wlc_param param, void *data, void *value)
+{
+       int ret = -1;
+       char *str = (char *) value;
+       wsec_pmk_t pmk;
+       
+       /* driver doesn't support GET */
+
+       if ((param & PARAM_MODE) == SET) {
+               strncpy(pmk.key, value, WSEC_MAX_PSK_LEN);
+               pmk.key_len = strlen(value);
+
+               if (pmk.key_len > WSEC_MAX_PSK_LEN)
+                       pmk.key_len = WSEC_MAX_PSK_LEN;
+
+               pmk.flags = WSEC_PASSPHRASE;
+
+               ret = wl_ioctl(interface, WLC_SET_WSEC_PMK, &pmk, sizeof(pmk));
+       }
+       
+       return ret;
+}
+
 static const struct wlc_call wlc_calls[] = {
        {
                .name = "version",
@@ -864,6 +887,12 @@ static const struct wlc_call wlc_calls[] = {
                .data.str = "sup_wpa",
                .desc = "Built-in WPA supplicant"
        },
+       {
+               .name = "passphrase",
+               .param = STRING,
+               .handler = wlc_pmk,
+               .desc = "Passphrase for built-in WPA supplicant",
+       },
        {
                .name = "maxassoc",
                .param = INT,