Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jan 1996 12:34:20 PST
From:      Bill Fenner <fenner@parc.xerox.com>
To:        Philippe Regnauld <regnauld@tetard.frmug.fr.net>
Cc:        hackers@freebsd.org (hackers)
Subject:   Re: tcpdump barfs on interface lp0 
Message-ID:  <96Jan22.123428pst.177479@crevenia.parc.xerox.com>
In-Reply-To: Your message of "Sat, 20 Jan 1996 18:50:57 PST." <199601210250.DAA00319@tetard.frmug.fr.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multipart MIME message.

--===_0_Mon_Jan_22_12:33:42_PST_1996
Content-Type: text/plain; charset=us-ascii

This is probably because the lpt driver incorrectly uses the DLT_NULL 
encapsulation; it prepends 2 bytes but tcpdump expects 4.  Try this patch.

  Bill


--===_0_Mon_Jan_22_12:33:42_PST_1996
Content-Type: application/octet-stream
Content-Description: lpt.c.diff

*** lpt.c.orig	Mon Jan 22 12:26:45 1996
--- lpt.c	Mon Jan 22 12:30:12 1996
***************
*** 1344,1360 ****
  	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->if_bpf, &m0);
  	}
--- 1344,1364 ----
  	if (ifp->if_bpf) {
  	    /*
  	     * We need to prepend the packet type as
! 	     * a two byte field.  The DLT_NULL encapsulation
! 	     * assumes a four byte header.  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;
! 	    struct {
! 		u_short type;
! 		u_short padding;
! 	    } nullhdr = { 0x800 };
  
  	    m0.m_next = m;
! 	    m0.m_len = 4;
! 	    m0.m_data = (char *)&nullhdr;
  
  	    bpf_mtap(ifp->if_bpf, &m0);
  	}

--===_0_Mon_Jan_22_12:33:42_PST_1996--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?96Jan22.123428pst.177479>