560-indicate-features.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. --- a/hostapd/main.c
  2. +++ b/hostapd/main.c
  3. @@ -13,6 +13,7 @@
  4. #include "utils/common.h"
  5. #include "utils/eloop.h"
  6. +#include "utils/build_features.h"
  7. #include "crypto/random.h"
  8. #include "crypto/tls.h"
  9. #include "common/version.h"
  10. @@ -551,7 +552,7 @@ int main(int argc, char *argv[])
  11. wpa_supplicant_event = hostapd_wpa_event;
  12. for (;;) {
  13. - c = getopt(argc, argv, "Bde:f:hKP:tv");
  14. + c = getopt(argc, argv, "Bde:f:hKP:tv::");
  15. if (c < 0)
  16. break;
  17. switch (c) {
  18. @@ -583,6 +584,8 @@ int main(int argc, char *argv[])
  19. wpa_debug_timestamp++;
  20. break;
  21. case 'v':
  22. + if (optarg)
  23. + exit(!has_feature(optarg));
  24. show_version();
  25. exit(1);
  26. break;
  27. --- a/wpa_supplicant/main.c
  28. +++ b/wpa_supplicant/main.c
  29. @@ -12,6 +12,7 @@
  30. #endif /* __linux__ */
  31. #include "common.h"
  32. +#include "build_features.h"
  33. #include "wpa_supplicant_i.h"
  34. #include "driver_i.h"
  35. @@ -145,7 +146,7 @@ int main(int argc, char *argv[])
  36. for (;;) {
  37. c = getopt(argc, argv,
  38. - "b:Bc:C:D:de:f:g:hH:i:KLNo:O:p:P:qsTtuvW");
  39. + "b:Bc:C:D:de:f:g:hH:i:KLNo:O:p:P:qsTtuv::W");
  40. if (c < 0)
  41. break;
  42. switch (c) {
  43. @@ -237,8 +238,12 @@ int main(int argc, char *argv[])
  44. break;
  45. #endif /* CONFIG_DBUS */
  46. case 'v':
  47. - printf("%s\n", wpa_supplicant_version);
  48. - exitcode = 0;
  49. + if (optarg) {
  50. + exitcode = !has_feature(optarg);
  51. + } else {
  52. + printf("%s\n", wpa_supplicant_version);
  53. + exitcode = 0;
  54. + }
  55. goto out;
  56. case 'W':
  57. params.wait_for_monitor++;
  58. --- /dev/null
  59. +++ b/src/utils/build_features.h
  60. @@ -0,0 +1,17 @@
  61. +#ifndef BUILD_FEATURES_H
  62. +#define BUILD_FEATURES_H
  63. +
  64. +static inline int has_feature(const char *feat)
  65. +{
  66. +#ifdef IEEE8021X_EAPOL
  67. + if (!strcmp(feat, "eap"))
  68. + return 1;
  69. +#endif
  70. +#ifdef IEEE80211N
  71. + if (!strcmp(feat, "11n"))
  72. + return 1;
  73. +#endif
  74. + return 0;
  75. +}
  76. +
  77. +#endif /* BUILD_FEATURES_H */