003-we_essential_def.patch 11 KB

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