Skip to content
Snippets Groups Projects
Commit cc32dec6 authored by Adam Wujek's avatar Adam Wujek
Browse files

[BUG: #368] userspace/snmpd/wrsSpllVersionGroup: fix unsupported version of spll_stats


Signed-off-by: default avatarAdam Wujek <dev_public@wujek.eu>
parent e43be539
Branches
No related merge requests found
...@@ -64,8 +64,8 @@ time_t wrsSpllStatus_data_fill(void) ...@@ -64,8 +64,8 @@ time_t wrsSpllStatus_data_fill(void)
{ {
snmp_log(LOG_ERR, "SNMP: " SL_ER snmp_log(LOG_ERR, "SNMP: " SL_ER
"wrsSpllStatusGroup unsupported version of spll_stats " "wrsSpllStatusGroup unsupported version of spll_stats "
"registers (reading ver %d, supported 1, 2 and 3) \n", "registers (reading ver %d, supported %d) \n",
spll_stats_p->ver); spll_stats_p->ver, SPLL_STATS_VER);
} }
/* there was an update, return current time */ /* there was an update, return current time */
return time_update; return time_update;
......
...@@ -44,7 +44,7 @@ time_t wrsSpllVersion_data_fill(void) ...@@ -44,7 +44,7 @@ time_t wrsSpllVersion_data_fill(void)
} }
/* check version of SPLL's stat structure, version fields are from /* check version of SPLL's stat structure, version fields are from
* version 2 */ * version 2 */
if (spll_stats_p->ver <= 4) { if (spll_stats_p->ver == SPLL_STATS_VER) {
int len; int len;
strncpy(wrsSpllVersion_s.wrsSpllVersion, spll_stats_p->build_id.commit_id, 32); strncpy(wrsSpllVersion_s.wrsSpllVersion, spll_stats_p->build_id.commit_id, 32);
/* concatenate date and time */ /* concatenate date and time */
...@@ -53,17 +53,14 @@ time_t wrsSpllVersion_data_fill(void) ...@@ -53,17 +53,14 @@ time_t wrsSpllVersion_data_fill(void)
wrsSpllVersion_s.wrsSpllBuildDate[len] = ' '; /* put space instead of null */ wrsSpllVersion_s.wrsSpllBuildDate[len] = ' '; /* put space instead of null */
/* add time after added space at the end of string */ /* add time after added space at the end of string */
strncpy(&wrsSpllVersion_s.wrsSpllBuildDate[len + 1], spll_stats_p->build_id.build_time, 16 - 1); strncpy(&wrsSpllVersion_s.wrsSpllBuildDate[len + 1], spll_stats_p->build_id.build_time, 16 - 1);
strncpy(wrsSpllVersion_s.wrsSpllBuildBy, spll_stats_p->build_id.build_by, 32);
} }
else else
{ {
snmp_log(LOG_ERR, "SNMP: " SL_ER snmp_log(LOG_ERR, "SNMP: " SL_ER
"wrsSpllVersionGroup unsupported version of spll_stats " "wrsSpllVersionGroup unsupported version of spll_stats "
"registers (reading ver %d, supported 2 and 3) \n", "registers (reading ver %d, supported %d) \n",
spll_stats_p->ver); spll_stats_p->ver, SPLL_STATS_VER);
}
/* buil_by was introduced in version 3 */
if (spll_stats_p->ver >= 3) {
strncpy(wrsSpllVersion_s.wrsSpllBuildBy, spll_stats_p->build_id.build_by, 32);
} }
/* there was an update, return current time */ /* there was an update, return current time */
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment