Date: Thu, 10 Jun 2004 18:22:37 +0400 From: Roman Kurakin <rik@cronyx.ru> To: Guy Harris <guy@alum.mit.edu> Cc: net@FreeBSD.org Subject: Re: cvs commit: src/sys/net bpf.h Message-ID: <40C86EAD.8080508@cronyx.ru> In-Reply-To: <C9710634-BA5B-11D8-B046-000A958097E4@alum.mit.edu> References: <C9710634-BA5B-11D8-B046-000A958097E4@alum.mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
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"
>
>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40C86EAD.8080508>
