I don't think the patch is the issue. There are two questions to be
addressed first:
1. For the embedded environment, is it acceptable to use an extra several
bytes for this (or is there a way to rearrange the struct so that padding
reduces the extra cost)?
2. Is it reasonable to have more than 255 variables in a single
registration, or should the reporter just split up his registration into
multiple groups, each with less than 255 variables?
Bill
On Wed, Mar 21, 2018 at 10:43 PM, Eric S. Raymond <e...@thyrsus.com> wrote:
> From 54e79ba66327bdb54f97f457d76531f657ec546d Mon Sep 17 00:00:00 2001
> From: "Eric S. Raymond" <e...@thyrsus.com>
> Date: Wed, 21 Mar 2018 22:22:29 -0400
> Subject: [PATCH] include/net-snmp/agent/{snmp_vars.h,var_struct.h}:
> address SF
> bug 2833.
>
> Tests pass,
> ---
> include/net-snmp/agent/snmp_vars.h | 2 +-
> include/net-snmp/agent/var_struct.h | 12 ++++++------
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/include/net-snmp/agent/snmp_vars.h
> b/include/net-snmp/agent/snmp_vars.h
> index bd27eeb..b2f2f8f 100644
> --- a/include/net-snmp/agent/snmp_vars.h
> +++ b/include/net-snmp/agent/snmp_vars.h
> @@ -101,7 +101,7 @@ PERFORMANCE OF THIS SOFTWARE.
> #define INST 0xFFFFFFFF /* used to fill out the instance field of
> the variables table */
>
> struct variable {
> - u_char magic; /* passed to function as a hint */
> + u_short magic; /* passed to function as a hint */
> char type; /* type of variable */
> /*
> * See important comment in snmp_vars.c relating to acl
> diff --git a/include/net-snmp/agent/var_struct.h
> b/include/net-snmp/agent/var_struct.h
> index 15b5770..10bf4ae 100644
> --- a/include/net-snmp/agent/var_struct.h
> +++ b/include/net-snmp/agent/var_struct.h
> @@ -52,7 +52,7 @@ typedef struct netsnmp_subtree_s {
> * application. The first 5 elements of the structure must remain
> constant.
> */
> struct variable1 {
> - u_char magic; /* passed to function as a hint */
> + u_short magic; /* passed to function as a hint */
> u_char type; /* type of variable */
> u_short acl; /* access control list for variable */
> FindVarMethod *findVar; /* function that finds variable */
> @@ -61,7 +61,7 @@ struct variable1 {
> };
>
> struct variable2 {
> - u_char magic; /* passed to function as a hint */
> + u_short magic; /* passed to function as a hint */
> u_char type; /* type of variable */
> u_short acl; /* access control list for variable */
> FindVarMethod *findVar; /* function that finds variable */
> @@ -79,7 +79,7 @@ struct variable3 {
> };
>
> struct variable4 {
> - u_char magic; /* passed to function as a hint */
> + u_short magic; /* passed to function as a hint */
> u_char type; /* type of variable */
> u_short acl; /* access control list for variable */
> FindVarMethod *findVar; /* function that finds variable */
> @@ -88,7 +88,7 @@ struct variable4 {
> };
>
> struct variable7 {
> - u_char magic; /* passed to function as a hint */
> + u_short magic; /* passed to function as a hint */
> u_char type; /* type of variable */
> u_short acl; /* access control list for variable */
> FindVarMethod *findVar; /* function that finds variable */
> @@ -97,7 +97,7 @@ struct variable7 {
> };
>
> struct variable8 {
> - u_char magic; /* passed to function as a hint */
> + u_short magic; /* passed to function as a hint */
> u_char type; /* type of variable */
> u_short acl; /* access control list for variable */
> FindVarMethod *findVar; /* function that finds variable */
> @@ -106,7 +106,7 @@ struct variable8 {
> };
>
> struct variable13 {
> - u_char magic; /* passed to function as a hint */
> + u_short magic; /* passed to function as a hint */
> u_char type; /* type of variable */
> u_short acl; /* access control list for variable */
> FindVarMethod *findVar; /* function that finds variable */
> --
> 2.7.4
>
>
> --
> <a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
>
> As war and government prove, insanity is the most contagious of
> diseases. -- Edward Abbey
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Net-snmp-coders mailing list
> Net-snmp-coders@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders