hostapd: slightly clean up patches
[openwrt/openwrt.git] / package / network / services / hostapd / patches / 220-indicate-features.patch
1 From: Jo-Philipp Wich <jow@openwrt.org>
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
7 --- a/hostapd/main.c
8 +++ b/hostapd/main.c
9 @@ -31,7 +31,7 @@
10 #include "config_file.h"
11 #include "eap_register.h"
12 #include "ctrl_iface.h"
13 -
14 +#include "build_features.h"
15
16 struct hapd_global {
17 void **drv_priv;
18 @@ -806,7 +806,7 @@ int main(int argc, char *argv[])
19 wpa_supplicant_event = hostapd_wpa_event;
20 wpa_supplicant_event_global = hostapd_wpa_event_global;
21 for (;;) {
22 - c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:q");
23 + c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:g:G:qv::");
24 if (c < 0)
25 break;
26 switch (c) {
27 @@ -843,6 +843,8 @@ int main(int argc, char *argv[])
28 break;
29 #endif /* CONFIG_DEBUG_LINUX_TRACING */
30 case 'v':
31 + if (optarg)
32 + exit(!has_feature(optarg));
33 show_version();
34 exit(1);
35 case 'g':
36 --- a/wpa_supplicant/main.c
37 +++ b/wpa_supplicant/main.c
38 @@ -12,6 +12,7 @@
39 #endif /* __linux__ */
40
41 #include "common.h"
42 +#include "build_features.h"
43 #include "crypto/crypto.h"
44 #include "fst/fst.h"
45 #include "wpa_supplicant_i.h"
46 @@ -202,7 +203,7 @@ int main(int argc, char *argv[])
47
48 for (;;) {
49 c = getopt(argc, argv,
50 - "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW");
51 + "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuv::W");
52 if (c < 0)
53 break;
54 switch (c) {
55 @@ -302,8 +303,12 @@ int main(int argc, char *argv[])
56 break;
57 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
58 case 'v':
59 - printf("%s\n", wpa_supplicant_version);
60 - exitcode = 0;
61 + if (optarg) {
62 + exitcode = !has_feature(optarg);
63 + } else {
64 + printf("%s\n", wpa_supplicant_version);
65 + exitcode = 0;
66 + }
67 goto out;
68 case 'W':
69 params.wait_for_monitor++;