+ if (wl_ioctl(dev, WLC_SET_WSEC, &wep, sizeof(val)) < 0)
+ return -EINVAL;
+
+ if (wrqu->data.flags & IW_ENCODE_OPEN)
+ wrestrict = 0;
+
+ if (wrqu->data.pointer && (wrqu->data.length > 0) && (wrqu->data.length <= 16)) {
+ wl_wsec_key_t key;
+ memset(&key, 0, sizeof(key));
+
+ key.flags = WL_PRIMARY_KEY;
+ key.len = wrqu->data.length;
+ key.index = index;
+ memcpy(key.data, wrqu->data.pointer, wrqu->data.length);
+
+ if (wl_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)) < 0)
+ return -EINVAL;