]>
Commit | Line | Data |
---|---|---|
92379080 EQ |
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 | ||
059d4bad JPW |
7 | --- a/hostapd/main.c |
8 | +++ b/hostapd/main.c | |
c35ff1af DB |
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; | |
24d0e746 | 18 | @@ -806,7 +806,7 @@ int main(int argc, char *argv[]) |
059d4bad | 19 | wpa_supplicant_event = hostapd_wpa_event; |
13b44abc | 20 | wpa_supplicant_event_global = hostapd_wpa_event_global; |
059d4bad | 21 | for (;;) { |
c35ff1af | 22 | - c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:q"); |
f03b2083 | 23 | + c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:g:G:qv::"); |
059d4bad JPW |
24 | if (c < 0) |
25 | break; | |
26 | switch (c) { | |
24d0e746 | 27 | @@ -843,6 +843,8 @@ int main(int argc, char *argv[]) |
059d4bad | 28 | break; |
1d75f750 | 29 | #endif /* CONFIG_DEBUG_LINUX_TRACING */ |
059d4bad JPW |
30 | case 'v': |
31 | + if (optarg) | |
32 | + exit(!has_feature(optarg)); | |
33 | show_version(); | |
34 | exit(1); | |
c35ff1af | 35 | case 'g': |
059d4bad JPW |
36 | --- a/wpa_supplicant/main.c |
37 | +++ b/wpa_supplicant/main.c | |
4225e4b2 | 38 | @@ -12,6 +12,7 @@ |
059d4bad JPW |
39 | #endif /* __linux__ */ |
40 | ||
41 | #include "common.h" | |
42 | +#include "build_features.h" | |
c35ff1af | 43 | #include "crypto/crypto.h" |
924407b2 | 44 | #include "fst/fst.h" |
059d4bad | 45 | #include "wpa_supplicant_i.h" |
847984c7 | 46 | @@ -202,7 +203,7 @@ int main(int argc, char *argv[]) |
059d4bad JPW |
47 | |
48 | for (;;) { | |
d4d223ed | 49 | c = getopt(argc, argv, |
847984c7 FF |
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"); | |
059d4bad JPW |
52 | if (c < 0) |
53 | break; | |
54 | switch (c) { | |
847984c7 | 55 | @@ -302,8 +303,12 @@ int main(int argc, char *argv[]) |
059d4bad | 56 | break; |
8af79550 | 57 | #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ |
059d4bad JPW |
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++; |