ports/65379: Update net/trafshow to 4.0

Andrew Thompson andy at fud.org.nz
Fri Apr 9 21:50:27 UTC 2004


>Number:         65379
>Category:       ports
>Synopsis:       Update net/trafshow to 4.0
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 09 14:50:26 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Thompson
>Release:        FreeBSD 5.2.1-RELEASE i386
>Organization:
>Environment:
System: FreeBSD kate.fud.org.nz 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #0: Fri Feb 27 23:34:15 NZDT 2004 root at kate.fud.org.nz:/usr/obj/usr/src/sys/KATE i386


	
>Description:
Update trafshow to 4.0. If the current maintainer wants to drop the port, I am
happy to take over maintainership :)
	
>How-To-Repeat:
Apply patch
	
>Fix:

patch also available from http://www.fud.org.nz/~andy/trafshow-port.patch


diff -urN net/trafshow.orig/Makefile net/trafshow/Makefile
--- net/trafshow.orig/MakefileTue Apr  6 20:19:03 2004
+++ net/trafshow/MakefileTueTue Apr  6 20:30:37 2004
@@ -6,11 +6,9 @@
 #
 
 PORTNAME=	trafshow
-PORTVERSION=	3.1
-PORTREVISION=	3
+PORTVERSION=	4.0
 CATEGORIES=	net
-MASTER_SITES=	ftp://ftp.sasknow.com/pub/trafshow/ \
-		ftp://ftp.nsk.su/pub/RinetSoftware/
+MASTER_SITES=	ftp://ftp.nsk.su/pub/RinetSoftware/
 EXTRACT_SUFX=	.tgz
 
 MAINTAINER=	ryan at sasknow.com
