]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/linux/files/iw240_we15-6.diff
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / linux / files / iw240_we15-6.diff
1 diff -u -p linux/include/linux/wireless.14.h linux/include/linux/wireless.h
2 --- linux/include/linux/wireless.14.h   Mon Dec  2 18:51:00 2002
3 +++ linux/include/linux/wireless.h      Mon Dec  2 18:53:35 2002
4 @@ -1,7 +1,7 @@
5  /*
6   * This file define a set of standard wireless extensions
7   *
8 - * Version :   14      25.1.02
9 + * Version :   15      12.7.02
10   *
11   * Authors :   Jean Tourrilhes - HPL - <jt@hpl.hp.com>
12   * Copyright (c) 1997-2002 Jean Tourrilhes, All Rights Reserved.
13 @@ -80,7 +80,7 @@
14   * (there is some stuff that will be added in the future...)
15   * I just plan to increment with each new version.
16   */
17 -#define WIRELESS_EXT   14
18 +#define WIRELESS_EXT   15
19  
20  /*
21   * Changes :
22 @@ -153,17 +153,32 @@
23   *     - Define additional specific event numbers
24   *     - Add "addr" and "param" fields in union iwreq_data
25   *     - AP scanning stuff (SIOCSIWSCAN and friends)
26 + *
27 + * V14 to V15
28 + * ----------
29 + *     - Add IW_PRIV_TYPE_ADDR for struct sockaddr private arg
30 + *     - Make struct iw_freq signed (both m & e), add explicit padding
31 + *     - Add IWEVCUSTOM for driver specific event/scanning token
32 + *     - Add IW_MAX_GET_SPY for driver returning a lot of addresses
33 + *     - Add IW_TXPOW_RANGE for range of Tx Powers
34 + *     - Add IWEVREGISTERED & IWEVEXPIRED events for Access Points
35 + *     - Add IW_MODE_MONITOR for passive monitor
36   */
37  
38  /**************************** CONSTANTS ****************************/
39  
40  /* -------------------------- IOCTL LIST -------------------------- */
41  
42 -/* Basic operations */
43 +/* Wireless Identification */
44  #define SIOCSIWCOMMIT  0x8B00          /* Commit pending changes to driver */
45  #define SIOCGIWNAME    0x8B01          /* get name == wireless protocol */
46 -#define SIOCSIWNWID    0x8B02          /* set network id (the cell) */
47 -#define SIOCGIWNWID    0x8B03          /* get network id */
48 +/* SIOCGIWNAME is used to verify the presence of Wireless Extensions.
49 + * Common values : "IEEE 802.11-DS", "IEEE 802.11-FH", "IEEE 802.11b"...
50 + * Don't put the name of your driver there, it's useless. */
51 +
52 +/* Basic operations */
53 +#define SIOCSIWNWID    0x8B02          /* set network id (pre-802.11) */
54 +#define SIOCGIWNWID    0x8B03          /* get network id (the cell) */
55  #define SIOCSIWFREQ    0x8B04          /* set channel/frequency (Hz) */
56  #define SIOCGIWFREQ    0x8B05          /* get channel/frequency (Hz) */
57  #define SIOCSIWMODE    0x8B06          /* set operation mode */
58 @@ -178,16 +193,18 @@
59  #define SIOCGIWPRIV    0x8B0D          /* get private ioctl interface info */
60  #define SIOCSIWSTATS   0x8B0E          /* Unused */
61  #define SIOCGIWSTATS   0x8B0F          /* Get /proc/net/wireless stats */
62 +/* SIOCGIWSTATS is strictly used between user space and the kernel, and
63 + * is never passed to the driver (i.e. the driver will never see it). */
64  
65 -/* Mobile IP support */
66 +/* Mobile IP support (statistics per MAC address) */
67  #define SIOCSIWSPY     0x8B10          /* set spy addresses */
68  #define SIOCGIWSPY     0x8B11          /* get spy info (quality of link) */
69  
70  /* Access Point manipulation */
71  #define SIOCSIWAP      0x8B14          /* set access point MAC addresses */
72  #define SIOCGIWAP      0x8B15          /* get access point MAC addresses */
73 -#define SIOCGIWAPLIST  0x8B17          /* get list of access point in range */
74 -#define SIOCSIWSCAN    0x8B18          /* trigger scanning */
75 +#define SIOCGIWAPLIST  0x8B17          /* Deprecated in favor of scanning */
76 +#define SIOCSIWSCAN    0x8B18          /* trigger scanning (list cells) */
77  #define SIOCGIWSCAN    0x8B19          /* get scanning results */
78  
79  /* 802.11 specific support */
80 @@ -197,9 +214,7 @@
81  #define SIOCGIWNICKN   0x8B1D          /* get node name/nickname */
82  /* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit
83   * within the 'iwreq' structure, so we need to use the 'data' member to
84 - * point to a string in user space, like it is done for RANGE...
85 - * The "flags" member indicate if the ESSID is active or not (promiscuous).
86 - */
87 + * point to a string in user space, like it is done for RANGE... */
88  
89  /* Other parameters useful in 802.11 and some other devices */
90  #define SIOCSIWRATE    0x8B20          /* set default bit rate (bps) */
91 @@ -257,7 +272,10 @@
92  /* Most events use the same identifier as ioctl requests */
93  
94  #define IWEVTXDROP     0x8C00          /* Packet dropped to excessive retry */
95 -#define IWEVQUAL       0x8C01          /* Quality part of statistics */
96 +#define IWEVQUAL       0x8C01          /* Quality part of statistics (scan) */
97 +#define IWEVCUSTOM     0x8C02          /* Driver specific ascii string */
98 +#define IWEVREGISTERED 0x8C03          /* Discovered a new node (AP mode) */
99 +#define IWEVEXPIRED    0x8C04          /* Expired a node (AP mode) */
100  
101  #define IWEVFIRST      0x8C00
102  
103 @@ -273,7 +291,8 @@
104  #define IW_PRIV_TYPE_BYTE      0x1000  /* Char as number */
105  #define IW_PRIV_TYPE_CHAR      0x2000  /* Char as character */
106  #define IW_PRIV_TYPE_INT       0x4000  /* 32 bits int */
107 -#define IW_PRIV_TYPE_FLOAT     0x5000
108 +#define IW_PRIV_TYPE_FLOAT     0x5000  /* struct iw_freq */
109 +#define IW_PRIV_TYPE_ADDR      0x6000  /* struct sockaddr */
110  
111  #define IW_PRIV_SIZE_FIXED     0x0800  /* Variable or fixed nuber of args */
112  
113 @@ -297,13 +316,16 @@
114  
115  /* Maximum tx powers in the range struct */
116  #define IW_MAX_TXPOWER         8
117 +/* Note : if you more than 8 TXPowers, just set the max and min or
118 + * a few of them in the struct iw_range. */
119  
120  /* Maximum of address that you may set with SPY */
121 -#define IW_MAX_SPY             8
122 +#define IW_MAX_SPY             8       /* set */
123 +#define IW_MAX_GET_SPY         64      /* get */
124  
125  /* Maximum of address that you may get in the
126     list of access points in range */
127 -#define IW_MAX_AP              8
128 +#define IW_MAX_AP              64
129  
130  /* Maximum size of the ESSID and NICKN strings */
131  #define IW_ESSID_MAX_SIZE      32
132 @@ -315,6 +337,7 @@
133  #define IW_MODE_MASTER 3       /* Synchronisation master or Access Point */
134  #define IW_MODE_REPEAT 4       /* Wireless Repeater (forwarder) */
135  #define IW_MODE_SECOND 5       /* Secondary master/repeater (backup) */
136 +#define IW_MODE_MONITOR        6       /* Passive monitor (listen only) */
137  
138  /* Maximum number of size of encoding token available
139   * they are listed in the range structure */
140 @@ -350,8 +373,10 @@
141  #define IW_POWER_RELATIVE      0x0004  /* Value is not in seconds/ms/us */
142  
143  /* Transmit Power flags available */
144 +#define IW_TXPOW_TYPE          0x00FF  /* Type of value */
145  #define IW_TXPOW_DBM           0x0000  /* Value is in dBm */
146  #define IW_TXPOW_MWATT         0x0001  /* Value is in mW */
147 +#define IW_TXPOW_RANGE         0x1000  /* Range of value between min/max */
148  
149  /* Retry limits and lifetime flags available */
150  #define IW_RETRY_ON            0x0000  /* No details... */
151 @@ -376,6 +401,9 @@
152  /* Maximum size of returned data */
153  #define IW_SCAN_MAX_DATA       4096    /* In bytes */
154  
155 +/* Max number of char in custom event - use multiple of them if needed */
156 +#define IW_CUSTOM_MAX          256     /* In bytes */
157 +
158  /****************************** TYPES ******************************/
159  
160  /* --------------------------- SUBTYPES --------------------------- */
161 @@ -411,9 +439,10 @@ struct     iw_point
162   */
163  struct iw_freq
164  {
165 -       __u32           m;              /* Mantissa */
166 -       __u16           e;              /* Exponent */
167 +       __s32           m;              /* Mantissa */
168 +       __s16           e;              /* Exponent */
169         __u8            i;              /* List index (when in range struct) */
170 +       __u8            pad;            /* Unused - just for alignement */
171  };
172  
173  /*
174 diff -u -p linux/include/net/iw_handler.14.h linux/include/net/iw_handler.h
175 --- linux/include/net/iw_handler.14.h   Mon Dec  2 18:51:17 2002
176 +++ linux/include/net/iw_handler.h      Mon Dec  2 18:54:51 2002
177 @@ -1,7 +1,7 @@
178  /*
179   * This file define the new driver API for Wireless Extensions
180   *
181 - * Version :   3       17.1.02
182 + * Version :   4       21.6.02
183   *
184   * Authors :   Jean Tourrilhes - HPL - <jt@hpl.hp.com>
185   * Copyright (c) 2001-2002 Jean Tourrilhes, All Rights Reserved.
186 @@ -206,7 +206,7 @@
187   * will be needed...
188   * I just plan to increment with each new version.
189   */
190 -#define IW_HANDLER_VERSION     3
191 +#define IW_HANDLER_VERSION     4
192  
193  /*
194   * Changes :
195 @@ -217,6 +217,9 @@
196   *     - Add Wireless Event support :
197   *             o wireless_send_event() prototype
198   *             o iwe_stream_add_event/point() inline functions
199 + * V3 to V4
200 + * --------
201 + *     - Reshuffle IW_HEADER_TYPE_XXX to map IW_PRIV_TYPE_XXX changes
202   */
203  
204  /**************************** CONSTANTS ****************************/
205 @@ -233,10 +236,10 @@
206  #define IW_HEADER_TYPE_CHAR    2       /* char [IFNAMSIZ] */
207  #define IW_HEADER_TYPE_UINT    4       /* __u32 */
208  #define IW_HEADER_TYPE_FREQ    5       /* struct iw_freq */
209 -#define IW_HEADER_TYPE_POINT   6       /* struct iw_point */
210 -#define IW_HEADER_TYPE_PARAM   7       /* struct iw_param */
211 -#define IW_HEADER_TYPE_ADDR    8       /* struct sockaddr */
212 -#define IW_HEADER_TYPE_QUAL    9       /* struct iw_quality */
213 +#define IW_HEADER_TYPE_ADDR    6       /* struct sockaddr */
214 +#define IW_HEADER_TYPE_POINT   8       /* struct iw_point */
215 +#define IW_HEADER_TYPE_PARAM   9       /* struct iw_param */
216 +#define IW_HEADER_TYPE_QUAL    10      /* struct iw_quality */
217  
218  /* Handling flags */
219  /* Most are not implemented. I just use them as a reminder of some
220 diff -u -p linux/net/core/wireless.14.c linux/net/core/wireless.c
221 --- linux/net/core/wireless.14.c        Mon Dec  2 18:51:35 2002
222 +++ linux/net/core/wireless.c   Mon Dec  2 18:53:10 2002
223 @@ -33,8 +33,16 @@
224   *     o Propagate events as rtnetlink IFLA_WIRELESS option
225   *     o Generate event on selected SET requests
226   *
227 - * v4 - 18.04.01 - Jean II
228 + * v4 - 18.04.02 - Jean II
229   *     o Fix stupid off by one in iw_ioctl_description : IW_ESSID_MAX_SIZE + 1
230 + *
231 + * v5 - 21.06.02 - Jean II
232 + *     o Add IW_PRIV_TYPE_ADDR in priv_type_size (+cleanup)
233 + *     o Reshuffle IW_HEADER_TYPE_XXX to map IW_PRIV_TYPE_XXX changes
234 + *     o Add IWEVCUSTOM for driver specific event/scanning token
235 + *     o Turn on WE_STRICT_WRITE by default + kernel warning
236 + *     o Fix WE_STRICT_WRITE in ioctl_export_private() (32 => iw_num)
237 + *     o Fix off-by-one in test (extra_size <= IFNAMSIZ)
238   */
239  
240  /***************************** INCLUDES *****************************/
241 @@ -50,8 +58,9 @@
242  
243  /**************************** CONSTANTS ****************************/
244  
245 -/* This will be turned on later on... */
246 -#undef WE_STRICT_WRITE         /* Check write buffer size */
247 +/* Enough lenience, let's make sure things are proper... */
248 +#define WE_STRICT_WRITE                /* Check write buffer size */
249 +/* I'll probably drop both the define and kernel message in the next version */
250  
251  /* Debuging stuff */
252  #undef WE_IOCTL_DEBUG          /* Debug IOCTL API */
253 @@ -106,7 +115,7 @@ static const struct iw_ioctl_description
254         /* SIOCSIWSPY */
255         { IW_HEADER_TYPE_POINT, 0, sizeof(struct sockaddr), 0, IW_MAX_SPY, 0},
256         /* SIOCGIWSPY */
257 -       { IW_HEADER_TYPE_POINT, 0, (sizeof(struct sockaddr) + sizeof(struct iw_quality)), 0, IW_MAX_SPY, 0},
258 +       { IW_HEADER_TYPE_POINT, 0, (sizeof(struct sockaddr) + sizeof(struct iw_quality)), 0, IW_MAX_GET_SPY, 0},
259         /* -- hole -- */
260         { IW_HEADER_TYPE_NULL, 0, 0, 0, 0, 0},
261         /* -- hole -- */
262 @@ -176,25 +185,41 @@ static const struct iw_ioctl_description
263         { IW_HEADER_TYPE_ADDR, 0, 0, 0, 0, 0},
264         /* IWEVQUAL */
265         { IW_HEADER_TYPE_QUAL, 0, 0, 0, 0, 0},
266 +       /* IWEVCUSTOM */
267 +       { IW_HEADER_TYPE_POINT, 0, 1, 0, IW_CUSTOM_MAX, 0},
268 +       /* IWEVREGISTERED */
269 +       { IW_HEADER_TYPE_ADDR, 0, 0, 0, 0, 0},
270 +       /* IWEVEXPIRED */
271 +       { IW_HEADER_TYPE_ADDR, 0, 0, 0, 0, 0},
272  };
273  static const int standard_event_num = (sizeof(standard_event) /
274                                        sizeof(struct iw_ioctl_description));
275  
276  /* Size (in bytes) of the various private data types */
277 -static const char priv_type_size[] = { 0, 1, 1, 0, 4, 4, 0, 0 };
278 +static const char priv_type_size[] = {
279 +       0,                              /* IW_PRIV_TYPE_NONE */
280 +       1,                              /* IW_PRIV_TYPE_BYTE */
281 +       1,                              /* IW_PRIV_TYPE_CHAR */
282 +       0,                              /* Not defined */
283 +       sizeof(__u32),                  /* IW_PRIV_TYPE_INT */
284 +       sizeof(struct iw_freq),         /* IW_PRIV_TYPE_FLOAT */
285 +       sizeof(struct sockaddr),        /* IW_PRIV_TYPE_ADDR */
286 +       0,                              /* Not defined */
287 +};
288  
289  /* Size (in bytes) of various events */
290  static const int event_type_size[] = {
291 -       IW_EV_LCP_LEN,
292 +       IW_EV_LCP_LEN,                  /* IW_HEADER_TYPE_NULL */
293 +       0,
294 +       IW_EV_CHAR_LEN,                 /* IW_HEADER_TYPE_CHAR */
295         0,
296 -       IW_EV_CHAR_LEN,
297 +       IW_EV_UINT_LEN,                 /* IW_HEADER_TYPE_UINT */
298 +       IW_EV_FREQ_LEN,                 /* IW_HEADER_TYPE_FREQ */
299 +       IW_EV_ADDR_LEN,                 /* IW_HEADER_TYPE_ADDR */
300         0,
301 -       IW_EV_UINT_LEN,
302 -       IW_EV_FREQ_LEN,
303         IW_EV_POINT_LEN,                /* Without variable payload */
304 -       IW_EV_PARAM_LEN,
305 -       IW_EV_ADDR_LEN,
306 -       IW_EV_QUAL_LEN,
307 +       IW_EV_PARAM_LEN,                /* IW_HEADER_TYPE_PARAM */
308 +       IW_EV_QUAL_LEN,                 /* IW_HEADER_TYPE_QUAL */
309  };
310  
311  /************************ COMMON SUBROUTINES ************************/
312 @@ -440,8 +465,10 @@ static inline int ioctl_export_private(s
313                 return -EFAULT;
314  #ifdef WE_STRICT_WRITE
315         /* Check if there is enough buffer up there */
316 -       if(iwr->u.data.length < (SIOCIWLASTPRIV - SIOCIWFIRSTPRIV + 1))
317 +       if(iwr->u.data.length < dev->wireless_handlers->num_private_args) {
318 +               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);
319                 return -E2BIG;
320 +       }
321  #endif /* WE_STRICT_WRITE */
322  
323         /* Set the number of available ioctls. */
324 @@ -471,6 +498,7 @@ static inline int ioctl_standard_call(st
325         const struct iw_ioctl_description *     descr;
326         struct iw_request_info                  info;
327         int                                     ret = -EINVAL;
328 +       int                                     user_size = 0;
329  
330         /* Get the description of the IOCTL */
331         if((cmd - SIOCIWFIRST) >= standard_ioctl_num)
332 @@ -518,11 +546,8 @@ static inline int ioctl_standard_call(st
333                         /* Check NULL pointer */
334                         if(iwr->u.data.pointer == NULL)
335                                 return -EFAULT;
336 -#ifdef WE_STRICT_WRITE
337 -                       /* Check if there is enough buffer up there */
338 -                       if(iwr->u.data.length < descr->max_tokens)
339 -                               return -E2BIG;
340 -#endif /* WE_STRICT_WRITE */
341 +                       /* Save user space buffer size for checking */
342 +                       user_size = iwr->u.data.length;
343                 }
344  
345  #ifdef WE_IOCTL_DEBUG
346 @@ -559,6 +584,15 @@ static inline int ioctl_standard_call(st
347  
348                 /* If we have something to return to the user */
349                 if (!ret && IW_IS_GET(cmd)) {
350 +#ifdef WE_STRICT_WRITE
351 +                       /* Check if there is enough buffer up there */
352 +                       if(user_size < iwr->u.data.length) {
353 +                               printk(KERN_ERR "%s (WE) : Buffer for request %04X too small (%d<%d)\n", dev->name, cmd, user_size, iwr->u.data.length);
354 +                               kfree(extra);
355 +                               return -E2BIG;
356 +                       }
357 +#endif /* WE_STRICT_WRITE */
358 +
359                         err = copy_to_user(iwr->u.data.pointer, extra,
360                                            iwr->u.data.length *
361                                            descr->token_size);
362 @@ -646,12 +680,18 @@ static inline int ioctl_private_call(str
363         /* Compute the size of the set/get arguments */
364         if(descr != NULL) {
365                 if(IW_IS_SET(cmd)) {
366 +                       int     offset = 0;     /* For sub-ioctls */
367 +                       /* Check for sub-ioctl handler */
368 +                       if(descr->name[0] == '\0')
369 +                               /* Reserve one int for sub-ioctl index */
370 +                               offset = sizeof(__u32);
371 +
372                         /* Size of set arguments */
373                         extra_size = get_priv_size(descr->set_args);
374  
375                         /* Does it fits in iwr ? */
376                         if((descr->set_args & IW_PRIV_SIZE_FIXED) &&
377 -                          (extra_size < IFNAMSIZ))
378 +                          ((extra_size + offset) <= IFNAMSIZ))
379                                 extra_size = 0;
380                 } else {
381                         /* Size of set arguments */
382 @@ -659,7 +699,7 @@ static inline int ioctl_private_call(str
383  
384                         /* Does it fits in iwr ? */
385                         if((descr->get_args & IW_PRIV_SIZE_FIXED) &&
386 -                          (extra_size < IFNAMSIZ))
387 +                          (extra_size <= IFNAMSIZ))
388                                 extra_size = 0;
389                 }
390         }
391 @@ -925,7 +965,7 @@ void wireless_send_event(struct net_devi
392                  * The best the driver could do is to log an error message.
393                  * We will do it ourselves instead...
394                  */
395 -               printk(KERN_ERR "%s (WE) : Invalid Wireless Event (0x%04X)\n",
396 +               printk(KERN_ERR "%s (WE) : Invalid/Unknown Wireless Event (0x%04X)\n",
397                        dev->name, cmd);
398                 return;
399         }