From owner-freebsd-net@FreeBSD.ORG Wed Jun 9 21:27:25 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 858A916A4D2 for ; Wed, 9 Jun 2004 21:27:25 +0000 (GMT) Received: from mail-out3.apple.com (mail-out3.apple.com [17.254.13.22]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5E12A43D1F for ; Wed, 9 Jun 2004 21:27:25 +0000 (GMT) (envelope-from guy@alum.mit.edu) Received: from mailgate1.apple.com (a17-128-100-225.apple.com [17.128.100.225]) by mail-out3.apple.com (8.12.11/8.12.11) with ESMTP id i59LRL5X020716 for ; Wed, 9 Jun 2004 14:27:22 -0700 (PDT) Received: from relay3.apple.com (relay3.apple.com) by mailgate1.apple.com ; Wed, 9 Jun 2004 14:27:21 -0700 Received: from [17.202.40.208] (gharris.apple.com [17.202.40.208]) by relay3.apple.com (8.12.11/8.12.11) with ESMTP id i59LRJH7023846; Wed, 9 Jun 2004 14:27:20 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v618) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Guy Harris Date: Wed, 9 Jun 2004 14:27:19 -0700 To: Roman Kurakin X-Mailer: Apple Mail (2.618) 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: Wed, 09 Jun 2004 21:27:25 -0000 > 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; }