220-indicate-features.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. From: Jo-Philipp Wich <[email protected]>
  2. Date: Mon, 12 Dec 2011 17:26:13 +0000
  3. Subject: [PATCH] hostapd: support optional argument for the -v switch of
  4. hostapd and wpa_supplicant to query build features, e.g. hostapd -veap to
  5. test whether 802.11i support is compiled in
  6. --- a/hostapd/main.c
  7. +++ b/hostapd/main.c
  8. @@ -31,7 +31,7 @@
  9. #include "config_file.h"
  10. #include "eap_register.h"
  11. #include "ctrl_iface.h"
  12. -
  13. +#include "build_features.h"
  14. struct hapd_global {
  15. void **drv_priv;
  16. @@ -806,7 +806,7 @@ int main(int argc, char *argv[])
  17. wpa_supplicant_event = hostapd_wpa_event;
  18. wpa_supplicant_event_global = hostapd_wpa_event_global;
  19. for (;;) {
  20. - c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:q");
  21. + c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:g:G:qv::");
  22. if (c < 0)
  23. break;
  24. switch (c) {
  25. @@ -843,6 +843,8 @@ int main(int argc, char *argv[])
  26. break;
  27. #endif /* CONFIG_DEBUG_LINUX_TRACING */
  28. case 'v':
  29. + if (optarg)
  30. + exit(!has_feature(optarg));
  31. show_version();
  32. exit(1);
  33. case 'g':
  34. --- a/wpa_supplicant/main.c
  35. +++ b/wpa_supplicant/main.c
  36. @@ -12,6 +12,7 @@
  37. #endif /* __linux__ */
  38. #include "common.h"
  39. +#include "build_features.h"
  40. #include "crypto/crypto.h"
  41. #include "fst/fst.h"
  42. #include "wpa_supplicant_i.h"
  43. @@ -202,7 +203,7 @@ int main(int argc, char *argv[])
  44. for (;;) {
  45. c = getopt(argc, argv,
  46. - "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW");
  47. + "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuv::W");
  48. if (c < 0)
  49. break;
  50. switch (c) {
  51. @@ -302,8 +303,12 @@ int main(int argc, char *argv[])
  52. break;
  53. #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
  54. case 'v':
  55. - printf("%s\n", wpa_supplicant_version);
  56. - exitcode = 0;
  57. + if (optarg) {
  58. + exitcode = !has_feature(optarg);
  59. + } else {
  60. + printf("%s\n", wpa_supplicant_version);
  61. + exitcode = 0;
  62. + }
  63. goto out;
  64. case 'W':
  65. params.wait_for_monitor++;