[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
rpms/bluez-hcidump/devel bluez-hcidump-1.32-ipv6.patch, NONE, 1.1 .cvsignore, 1.13, 1.14 bluez-hcidump.spec, 1.22, 1.23 sources, 1.13, 1.14
- From: fedora-cvs-commits redhat com
- To: fedora-cvs-commits redhat com
- Subject: rpms/bluez-hcidump/devel bluez-hcidump-1.32-ipv6.patch, NONE, 1.1 .cvsignore, 1.13, 1.14 bluez-hcidump.spec, 1.22, 1.23 sources, 1.13, 1.14
- Date: Sat, 30 Sep 2006 09:52:59 -0400
Author: dwmw2
Update of /cvs/dist/rpms/bluez-hcidump/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv32583
Modified Files:
.cvsignore bluez-hcidump.spec sources
Added Files:
bluez-hcidump-1.32-ipv6.patch
Log Message:
1.32
bluez-hcidump-1.32-ipv6.patch:
parser/bnep.c | 10 ++
parser/tcpip.c | 66 +++++++++++++---
src/hcidump.c | 234 ++++++++++++++++++++++++++++++++++-----------------------
3 files changed, 205 insertions(+), 105 deletions(-)
--- NEW FILE bluez-hcidump-1.32-ipv6.patch ---
--- bluez-hcidump-1.30/parser/bnep.c.orig 2006-09-14 23:10:47.000000000 +0200
+++ bluez-hcidump-1.30/parser/bnep.c 2006-09-14 23:18:36.000000000 +0200
@@ -56,6 +56,10 @@
/* BNEP Extension Type */
#define BNEP_EXTENSION_CONTROL 0x00
+#ifndef ETHERTYPE_IPV6
+#define ETHERTYPE_IPV6 ETH_P_IPV6
+#endif
+
static char *get_macaddr(struct frame *frm)
{
static char str[20];
@@ -287,6 +291,12 @@
ip_dump(level, frm);
break;
+ case ETHERTYPE_IPV6:
+ p_indent(++level, frm);
+ printf("IPV6: ");
+ ip_dump(level, frm);
+ break;
+
default:
raw_dump(level, frm);
break;
--- bluez-hcidump-1.30/parser/tcpip.c.orig 2006-09-11 15:22:53.000000000 +0200
+++ bluez-hcidump-1.30/parser/tcpip.c 2006-09-16 10:19:05.000000000 +0200
@@ -35,26 +35,37 @@
#include <net/ethernet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
+#include <netinet/ip6.h>
#include <netinet/if_ether.h>
#include <arpa/inet.h>
+#include <netdb.h>
#include "parser.h"
void arp_dump(int level, struct frame *frm)
{
int i;
+ char buf[20];
+ struct sockaddr_in sai;
struct ether_arp *arp = (struct ether_arp *) frm->ptr;
printf("Src ");
for (i = 0; i < 5; i++)
printf("%02x:", arp->arp_sha[i]);
printf("%02x", arp->arp_sha[5]);
- printf("(%s) ", inet_ntoa(*(struct in_addr *) &arp->arp_spa));
+ sai.sin_family = AF_INET;
+ memcpy(&sai.sin_addr, &arp->arp_spa, sizeof(sai.sin_addr));
+ getnameinfo((struct sockaddr *) &sai, sizeof(sai), buf, sizeof(buf),
+ NULL, 0, NI_NUMERICHOST);
+ printf("(%s) ", buf);
printf("Tgt ");
for (i = 0; i < 5; i++)
printf("%02x:", arp->arp_tha[i]);
printf("%02x", arp->arp_tha[5]);
- printf("(%s)\n", inet_ntoa(*(struct in_addr *) &arp->arp_tpa));
+ memcpy(&sai.sin_addr, &arp->arp_tpa, sizeof(sai.sin_addr));
+ getnameinfo((struct sockaddr *) &sai, sizeof(sai), buf, sizeof(buf),
+ NULL, 0, NI_NUMERICHOST);
+ printf("(%s)\n", buf);
frm->ptr += sizeof(struct ether_arp);
frm->len -= sizeof(struct ether_arp);
raw_dump(level, frm); // not needed.
@@ -62,33 +73,66 @@
void ip_dump(int level, struct frame *frm)
{
+ char src[50], dst[50];
struct ip *ip = (struct ip *) (frm->ptr);
- int len = ip->ip_hl << 2;
+ int len;
+ uint8_t proto = 0;
+
+ if(ip->ip_v == 4) {
+ struct sockaddr_in sai;
+ proto = ip->ip_p;
+ len = ip->ip_hl << 2;
+ memset(&sai, 0, sizeof(sai));
+ sai.sin_family = AF_INET;
+ memcpy(&sai.sin_addr, &ip->ip_src, sizeof(struct in_addr));
+ getnameinfo((struct sockaddr *) &sai, sizeof(sai),
+ src, sizeof(src), NULL, 0, NI_NUMERICHOST);
+ memcpy(&sai.sin_addr, &ip->ip_dst, sizeof(struct in_addr));
+ getnameinfo((struct sockaddr *) &sai, sizeof(sai),
+ dst, sizeof(dst), NULL, 0, NI_NUMERICHOST);
+ }
+ if(ip->ip_v == 6) {
+ struct sockaddr_in6 sai6;
+ struct ip6_hdr *ip6 = (struct ip6_hdr *) ip;
+ proto = ip6->ip6_nxt;
+ len = sizeof(struct ip6_hdr);
+ memset(&sai6, 0, sizeof(sai6));
+ sai6.sin6_family = AF_INET6;
+ memcpy(&sai6.sin6_addr, &ip6->ip6_src, sizeof(struct in6_addr));
+ getnameinfo((struct sockaddr *) &sai6, sizeof(sai6),
+ src, sizeof(src), NULL, 0, NI_NUMERICHOST);
+ memcpy(&sai6.sin6_addr, &ip6->ip6_dst, sizeof(struct in6_addr));
+ getnameinfo((struct sockaddr *) &sai6, sizeof(sai6),
+ dst, sizeof(dst), NULL, 0, NI_NUMERICHOST);
+ }
+
+
+ printf("src %s ", src);
+ printf("dst %s\n", dst);
+
frm->ptr += len;
frm->len -= len;
-
- printf("src %s ", inet_ntoa(*(struct in_addr *) &(ip->ip_src)));
- printf("dst %s\n", inet_ntoa(*(struct in_addr *) &(ip->ip_dst)));
p_indent(++level, frm);
- switch (ip->ip_p) {
+ switch (proto) {
case IPPROTO_TCP:
printf("TCP:\n");
- raw_dump(level, frm);
break;
case IPPROTO_UDP:
printf("UDP:\n");
- raw_dump(level, frm);
break;
case IPPROTO_ICMP:
printf("ICMP:\n");
- raw_dump(level, frm);
+ break;
+
+ case IPPROTO_ICMPV6:
+ printf("ICMPv6:\n");
break;
default:
printf("Unknown Protocol: 0x%02x\n", ip->ip_p);
- raw_dump(level, frm);
}
+ raw_dump(level, frm);
}
--- bluez-hcidump-1.30/src/hcidump.c.orig 2006-09-11 15:21:13.000000000 +0200
+++ bluez-hcidump-1.30/src/hcidump.c 2006-09-11 17:41:36.000000000 +0200
@@ -66,7 +66,7 @@
#define hton64(x) ntoh64(x)
#define SNAP_LEN HCI_MAX_FRAME_SIZE
-#define DEFAULT_PORT 10839;
+#define DEFAULT_PORT "10839";
/* Modes */
enum {
@@ -92,8 +92,9 @@
static char *dump_file = NULL;
static char *pppdump_file = NULL;
static char *audio_file = NULL;
-static in_addr_t dump_addr = INADDR_LOOPBACK;
-static in_port_t dump_port = DEFAULT_PORT;
+static char *dump_addr;
+static char *dump_port = DEFAULT_PORT;
+static int af = AF_UNSPEC;
struct hcidump_hdr {
uint16_t len;
@@ -504,88 +505,139 @@
return sk;
}
-static int open_connection(in_addr_t addr, in_port_t port)
+static int open_connection(char *addr, char *port)
{
- struct sockaddr_in sa;
- int sk, opt;
-
- sk = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- if (sk < 0) {
- perror("Can't create inet socket");
- exit(1);
- }
-
- opt = 1;
- setsockopt(sk, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
-
- sa.sin_family = AF_INET;
- sa.sin_addr.s_addr = htonl(INADDR_ANY);
- sa.sin_port = htons(0);
- if (bind(sk, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
- perror("Can't bind inet socket");
- close(sk);
- exit(1);
- }
-
- sa.sin_family = AF_INET;
- sa.sin_addr.s_addr = htonl(addr);
- sa.sin_port = htons(port);
- if (connect(sk, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
- perror("Can't connect inet socket");
- close(sk);
- exit(1);
+ struct sockaddr_storage ss;
+ struct addrinfo hints, *res0, *res;
+ int sk = -1, opt = 1;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = af;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_protocol = IPPROTO_TCP;
+
+ if(getaddrinfo(addr, port, &hints, &res0))
+ if(getaddrinfo(NULL, port, &hints, &res0)) {
+ perror("getaddrinfo");
+ exit(1);
+ }
+
+ for(res = res0; res; res = res->ai_next) {
+ if((sk = socket(res->ai_family, res->ai_socktype,
+ res->ai_protocol)) == -1) {
+ if(res->ai_next)
+ continue;
+ else {
+ perror("Can't create socket");
+ freeaddrinfo(res0);
+ exit(1);
+ }
+ }
+ setsockopt(sk, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
+
+ memcpy(&ss, res->ai_addr, res->ai_addrlen);
+ switch(ss.ss_family) {
+ case AF_INET:
+ ((struct sockaddr_in *) &ss)->sin_addr.s_addr = htonl(INADDR_ANY);
+ ((struct sockaddr_in *) &ss)->sin_port = 0;
+ break;
+ case AF_INET6:
+ memcpy(&((struct sockaddr_in6 *) &ss)->sin6_addr, &in6addr_any,
+ sizeof(in6addr_any));
+ ((struct sockaddr_in6 *) &ss)->sin6_port = 0;
+ break;
+ }
+ if(bind(sk, (struct sockaddr *) &ss, sizeof(ss)) == -1) {
+ perror("Can't bind socket");
+ close(sk);
+ freeaddrinfo(res0);
+ exit(1);
+ }
+
+ if(connect(sk, res->ai_addr, res->ai_addrlen) == -1) {
+ perror("Can't connect socket");
+ close(sk);
+ freeaddrinfo(res0);
+ exit(1);
+ }
}
-
+ freeaddrinfo(res0);
return sk;
}
-static int wait_connection(in_addr_t addr, in_port_t port)
+static int wait_connection(char *addr, char *port)
{
- struct sockaddr_in sa;
- struct hostent *host;
+ char hname[100], hport[10];
+ struct sockaddr_storage ss;
+ struct addrinfo hints, *res0, *res;
socklen_t len;
- int sk, nsk, opt;
+ int sk = -1, nsk, opt = 1;
- sk = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- if (sk < 0) {
- perror("Can't create inet socket");
- exit(1);
- }
-
- opt = 1;
- setsockopt(sk, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
-
- sa.sin_family = AF_INET;
- sa.sin_addr.s_addr = htonl(addr);
- sa.sin_port = htons(port);
- if (bind(sk, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
- perror("Can't bind inet socket");
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = af;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_protocol = IPPROTO_TCP;
+
+ if(getaddrinfo(addr, port, &hints, &res0))
+ if(getaddrinfo(NULL, port, &hints, &res0)) {
+ perror("getaddrinfo");
+ exit(1);
+ }
+
+ for(res = res0; res; res = res->ai_next) {
+ if((sk = socket(res->ai_family, res->ai_socktype,
+ res->ai_protocol)) == -1) {
+ if(res->ai_next)
+ continue;
+ else {
+ perror("Can't create socket");
+ freeaddrinfo(res0);
+ exit(1);
+ }
+ }
+ setsockopt(sk, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
+ if(bind(sk, res->ai_addr, res->ai_addrlen) == -1) {
+ if(res->ai_next) {
+ close(sk);
+ continue;
+ }
+ else {
+ perror("Can't bind socket");
+ close(sk);
+ freeaddrinfo(res0);
+ exit(1);
+ }
+ }
+ getnameinfo(res->ai_addr, res->ai_addrlen, hname, sizeof(hname),
+ hport, sizeof(hport), NI_NUMERICSERV);
+ printf("device: %s:%s snap_len: %d filter: 0x%lx\n",
+ hname, hport, snap_len, filter);
+ if(listen(sk, 1)) {
+ if(res->ai_next) {
+ close(sk);
+ continue;
+ }
+ else {
+ perror("Can't listen on socket");
+ close(sk);
+ freeaddrinfo(res0);
+ exit(1);
+ }
+ }
+ }
+ freeaddrinfo(res0);
+
+ len = sizeof(ss);
+ if((nsk = accept(sk, (struct sockaddr *) &ss, &len)) == -1) {
+ perror("Can't accept new socket");
close(sk);
+ freeaddrinfo(res0);
exit(1);
}
- host = gethostbyaddr(&sa.sin_addr, sizeof(sa.sin_addr), AF_INET);
- printf("device: %s:%d snap_len: %d filter: 0x%lx\n",
- host ? host->h_name : inet_ntoa(sa.sin_addr),
- ntohs(sa.sin_port), snap_len, filter);
-
- if (listen(sk, 1)) {
- perror("Can't listen on inet socket");
- close(sk);
- exit(1);
- }
-
- len = sizeof(sa);
- nsk = accept(sk, (struct sockaddr *) &sa, &len);
- if (nsk < 0) {
- perror("Can't accept new inet socket");
- close(sk);
- exit(1);
- }
-
- host = gethostbyaddr(&sa.sin_addr, sizeof(sa.sin_addr), AF_INET);
- printf("device: %s snap_len: %d filter: 0x%lx\n",
- host ? host->h_name : inet_ntoa(sa.sin_addr), snap_len, filter);
+ getnameinfo((struct sockaddr *) &ss, sizeof(ss), hname, sizeof(hname),
+ NULL, 0, 0);
+ printf("device: %s snap_len: %d filter: 0x%lx\n", hname, snap_len, filter);
close(sk);
@@ -657,6 +709,8 @@
" -V, --verbose Verbose decoding\n"
" -Y, --novendor No vendor commands or events\n"
" -N, --noappend No appending to existing files\n"
+ " -4 Use IPv4\n"
+ " -6 Use IPv6\n"
" -h, --help Give this help list\n"
" --usage Give a short usage message\n"
);
@@ -687,19 +741,19 @@
{ "novendor", 0, 0, 'Y' },
{ "nopermcheck", 0, 0, 'Z' },
{ "noappend", 0, 0, 'N' },
+ { NULL, 0, 0, '4' },
+ { NULL, 0, 0, '6' },
{ "help", 0, 0, 'h' },
{ 0 }
};
int main(int argc, char *argv[])
{
- struct hostent *host;
- struct in_addr addr;
int opt, pppdump_fd = -1, audio_fd = -1;
printf("HCI sniffer - Bluetooth packet analyzer ver %s\n", VERSION);
- while ((opt=getopt_long(argc, argv, "i:l:p:m:w:r:s:n:taxXRC:H:O:P:D:A:BVYZNh", main_options, NULL)) != -1) {
+ while ((opt=getopt_long(argc, argv, "i:l:p:m:w:r:s:n:taxXRC:H:O:P:D:A:BVYZN46h", main_options, NULL)) != -1) {
switch(opt) {
case 'i':
if (strcasecmp(optarg, "none") && strcasecmp(optarg, "system"))
@@ -732,28 +786,12 @@
case 's':
mode = SEND;
- host = gethostbyname(optarg);
- if (host) {
- bcopy(host->h_addr, &addr, sizeof(struct in_addr));
- dump_addr = ntohl(addr.s_addr);
- dump_port = DEFAULT_PORT;
- } else {
- dump_addr = INADDR_LOOPBACK;
- dump_port = DEFAULT_PORT;
- }
+ dump_addr = optarg;
break;
case 'n':
mode = RECEIVE;
- host = gethostbyname(optarg);
- if (host) {
- bcopy(host->h_addr, &addr, sizeof(struct in_addr));
- dump_addr = ntohl(addr.s_addr);
- dump_port = DEFAULT_PORT;
- } else {
- dump_addr = INADDR_LOOPBACK;
- dump_port = DEFAULT_PORT;
- }
+ dump_addr = optarg;
break;
case 't':
@@ -820,6 +858,14 @@
noappend = 1;
break;
+ case '4':
+ af = AF_INET;
+ break;
+
+ case '6':
+ af = AF_INET6;
+ break;
+
case 'h':
default:
usage();
Index: .cvsignore
===================================================================
RCS file: /cvs/dist/rpms/bluez-hcidump/devel/.cvsignore,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- .cvsignore 11 Jun 2006 23:45:59 -0000 1.13
+++ .cvsignore 30 Sep 2006 13:52:56 -0000 1.14
@@ -1 +1 @@
-bluez-hcidump-1.31.tar.gz
+bluez-hcidump-1.32.tar.gz
Index: bluez-hcidump.spec
===================================================================
RCS file: /cvs/dist/rpms/bluez-hcidump/devel/bluez-hcidump.spec,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- bluez-hcidump.spec 12 Jul 2006 05:27:44 -0000 1.22
+++ bluez-hcidump.spec 30 Sep 2006 13:52:56 -0000 1.23
@@ -1,16 +1,17 @@
Summary: Bluetooth HCI protocol analyser
Name: bluez-hcidump
-Version: 1.31
-Release: 5.1
+Version: 1.32
+Release: 1
License: GPL
Group: Applications/System
-Source: http://bluez.sourceforge.net/download/%{name}-1.31.tar.gz
+Source: http://bluez.sourceforge.net/download/%{name}-%{version}.tar.gz
+Patch1: bluez-hcidump-1.32-ipv6.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
URL: http://www.bluez.org/
Requires: glibc >= 2.2.4
-Requires: bluez-libs >= 2.23
+Requires: bluez-libs >= 3.3
BuildRequires: glibc-devel >= 2.2.4
-BuildRequires: bluez-libs-devel >= 2.23
+BuildRequires: bluez-libs-devel >= 3.3
BuildRequires: pkgconfig
ExcludeArch: s390 s390x
@@ -22,6 +23,7 @@
%prep
%setup -q
+%patch1 -p1
%build
%configure
@@ -41,6 +43,11 @@
%{_mandir}/man8/hcidump.8.gz
%changelog
+* Sat Sep 30 2006 David Woodhouse <dwmw2 redhat com> - 1.32-1
+- update to bluez-hcidump 1.32
+- Fix BNEP IPv6 parsing (#196879)
+- Support IPv6 in -n and -s options (#196878)
+
* Wed Jul 12 2006 Jesse Keating <jkeating redhat com> - 1.31-5.1
- rebuild
Index: sources
===================================================================
RCS file: /cvs/dist/rpms/bluez-hcidump/devel/sources,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- sources 11 Jun 2006 23:45:59 -0000 1.13
+++ sources 30 Sep 2006 13:52:56 -0000 1.14
@@ -1 +1 @@
-505a0843eccfea4e4467304d63be8396 bluez-hcidump-1.31.tar.gz
+3320121113cf31fe9180470edff2c71d bluez-hcidump-1.32.tar.gz
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]