aboutsummaryrefslogtreecommitdiffstats
path: root/caputils
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2020-04-01 13:06:00 -0700
committerGuy Harris <gharris@sonic.net>2020-04-01 20:31:14 +0000
commit0975bf792a5609157349053385badca1f9c29cd7 (patch)
tree02d86aaa3294b2149865145873c49f064116de85 /caputils
parent8e5007442e73884b44b5cb204d9179d587607809 (diff)
Handle -k better on platforms that don't support it.
Have ws80211_init() return an indication that channel setting isn't supported on those platforms. In dumpcap, try to set up ws80211 before checking the channel argument and, if it fails, report the failure, rather than failing because the "convert channel name to channel code" routine fails. See https://ask.wireshark.org/question/15535/dumpcap-k-is-not-accepting-channel-type-values/ for an example of confusion caused by the previous behavior. Change-Id: I303f560704700bbcd4f0ecea041f8632744212f3 Reviewed-on: https://code.wireshark.org/review/36659 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
Diffstat (limited to 'caputils')
-rw-r--r--caputils/ws80211_utils.c8
-rw-r--r--caputils/ws80211_utils.h7
2 files changed, 10 insertions, 5 deletions
diff --git a/caputils/ws80211_utils.c b/caputils/ws80211_utils.c
index 1835052a97..c21d035ca7 100644
--- a/caputils/ws80211_utils.c
+++ b/caputils/ws80211_utils.c
@@ -102,7 +102,7 @@ int ws80211_init(void)
state->have_split_wiphy = TRUE;
#endif /* HAVE_NL80211_SPLIT_WIPHY_DUMP */
- return 0;
+ return WS80211_INIT_OK;
out_handle_destroy:
nl_socket_free(state->nl_sock);
@@ -933,9 +933,9 @@ const char *ws80211_get_helper_path(void) {
int ws80211_init(void)
{
if (airpcap_get_dll_state() == AIRPCAP_DLL_OK) {
- return 0;
+ return WS80211_INIT_OK;
}
- return -1;
+ return WS80211_INIT_NOT_SUPPORTED;
}
static const char *airpcap_dev_prefix_ = "\\\\.\\";
@@ -1198,7 +1198,7 @@ const char *ws80211_get_helper_path(void)
#else /* Everyone else. */
int ws80211_init(void)
{
- return -1;
+ return WS80211_INIT_NOT_SUPPORTED;
}
GArray* ws80211_find_interfaces(void)
diff --git a/caputils/ws80211_utils.h b/caputils/ws80211_utils.h
index d457cd4ebc..036d81c4d9 100644
--- a/caputils/ws80211_utils.h
+++ b/caputils/ws80211_utils.h
@@ -65,8 +65,13 @@ struct ws80211_iface_info {
* On Windows this checks the AirPcap status. It does *not* load the
* AirPcap DLL. That happens when the program starts.
*
- * @return 0 on success, an error value on failure.
+ * @return WS80211_INIT_OK on success, WS80211_INIT_NOT_SUPPORTED if the
+ * 802.11 environment isn't supported, or the negative of an errno value
+ * on failure.
*/
+#define WS80211_INIT_OK 0
+#define WS80211_INIT_NOT_SUPPORTED 1
+
int ws80211_init(void);
/** Build a list of 802.11 interfaces.