cvs commit: src/sys/net bpf.h
Roman Kurakin
rik at cronyx.ru
Thu Jun 10 14:29:34 GMT 2004
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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
>
>
More information about the freebsd-net
mailing list