Skip to content

Commit

Permalink
src: nl-link-stats: use correct rtnl link stats maximum
Browse files Browse the repository at this point in the history
Use __RTNL_LINK_STATS_MAX instead of RTNL_LINK_STATS_MAX when iterating
over all rtnl link stat counters. Otherwise, the last stat counter will
always be missing, as RTNL_LINK_STATS_MAX is the value of the last valid
index.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
  • Loading branch information
tklauser committed Nov 29, 2016
1 parent 90680e0 commit 4618b88
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/nl-link-stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static void list_stat_names(void)
char buf[64];
int i;

for (i = 0; i < RTNL_LINK_STATS_MAX; i++)
for (i = 0; i < __RTNL_LINK_STATS_MAX; i++)
printf("%s\n", rtnl_link_stat2str(i, buf, sizeof(buf)));

exit(0);
Expand All @@ -59,7 +59,7 @@ static void dump_stats(struct nl_object *obj, void *arg)
if (optind >= gargc) {
int i;

for (i = 0; i < RTNL_LINK_STATS_MAX; i++)
for (i = 0; i < __RTNL_LINK_STATS_MAX; i++)
dump_stat(link, i);
} else {
while (optind < gargc) {
Expand Down

0 comments on commit 4618b88

Please sign in to comment.