Results 1 to 6 of 6
Hi
I have endian issues in net-snmp.
when requesting for a value, instead of presenting 1 I get 16777216 (which is 1000...0000)
I tried adding the flag "--with-endianness" in configure ...
- 09-21-2010 #1Just Joined!
- Join Date
- Aug 2010
- Posts
- 9
endian problems Net-SNMP
Hi
I have endian issues in net-snmp.
when requesting for a value, instead of presenting 1 I get 16777216 (which is 1000...0000)
I tried adding the flag "--with-endianness" in configure with both big and little values - and none worked
What to do?
here are configure commands (in a file that I execute):
------------------------------------------------------------------------------
CC=mips64-octeon-linux-gnu-gcc\
LD=/home/naamab/projects/eclipse/env/cavium-sdk/tools-gcc-4.3/mips64-octeon-linux-gnu/bin/ld\
./configure --target=mips64-octeon-linux-gnu\
--build=mips64-octeon-linux-gnu\
--host=i686-pc-linux-gnu\
--prefix=$PWD/usr\
--exec-prefix=$PWD/../../../bin\
--with-build-cc=gc\
--with-endianness=big\
--enable-shared\
--enable-embedded-perl\
--with-mib-modules="ucd_snmp"\
--with-default-snmp-version=3\
--with-sys-location=\
--with-logfile=/data/net/naamab/snmp/log/snmpd.log\
--with-persistent-directory=/data/net/naamab/snmp/snmp_persist/
- 09-26-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
In any case, you need to use the host-to-network and network-to-host conversion functions. Which, depends upon the type/size of value you are converting, such as htonl/ntohl (32bit values), htons/ntohs (16bit values). The sending side needs to encode the values using htonl/htons and the receiving side needs to decode the values using ntohl/ntohs functions/macros.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 09-27-2010 #3Just Joined!
- Join Date
- Aug 2010
- Posts
- 9
I'm not sure where I need to use these functuins.
I created my MIBs source/header files using mib2c tool and filled in the necessary data.
- on the GET case, after getting the proper value from my external code I use the function "snmp_set_var_typed_value" (Net-SNMP/mib2c function)
- on the SET action I get the value from the request using :
req_value = *(requests->requestvb->val.integer);
and than set the new value on my external code
(requests is a pointer to the Net-SNMP structure "netsnmp_request_info" and it is one of the paraneters the handler receive)
Thank you,
nbm
- 10-03-2010 #4Just Joined!
- Join Date
- Aug 2010
- Posts
- 9
- 10-06-2010 #5Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 10-06-2010 #6Just Joined!
- Join Date
- Aug 2010
- Posts
- 9
Thanks a lot for your help.
I found the problem, and it had nothing to do with SNMP, but with a bug in my code
Have a great day!


Reply With Quote
