(Previous email had a weird formatting) Custom Mib returning wrong values when Magic number is larger than 255
Neeraj Bansal <[email protected]> Thu, 11 Jul 2024 15:30:32 -0700
| Newsgroups | gmane.network.net-snmp.devel |
|---|---|
| Message-ID | <CAP2FjR0h_D7wYiDf82N+UVbbQNs1=dj6=dy5gpUs-w7Zf0yi3g@mail.gmail.com> |
--===============1258139345718587060==
Content-Type: multipart/alternative; boundary="0000000000003c4d02061d0050f5"
--0000000000003c4d02061d0050f5
Content-Type: text/plain; charset="UTF-8"
Hello,
Net-SNMP version: 5.9.3
OS: Plain Vanilla Linux (kernel 6.6.23)
Hardware: custom ARM board with many sensors
Back in the net-snmp 5.4 days we created a custom mib in c using the
example found at: netsnmp/agent/mibgroup/example.c
This has worked great with one minor patch that we add to be able to go
beyhond the 255 custom oid limitation set by a u_char magic. We would
change that to u_short magic in the two files below, and then when calling
an oid that has a magic number beyhond 255 it does not wrap to zero and
start returning wrong vales.
Change all u_char magic; to u_short magic; in the two files below.
netsnmp/include/netsnmp/agent/snmp_vars.h
netsnmp/include/netsnmp/agent/var_struct.h
As mentioned our custom patch has worked for many years and many newer
versions than net-snmp 5.4. Now fast forward to today. We want to upgrade
our net-snmp to a newer version that supports newer openssl. So we install
5.9.3, test our custom mib, and all works as expected including the 255
limitation. When walking the tree we can observe that when the 255 limit is
reached it wraps around and outputs from the beginning. So, no problem. We
just have to add our patches to increase the size of the magic variable
from u_char (8-bit) to u_short (16-bit) in two files mentioned above.
We recompile everything and install no problem, but instead of fixing our
problem it caused net-snmp-5.9.3 to not be able to start. The error it
gives is: Bad user id, which could be a red herring. example below:
[root@testboard: /root# /etc/init.d/S59netsnmp restart
Stopping SNMP daemon: [OK]
Starting SNMP daemon: Bad user id: snmp
[root@testboard: /root#
So, we take our patches out and recompile and install, and it works again
but still has the 255 custom oid limitation.
A snippet from our header file. Too big to paste it all.
#define TEMPC 1
#define TEMPF 2
#define UPTIME_STR 3
#define SERIALNUMBER 4
#define ALLOFIT 5
#define ROOTFSBUILD 6
#define KERNELBUILD 7
#define OSINFO 8
......
#define PRODUCT_ID 250
#define RUNSCRIPT 251
#define TIMER1 252
#define TIMER2 253
#define TIMER3 254
#define TIMER4 255
#define TIMER5 256 <- This outpts an error because it wraps around and 0 is
not defined.
#define TIMER6 257 <- This outputs TEMPC value instead of TIMER6.
#define TIMER7 258
#define TIMER8 259
#define TIMER9 260
#define TIMER10 261
#define EXAMPLETIMETICKS 3333
#define EXAMPLEIPADDRESS 4444
#define EXAMPLECOUNTER 7777
#define EXAMPLEGAUGE 8888
#define EXAMPLETRIGGERTRAP 9999
#define EXAMPLETRIGGERTRAP2 1000
Notice the example defines above that were provided in the example C header
file, those magic numbers would have never worked because of the u_char
(8-bit) magic variable limitation.
This is a code snippet from our custom mib C file.
struct variable4 testboard_variables[] = {
{ROOTFSBUILD, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, testboard_var, 2, {7,
1}},
{KERNELBUILD, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, testboard_var, 2, {7,
2}},
{OSINFO, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, testboard_var, 2, {7, 3}},
{PRODUCT_ID, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, etestboard_var, 2, {7,
4}},
{UPTIME_STR, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, testboard_var, 2, {5,
1}},
{SERIALNUMBER, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, testboard_var, 2,
{5, 2}},
{TEMPC, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, testboard_var, 2, {6,1}},
{TEMPF, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, testboard_var, 2, {6,2}},
We have poured over the souce code looking for any other instance of u_char
magic that we may have missed, but they are only defined in the two files
mentioned above.
We need some help with this. What else do we need to do in the 5.9 versions
to make the magic number not wrap around to zero after 255 and not crash
when we do that?
Thanks,
Neeraj Bansal
--0000000000003c4d02061d0050f5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><span style=3D"color:rgb(36,36,36);font-family:"Casca=
dia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"=
>Hello,</span><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-f=
amily:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospac=
e;font-size:14px"><br style=3D"box-sizing:border-box;color:rgb(36,36,36);fo=
nt-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,mono=
space;font-size:14px"><span style=3D"color:rgb(36,36,36);font-family:"=
Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:=
14px">Net-SNMP version: 5.9.3</span><br style=3D"box-sizing:border-box;colo=
r:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace=
,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);=
font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,mo=
nospace;font-size:14px">OS: Plain Vanilla Linux (kernel 6.6.23)</span><br s=
tyle=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadi=
a Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><=
span style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",Con=
solas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">Hardware: custom =
ARM board with many sensors</span><br style=3D"box-sizing:border-box;color:=
rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,M=
enlo,Monaco,monospace;font-size:14px"><br style=3D"box-sizing:border-box;co=
lor:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospa=
ce,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36=
);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,=
monospace;font-size:14px">Back in the net-snmp 5.4 days we created a custom=
mib in c using the example found at: netsnmp/agent/mibgroup/example.c </sp=
an><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"=
;Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size=
:14px"><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:&=
quot;Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-=
size:14px"><span style=3D"color:rgb(36,36,36);font-family:"Cascadia Mo=
no",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">This =
has worked great with one minor patch that we add to be able to go beyhond =
the 255 custom oid limitation set by a u_char magic. We would change that t=
o u_short magic in the two files below, and then when calling an oid that h=
as a magic number beyhond 255 it does not wrap to zero and start returning =
wrong vales.</span><br style=3D"box-sizing:border-box;color:rgb(36,36,36);f=
ont-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,mon=
ospace;font-size:14px"><br style=3D"box-sizing:border-box;color:rgb(36,36,3=
6);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco=
,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-family:&=
quot;Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-=
size:14px">Change all u_char magic; to u_short magic; in the two files belo=
w.</span><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family=
:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;fon=
t-size:14px"><span style=3D"color:rgb(36,36,36);font-family:"Cascadia =
Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">net=
snmp/include/netsnmp/agent/snmp_vars.h</span><br style=3D"box-sizing:border=
-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-=
monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:rgb(3=
6,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,=
Monaco,monospace;font-size:14px">netsnmp/include/netsnmp/agent/var_struct.h=
</span><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:&=
quot;Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-=
size:14px"><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-fami=
ly:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;f=
ont-size:14px"><span style=3D"color:rgb(36,36,36);font-family:"Cascadi=
a Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">A=
s mentioned our custom patch has worked for many years and many newer versi=
ons than net-snmp 5.4. Now fast forward to today. We want to upgrade our ne=
t-snmp to a newer version that supports newer openssl. So we install 5.9.3,=
test our custom mib, and all works as expected including the 255 limitatio=
n. When walking the tree we can observe that when the 255 limit is reached =
it wraps around and outputs from the beginning. So, no problem. We just hav=
e to add our patches to increase the size of the magic variable from u_char=
(8-bit) to u_short (16-bit) in two files mentioned above.</span><br style=
=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadia Mo=
no",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><br s=
tyle=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadi=
a Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><=
span style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",Con=
solas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">We recompile ever=
ything and install no problem, but instead of fixing our problem it caused =
net-snmp-5.9.3 to not be able to start. The error it gives is: Bad user id,=
which could be a red herring. example below:</span><br style=3D"box-sizing=
:border-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Conso=
las,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"colo=
r:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace=
,Menlo,Monaco,monospace;font-size:14px">[root@testboard: /root# /etc/init.d=
/S59netsnmp restart</span><br style=3D"box-sizing:border-box;color:rgb(36,3=
6,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Mon=
aco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-famil=
y:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;fo=
nt-size:14px">Stopping SNMP daemon: [OK]</span><br style=3D"box-sizing:bord=
er-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,u=
i-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:rgb=
(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menl=
o,Monaco,monospace;font-size:14px">Starting SNMP daemon: Bad user id: snmp<=
/span><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:&q=
uot;Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-s=
ize:14px"><span style=3D"color:rgb(36,36,36);font-family:"Cascadia Mon=
o",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">[root@=
testboard: /root#</span><br style=3D"box-sizing:border-box;color:rgb(36,36,=
36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monac=
o,monospace;font-size:14px"><br style=3D"box-sizing:border-box;color:rgb(36=
,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,M=
onaco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-fam=
ily:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;=
font-size:14px">So, we take our patches out and recompile and install, and =
it works again but still has the 255 custom oid limitation.</span><br style=
=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadia Mo=
no",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><br s=
tyle=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadi=
a Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><=
span style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",Con=
solas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">A snippet from ou=
r header file. Too big to paste it all.</span><br style=3D"box-sizing:borde=
r-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui=
-monospace,Menlo,Monaco,monospace;font-size:14px"><br style=3D"box-sizing:b=
order-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Consola=
s,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:=
rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,M=
enlo,Monaco,monospace;font-size:14px">#define=E2=80=83 TEMPC=E2=80=83=E2=80=
=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=
=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=831</span><br style=3D"=
box-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadia Mono&q=
uot;,Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span sty=
le=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui=
-monospace,Menlo,Monaco,monospace;font-size:14px">#define=E2=80=83 TEMPF=E2=
=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=
=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=832</span><=
br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Cas=
cadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14p=
x"><span style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono"=
,Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">#define=C2=A0=
=C2=A0UPTIME_STR=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=
=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=833</span><br sty=
le=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadia =
Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><sp=
an style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",Conso=
las,ui-monospace,Menlo,Monaco,monospace;font-size:14px">#define=C2=A0 =C2=
=A0SERIALNUMBER=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=
=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=834</span><br style=3D"box-si=
zing:border-box;color:rgb(36,36,36);font-family:"Cascadia Mono",C=
onsolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"=
color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monos=
pace,Menlo,Monaco,monospace;font-size:14px">#define=C2=A0 =C2=A0ALLOFIT=E2=
=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=
=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=835</span><br style=
=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadia Mo=
no",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span=
style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",Consola=
s,ui-monospace,Menlo,Monaco,monospace;font-size:14px">#define=C2=A0 =C2=A0R=
OOTFSBUILD=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=
=E2=80=83=E2=80=83=E2=80=83 =E2=80=83=E2=80=836</span><br style=3D"box-sizi=
ng:border-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Con=
solas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"co=
lor:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospa=
ce,Menlo,Monaco,monospace;font-size:14px">#define=C2=A0 =C2=A0KERNELBUILD=
=C2=A0 =E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=C2=A0 =C2=A0 =E2=80=83=
=E2=80=83=E2=80=83=E2=80=837</span><br style=3D"box-sizing:border-box;color=
:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,=
Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);f=
ont-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,mon=
ospace;font-size:14px">#define=C2=A0 =C2=A0OSINFO=E2=80=83=E2=80=83=E2=80=
=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=C2=A0 =C2=A0=E2=
=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=838</span><br style=3D"box-sizing:b=
order-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Consola=
s,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:=
rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,M=
enlo,Monaco,monospace;font-size:14px">......</span><br style=3D"box-sizing:=
border-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Consol=
as,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color=
:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,=
Menlo,Monaco,monospace;font-size:14px">#define PRODUCT_ID 250</span><br sty=
le=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadia =
Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><sp=
an style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",Conso=
las,ui-monospace,Menlo,Monaco,monospace;font-size:14px">#define RUNSCRIPT 2=
51</span><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family=
:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;fon=
t-size:14px"><span style=3D"color:rgb(36,36,36);font-family:"Cascadia =
Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">#de=
fine TIMER1 252</span><br style=3D"box-sizing:border-box;color:rgb(36,36,36=
);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,=
monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-family:&q=
uot;Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-s=
ize:14px">#define TIMER2 253</span><br style=3D"box-sizing:border-box;color=
:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,=
Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);f=
ont-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,mon=
ospace;font-size:14px">#define TIMER3 254</span><br style=3D"box-sizing:bor=
der-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,=
ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:rg=
b(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Men=
lo,Monaco,monospace;font-size:14px">#define TIMER4 255</span><br style=3D"b=
ox-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadia Mono&qu=
ot;,Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span styl=
e=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-=
monospace,Menlo,Monaco,monospace;font-size:14px">#define TIMER5 256 <- T=
his outpts an error because it wraps around and 0 is not defined.</span><br=
style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Casca=
dia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"=
><span style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",C=
onsolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">#define TIMER6 =
257 <- This outputs TEMPC value instead of TIMER6.</span><br style=3D"bo=
x-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadia Mono&quo=
t;,Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=
=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-m=
onospace,Menlo,Monaco,monospace;font-size:14px">#define TIMER7 258</span><b=
r style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Casc=
adia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px=
"><span style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",=
Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">#define TIMER8=
259</span><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-fami=
ly:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;f=
ont-size:14px"><span style=3D"color:rgb(36,36,36);font-family:"Cascadi=
a Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">#=
define TIMER9 260</span><br style=3D"box-sizing:border-box;color:rgb(36,36,=
36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monac=
o,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-family:=
"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font=
-size:14px">#define TIMER10 261</span><br style=3D"box-sizing:border-box;co=
lor:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospa=
ce,Menlo,Monaco,monospace;font-size:14px"><br style=3D"box-sizing:border-bo=
x;color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-mon=
ospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:rgb(36,3=
6,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Mon=
aco,monospace;font-size:14px">#define=C2=A0 =C2=A0 EXAMPLETIMETICKS=E2=80=
=83=E2=80=83=E2=80=83=E2=80=833333</span><br style=3D"box-sizing:border-box=
;color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-mono=
space,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:rgb(36,36=
,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Mona=
co,monospace;font-size:14px">#define=E2=80=83=E2=80=83EXAMPLEIPADDRESS=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 4444</span><br style=3D"box-sizing:=
border-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Consol=
as,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color=
:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,=
Menlo,Monaco,monospace;font-size:14px">#define=C2=A0 =C2=A0EXAMPLECOUNTER=
=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=837777</span><br style=
=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadia Mo=
no",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span=
style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",Consola=
s,ui-monospace,Menlo,Monaco,monospace;font-size:14px">#define=E2=80=83=E2=
=80=83EXAMPLEGAUGE=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 8888</span><br style=3D"box-sizing:border-box;color:rgb(36,36,36)=
;font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,m=
onospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-family:&qu=
ot;Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-si=
ze:14px">#define=E2=80=83=E2=80=83EXAMPLETRIGGERTRAP=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 9999</span><br style=3D"box-sizing:border-box;color:rgb(36,36,36)=
;font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,m=
onospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-family:&qu=
ot;Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-si=
ze:14px">#define=E2=80=83=E2=80=83EXAMPLETRIGGERTRAP2=C2=A0=C2=A0=C2=A0=C2=
=A0 1000</span><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-=
family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospa=
ce;font-size:14px"><br style=3D"box-sizing:border-box;color:rgb(36,36,36);f=
ont-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,mon=
ospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-family:"=
;Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size=
:14px">Notice the example defines above that were provided in the example C=
header file, those magic numbers would have never worked because of the u_=
char (8-bit) magic variable limitation. </span><br style=3D"box-sizing:bord=
er-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,u=
i-monospace,Menlo,Monaco,monospace;font-size:14px"><br style=3D"box-sizing:=
border-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Consol=
as,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color=
:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,=
Menlo,Monaco,monospace;font-size:14px">This is a code snippet from our cust=
om mib C file.</span><br style=3D"box-sizing:border-box;color:rgb(36,36,36)=
;font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,m=
onospace;font-size:14px"><br style=3D"box-sizing:border-box;color:rgb(36,36=
,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Mona=
co,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-family=
:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;fon=
t-size:14px">struct variable4 testboard_variables[] =3D {</span><br style=
=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadia Mo=
no",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span=
style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",Consola=
s,ui-monospace,Menlo,Monaco,monospace;font-size:14px"> =C2=A0=C2=A0 {ROOTFS=
BUILD, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, testboard_var, 2, {7, 1}},</spa=
n><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"=
Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:=
14px"><span style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono&qu=
ot;,Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"> =C2=A0=C2=
=A0 {KERNELBUILD, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, testboard_var, 2, {7=
, 2}},</span><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-fa=
mily:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace=
;font-size:14px"><span style=3D"color:rgb(36,36,36);font-family:"Casca=
dia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"=
> =C2=A0=C2=A0 {OSINFO, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, testboard_var,=
2, {7, 3}},</span><br style=3D"box-sizing:border-box;color:rgb(36,36,36);f=
ont-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,mon=
ospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-family:"=
;Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size=
:14px"> =C2=A0=C2=A0 {PRODUCT_ID, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, etes=
tboard_var, 2, {7, 4}},</span><br style=3D"box-sizing:border-box;color:rgb(=
36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo=
,Monaco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-f=
amily:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospac=
e;font-size:14px"> =C2=A0=C2=A0 {UPTIME_STR, ASN_OCTET_STR, NETSNMP_OLDAPI_=
RONLY, testboard_var, 2, {5, 1}},</span><br style=3D"box-sizing:border-box;=
color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monos=
pace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,=
36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monac=
o,monospace;font-size:14px"> =C2=A0=C2=A0 {SERIALNUMBER, ASN_OCTET_STR, NET=
SNMP_OLDAPI_RONLY, testboard_var, 2, {5, 2}},</span><br style=3D"box-sizing=
:border-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Conso=
las,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"colo=
r:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace=
,Menlo,Monaco,monospace;font-size:14px"> =C2=A0=C2=A0 {TEMPC, ASN_OCTET_STR=
, NETSNMP_OLDAPI_RONLY, testboard_var, 2, {6,1}},</span><br style=3D"box-si=
zing:border-box;color:rgb(36,36,36);font-family:"Cascadia Mono",C=
onsolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"=
color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monos=
pace,Menlo,Monaco,monospace;font-size:14px"> =C2=A0=C2=A0 {TEMPF, ASN_OCTET=
_STR, NETSNMP_OLDAPI_RONLY, testboard_var, 2, {6,2}},</span><br style=3D"bo=
x-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadia Mono&quo=
t;,Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><br style=
=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadia Mo=
no",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span=
style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",Consola=
s,ui-monospace,Menlo,Monaco,monospace;font-size:14px">We have poured over t=
he souce code looking for any other instance of u_char magic that we may ha=
ve missed, but they are only defined in the two files mentioned above.</spa=
n><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"=
Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:=
14px"><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:&q=
uot;Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-s=
ize:14px"><span style=3D"color:rgb(36,36,36);font-family:"Cascadia Mon=
o",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">We nee=
d some help with this. What else do we need to do in the 5.9 versions to ma=
ke the magic number not wrap around to zero after 255 and not crash when we=
do that?</span><br><div><span style=3D"color:rgb(36,36,36);font-family:&qu=
ot;Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-si=
ze:14px"><br></span></div><div><font color=3D"#242424" face=3D"Cascadia Mon=
o, Consolas, ui-monospace, Menlo, Monaco, monospace"><span style=3D"font-si=
ze:14px">Thanks,</span></font></div><div><font color=3D"#242424" face=3D"Ca=
scadia Mono, Consolas, ui-monospace, Menlo, Monaco, monospace"><span style=
=3D"font-size:14px"><br></span></font></div><div><font color=3D"#242424" fa=
ce=3D"Cascadia Mono, Consolas, ui-monospace, Menlo, Monaco, monospace"><spa=
n style=3D"font-size:14px">Neeraj Bansal</span></font></div></div>
--0000000000003c4d02061d0050f5--
--===============1258139345718587060==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============1258139345718587060==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
--===============1258139345718587060==--