2

I am familiar with different tools (like netstat, tcpdump, etc.) and files (like /sys/class/net/<dev>/statistics) with which we can get the count.

But can anyone tell me if there is a way of getting that information directly from the kernel, using netlink sockets?

Dusan
  • 95
  • 5

1 Answers1

1

Sure, take a look at IFLA_STATS. You may want to check the ifstat.c file of the iproute2 package, which is pretty much the standard tool to interact with netlink.

Cheatah
  • 1,825
  • 2
  • 13
  • 21