Bug 92694

Summary: net/trafshow upgrade to 5.2.2 with better patches for FreeBSD
Product: Ports & Packages Reporter: Rudolf Čejka <cejkar>
Component: Individual Port(s)Assignee: Jean-Yves Lefort <jylefort>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Rudolf Čejka 2006-02-01 17:20:03 UTC
 
 Below is a patch (apply it with -p0 in /usr/ports/net directory please)
 for update of net/trafshow from 5.2.1 to 5.2.2. There is not a functional
 change from 5.2.1 to 5.2.2 (it was just preparation for gcc 4.0), however
 the patch contains much better workaround for bpf non-blocking brokenness
 in FreeBSD's kernel (kern/84823). Now it should produce results like
 trafshow3 with much better interactivity, IPv6 and some other possibilities.
 
 diff -urN trafshow.save/Makefile trafshow/Makefile
 --- trafshow.save/Makefile	Wed Feb  1 17:49:17 2006
 +++ trafshow/Makefile	Wed Feb  1 18:06:18 2006
 @@ -6,12 +6,10 @@
  #
  
  PORTNAME=	trafshow
 -PORTVERSION=	5.2.1
 -PORTREVISION=	1
 +PORTVERSION=	5.2.2
  PORTEPOCH=	1
  CATEGORIES=	net
 -MASTER_SITES=	${MASTER_SITE_NETBSD} \
 -		ftp://ftp.nsk.su/pub/RinetSoftware/
 +MASTER_SITES=	ftp://ftp.nsk.su/pub/RinetSoftware/
  EXTRACT_SUFX=	.tgz
  
  MAINTAINER=	ports@FreeBSD.org
 diff -urN trafshow.save/distinfo trafshow/distinfo
 --- trafshow.save/distinfo	Wed Feb  1 17:13:48 2006
 +++ trafshow/distinfo	Wed Feb  1 18:06:18 2006
 @@ -1,3 +1,3 @@
 -MD5 (trafshow-5.2.1.tgz) = e3ad2e3f1aac2e1bac9b467df44cf8f0
 -SHA256 (trafshow-5.2.1.tgz) = 7aa55cd88fe25b212ef15420fdf4a812d8296f6df3005ea77cde7c6716e9c574
 -SIZE (trafshow-5.2.1.tgz) = 123770
 +MD5 (trafshow-5.2.2.tgz) = 6fbf6668b87415ff0baa75021204a264
 +SHA256 (trafshow-5.2.2.tgz) = 7b6b014d9e67c9a09e66caa002208071d603067782c3b86e1ddb9a6aefe5ff25
 +SIZE (trafshow-5.2.2.tgz) = 124191
 diff -urN trafshow.save/files/patch-show_dump.c trafshow/files/patch-show_dump.c
 --- trafshow.save/files/patch-show_dump.c	Thu Jan  1 01:00:00 1970
 +++ trafshow/files/patch-show_dump.c	Wed Feb  1 18:08:17 2006
 @@ -0,0 +1,31 @@
 +--- show_dump.c.orig	Mon Jul 12 07:21:09 2004
 ++++ show_dump.c	Wed Feb  1 18:07:01 2006
 +@@ -21,6 +21,7 @@
 + #include <sys/param.h>
 + #include <sys/types.h>
 + #include <sys/socket.h>
 ++#include <sys/ioctl.h>
 + #include <sys/time.h>
 + #include <netinet/in.h>
 + #include <arpa/inet.h>
 +@@ -118,6 +119,7 @@
 +         bpf_u_int32 net;
 +         bpf_u_int32 mask;
 + 	char name[100], buf[256];
 ++	u_int v;
 + 
 + 	/* sanity check */
 + 	if (!ph || !ns) return -1;
 +@@ -141,6 +143,12 @@
 + 		if (!live_pcap) return -1;
 + 		if (pcap_setnonblock(live_pcap, 1, buf) < 0) {
 + 			screen_status("%s: %s", ph->name, buf);
 ++			show_dump_close();
 ++			return -1;
 ++		}
 ++		v = 1;
 ++		if (ioctl(pcap_fileno(live_pcap), BIOCIMMEDIATE, &v) < 0) {
 ++			screen_status("%s: %s", ph->name, strerror(errno));
 + 			show_dump_close();
 + 			return -1;
 + 		}
 diff -urN trafshow.save/files/patch-trafshow.c trafshow/files/patch-trafshow.c
 --- trafshow.save/files/patch-trafshow.c	Mon Nov  7 22:33:44 2005
 +++ trafshow/files/patch-trafshow.c	Wed Feb  1 18:08:02 2006
 @@ -1,11 +1,32 @@
 ---- trafshow.c.orig	Mon Jul 12 07:20:41 2004
 -+++ trafshow.c	Mon Nov  7 22:25:56 2005
 -@@ -305,7 +305,7 @@
 - 			fprintf(stderr, "%s: %s\n", dp->name, buf);
 - 			err++;
 +--- trafshow.c.orig	Sun Jan  8 08:05:29 2006
 ++++ trafshow.c	Wed Feb  1 18:07:33 2006
 +@@ -20,6 +20,7 @@
 + #endif
 + #include <sys/types.h>
 + #include <sys/socket.h>
 ++#include <sys/ioctl.h>
 + #include <stdio.h>
 + #include <stdlib.h>
 + #include <signal.h>
 +@@ -281,6 +282,7 @@
 + 	pcap_t *pd;
 + 	PCAP_HANDLER *ph, *ph_prev = 0;
 + 	char buf[256];
 ++	u_int v;
 + 
 + 	if (!ph_list) return -1;
 + 
 +@@ -307,6 +309,13 @@
   		}
 --		if (pcap_setnonblock(pd, 1, buf) < 0) {
 -+		if (pcap_setnonblock(pd, 0, buf) < 0) {
 + 		if (pcap_setnonblock(pd, 1, buf) < 0) {
   			fprintf(stderr, "%s: %s\n", dp->name, buf);
 ++			pcap_close(pd);
 ++			err++;
 ++			continue;
 ++		}
 ++		v = 1;
 ++		if (ioctl(pcap_fileno(pd), BIOCIMMEDIATE, &v) < 0) {
 ++			fprintf(stderr, "%s: %s\n", dp->name, strerror(errno));
   			pcap_close(pd);
   			err++;
 + 			continue;
Comment 1 Jean-Yves Lefort freebsd_committer freebsd_triage 2006-02-01 21:03:00 UTC
Responsible Changed
From-To: freebsd-ports-bugs->jylefort

Take.
Comment 2 Jean-Yves Lefort freebsd_committer freebsd_triage 2006-02-01 21:14:52 UTC
State Changed
From-To: open->closed

Committed, thanks!