Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 May 2008 16:10:31 GMT
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 142260 for review
Message-ID:  <200805251610.m4PGAV9s099844@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=142260

Change 142260 by rpaulo@rpaulo_epsilon on 2008/05/25 16:10:18

	Add groundwork for pcap dumping routines.

Affected files ...

.. //depot/projects/soc2008/rpaulo-tcpad/Makefile#3 edit
.. //depot/projects/soc2008/rpaulo-tcpad/dumper.c#1 add
.. //depot/projects/soc2008/rpaulo-tcpad/dumper.h#1 add
.. //depot/projects/soc2008/rpaulo-tcpad/handler.c#4 edit
.. //depot/projects/soc2008/rpaulo-tcpad/tcpad.h#4 edit

Differences ...

==== //depot/projects/soc2008/rpaulo-tcpad/Makefile#3 (text+ko) ====

@@ -1,7 +1,7 @@
-# $P4: //depot/projects/soc2008/rpaulo-tcpad/Makefile#2 $
+# $P4: //depot/projects/soc2008/rpaulo-tcpad/Makefile#3 $
 
 PROG=tcpad
-SRCS=main.c device.c linkhdr.c handler.c
+SRCS=main.c device.c linkhdr.c handler.c dumper.c
 WARNS=5
 CFLAGS+=-DDEBUG
 LDADD=-lpcap

==== //depot/projects/soc2008/rpaulo-tcpad/handler.c#4 (text+ko) ====

@@ -23,7 +23,7 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/soc2008/rpaulo-tcpad/handler.c#3 $
+ * $P4: //depot/projects/soc2008/rpaulo-tcpad/handler.c#4 $
  */
 
 #include <stdio.h>
@@ -40,9 +40,10 @@
 #include <arpa/inet.h>
 #include <pcap.h>
 
-#include "tcpad.h"
 #include "linkhdr.h"
 #include "handler.h"
+#include "dumper.h"
+#include "tcpad.h"
 #include "debug.h"
 
 
@@ -51,7 +52,7 @@
 static void	print_packet(const unsigned char *bytes, const int linkhlen);
 
 void
-tcpad_pcaphandler(unsigned char *user, const struct pcap_pkthdr *h __unused,
+tcpad_pcaphandler(unsigned char *user, const struct pcap_pkthdr *ph,
     const unsigned char *bytes)
 {
 	const struct ip *ip;
@@ -90,6 +91,8 @@
 		DPRINTF("%s\n",inet_ntoa(cp->dv4addr));
 		LIST_INSERT_HEAD(&chead, cp, entries);
 		print_packet(bytes, linkhlen);
+		TAILQ_INIT(&cp->pktshead);
+		dumper_addpkt(ph, bytes);
 	} else if ((tcp->th_flags & TH_FLAGS) == (TH_SYN|TH_ACK)) {
 		if (cp) {
 			DPRINTF("connection already being tracked!\n");

==== //depot/projects/soc2008/rpaulo-tcpad/tcpad.h#4 (text+ko) ====

@@ -23,7 +23,7 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/soc2008/rpaulo-tcpad/tcpad.h#3 $
+ * $P4: //depot/projects/soc2008/rpaulo-tcpad/tcpad.h#4 $
  */
 
 #ifndef _TCPAD_H_
@@ -39,7 +39,7 @@
 	unsigned short sport;
 	int tcpstate;		/* TCP FSM state */
 	int isv6;
-	struct dumppkth *pktshead;
+	struct dumppkth pktshead;
 } conn_t;
 
 LIST_HEAD(chead, _conn_t) chead;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805251610.m4PGAV9s099844>