Root/package/wireless-tools/patches/003-we_essential_def.patch

1--- a/iwlist.c
2+++ b/iwlist.c
3@@ -58,7 +58,6 @@ typedef struct iw_auth_descr
4  * Maybe this should go in iwlib.c ?
5  */
6 
7-#ifndef WE_ESSENTIAL
8 #define IW_ARRAY_LEN(x) (sizeof(x)/sizeof((x)[0]))
9 
10 //static const struct iwmask_name iw_enc_mode_name[] = {
11@@ -161,11 +160,8 @@ static const char * iw_ie_key_mgmt_name[
12 };
13 #define IW_IE_KEY_MGMT_NUM IW_ARRAY_LEN(iw_ie_key_mgmt_name)
14 
15-#endif /* WE_ESSENTIAL */
16-
17 /************************* WPA SUBROUTINES *************************/
18 
19-#ifndef WE_ESSENTIAL
20 /*------------------------------------------------------------------*/
21 /*
22  * Print all names corresponding to a mask.
23@@ -431,7 +427,6 @@ iw_print_gen_ie(unsigned char * buffer,
24       offset += buffer[offset+1] + 2;
25     }
26 }
27-#endif /* WE_ESSENTIAL */
28 
29 /***************************** SCANNING *****************************/
30 /*
31@@ -585,12 +580,10 @@ print_scanning_token(struct stream_descr
32              &event->u.qual, iw_range, has_range);
33       printf(" %s\n", buffer);
34       break;
35-#ifndef WE_ESSENTIAL
36     case IWEVGENIE:
37       /* Informations Elements are complex, let's do only some of them */
38       iw_print_gen_ie(event->u.data.pointer, event->u.data.length);
39       break;
40-#endif /* WE_ESSENTIAL */
41     case IWEVCUSTOM:
42       {
43     char custom[IW_CUSTOM_MAX+1];
44@@ -1302,7 +1295,6 @@ print_pm_info(int skfd,
45   return(0);
46 }
47 
48-#ifndef WE_ESSENTIAL
49 /************************** TRANSMIT POWER **************************/
50 
51 /*------------------------------------------------------------------*/
52@@ -1405,6 +1397,7 @@ print_txpower_info(int skfd,
53   return(0);
54 }
55 
56+#ifndef WE_ESSENTIAL
57 /*********************** RETRY LIMIT/LIFETIME ***********************/
58 
59 /*------------------------------------------------------------------*/
60@@ -2060,8 +2053,8 @@ static const struct iwlist_entry iwlist_
61   { "encryption", print_keys_info, 0, NULL },
62   { "keys", print_keys_info, 0, NULL },
63   { "power", print_pm_info, 0, NULL },
64-#ifndef WE_ESSENTIAL
65   { "txpower", print_txpower_info, 0, NULL },
66+#ifndef WE_ESSENTIAL
67   { "retry", print_retry_info, 0, NULL },
68   { "ap", print_ap_info, 0, NULL },
69   { "accesspoints", print_ap_info, 0, NULL },
70--- a/iwconfig.c
71+++ b/iwconfig.c
72@@ -106,16 +106,6 @@ get_info(int skfd,
73     if(wrq.u.data.length > 1)
74       info->has_nickname = 1;
75 
76- if((info->has_range) && (info->range.we_version_compiled > 9))
77- {
78- /* Get Transmit Power */
79- if(iw_get_ext(skfd, ifname, SIOCGIWTXPOW, &wrq) >= 0)
80- {
81- info->has_txpower = 1;
82- memcpy(&(info->txpower), &(wrq.u.txpower), sizeof(iwparam));
83- }
84- }
85-
86   /* Get sensitivity */
87   if(iw_get_ext(skfd, ifname, SIOCGIWSENS, &wrq) >= 0)
88     {
89@@ -132,6 +122,17 @@ get_info(int skfd,
90       memcpy(&(info->retry), &(wrq.u.retry), sizeof(iwparam));
91     }
92     }
93+#endif /* WE_ESSENTIAL */
94+
95+ if((info->has_range) && (info->range.we_version_compiled > 9))
96+ {
97+ /* Get Transmit Power */
98+ if(iw_get_ext(skfd, ifname, SIOCGIWTXPOW, &wrq) >= 0)
99+ {
100+ info->has_txpower = 1;
101+ memcpy(&(info->txpower), &(wrq.u.txpower), sizeof(iwparam));
102+ }
103+ }
104 
105   /* Get RTS threshold */
106   if(iw_get_ext(skfd, ifname, SIOCGIWRTS, &wrq) >= 0)
107@@ -146,7 +147,6 @@ get_info(int skfd,
108       info->has_frag = 1;
109       memcpy(&(info->frag), &(wrq.u.frag), sizeof(iwparam));
110     }
111-#endif /* WE_ESSENTIAL */
112 
113   return(0);
114 }
115@@ -269,7 +269,6 @@ display_info(struct wireless_info * info
116       printf("Bit Rate%c%s ", (info->bitrate.fixed ? '=' : ':'), buffer);
117     }
118 
119-#ifndef WE_ESSENTIAL
120   /* Display the Transmit Power */
121   if(info->has_txpower)
122     {
123@@ -286,6 +285,7 @@ display_info(struct wireless_info * info
124       printf("Tx-Power%c%s ", (info->txpower.fixed ? '=' : ':'), buffer);
125     }
126 
127+#ifndef WE_ESSENTIAL
128   /* Display sensitivity */
129   if(info->has_sens)
130     {
131@@ -340,6 +340,7 @@ display_info(struct wireless_info * info
132       printf(" ");
133       tokens += 5; /* Between 3 and 5, depend on flags */
134     }
135+#endif /* WE_ESSENTIAL */
136 
137   /* Display the RTS threshold */
138   if(info->has_rts)
139@@ -383,7 +384,6 @@ display_info(struct wireless_info * info
140   /* Formating */
141   if(tokens > 0)
142     printf("\n ");
143-#endif /* WE_ESSENTIAL */
144 
145   /* Display encryption information */
146   /* Note : we display only the "current" key, use iwlist to list all keys */
147@@ -1196,6 +1196,7 @@ set_nwid_info(int skfd,
148   /* 1 arg */
149   return(1);
150 }
151+#endif /* WE_ESSENTIAL */
152 
153 /*------------------------------------------------------------------*/
154 /*
155@@ -1362,6 +1363,7 @@ set_txpower_info(int skfd,
156   return(i);
157 }
158 
159+#ifndef WE_ESSENTIAL
160 /*------------------------------------------------------------------*/
161 /*
162  * Set Sensitivity
163@@ -1459,6 +1461,7 @@ set_retry_info(int skfd,
164   /* Var args */
165   return(i);
166 }
167+#endif /* WE_ESSENTIAL */
168 
169 /*------------------------------------------------------------------*/
170 /*
171@@ -1565,6 +1568,7 @@ set_frag_info(int skfd,
172   return(1);
173 }
174 
175+#ifndef WE_ESSENTIAL
176 /*------------------------------------------------------------------*/
177 /*
178  * Set Modulation
179@@ -1719,21 +1723,21 @@ static const struct iwconfig_entry iwcon
180     "Set Nickname", "NNN" },
181   { "nwid", set_nwid_info, 1, SIOCSIWNWID,
182     "Set NWID", "{NN|on|off}" },
183- { "ap", set_apaddr_info, 1, SIOCSIWAP,
184- "Set AP Address", "{N|off|auto}" },
185- { "txpower", set_txpower_info, 1, SIOCSIWTXPOW,
186- "Set Tx Power", "{NmW|NdBm|off|auto}" },
187   { "sens", set_sens_info, 1, SIOCSIWSENS,
188     "Set Sensitivity", "N" },
189+ { "modulation", set_modulation_info, 1, SIOCGIWMODUL,
190+ "Set Modulation", "{11g|11a|CCK|OFDMg|...}" },
191   { "retry", set_retry_info, 1, SIOCSIWRETRY,
192     "Set Retry Limit", "{limit N|lifetime N}" },
193+#endif /* WE_ESSENTIAL */
194+ { "ap", set_apaddr_info, 1, SIOCSIWAP,
195+ "Set AP Address", "{N|off|auto}" },
196+ { "txpower", set_txpower_info, 1, SIOCSIWTXPOW,
197+ "Set Tx Power", "{NmW|NdBm|off|auto}" },
198   { "rts", set_rts_info, 1, SIOCSIWRTS,
199     "Set RTS Threshold", "{N|auto|fixed|off}" },
200   { "frag", set_frag_info, 1, SIOCSIWFRAG,
201     "Set Fragmentation Threshold", "{N|auto|fixed|off}" },
202- { "modulation", set_modulation_info, 1, SIOCGIWMODUL,
203- "Set Modulation", "{11g|11a|CCK|OFDMg|...}" },
204-#endif /* WE_ESSENTIAL */
205   { "commit", set_commit_info, 0, SIOCSIWCOMMIT,
206     "Commit changes", "" },
207   { NULL, NULL, 0, 0, NULL, NULL },
208--- a/iwmulticall.c
209+++ b/iwmulticall.c
210@@ -81,7 +81,7 @@ extern int
211 #define main(args...) main_iwspy(args)
212 #include "iwspy.c"
213 #undef main
214-#endif /* WE_ESSENTIAL */
215+#endif
216 
217 /* Get iwpriv in there. Mandatory for HostAP and some other drivers. */
218 #define main(args...) main_iwpriv(args)
219@@ -90,12 +90,14 @@ extern int
220 #undef iw_usage
221 #undef main
222 
223+#ifndef WE_ESSENTIAL
224 /* Do we really need iwgetid ? Well, it's not like it's a big one */
225 #define main(args...) main_iwgetid(args)
226 #define iw_usage(args...) iwgetid_usage(args)
227 #include "iwgetid.c"
228 #undef iw_usage
229 #undef main
230+#endif
231 
232 /* iwevent is useless for most people, don't grab it ? */
233 
234@@ -131,11 +133,13 @@ main(int argc,
235 #ifndef WE_ESSENTIAL
236   if(!strcmp(call_name, "iwspy"))
237     return(main_iwspy(argc, argv));
238-#endif /* WE_ESSENTIAL */
239+#endif
240   if(!strcmp(call_name, "iwpriv"))
241     return(main_iwpriv(argc, argv));
242+#ifndef WE_ESSENTIAL
243   if(!strcmp(call_name, "iwgetid"))
244     return(main_iwgetid(argc, argv));
245+#endif
246 
247   /* Uh oh... Not supposed to come here. */
248   printf("iwmulticall : you are not supposed to call me this way...\n");
249--- a/iwlib.c
250+++ b/iwlib.c
251@@ -113,6 +113,7 @@ const struct iw_modul_descr iw_modul_lis
252   { IW_MODUL_11A, "11a", "IEEE 802.11a (5 GHz, up to 54 Mb/s)" },
253   { IW_MODUL_11B, "11b", "IEEE 802.11b (2.4 GHz, up to 11 Mb/s)" },
254 
255+#ifndef WE_ESSENTIAL
256   /* Proprietary aggregates */
257   { IW_MODUL_TURBO | IW_MODUL_11A, "turboa",
258     "Atheros turbo mode at 5 GHz (up to 108 Mb/s)" },
259@@ -120,6 +121,7 @@ const struct iw_modul_descr iw_modul_lis
260     "Atheros turbo mode at 2.4 GHz (up to 108 Mb/s)" },
261   { IW_MODUL_PBCC | IW_MODUL_11B, "11+",
262     "TI 802.11+ (2.4 GHz, up to 22 Mb/s)" },
263+#endif
264 
265   /* Individual modulations */
266   { IW_MODUL_OFDM_G, "OFDMg",
267@@ -129,6 +131,7 @@ const struct iw_modul_descr iw_modul_lis
268   { IW_MODUL_DS, "DS", "802.11 Direct Sequence (2.4 GHz, up to 2 Mb/s)" },
269   { IW_MODUL_FH, "FH", "802.11 Frequency Hopping (2,4 GHz, up to 2 Mb/s)" },
270 
271+#ifndef WE_ESSENTIAL
272   /* Proprietary modulations */
273   { IW_MODUL_TURBO, "turbo",
274     "Atheros turbo mode, channel bonding (up to 108 Mb/s)" },
275@@ -136,6 +139,7 @@ const struct iw_modul_descr iw_modul_lis
276     "TI 802.11+ higher rates (2.4 GHz, up to 22 Mb/s)" },
277   { IW_MODUL_CUSTOM, "custom",
278     "Driver specific modulation (check driver documentation)" },
279+#endif
280 };
281 
282 /* Disable runtime version warning in iw_get_range_info() */
283@@ -440,6 +444,7 @@ iw_print_version_info(const char * tooln
284       return -1;
285     }
286 
287+#ifndef WE_ESSENTIAL
288   /* Information about the tools themselves */
289   if(toolname != NULL)
290     printf("%-8.16s Wireless-Tools version %d\n", toolname, WT_VERSION);
291@@ -452,6 +457,7 @@ iw_print_version_info(const char * tooln
292   if(we_kernel_version > 15)
293     printf("Kernel Currently compiled with Wireless Extension v%d.\n\n",
294        we_kernel_version);
295+#endif
296 
297   /* Version for each device */
298   iw_enum_devices(skfd, &print_iface_version_info, NULL, 0);
299@@ -501,6 +507,7 @@ iw_get_range_info(int skfd,
300       /* Copy stuff at the right place, ignore extra */
301       memcpy((char *) range, buffer, sizeof(iwrange));
302     }
303+#ifndef WE_ESSENTIAL
304   else
305     {
306       /* Zero unknown fields */
307@@ -574,6 +581,7 @@ iw_get_range_info(int skfd,
308        * If the driver source has not been updated to the latest, it doesn't
309        * matter because the new fields are set to zero */
310     }
311+#endif
312 
313   /* Don't complain twice.
314    * In theory, the test apply to each individual driver, but usually
315@@ -1542,6 +1550,7 @@ iw_print_key(char * buffer,
316     }
317 }
318 
319+#ifndef WE_ESSENTIAL
320 /*------------------------------------------------------------------*/
321 /*
322  * Convert a passphrase into a key
323@@ -1556,6 +1565,7 @@ iw_pass_key(const char * input,
324   fprintf(stderr, "Error: Passphrase not implemented\n");
325   return(-1);
326 }
327+#endif
328 
329 /*------------------------------------------------------------------*/
330 /*
331@@ -1578,12 +1588,14 @@ iw_in_key(const char * input,
332     keylen = IW_ENCODING_TOKEN_MAX;
333       memcpy(key, input + 2, keylen);
334     }
335+#ifndef WE_ESSENTIAL
336   else
337     if(!strncmp(input, "p:", 2))
338       {
339     /* Second case : as a passphrase (PrismII cards) */
340     return(iw_pass_key(input + 2, key)); /* skip "p:" */
341       }
342+#endif
343     else
344       {
345     const char * p;
346--- a/Makefile
347+++ b/Makefile
348@@ -195,9 +195,9 @@ install-iwmulticall:: iwmulticall
349     install -m 755 $< $(INSTALL_DIR)/iwconfig
350     ( cd $(INSTALL_DIR) ; \
351       ln -f -s iwconfig iwlist ; \
352- ln -f -s iwconfig iwspy ; \
353+ $(if $(BUILD_WE_ESSENTIAL),,ln -f -s iwconfig iwspy ;) \
354       ln -f -s iwconfig iwpriv ; \
355- ln -f -s iwconfig iwgetid )
356+ $(if $(BUILD_WE_ESSENTIAL),,ln -f -s iwconfig iwgetid ) )
357 
358 clean::
359     $(RM_CMD)
360

Archive Download this file



interactive