Skip to content
Snippets Groups Projects
Commit a64c8d1d authored by Padmalochan Mohapatra's avatar Padmalochan Mohapatra Committed by Rahul Thakur
Browse files

libethernet : Fix for counters showing all zero in linux QCM platform's ubus call output

parent 78552f77
No related branches found
No related tags found
1 merge request!4libethernet : Fix for counters showing all zero in linux QCM platform's ubus call output
......@@ -217,11 +217,8 @@ static int linux_get_ethtool_stats(const char *ifname)
}
struct ethtool_drvinfo drvinfo = {.cmd = ETHTOOL_GDRVINFO};
struct ifreq req = {.ifr_data = (void *)&drvinfo};
strncpy(req.ifr_name, ifname, sizeof(req.ifr_name));
status = ioctl(fd, SIOCETHTOOL, &req);
if (status < 0) {
......@@ -240,7 +237,7 @@ static int linux_get_ethtool_stats(const char *ifname)
}
stats_size = sizeof(struct ethtool_stats) + (n_stats * sizeof(uint64_t));
g_linux_stats = malloc(stats_size);
g_linux_stats = (struct ethtool_stats *)calloc(1, stats_size);
if (!g_linux_stats) {
close(fd);
syslog(LOG_ERR, "%s(%d): malloc failed.",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment