Re: [PATCH 1/1] snmp_agent: Fixes incrementation of snmpInTotalSetVars

Bart Van Assche via Net-snmp-coders <[email protected]> Fri, 28 Feb 2025 11:09:13 -0800
Newsgroups gmane.network.net-snmp.devel
Message-ID <[email protected]>
On 2/28/25 5:14 AM, Michael Schmidt via Net-snmp-coders wrote:
> diff --git a/agent/snmp_agent.c b/agent/snmp_agent.c
> index 9913a968e1..c728059ac8 100644
> --- a/agent/snmp_agent.c
> +++ b/agent/snmp_agent.c
> @@ -1908,6 +1908,8 @@ netsnmp_wrap_up_request(netsnmp_agent_session *asp, int status)
>       }
>   
>       if (asp->pdu) {
> +	int command = asp->pdu->command;
> +

Please fix the indentation of this declaration and declare 'command'
const.

> @@ -2030,7 +2032,7 @@ netsnmp_wrap_up_request(netsnmp_agent_session *asp, int status)
>           if (status == SNMP_ERR_NOERROR)
>               snmp_increment_statistic_by(
>   #ifndef NETSNMP_NO_WRITE_SUPPORT
> -                (asp->pdu->command == SNMP_MSG_SET ?
> +                (command == SNMP_MSG_SET ?
>                    STAT_SNMPINTOTALSETVARS : STAT_SNMPINTOTALREQVARS),
>   #else
>                   STAT_SNMPINTOTALREQVARS,

Please submit a pull request to the following GitHub project:
https://github.com/net-snmp/net-snmp/

Thanks,

Bart.