Fetch dropped packet count of an interface with netlink sockets

Viewed 188

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?

1 Answers

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.

Related