Merge pull request #334 from stapelberg/speed

fix ethernet speed display for 100 Gbit/s cards
This commit is contained in:
Ingo Bürk 2019-01-27 22:40:46 +01:00 committed by GitHub
commit 1f3fe73b36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,7 +43,7 @@ static int print_eth_speed(char *outwalk, const char *interface) {
ifr.ifr_data = (caddr_t)&ecmd; ifr.ifr_data = (caddr_t)&ecmd;
(void)strcpy(ifr.ifr_name, interface); (void)strcpy(ifr.ifr_name, interface);
if (ioctl(general_socket, SIOCETHTOOL, &ifr) == 0) { if (ioctl(general_socket, SIOCETHTOOL, &ifr) == 0) {
ethspeed = (ecmd.speed == USHRT_MAX ? 0 : ecmd.speed); ethspeed = (ecmd.speed == USHRT_MAX ? 0 : ethtool_cmd_speed(&ecmd));
return sprintf(outwalk, "%d Mbit/s", ethspeed); return sprintf(outwalk, "%d Mbit/s", ethspeed);
} else } else
return sprintf(outwalk, "?"); return sprintf(outwalk, "?");