From owner-freebsd-net@FreeBSD.ORG Wed Feb 14 23:29:54 2007 Return-Path: X-Original-To: freebsd-net@FreeBSD.org Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A945C16A401 for ; Wed, 14 Feb 2007 23:29:54 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from anuket.mj.niksun.com (gwnew.niksun.com [65.115.46.162]) by mx1.freebsd.org (Postfix) with ESMTP id 71AA113C428 for ; Wed, 14 Feb 2007 23:29:54 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from niksun.com (anuket [10.70.0.5]) by anuket.mj.niksun.com (8.13.6/8.13.6) with ESMTP id l1EN5PsI089277 for ; Wed, 14 Feb 2007 18:05:25 -0500 (EST) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-net@FreeBSD.org Date: Wed, 14 Feb 2007 18:05:15 -0500 User-Agent: KMail/1.6.2 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200702141805.20228.jkim@FreeBSD.org> X-Virus-Scanned: ClamAV 0.88.6/2568/Wed Feb 14 10:42:10 2007 on anuket.mj.niksun.com X-Virus-Status: Clean Cc: Subject: [PATCH] BPF to support directions and more X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2007 23:29:54 -0000 I was playing with some BPF ideas for few days and I added two new features. SEESENT flag is extended to see only outgoing packets, which is analogous to libpcap's PCAP_D_OUT direction. Thus SEESENT is now called DIRECTION. Second feature is feedback mode (sort of simulated hardware loopback), i.e., when packets are injected, you can feed them back as if they are coming from the wire. You can debug link layer protocols easily with this without second machine, network controller, or loopback plug. It's only tested with Ethernet, though. All necessary patches (including libpcap modification) are here: http://people.freebsd.org/~jkim/bpf_feedback.diff Don't forget to turn off all hardware assisted features (e.g., RX/TX checksum offloading) to test feedback mode. Otherwise, packets will be dropped. Jung-uk Kim Note: Actually I started this for QEMU networking, so that's another example. See: http://docs.freebsd.org/cgi/mid.cgi?200702092002.31220.jkim