From owner-freebsd-net@FreeBSD.ORG Thu Jun 10 14:29:34 2004 Return-Path: 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 95F2716A4CE for ; Thu, 10 Jun 2004 14:29:34 +0000 (GMT) Received: from hanoi.cronyx.ru (hanoi.cronyx.ru [144.206.181.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6365243D45 for ; Thu, 10 Jun 2004 14:29:33 +0000 (GMT) (envelope-from rik@cronyx.ru) Received: (from root@localhost) by hanoi.cronyx.ru id i5AEQ3w2045257 for net@FreeBSD.org.checked; (8.12.8/vak/2.1) Thu, 10 Jun 2004 18:26:03 +0400 (MSD) (envelope-from rik@cronyx.ru) Received: from cronyx.ru (hi.cronyx.ru [144.206.181.94]) by hanoi.cronyx.ru with ESMTP id i5AENoIE045173; (8.12.8/vak/2.1) Thu, 10 Jun 2004 18:23:50 +0400 (MSD) (envelope-from rik@cronyx.ru) Message-ID: <40C86EAD.8080508@cronyx.ru> Date: Thu, 10 Jun 2004 18:22:37 +0400 From: Roman Kurakin User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6b) Gecko/20031208 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Guy Harris References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: net@FreeBSD.org Subject: Re: cvs commit: src/sys/net bpf.h X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jun 2004 14:29:34 -0000 Yea, I think the same. rik Guy Harris wrote: >> This commit reminded me one of my old ideas. Why not to make some >> function that allow to change DLT on the fly? > > > Such as NetBSD's "bpf_change_type()"? > > /* > * Change the data link type of a interface. > */ > void > bpf_change_type(ifp, dlt, hdrlen) > struct ifnet *ifp; > u_int dlt, hdrlen; > { > struct bpf_if *bp; > > for (bp = bpf_iflist; bp != NULL; bp = bp->bif_next) { > if (bp->bif_driverp == (struct bpf_if **)&ifp->if_bpf) > break; > } > if (bp == NULL) > panic("bpf_change_type"); > > bp->bif_dlt = dlt; > > /* > * Compute the length of the bpf header. This is not necessarily > * equal to SIZEOF_BPF_HDR because we want to insert spacing such > * that the network layer header begins on a longword boundary > (for > * performance reasons and to alleviate alignment restrictions). > */ > bp->bif_hdrlen = BPF_WORDALIGN(hdrlen + SIZEOF_BPF_HDR) - hdrlen; > } > > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > >