diff options
| author | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-04-29 14:14:25 +0300 |
|---|---|---|
| committer | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-05-04 03:09:49 +0300 |
| commit | 25174419a520d20d0c78b89eafc34c2ee9f896b5 (patch) | |
| tree | 594c275cb1e4fbb84a11519a54cb7fbbf307db57 | |
| parent | d3d5aec5551d7d451fa4dae3df118a6ebd4cc2b7 (diff) | |
| download | accel-ppp-25174419a520d20d0c78b89eafc34c2ee9f896b5.tar.gz accel-ppp-25174419a520d20d0c78b89eafc34c2ee9f896b5.zip | |
net-snmp: fix ASN_INTEGER scalar value size
Use long storage for ASN_INTEGER scalar values passed to snmp_set_var_typed_value(). PPTP, L2TP, and PPPoE starting/active handlers previously passed unsigned int locals, and statCoreCPU passed triton_stat.cpu directly, which does not match Net-SNMP's C representation for ASN_INTEGER on 64-bit systems.
Keep the exposed MIB values and access paths unchanged; only stage the values through correctly sized local variables before encoding them for Net-SNMP.
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
| -rw-r--r-- | accel-pppd/extra/net-snmp/statCore.c | 7 | ||||
| -rw-r--r-- | accel-pppd/extra/net-snmp/statL2TP.c | 4 | ||||
| -rw-r--r-- | accel-pppd/extra/net-snmp/statPPPOE.c | 4 | ||||
| -rw-r--r-- | accel-pppd/extra/net-snmp/statPPTP.c | 4 |
4 files changed, 11 insertions, 8 deletions
diff --git a/accel-pppd/extra/net-snmp/statCore.c b/accel-pppd/extra/net-snmp/statCore.c index c2e64689..9206f6ed 100644 --- a/accel-pppd/extra/net-snmp/statCore.c +++ b/accel-pppd/extra/net-snmp/statCore.c @@ -80,6 +80,8 @@ handle_statCoreCPU(netsnmp_mib_handler *handler, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) { + long cpu; + /* We are never called for a GETNEXT if it's registered as a "instance", as it's "magically" handled for us. */ @@ -89,9 +91,10 @@ handle_statCoreCPU(netsnmp_mib_handler *handler, switch(reqinfo->mode) { case MODE_GET: + cpu = triton_stat.cpu; snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, - (u_char *)&triton_stat.cpu /* XXX: a pointer to the scalar's data */, - sizeof(triton_stat.cpu)/* XXX: the length of the data in bytes */); + (u_char *)&cpu /* XXX: a pointer to the scalar's data */, + sizeof(cpu)/* XXX: the length of the data in bytes */); break; diff --git a/accel-pppd/extra/net-snmp/statL2TP.c b/accel-pppd/extra/net-snmp/statL2TP.c index ee17717b..36e6f90b 100644 --- a/accel-pppd/extra/net-snmp/statL2TP.c +++ b/accel-pppd/extra/net-snmp/statL2TP.c @@ -70,7 +70,7 @@ static int handle_statL2TPStarting(netsnmp_mib_handler *handler, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) { - unsigned int stat; + long stat; (void)handler; (void)reginfo; @@ -94,7 +94,7 @@ static int handle_statL2TPActive(netsnmp_mib_handler *handler, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) { - unsigned int stat; + long stat; (void)handler; (void)reginfo; diff --git a/accel-pppd/extra/net-snmp/statPPPOE.c b/accel-pppd/extra/net-snmp/statPPPOE.c index 5cc7e872..64e61c3c 100644 --- a/accel-pppd/extra/net-snmp/statPPPOE.c +++ b/accel-pppd/extra/net-snmp/statPPPOE.c @@ -71,7 +71,7 @@ static int handle_statPPPOEStarting(netsnmp_mib_handler *handler, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) { - unsigned int stat; + long stat; switch (reqinfo->mode) { case MODE_GET: @@ -92,7 +92,7 @@ static int handle_statPPPOEActive(netsnmp_mib_handler *handler, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) { - unsigned int stat; + long stat; switch (reqinfo->mode) { case MODE_GET: diff --git a/accel-pppd/extra/net-snmp/statPPTP.c b/accel-pppd/extra/net-snmp/statPPTP.c index f02525bf..8a633da3 100644 --- a/accel-pppd/extra/net-snmp/statPPTP.c +++ b/accel-pppd/extra/net-snmp/statPPTP.c @@ -69,7 +69,7 @@ static int handle_statPPTPStarting(netsnmp_mib_handler *handler, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) { - unsigned int stat; + long stat; (void)handler; (void)reginfo; @@ -93,7 +93,7 @@ static int handle_statPPTPActive(netsnmp_mib_handler *handler, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) { - unsigned int stat; + long stat; (void)handler; (void)reginfo; |
