RE: problem with get_next when ipAddress as table index

"Naama Bar Menachem" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hi Dave

The problem was indeed solved when I got the indices from string as
separated characters - (idx->val.string)[0], (idx->val.string)[1],...
The set method stayed as it was and it works great!
*(idx->val.integer) = key_pointer->dest_ip;

Thank you!

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of
Dave Shield
Sent: Tuesday, July 24, 2012 10:51 AM
To: Naama Bar Menachem
Cc: [email protected]
Subject: Re: problem with get_next when ipAddress as table index

On 24 July 2012 06:45, Naama Bar Menachem
<[email protected]> wrote:
> I took your advice and tried a single getnext.
> No matter what index I write, it always receives 0,0,0,what-i-insert 
> (the first 3 are received as 0, only the fourth is received properly).

First of all - an apology.
I've had a closer look at the library code, and build_oid_noalloc() does
encode the whole index varbind list - not just a single value.
(I must have been looking at build_oid_segment() instead!)


> Is my index read wrong? Does ipAddress saved in " idx->val.integer " ?

Strictly speaking - no.   It's saved as the first four octets of
'idx->val.string'
Those two buffers actually overlap, so this may or may not be the same.
But given that you're getting the wrong results, that would tend to
indicate that they're not!

   One possibility springs to mind - are you working with a 64-bit
system?
It may be that you are settings the IP address as octets 5-8 of a 64-bit
long variable,   while the code that retrieves it is looking at octets
1-4.
That would certainly explain the response OID that's generated.

Try using 'snmp_set_var' to set the index varbind values for the three
IP addresses.   Have a look at agent/mibgroup/mibII/tcpTable.c
for an example of working with IP Address values.

Dave

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.