Date: Fri, 09 Sep 2005 10:17:45 +0400 From: "Vladimir Yu. Stepanov" <vys@renet.ru> To: freebsd-net@freebsd.org Subject: BPF patch for addition of good feature linux packet(7) Message-ID: <43212909.7060705@renet.ru>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------090304080609090509000802 Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Hello! I made a modernization of bpf realization. It have a mind when we are trying to use bpf to account network statistic. When packets is catching by filter thereis imposible to determine the direction of packets flows. Due to this problem statistic accounts two times when packets is routes by the same interface, because this packets counts as incoming and outgoing traffic. The prototype of this patch is packet(7) on linux. This patch is fully compatible with all program uses the bpf. It adds the tags means traffic direction to the struct bpf_hdr. struct bpf_hdr { struct timeval bh_tstamp; /* time stamp */ bpf_u_int32 bh_caplen; /* length of captured portion */ bpf_u_int32 bh_datalen; /* original length of packet */ u_short bh_hdrlen; /* length of bpf header (this struct plus alignment padding) */ u_short bh_pkttype; /* packet type */ }; /* * Packet types. * For help to get some extra information. * It is taken from the description packet(7) in Linux system. */ #define BPFPKTTYPE_HOST 0 /* To us */ #define BPFPKTTYPE_BROADCAST 1 /* To all */ #define BPFPKTTYPE_MULTICAST 2 /* To group */ #define BPFPKTTYPE_OTHERHOST 3 /* To someone else */ #define BPFPKTTYPE_OUTGOING 4 /* Outgoing of any type */ #define BPFPKTTYPE_LOOPBACK 5 /* MC/BRD frame looped back */ #define BPFPKTTYPE_FASTROUTE 6 /* Fastrouted frame (if cannot detect MC/BRD type) */ --------------090304080609090509000802--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43212909.7060705>