diff options
author | Anders Broman <anders.broman@ericsson.com> | 2012-09-04 08:57:03 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2012-09-04 08:57:03 +0000 |
commit | 342c344c1fc890ba2b0c68e4d60caf7fc9dfdead (patch) | |
tree | 0c7ef235ac04f33f2b77176fe50e52832ad3e4d4 | |
parent | 3ccb64d4900d9bb0fa78dc41735a62ba1820c37a (diff) |
From Pontus Fuchs:
Fall back to CMD_SET_WIPHY for older kernels.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6973
svn path=/trunk/; revision=44768
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | ws80211_utils.c | 14 |
2 files changed, 19 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 8a8c07dd64..8697d4dfc8 100644 --- a/configure.ac +++ b/configure.ac @@ -254,6 +254,13 @@ elif (test "${have_libnl1}" = "yes"); then enable_airpcap=no fi +AC_MSG_CHECKING([for NL80211_SET_CHANNEL]) + AC_TRY_COMPILE([#include <linux/nl80211.h>], + [enum nl80211_commands x = NL80211_CMD_SET_CHANNEL;], + [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NL80211_CMD_SET_CHANNEL, 1, [SET_CHANNEL is supported])], + [AC_MSG_RESULT(no)]) + + AC_ARG_WITH([gtk3], AC_HELP_STRING( [--with-gtk3=@<:@yes/no@:>@], [use GTK+ 3.0 instead of 2.0 @<:@default=no@:>@]), diff --git a/ws80211_utils.c b/ws80211_utils.c index 8dde38e16e..95c6d20fc3 100644 --- a/ws80211_utils.c +++ b/ws80211_utils.c @@ -177,7 +177,6 @@ static int get_phys_handler(struct nl_msg *msg, void *arg) struct nlattr *nl_band; struct nlattr *nl_freq; - struct nlattr *nl_cmd; struct nlattr *nl_mode; int bandidx = 1; int rem_band, rem_freq, rem_mode; @@ -243,14 +242,19 @@ static int get_phys_handler(struct nl_msg *msg, void *arg) } } - /* Can frequency be set? */ + /* Can frequency be set? Only newer versions of cfg80211 supports this */ +#ifdef HAVE_NL80211_CMD_SET_CHANNEL if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) { int cmd; + struct nlattr *nl_cmd; nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], cmd) { if(nla_get_u32(nl_cmd) == NL80211_CMD_SET_CHANNEL) iface->can_set_freq = TRUE; } } +#else + iface->can_set_freq = TRUE; +#endif g_array_append_val(cookie->interfaces, iface); return NL_SKIP; @@ -539,8 +543,14 @@ int ws80211_set_freq(const char *name, int freq, int chan_type) devidx = if_nametoindex(name); +#ifdef HAVE_NL80211_CMD_SET_CHANNEL genlmsg_put(msg, 0, 0, nl_state.nl80211_id, 0, 0, NL80211_CMD_SET_CHANNEL, 0); +#else + genlmsg_put(msg, 0, 0, nl_state.nl80211_id, 0, + 0, NL80211_CMD_SET_WIPHY, 0); +#endif + NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, devidx); NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq); |