From 5829523b18fd83fa75daf6dc010c978251d3a9ac Mon Sep 17 00:00:00 2001 From: Landry Breuil Date: Wed, 29 Nov 2017 09:59:02 +0100 Subject: [PATCH] Fix stats on some openbsd drivers (bug #13853) some driver names are not null-ended (re, nfe?), leading to failing comparisons. On top of this the comparison was wrong. Simpler patch than the one provided by Ed Hynan, thanks for the detailed bug report and thorough analysis. --- panel-plugin/wormulon/openbsd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panel-plugin/wormulon/openbsd.c b/panel-plugin/wormulon/openbsd.c index 7a79f7b..b138c6b 100644 --- a/panel-plugin/wormulon/openbsd.c +++ b/panel-plugin/wormulon/openbsd.c @@ -149,10 +149,10 @@ int get_stat(netdata* data) /* search for the right network interface */ if (sdl->sdl_family != AF_LINK) continue; - if (strcmp(sdl->sdl_data, data->ifdata.if_name) != 0) - continue; strncpy(s, sdl->sdl_data, sdl->sdl_nlen); s[sdl->sdl_nlen] = '\0'; + if (strcmp(s, data->ifdata.if_name) != 0) + continue; rx_o = data->stats.rx_bytes; tx_o = data->stats.tx_bytes; /* write stats */