This is a discussion on RE: A bug in parsing ASN_OCTET_STR as an index? within the SNMP Coders forums, part of the Networking and Network Related category; This message is in MIME format. Since your mail reader does not understand this format, some or all of this ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible. ------_=_NextPart_001_01C5E182.28B995FF Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Thanks all, I found the bug it was an omitted return statement due to a "heavy finger" while porting function parse_one_oid_index mib.cxx. Once I fixed it everything is working as expected... =20 Thanks, Shuki =20 _____ =20 From: net-snmp-coders-admin@lists.sourceforge.net [mailto:net-snmp-coders-admin@lists.sourceforge.net] On Behalf Of = sasson, shuki Sent: Friday, November 04, 2005 2:20 PM To: net-snmp-coders@lists.sourceforge.net Subject: A bug in parsing ASN_OCTET_STR as an index? =20 Hi all, I am using Net-SNMP 5.2.1 to implement RFC 2465 In it there is a table ipv6AddrPrefixTable=20 This table has 3 indexes: INDEX { ipv6IfIndex, ipv6AddrPrefix, ipv6AddrPrefixLength } ipv6AddrPrefix is an OCTET string. While the two others are 32 bits = value indexes. When I am trying to send the following getnext request to my = implementation module: snmpgetnext -v 2c -c public 10.172.129.74:162 IPV6-MIB::ipv6AddrPrefixAdvValidLifetime.5.16.63.254.5. 1.255.255.1.0.2.4= ..35. 255.254.69.107.20.64 I see that the indexes were not parsed correctly. Here is the situation = as I see it in a gdb debugger: (gdb) p *table_info->indexes->val.integer $22 =3D 5 <----- That's the first = index with the value of 5 (correct!) gdb) p *table_info->indexes->next_variable =20 $23 =3D {next_variable =3D 0xc6386020, name =3D 0xc6386838, name_length = =3D 0,=20 type =3D 4 '\004', val =3D {integer =3D 0xc5a53420, string =3D = 0xc5a53420 "",=20 objid =3D 0xc5a53420, bitstring =3D 0xc5a53420 "", counter64 =3D = 0xc5a53420,=20 floatVal =3D 0xc5a53420, doubleVal =3D 0xc5a53420}, val_len =3D 16, = name_loc =3D { 4008636142 <repeats 128 times>}, buf =3D "\0", '=EE' <repeats 39 = times>,=20 data =3D 0x0, dataFreeHook =3D 0x0, index =3D 0} The above indicates that there is an index value with length of 16 = :val_len =3D 16 which is correct! When I try to look at the octet string itself using bitstring: (gdb) p table_info->indexes->next_variable->val.bitstring[1] $26 =3D 0 '\0' (gdb) p table_info->indexes->next_variable->val.bitstring[2] $27 =3D 0 '\0' (gdb) p table_info->indexes->next_variable->val.bitstring[3] .. .. .. (gdb) p table_info->indexes->next_variable->val.bitstring[16] $36 =3D 0 '\0' As one can see the IPv6 octet string come out to be all zeros which is = not correct. Interestingly enough when I look into the third index value: (gdb) p *table_info->indexes->next_variable->next_variable->val.integer $39 =3D 63 I see the value of the first OCTET in the octet string! I put a sniffer and I made sure that the indexes are traveling = correctly to the agent. It seems like there is a bug in parsing the octet string index. Its = value is not copied to the bitstring memory area as it should be. In addition = the first octet of the 2nd index ipv6AddrPrefix which is 63 is assigned as = the value of the 3rd index: ipv6AddrPrefixLength instead of what should be = 64). A few questions: 1. Is that a known problem (I am using Net-SNMP 5.2.1 which was = ported to a specific platform)? If the answer is yes where can I get a fix to = it? 2. Can someone point to me to the place in the code where the = indexes are parsed? I can use a debugger to try and figure out what is going = on... 3. Any other ideas?=20 Thanks for your help! Shuki Sasson Principal Engineer, Network Storage Group EMC=B2 where information lives Fax: 508 305 9026 =20 Phone: 508 305 8515 Cell: 617 834 4258 Pager: 877 919 0794=20 Email: sasson_shuki@emc.com=20 ------_=_NextPart_001_01C5E182.28B995FF Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <html> <head> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Diso-8859-1"> <meta name=3DGenerator content=3D"Microsoft Word 11 (filtered)"> <title>A bug in parsing ASN_OCTET_STR as an index?</title> <style> <!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0;} @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;} @font-face {font-family:Times; panose-1:2 2 6 3 5 4 5 2 3 4;} @font-face {font-family:Garamond; panose-1:2 2 4 4 3 3 1 1 8 3;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:#606420; text-decoration:underline;} p {margin-right:0in; margin-left:0in; font-size:12.0pt; font-family:"Times New Roman";} span.EmailStyle18 {font-family:Arial; color:navy;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in;} div.Section1 {page:Section1;} --> </style> </head> <body lang=3DEN-US link=3Dblue vlink=3D"#606420"> <div class=3DSection1> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'>Thanks all, I found the bug it was = an omitted return statement due to a “heavy finger” while = porting =A0function parse_one_oid_index mib.cxx.</span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'>Once I fixed it everything is = working as expected…</span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'> </span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'>Thanks,</span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'>Shuki</span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:navy'> </span></font></p> <div> <div class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><font = size=3D3 face=3D"Times New Roman"><span style=3D'font-size:12.0pt'> <hr size=3D2 width=3D"100%" align=3Dcenter tabindex=3D-1> </span></font></div> <p class=3DMsoNormal><b><font size=3D2 face=3DTahoma><span = style=3D'font-size:10.0pt; font-family:Tahoma;font-weight:bold'>From:</span></font></b><font = size=3D2 face=3DTahoma><span style=3D'font-size:10.0pt;font-family:Tahoma'> net-snmp-coders-admin@lists.sourceforge.net = [mailto:net-snmp-coders-admin@lists.sourceforge.net] <b><span style=3D'font-weight:bold'>On Behalf Of </span></b>sasson, = shuki<br> <b><span style=3D'font-weight:bold'>Sent:</span></b> Friday, November = 04, 2005 2:20 PM<br> <b><span style=3D'font-weight:bold'>To:</span></b> = net-snmp-coders@lists.sourceforge.net<br> <b><span style=3D'font-weight:bold'>Subject:</span></b> A bug in = parsing ASN_OCTET_STR as an index?</span></font></p> </div> <p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span = style=3D'font-size: 12.0pt'> </span></font></p> <p><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt;font-family:Arial'>Hi all, I am using Net-SNMP 5.2.1 to implement RFC</span></font> <font = size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier = New"'>2465</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>In it there is a table</span></font> <font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier = New"'>ipv6AddrPrefixTable</span></font> </p> <p><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt;font-family:Arial'>This table has 3 indexes:</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'> &n bsp; INDEX { ipv6IfIndex,</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier = New"'> &n bsp; = &n bsp; ipv6AddrPrefix,</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier = New"'> &n bsp; = &n bsp; ipv6AddrPrefixLength }</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>ipv6AddrPrefix is an</span></font> <font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier New"'>OCTET string. While the two others are 32 bits value = indexes.</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>When I am trying to send the following getnext request = to my</span></font> <font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier New"'>implementation module:</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>snmpgetnext -v 2c -c public 10.172.129.74:162 IPV6-MIB::ipv6AddrPrefixAdvValidLifetime.5.16.63.254.5. 1.255.255.1.0.2.4= ..35.255.254.69.107.20.64</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>I see that the indexes</span></font> <font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier New"'>were not parsed correctly. Here is the situation as I see it = in</span></font> <font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier New"'>a</span></font> <font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier New"'>gdb debugger:</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>(gdb) p = *table_info->indexes->val.integer</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>$22 =3D 5 & nbsp;  = ; & nbsp;  = ; & nbsp; </span></fo= nt> <font size=3D2 face=3DWingdings><span = style=3D'font-size:10.0pt;font-family:Wingdings'>=DF</span></font><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier New"'>--- That's the first index with the value of 5 (correct!)</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>gdb) p *table_info->indexes->next_variable &= nbsp; </span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>$23 =3D {next_variable =3D 0xc6386020, name =3D = 0xc6386838, name_length =3D 0, </span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'> type =3D 4 '\004', val =3D {integer =3D = 0xc5a53420, string =3D 0xc5a53420 "", </span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'> objid =3D 0xc5a53420, bitstring =3D = 0xc5a53420 "", counter64 =3D 0xc5a53420, </span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'> floatVal =3D 0xc5a53420, doubleVal = =3D 0xc5a53420}, val_len =3D 16, name_loc =3D {</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'> 4008636142 <repeats 128 = times>}, buf =3D "\0", '=EE' <repeats 39 times>, </span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'> data =3D 0x0, dataFreeHook =3D 0x0, index =3D = 0}</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>The above indicates that there is an</span></font> <font = size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier New"'>index value with length of 16 :val_len =3D 16 which is = correct!</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>When I try to look at the octet string itself using = bitstring:</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>(gdb) p table_info->indexes->next_variable->val.bitstring[1]</span></fo= nt></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>$26 =3D 0 '\0'</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>(gdb) p table_info->indexes->next_variable->val.bitstring[2]</span></fo= nt></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>$27 =3D 0 '\0'</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>(gdb) p table_info->indexes->next_variable->val.bitstring[3]</span></fo= nt></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>.</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>.</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>.</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>(gdb) p table_info->indexes->next_variable->val.bitstring[16]</span></f= ont></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>$36 =3D 0 '\0'</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>As one can see the IPv6 octet string come out to be all = zeros which is not correct.</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>Interestingly enough when I look into the</span></font> = <font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier New"'>third index value:</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>(gdb) p *table_info->indexes->next_variable->next_variable->val.inte= ger</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>$39 =3D 63</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>I see the value of the first OCTET in the octet = string!</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>I put a sniffer and I made sure that the indexes = are</span></font> <font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier New"'>traveling correctly to the agent.</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>It seems like there is a bug in parsing = the</span></font> <font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier New"'>octet string index. Its value is not copied to the bitstring memory area as = it should be. In addition the first octet of the 2<sup>nd</sup> index</span></font= > <font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier New"'>ipv6AddrPrefix which is 63 is assigned as the value of the 3<sup>rd</sup> = index:</span></font> <font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier = New"'>ipv6AddrPrefixLength instead of what should be 64).</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>A few questions:</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>1. </span></font> <font = size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier New"'>Is that a known problem (I am using Net-SNMP 5.2.1 which was ported to a = specific platform)? If the answer is yes where can I get a fix to = it?</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>2. </span></font> <font = size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier New"'>Can someone point to me to the place in the code where the indexes are = parsed?</span></font> <font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier New"'>I can use a debugger to try and figure out what is going = on...</span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>3. </span></font> <font = size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family:"Courier New"'>Any other ideas? </span></font></p> <p><font size=3D2 face=3D"Courier New"><span = style=3D'font-size:10.0pt;font-family: "Courier New"'>Thanks for your help!</span></font></p> <p><font size=3D2 color=3Dnavy face=3DTahoma><span = style=3D'font-size:10.0pt; font-family:Tahoma;color:navy'>Shuki Sasson</span></font><font = color=3Dblack><span style=3D'color:black'><br> </span></font><font size=3D2 color=3Dnavy face=3DTahoma><span = style=3D'font-size:10.0pt; font-family:Tahoma;color:navy'>Principal Engineer, Network Storage = Group</span></font><font color=3Dblack><span style=3D'color:black'><br> </span></font><b><font size=3D7 color=3Dnavy face=3DGaramond><span = style=3D'font-size: 36.0pt;font-family:Garamond;color:navy;font-weight:bold'>EMC=B2</span></= font></b><font color=3Dblack><span style=3D'color:black'><br> </span></font><b><font size=3D2 color=3Dblack face=3DArial><span = style=3D'font-size: 10.0pt;font-family:Arial;color:black;font-weight:bold'>where = information lives</span></font></b></p> <p><font size=3D3 color=3Dnavy face=3DTimes><span = style=3D'font-size:12.0pt;font-family: Times;color:navy'>Fax: 508 305 9026 </span></font> <font = color=3Dblack><span style=3D'color:black'><br> </span></font><font color=3Dnavy face=3DTimes><span = style=3D'font-family:Times; color:navy'>Phone: 508 305 8515<br> Cell: 617 834 4258<br> Pager: 877 919 0794 <br> Email: sasson_shuki@emc.com</span></font><b><span = style=3D'font-weight:bold'> </span></b></p> </div> </body> </html> ------_=_NextPart_001_01C5E182.28B995FF-- ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/...et-snmp-coders |
![]() |
| Thread Tools | |
| Display Modes | |
|
|