460-indicate-features.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. --- a/hostapd/main.c
  2. +++ b/hostapd/main.c
  3. @@ -14,6 +14,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. @@ -546,7 +547,7 @@ int main(int argc, char *argv[])
  11. wpa_supplicant_event = hostapd_wpa_event;
  12. for (;;) {
  13. - c = getopt(argc, argv, "b:Bde:f:hKP:Ttvg:G:");
  14. + c = getopt(argc, argv, "b:Bde:f:hKP:Ttg:G:v::");
  15. if (c < 0)
  16. break;
  17. switch (c) {
  18. @@ -583,6 +584,8 @@ int main(int argc, char *argv[])
  19. break;
  20. #endif /* CONFIG_DEBUG_LINUX_TRACING */
  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. #include "p2p_supplicant.h"
  36. @@ -161,7 +162,7 @@ int main(int argc, char *argv[])
  37. for (;;) {
  38. c = getopt(argc, argv,
  39. - "b:Bc:C:D:de:f:g:G:hH:i:I:KLNo:O:p:P:qsTtuvW");
  40. + "b:Bc:C:D:de:f:g:G:hH:i:I:KLNo:O:p:P:qsTtuv::W");
  41. if (c < 0)
  42. break;
  43. switch (c) {
  44. @@ -259,8 +260,12 @@ int main(int argc, char *argv[])
  45. break;
  46. #endif /* CONFIG_DBUS */
  47. case 'v':
  48. - printf("%s\n", wpa_supplicant_version);
  49. - exitcode = 0;
  50. + if (optarg) {
  51. + exitcode = !has_feature(optarg);
  52. + } else {
  53. + printf("%s\n", wpa_supplicant_version);
  54. + exitcode = 0;
  55. + }
  56. goto out;
  57. case 'W':
  58. params.wait_for_monitor++;
  59. --- /dev/null
  60. +++ b/src/utils/build_features.h
  61. @@ -0,0 +1,17 @@
  62. +#ifndef BUILD_FEATURES_H
  63. +#define BUILD_FEATURES_H
  64. +
  65. +static inline int has_feature(const char *feat)
  66. +{
  67. +#ifdef IEEE8021X_EAPOL
  68. + if (!strcmp(feat, "eap"))
  69. + return 1;
  70. +#endif
  71. +#ifdef IEEE80211N
  72. + if (!strcmp(feat, "11n"))
  73. + return 1;
  74. +#endif
  75. + return 0;
  76. +}
  77. +
  78. +#endif /* BUILD_FEATURES_H */