mdlayher / raw

Package raw enables reading and writing data at the device driver level for a network interface. MIT Licensed.
MIT License
425 stars 71 forks source link

raw: implement Stats on Linux only #29

Closed mdlayher closed 6 years ago

mdlayher commented 6 years ago

Retrieves stats from a packet socket on Linux. Information sourced from: http://man7.org/linux/man-pages/man7/packet.7.html.

mdlayher commented 6 years ago
      PACKET_STATISTICS
              Retrieve packet socket statistics in the form of a structure

                  struct tpacket_stats {
                      unsigned int tp_packets;  /* Total packet count */
                      unsigned int tp_drops;    /* Dropped packet count */
                  };

              Receiving statistics resets the internal counters.  The sta‐
              tistics structure differs when using a ring of variant
              TPACKET_V3.

Need to figure out if these counters should be cumulative inside the package or not.