diff -urN net/trafshow.orig/distinfo net/trafshow/distinfo
--- net/trafshow.orig/distinfoTue Apr  6 20:19:03 2004
+++ net/trafshow/distinfoTueTue Apr  6 18:03:09 2004
@@ -1,2 +1,2 @@
-MD5 (trafshow-3.1.tgz) = 085b99f160002a269b358aab1c5004f0
-SIZE (trafshow-3.1.tgz) = 72342
+MD5 (trafshow-4.0.tgz) = 994355d6ba98d96ce06db9c92ae41669
+SIZE (trafshow-4.0.tgz) = 76376
diff -urN net/trafshow.orig/files/patch-aa net/trafshow/files/patch-aa
--- net/trafshow.orig/files/patch-aaThu Jan  1 12:00:00 1970
+++ net/trafshow/files/patch-aaThuTue Apr  6 18:03:09 2004
@@ -0,0 +1,60 @@
+diff -urN display.c display.c
+--- display.comSat Dec 20 02:17:57 2003
++++ display.comSatWed Mar 31 20:55:16 2004
+@@ -549,7 +549,7 @@
+ 
+ 	collect(&te);
+ 
+-	if (alarm_flag) {
++	if (alarm_flag && !rflag) {
+ 		alarm_flag = 0;
+ 		if (resize_flag) {
+ 			resize_flag = 0;
+@@ -561,7 +561,7 @@
+ refresh_screen:
+ 	if (kflag && kbhit(0) && get_keyb()) scr_redraw(FALSE);
+ 
+-	scr_update();
++	if (!rflag) scr_update();
+ 	return;
+ }
+ 
+diff -urN trafshow.c trafshow.c
+--- trafshow.collectFri Dec 19 22:08:30 2003
++++ trafshow.collectFriWed Mar 31 20:53:52 2004
+@@ -49,6 +49,7 @@
+ int pflag = 0;		/* don't put the interface into promiscuous mode */
+ int kflag = 1;		/* disable keyboard input checking */
+ int eflag = 0;		/* show ethernet traffic rather than ip */
++int rflag = 0;		/* user specified screen refresh */
+ 
+ /* global variables */
+ char *program_name;		/* myself */
+@@ -142,6 +143,7 @@
+ 			++pflag;
+ 			break;
+ 		case 'r':
++			++rflag;
+ 			scr_interval = atoi(optarg);
+ 			if (scr_interval < 1) usage();
+ 			break;
+@@ -244,7 +246,7 @@
+ void
+ onalarm()
+ {
+-	if (alarm_flag) {
++	if (alarm_flag || rflag) {
+ 		if (resize_flag) {
+ 			resize_flag = 0;
+ 			init_term(TRUE);
+diff -urN trafshow.h trafshow.h
+--- trafshow.httpFri Dec 19 17:39:57 2003
++++ trafshow.httpFriWed Mar 31 20:51:55 2004
+@@ -107,6 +107,7 @@
+ extern int nflag;
+ extern int Nflag;
+ extern int eflag;
++extern int rflag;
+ extern int page_size;
+ extern int resize_flag;
+ extern int addr_size;
diff -urN net/trafshow.orig/files/patch-ag net/trafshow/files/patch-ag
--- net/trafshow.orig/files/patch-agTue Apr  6 20:19:01 2004
+++ net/trafshow/files/patch-agTueTue Apr  6 18:03:09 2004
@@ -1,8 +1,8 @@
---- util.c.origFri Sep 15 06:51:11 2000
-+++ util.caseThu Sep 21 14:35:33 2000
-@@ -129,6 +129,9 @@
- #ifdefIPPROTO_ENCAP
- 	{ "encap",IPPROTO_ENCAP},
+--- util.c.origFriWed Mar 31 22:36:05 2004
++++ util.caseThuWed Mar 31 22:36:08 2004
+@@ -144,6 +144,9 @@
+ #ifdef IPPROTO_MOBILE
+ 	{ "mobile", IPPROTO_MOBILE},
  #endif
 +#ifdefIPPROTO_IPV6
 +	{ "ipv6", IPPROTO_IPV6},
diff -urN net/trafshow.orig/files/patch-ah net/trafshow/files/patch-ah
--- net/trafshow.orig/files/patch-ahTue Apr  6 20:19:01 2004
+++ net/trafshow/files/patch-ahTueTue Apr  6 20:24:34 2004
@@ -1,51 +1,91 @@
---- display.c.origSun Aug 23 21:51:48 1998
-+++ display.caseThuWedFri Dec  6 12:17:55 2002
-@@ -54,6 +54,7 @@
+--- display.c.origSunTue Apr  6 20:09:28 2004
++++ display.caseThuWedFriTue Apr  6 20:09:04 2004
+@@ -60,6 +60,9 @@
  static int l_nflag, l_eflag;
  static int n_entries;
  static int err_pos;
-+extern struct t_entry t_mask;  /* traffic mask */
++extern struct sockaddr_in s_mask;	/* source traffic mask */
++extern struct sockaddr_in d_mask;	/* destination traffic mask */
++extern int p_mask;			/* protocol mask */
  
  void
  init_display(reinit)
-@@ -282,6 +284,13 @@
+@@ -338,14 +341,27 @@
+ 	register p_entry e;
+ {
+ 	register i, j;
++	struct sockaddr_in *s_sin, *d_sin;
++	struct sockaddr *s;
+ 
  	packets_total++;
  	bytes_total += e->bytes;
  	j = page * page_size;
++	s = (struct sockaddr *)&e->src;
 +
-+	e->src.s_addr &= t_mask.src.s_addr;
-+	e->dst.s_addr &= t_mask.dst.s_addr;
-+	e->sport &= t_mask.sport;
-+	e->dport &= t_mask.dport;
-+	e->proto &= t_mask.proto;
-+
++	if (s->sa_family == AF_INET) {
++	        s_sin = (struct sockaddr_in *)&e->src;
++	        d_sin = (struct sockaddr_in *)&e->dst;
++		s_sin->sin_addr.s_addr &= s_mask.sin_addr.s_addr;
++		d_sin->sin_addr.s_addr &= d_mask.sin_addr.s_addr;
++		s_sin->sin_port &= s_mask.sin_port;
++		d_sin->sin_port &= d_mask.sin_port;
++		e->proto &= p_mask; 
++	}
++	
  	for (i = 0; i < n_entry; i++) {
- 		if (memcmp(&e->eh, &entries[i].eh, sizeof(e->eh)) == 0 &&
- 		    e->src.s_addr == entries[i].src.s_addr &&
---- trafshow.c.origSunTueFri Aug 28 00:15:57 1998
-+++ trafshow.caseThuWedFriTueFri Dec  6 12:34:09 2002
-@@ -48,6 +48,7 @@
- int pflag = 0;		/* don't put the interface into promiscuous mode */
+-		if (memcmp(&e->eh, &entries[i].eh, sizeof(e->eh)) == 0 &&
+-		    ipaddr_compar(&e->src, &e->src) &&
+-		    ipaddr_compar(&e->dst, &e->dst) &&
++		if (ipaddr_compar(&e->src, &entries[i].src) &&
++		    ipaddr_compar(&e->dst, &entries[i].dst) &&
+ 		    e->proto == entries[i].proto) {
+ 			entries[i].bytes += e->bytes;
+ 			if (i >= j && i < j + page_size)
+--- trafshow.1.origSunTueFriFri Dec 19 22:03:28 2003
++++ trafshow.19Tue Apr  6 20:09:04 2004
+@@ -49,6 +49,16 @@
+ .B \-k
+ Disable input keyboard checking. It is intended to avoid loss of packets.
+ .TP
++.B \-m
++[src-ip M] [dst-ip M] [src-port M] [dst-port M] [proto M]
++.br
++Mask the specified field with mask M (which should be specified
++as an hex number e.g. 0xffff0000) before further processing
++of the packet. This allows to aggregate traffic in the display
++to ease analysis.
++.br
++.The masks for all field not specified will be set to 0.
++.TP
+ .B \-n
+ Don't convert host addresses and port numbers to names.
+ .TP
+--- trafshow.c.origSunTueFriFriTue Apr  6 20:09:28 2004
++++ trafshow.convertTue Apr  6 20:09:04 2004
+@@ -50,6 +50,9 @@
  int kflag = 1;		/* disable keyboard input checking */
  int eflag = 0;		/* show ethernet traffic rather than ip */
-+struct t_entry t_mask;	/* traffic mask */
+ int rflag = 0;		/* user specified screen refresh */
++struct sockaddr_in s_mask;	/* source traffic mask */
++struct sockaddr_in d_mask;	/* destination traffic mask */
++int p_mask;			/* protocol mask */
  
  /* global variables */
  char *program_name;		/* myself */
-@@ -78,6 +79,12 @@
+@@ -81,6 +84,12 @@
  	extern int abort_on_misalignment();
  	extern pcap_handler lookup_if();
  
-+	t_mask.src.s_addr = 0xffffffff;	/* all bits valid */
-+	t_mask.dst.s_addr = 0xffffffff;	/* all bits valid */
-+	t_mask.sport = 0xffff;		/* all bits valid */
-+	t_mask.dport = 0xffff;		/* all bits valid */
-+	t_mask.proto = 0xffff;		/* all bits valid */
++	s_mask.sin_addr.s_addr = 0xffffffff;	/* all bits valid */
++	d_mask.sin_addr.s_addr = 0xffffffff;	/* all bits valid */
++	s_mask.sin_port = 0xffff;		/* all bits valid */
++	d_mask.sin_port = 0xffff;		/* all bits valid */
++	p_mask = 0xffff;			/* all bits valid */
 +
  	cnt = -1;
- 	device_name = NULL;
- 	infile = NULL;
-@@ -94,7 +87,7 @@
+ 	netflow = 0;
+ #ifdefIPPROTO_IPV6INET6
+@@ -98,7 +107,7 @@
  
  	if (abort_on_misalignment(ebuf) < 0) error(0, ebuf);
  
@@ -54,66 +94,43 @@
  		switch (op) {
  		case 'C':
  #ifdefIPPROTO_IPV6INET6HAVE_SLCURSES
-@@ -114,6 +121,40 @@
+@@ -129,6 +138,39 @@
  			break;
  		case 'k':
  			kflag = 0;
 +			break;
 +		case 'm':
-+			t_mask.src.s_addr = 0;
-+			t_mask.dst.s_addr = 0;
-+			t_mask.sport = 0;
-+			t_mask.dport = 0;
-+			t_mask.proto = 0;
++			s_mask.sin_addr.s_addr = 0;
++			d_mask.sin_addr.s_addr = 0;
++			s_mask.sin_port = 0;
++			d_mask.sin_port = 0;
++			p_mask = 0;
 +			for (;optind + 1 <= argc;) {
-+			    char *s = argv[optind];
-+			    u_int32_t arg = 0xffffffff;
-+			    int save=optind;
-+			    
-+			    optind++;
-+			    if (optind + 1 <= argc &&
-+				    isdigit(*(argv[optind])) ) {
-+				arg = strtoul(argv[optind], NULL, 0);
++				char *s = argv[optind];
++				u_int32_t arg = 0xffffffff;
++				int save=optind;
 +				optind++;
-+			    }
-+				
-+			    if (!strcmp(s, "src-ip"))
-+				t_mask.src.s_addr = htonl(arg);
-+			    else if (!strcmp(s, "dst-ip"))
-+				t_mask.dst.s_addr = htonl(arg);
-+			    else if (!strcmp(s, "src-port"))
-+				t_mask.sport = htons((u_short)(arg));
-+			    else if (!strcmp(s, "dst-port"))
-+				t_mask.dport = htons((u_short)(arg));
-+			    else if (!strcmp(s, "proto"))
-+				t_mask.proto = arg;
-+			    else {
-+				optind = save;
-+				break;
-+			    }
++				if (optind + 1 <= argc &&
++						isdigit(*(argv[optind])) ) {
++					arg = strtoul(argv[optind], NULL, 0);
++					optind++;
++				}
++
++				if (!strcmp(s, "src-ip"))
++					s_mask.sin_addr.s_addr = htonl(arg);
++				else if (!strcmp(s, "dst-ip"))
++					d_mask.sin_addr.s_addr = htonl(arg);
++				else if (!strcmp(s, "src-port"))
++					s_mask.sin_port = htons((u_short)(arg));
++				else if (!strcmp(s, "dst-port"))
++					d_mask.sin_port = htons((u_short)(arg));
++				else if (!strcmp(s, "proto"))
++					p_mask = arg;
++				 else {
++					 optind = save;
++					 break;
++				 }
 +			}
  			break;
  		case 'n':
  			++nflag;
---- trafshow.1.origSunTueFriFriTueFri Aug 28 09:37:38 1998
-+++ trafshow.1998Tue Apr 15 22:32:21 2003
-@@ -42,6 +42,16 @@
- .B \-k
- Disable input keyboard checking. It is intended to avoid loss of packets.
- .TP
-+.B \-m
-+[src-ip M] [dst-ip M] [src-port M] [dst-port M] [proto M]
-+.br
-+Mask the specified field with mask M (which should be specified
-+as an hex number e.g. 0xffff0000) before further processing
-+of the packet. This allows to aggregate traffic in the display
-+to ease analysis.
-+.br
-+.The masks for all field not specified will be set to 0.
-+.TP
- .B \-n
- Don't convert host addresses and port numbers to names.
- .TP
-
-
-


	


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list