View | Details | Raw Unified | Return to bug 198888
Collapse All | Expand All

(-)tcptrack/Makefile (-6 / +9 lines)
Lines 2-17 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	tcptrack
4
PORTNAME=	tcptrack
5
PORTVERSION=	1.4.2
5
PORTVERSION=	1.4.3
6
PORTREVISION=	2
6
PORTREVISION=	3
7
CATEGORIES=	net-mgmt
7
CATEGORIES=	net-mgmt
8
MASTER_SITES=	http://pkgs.fedoraproject.org/repo/pkgs/tcptrack/tcptrack-1.4.2.tar.gz/dacf71a6b5310caf1203a2171b598610/
8
MASTER_SITES=	http://BSDforge.com/projects/source/net-mgmt/tcptrack/
9
9
10
MAINTAINER=	ports@FreeBSD.org
10
MAINTAINER=	portmaster@BSDforge.com
11
COMMENT=	Packet sniffer which displays TCP information like top(1)
11
COMMENT=	Packet sniffer that displays TCP information like top(1)
12
12
13
LICENSE=	LGPL21
13
LICENSE=	LGPL21 BSD2CLAUSE
14
LICENSE_COMB=	multi
14
15
16
USES=	tar:xz
17
15
GNU_CONFIGURE=	yes
18
GNU_CONFIGURE=	yes
16
19
17
PLIST_FILES=	bin/tcptrack man/man1/tcptrack.1.gz
20
PLIST_FILES=	bin/tcptrack man/man1/tcptrack.1.gz
(-)tcptrack/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (tcptrack-1.4.2.tar.gz) = 6607b1e1c778c49d3e8795e119065cf66eb2db28b3255dbc56b1612527107049
1
SHA256 (tcptrack-1.4.3.tar.xz) = be32d93bd082e46200fea73d3ecaf8a89b2ccfec0bdb3bc9fd67906e8f00c038
2
SIZE (tcptrack-1.4.2.tar.gz) = 120569
2
SIZE (tcptrack-1.4.3.tar.xz) = 94412
(-)tcptrack/files/patch-IPv6Address.cc (-11 lines)
Lines 1-11 Link Here
1
--- src/IPv6Address.cc.orig	2010-09-28 03:35:16.000000000 +0200
2
+++ src/IPv6Address.cc	2014-07-18 10:19:48.000000000 +0200
3
@@ -7,6 +7,8 @@
4
 #include "IPv6Address.h"
5
 #include "util.h"
6
 
7
+#define s6_addr16 __u6_addr.__u6_addr16
8
+
9
 uint16_t IPv6Address::GetShort( int index ) const
