]> git.ipfire.org Git - oddments/collecty.git/commitdiff
sources: hostapd: Convert rates after they have been parsed
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 22 Oct 2025 19:31:22 +0000 (19:31 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 22 Oct 2025 19:31:22 +0000 (19:31 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/sources/hostapd.c

index 451b577294e07c831e7cd3a499f1c87c144e261b..c03fbf1f51abb7d56bbf45fad9da1bcc488e1be4 100644 (file)
@@ -97,6 +97,10 @@ static int hostapd_submit_station(td_ctx* ctx, hostapd_station* station) {
                return r;
        }
 
+       // Convert the RX/TX rate to bit/s (hostapd returns hundredth of kilobits)
+       station->rx_rate *= 100 * 1024;
+       station->tx_rate *= 100 * 1024;
+
        // Submit the station
        return td_source_submit_values(station->source, address, VALUES(
                VALUE_UINT64("connected_time",  &station->connected_time),
@@ -182,10 +186,6 @@ static int hostapd_parse(td_ctx* ctx, td_file* stdout, unsigned long lineno,
                { NULL },
        };
 
-       // Convert the RX/TX rate to bit/s
-       station->rx_rate *= 100 * 1024;
-       station->tx_rate *= 100 * 1024;
-
        //  Try parsing the line
        return td_file_parse_line(stdout, parser, line, length);
 }