diff options
author | Luis R. Rodriguez <mcgrof@qca.qualcomm.com> | 2011-11-29 12:40:16 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-11-30 15:08:35 -0500 |
commit | acda130b0e615596c63640f05febb02d2e681dde (patch) | |
tree | 5f856e7395566ff7b2b1beeb194f86d56b01f157 /drivers/net/wireless/prism54 | |
parent | eb840a80d2e5f446ad58a6d4f14dcaa3d877a362 (diff) |
prism54: remove private driver ioctls
As of hostap_0_7_1~358 the CONFIG_DRIVER_PRISM54
was removed from upstream wpa_supplicant/hostapd so
lets just kill the useless old prism54 private ioctl
crap.
Cc: Jouni Malinen <j@w1.fi>
Cc: David Miller <davem@davemloft.net>
Reported-by: David Miller <davem@davemloft.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/prism54')
-rw-r--r-- | drivers/net/wireless/prism54/isl_ioctl.c | 333 | ||||
-rw-r--r-- | drivers/net/wireless/prism54/isl_ioctl.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/prism54/islpci_dev.c | 1 |
3 files changed, 0 insertions, 336 deletions
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index d97a2caf582b..f83bc5a5e81f 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c | |||
@@ -2493,323 +2493,7 @@ prism54_set_mac_address(struct net_device *ndev, void *addr) | |||
2493 | return ret; | 2493 | return ret; |
2494 | } | 2494 | } |
2495 | 2495 | ||
2496 | /* Note: currently, use hostapd ioctl from the Host AP driver for WPA | ||
2497 | * support. This is to be replaced with Linux wireless extensions once they | ||
2498 | * get WPA support. */ | ||
2499 | |||
2500 | /* Note II: please leave all this together as it will be easier to remove later, | ||
2501 | * once wireless extensions add WPA support -mcgrof */ | ||
2502 | |||
2503 | /* PRISM54_HOSTAPD ioctl() cmd: */ | ||
2504 | enum { | ||
2505 | PRISM2_SET_ENCRYPTION = 6, | ||
2506 | PRISM2_HOSTAPD_SET_GENERIC_ELEMENT = 12, | ||
2507 | PRISM2_HOSTAPD_MLME = 13, | ||
2508 | PRISM2_HOSTAPD_SCAN_REQ = 14, | ||
2509 | }; | ||
2510 | |||
2511 | #define PRISM54_SET_WPA SIOCIWFIRSTPRIV+12 | 2496 | #define PRISM54_SET_WPA SIOCIWFIRSTPRIV+12 |
2512 | #define PRISM54_HOSTAPD SIOCIWFIRSTPRIV+25 | ||
2513 | #define PRISM54_DROP_UNENCRYPTED SIOCIWFIRSTPRIV+26 | ||
2514 | |||
2515 | #define PRISM2_HOSTAPD_MAX_BUF_SIZE 1024 | ||
2516 | #define PRISM2_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \ | ||
2517 | offsetof(struct prism2_hostapd_param, u.generic_elem.data) | ||
2518 | |||
2519 | /* Maximum length for algorithm names (-1 for nul termination) | ||
2520 | * used in ioctl() */ | ||
2521 | #define HOSTAP_CRYPT_ALG_NAME_LEN 16 | ||
2522 | |||
2523 | struct prism2_hostapd_param { | ||
2524 | u32 cmd; | ||
2525 | u8 sta_addr[ETH_ALEN]; | ||
2526 | union { | ||
2527 | struct { | ||
2528 | u8 alg[HOSTAP_CRYPT_ALG_NAME_LEN]; | ||
2529 | u32 flags; | ||
2530 | u32 err; | ||
2531 | u8 idx; | ||
2532 | u8 seq[8]; /* sequence counter (set: RX, get: TX) */ | ||
2533 | u16 key_len; | ||
2534 | u8 key[0]; | ||
2535 | } crypt; | ||
2536 | struct { | ||
2537 | u8 len; | ||
2538 | u8 data[0]; | ||
2539 | } generic_elem; | ||
2540 | struct { | ||
2541 | #define MLME_STA_DEAUTH 0 | ||
2542 | #define MLME_STA_DISASSOC 1 | ||
2543 | u16 cmd; | ||
2544 | u16 reason_code; | ||
2545 | } mlme; | ||
2546 | struct { | ||
2547 | u8 ssid_len; | ||
2548 | u8 ssid[32]; | ||
2549 | } scan_req; | ||
2550 | } u; | ||
2551 | }; | ||
2552 | |||
2553 | |||
2554 | static int | ||
2555 | prism2_ioctl_set_encryption(struct net_device *dev, | ||
2556 | struct prism2_hostapd_param *param, | ||
2557 | int param_len) | ||
2558 | { | ||
2559 | islpci_private *priv = netdev_priv(dev); | ||
2560 | int rvalue = 0, force = 0; | ||
2561 | int authen = DOT11_AUTH_OS, invoke = 0, exunencrypt = 0; | ||
2562 | union oid_res_t r; | ||
2563 | |||
2564 | /* with the new API, it's impossible to get a NULL pointer. | ||
2565 | * New version of iwconfig set the IW_ENCODE_NOKEY flag | ||
2566 | * when no key is given, but older versions don't. */ | ||
2567 | |||
2568 | if (param->u.crypt.key_len > 0) { | ||
2569 | /* we have a key to set */ | ||
2570 | int index = param->u.crypt.idx; | ||
2571 | int current_index; | ||
2572 | struct obj_key key = { DOT11_PRIV_TKIP, 0, "" }; | ||
2573 | |||
2574 | /* get the current key index */ | ||
2575 | rvalue = mgt_get_request(priv, DOT11_OID_DEFKEYID, 0, NULL, &r); | ||
2576 | current_index = r.u; | ||
2577 | /* Verify that the key is not marked as invalid */ | ||
2578 | if (!(param->u.crypt.flags & IW_ENCODE_NOKEY)) { | ||
2579 | key.length = param->u.crypt.key_len > sizeof (param->u.crypt.key) ? | ||
2580 | sizeof (param->u.crypt.key) : param->u.crypt.key_len; | ||
2581 | memcpy(key.key, param->u.crypt.key, key.length); | ||
2582 | if (key.length == 32) | ||
2583 | /* we want WPA-PSK */ | ||
2584 | key.type = DOT11_PRIV_TKIP; | ||
2585 | if ((index < 0) || (index > 3)) | ||
2586 | /* no index provided use the current one */ | ||
2587 | index = current_index; | ||
2588 | |||
2589 | /* now send the key to the card */ | ||
2590 | rvalue |= | ||
2591 | mgt_set_request(priv, DOT11_OID_DEFKEYX, index, | ||
2592 | &key); | ||
2593 | } | ||
2594 | /* | ||
2595 | * If a valid key is set, encryption should be enabled | ||
2596 | * (user may turn it off later). | ||
2597 | * This is also how "iwconfig ethX key on" works | ||
2598 | */ | ||
2599 | if ((index == current_index) && (key.length > 0)) | ||
2600 | force = 1; | ||
2601 | } else { | ||
2602 | int index = (param->u.crypt.flags & IW_ENCODE_INDEX) - 1; | ||
2603 | if ((index >= 0) && (index <= 3)) { | ||
2604 | /* we want to set the key index */ | ||
2605 | rvalue |= | ||
2606 | mgt_set_request(priv, DOT11_OID_DEFKEYID, 0, | ||
2607 | &index); | ||
2608 | } else { | ||
2609 | if (!(param->u.crypt.flags & IW_ENCODE_MODE)) { | ||
2610 | /* we cannot do anything. Complain. */ | ||
2611 | return -EINVAL; | ||
2612 | } | ||
2613 | } | ||
2614 | } | ||
2615 | /* now read the flags */ | ||
2616 | if (param->u.crypt.flags & IW_ENCODE_DISABLED) { | ||
2617 | /* Encoding disabled, | ||
2618 | * authen = DOT11_AUTH_OS; | ||
2619 | * invoke = 0; | ||
2620 | * exunencrypt = 0; */ | ||
2621 | } | ||
2622 | if (param->u.crypt.flags & IW_ENCODE_OPEN) | ||
2623 | /* Encode but accept non-encoded packets. No auth */ | ||
2624 | invoke = 1; | ||
2625 | if ((param->u.crypt.flags & IW_ENCODE_RESTRICTED) || force) { | ||
2626 | /* Refuse non-encoded packets. Auth */ | ||
2627 | authen = DOT11_AUTH_BOTH; | ||
2628 | invoke = 1; | ||
2629 | exunencrypt = 1; | ||
2630 | } | ||
2631 | /* do the change if requested */ | ||
2632 | if ((param->u.crypt.flags & IW_ENCODE_MODE) || force) { | ||
2633 | rvalue |= | ||
2634 | mgt_set_request(priv, DOT11_OID_AUTHENABLE, 0, &authen); | ||
2635 | rvalue |= | ||
2636 | mgt_set_request(priv, DOT11_OID_PRIVACYINVOKED, 0, &invoke); | ||
2637 | rvalue |= | ||
2638 | mgt_set_request(priv, DOT11_OID_EXUNENCRYPTED, 0, | ||
2639 | &exunencrypt); | ||
2640 | } | ||
2641 | return rvalue; | ||
2642 | } | ||
2643 | |||
2644 | static int | ||
2645 | prism2_ioctl_set_generic_element(struct net_device *ndev, | ||
2646 | struct prism2_hostapd_param *param, | ||
2647 | int param_len) | ||
2648 | { | ||
2649 | islpci_private *priv = netdev_priv(ndev); | ||
2650 | int max_len, len, alen, ret=0; | ||
2651 | struct obj_attachment *attach; | ||
2652 | |||
2653 | len = param->u.generic_elem.len; | ||
2654 | max_len = param_len - PRISM2_HOSTAPD_GENERIC_ELEMENT_HDR_LEN; | ||
2655 | if (max_len < 0 || max_len < len) | ||
2656 | return -EINVAL; | ||
2657 | |||
2658 | alen = sizeof(*attach) + len; | ||
2659 | attach = kzalloc(alen, GFP_KERNEL); | ||
2660 | if (attach == NULL) | ||
2661 | return -ENOMEM; | ||
2662 | |||
2663 | #define WLAN_FC_TYPE_MGMT 0 | ||
2664 | #define WLAN_FC_STYPE_ASSOC_REQ 0 | ||
2665 | #define WLAN_FC_STYPE_REASSOC_REQ 2 | ||
2666 | |||
2667 | /* Note: endianness is covered by mgt_set_varlen */ | ||
2668 | |||
2669 | attach->type = (WLAN_FC_TYPE_MGMT << 2) | | ||
2670 | (WLAN_FC_STYPE_ASSOC_REQ << 4); | ||
2671 | attach->id = -1; | ||
2672 | attach->size = len; | ||
2673 | memcpy(attach->data, param->u.generic_elem.data, len); | ||
2674 | |||
2675 | ret = mgt_set_varlen(priv, DOT11_OID_ATTACHMENT, attach, len); | ||
2676 | |||
2677 | if (ret == 0) { | ||
2678 | attach->type = (WLAN_FC_TYPE_MGMT << 2) | | ||
2679 | (WLAN_FC_STYPE_REASSOC_REQ << 4); | ||
2680 | |||
2681 | ret = mgt_set_varlen(priv, DOT11_OID_ATTACHMENT, attach, len); | ||
2682 | |||
2683 | if (ret == 0) | ||
2684 | printk(KERN_DEBUG "%s: WPA IE Attachment was set\n", | ||
2685 | ndev->name); | ||
2686 | } | ||
2687 | |||
2688 | kfree(attach); | ||
2689 | return ret; | ||
2690 | |||
2691 | } | ||
2692 | |||
2693 | static int | ||
2694 | prism2_ioctl_mlme(struct net_device *dev, struct prism2_hostapd_param *param) | ||
2695 | { | ||
2696 | return -EOPNOTSUPP; | ||
2697 | } | ||
2698 | |||
2699 | static int | ||
2700 | prism2_ioctl_scan_req(struct net_device *ndev, | ||
2701 | struct prism2_hostapd_param *param) | ||
2702 | { | ||
2703 | islpci_private *priv = netdev_priv(ndev); | ||
2704 | struct iw_request_info info; | ||
2705 | int i, rvalue; | ||
2706 | struct obj_bsslist *bsslist; | ||
2707 | u32 noise = 0; | ||
2708 | char *extra = ""; | ||
2709 | char *current_ev = "foo"; | ||
2710 | union oid_res_t r; | ||
2711 | |||
2712 | if (islpci_get_state(priv) < PRV_STATE_INIT) { | ||
2713 | /* device is not ready, fail gently */ | ||
2714 | return 0; | ||
2715 | } | ||
2716 | |||
2717 | /* first get the noise value. We will use it to report the link quality */ | ||
2718 | rvalue = mgt_get_request(priv, DOT11_OID_NOISEFLOOR, 0, NULL, &r); | ||
2719 | noise = r.u; | ||
2720 | |||
2721 | /* Ask the device for a list of known bss. We can report at most | ||
2722 | * IW_MAX_AP=64 to the range struct. But the device won't repport anything | ||
2723 | * if you change the value of IWMAX_BSS=24. | ||
2724 | */ | ||
2725 | rvalue |= mgt_get_request(priv, DOT11_OID_BSSLIST, 0, NULL, &r); | ||
2726 | bsslist = r.ptr; | ||
2727 | |||
2728 | info.cmd = PRISM54_HOSTAPD; | ||
2729 | info.flags = 0; | ||
2730 | |||
2731 | /* ok now, scan the list and translate its info */ | ||
2732 | for (i = 0; i < min(IW_MAX_AP, (int) bsslist->nr); i++) | ||
2733 | current_ev = prism54_translate_bss(ndev, &info, current_ev, | ||
2734 | extra + IW_SCAN_MAX_DATA, | ||
2735 | &(bsslist->bsslist[i]), | ||
2736 | noise); | ||
2737 | kfree(bsslist); | ||
2738 | |||
2739 | return rvalue; | ||
2740 | } | ||
2741 | |||
2742 | static int | ||
2743 | prism54_hostapd(struct net_device *ndev, struct iw_point *p) | ||
2744 | { | ||
2745 | struct prism2_hostapd_param *param; | ||
2746 | int ret = 0; | ||
2747 | u32 uwrq; | ||
2748 | |||
2749 | printk(KERN_DEBUG "prism54_hostapd - len=%d\n", p->length); | ||
2750 | if (p->length < sizeof(struct prism2_hostapd_param) || | ||
2751 | p->length > PRISM2_HOSTAPD_MAX_BUF_SIZE || !p->pointer) | ||
2752 | return -EINVAL; | ||
2753 | |||
2754 | param = memdup_user(p->pointer, p->length); | ||
2755 | if (IS_ERR(param)) | ||
2756 | return PTR_ERR(param); | ||
2757 | |||
2758 | switch (param->cmd) { | ||
2759 | case PRISM2_SET_ENCRYPTION: | ||
2760 | printk(KERN_DEBUG "%s: Caught WPA supplicant set encryption request\n", | ||
2761 | ndev->name); | ||
2762 | ret = prism2_ioctl_set_encryption(ndev, param, p->length); | ||
2763 | break; | ||
2764 | case PRISM2_HOSTAPD_SET_GENERIC_ELEMENT: | ||
2765 | printk(KERN_DEBUG "%s: Caught WPA supplicant set WPA IE request\n", | ||
2766 | ndev->name); | ||
2767 | ret = prism2_ioctl_set_generic_element(ndev, param, | ||
2768 | p->length); | ||
2769 | break; | ||
2770 | case PRISM2_HOSTAPD_MLME: | ||
2771 | printk(KERN_DEBUG "%s: Caught WPA supplicant MLME request\n", | ||
2772 | ndev->name); | ||
2773 | ret = prism2_ioctl_mlme(ndev, param); | ||
2774 | break; | ||
2775 | case PRISM2_HOSTAPD_SCAN_REQ: | ||
2776 | printk(KERN_DEBUG "%s: Caught WPA supplicant scan request\n", | ||
2777 | ndev->name); | ||
2778 | ret = prism2_ioctl_scan_req(ndev, param); | ||
2779 | break; | ||
2780 | case PRISM54_SET_WPA: | ||
2781 | printk(KERN_DEBUG "%s: Caught WPA supplicant wpa init request\n", | ||
2782 | ndev->name); | ||
2783 | uwrq = 1; | ||
2784 | ret = prism54_set_wpa(ndev, NULL, &uwrq, NULL); | ||
2785 | break; | ||
2786 | case PRISM54_DROP_UNENCRYPTED: | ||
2787 | printk(KERN_DEBUG "%s: Caught WPA drop unencrypted request\n", | ||
2788 | ndev->name); | ||
2789 | #if 0 | ||
2790 | uwrq = 0x01; | ||
2791 | mgt_set(priv, DOT11_OID_EXUNENCRYPTED, &uwrq); | ||
2792 | down_write(&priv->mib_sem); | ||
2793 | mgt_commit(priv); | ||
2794 | up_write(&priv->mib_sem); | ||
2795 | #endif | ||
2796 | /* Not necessary, as set_wpa does it, should we just do it here though? */ | ||
2797 | ret = 0; | ||
2798 | break; | ||
2799 | default: | ||
2800 | printk(KERN_DEBUG "%s: Caught a WPA supplicant request that is not supported\n", | ||
2801 | ndev->name); | ||
2802 | ret = -EOPNOTSUPP; | ||
2803 | break; | ||
2804 | } | ||
2805 | |||
2806 | if (ret == 0 && copy_to_user(p->pointer, param, p->length)) | ||
2807 | ret = -EFAULT; | ||
2808 | |||
2809 | kfree(param); | ||
2810 | |||
2811 | return ret; | ||
2812 | } | ||
2813 | 2497 | ||
2814 | static int | 2498 | static int |
2815 | prism54_set_wpa(struct net_device *ndev, struct iw_request_info *info, | 2499 | prism54_set_wpa(struct net_device *ndev, struct iw_request_info *info, |
@@ -3223,20 +2907,3 @@ const struct iw_handler_def prism54_handler_def = { | |||
3223 | .private_args = (struct iw_priv_args *) prism54_private_args, | 2907 | .private_args = (struct iw_priv_args *) prism54_private_args, |
3224 | .get_wireless_stats = prism54_get_wireless_stats, | 2908 | .get_wireless_stats = prism54_get_wireless_stats, |
3225 | }; | 2909 | }; |
3226 | |||
3227 | /* For wpa_supplicant */ | ||
3228 | |||
3229 | int | ||
3230 | prism54_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) | ||
3231 | { | ||
3232 | struct iwreq *wrq = (struct iwreq *) rq; | ||
3233 | int ret = -1; | ||
3234 | switch (cmd) { | ||
3235 | case PRISM54_HOSTAPD: | ||
3236 | if (!capable(CAP_NET_ADMIN)) | ||
3237 | return -EPERM; | ||
3238 | ret = prism54_hostapd(ndev, &wrq->u.data); | ||
3239 | return ret; | ||
3240 | } | ||
3241 | return -EOPNOTSUPP; | ||
3242 | } | ||
diff --git a/drivers/net/wireless/prism54/isl_ioctl.h b/drivers/net/wireless/prism54/isl_ioctl.h index bcfbfb9281d2..a34bceb6e3cd 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.h +++ b/drivers/net/wireless/prism54/isl_ioctl.h | |||
@@ -43,8 +43,6 @@ void prism54_wpa_bss_ie_clean(islpci_private *priv); | |||
43 | 43 | ||
44 | int prism54_set_mac_address(struct net_device *, void *); | 44 | int prism54_set_mac_address(struct net_device *, void *); |
45 | 45 | ||
46 | int prism54_ioctl(struct net_device *, struct ifreq *, int); | ||
47 | |||
48 | extern const struct iw_handler_def prism54_handler_def; | 46 | extern const struct iw_handler_def prism54_handler_def; |
49 | 47 | ||
50 | #endif /* _ISL_IOCTL_H */ | 48 | #endif /* _ISL_IOCTL_H */ |
diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c index 8a3cf4fe376f..5970ff6f40cc 100644 --- a/drivers/net/wireless/prism54/islpci_dev.c +++ b/drivers/net/wireless/prism54/islpci_dev.c | |||
@@ -804,7 +804,6 @@ static const struct ethtool_ops islpci_ethtool_ops = { | |||
804 | static const struct net_device_ops islpci_netdev_ops = { | 804 | static const struct net_device_ops islpci_netdev_ops = { |
805 | .ndo_open = islpci_open, | 805 | .ndo_open = islpci_open, |
806 | .ndo_stop = islpci_close, | 806 | .ndo_stop = islpci_close, |
807 | .ndo_do_ioctl = prism54_ioctl, | ||
808 | .ndo_start_xmit = islpci_eth_transmit, | 807 | .ndo_start_xmit = islpci_eth_transmit, |
809 | .ndo_tx_timeout = islpci_eth_tx_timeout, | 808 | .ndo_tx_timeout = islpci_eth_tx_timeout, |
810 | .ndo_set_mac_address = prism54_set_mac_address, | 809 | .ndo_set_mac_address = prism54_set_mac_address, |