This is a discussion on sizeof(oid) and 32/64 bit issues within the SNMP Coders forums, part of the Networking and Network Related category; Hi, I'm currently doing some work porting some of our apps to a 64 bit platform. Having run into ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I'm currently doing some work porting some of our apps to a 64 bit platform. Having run into some crashes I started using valgrind and found some interesting issues. Our app uses both net-snmp and libsmi to do various things with MIB's. Internally we use net-snmp's oid type to define oids. However on 64 bit it breaks down when we pass an oid to libsmi to process. The problem can be seen by the following gdb session: (gdb) p (SmiSubid *)sysName0 $14 = (unsigned int *) 0x65ca60 (gdb) p sizeof(unsigned int) $15 = 4 (gdb) p sizeof(oid) $16 = 8 (gdb) p sizeof(u_long) $17 = 8 I'm currently using the standard net-snmp installed on the latest Ubuntu which trails the current stable release by a version. I noted there has been a bunch of 64 bit work in the Changelog but looking at the current SVN I see oid is still typedef'ed as u_long. I understand there is no particular reason why the internal workings of one library should match with another library as long as over-the-wire sizes are correct. However I'm curious if there is a reason as to the choice of u_long. Can an oid ever exceed 32 bits? Wouldn't it be safer to define oid as u32int_t? -- Alex Bennee Software Engineer T +44 1223 703053 Cambridge Broadband Networks T +44 1223 703000 F +44 1223 703001 http://www.cbnl.com ------------------------------------------------------------------------------ Cambridge Broadband Networks Limited Registered in England and Wales under company number: 03879840 Registered office: Selwyn House, Cambridge Business Park, Cowley Road, Cambridge CB4 0WZ, UK. VAT number: GB 741 0186 64 This email and any attachments are private and confidential. If you believe you have received this email in error please inform the sender and delete it from your mailbox or any other storage mechanism. Cambridge Broadband Networks Limited cannot accept liability for any statements made which are clearly the individual sender's own and not expressly made on behalf of Cambridge Broadband Networks Limited. ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757...un.com/javaone _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/...et-snmp-coders |
![]() |
| Thread Tools | |
| Display Modes | |
|
|