summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure65
-rw-r--r--configure.in20
-rw-r--r--pcap-bt-linux.c5
4 files changed, 92 insertions, 1 deletions
diff --git a/config.h.in b/config.h.in
index 05a1c980..06dbf820 100644
--- a/config.h.in
+++ b/config.h.in
@@ -268,6 +268,9 @@
/* include ACN support */
#undef SITA
+/* if struct sockaddr_hci has hci_channel member */
+#undef SOCKADDR_HCI_HAS_HCI_CHANNEL
+
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
diff --git a/configure b/configure
index 88577c4e..f7291760 100755
--- a/configure
+++ b/configure
@@ -11489,6 +11489,71 @@ _ACEOF
{ echo "$as_me:$LINENO: Bluetooth sniffing is supported" >&5
echo "$as_me: Bluetooth sniffing is supported" >&6;}
+ #
+ # OK, does struct sockaddr_hci have an hci_channel
+ # member?
+ #
+ { echo "$as_me:$LINENO: checking if struct sockaddr_hci has hci_channel member" >&5
+echo $ECHO_N "checking if struct sockaddr_hci has hci_channel member... $ECHO_C" >&6; }
+ if test "${ac_cv_lbl_sockaddr_hci_has_hci_channel+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/hci.h>
+
+int
+main ()
+{
+u_int i = sizeof(((struct sockaddr_hci *)0)->hci_channel)
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_lbl_sockaddr_hci_has_hci_channel=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lbl_sockaddr_hci_has_hci_channel=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+ { echo "$as_me:$LINENO: result: $ac_cv_lbl_sockaddr_hci_has_hci_channel" >&5
+echo "${ECHO_T}$ac_cv_lbl_sockaddr_hci_has_hci_channel" >&6; }
+ if test $ac_cv_lbl_sockaddr_hci_has_hci_channel = yes ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define SOCKADDR_HCI_HAS_HCI_CHANNEL
+_ACEOF
+
+ fi
+
else
{ echo "$as_me:$LINENO: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&5
echo "$as_me: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&6;}
diff --git a/configure.in b/configure.in
index bd478413..b3a10abc 100644
--- a/configure.in
+++ b/configure.in
@@ -1413,6 +1413,26 @@ if test "x$enable_bluetooth" != "xno" ; then
AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
BT_SRC=pcap-bt-linux.c
AC_MSG_NOTICE(Bluetooth sniffing is supported)
+
+ #
+ # OK, does struct sockaddr_hci have an hci_channel
+ # member?
+ #
+ AC_MSG_CHECKING(if struct sockaddr_hci has hci_channel member)
+ AC_CACHE_VAL(ac_cv_lbl_sockaddr_hci_has_hci_channel,
+ AC_TRY_COMPILE(
+[
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/hci.h>
+],
+ [u_int i = sizeof(((struct sockaddr_hci *)0)->hci_channel)],
+ ac_cv_lbl_sockaddr_hci_has_hci_channel=yes,
+ ac_cv_lbl_sockaddr_hci_has_hci_channel=no))
+ AC_MSG_RESULT($ac_cv_lbl_sockaddr_hci_has_hci_channel)
+ if test $ac_cv_lbl_sockaddr_hci_has_hci_channel = yes ; then
+ AC_DEFINE(SOCKADDR_HCI_HAS_HCI_CHANNEL,,
+ [if struct sockaddr_hci has hci_channel member])
+ fi
],
AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
)
diff --git a/pcap-bt-linux.c b/pcap-bt-linux.c
index c951a7e2..037f64b9 100644
--- a/pcap-bt-linux.c
+++ b/pcap-bt-linux.c
@@ -78,7 +78,7 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str)
struct hci_dev_req *dev_req;
int i, sock;
int ret = 0;
-
+
sock = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
if (sock < 0)
{
@@ -254,6 +254,9 @@ bt_activate(pcap_t* handle)
/* Bind socket to the HCI device */
addr.hci_family = AF_BLUETOOTH;
addr.hci_dev = handle->md.ifindex;
+#ifdef SOCKADDR_HCI_HAS_HCI_CHANNEL
+ addr.hci_channel = HCI_CHANNEL_RAW;
+#endif
if (bind(handle->fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"Can't attach to device %d: %s", handle->md.ifindex,