10
 {
11
 	assert(index >= 0);
(-)tcptrack/files/patch-const (-22 lines)
Lines 1-22 Link Here
1
Const is good...
2
3
	-mi
4
5
--- src/Guesser.h	2010-09-27 19:02:01.000000000 -0400
6
+++ src/Guesser.h	2015-03-23 11:42:51.000000000 -0400
7
@@ -20,5 +20,5 @@
8
 {
9
 public:
10
-	bool operator()( const SocketPair &sp1, const SocketPair & sp2 )
11
+	bool operator()( const SocketPair &sp1, const SocketPair & sp2 ) const
12
 	{
13
 		if( sp1==sp2 )
14
--- src/TCContainer.h	2010-09-27 19:02:01.000000000 -0400
15
+++ src/TCContainer.h	2015-03-23 11:40:43.000000000 -0400
16
@@ -58,5 +58,5 @@
17
 {
18
 public:
19
-	bool operator()( const SocketPair &sp1, const SocketPair &sp2 ) 
20
+	bool operator()( const SocketPair &sp1, const SocketPair &sp2 ) const
21
 	{
22
 		if( sp1==sp2 )
(-)tcptrack/files/patch-headers.h (-10 lines)
Lines 1-10 Link Here
1
--- src/headers.h-orig	2014-07-18 09:58:12.000000000 +0200
2
+++ src/headers.h	2014-07-18 09:58:31.000000000 +0200
3
@@ -120,7 +120,6 @@
4
     #define TH_URG 0x20
5
     #define TH_ECE 0x40
6
     #define TH_CWR 0x80
7
-    #define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR)
8
     u_short th_win; /* window */
9
     u_short th_sum; /* checksum */
10
     u_short th_urp; /* urgent pointer */
(-)tcptrack/files/patch-no-stack-limits (-160 lines)
Lines 1-160 Link Here
1
Remove attempts to set arbitrary limits on stack-sizes for different
2
threads, which cause segfaults (due, presumably, to the limits being
3
too low).
4
5
	-mi
6
7
--- src/defs.h	2010-09-27 19:02:01.000000000 -0400
8
+++ src/defs.h	2015-03-23 16:39:53.000000000 -0400
9
@@ -30,8 +30,2 @@
10
 //#define FASTMODE_INTERVAL 250000000 // one quarter of a second
11
 #define FASTMODE_INTERVAL 100000000 // one tenth of a second
12
-
13
-// stack sizes for the different threads
14
-#define SS_PB  2048 // PacketBuffer
15
-#define SS_S   4096 // Sniffer 2048 -> segfault on freebsd
16
-#define SS_TCC 4096 // TCContainer
17
-#define SS_TUI 5120 // TextUI. 4096 -> segfault on solaris
18
--- src/PacketBuffer.cc	2010-09-27 19:02:01.000000000 -0400
19
+++ src/PacketBuffer.cc	2015-03-23 16:23:36.000000000 -0400
20
@@ -53,14 +53,6 @@
21
 	// Start up maintenence thread
22
 	//
23
-	pthread_attr_t attr;
24
-	if( pthread_attr_init( &attr ) != 0 )
25
-		throw GenericError("pthread_attr_init() failed");
26
-
27
-	// TODO: there is no man page for this call on linux. Not sure what it
28
-	// may return. On some systems it may not be supported at all 
29
-	// (should return ENOSYS). Should be safe to ignore return val.
30
-	pthread_attr_setstacksize( &attr, SS_PB );
31
 
32
-	if( pthread_create(&maint_thread_tid,&attr,pbmaint_thread_func,this) != 0 )
33
+	if (pthread_create(&maint_thread_tid, NULL, pbmaint_thread_func, this) != 0)
34
 		throw GenericError("pthread_create() returned an error");
35
 
36
--- src/Sniffer.cc	2010-09-27 19:02:22.000000000 -0400
37
+++ src/Sniffer.cc	2015-03-23 16:25:10.000000000 -0400
38
@@ -55,5 +66,5 @@
39
 }
40
 
41
-void Sniffer::init(char *iface, char *fexp, char *test_file)
42
+void Sniffer::init(const char *iface, const char *fexp, const char *test_file)
43
 {
44
 	assert(pcap_initted==false);
45
@@ -89,6 +102,4 @@
46
 	// prepare the filter	
47
 	//
48
-	struct bpf_program filter; // the filter for the sniffer
49
-	char *filter_app = fexp;  // The filter expression
50
 	bpf_u_int32 mask;  // The netmask of our sniffing device
51
 	bpf_u_int32 net;    // The IP of our sniffing device
52
@@ -102,28 +113,23 @@
53
 		mask = 0;
54
 	}
55
-	if( pcap_compile(handle, &filter, filter_app, 0, net) == -1 )
56
-	{
57
-		pcap_close(handle);
58
-		throw PcapError("pcap_compile",pcap_geterr(handle));
59
-	}
60
-	if( pcap_setfilter(handle, &filter) ) // apply filter to sniffer
61
-	{
62
-		pcap_freecode(&filter);
63
-		pcap_close(handle);
64
-		throw PcapError("pcap_setfilter",pcap_geterr(handle));
65
+	if (fexp != NULL && fexp[0] != '\0') {
66
+		struct bpf_program filter; // the filter for the sniffer
67
+		if (pcap_compile(handle, &filter, fexp, 0, net) == -1)
68
+		{
69
+			pcap_close(handle);
70
+			throw PcapError("pcap_compile", pcap_geterr(handle));
71
+		}
72
+		if (pcap_setfilter(handle, &filter)) // apply filter to sniffer
73
+		{
74
+			pcap_freecode(&filter);
75
+			pcap_close(handle);
76
+			throw PcapError("pcap_setfilter", pcap_geterr(handle));
77
+		}
78
+		pcap_freecode(&filter); // filter code not needed after setfilter
79
 	}
80
-	pcap_freecode(&filter); // filter code not needed after setfilter
81
-	
82
-	pcap_initted=true;
83
-
84
 
85
-	pthread_attr_t attr;
86
-
87
-	if( pthread_attr_init( &attr ) != 0 )
88
-		throw GenericError("pthread_attr_init() failed");
89
-
90
-	pthread_attr_setstacksize( &attr, SS_S );
91
+	pcap_initted=true;
92
 
93
-	if( pthread_create(&sniffer_tid,&attr,sniffer_thread_func,this) != 0 )
94
+	if (pthread_create(&sniffer_tid, NULL, sniffer_thread_func, this) != 0)
95
 		throw GenericError("pthread_create() failed.");
96
 
97
@@ -163,9 +170,11 @@
98
 void Sniffer::processPacket( const pcap_pkthdr *header, const u_char *packet )
99
 {
100
-	assert( pthread_mutex_lock(&pb_mutex)==0 );
101
+
102
+	if (pthread_mutex_lock(&pb_mutex) != 0)
103
+		return;
104
 
105
 	if( pb==NULL ) 
106
 	{
107
-		assert( pthread_mutex_unlock(&pb_mutex) == 0 );
108
+		pthread_mutex_unlock(&pb_mutex);
109
 		return;
110
 	}
111
@@ -193,5 +202,5 @@
112
 	pb->pushPacket(n);
113
 	
114
-	assert( pthread_mutex_unlock(&pb_mutex) == 0 );
115
+	pthread_mutex_unlock(&pb_mutex);
116
 }
117
 
118
--- src/Sniffer.h	2010-09-27 19:02:22.000000000 -0400
119
+++ src/Sniffer.h	2015-03-23 15:07:57.000000000 -0400
120
@@ -43,5 +43,5 @@
121
 	// init performs some constructor-like activity. It is separate
122
 	// so that exceptions don't have to be thrown in the constructor.
123
-	void init(char *iface, char *fexp, char *test_file);
124
+	void init(const char *iface, const char *fexp, const char *test_file);
125
 
126
 	// set the place where sniffed packets are sent for further 
127
--- src/TCContainer.cc	2010-09-27 19:02:01.000000000 -0400
128
+++ src/TCContainer.cc	2015-03-23 16:23:05.000000000 -0400
129
@@ -47,15 +47,8 @@
130
 	state=TSTATE_IDLE;
131
 
132
-	pthread_attr_t attr;
133
-
134
 	pthread_mutex_init( &conlist_lock, NULL );
135
 	pthread_mutex_init( &state_mutex, NULL );
136
 
137
-	if( pthread_attr_init( &attr ) != 0 )
138
-		throw GenericError("pthread_attr_init() failed");
139
-
140
-	pthread_attr_setstacksize( &attr, SS_TCC );
141
-
142
-	if( pthread_create(&maint_thread_tid,&attr,maint_thread_func,this) != 0 )
143
+	if( pthread_create(&maint_thread_tid, NULL, maint_thread_func, this) != 0 )
144
 		throw GenericError("pthread_create() failed.");
145
 
146
--- src/TextUI.cc	2011-08-03 13:34:45.000000000 -0400
147
+++ src/TextUI.cc	2015-03-23 16:24:20.000000000 -0400
148
@@ -80,11 +80,5 @@
149
 	run_displayer = true;
150
 
151
-	pthread_attr_t attr;
152
-	if( pthread_attr_init( &attr ) != 0 )
153
-		throw GenericError("pthread_attr_init() failed");
154
-
155
-	pthread_attr_setstacksize( &attr, SS_TUI );
156
-
157
-	if( pthread_create(&displayer_tid,&attr,displayer_thread_func,this) != 0 )
158
+	if (pthread_create(&displayer_tid, NULL, displayer_thread_func, this) != 0)
159
 		throw GenericError("pthread_create() returned an error.");
160
 
(-)tcptrack/files/patch-util.cc (-10 lines)
Lines 1-10 Link Here
1
--- src/util.cc-orig	2014-07-18 09:55:37.000000000 +0200
2
+++ src/util.cc	2014-07-18 09:56:11.000000000 +0200
3
@@ -22,6 +22,7 @@
4
 #include "util.h"
5
 #include <stdio.h>
6
 #include <cstring>
7
+#include <string>
8
 #include "headers.h"
9
 #ifdef HAVE_HASH_MAP
10
 # include <hash_map>
(-)tcptrack/pkg-descr (-7 / +8 lines)
Lines 1-8 Link Here
1
tcptrack is a sniffer which displays information about TCP connections it
1
Tcptrack is a network sniffer that displays information about
2
sees on a network interface. It passively watches for connections on the
2
TCP connections it sees on a network interface. It passively
3
network interface, keeps track of their state and displays a list of
3
watches for connections on the network interface, keeps track
4
connections in a manner similar to the unix 'top' command. It displays
4
of their state and displays a list of connections in a manner
5
source and destination addresses and ports, connection state, idle time, and
5
similar to the UNIX 'top' command. It displays source and
6
bandwidth usage.
6
destination addresses, and ports, connection state, idle time,
7
and bandwidth usage.
7
8
8
WWW: http://www.rhythm.cx/~steve/devel/tcptrack/
9
WWW: http://BSDforge.com/projects/net-mgmt/tcptrack/

Return to bug 198888