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