Re: Programmatically get ethernet interface speed?

From: David S. Miller (
Date: Wed Jul 11 2001 - 20:19:13 EST

Andrew Morton writes:
> Unfortunately we have no uniform way of doing this.

Really? ;-)

#include <linux/ethtool.h>

struct ethtool_cmd tmp;
int err;
err = ioctl(fd, ETHTOOL_GSET, &tmp);
if (err < 0) {
switch (tmp.speed) {
case SPEED_10: printf("10 Mb\n"); break;
case SPEED_100: printf("100 Mb\n"); break;
case SPEED_1000: printf("1000 Mb\n"); break;

David S. Miller
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to

This archive was generated by hypermail 2b29 : Sun Jul 15 2001 - 21:00:25 EST