diff options
author | plunky <plunky@pkgsrc.org> | 2010-12-19 20:20:42 +0000 |
---|---|---|
committer | plunky <plunky@pkgsrc.org> | 2010-12-19 20:20:42 +0000 |
commit | fdf374686dea94d69214a72bfb141c9bbf110d47 (patch) | |
tree | 331634c0ae6db4e00dc39ccb5755cab43894698a /sysutils | |
parent | a51b67deb132d0236d0a8f57a92969607c37ef18 (diff) | |
download | pkgsrc-fdf374686dea94d69214a72bfb141c9bbf110d47.tar.gz |
HCIdump reads raw HCI data coming from and going to a Bluetooth device and
prints to screen commands, events and data in a human-readable form.
Optionally, the dump can be written to a file rather than parsed, and the dump
file can be parsed in a subsequent moment.
This is a patched standalone version not requiring bluez-libs, suitable
for use with the netbt Bluetooth stack [originating] in NetBSD.
--
the sysutils/hcidump package (which this will replace) is a descendent of a
previous version of the bluez-hcidump package.
Diffstat (limited to 'sysutils')
22 files changed, 882 insertions, 0 deletions
diff --git a/sysutils/netbt-hcidump/DESCR b/sysutils/netbt-hcidump/DESCR new file mode 100644 index 00000000000..aa98e54d3b8 --- /dev/null +++ b/sysutils/netbt-hcidump/DESCR @@ -0,0 +1,7 @@ +HCIdump reads raw HCI data coming from and going to a Bluetooth device and +prints to screen commands, events and data in a human-readable form. +Optionally, the dump can be written to a file rather than parsed, and the dump +file can be parsed in a subsequent moment. + +This is a patched standalone version not requiring bluez-libs, suitable +for use with the netbt Bluetooth stack [originating] in NetBSD. diff --git a/sysutils/netbt-hcidump/Makefile b/sysutils/netbt-hcidump/Makefile new file mode 100644 index 00000000000..b96db985e6c --- /dev/null +++ b/sysutils/netbt-hcidump/Makefile @@ -0,0 +1,41 @@ +# $NetBSD: Makefile,v 1.1.1.1 2010/12/19 20:20:42 plunky Exp $ + +DISTNAME= netbt-hcidump-1.42 +CATEGORIES= sysutils +MASTER_SITES= http://bluez.sourceforge.net/download/ \ + http://www.kernel.org/pub/linux/bluetooth/ +DISTFILES= bluez-hcidump-1.42.tar.gz \ + bluez-4.81.tar.gz + +MAINTAINER= plunky@rya-online.net +HOMEPAGE= http://www.bluez.org/ +COMMENT= Bluetooth packet analyzer (netbt version) + +LICENSE= gnu-gpl-v2 + +ONLY_FOR_PLATFORM= NetBSD-[4-9].*-* +CONFLICTS+= hcidump-[0-9]* bluez-hcidump-[0-9]* + +INSTALLATION_DIRS= sbin ${PKGMANDIR}/cat8 ${PKGMANDIR}/man8 + +WRKSRC= ${WRKDIR}/bluez-hcidump-1.42 +LIBSRC= ${WRKDIR}/bluez-4.81 + +PKG_DESTDIR_SUPPORT= user-destdir + +.include "options.mk" + +CPPFLAGS+= -DVERSION=\""1.42-netbt"\" + +USE_BSD_MAKEFILE= yes + +post-extract: + mkdir ${WRKSRC}/bluetooth + cp ${LIBSRC}/lib/bluetooth.h ${WRKSRC}/bluetooth + cp ${LIBSRC}/lib/hci.h ${WRKSRC}/bluetooth + cp ${LIBSRC}/lib/hci_lib.h ${WRKSRC}/bluetooth + cp ${LIBSRC}/lib/l2cap.h ${WRKSRC}/bluetooth + cp ${LIBSRC}/lib/bluetooth.c ${WRKSRC}/src/bt_lib.c + cp ${LIBSRC}/lib/hci.c ${WRKSRC}/src/hci_lib.c + +.include "../../mk/bsd.pkg.mk" diff --git a/sysutils/netbt-hcidump/PLIST b/sysutils/netbt-hcidump/PLIST new file mode 100644 index 00000000000..a99e453b478 --- /dev/null +++ b/sysutils/netbt-hcidump/PLIST @@ -0,0 +1,4 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2010/12/19 20:20:42 plunky Exp $ +man/cat8/hcidump.0 +man/man8/hcidump.8 +sbin/hcidump diff --git a/sysutils/netbt-hcidump/distinfo b/sysutils/netbt-hcidump/distinfo new file mode 100644 index 00000000000..e23434c353c --- /dev/null +++ b/sysutils/netbt-hcidump/distinfo @@ -0,0 +1,25 @@ +$NetBSD: distinfo,v 1.1.1.1 2010/12/19 20:20:42 plunky Exp $ + +SHA1 (bluez-4.81.tar.gz) = 852c79e2af55ca7db4e4dd66a2e98f839464093b +RMD160 (bluez-4.81.tar.gz) = 700c3ac877279bcb4636ed175ea3cdbb04107967 +Size (bluez-4.81.tar.gz) = 1104444 bytes +SHA1 (bluez-hcidump-1.42.tar.gz) = b18e41cbf92c00cfd0331506312fa248b39a0eee +RMD160 (bluez-hcidump-1.42.tar.gz) = c80eab49c75b8782d35e64eecfbc5a0e56214d4c +Size (bluez-hcidump-1.42.tar.gz) = 150060 bytes +SHA1 (patch-aa) = 6e30f3bd8e06e152bd2b65b32e173de039320787 +SHA1 (patch-ab) = b938aa1d4cba4891b58e7d4a2add3e88f86605f7 +SHA1 (patch-ac) = adbc1e33996e61ccc5c016154bee3c4af72d784d +SHA1 (patch-ad) = b7007a6c55011ac6a1da2fd1883f953532d75ea5 +SHA1 (patch-ae) = e59424e971879f368c09adae894088952612f1be +SHA1 (patch-af) = 7748d6d83ce118eff90b9d8158badd0664faa308 +SHA1 (patch-ag) = 858aa64a1495b81231a0ebd20b1b14576d3fbaab +SHA1 (patch-ah) = b5a190251ccb9e55d2ac8460a436df3026d6be3d +SHA1 (patch-ai) = 46239a7931f8fecee9216b13f98227711c69c54d +SHA1 (patch-aj) = 3ef708a26e82ea209ef66c556889ba0cb9c9dd86 +SHA1 (patch-ak) = 0d7d144bb67cd5ebf8e3c74fbb0fbdcce87bc4ac +SHA1 (patch-al) = cdef6a512fc1fa4e64c59ae43ce07506103061d4 +SHA1 (patch-am) = 0f3d33c1f06edabed5fef4500109a83eff599219 +SHA1 (patch-an) = 35d9fd1b0d82addf0688e2997fdf589fbc89d921 +SHA1 (patch-ao) = 519b39a8dc2217c06d618c45029df6bd4437117a +SHA1 (patch-ap) = f957985946117ffadcd10c39bfe74e132e173c86 +SHA1 (patch-aq) = a6a49e3469768971121def3cf329f16be53c2e1e diff --git a/sysutils/netbt-hcidump/options.mk b/sysutils/netbt-hcidump/options.mk new file mode 100644 index 00000000000..5414fca6078 --- /dev/null +++ b/sysutils/netbt-hcidump/options.mk @@ -0,0 +1,11 @@ +# $NetBSD: options.mk,v 1.1.1.1 2010/12/19 20:20:42 plunky Exp $ + +PKG_OPTIONS_VAR= PKG_OPTIONS.hcidump +PKG_SUPPORTED_OPTIONS= inet6 +PKG_SUGGESTED_OPTIONS= inet6 + +.include "../../mk/bsd.options.mk" + +.if !empty(PKG_OPTIONS:Minet6) +CPPFLAGS+= -DINET6 +.endif diff --git a/sysutils/netbt-hcidump/patches/patch-aa b/sysutils/netbt-hcidump/patches/patch-aa new file mode 100644 index 00000000000..def004fbcc4 --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-aa @@ -0,0 +1,9 @@ +$NetBSD: patch-aa,v 1.1.1.1 2010/12/19 20:20:42 plunky Exp $ + +--- Makefile.orig 2009-11-30 19:29:18.000000000 +0000 ++++ Makefile +@@ -0,0 +1,4 @@ ++ ++SUBDIR+= src ++ ++.include <bsd.subdir.mk> diff --git a/sysutils/netbt-hcidump/patches/patch-ab b/sysutils/netbt-hcidump/patches/patch-ab new file mode 100644 index 00000000000..f44d6443d38 --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-ab @@ -0,0 +1,75 @@ +$NetBSD: patch-ab,v 1.1.1.1 2010/12/19 20:20:42 plunky Exp $ + +--- bluetooth/bluetooth.h.orig 2009-11-30 19:29:17.000000000 +0000 ++++ bluetooth/bluetooth.h +@@ -30,6 +30,7 @@ + extern "C" { + #endif + ++#if 0 + #include <stdio.h> + #include <stdint.h> + #include <string.h> +@@ -97,6 +98,17 @@ enum { + #else + #error "Unknown byte order" + #endif ++#else ++#include <bluetooth.h> ++#include <string.h> ++ ++#define SOL_HCI BTPROTO_HCI ++ ++#define htobs(d) htole16(d) ++#define htobl(d) htole32(d) ++#define btohs(d) le16toh(d) ++#define btohl(d) le32toh(d) ++#endif + + /* Bluetooth unaligned access */ + #define bt_get_unaligned(ptr) \ +@@ -115,6 +127,7 @@ do { \ + __p->__v = (val); \ + } while(0) + ++#if 0 + /* BD Address */ + typedef struct { + uint8_t b[6]; +@@ -123,6 +136,7 @@ typedef struct { + #define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) + #define BDADDR_ALL (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}) + #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) ++#endif + + /* Copy, swap, convert BD Address */ + static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2) +@@ -135,9 +149,12 @@ static inline void bacpy(bdaddr_t *dst, + } + + void baswap(bdaddr_t *dst, const bdaddr_t *src); ++#if 0 + bdaddr_t *strtoba(const char *str); + char *batostr(const bdaddr_t *ba); ++#endif + int ba2str(const bdaddr_t *ba, char *str); ++#if 0 + int str2ba(const char *str, bdaddr_t *ba); + int ba2oui(const bdaddr_t *ba, char *oui); + int bachk(const char *str); +@@ -146,12 +163,15 @@ int baprintf(const char *format, ...); + int bafprintf(FILE *stream, const char *format, ...); + int basprintf(char *str, const char *format, ...); + int basnprintf(char *str, size_t size, const char *format, ...); ++#endif + + void *bt_malloc(size_t size); + void bt_free(void *ptr); + ++#if 0 + int bt_error(uint16_t code); + char *bt_compidtostr(int id); ++#endif + + #ifdef __cplusplus + } diff --git a/sysutils/netbt-hcidump/patches/patch-ac b/sysutils/netbt-hcidump/patches/patch-ac new file mode 100644 index 00000000000..2988c856661 --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-ac @@ -0,0 +1,41 @@ +$NetBSD: patch-ac,v 1.1.1.1 2010/12/19 20:20:42 plunky Exp $ + +--- bluetooth/hci.h.orig 2010-09-30 08:53:08.000000000 +0000 ++++ bluetooth/hci.h +@@ -39,6 +39,7 @@ extern "C" { + #define HCI_MAX_EVENT_SIZE 260 + #define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4) + ++#if 0 + /* HCI dev events */ + #define HCI_DEV_REG 1 + #define HCI_DEV_UNREG 2 +@@ -101,6 +102,7 @@ enum { + #define HCIUNBLOCKADDR _IOW('H', 231, int) + + #define HCIINQUIRY _IOR('H', 240, int) ++#endif + + #ifndef __NO_HCI_DEFS + +@@ -2232,6 +2234,7 @@ typedef struct { + + #endif /* _NO_HCI_DEFS */ + ++#if 0 + /* HCI Socket options */ + #define HCI_DATA_DIR 1 + #define HCI_FILTER 2 +@@ -2339,6 +2342,12 @@ struct hci_inquiry_req { + uint8_t num_rsp; + }; + #define IREQ_CACHE_FLUSH 0x0001 ++#else ++#define HCI_CMSG_DIR SCM_HCI_DIRECTION ++#define HCI_CMSG_TSTAMP SCM_TIMESTAMP ++#define HCI_DEV_NONE NULL ++#define HCI_DATA_DIR SO_HCI_DIRECTION ++#endif + + #ifdef __cplusplus + } diff --git a/sysutils/netbt-hcidump/patches/patch-ad b/sysutils/netbt-hcidump/patches/patch-ad new file mode 100644 index 00000000000..cbc87747457 --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-ad @@ -0,0 +1,50 @@ +$NetBSD: patch-ad,v 1.1.1.1 2010/12/19 20:20:43 plunky Exp $ + +--- bluetooth/hci_lib.h.orig 2010-09-30 08:53:08.000000000 +0000 ++++ bluetooth/hci_lib.h +@@ -30,6 +30,7 @@ + extern "C" { + #endif + ++#if 0 + struct hci_request { + uint16_t ogf; + uint16_t ocf; +@@ -135,11 +136,15 @@ char *hci_bustostr(int bus); + char *hci_typetostr(int type); + char *hci_dtypetostr(int type); + char *hci_dflagstostr(uint32_t flags); ++#endif + char *hci_ptypetostr(unsigned int ptype); ++#if 0 + int hci_strtoptype(char *str, unsigned int *val); + char *hci_scoptypetostr(unsigned int ptype); + int hci_strtoscoptype(char *str, unsigned int *val); ++#endif + char *hci_lptostr(unsigned int ptype); ++#if 0 + int hci_strtolp(char *str, unsigned int *val); + char *hci_lmtostr(unsigned int ptype); + int hci_strtolm(char *str, unsigned int *val); +@@ -147,9 +152,13 @@ int hci_strtolm(char *str, unsigned int + char *hci_cmdtostr(unsigned int cmd); + char *hci_commandstostr(uint8_t *commands, char *pref, int width); + ++#endif + char *hci_vertostr(unsigned int ver); ++#if 0 + int hci_strtover(char *str, unsigned int *ver); ++#endif + char *lmp_vertostr(unsigned int ver); ++#if 0 + int lmp_strtover(char *str, unsigned int *ver); + + char *lmp_featurestostr(uint8_t *features, char *pref, int width); +@@ -218,6 +227,7 @@ static inline int hci_filter_test_opcode + { + return (f->opcode == opcode); + } ++#endif + + #ifdef __cplusplus + } diff --git a/sysutils/netbt-hcidump/patches/patch-ae b/sysutils/netbt-hcidump/patches/patch-ae new file mode 100644 index 00000000000..7aad6cac9f0 --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-ae @@ -0,0 +1,20 @@ +$NetBSD: patch-ae,v 1.1.1.1 2010/12/19 20:20:43 plunky Exp $ + +--- bluetooth/l2cap.h.orig 2009-11-30 19:29:17.000000000 +0000 ++++ bluetooth/l2cap.h +@@ -30,6 +30,7 @@ + extern "C" { + #endif + ++#if 0 + #include <sys/socket.h> + + /* L2CAP defaults */ +@@ -66,6 +67,7 @@ struct l2cap_conninfo { + #define L2CAP_LM_TRUSTED 0x0008 + #define L2CAP_LM_RELIABLE 0x0010 + #define L2CAP_LM_SECURE 0x0020 ++#endif + + /* L2CAP command codes */ + #define L2CAP_COMMAND_REJ 0x01 diff --git a/sysutils/netbt-hcidump/patches/patch-af b/sysutils/netbt-hcidump/patches/patch-af new file mode 100644 index 00000000000..5a28f8f8858 --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-af @@ -0,0 +1,13 @@ +$NetBSD: patch-af,v 1.1.1.1 2010/12/19 20:20:43 plunky Exp $ + +--- parser/bnep.c.orig 2007-02-18 03:39:02.000000000 +0000 ++++ parser/bnep.c +@@ -33,7 +33,7 @@ + #include <string.h> + #include <sys/types.h> + +-#include <net/ethernet.h> ++#include <net/ethertypes.h> + + #include "parser.h" + diff --git a/sysutils/netbt-hcidump/patches/patch-ag b/sysutils/netbt-hcidump/patches/patch-ag new file mode 100644 index 00000000000..f3f35aeb5f6 --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-ag @@ -0,0 +1,16 @@ +$NetBSD: patch-ag,v 1.1.1.1 2010/12/19 20:20:43 plunky Exp $ + +fix SDP universal attributes, has been reported upstream (30 Nov 2009) + +--- parser/sdp.c.orig 2009-11-30 19:29:31.000000000 +0000 ++++ parser/sdp.c +@@ -194,8 +194,8 @@ static sdp_attr_id_nam_lookup_table_t sd + { SDP_ATTR_ID_BLUETOOTH_PROFILE_DESCRIPTOR_LIST, "BTProfileDescList" }, + { SDP_ATTR_ID_DOCUMENTATION_URL, "DocURL" }, + { SDP_ATTR_ID_CLIENT_EXECUTABLE_URL, "ClientExeURL" }, +- { SDP_ATTR_ID_ICON_10, "Icon10" }, + { SDP_ATTR_ID_ICON_URL, "IconURL" }, ++ { SDP_ATTR_ID_ADDITIONAL_PROTOCOL_DESC_LISTS, "AdditionalProtocolDescLists" }, + { SDP_ATTR_ID_SERVICE_NAME, "SrvName" }, + { SDP_ATTR_ID_SERVICE_DESCRIPTION, "SrvDesc" }, + { SDP_ATTR_ID_PROVIDER_NAME, "ProviderName" }, diff --git a/sysutils/netbt-hcidump/patches/patch-ah b/sysutils/netbt-hcidump/patches/patch-ah new file mode 100644 index 00000000000..778fa9e4e39 --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-ah @@ -0,0 +1,13 @@ +$NetBSD: patch-ah,v 1.1.1.1 2010/12/19 20:20:43 plunky Exp $ + +--- parser/parser.h.orig 2007-02-18 03:39:02.000000000 +0000 ++++ parser/parser.h +@@ -35,7 +35,7 @@ struct frame { + uint32_t data_len; + void *ptr; + uint32_t len; +- uint16_t dev_id; ++ char *dev_id; + uint8_t in; + uint8_t master; + uint16_t handle; diff --git a/sysutils/netbt-hcidump/patches/patch-ai b/sysutils/netbt-hcidump/patches/patch-ai new file mode 100644 index 00000000000..b877c78e894 --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-ai @@ -0,0 +1,14 @@ +$NetBSD: patch-ai,v 1.1.1.1 2010/12/19 20:20:43 plunky Exp $ + +--- parser/rfcomm.h.orig 2007-02-18 03:39:02.000000000 +0000 ++++ parser/rfcomm.h +@@ -25,7 +25,9 @@ + #ifndef __RFCOMM_H + #define __RFCOMM_H + ++#if 0 + #include <endian.h> ++#endif + + #define RFCOMM_PSM 3 + diff --git a/sysutils/netbt-hcidump/patches/patch-aj b/sysutils/netbt-hcidump/patches/patch-aj new file mode 100644 index 00000000000..6e27fed5a5a --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-aj @@ -0,0 +1,15 @@ +$NetBSD: patch-aj,v 1.1.1.1 2010/12/19 20:20:43 plunky Exp $ + +--- parser/tcpip.c.orig 2007-02-18 03:39:02.000000000 +0000 ++++ parser/tcpip.c +@@ -32,8 +32,9 @@ + #include <string.h> + #include <sys/types.h> + +-#include <net/ethernet.h> ++#include <net/if.h> + #include <netinet/in.h> ++#include <netinet/in_systm.h> + #include <netinet/ip.h> + #include <netinet/ip6.h> + #include <netinet/if_ether.h> diff --git a/sysutils/netbt-hcidump/patches/patch-ak b/sysutils/netbt-hcidump/patches/patch-ak new file mode 100644 index 00000000000..b06b3a0c0ba --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-ak @@ -0,0 +1,21 @@ +$NetBSD: patch-ak,v 1.1.1.1 2010/12/19 20:20:43 plunky Exp $ + +--- src/Makefile.orig 2009-11-30 19:29:18.000000000 +0000 ++++ src/Makefile +@@ -0,0 +1,16 @@ ++.PATH: ../parser ++ ++PROG= hcidump ++MAN= hcidump.8 ++ ++BINDIR= ${PREFIX}/sbin ++ ++SRCS= hcidump.c bt_lib.c hci_lib.c \ ++ avctp.c avdtp.c bnep.c bpa.c capi.c cmtp.c csr.c \ ++ ericsson.c hci.c hcrp.c hidp.c l2cap.c lmp.c obex.c \ ++ parser.c ppp.c rfcomm.c sdp.c tcpip.c ++ ++CPPFLAGS+= -I.. ++LDADD+= -lbluetooth ++ ++.include <bsd.prog.mk> diff --git a/sysutils/netbt-hcidump/patches/patch-al b/sysutils/netbt-hcidump/patches/patch-al new file mode 100644 index 00000000000..52579edeb46 --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-al @@ -0,0 +1,63 @@ +$NetBSD: patch-al,v 1.1.1.1 2010/12/19 20:20:43 plunky Exp $ + +--- src/bt_lib.c.orig 2010-01-05 12:27:30.000000000 +0000 ++++ src/bt_lib.c +@@ -35,8 +35,8 @@ + #include <string.h> + #include <sys/socket.h> + +-#include "bluetooth.h" +-#include "hci.h" ++#include <bluetooth/bluetooth.h> ++#include <bluetooth/hci.h> + + void baswap(bdaddr_t *dst, const bdaddr_t *src) + { +@@ -48,6 +48,7 @@ void baswap(bdaddr_t *dst, const bdaddr_ + d[i] = s[5-i]; + } + ++#if 0 + char *batostr(const bdaddr_t *ba) + { + char *str = bt_malloc(18); +@@ -79,6 +80,7 @@ bdaddr_t *strtoba(const char *str) + + return (bdaddr_t *) ba; + } ++#endif + + int ba2str(const bdaddr_t *ba, char *str) + { +@@ -89,6 +91,7 @@ int ba2str(const bdaddr_t *ba, char *str + b[0], b[1], b[2], b[3], b[4], b[5]); + } + ++#if 0 + int str2ba(const char *str, bdaddr_t *ba) + { + uint8_t b[6]; +@@ -197,6 +200,7 @@ int basnprintf(char *str, size_t size, c + + return len; + } ++#endif + + void *bt_malloc(size_t size) + { +@@ -208,6 +212,7 @@ void bt_free(void *ptr) + free(ptr); + } + ++#if 0 + /* Bluetooth error codes to Unix errno mapping */ + int bt_error(uint16_t code) + { +@@ -282,6 +287,7 @@ int bt_error(uint16_t code) + return ENOSYS; + } + } ++#endif + + char *bt_compidtostr(int compid) + { diff --git a/sysutils/netbt-hcidump/patches/patch-am b/sysutils/netbt-hcidump/patches/patch-am new file mode 100644 index 00000000000..5902d55d162 --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-am @@ -0,0 +1,122 @@ +$NetBSD: patch-am,v 1.1.1.1 2010/12/19 20:20:43 plunky Exp $ + +--- src/hci_lib.c.orig 2010-09-30 09:12:22.000000000 +0000 ++++ src/hci_lib.c +@@ -41,9 +41,9 @@ + #include <sys/ioctl.h> + #include <sys/socket.h> + +-#include "bluetooth.h" +-#include "hci.h" +-#include "hci_lib.h" ++#include <bluetooth/bluetooth.h> ++#include <bluetooth/hci.h> ++#include <bluetooth/hci_lib.h> + + #ifndef MIN + #define MIN(x, y) ((x) < (y) ? (x) : (y)) +@@ -71,6 +71,7 @@ static char *hci_bit2str(hci_map *m, uns + return str; + } + ++#if 0 + static int hci_str2bit(hci_map *map, char *str, unsigned int *val) + { + char *t, *ptr; +@@ -94,6 +95,7 @@ static int hci_str2bit(hci_map *map, cha + + return set; + } ++#endif + + static char *hci_uint2str(hci_map *m, unsigned int val) + { +@@ -114,6 +116,7 @@ static char *hci_uint2str(hci_map *m, un + return str; + } + ++#if 0 + static int hci_str2uint(hci_map *map, char *str, unsigned int *val) + { + char *t, *ptr; +@@ -212,6 +215,7 @@ char *hci_dflagstostr(uint32_t flags) + } + return str; + } ++#endif + + /* HCI packet type mapping */ + static hci_map pkt_type_map[] = { +@@ -233,6 +237,7 @@ static hci_map pkt_type_map[] = { + { NULL } + }; + ++#if 0 + static hci_map sco_ptype_map[] = { + { "HV1", 0x0001 }, + { "HV2", 0x0002 }, +@@ -246,12 +251,15 @@ static hci_map sco_ptype_map[] = { + { "3-EV5", HCI_3EV5 }, + { NULL } + }; ++#endif + + char *hci_ptypetostr(unsigned int ptype) + { ++ ptype ^= (HCI_2DH1|HCI_2DH3|HCI_2DH5|HCI_3DH1|HCI_3DH3|HCI_3DH5); + return hci_bit2str(pkt_type_map, ptype); + } + ++#if 0 + int hci_strtoptype(char *str, unsigned int *val) + { + return hci_str2bit(pkt_type_map, str, val); +@@ -266,6 +274,7 @@ int hci_strtoscoptype(char *str, unsigne + { + return hci_str2bit(sco_ptype_map, str, val); + } ++#endif + + /* Link policy mapping */ + static hci_map link_policy_map[] = { +@@ -282,6 +291,7 @@ char *hci_lptostr(unsigned int lp) + return hci_bit2str(link_policy_map, lp); + } + ++#if 0 + int hci_strtolp(char *str, unsigned int *val) + { + return hci_str2bit(link_policy_map, str, val); +@@ -638,6 +648,7 @@ char *hci_commandstostr(uint8_t *command + + return str; + } ++#endif + + /* Version mapping */ + static hci_map ver_map[] = { +@@ -656,16 +667,19 @@ char *hci_vertostr(unsigned int ver) + return hci_uint2str(ver_map, ver); + } + ++#if 0 + int hci_strtover(char *str, unsigned int *ver) + { + return hci_str2uint(ver_map, str, ver); + } ++#endif + + char *lmp_vertostr(unsigned int ver) + { + return hci_uint2str(ver_map, ver); + } + ++#if 0 + int lmp_strtover(char *str, unsigned int *ver) + { + return hci_str2uint(ver_map, str, ver); +@@ -2744,3 +2758,4 @@ int hci_le_create_conn(int dd, uint16_t + + return 0; + } ++#endif diff --git a/sysutils/netbt-hcidump/patches/patch-an b/sysutils/netbt-hcidump/patches/patch-an new file mode 100644 index 00000000000..ce626aec199 --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-an @@ -0,0 +1,13 @@ +$NetBSD: patch-an,v 1.1.1.1 2010/12/19 20:20:43 plunky Exp $ + +--- src/hcidump.8.orig 2007-07-26 08:34:58.000000000 +0100 ++++ src/hcidump.8 +@@ -28,7 +28,7 @@ which must be the name of an installed B + and if + .B + -r +-option is not set, data is read from the first available Bluetooth device. ++option is not set, data is read from all available Bluetooth devices. + .TP + .BI -l " <len>" "\fR,\fP \-\^\-snap-len=" "<len>" + Sets max length of processed packets to diff --git a/sysutils/netbt-hcidump/patches/patch-ao b/sysutils/netbt-hcidump/patches/patch-ao new file mode 100644 index 00000000000..62243381697 --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-ao @@ -0,0 +1,181 @@ +$NetBSD: patch-ao,v 1.1.1.1 2010/12/19 20:20:43 plunky Exp $ + +--- src/hcidump.c.orig 2007-07-28 15:41:34.000000000 +0100 ++++ src/hcidump.c +@@ -50,6 +50,10 @@ + #include "parser/parser.h" + #include "parser/sdp.h" + ++#ifndef AI_ADDRCONFIG ++#define AI_ADDRCONFIG 0 ++#endif ++ + #if __BYTE_ORDER == __LITTLE_ENDIAN + static inline uint64_t ntoh64(uint64_t n) + { +@@ -165,7 +169,7 @@ static inline int write_n(int fd, char * + return t; + } + +-static int process_frames(int dev, int sock, int fd, unsigned long flags) ++static int process_frames(char *dev, int sock, int fd, unsigned long flags) + { + struct cmsghdr *cmsg; + struct msghdr msg; +@@ -210,7 +214,7 @@ static int process_frames(int dev, int s + if (dev == HCI_DEV_NONE) + printf("system: "); + else +- printf("device: hci%d ", dev); ++ printf("device: %s ", dev); + + printf("snap_len: %d filter: 0x%lx\n", snap_len, parser.filter); + +@@ -553,10 +557,13 @@ static int open_file(char *file, int mod + return fd; + } + +-static int open_socket(int dev, unsigned long flags) ++static int open_socket(char *dev, unsigned long flags) + { +- struct sockaddr_hci addr; ++ struct sockaddr_bt addr; + struct hci_filter flt; ++#if 1 ++ int sk, opt; ++#else + struct hci_dev_info di; + int sk, dd, opt; + +@@ -582,6 +589,7 @@ static int open_socket(int dev, unsigned + + hci_close_dev(dd); + } ++#endif + + /* Create HCI socket */ + sk = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); +@@ -597,12 +605,13 @@ static int open_socket(int dev, unsigned + } + + opt = 1; +- if (setsockopt(sk, SOL_HCI, HCI_TIME_STAMP, &opt, sizeof(opt)) < 0) { ++ if (setsockopt(sk, SOL_SOCKET, SO_TIMESTAMP, &opt, sizeof(opt)) < 0) { + perror("Can't enable time stamp"); + return -1; + } + + /* Setup filter */ ++#if 0 + hci_filter_clear(&flt); + hci_filter_all_ptypes(&flt); + hci_filter_all_events(&flt); +@@ -610,12 +619,34 @@ static int open_socket(int dev, unsigned + perror("Can't set filter"); + return -1; + } ++#else ++ memset(&flt, 0xff, sizeof(flt)); ++ if (setsockopt(sk, BTPROTO_HCI, SO_HCI_EVT_FILTER, &flt, sizeof(flt)) < 0) { ++ perror("Can't set event filter"); ++ exit(1); ++ } ++ ++ if (setsockopt(sk, BTPROTO_HCI, SO_HCI_PKT_FILTER, &flt, sizeof(flt)) < 0) { ++ perror("Can't set packet filter"); ++ exit(1); ++ } ++#endif + + /* Bind socket to the HCI device */ ++#if 0 + addr.hci_family = AF_BLUETOOTH; + addr.hci_dev = dev; ++#else ++ memset(&addr, 0, sizeof(addr)); ++ addr.bt_len = sizeof(addr); ++ addr.bt_family = AF_BLUETOOTH; ++ if (dev != HCI_DEV_NONE && !bt_devaddr(dev, &addr.bt_bdaddr)) { ++ perror("device"); ++ exit(1); ++ } ++#endif + if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) { +- printf("Can't attach to device hci%d. %s(%d)\n", ++ printf("Can't attach to device %s. %s(%d)\n", + dev, strerror(errno), errno); + return -1; + } +@@ -660,11 +691,13 @@ static int open_connection(char *addr, c + ((struct sockaddr_in *) &ss)->sin_addr.s_addr = htonl(INADDR_ANY); + ((struct sockaddr_in *) &ss)->sin_port = 0; + break; ++#ifdef INET6 + case AF_INET6: + memcpy(&((struct sockaddr_in6 *) &ss)->sin6_addr, + &in6addr_any, sizeof(in6addr_any)); + ((struct sockaddr_in6 *) &ss)->sin6_port = 0; + break; ++#endif + } + + if (bind(sk, (struct sockaddr *) &ss, sizeof(ss)) < 0) { +@@ -854,7 +887,7 @@ static int wait_connection(char *addr, c + return -1; + } + +-static int run_server(int dev, char *addr, char *port, unsigned long flags) ++static int run_server(char *dev, char *addr, char *port, unsigned long flags) + { + while (1) { + int dd, sk; +@@ -950,7 +983,9 @@ static void usage(void) + " -Y, --novendor No vendor commands or events\n" + " -N, --noappend No appending to existing files\n" + " -4, --ipv4 Use IPv4 as transport\n" ++#ifdef INET6 + " -6 --ipv6 Use IPv6 as transport\n" ++#endif + " -h, --help Give this help list\n" + " --usage Give a short usage message\n" + ); +@@ -983,7 +1018,9 @@ static struct option main_options[] = { + { "nopermcheck", 0, 0, 'Z' }, + { "noappend", 0, 0, 'N' }, + { "ipv4", 0, 0, '4' }, ++#ifdef INET6 + { "ipv6", 0, 0, '6' }, ++#endif + { "help", 0, 0, 'h' }, + { 0 } + }; +@@ -992,7 +1029,7 @@ int main(int argc, char *argv[]) + { + unsigned long flags = 0; + unsigned long filter = 0; +- int device = 0; ++ char *device = HCI_DEV_NONE; + int defpsm = 0; + int defcompid = DEFAULT_COMPID; + int opt, pppdump_fd = -1, audio_fd = -1; +@@ -1003,7 +1040,7 @@ int main(int argc, char *argv[]) + switch(opt) { + case 'i': + if (strcasecmp(optarg, "none") && strcasecmp(optarg, "system")) +- device = atoi(optarg + 3); ++ device = optarg; + else + device = HCI_DEV_NONE; + break; +@@ -1113,9 +1150,11 @@ int main(int argc, char *argv[]) + af = AF_INET; + break; + ++#ifdef INET6 + case '6': + af = AF_INET6; + break; ++#endif + + case 'h': + default: diff --git a/sysutils/netbt-hcidump/patches/patch-ap b/sysutils/netbt-hcidump/patches/patch-ap new file mode 100644 index 00000000000..0f57f7091b6 --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-ap @@ -0,0 +1,111 @@ +$NetBSD: patch-ap,v 1.1.1.1 2010/12/19 20:20:43 plunky Exp $ + +this is a bugfix, has been reported upstreadm (18 Aug 2009) + +plus some additional fixes for overflowing the buffer, also reported (Jan 2010) + +--- parser/obex.c.orig 2007-02-18 03:39:02.000000000 +0000 ++++ parser/obex.c +@@ -200,27 +200,55 @@ static void parse_headers(int level, str + printf("%s (0x%02x)", hi2str(hi), hi); + switch (hi & 0xc0) { + case 0x00: /* Unicode */ ++ if (frm->len < 2) { ++ printf("\n"); ++ return; ++ } ++ + len = get_u16(frm) - 3; + printf(" = Unicode length %d\n", len); ++ ++ if (frm->len < len) ++ return; ++ + raw_ndump(level, frm, len); + frm->ptr += len; + frm->len -= len; + break; + + case 0x40: /* Byte sequence */ ++ if (frm->len < 2) { ++ printf("\n"); ++ return; ++ } ++ + len = get_u16(frm) - 3; + printf(" = Sequence length %d\n", len); ++ ++ if (frm->len < len) ++ return; ++ + raw_ndump(level, frm, len); + frm->ptr += len; + frm->len -= len; + break; + + case 0x80: /* One byte */ ++ if (frm->len < 1) { ++ printf("\n"); ++ return; ++ } ++ + hv8 = get_u8(frm); + printf(" = %d\n", hv8); + break; + + case 0xc0: /* Four bytes */ ++ if (frm->len < 4) { ++ printf("\n"); ++ return; ++ } ++ + hv32 = get_u32(frm); + printf(" = %u\n", hv32); + break; +@@ -236,7 +264,7 @@ void obex_dump(int level, struct frame * + + frm = add_frame(frm); + +- while (frm->len > 0) { ++ while (frm->len > 2) { + opcode = get_u8(frm); + length = get_u16(frm); + status = opcode & 0x7f; +@@ -276,6 +304,11 @@ void obex_dump(int level, struct frame * + + switch (opcode & 0x7f) { + case 0x00: /* Connect */ ++ if (frm->len < 4) { ++ printf("\n"); ++ return; ++ } ++ + version = get_u8(frm); + flags = get_u8(frm); + pktlen = get_u16(frm); +@@ -284,17 +317,19 @@ void obex_dump(int level, struct frame * + break; + + case 0x05: /* SetPath */ +- if (length > 3) { +- flags = get_u8(frm); +- constants = get_u8(frm); +- printf(" flags %d constants %d\n", +- flags, constants); +- } else ++ if (frm->len < 2) { + printf("\n"); ++ return; ++ } ++ ++ flags = get_u8(frm); ++ constants = get_u8(frm); ++ printf(" flags %d constants %d\n", flags, constants); + break; + + default: + printf("\n"); ++ break; + } + + if ((status & 0x70) && (parser.flags & DUMP_VERBOSE)) { diff --git a/sysutils/netbt-hcidump/patches/patch-aq b/sysutils/netbt-hcidump/patches/patch-aq new file mode 100644 index 00000000000..cf613dc0d30 --- /dev/null +++ b/sysutils/netbt-hcidump/patches/patch-aq @@ -0,0 +1,17 @@ +$NetBSD: patch-aq,v 1.1.1.1 2010/12/19 20:20:43 plunky Exp $ + +fix SDP universal attributes, has been reported upstream (30 Nov 2009) + +--- parser/sdp.h.orig 2009-11-30 19:29:35.000000000 +0000 ++++ parser/sdp.h +@@ -129,8 +129,8 @@ + #define SDP_ATTR_ID_BLUETOOTH_PROFILE_DESCRIPTOR_LIST 0x0009 + #define SDP_ATTR_ID_DOCUMENTATION_URL 0x000A + #define SDP_ATTR_ID_CLIENT_EXECUTABLE_URL 0x000B +-#define SDP_ATTR_ID_ICON_10 0x000C +-#define SDP_ATTR_ID_ICON_URL 0x000D ++#define SDP_ATTR_ID_ICON_URL 0x000C ++#define SDP_ATTR_ID_ADDITIONAL_PROTOCOL_DESC_LISTS 0x000D + #define SDP_ATTR_ID_SERVICE_NAME 0x0100 + #define SDP_ATTR_ID_SERVICE_DESCRIPTION 0x0101 + #define SDP_ATTR_ID_PROVIDER_NAME 0x0102 |