BPF patch for addition of good feature linux packet(7)

From: Vladimir Yu. Stepanov (vys_at_renet.ru)
Date: 09/09/05

  • Next message: Vladimir Yu. Stepanov: "BPF patch for addition of good feature linux packet (7) (see attachment)"
    Date: Fri, 09 Sep 2005 10:17:45 +0400
    To: freebsd-net@freebsd.org
    
    
    

         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) */

    
    

    _______________________________________________
    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"


  • Next message: Vladimir Yu. Stepanov: "BPF patch for addition of good feature linux packet (7) (see attachment)"

    Relevant Pages

    • Re: bge dropping packets issue
      ... listening in this instance is using BPF. ... to understand how much can BPF take before dumping packets due to lack ... bpf is turned on on the receiver. ... packets at a send rate of about 400 kpps. ...
      (freebsd-net)
    • [ANN]: Microolap Packet Sniffer SDK 4.0
      ... The major release 4.0 of Packet Sniffer SDK is out: Ethernet emulation mode for Loopback traffic, Adjustable packets pool, support of x64systems in BPF JIT compiler, packets marking in BPF filter, the queue for packets sending..... ... Ethernet emulation mode for HNLBAdapter object is added. ... All objects, properties, methods, and events available for HNAdapter object now are available for Loopback adapter too. ...
      (borland.public.delphi.thirdpartytools.general)
    • Re: bpf/pcap are weird
      ... BIOCIMMEDIATE mode means "make incoming packets readable immediately; ... might want to try to get as many packets as possible per read on the BPF ... BIOCIMMEDIATE mode would probably still want to block, rather than spin, ... store buffer fills *OR* the timeout expires - then it does need to be ...
      (freebsd-arch)
    • Re: memory mapped packet capturing - bpf replacement ?
      ... > the point at which packets started to be dropped. ... A bit offtopic - what traffic generator you use? ... > still got the same number of copies as vanilla BPF. ... I am copying whole mbuf chain the same way BPF does. ...
      (freebsd-hackers)
    • bpf writes on tun device
      ... I would like to use the BPF device to write packets on a tun device, ... 5.X) says that BPF writes are only supported on Ethernet and SLIP links. ... I can successfully write BPF packets up to 1500 bytes in size (1496 IP ...
      (freebsd-net)