Re: (Previous email had a weird formatting) Custom Mib returning wrong values when Magic number is larger than 255
Neeraj Bansal <[email protected]> Mon, 29 Jul 2024 10:34:36 -0700
| Newsgroups | gmane.network.net-snmp.devel |
|---|---|
| Message-ID | <CAP2FjR3AB4H5XzXiRBTqoqw2dNa04bzSDE5CUFfJRcP35kqScg@mail.gmail.com> |
--===============3896717634338860528== Content-Type: multipart/alternative; boundary="0000000000000ca854061e66474f" --0000000000000ca854061e66474f Content-Type: text/plain; charset="UTF-8" We are still stuck on this issue. We would really like it if someone could guide us. Is somebody else facing the same issue? Please let me know if I can provide more information. Regards, Neeraj Bansal On Thu, 11 Jul 2024 at 15:30, Neeraj Bansal <[email protected]> wrote: > 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 > --0000000000000ca854061e66474f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">We are still stuck on this issue. We would=C2=A0really lik= e it if someone could guide us. Is somebody else facing the same issue?=C2= =A0<div><br></div><div>Please let me know if I can provide more information= .<div><br></div><div>Regards,</div><div><br></div><div>Neeraj Bansal</div><= /div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_a= ttr">On Thu, 11 Jul 2024 at 15:30, Neeraj Bansal <<a href=3D"mailto:neer= [email protected]">[email protected]</a>> wrote:<br></di= v><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;borde= r-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><span = style=3D"color:rgb(36,36,36);font-family:"Cascadia 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-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">Net-SNMP version:= 5.9.3</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"= >OS: Plain Vanilla Linux (kernel 6.6.23)</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">Hardware: custom ARM board with many sen= sors</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"><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"><span style=3D"color:rgb(36,36,36);font-family:"Cas= cadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14p= x">Back in the net-snmp 5.4 days we created a custom mib in c using the exa= mple found at: netsnmp/agent/mibgroup/example.c </span><br style=3D"box-siz= ing:border-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Co= nsolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><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",Consolas,ui-m= onospace,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 lim= itation 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 beyh= ond 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);font-family:"Casca= dia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"= ><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"C= ascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:1= 4px"><span style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono&quo= t;,Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">Change all = u_char magic; to u_short magic; in the two files below.</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">netsnmp/include/netsnmp/a= gent/snmp_vars.h</span><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">netsnmp/include/netsnmp/agent/var_struct.h</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">As mentioned our cust= om 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 ve= rsion 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.</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"><br style=3D"box-sizing:bo= rder-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas= ,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:r= gb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Me= nlo,Monaco,monospace;font-size:14px">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:</span><br style=3D"box-sizing:border-box;color:rgb= (36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menl= o,Monaco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-= family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospa= ce;font-size:14px">[root@testboard: /root# /etc/init.d/S59netsnmp restart</= span><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:&qu= ot;Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-si= ze:14px"><span style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono= ",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">Stoppin= g SNMP daemon: [OK]</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">Starting SNMP daemon: Bad user id: snmp</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">[root@testboard: /root#</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">So, w= e take our patches out and recompile and install, and it works again but st= ill has the 255 custom oid limitation.</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"><br style=3D"box-sizing:bo= rder-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas= ,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:r= gb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Me= nlo,Monaco,monospace;font-size:14px">A snippet from our header file. Too bi= g to paste it all.</span><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"><br style=3D"box-sizing:border-box;color:rgb(3= 6,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,= Monaco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-fa= mily:"Cascadia Mono",Consolas,ui-monospace,Menlo,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",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 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-sizin= g:border-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Cons= olas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"col= or:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospac= e,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 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">#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-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=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 Mono",Consolas,ui-m= onospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:rgb(36= ,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,M= onaco,monospace;font-size:14px">#define=C2=A0 =C2=A0ROOTFSBUILD=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-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">#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-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=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: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">......</span><br style=3D"box-sizing:border-box;color:rgb(36,= 36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Mo= naco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-fami= ly:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;f= ont-size:14px">#define PRODUCT_ID 250</span><br style=3D"box-sizing:border-= box;color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-m= onospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:rgb(36= ,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,M= onaco,monospace;font-size:14px">#define RUNSCRIPT 251</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 TIMER1 252</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 TIMER2= 253</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 TIMER3 254</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 TIMER4 255</span><br style=3D"box-sizing:border-box;col= or:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospac= e,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36)= ;font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,m= onospace;font-size:14px">#define TIMER5 256 <- This outpts an error beca= use it wraps around and 0 is not defined.</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 TIMER6 257 <- This outputs T= EMPC value instead of TIMER6.</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">#define TIMER7 258</span><br style=3D"box-sizing:bo= rder-box;color:rgb(36,36,36);font-family:"Cascadia Mono",Consolas= ,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:r= gb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Me= nlo,Monaco,monospace;font-size:14px">#define TIMER8 259</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 TIMER9 260</span>= <br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Ca= scadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14= px"><span style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono"= ;,Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">#define TIME= R10 261</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">#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);fon= t-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monos= pace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-family:"C= ascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:1= 4px">#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",Consolas,ui-monospace,Menlo,Mo= naco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-fami= ly:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;f= ont-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 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=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 st= yle=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadia= Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><s= pan style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",Cons= olas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">#define=E2=80=83= =E2=80=83EXAMPLETRIGGERTRAP=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 9999</span><br st= yle=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"Cascadia= Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><s= pan style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",Cons= olas,ui-monospace,Menlo,Monaco,monospace;font-size: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 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">Notice the exampl= e defines above that were provided in the example C header file, those magi= c numbers would have never worked because of the u_char (8-bit) magic varia= ble limitation. </span><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"><br style=3D"box-sizing:border-box;color:rgb(36,= 36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Mo= naco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-fami= ly:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;f= ont-size:14px">This is a code snippet from our custom mib C file.</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"= ><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:"C= ascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:1= 4px"><span style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono&quo= t;,Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14px">struct vari= able4 testboard_variables[] =3D {</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 {ROOTFSBUILD, ASN_OCTET_STR, NETS= NMP_OLDAPI_RONLY, testboard_var, 2, {7, 1}},</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"> =C2=A0=C2=A0 {KERNELBUILD, ASN_OCTE= T_STR, NETSNMP_OLDAPI_RONLY, testboard_var, 2, {7, 2}},</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"> =C2=A0=C2=A0 {OSINFO, AS= N_OCTET_STR, NETSNMP_OLDAPI_RONLY, testboard_var, 2, {7, 3}},</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"> =C2=A0=C2=A0 {PROD= UCT_ID, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, etestboard_var, 2, {7, 4}},</s= pan><br style=3D"box-sizing:border-box;color:rgb(36,36,36);font-family:&quo= t;Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-siz= e:14px"><span style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono&= quot;,Consolas,ui-monospace,Menlo,Monaco,monospace;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-monospace,Menlo,Monaco,monospa= ce;font-size:14px"><span style=3D"color:rgb(36,36,36);font-family:"Cas= cadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;font-size:14p= x"> =C2=A0=C2=A0 {SERIALNUMBER, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, testbo= ard_var, 2, {5, 2}},</span><br style=3D"box-sizing:border-box;color:rgb(36,= 36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Mo= naco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-fami= ly:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospace;f= ont-size:14px"> =C2=A0=C2=A0 {TEMPC, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, t= estboard_var, 2, {6,1}},</span><br style=3D"box-sizing:border-box;color:rgb= (36,36,36);font-family:"Cascadia Mono",Consolas,ui-monospace,Menl= o,Monaco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,36);font-= family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco,monospa= ce;font-size:14px"> =C2=A0=C2=A0 {TEMPF, ASN_OCTET_STR, NETSNMP_OLDAPI_RONL= Y, testboard_var, 2, {6,2}},</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"><br style=3D"box-sizing:border-box;c= olor:rgb(36,36,36);font-family:"Cascadia Mono",Consolas,ui-monosp= ace,Menlo,Monaco,monospace;font-size:14px"><span style=3D"color:rgb(36,36,3= 6);font-family:"Cascadia Mono",Consolas,ui-monospace,Menlo,Monaco= ,monospace;font-size:14px">We have poured over the souce code looking for a= ny other instance of u_char magic that we may have missed, but they are onl= y defined in the two files mentioned above.</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"><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">We need some help with this. What= else do we need to do in the 5.9 versions to make the magic number not wra= p around to zero after 255 and not crash when we do that?</span><br><div><s= pan style=3D"color:rgb(36,36,36);font-family:"Cascadia Mono",Cons= olas,ui-monospace,Menlo,Monaco,monospace;font-size:14px"><br></span></div><= div><font color=3D"#242424" face=3D"Cascadia Mono, Consolas, ui-monospace, = Menlo, Monaco, monospace"><span style=3D"font-size:14px">Thanks,</span></fo= nt></div><div><font color=3D"#242424" face=3D"Cascadia Mono, Consolas, ui-m= onospace, Menlo, Monaco, monospace"><span style=3D"font-size:14px"><br></sp= an></font></div><div><font color=3D"#242424" face=3D"Cascadia Mono, Consola= s, ui-monospace, Menlo, Monaco, monospace"><span style=3D"font-size:14px">N= eeraj Bansal</span></font></div></div> </blockquote></div> --0000000000000ca854061e66474f-- --===============3896717634338860528== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============3896717634338860528== 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 --===============3896717634338860528==--