source:
freewrt/target/linux/generic-2.4/patches/100-wireless-extension.patch@
a3abab6
| Last change on this file since a3abab6 was 475ad56, checked in by , 20 years ago | |
|---|---|
|
|
| File size: 39.5 KB | |
-
include/linux/netdevice.h
diff -Nur linux-2.4.32/include/linux/netdevice.h linux-2.4.32-we/include/linux/netdevice.h
old new 295 295 296 296 /* List of functions to handle Wireless Extensions (instead of ioctl). 297 297 * See <net/iw_handler.h> for details. Jean II */ 298 struct iw_handler_def * wireless_handlers; 298 const struct iw_handler_def * wireless_handlers; 299 /* Instance data managed by the core of Wireless Extensions. */ 300 struct iw_public_data * wireless_data; 299 301 300 302 struct ethtool_ops *ethtool_ops; 301 303 -
include/linux/wireless.h
diff -Nur linux-2.4.32/include/linux/wireless.h linux-2.4.32-we/include/linux/wireless.h
old new 1 1 /* 2 2 * This file define a set of standard wireless extensions 3 3 * 4 * Version : 1 6 2.4.034 * Version : 18 12.3.05 5 5 * 6 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 7 * Copyright (c) 1997-200 2Jean Tourrilhes, All Rights Reserved.7 * Copyright (c) 1997-2005 Jean Tourrilhes, All Rights Reserved. 8 8 */ 9 9 10 10 #ifndef _LINUX_WIRELESS_H … … 47 47 * # include/net/iw_handler.h 48 48 * 49 49 * Note as well that /proc/net/wireless implementation has now moved in : 50 * # include/linux/wireless.c50 * # net/core/wireless.c 51 51 * 52 52 * Wireless Events (2002 -> onward) : 53 53 * -------------------------------- 54 54 * Events are defined at the end of this file, and implemented in : 55 * # include/linux/wireless.c55 * # net/core/wireless.c 56 56 * 57 57 * Other comments : 58 58 * -------------- … … 82 82 * (there is some stuff that will be added in the future...) 83 83 * I just plan to increment with each new version. 84 84 */ 85 #define WIRELESS_EXT 1 685 #define WIRELESS_EXT 18 86 86 87 87 /* 88 88 * Changes : … … 175 175 * - Remove IW_MAX_GET_SPY because conflict with enhanced spy support 176 176 * - Add SIOCSIWTHRSPY/SIOCGIWTHRSPY and "struct iw_thrspy" 177 177 * - Add IW_ENCODE_TEMP and iw_range->encoding_login_index 178 * 179 * V16 to V17 180 * ---------- 181 * - Add flags to frequency -> auto/fixed 182 * - Document (struct iw_quality *)->updated, add new flags (INVALID) 183 * - Wireless Event capability in struct iw_range 184 * - Add support for relative TxPower (yick !) 185 * 186 * V17 to V18 (From Jouni Malinen <jkmaline@cc.hut.fi>) 187 * ---------- 188 * - Add support for WPA/WPA2 189 * - Add extended encoding configuration (SIOCSIWENCODEEXT and 190 * SIOCGIWENCODEEXT) 191 * - Add SIOCSIWGENIE/SIOCGIWGENIE 192 * - Add SIOCSIWMLME 193 * - Add SIOCSIWPMKSA 194 * - Add struct iw_range bit field for supported encoding capabilities 195 * - Add optional scan request parameters for SIOCSIWSCAN 196 * - Add SIOCSIWAUTH/SIOCGIWAUTH for setting authentication and WPA 197 * related parameters (extensible up to 4096 parameter values) 198 * - Add wireless events: IWEVGENIE, IWEVMICHAELMICFAILURE, 199 * IWEVASSOCREQIE, IWEVASSOCRESPIE, IWEVPMKIDCAND 178 200 */ 179 201 180 202 /**************************** CONSTANTS ****************************/ … … 249 271 #define SIOCSIWPOWER 0x8B2C /* set Power Management settings */ 250 272 #define SIOCGIWPOWER 0x8B2D /* get Power Management settings */ 251 273 274 /* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM). 275 * This ioctl uses struct iw_point and data buffer that includes IE id and len 276 * fields. More than one IE may be included in the request. Setting the generic 277 * IE to empty buffer (len=0) removes the generic IE from the driver. Drivers 278 * are allowed to generate their own WPA/RSN IEs, but in these cases, drivers 279 * are required to report the used IE as a wireless event, e.g., when 280 * associating with an AP. */ 281 #define SIOCSIWGENIE 0x8B30 /* set generic IE */ 282 #define SIOCGIWGENIE 0x8B31 /* get generic IE */ 283 284 /* WPA : IEEE 802.11 MLME requests */ 285 #define SIOCSIWMLME 0x8B16 /* request MLME operation; uses 286 * struct iw_mlme */ 287 /* WPA : Authentication mode parameters */ 288 #define SIOCSIWAUTH 0x8B32 /* set authentication mode params */ 289 #define SIOCGIWAUTH 0x8B33 /* get authentication mode params */ 290 291 /* WPA : Extended version of encoding configuration */ 292 #define SIOCSIWENCODEEXT 0x8B34 /* set encoding token & mode */ 293 #define SIOCGIWENCODEEXT 0x8B35 /* get encoding token & mode */ 294 295 /* WPA2 : PMKSA cache management */ 296 #define SIOCSIWPMKSA 0x8B36 /* PMKSA cache operation */ 297 252 298 /* -------------------- DEV PRIVATE IOCTL LIST -------------------- */ 253 299 254 /* These 16 ioctl are wireless device private.300 /* These 32 ioctl are wireless device private, for 16 commands. 255 301 * Each driver is free to use them for whatever purpose it chooses, 256 302 * however the driver *must* export the description of those ioctls 257 303 * with SIOCGIWPRIV and *must* use arguments as defined below. … … 266 312 * We now have 32 commands, so a bit more space ;-). 267 313 * Also, all 'odd' commands are only usable by root and don't return the 268 314 * content of ifr/iwr to user (but you are not obliged to use the set/get 269 * convention, just use every other two command). 270 * And I repeat : you are not obliged to use them with iwspy, but you315 * convention, just use every other two command). More details in iwpriv.c. 316 * And I repeat : you are not forced to use them with iwpriv, but you 271 317 * must be compliant with it. 272 318 */ 273 319 … … 290 336 #define IWEVCUSTOM 0x8C02 /* Driver specific ascii string */ 291 337 #define IWEVREGISTERED 0x8C03 /* Discovered a new node (AP mode) */ 292 338 #define IWEVEXPIRED 0x8C04 /* Expired a node (AP mode) */ 339 #define IWEVGENIE 0x8C05 /* Generic IE (WPA, RSN, WMM, ..) 340 * (scan results); This includes id and 341 * length fields. One IWEVGENIE may 342 * contain more than one IE. Scan 343 * results may contain one or more 344 * IWEVGENIE events. */ 345 #define IWEVMICHAELMICFAILURE 0x8C06 /* Michael MIC failure 346 * (struct iw_michaelmicfailure) 347 */ 348 #define IWEVASSOCREQIE 0x8C07 /* IEs used in (Re)Association Request. 349 * The data includes id and length 350 * fields and may contain more than one 351 * IE. This event is required in 352 * Managed mode if the driver 353 * generates its own WPA/RSN IE. This 354 * should be sent just before 355 * IWEVREGISTERED event for the 356 * association. */ 357 #define IWEVASSOCRESPIE 0x8C08 /* IEs used in (Re)Association 358 * Response. The data includes id and 359 * length fields and may contain more 360 * than one IE. This may be sent 361 * between IWEVASSOCREQIE and 362 * IWEVREGISTERED events for the 363 * association. */ 364 #define IWEVPMKIDCAND 0x8C09 /* PMKID candidate for RSN 365 * pre-authentication 366 * (struct iw_pmkid_cand) */ 293 367 294 368 #define IWEVFIRST 0x8C00 295 369 … … 352 426 #define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */ 353 427 #define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */ 354 428 429 /* Statistics flags (bitmask in updated) */ 430 #define IW_QUAL_QUAL_UPDATED 0x1 /* Value was updated since last read */ 431 #define IW_QUAL_LEVEL_UPDATED 0x2 432 #define IW_QUAL_NOISE_UPDATED 0x4 433 #define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */ 434 #define IW_QUAL_LEVEL_INVALID 0x20 435 #define IW_QUAL_NOISE_INVALID 0x40 436 437 /* Frequency flags */ 438 #define IW_FREQ_AUTO 0x00 /* Let the driver decides */ 439 #define IW_FREQ_FIXED 0x01 /* Force a specific value */ 440 355 441 /* Maximum number of size of encoding token available 356 442 * they are listed in the range structure */ 357 443 #define IW_MAX_ENCODING_SIZES 8 … … 390 476 #define IW_TXPOW_TYPE 0x00FF /* Type of value */ 391 477 #define IW_TXPOW_DBM 0x0000 /* Value is in dBm */ 392 478 #define IW_TXPOW_MWATT 0x0001 /* Value is in mW */ 479 #define IW_TXPOW_RELATIVE 0x0002 /* Value is in arbitrary units */ 393 480 #define IW_TXPOW_RANGE 0x1000 /* Range of value between min/max */ 394 481 395 482 /* Retry limits and lifetime flags available */ … … 412 499 #define IW_SCAN_THIS_MODE 0x0020 /* Scan only this Mode */ 413 500 #define IW_SCAN_ALL_RATE 0x0040 /* Scan all Bit-Rates */ 414 501 #define IW_SCAN_THIS_RATE 0x0080 /* Scan only this Bit-Rate */ 502 /* struct iw_scan_req scan_type */ 503 #define IW_SCAN_TYPE_ACTIVE 0 504 #define IW_SCAN_TYPE_PASSIVE 1 415 505 /* Maximum size of returned data */ 416 506 #define IW_SCAN_MAX_DATA 4096 /* In bytes */ 417 507 418 508 /* Max number of char in custom event - use multiple of them if needed */ 419 509 #define IW_CUSTOM_MAX 256 /* In bytes */ 420 510 511 /* Generic information element */ 512 #define IW_GENERIC_IE_MAX 1024 513 514 /* MLME requests (SIOCSIWMLME / struct iw_mlme) */ 515 #define IW_MLME_DEAUTH 0 516 #define IW_MLME_DISASSOC 1 517 518 /* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */ 519 #define IW_AUTH_INDEX 0x0FFF 520 #define IW_AUTH_FLAGS 0xF000 521 /* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095) 522 * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the 523 * parameter that is being set/get to; value will be read/written to 524 * struct iw_param value field) */ 525 #define IW_AUTH_WPA_VERSION 0 526 #define IW_AUTH_CIPHER_PAIRWISE 1 527 #define IW_AUTH_CIPHER_GROUP 2 528 #define IW_AUTH_KEY_MGMT 3 529 #define IW_AUTH_TKIP_COUNTERMEASURES 4 530 #define IW_AUTH_DROP_UNENCRYPTED 5 531 #define IW_AUTH_80211_AUTH_ALG 6 532 #define IW_AUTH_WPA_ENABLED 7 533 #define IW_AUTH_RX_UNENCRYPTED_EAPOL 8 534 #define IW_AUTH_ROAMING_CONTROL 9 535 #define IW_AUTH_PRIVACY_INVOKED 10 536 537 /* IW_AUTH_WPA_VERSION values (bit field) */ 538 #define IW_AUTH_WPA_VERSION_DISABLED 0x00000001 539 #define IW_AUTH_WPA_VERSION_WPA 0x00000002 540 #define IW_AUTH_WPA_VERSION_WPA2 0x00000004 541 542 /* IW_AUTH_PAIRWISE_CIPHER and IW_AUTH_GROUP_CIPHER values (bit field) */ 543 #define IW_AUTH_CIPHER_NONE 0x00000001 544 #define IW_AUTH_CIPHER_WEP40 0x00000002 545 #define IW_AUTH_CIPHER_TKIP 0x00000004 546 #define IW_AUTH_CIPHER_CCMP 0x00000008 547 #define IW_AUTH_CIPHER_WEP104 0x00000010 548 549 /* IW_AUTH_KEY_MGMT values (bit field) */ 550 #define IW_AUTH_KEY_MGMT_802_1X 1 551 #define IW_AUTH_KEY_MGMT_PSK 2 552 553 /* IW_AUTH_80211_AUTH_ALG values (bit field) */ 554 #define IW_AUTH_ALG_OPEN_SYSTEM 0x00000001 555 #define IW_AUTH_ALG_SHARED_KEY 0x00000002 556 #define IW_AUTH_ALG_LEAP 0x00000004 557 558 /* IW_AUTH_ROAMING_CONTROL values */ 559 #define IW_AUTH_ROAMING_ENABLE 0 /* driver/firmware based roaming */ 560 #define IW_AUTH_ROAMING_DISABLE 1 /* user space program used for roaming 561 * control */ 562 563 /* SIOCSIWENCODEEXT definitions */ 564 #define IW_ENCODE_SEQ_MAX_SIZE 8 565 /* struct iw_encode_ext ->alg */ 566 #define IW_ENCODE_ALG_NONE 0 567 #define IW_ENCODE_ALG_WEP 1 568 #define IW_ENCODE_ALG_TKIP 2 569 #define IW_ENCODE_ALG_CCMP 3 570 /* struct iw_encode_ext ->ext_flags */ 571 #define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001 572 #define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002 573 #define IW_ENCODE_EXT_GROUP_KEY 0x00000004 574 #define IW_ENCODE_EXT_SET_TX_KEY 0x00000008 575 576 /* IWEVMICHAELMICFAILURE : struct iw_michaelmicfailure ->flags */ 577 #define IW_MICFAILURE_KEY_ID 0x00000003 /* Key ID 0..3 */ 578 #define IW_MICFAILURE_GROUP 0x00000004 579 #define IW_MICFAILURE_PAIRWISE 0x00000008 580 #define IW_MICFAILURE_STAKEY 0x00000010 581 #define IW_MICFAILURE_COUNT 0x00000060 /* 1 or 2 (0 = count not supported) 582 */ 583 584 /* Bit field values for enc_capa in struct iw_range */ 585 #define IW_ENC_CAPA_WPA 0x00000001 586 #define IW_ENC_CAPA_WPA2 0x00000002 587 #define IW_ENC_CAPA_CIPHER_TKIP 0x00000004 588 #define IW_ENC_CAPA_CIPHER_CCMP 0x00000008 589 590 /* Event capability macros - in (struct iw_range *)->event_capa 591 * Because we have more than 32 possible events, we use an array of 592 * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */ 593 #define IW_EVENT_CAPA_BASE(cmd) ((cmd >= SIOCIWFIRSTPRIV) ? \ 594 (cmd - SIOCIWFIRSTPRIV + 0x60) : \ 595 (cmd - SIOCSIWCOMMIT)) 596 #define IW_EVENT_CAPA_INDEX(cmd) (IW_EVENT_CAPA_BASE(cmd) >> 5) 597 #define IW_EVENT_CAPA_MASK(cmd) (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F)) 598 /* Event capability constants - event autogenerated by the kernel 599 * This list is valid for most 802.11 devices, customise as needed... */ 600 #define IW_EVENT_CAPA_K_0 (IW_EVENT_CAPA_MASK(0x8B04) | \ 601 IW_EVENT_CAPA_MASK(0x8B06) | \ 602 IW_EVENT_CAPA_MASK(0x8B1A)) 603 #define IW_EVENT_CAPA_K_1 (IW_EVENT_CAPA_MASK(0x8B2A)) 604 /* "Easy" macro to set events in iw_range (less efficient) */ 605 #define IW_EVENT_CAPA_SET(event_capa, cmd) (event_capa[IW_EVENT_CAPA_INDEX(cmd)] |= IW_EVENT_CAPA_MASK(cmd)) 606 #define IW_EVENT_CAPA_SET_KERNEL(event_capa) {event_capa[0] |= IW_EVENT_CAPA_K_0; event_capa[1] |= IW_EVENT_CAPA_K_1; } 607 608 421 609 /****************************** TYPES ******************************/ 422 610 423 611 /* --------------------------- SUBTYPES --------------------------- */ … … 456 644 __s32 m; /* Mantissa */ 457 645 __s16 e; /* Exponent */ 458 646 __u8 i; /* List index (when in range struct) */ 459 __u8 pad; /* Unused - just for alignement*/647 __u8 flags; /* Flags (fixed/auto) */ 460 648 }; 461 649 462 650 /* … … 507 695 struct iw_quality high; /* High threshold */ 508 696 }; 509 697 698 /* 699 * Optional data for scan request 700 * 701 * Note: these optional parameters are controlling parameters for the 702 * scanning behavior, these do not apply to getting scan results 703 * (SIOCGIWSCAN). Drivers are expected to keep a local BSS table and 704 * provide a merged results with all BSSes even if the previous scan 705 * request limited scanning to a subset, e.g., by specifying an SSID. 706 * Especially, scan results are required to include an entry for the 707 * current BSS if the driver is in Managed mode and associated with an AP. 708 */ 709 struct iw_scan_req 710 { 711 __u8 scan_type; /* IW_SCAN_TYPE_{ACTIVE,PASSIVE} */ 712 __u8 essid_len; 713 __u8 num_channels; /* num entries in channel_list; 714 * 0 = scan all allowed channels */ 715 __u8 flags; /* reserved as padding; use zero, this may 716 * be used in the future for adding flags 717 * to request different scan behavior */ 718 struct sockaddr bssid; /* ff:ff:ff:ff:ff:ff for broadcast BSSID or 719 * individual address of a specific BSS */ 720 721 /* 722 * Use this ESSID if IW_SCAN_THIS_ESSID flag is used instead of using 723 * the current ESSID. This allows scan requests for specific ESSID 724 * without having to change the current ESSID and potentially breaking 725 * the current association. 726 */ 727 __u8 essid[IW_ESSID_MAX_SIZE]; 728 729 /* 730 * Optional parameters for changing the default scanning behavior. 731 * These are based on the MLME-SCAN.request from IEEE Std 802.11. 732 * TU is 1.024 ms. If these are set to 0, driver is expected to use 733 * reasonable default values. min_channel_time defines the time that 734 * will be used to wait for the first reply on each channel. If no 735 * replies are received, next channel will be scanned after this. If 736 * replies are received, total time waited on the channel is defined by 737 * max_channel_time. 738 */ 739 __u32 min_channel_time; /* in TU */ 740 __u32 max_channel_time; /* in TU */ 741 742 struct iw_freq channel_list[IW_MAX_FREQUENCIES]; 743 }; 744 745 /* ------------------------- WPA SUPPORT ------------------------- */ 746 747 /* 748 * Extended data structure for get/set encoding (this is used with 749 * SIOCSIWENCODEEXT/SIOCGIWENCODEEXT. struct iw_point and IW_ENCODE_* 750 * flags are used in the same way as with SIOCSIWENCODE/SIOCGIWENCODE and 751 * only the data contents changes (key data -> this structure, including 752 * key data). 753 * 754 * If the new key is the first group key, it will be set as the default 755 * TX key. Otherwise, default TX key index is only changed if 756 * IW_ENCODE_EXT_SET_TX_KEY flag is set. 757 * 758 * Key will be changed with SIOCSIWENCODEEXT in all cases except for 759 * special "change TX key index" operation which is indicated by setting 760 * key_len = 0 and ext_flags |= IW_ENCODE_EXT_SET_TX_KEY. 761 * 762 * tx_seq/rx_seq are only used when respective 763 * IW_ENCODE_EXT_{TX,RX}_SEQ_VALID flag is set in ext_flags. Normal 764 * TKIP/CCMP operation is to set RX seq with SIOCSIWENCODEEXT and start 765 * TX seq from zero whenever key is changed. SIOCGIWENCODEEXT is normally 766 * used only by an Authenticator (AP or an IBSS station) to get the 767 * current TX sequence number. Using TX_SEQ_VALID for SIOCSIWENCODEEXT and 768 * RX_SEQ_VALID for SIOCGIWENCODEEXT are optional, but can be useful for 769 * debugging/testing. 770 */ 771 struct iw_encode_ext 772 { 773 __u32 ext_flags; /* IW_ENCODE_EXT_* */ 774 __u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ 775 __u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ 776 struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast 777 * (group) keys or unicast address for 778 * individual keys */ 779 __u16 alg; /* IW_ENCODE_ALG_* */ 780 __u16 key_len; 781 __u8 key[0]; 782 }; 783 784 /* SIOCSIWMLME data */ 785 struct iw_mlme 786 { 787 __u16 cmd; /* IW_MLME_* */ 788 __u16 reason_code; 789 struct sockaddr addr; 790 }; 791 792 /* SIOCSIWPMKSA data */ 793 #define IW_PMKSA_ADD 1 794 #define IW_PMKSA_REMOVE 2 795 #define IW_PMKSA_FLUSH 3 796 797 #define IW_PMKID_LEN 16 798 799 struct iw_pmksa 800 { 801 __u32 cmd; /* IW_PMKSA_* */ 802 struct sockaddr bssid; 803 __u8 pmkid[IW_PMKID_LEN]; 804 }; 805 806 /* IWEVMICHAELMICFAILURE data */ 807 struct iw_michaelmicfailure 808 { 809 __u32 flags; 810 struct sockaddr src_addr; 811 __u8 tsc[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ 812 }; 813 814 /* IWEVPMKIDCAND data */ 815 #define IW_PMKID_CAND_PREAUTH 0x00000001 /* RNS pre-authentication enabled */ 816 struct iw_pmkid_cand 817 { 818 __u32 flags; /* IW_PMKID_CAND_* */ 819 __u32 index; /* the smaller the index, the higher the 820 * priority */ 821 struct sockaddr bssid; 822 }; 823 510 824 /* ------------------------ WIRELESS STATS ------------------------ */ 511 825 /* 512 826 * Wireless statistics (used for /proc/net/wireless) … … 610 924 /* Old Frequency (backward compat - moved lower ) */ 611 925 __u16 old_num_channels; 612 926 __u8 old_num_frequency; 613 /* Filler to keep "version" at the same offset */ 614 __s32 old_freq[6]; 927 928 /* Wireless event capability bitmasks */ 929 __u32 event_capa[6]; 615 930 616 931 /* signal level threshold range */ 617 __s32 sensitivity;932 __s32 sensitivity; 618 933 619 934 /* Quality of link & SNR stuff */ 620 935 /* Quality range (link, level, noise) … … 685 1000 struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */ 686 1001 /* Note : this frequency list doesn't need to fit channel numbers, 687 1002 * because each entry contain its channel index */ 1003 1004 __u32 enc_capa; /* IW_ENC_CAPA_* bit field */ 688 1005 }; 689 1006 690 1007 /* -
include/net/iw_handler.h
diff -Nur linux-2.4.32/include/net/iw_handler.h linux-2.4.32-we/include/net/iw_handler.h
old new 1 1 /* 2 2 * This file define the new driver API for Wireless Extensions 3 3 * 4 * Version : 5 4.12.024 * Version : 6 21.6.04 5 5 * 6 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 7 * Copyright (c) 2001-200 2Jean Tourrilhes, All Rights Reserved.7 * Copyright (c) 2001-2004 Jean Tourrilhes, All Rights Reserved. 8 8 */ 9 9 10 10 #ifndef _IW_HANDLER_H … … 206 206 * will be needed... 207 207 * I just plan to increment with each new version. 208 208 */ 209 #define IW_HANDLER_VERSION 5209 #define IW_HANDLER_VERSION 6 210 210 211 211 /* 212 212 * Changes : … … 224 224 * V4 to V5 225 225 * -------- 226 226 * - Add new spy support : struct iw_spy_data & prototypes 227 * 228 * V5 to V6 229 * -------- 230 * - Change the way we get to spy_data method for added safety 231 * - Remove spy #ifdef, they are always on -> cleaner code 232 * - Add IW_DESCR_FLAG_NOMAX flag for very large requests 233 * - Start migrating get_wireless_stats to struct iw_handler_def 227 234 */ 228 235 229 236 /**************************** CONSTANTS ****************************/ 230 237 231 /* En able enhanced spy support. Disable to reduce footprint*/238 /* Enhanced spy support available */ 232 239 #define IW_WIRELESS_SPY 233 240 #define IW_WIRELESS_THRSPY 234 241 … … 258 265 #define IW_DESCR_FLAG_EVENT 0x0002 /* Generate an event on SET */ 259 266 #define IW_DESCR_FLAG_RESTRICT 0x0004 /* GET : request is ROOT only */ 260 267 /* SET : Omit payload from generated iwevent */ 268 #define IW_DESCR_FLAG_NOMAX 0x0008 /* GET : no limit on request size */ 261 269 /* Driver level flags */ 262 270 #define IW_DESCR_FLAG_WAIT 0x0100 /* Wait for driver event */ 263 271 … … 311 319 /* Array of handlers for standard ioctls 312 320 * We will call dev->wireless_handlers->standard[ioctl - SIOCSIWNAME] 313 321 */ 314 iw_handler *standard;322 const iw_handler * standard; 315 323 316 324 /* Array of handlers for private ioctls 317 325 * Will call dev->wireless_handlers->private[ioctl - SIOCIWFIRSTPRIV] 318 326 */ 319 iw_handler *private;327 const iw_handler * private; 320 328 321 329 /* Arguments of private handler. This one is just a list, so you 322 330 * can put it in any order you want and should not leave holes... 323 331 * We will automatically export that to user space... */ 324 struct iw_priv_args * private_args;332 const struct iw_priv_args * private_args; 325 333 326 /* Driver enhanced spy support*/327 long spy_offset; /* Spy data offset*/334 /* This field will be *removed* in the next version of WE */ 335 long spy_offset; /* DO NOT USE */ 328 336 329 /* In the long term, get_wireless_stats will move from 330 * 'struct net_device' to here, to minimise bloat. */ 337 /* New location of get_wireless_stats, to de-bloat struct net_device. 338 * The old pointer in struct net_device will be gradually phased 339 * out, and drivers are encouraged to use this one... */ 340 struct iw_statistics* (*get_wireless_stats)(struct net_device *dev); 331 341 }; 332 342 333 343 /* ---------------------- IOCTL DESCRIPTION ---------------------- */ … … 374 384 */ 375 385 struct iw_spy_data 376 386 { 377 #ifdef IW_WIRELESS_SPY378 387 /* --- Standard spy support --- */ 379 388 int spy_number; 380 389 u_char spy_address[IW_MAX_SPY][ETH_ALEN]; 381 390 struct iw_quality spy_stat[IW_MAX_SPY]; 382 #ifdef IW_WIRELESS_THRSPY383 391 /* --- Enhanced spy support (event) */ 384 392 struct iw_quality spy_thr_low; /* Low threshold */ 385 393 struct iw_quality spy_thr_high; /* High threshold */ 386 394 u_char spy_thr_under[IW_MAX_SPY]; 387 #endif /* IW_WIRELESS_THRSPY */ 388 #endif /* IW_WIRELESS_SPY */ 395 }; 396 397 /* --------------------- DEVICE WIRELESS DATA --------------------- */ 398 /* 399 * This is all the wireless data specific to a device instance that 400 * is managed by the core of Wireless Extensions. 401 * We only keep pointer to those structures, so that a driver is free 402 * to share them between instances. 403 * This structure should be initialised before registering the device. 404 * Access to this data follow the same rules as any other struct net_device 405 * data (i.e. valid as long as struct net_device exist, same locking rules). 406 */ 407 struct iw_public_data { 408 /* Driver enhanced spy support */ 409 struct iw_spy_data * spy_data; 389 410 }; 390 411 391 412 /**************************** PROTOTYPES ****************************/ -
net/core/dev.c
diff -Nur linux-2.4.32/net/core/dev.c linux-2.4.32-we/net/core/dev.c
old new 2426 2426 /* Follow me in net/core/wireless.c */ 2427 2427 ret = wireless_process_ioctl(&ifr, cmd); 2428 2428 rtnl_unlock(); 2429 if ( !ret &&IW_IS_GET(cmd) &&2429 if (IW_IS_GET(cmd) && 2430 2430 copy_to_user(arg, &ifr, sizeof(struct ifreq))) 2431 2431 return -EFAULT; 2432 2432 return ret; -
net/core/wireless.c
diff -Nur linux-2.4.32/net/core/wireless.c linux-2.4.32-we/net/core/wireless.c
old new 2 2 * This file implement the Wireless Extensions APIs. 3 3 * 4 4 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 5 * Copyright (c) 1997-200 3Jean Tourrilhes, All Rights Reserved.5 * Copyright (c) 1997-2005 Jean Tourrilhes, All Rights Reserved. 6 6 * 7 7 * (As all part of the Linux kernel, this file is GPL) 8 8 */ … … 48 48 * o Add common spy support : iw_handler_set_spy(), wireless_spy_update() 49 49 * o Add enhanced spy support : iw_handler_set_thrspy() and event. 50 50 * o Add WIRELESS_EXT version display in /proc/net/wireless 51 * 52 * v6 - 18.06.04 - Jean II 53 * o Change get_spydata() method for added safety 54 * o Remove spy #ifdef, they are always on -> cleaner code 55 * o Allow any size GET request if user specifies length > max 56 * and if request has IW_DESCR_FLAG_NOMAX flag or is SIOCGIWPRIV 57 * o Start migrating get_wireless_stats to struct iw_handler_def 58 * o Add wmb() in iw_handler_set_spy() for non-coherent archs/cpus 59 * Based on patch from Pavel Roskin <proski@gnu.org> : 60 * o Fix kernel data leak to user space in private handler handling 51 61 */ 52 62 53 63 /***************************** INCLUDES *****************************/ … … 64 74 65 75 /**************************** CONSTANTS ****************************/ 66 76 67 /* Enough lenience, let's make sure things are proper... */ 68 #define WE_STRICT_WRITE /* Check write buffer size */ 69 /* I'll probably drop both the define and kernel message in the next version */ 70 71 /* Debuging stuff */ 77 /* Debugging stuff */ 72 78 #undef WE_IOCTL_DEBUG /* Debug IOCTL API */ 73 79 #undef WE_EVENT_DEBUG /* Debug Event dispatcher */ 74 80 #undef WE_SPY_DEBUG /* Debug enhanced spy support */ … … 131 137 { IW_HEADER_TYPE_ADDR, 0, 0, 0, 0, 0}, 132 138 /* SIOCGIWAP */ 133 139 { IW_HEADER_TYPE_ADDR, 0, 0, 0, 0, IW_DESCR_FLAG_DUMP}, 134 /* -- hole --*/135 { IW_HEADER_TYPE_ NULL, 0, 0, 0, 0, 0},140 /* SIOCSIWMLME */ 141 { IW_HEADER_TYPE_POINT, 0, 1, sizeof(struct iw_mlme), sizeof(struct iw_mlme), 0}, 136 142 /* SIOCGIWAPLIST */ 137 { IW_HEADER_TYPE_POINT, 0, (sizeof(struct sockaddr) + sizeof(struct iw_quality)), 0, IW_MAX_AP, 0},143 { IW_HEADER_TYPE_POINT, 0, (sizeof(struct sockaddr) + sizeof(struct iw_quality)), 0, IW_MAX_AP, IW_DESCR_FLAG_NOMAX}, 138 144 /* SIOCSIWSCAN */ 139 { IW_HEADER_TYPE_P ARAM, 0, 0, 0, 0, 0},145 { IW_HEADER_TYPE_POINT, 0, 1, 0, sizeof(struct iw_scan_req), 0}, 140 146 /* SIOCGIWSCAN */ 141 { IW_HEADER_TYPE_POINT, 0, 1, 0, IW_SCAN_MAX_DATA, 0},147 { IW_HEADER_TYPE_POINT, 0, 1, 0, IW_SCAN_MAX_DATA, IW_DESCR_FLAG_NOMAX}, 142 148 /* SIOCSIWESSID */ 143 149 { IW_HEADER_TYPE_POINT, 0, 1, 0, IW_ESSID_MAX_SIZE + 1, IW_DESCR_FLAG_EVENT}, 144 150 /* SIOCGIWESSID */ … … 179 185 { IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, 180 186 /* SIOCGIWPOWER */ 181 187 { IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, 188 /* -- hole -- */ 189 { IW_HEADER_TYPE_NULL, 0, 0, 0, 0, 0}, 190 /* -- hole -- */ 191 { IW_HEADER_TYPE_NULL, 0, 0, 0, 0, 0}, 192 /* SIOCSIWGENIE */ 193 { IW_HEADER_TYPE_POINT, 0, 1, 0, IW_GENERIC_IE_MAX, 0}, 194 /* SIOCGIWGENIE */ 195 { IW_HEADER_TYPE_POINT, 0, 1, 0, IW_GENERIC_IE_MAX, 0}, 196 /* SIOCSIWAUTH */ 197 { IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, 198 /* SIOCGIWAUTH */ 199 { IW_HEADER_TYPE_PARAM, 0, 0, 0, 0, 0}, 200 /* SIOCSIWENCODEEXT */ 201 { IW_HEADER_TYPE_POINT, 0, 1, sizeof(struct iw_encode_ext), sizeof(struct iw_encode_ext) + IW_ENCODING_TOKEN_MAX, 0}, 202 /* SIOCGIWENCODEEXT */ 203 { IW_HEADER_TYPE_POINT, 0, 1, sizeof(struct iw_encode_ext), sizeof(struct iw_encode_ext) + IW_ENCODING_TOKEN_MAX, 0}, 204 /* SIOCSIWPMKSA */ 205 { IW_HEADER_TYPE_POINT, 0, 1, sizeof(struct iw_pmksa), sizeof(struct iw_pmksa), 0}, 206 /* -- hole -- */ 182 207 }; 183 208 static const int standard_ioctl_num = (sizeof(standard_ioctl) / 184 209 sizeof(struct iw_ioctl_description)); … … 198 223 { IW_HEADER_TYPE_ADDR, 0, 0, 0, 0, 0}, 199 224 /* IWEVEXPIRED */ 200 225 { IW_HEADER_TYPE_ADDR, 0, 0, 0, 0, 0}, 226 /* IWEVGENIE */ 227 { IW_HEADER_TYPE_POINT, 0, 1, 0, IW_GENERIC_IE_MAX, 0}, 228 /* IWEVMICHAELMICFAILURE */ 229 { IW_HEADER_TYPE_POINT, 0, 1, 0, sizeof(struct iw_michaelmicfailure), 0}, 230 /* IWEVASSOCREQIE */ 231 { IW_HEADER_TYPE_POINT, 0, 1, 0, IW_GENERIC_IE_MAX, 0}, 232 /* IWEVASSOCRESPIE */ 233 { IW_HEADER_TYPE_POINT, 0, 1, 0, IW_GENERIC_IE_MAX, 0}, 234 /* IWEVPMKIDCAND */ 235 { IW_HEADER_TYPE_POINT, 0, 1, 0, sizeof(struct iw_pmkid_cand), 0}, 201 236 }; 202 237 static const int standard_event_num = (sizeof(standard_event) / 203 238 sizeof(struct iw_ioctl_description)); 204 239 205 240 /* Size (in bytes) of the various private data types */ 206 static const char priv_type_size[] = {241 static const char iw_priv_type_size[] = { 207 242 0, /* IW_PRIV_TYPE_NONE */ 208 243 1, /* IW_PRIV_TYPE_BYTE */ 209 244 1, /* IW_PRIV_TYPE_CHAR */ … … 270 305 */ 271 306 static inline struct iw_statistics *get_wireless_stats(struct net_device *dev) 272 307 { 308 /* New location */ 309 if((dev->wireless_handlers != NULL) && 310 (dev->wireless_handlers->get_wireless_stats != NULL)) 311 return dev->wireless_handlers->get_wireless_stats(dev); 312 313 /* Old location, will be phased out in next WE */ 273 314 return (dev->get_wireless_stats ? 274 315 dev->get_wireless_stats(dev) : 275 316 (struct iw_statistics *) NULL); 276 /* In the future, get_wireless_stats may move from 'struct net_device'277 * to 'struct iw_handler_def', to de-bloat struct net_device.278 * Definitely worse a thought... */279 317 } 280 318 281 319 /* ---------------------------------------------------------------- */ … … 310 348 311 349 /* ---------------------------------------------------------------- */ 312 350 /* 313 * Numberof private arguments351 * Calculate size of private arguments 314 352 */ 315 353 static inline int get_priv_size(__u16 args) 316 354 { 317 355 int num = args & IW_PRIV_SIZE_MASK; 318 356 int type = (args & IW_PRIV_TYPE_MASK) >> 12; 319 357 320 return num * priv_type_size[type]; 358 return num * iw_priv_type_size[type]; 359 } 360 361 /* ---------------------------------------------------------------- */ 362 /* 363 * Re-calculate the size of private arguments 364 */ 365 static inline int adjust_priv_size(__u16 args, 366 union iwreq_data * wrqu) 367 { 368 int num = wrqu->data.length; 369 int max = args & IW_PRIV_SIZE_MASK; 370 int type = (args & IW_PRIV_TYPE_MASK) >> 12; 371 372 /* Make sure the driver doesn't goof up */ 373 if (max < num) 374 num = max; 375 376 return num * iw_priv_type_size[type]; 321 377 } 322 378 323 379 … … 350 406 dev->name, 351 407 stats->status, 352 408 stats->qual.qual, 353 stats->qual.updated & 1 ? '.' : ' ', 409 stats->qual.updated & IW_QUAL_QUAL_UPDATED 410 ? '.' : ' ', 354 411 ((__u8) stats->qual.level), 355 stats->qual.updated & 2 ? '.' : ' ', 412 stats->qual.updated & IW_QUAL_LEVEL_UPDATED 413 ? '.' : ' ', 356 414 ((__u8) stats->qual.noise), 357 stats->qual.updated & 4 ? '.' : ' ', 415 stats->qual.updated & IW_QUAL_NOISE_UPDATED 416 ? '.' : ' ', 358 417 stats->discard.nwid, 359 418 stats->discard.code, 360 419 stats->discard.fragment, … … 470 529 /* Check NULL pointer */ 471 530 if(iwr->u.data.pointer == NULL) 472 531 return -EFAULT; 473 #ifdef WE_STRICT_WRITE 532 474 533 /* Check if there is enough buffer up there */ 475 534 if(iwr->u.data.length < dev->wireless_handlers->num_private_args) { 476 printk(KERN_ERR "%s (WE) : Buffer for request SIOCGIWPRIV too small (%d<%d)\n", dev->name, iwr->u.data.length, dev->wireless_handlers->num_private_args); 535 /* User space can't know in advance how large the buffer 536 * needs to be. Give it a hint, so that we can support 537 * any size buffer we want somewhat efficiently... */ 538 iwr->u.data.length = dev->wireless_handlers->num_private_args; 477 539 return -E2BIG; 478 540 } 479 #endif /* WE_STRICT_WRITE */480 541 481 542 /* Set the number of available ioctls. */ 482 543 iwr->u.data.length = dev->wireless_handlers->num_private_args; … … 505 566 const struct iw_ioctl_description * descr; 506 567 struct iw_request_info info; 507 568 int ret = -EINVAL; 508 int user_size = 0;509 569 510 570 /* Get the description of the IOCTL */ 511 571 if((cmd - SIOCIWFIRST) >= standard_ioctl_num) … … 536 596 #endif /* WE_SET_EVENT */ 537 597 } else { 538 598 char * extra; 599 int extra_size; 600 int user_length = 0; 539 601 int err; 540 602 603 /* Calculate space needed by arguments. Always allocate 604 * for max space. Easier, and won't last long... */ 605 extra_size = descr->max_tokens * descr->token_size; 606 541 607 /* Check what user space is giving us */ 542 608 if(IW_IS_SET(cmd)) { 543 609 /* Check NULL pointer */ … … 554 620 if(iwr->u.data.pointer == NULL) 555 621 return -EFAULT; 556 622 /* Save user space buffer size for checking */ 557 user_size = iwr->u.data.length; 623 user_length = iwr->u.data.length; 624 625 /* Don't check if user_length > max to allow forward 626 * compatibility. The test user_length < min is 627 * implied by the test at the end. */ 628 629 /* Support for very large requests */ 630 if((descr->flags & IW_DESCR_FLAG_NOMAX) && 631 (user_length > descr->max_tokens)) { 632 /* Allow userspace to GET more than max so 633 * we can support any size GET requests. 634 * There is still a limit : -ENOMEM. */ 635 extra_size = user_length * descr->token_size; 636 /* Note : user_length is originally a __u16, 637 * and token_size is controlled by us, 638 * so extra_size won't get negative and 639 * won't overflow... */ 640 } 558 641 } 559 642 560 643 #ifdef WE_IOCTL_DEBUG 561 644 printk(KERN_DEBUG "%s (WE) : Malloc %d bytes\n", 562 dev->name, descr->max_tokens * descr->token_size);645 dev->name, extra_size); 563 646 #endif /* WE_IOCTL_DEBUG */ 564 647 565 /* Always allocate for max space. Easier, and won't last 566 * long... */ 567 extra = kmalloc(descr->max_tokens * descr->token_size, 568 GFP_KERNEL); 648 /* Create the kernel buffer */ 649 extra = kmalloc(extra_size, GFP_KERNEL); 569 650 if (extra == NULL) { 570 651 return -ENOMEM; 571 652 } … … 591 672 592 673 /* If we have something to return to the user */ 593 674 if (!ret && IW_IS_GET(cmd)) { 594 #ifdef WE_STRICT_WRITE595 675 /* Check if there is enough buffer up there */ 596 if(user_size < iwr->u.data.length) { 597 printk(KERN_ERR "%s (WE) : Buffer for request %04X too small (%d<%d)\n", dev->name, cmd, user_size, iwr->u.data.length); 676 if(user_length < iwr->u.data.length) { 598 677 kfree(extra); 599 678 return -E2BIG; 600 679 } 601 #endif /* WE_STRICT_WRITE */602 680 603 681 err = copy_to_user(iwr->u.data.pointer, extra, 604 682 iwr->u.data.length * … … 661 739 iw_handler handler) 662 740 { 663 741 struct iwreq * iwr = (struct iwreq *) ifr; 664 struct iw_priv_args *descr = NULL;742 const struct iw_priv_args * descr = NULL; 665 743 struct iw_request_info info; 666 744 int extra_size = 0; 667 745 int i; … … 701 779 ((extra_size + offset) <= IFNAMSIZ)) 702 780 extra_size = 0; 703 781 } else { 704 /* Size of set arguments */782 /* Size of get arguments */ 705 783 extra_size = get_priv_size(descr->get_args); 706 784 707 785 /* Does it fits in iwr ? */ … … 771 849 772 850 /* If we have something to return to the user */ 773 851 if (!ret && IW_IS_GET(cmd)) { 852 853 /* Adjust for the actual length if it's variable, 854 * avoid leaking kernel bits outside. */ 855 if (!(descr->get_args & IW_PRIV_SIZE_FIXED)) { 856 extra_size = adjust_priv_size(descr->get_args, 857 &(iwr->u)); 858 } 859 774 860 err = copy_to_user(iwr->u.data.pointer, extra, 775 861 extra_size); 776 862 if (err) … … 1042 1128 * One of the main advantage of centralising spy support here is that 1043 1129 * it becomes much easier to improve and extend it without having to touch 1044 1130 * the drivers. One example is the addition of the Spy-Threshold events. 1045 * Note : IW_WIRELESS_SPY is defined in iw_handler.h1046 1131 */ 1047 1132 1133 /* ---------------------------------------------------------------- */ 1134 /* 1135 * Return the pointer to the spy data in the driver. 1136 * Because this is called on the Rx path via wireless_spy_update(), 1137 * we want it to be efficient... 1138 */ 1139 static inline struct iw_spy_data * get_spydata(struct net_device *dev) 1140 { 1141 /* This is the new way */ 1142 if(dev->wireless_data) 1143 return(dev->wireless_data->spy_data); 1144 1145 /* This is the old way. Doesn't work for multi-headed drivers. 1146 * It will be removed in the next version of WE. */ 1147 return (dev->priv + dev->wireless_handlers->spy_offset); 1148 } 1149 1048 1150 /*------------------------------------------------------------------*/ 1049 1151 /* 1050 1152 * Standard Wireless Handler : set Spy List … … 1054 1156 union iwreq_data * wrqu, 1055 1157 char * extra) 1056 1158 { 1057 #ifdef IW_WIRELESS_SPY 1058 struct iw_spy_data * spydata = (dev->priv + 1059 dev->wireless_handlers->spy_offset); 1159 struct iw_spy_data * spydata = get_spydata(dev); 1060 1160 struct sockaddr * address = (struct sockaddr *) extra; 1061 1161 1162 /* Make sure driver is not buggy or using the old API */ 1163 if(!spydata) 1164 return -EOPNOTSUPP; 1165 1062 1166 /* Disable spy collection while we copy the addresses. 1063 * As we don't disable interrupts, we need to do this to avoid races.1064 * As we are the only writer, this is good enough. */1167 * While we copy addresses, any call to wireless_spy_update() 1168 * will NOP. This is OK, as anyway the addresses are changing. */ 1065 1169 spydata->spy_number = 0; 1066 1170 1171 /* We want to operate without locking, because wireless_spy_update() 1172 * most likely will happen in the interrupt handler, and therefore 1173 * have its own locking constraints and needs performance. 1174 * The rtnl_lock() make sure we don't race with the other iw_handlers. 1175 * This make sure wireless_spy_update() "see" that the spy list 1176 * is temporarily disabled. */ 1177 wmb(); 1178 1067 1179 /* Are there are addresses to copy? */ 1068 1180 if(wrqu->data.length > 0) { 1069 1181 int i; … … 1089 1201 spydata->spy_address[i][5]); 1090 1202 #endif /* WE_SPY_DEBUG */ 1091 1203 } 1204 1205 /* Make sure above is updated before re-enabling */ 1206 wmb(); 1207 1092 1208 /* Enable addresses */ 1093 1209 spydata->spy_number = wrqu->data.length; 1094 1210 1095 1211 return 0; 1096 #else /* IW_WIRELESS_SPY */1097 return -EOPNOTSUPP;1098 #endif /* IW_WIRELESS_SPY */1099 1212 } 1100 1213 1101 1214 /*------------------------------------------------------------------*/ … … 1107 1220 union iwreq_data * wrqu, 1108 1221 char * extra) 1109 1222 { 1110 #ifdef IW_WIRELESS_SPY 1111 struct iw_spy_data * spydata = (dev->priv + 1112 dev->wireless_handlers->spy_offset); 1223 struct iw_spy_data * spydata = get_spydata(dev); 1113 1224 struct sockaddr * address = (struct sockaddr *) extra; 1114 1225 int i; 1115 1226 1227 /* Make sure driver is not buggy or using the old API */ 1228 if(!spydata) 1229 return -EOPNOTSUPP; 1230 1116 1231 wrqu->data.length = spydata->spy_number; 1117 1232 1118 1233 /* Copy addresses. */ … … 1129 1244 for(i = 0; i < spydata->spy_number; i++) 1130 1245 spydata->spy_stat[i].updated = 0; 1131 1246 return 0; 1132 #else /* IW_WIRELESS_SPY */1133 return -EOPNOTSUPP;1134 #endif /* IW_WIRELESS_SPY */1135 1247 } 1136 1248 1137 1249 /*------------------------------------------------------------------*/ … … 1143 1255 union iwreq_data * wrqu, 1144 1256 char * extra) 1145 1257 { 1146 #ifdef IW_WIRELESS_THRSPY 1147 struct iw_spy_data * spydata = (dev->priv + 1148 dev->wireless_handlers->spy_offset); 1258 struct iw_spy_data * spydata = get_spydata(dev); 1149 1259 struct iw_thrspy * threshold = (struct iw_thrspy *) extra; 1150 1260 1261 /* Make sure driver is not buggy or using the old API */ 1262 if(!spydata) 1263 return -EOPNOTSUPP; 1264 1151 1265 /* Just do it */ 1152 1266 memcpy(&(spydata->spy_thr_low), &(threshold->low), 1153 1267 2 * sizeof(struct iw_quality)); … … 1160 1274 #endif /* WE_SPY_DEBUG */ 1161 1275 1162 1276 return 0; 1163 #else /* IW_WIRELESS_THRSPY */1164 return -EOPNOTSUPP;1165 #endif /* IW_WIRELESS_THRSPY */1166 1277 } 1167 1278 1168 1279 /*------------------------------------------------------------------*/ … … 1174 1285 union iwreq_data * wrqu, 1175 1286 char * extra) 1176 1287 { 1177 #ifdef IW_WIRELESS_THRSPY 1178 struct iw_spy_data * spydata = (dev->priv + 1179 dev->wireless_handlers->spy_offset); 1288 struct iw_spy_data * spydata = get_spydata(dev); 1180 1289 struct iw_thrspy * threshold = (struct iw_thrspy *) extra; 1181 1290 1291 /* Make sure driver is not buggy or using the old API */ 1292 if(!spydata) 1293 return -EOPNOTSUPP; 1294 1182 1295 /* Just do it */ 1183 1296 memcpy(&(threshold->low), &(spydata->spy_thr_low), 1184 1297 2 * sizeof(struct iw_quality)); 1185 1298 1186 1299 return 0; 1187 #else /* IW_WIRELESS_THRSPY */1188 return -EOPNOTSUPP;1189 #endif /* IW_WIRELESS_THRSPY */1190 1300 } 1191 1301 1192 #ifdef IW_WIRELESS_THRSPY1193 1302 /*------------------------------------------------------------------*/ 1194 1303 /* 1195 1304 * Prepare and send a Spy Threshold event … … 1227 1336 /* Send event to user space */ 1228 1337 wireless_send_event(dev, SIOCGIWTHRSPY, &wrqu, (char *) &threshold); 1229 1338 } 1230 #endif /* IW_WIRELESS_THRSPY */1231 1339 1232 1340 /* ---------------------------------------------------------------- */ 1233 1341 /* … … 1240 1348 unsigned char * address, 1241 1349 struct iw_quality * wstats) 1242 1350 { 1243 #ifdef IW_WIRELESS_SPY 1244 struct iw_spy_data * spydata = (dev->priv + 1245 dev->wireless_handlers->spy_offset); 1351 struct iw_spy_data * spydata = get_spydata(dev); 1246 1352 int i; 1247 1353 int match = -1; 1248 1354 1355 /* Make sure driver is not buggy or using the old API */ 1356 if(!spydata) 1357 return; 1358 1249 1359 #ifdef WE_SPY_DEBUG 1250 1360 printk(KERN_DEBUG "wireless_spy_update() : offset %ld, spydata %p, address %02X:%02X:%02X:%02X:%02X:%02X\n", dev->wireless_handlers->spy_offset, spydata, address[0], address[1], address[2], address[3], address[4], address[5]); 1251 1361 #endif /* WE_SPY_DEBUG */ … … 1257 1367 sizeof(struct iw_quality)); 1258 1368 match = i; 1259 1369 } 1260 #ifdef IW_WIRELESS_THRSPY 1370 1261 1371 /* Generate an event if we cross the spy threshold. 1262 1372 * To avoid event storms, we have a simple hysteresis : we generate 1263 1373 * event only when we go under the low threshold or above the … … 1277 1387 } 1278 1388 } 1279 1389 } 1280 #endif /* IW_WIRELESS_THRSPY */1281 #endif /* IW_WIRELESS_SPY */1282 1390 }
Note:
See TracBrowser
for help on using the repository browser.
