Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jul 1998 19:40:01 -0700 (PDT)
From:      Bill Fenner <fenner@FreeBSD.ORG>
To:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: bin/7241: tcpdump does not work with parallel line IP
Message-ID:  <199807120240.TAA14593@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/7241; it has been noted by GNATS.

From: Bill Fenner <fenner@FreeBSD.ORG>
To: freebsd-gnats-submit@FreeBSD.org, peter.jeremy@alcatel.com.au
Cc:  Subject: Re: bin/7241: tcpdump does not work with parallel line IP
Date: Sat, 11 Jul 1998 16:31:38 -0700 (PDT)

 In fact, I just found these diffs in my home directory on freefall; seems
 that I tried to address this issue in early 1997 but didn't find anyone
 to test the patches.  Would you mind testing this patch?
 
 Thanks,
   Bill
 
 Index: sys_i386_isa/lpt.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/i386/isa/lpt.c,v
 retrieving revision 1.58
 diff -c -r1.58 lpt.c
 *** lpt.c	1997/02/22 09:36:51	1.58
 --- lpt.c	1997/03/10 07:59:44
 ***************
 *** 880,886 ****
   	printf("lp%d: TCP/IP capable interface\n", unit);
   
   #if NBPFILTER > 0
 ! 	bpfattach(ifp, DLT_NULL, LPIPHDRLEN);
   #endif
   }
   /*
 --- 880,886 ----
   	printf("lp%d: TCP/IP capable interface\n", unit);
   
   #if NBPFILTER > 0
 ! 	bpfattach(ifp, DLT_NULL, sizeof(u_int));
   #endif
   }
   /*
 ***************
 *** 1102,1107 ****
 --- 1102,1126 ----
   	    sc->sc_if.if_ibytes += len;
   	    top = m_devget(sc->sc_ifbuf + CLPIPHDRLEN, len, 0, &sc->sc_if, 0);
   	    if (top) {
 + #if NBPFILTER > 0
 + 		if (sc->sc_if.if_bpf) {
 + 		    /*
 + 		     * We need to prepend the address family as
 + 		     * a four byte field.  Cons up a dummy header
 + 		     * to pacify bpf.  This is safe because bpf
 + 		     * will only read from the mbuf (i.e., it won't
 + 		     * try to free it or keep a pointer to it).
 + 		     */
 + 		    struct mbuf m0;
 + 		    u_int af = AF_INET;
 + 
 + 		    m0.m_next = top;
 + 		    m0.m_len = 4;
 + 		    m0.m_data = (char *)&af;
 + 
 + 		    bpf_mtap(ifp, &m0);
 + 		}
 + #endif
   	        IF_ENQUEUE(&ipintrq, top);
   	        schednetisr(NETISR_IP);
   	    }
 ***************
 *** 1146,1161 ****
   		IF_DROP(&ipintrq);
   		goto done;
   	    }
 - #if NBPFILTER > 0
 - 	    if (sc->sc_if.if_bpf) {
 - 		bpf_tap(&sc->sc_if, sc->sc_ifbuf, len);
 - 	    }
 - #endif
   	    len -= LPIPHDRLEN;
   	    sc->sc_if.if_ipackets++;
   	    sc->sc_if.if_ibytes += len;
   	    top = m_devget(sc->sc_ifbuf + LPIPHDRLEN, len, 0, &sc->sc_if, 0);
   	    if (top) {
   		    IF_ENQUEUE(&ipintrq, top);
   		    schednetisr(NETISR_IP);
   	    }
 --- 1165,1194 ----
   		IF_DROP(&ipintrq);
   		goto done;
   	    }
   	    len -= LPIPHDRLEN;
   	    sc->sc_if.if_ipackets++;
   	    sc->sc_if.if_ibytes += len;
   	    top = m_devget(sc->sc_ifbuf + LPIPHDRLEN, len, 0, &sc->sc_if, 0);
   	    if (top) {
 + #if NBPFILTER > 0
 + 		    if (sc->sc_if.if_bpf) {
 + 			    /*
 + 			     * We need to prepend the address family as
 + 			     * a four byte field.  Cons up a dummy header
 + 			     * to pacify bpf.  This is safe because bpf
 + 			     * will only read from the mbuf (i.e., it won't
 + 			     * try to free it or keep a pointer to it).
 + 			     */
 + 			    struct mbuf m0;
 + 			    u_int af = AF_INET;
 + 
 + 			    m0.m_next = top;
 + 			    m0.m_len = 4;
 + 			    m0.m_data = (char *)&af;
 + 
 + 			    bpf_mtap(ifp, &m0);
 + 		    }
 + #endif
   		    IF_ENQUEUE(&ipintrq, top);
   		    schednetisr(NETISR_IP);
   	    }
 ***************
 *** 1225,1230 ****
 --- 1258,1283 ----
       /* Suspend (on laptops) or receive-errors might have taken us offline */
       outb(lpt_ctrl_port, LPC_ENA);
   
 + #if NBPFILTER > 0
 +     if (ifp->if_bpf) {
 + 	/*
 + 	 * We need to prepend the address family as
 + 	 * a four byte field.  Cons up a dummy header
 + 	 * to pacify bpf.  This is safe because bpf
 + 	 * will only read from the mbuf (i.e., it won't
 + 	 * try to free it or keep a pointer to it).
 + 	 */
 + 	struct mbuf m0;
 + 	u_int af = AF_INET;
 + 
 + 	m0.m_next = m;
 + 	m0.m_len = 4;
 + 	m0.m_data = (char *)&af;
 + 
 + 	bpf_mtap(ifp, &m0);
 +     }
 + #endif
 + 
       if (ifp->if_flags & IFF_LINK0) {
   
   	if (!(inb(lpt_stat_port) & CLPIP_SHAKE)) {
 ***************
 *** 1334,1358 ****
       } else {
   	ifp->if_opackets++;
   	ifp->if_obytes += m->m_pkthdr.len;
 - #if NBPFILTER > 0
 - 	if (ifp->if_bpf) {
 - 	    /*
 - 	     * We need to prepend the packet type as
 - 	     * a two byte field.  Cons up a dummy header
 - 	     * to pacify bpf.  This is safe because bpf
 - 	     * will only read from the mbuf (i.e., it won't
 - 	     * try to free it or keep a pointer to it).
 - 	     */
 - 	    struct mbuf m0;
 - 	    u_short hdr = 0x800;
 - 
 - 	    m0.m_next = m;
 - 	    m0.m_len = 2;
 - 	    m0.m_data = (char *)&hdr;
 - 
 - 	    bpf_mtap(ifp, &m0);
 - 	}
 - #endif
       }
   
       m_freem(m);
 --- 1387,1392 ----

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



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