From owner-freebsd-net@FreeBSD.ORG Fri Nov 3 21:00:38 2006 Return-Path: X-Original-To: net@freebsd.org Delivered-To: freebsd-net@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4860516A503 for ; Fri, 3 Nov 2006 21:00:38 +0000 (UTC) (envelope-from newroswell@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.171]) by mx1.FreeBSD.org (Postfix) with ESMTP id 379AE43D8C for ; Fri, 3 Nov 2006 21:00:27 +0000 (GMT) (envelope-from newroswell@gmail.com) Received: by ug-out-1314.google.com with SMTP id o2so469344uge for ; Fri, 03 Nov 2006 13:00:26 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=FK5SHSm80Ccb5mmP7ED3oEX2TLm+gpsMPNDU7ryhzTl62VAerD4l6GbBwbPsteTDLCo+FUR0QxuDmFIWJUhYDc8/uJVPKLWgj9vdlbFAQXAC+UFeul0CL5+ESQqb9kWVcwj97q9LPrXdbxkVEX3sd1yb0mmoClWDnqze94BxKYA= Received: by 10.78.17.1 with SMTP id 1mr119205huq.1162587625268; Fri, 03 Nov 2006 13:00:25 -0800 (PST) Received: by 10.78.192.15 with HTTP; Fri, 3 Nov 2006 13:00:20 -0800 (PST) Message-ID: <375baf50611031300n6a8088cbx49f121dfe1e6a644@mail.gmail.com> Date: Fri, 3 Nov 2006 13:00:20 -0800 From: "Kevin Sanders" To: "Andrew Thompson" In-Reply-To: <20061103015215.GA31234@heff.fud.org.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <375baf50611021745m6d097245y4670d5741ffbd64a@mail.gmail.com> <20061103015215.GA31234@heff.fud.org.nz> Cc: net@freebsd.org Subject: Re: pfil on bridge interface, looking for ether_header 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: Fri, 03 Nov 2006 21:00:38 -0000 On 11/2/06, Andrew Thompson wrote: > On Thu, Nov 02, 2006 at 05:45:50PM -0800, Kevin Sanders wrote: > > I've written a kernel module that has pfil_add_hook'ed into the pfil > > framework. When my input packet filter function is called, I can > > mtod(*m, struct IP *) to the IP header, but haven't found a way to > > find the original ethernet header. > > If you look in if_bridge.c:bridge_pfil you will see that the ethernet > header is stripped from the mbuf before passing to pfil. You may want to > create another hook such as ether_pfil_hook and modify the bridge to use > it. Alternatively see the recent discussion between Julian and Andre on > the matter. I've got a simple fix for this that solves my immediate need (to be able to reach the ethernet header). I grepped around, and don't see much use of the m_pkthdr.header value anymore, and this doesn't appear to break anything yet. *** if_bridge.c 21 Oct 2006 12:10:39 -0700 1.11.2.40 --- if_bridge.c 03 Nov 2006 11:46:15 -0800 *************** *** 2781,2786 **** --- 2781,2787 ---- ipfwpass: error = 0; + (*mp)->m_pkthdr.header = &eh2; /* * Run the packet through pfil *************** *** 2902,2907 **** --- 2903,2909 ---- if (*mp == NULL) return (error); bcopy(&eh2, mtod(*mp, caddr_t), ETHER_HDR_LEN); + (*mp)->m_pkthdr.header = NULL; return (0);