Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Increase the maxMsgSize for SNMP message

1,026 views
Skip to first unread message

Zheng, Wenjie (Barclay)

unread,
Nov 8, 2012, 7:07:17 AM11/8/12
to
Dear All,

Do you know what's the max_msg_size in net-snmp?
>From the code:
net-snmp/library/snmp_api.h:340:#defineSNMP_MAX_MSG_SIZE .SNMP_MAX_MSG_SIZE=1497.

But from my test, I found it can be larger in SNMP response message, by increase the max-repetition, the SNMP message got increased as more OIDs in one message, message could be around 2900, then it will not work bigger then that.

What is the bottle neck of the message size? How can we increase this?

Thanks,
Barclay


________________________________________
From: net-snmp-us...@lists.sourceforge.net [net-snmp-us...@lists.sourceforge.net]
Sent: Thursday, November 08, 2012 8:01 PM
To: net-snm...@lists.sourceforge.net
Subject: Net-snmp-users Digest, Vol 78, Issue 1

Send Net-snmp-users mailing list submissions to
net-snm...@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
or, via email, send a message with subject or body 'help' to
net-snmp-us...@lists.sourceforge.net

You can reach the person managing the list at
net-snmp-u...@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Net-snmp-users digest..."


Today's Topics:

1. Re: Problems with net-snmp on cygwin (Lee)
2. Re: Problems with net-snmp on cygwin (Bart Van Assche)
3. Running SNMP on windows (Gaelle Nsengiyumva)
4. Delayed response (Sverre Moe)
5. Problem with RPM build (jreg...@rego.org)
6. snmpd memory consumption 5.7.2 (Michi M?)
7. RE: snmpd memory consumption 5.7.2 (Gary Dunlap)
8. net-snmp cache reload:no response from the host (Jatin Bodarya)
9. Not able to set value using snmpset (Anirudha Patil)
10. Re: Not able to set value using snmpset (Dave Shield)
11. Re: Not able to set value using snmpset (Anirudha Patil)
12. Re: Delayed response (Sverre Moe)
13. delegated request, GETNEXT, and SNMP_NOSUCHINSTANCE (Ryan Morgan)
14. Re: Delayed response (Sverre Moe)
15. Small bug in net-snmp-5.7.1/snmplib/mib.c (Edgar)
16. Small bug in net-snmp-5.7.1/snmplib/mib.c (Edgar)
17. snmp only answering on localhost - but daemon is listening on
all ports (no iptables rules either) (Chris Bartram)
18. Re: snmp only answering on localhost - but daemon is
listening on all ports (no iptables rules either) (Dave Shield)
19. Windows: snmpd and a subagent connect via AgentX, but do not
resolve GET, SET and SNMPWALK. (antonio....@alice.it)
20. REPOST: Windows: snmpd and a subagent connect via AgentX, but
do not resolve GET, SET and SNMPWALK (Antonio Tringali)
21. executing snmpd::FATAL: kernel too old (Jatin Bodarya)
22. Unexpected behaviour (Sverre Moe)
23. executing snmpd::FATAL: kernel too old (Jatin Bodarya)
24. snmpd is not working with old kernel (Jatin Bodarya)
25. snmpusm: how to clone SNMPv3 users with different engineID
(Patrick Rogier)
26. Fwd: Selecting an outgoing interface (dos...@gmail.com)
27. problem with master/agentx on Openwrt - Net-snmp version
5.4.2.1 (Reza Salehi)
28. Determine Request PDU Size (Brandon Phelps)
29. statically compiled snmpd start error (John Q)
30. Re: statically compiled snmpd start error (John Q)
31. 'proxy' directive takes v3 user password in clear.
(Venkatramanan Srinivasan)


----------------------------------------------------------------------

Message: 1
Date: Mon, 29 Oct 2012 12:50:44 -0400
From: Lee <ler...@gmail.com>
Subject: Re: Problems with net-snmp on cygwin
To: Bart Van Assche <bvana...@acm.org>
Cc: net-snm...@lists.sourceforge.net
Message-ID:
<CAD8GWstPwDksG-ymU3_f0jPi...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On 10/29/12, Bart Van Assche <bvana...@acm.org> wrote:
> On 10/28/12 21:51, Lee wrote:
>> On 10/28/12, Patrick Rebert <patr...@yahoo.com> wrote:
>>> Thanks for the reply, I actually did try it with semicolons.
>>> Unfortunately, the
>>> shell sees the semicolon as a command terminator, so that didn't advance
>>> the cause.
>>
>> It's easier to build net-snmp with cygwin than it is to get the dos
>> version of net-snmp to work properly under cygwin. I submitted a
>> patch a while back for building net-snmp for cygwin:
>>
>> http://sourceforge.net/tracker/?func=detail&aid=3395862&group_id=12694&atid=312694
>> should at least give you an idea of what's needed.
>
> It isn't necessary anymore to modify the Net-SNMP source code in order
> to switch from semicolon to colon as a separator character. All you
> have to do is to set the ENV_SEPARATOR character before running
> configure. A quote from README.win32:
>
> ENV_SEPARATOR=":" \
> ./configure \
> --with-mib-modules="host agentx disman/event-mib examples/example"
> \
> --with-out-mib-modules=host/hr_network

I must be missing something; I can't find that in net-snmp-5.7.2.tar.gz
Where did your README.win32 come from?

& README.win32 could use an update:
"... The dependency on the
Cygwin dlls can be eliminated with the --mno-cygwin compiler flag,"

--mno-cygwin was dropped in version 1.7 of cygwin


Regards,
Lee



------------------------------

Message: 2
Date: Mon, 29 Oct 2012 20:42:48 +0100
From: Bart Van Assche <bvana...@acm.org>
Subject: Re: Problems with net-snmp on cygwin
To: Lee <ler...@gmail.com>
Cc: net-snm...@lists.sourceforge.net
Message-ID: <508EDC38...@acm.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 10/29/12 17:50, Lee wrote:
> On 10/29/12, Bart Van Assche <bvana...@acm.org> wrote:
>> On 10/28/12 21:51, Lee wrote:
>>> On 10/28/12, Patrick Rebert <patr...@yahoo.com> wrote:
>>>> Thanks for the reply, I actually did try it with semicolons.
>>>> Unfortunately, the
>>>> shell sees the semicolon as a command terminator, so that didn't advance
>>>> the cause.
>>>
>>> It's easier to build net-snmp with cygwin than it is to get the dos
>>> version of net-snmp to work properly under cygwin. I submitted a
>>> patch a while back for building net-snmp for cygwin:
>>>
>>> http://sourceforge.net/tracker/?func=detail&aid=3395862&group_id=12694&atid=312694
>>> should at least give you an idea of what's needed.
>>
>> It isn't necessary anymore to modify the Net-SNMP source code in order
>> to switch from semicolon to colon as a separator character. All you
>> have to do is to set the ENV_SEPARATOR character before running
>> configure. A quote from README.win32:
>>
>> ENV_SEPARATOR=":" \
>> ./configure \
>> --with-mib-modules="host agentx disman/event-mib examples/example"
>> \
>> --with-out-mib-modules=host/hr_network
>
> I must be missing something; I can't find that in net-snmp-5.7.2.tar.gz
> Where did your README.win32 come from?

From the master branch. I've just backported that feature to the 5.7
branch.

Bart.




------------------------------

Message: 3
Date: Mon, 29 Oct 2012 13:26:18 -0400
From: Gaelle Nsengiyumva <nsen...@gmail.com>
Subject: Running SNMP on windows
To: net-snm...@lists.sourceforge.net
Message-ID:
<CAKZ8YmHhjZi0Y82uiy_LXLzU...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi,
I am learning how to use SNMP and i found the tutorials/source code (
http://net-snmp.sourceforge.net/tutorial/tutorial-5/toolkit/demoapp/index.html)
on your website.
Am using windows 7, but I can also use a QNX server to run the program. Any
directions on how to do this?
Is there a particular environment I should run it in?

Thanks,

--
Gaelle
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 4
Date: Tue, 30 Oct 2012 15:01:19 +0100 (CET)
From: Sverre Moe <sve...@spacetec.no>
Subject: Delayed response
To: net-snm...@lists.sourceforge.net
Message-ID: <d7f86b83-1cbb-45f7-9567-14fb80399364@zcs>
Content-Type: text/plain; charset="iso-8859-1"


Is registering an Net-SNMP alarm the only way to delay a response?



I don't need to delay for a given amount of time, but until a signal is received (sigc signal). Anyway I could do that?


If not, the only possible way I see to get around this is to use an alarm with a timeout delay. Wait for 5-10 seconds, check if signal is received and data ready and then send it to the requester, if not send error SNMP_ERR_RESOURCEUNAVAILABLE .




My code for the delayed handler. I doesn't work if I keep the snmp_alarm_register inside the for-loop. Why is that? It will fail on the line with " if (!cache) { ".
Also, somehow handle_snmp gets called 4 times when delayed 1 second, 9 times for 2 seconds, 14 times for 3 seconds. I can't have that. Inside my if-statement in the for-loop I call my device to get the information for the request, I cannot call this so many times for one only request.



[CODE]

int
handle_snmp(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests) {

const oid* request_oid = (*reginfo).rootoid;
map<oid_wrapper, scalar>::iterator scalar_iterator;
for (scalar_iterator = scalars.begin();
scalar_iterator != scalars.end();
scalar_iterator++) {
const oid_wrapper oid_wrapper = (*scalar_iterator).first;
const scalar _scalar = (*scalar_iterator).second;

const oid* oid_value = oid_wrapper.get_oid();
const int oid_length = oid_wrapper.get_length();
if (netsnmp_oid_equals(oid_value, oid_length, request_oid, oid_length) == 0) {
cout << "We got here..." << endl;

requests->delegated = 1;
snmp_alarm_register(1,
0,
delayed_response,
(void *)
netsnmp_create_delegated_cache(handler,
reginfo,
reqinfo,
requests,
NULL));
} else {
netsnmp_set_request_error(reqinfo,
requests,
SNMP_ERR_RESOURCEUNAVAILABLE);
}
}

return SNMP_ERR_NOERROR;
}

void
delayed_response(unsigned int clientreg, void *clientarg) {
netsnmp_delegated_cache *cache = (netsnmp_delegated_cache *) clientarg;
netsnmp_request_info *requests;
netsnmp_agent_request_info *reqinfo;
cache = netsnmp_handler_check_cache(cache);

if (!cache) {
snmp_log(LOG_ERR, "illegal call to return delayed response\n");
return;
}

reqinfo = cache->reqinfo;
requests = cache->requests;

void* datapointer;
char buffer[2048];
int dataint;
int length = 0;
u_char type;

strcpy(buffer, "Testing delayed SNMP");
datapointer = buffer;
length = strlen(buffer);
type = ASN_OCTET_STR;

requests->delegated = 0;
switch(reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb,
type,
datapointer,
length);
break;

default:
snmp_log(LOG_ERR, "unknown mode (%d) in delayed_response\n", reqinfo->mode );
}

netsnmp_free_delegated_cache(cache);
}

[/CODE]


CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be
proprietary, confidential or subject to export regulations, and is only meant
for the intended recipient(s). Any disclosure, copying, distribution or use is
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in
error, please delete it immediately from your system and notify the sender
properly.
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 5
Date: Tue, 30 Oct 2012 08:23:08 -0700
From: <jreg...@rego.org>
Subject: Problem with RPM build
To: net-snm...@lists.sourceforge.net
Message-ID:
<20121030082308.feb4017efaa820d2...@email14.secureserver.net>

Content-Type: text/plain; charset="us-ascii"

An HTML attachment was scrubbed...

------------------------------

Message: 6
Date: Tue, 30 Oct 2012 10:51:01 +0100
From: Michi M? <mimi...@googlemail.com>
Subject: snmpd memory consumption 5.7.2
To: net-snm...@lists.sourceforge.net
Message-ID:
<CADAoUro9c5PrQELpcWa2Aj4p...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hello together,

I'm using net-snmp 5.7.2 with agentx for my own agent. I actually have the
problem, that when i generate a trap with my device, the memory consuption
of the snmpd is growing. When i generate many traps, the memory
consuption grows till 40% of physical memory and then it stops growing. The
snmpd is working well so my problem is the memory consumption, the same
agent compiled with net-snmp 5.3.2.2 is working without this issue. Has
anybody an idea? It looks to me like a sipmle configuration problem, but i
cannot find the right parameter.

Thank you all.
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 7
Date: Tue, 30 Oct 2012 10:46:38 -0600
From: Gary Dunlap <Gary....@dothill.com>
Subject: RE: snmpd memory consumption 5.7.2
To: Michi M? <mimi...@googlemail.com>,
"net-snm...@lists.sourceforge.net"
<net-snm...@lists.sourceforge.net>
Message-ID:
<7BDD12990A87C04088047...@dc-ex1.power.com>
Content-Type: text/plain; charset="utf-8"

Hi. I saw a similar problem in moving to Net-SNMP 5.6.1. The memory leak was pretty large as I recall, about 8K per trap. Memory was consumed up to the limits of the compiler, but this was having an adverse affect on other embedded applications

It seemed to me that a new MIB had been included by default, the Notification Log MIB. A call was being made to implement this, and that was where the memory leak was. The Notification Log MIB wasn?t providing any benefit that I could see, so I tried unsuccessfully to omit it with a ??with-out-mibs=?NOTIFICATION_LOG_MIB? directive to the configure step. Since that didn?t work, I commented out the call to log_notification() in the file snmpNotifyTable.c. That worked.

Fwiw?there?s probably a more accepted way to solve this.

Gary Dunlap
Dot Hill Systems
1351 S Sunset St
Longmont, CO 80501-6533
303-845-3277



From: Michi M? [mailto:mimi...@googlemail.com]
Sent: Tuesday, October 30, 2012 3:51 AM
To: net-snm...@lists.sourceforge.net
Subject: snmpd memory consumption 5.7.2

Hello together,

I'm using net-snmp 5.7.2 with agentx for my own agent. I actually have the problem, that when i generate a trap with my device, the memory consuption of the snmpd is growing. When i generate many traps, the memory consuption grows till 40% of physical memory and then it stops growing. The snmpd is working well so my problem is the memory consumption, the same agent compiled with net-snmp 5.3.2.2 is working without this issue. Has anybody an idea? It looks to me like a sipmle configuration problem, but i cannot find the right parameter.

Thank you all.
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 8
Date: Wed, 31 Oct 2012 16:21:36 +0530
From: "Jatin Bodarya" <jatin....@elitecore.com>
Subject: net-snmp cache reload:no response from the host
To: <net-snm...@lists.sourceforge.net>
Message-ID: <000c01cdb755$b2dd4080$1897c180$@bod...@elitecore.com>
Content-Type: text/plain; charset="us-ascii"

Hello all
I have implemented AgentX using mib2c.create-dataset.conf ( with cache
enabled)

In my snmd.conf :: agentXTimeout 15



In testtable.h file I have changed cache value as below...

#define testTABLE_TIMEOUT 60



According to my understanding It loads data every 60 second.

Now my issue is if the data in data table is exceeds some amount it takes
some amount of time to load it.



As in between If I fired SNMPWALK it gives me "no response from the host" If
I use SNMPWALK for whole table and in between testTABLE_TIMEOUT occurs it
stops in between and shows following error (no response from the host).

Please tell me how to solve it ? In my table large amount of data is present
and changing frequently.



I read some where:

(when the agent receives a request for something in this table and the cache
is older than the defined timeout (12s > 10s), then it *does* re-load the
data. This is the expected behaviour.

However the agent does not automatically release the local cache (i.e. call
the 'free' routine) as soon as the timeout has expired.

Instead this is handled by a regular "garbage collection" run (once a
minute), which will free any stale caches.

In the meantime, a request that tries to use that cache will spot that it's
expired, and reload the data.)



Is there any connection between these two ?? I can't get this... How to
resolve my problem ???





Thanks in advance.

-Jatin

-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 9
Date: Wed, 31 Oct 2012 17:29:37 +0530
From: Anirudha Patil <anirud...@gmail.com>
Subject: Not able to set value using snmpset
To: net-snm...@lists.sourceforge.net
Message-ID:
<CAAwxGDQvXLbNNpg1jmLOXzpe...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hello,

I have a concern about "*snmpset*" command. I'm not able to set a
hrStorageDescr or hrStorageType.

I have a working system and a CDROM mounted on my server [/mnt]. Now the
SNMP response show the type for CDROM detected [mounted on dir /mnt] as *
hrStorageFixedDisk*. I wish to change it to hrStorageOther, but unable to
do so and received notWritable error after using the snmpset command

Below is the response received when issued the snmpset command along with
the necessary details about my setup

*OS: RHEL6.1*
[root@server ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.1 (Santiago)

*SNMP version : 5.5*
[root@server ~]# snmpd -v
NET-SNMP version: 5.5
Web: http://www.net-snmp.org/
Email: net-snm...@lists.sourceforge.net

[root@server ~]# cat /etc/snmp/snmpd.conf
rocommunity public
rwcommunity private

SNMPWALK response
[root@server ~]# *snmpwalk -v2c -cpublic localhost | grep hrStorage*
HOST-RESOURCES-MIB::hrStorageIndex.1 = INTEGER: 1
HOST-RESOURCES-MIB::hrStorageIndex.3 = INTEGER: 3
HOST-RESOURCES-MIB::hrStorageIndex.6 = INTEGER: 6
HOST-RESOURCES-MIB::hrStorageIndex.7 = INTEGER: 7
HOST-RESOURCES-MIB::hrStorageIndex.10 = INTEGER: 10
HOST-RESOURCES-MIB::hrStorageIndex.31 = INTEGER: 31
HOST-RESOURCES-MIB::hrStorageIndex.35 = INTEGER: 35
HOST-RESOURCES-MIB::hrStorageIndex.36 = INTEGER: 36
HOST-RESOURCES-MIB::hrStorageIndex.37 = INTEGER: 37
HOST-RESOURCES-MIB::hrStorageIndex.39 = INTEGER: 39
HOST-RESOURCES-MIB::hrStorageType.1 = OID:
HOST-RESOURCES-TYPES::hrStorageRam
HOST-RESOURCES-MIB::hrStorageType.3 = OID:
HOST-RESOURCES-TYPES::hrStorageVirtualMemory
HOST-RESOURCES-MIB::hrStorageType.6 = OID:
HOST-RESOURCES-TYPES::hrStorageOther
HOST-RESOURCES-MIB::hrStorageType.7 = OID:
HOST-RESOURCES-TYPES::hrStorageOther
HOST-RESOURCES-MIB::hrStorageType.10 = OID:
HOST-RESOURCES-TYPES::hrStorageVirtualMemory
HOST-RESOURCES-MIB::hrStorageType.31 = OID:
HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageType.35 = OID:
HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageType.36 = OID:
HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageType.37 = OID:
HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageType.39 = OID: HOST-RESOURCES-TYPES::
hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageDescr.1 = STRING: Physical memory
HOST-RESOURCES-MIB::hrStorageDescr.3 = STRING: Virtual memory
HOST-RESOURCES-MIB::hrStorageDescr.6 = STRING: Memory buffers
HOST-RESOURCES-MIB::hrStorageDescr.7 = STRING: Cached memory
HOST-RESOURCES-MIB::hrStorageDescr.10 = STRING: Swap space
HOST-RESOURCES-MIB::hrStorageDescr.31 = STRING: /
HOST-RESOURCES-MIB::hrStorageDescr.35 = STRING: /dev/shm
HOST-RESOURCES-MIB::hrStorageDescr.36 = STRING: /boot
HOST-RESOURCES-MIB::hrStorageDescr.37 = STRING: /data
HOST-RESOURCES-MIB::hrStorageDescr.39 = STRING: /mnt
......output omitted

[root@server ~]# *snmpset -m ALL -v2c -c private localhost hrStorageType.39
o hrStorageOther*
Error in packet.
*Reason: notWritable (That object does not support modification)*
Failed object: HOST-RESOURCES-MIB::hrStorageType.39

[root@server ~]# *snmpset -m ALL -v2c -cprivate localhost hrStorageDescr.39
s "/mnt_new"*
Error in packet.
*Reason: notWritable (That object does not support modification)*
Failed object: HOST-RESOURCES-MIB::hrStorageDescr.39

Please help me to understand the reason the above commands are failing. I
dont have any ACL defined on snmpd.conf file.

I have also manually tried changing the MAX-ACCESS for the objects in their
corresponding MIB [/usr/share/snmp/mibs], but still its not working

HOST-RESOURCES-MIB.txt

hrStorageType OBJECT-TYPE
SYNTAX AutonomousType
MAX-ACCESS *read-write*
STATUS current
DESCRIPTION
--
hrStorageDescr OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS *read-write*
STATUS current
DESCRIPTION

Let me know how can i set this value.


With Regards
Anirudha Patil
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 10
Date: Wed, 31 Oct 2012 12:36:04 +0000
From: Dave Shield <D.T.S...@liverpool.ac.uk>
Subject: Re: Not able to set value using snmpset
To: Anirudha Patil <anirud...@gmail.com>
Cc: net-snm...@lists.sourceforge.net
Message-ID:
<CAKoMtGacHgXUQU45v37qV=AqGB_BNH5=MjrgNiDbE...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On 31 October 2012 11:59, Anirudha Patil <anirud...@gmail.com> wrote:
> I have a concern about "snmpset" command. I'm not able to set a
> hrStorageDescr or hrStorageType.

Correct.
>From the definition of these objects in HOST-RESOURCES-MIB:

hrStorageType OBJECT-TYPE
MAX-ACCESS read-only
::= { hrStorageEntry 2 }

hrStorageDescr OBJECT-TYPE
MAX-ACCESS read-only
::= { hrStorageEntry 3 }

"read-only" means that you cannot issue a SET command on such objects.



> I have also manually tried changing the MAX-ACCESS for the objects
> in their corresponding MIB [/usr/share/snmp/mibs], but still its not working

a) This is an internationally agreed standard MIB.
You can't simply decide to change it unilaterally.

b) The code within the agent that implements this MIB has been written
following the standard definitions. As such, these objects are
implemented as read-only objects. There is simply no code
within the agent to handle SET requests for them
Even if you go your own way and ignore issues of interoperability,
you are still going to have to write additional code for the agent, so
that it knows how to handle SET requests for these objects - how to
process the assignment, how to save the new state so that it's
retained when the agent restarts, etc, etc

The agent is not a magic box - you can't simply edit a text file and expect
everything to just start working. You need to supply the missing code.

Dave



------------------------------

Message: 11
Date: Wed, 31 Oct 2012 18:15:56 +0530
From: Anirudha Patil <anirud...@gmail.com>
Subject: Re: Not able to set value using snmpset
To: Dave Shield <D.T.S...@liverpool.ac.uk>
Cc: net-snm...@lists.sourceforge.net
Message-ID:
<CAAwxGDT0m=br1_i_v6_ZAb8irU4AC-...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hello Dave,

Thank you for the comments.

I would see to it that i study more on agent and extending the support for
agent.


With Regards
Anirudha Patil


On Wed, Oct 31, 2012 at 6:06 PM, Dave Shield <D.T.S...@liverpool.ac.uk>wrote:

> On 31 October 2012 11:59, Anirudha Patil <anirud...@gmail.com> wrote:
> > I have a concern about "snmpset" command. I'm not able to set a
> > hrStorageDescr or hrStorageType.
>
> Correct.
> From the definition of these objects in HOST-RESOURCES-MIB:
>
> hrStorageType OBJECT-TYPE
> MAX-ACCESS read-only
> ::= { hrStorageEntry 2 }
>
> hrStorageDescr OBJECT-TYPE
> MAX-ACCESS read-only
> ::= { hrStorageEntry 3 }
>
> "read-only" means that you cannot issue a SET command on such objects.
>
>
>
> > I have also manually tried changing the MAX-ACCESS for the objects
> > in their corresponding MIB [/usr/share/snmp/mibs], but still its not
> working
>
> a) This is an internationally agreed standard MIB.
> You can't simply decide to change it unilaterally.
>
> b) The code within the agent that implements this MIB has been written
> following the standard definitions. As such, these objects are
> implemented as read-only objects. There is simply no code
> within the agent to handle SET requests for them
> Even if you go your own way and ignore issues of interoperability,
> you are still going to have to write additional code for the agent,
> so
> that it knows how to handle SET requests for these objects - how to
> process the assignment, how to save the new state so that it's
> retained when the agent restarts, etc, etc
>
> The agent is not a magic box - you can't simply edit a text file and expect
> everything to just start working. You need to supply the missing code.
>
> Dave
>
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 12
Date: Wed, 31 Oct 2012 14:23:00 +0100 (CET)
From: Sverre Moe <sve...@spacetec.no>
Subject: Re: Delayed response
To: net-snm...@lists.sourceforge.net
Message-ID: <17e9ebb2-5175-413e-86cd-02a09bc94e16@zcs>
Content-Type: text/plain; charset="iso-8859-1"


Update:


Running: snmpget -v2c -c public localhost 1.3.6.1.4.1.49463.1.3.40.0


This is the frequency my handle_snmp and delayed_response gets called.
handle_snmp
handle_snmp
handle_snmp
handle_snmp
handle_snmp
handle_snmp
delayed_response
handle_snmp
handle_snmp
handle_snmp
delayed_response
delayed_response
handle_snmp
delayed_response
delayed_response
delayed_response
handle_snmp
delayed_response
delayed_response
delayed_response
delayed_response
delayed_response



The response are sent to the requester(snmpget) at line 7(the first delayed_response). Why does both the handler method and my delayed callback get called so many times. Delayed time is set to 3 seconds. If I also sends two snmpget at the same time, this output gets jumbled for each call. Is there a way to have some sort of synchronization on the handler. Can I have new calls to wait until the current one has been dispatched?




/Sverre

----- Original Message -----

Fra: "Sverre Moe" <sve...@spacetec.no>
Til: net-snm...@lists.sourceforge.net
Sendt: 30. oktober 2012 15:01:19
Emne: Delayed response



Is registering an Net-SNMP alarm the only way to delay a response?



I don't need to delay for a given amount of time, but until a signal is received (sigc signal). Anyway I could do that?


If not, the only possible way I see to get around this is to use an alarm with a timeout delay. Wait for 5-10 seconds, check if signal is received and data ready and then send it to the requester, if not send error SNMP_ERR_RESOURCEUNAVAILABLE .




My code for the delayed handler. I doesn't work if I keep the snmp_alarm_register inside the for-loop. Why is that? It will fail on the line with " if (!cache) { ".
Also, somehow handle_snmp gets called 4 times when delayed 1 second, 9 times for 2 seconds, 14 times for 3 seconds. I can't have that. Inside my if-statement in the for-loop I call my device to get the information for the request, I cannot call this so many times for one only request.



[CODE]

int
handle_snmp(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests) {

const oid* request_oid = (*reginfo).rootoid;
map<oid_wrapper, scalar>::iterator scalar_iterator;
for (scalar_iterator = scalars.begin();
scalar_iterator != scalars.end();
scalar_iterator++) {
const oid_wrapper oid_wrapper = (*scalar_iterator).first;
const scalar _scalar = (*scalar_iterator).second;

const oid* oid_value = oid_wrapper.get_oid();
const int oid_length = oid_wrapper.get_length();
if (netsnmp_oid_equals(oid_value, oid_length, request_oid, oid_length) == 0) {
cout << "We got here..." << endl;

requests->delegated = 1;
snmp_alarm_register(1,
0,
delayed_response,
(void *)
netsnmp_create_delegated_cache(handler,
reginfo,
reqinfo,
requests,
NULL));
} else {
netsnmp_set_request_error(reqinfo,
requests,
SNMP_ERR_RESOURCEUNAVAILABLE);
}
}

return SNMP_ERR_NOERROR;
}

void
delayed_response(unsigned int clientreg, void *clientarg) {
netsnmp_delegated_cache *cache = (netsnmp_delegated_cache *) clientarg;
netsnmp_request_info *requests;
netsnmp_agent_request_info *reqinfo;
cache = netsnmp_handler_check_cache(cache);

if (!cache) {
snmp_log(LOG_ERR, "illegal call to return delayed response\n");
return;
}

reqinfo = cache->reqinfo;
requests = cache->requests;

void* datapointer;
char buffer[2048];
int dataint;
int length = 0;
u_char type;

strcpy(buffer, "Testing delayed SNMP");
datapointer = buffer;
length = strlen(buffer);
type = ASN_OCTET_STR;

requests->delegated = 0;
switch(reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb,
type,
datapointer,
length);
break;

default:
snmp_log(LOG_ERR, "unknown mode (%d) in delayed_response\n", reqinfo->mode );
}

netsnmp_free_delegated_cache(cache);
}

[/CODE]


CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be
proprietary, confidential or subject to export regulations, and is only meant
for the intended recipient(s). Any disclosure, copying, distribution or use is
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in
error, please delete it immediately from your system and notify the sender
properly.



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Net-snmp-users mailing list
Net-snm...@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users



CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be
proprietary, confidential or subject to export regulations, and is only meant
for the intended recipient(s). Any disclosure, copying, distribution or use is
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in
error, please delete it immediately from your system and notify the sender
properly.
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 13
Date: Wed, 31 Oct 2012 20:56:56 -0400
From: Ryan Morgan <ry...@ryantmorgan.com>
Subject: delegated request, GETNEXT, and SNMP_NOSUCHINSTANCE
To: net-snm...@lists.sourceforge.net
Message-ID: <5091C8D8...@ryantmorgan.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

I'm trying to implement a subagent module for my table, which is an
interface table on which my protocol runs. All of the table data is
owned/managed by an external process, so in my code I need to make
asynchronous calls (via IPC) to the process to get/set data (which is
why I'm using delegated requests). GET and SET work like a charm.
However, I'm running into an issue with GETNEXT. The interface table
I'm implementing won't always have an instance/row for each interface on
the machine, so in my delegated request callback handler I do
netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE).

This works fine in the main table handler if I hard-code the responses.
In that case, if I do SNMP_NOSUCHINSTANCE, another GETNEXT request
gets called, and then I'll handle the next interface. In other words,
SNMP_NOSUCHINSTANCE seems to result in another GETNEXT call for my main
table handler, which is what I want. But when I remove the hard-coding
and actually use the delegating requests, when I do SNMP_NOSUCHINSTANCE
in the callback, I don't get any more calls to GETNEXT.

In my delegated request callback, how do I signal "this particular
interface/instance/row doesn't exist, but others might, so keep asking"?


Thank you!!






------------------------------

Message: 14
Date: Thu, 01 Nov 2012 12:46:25 +0100 (CET)
From: Sverre Moe <sve...@spacetec.no>
Subject: Re: Delayed response
To: net-snm...@lists.sourceforge.net
Message-ID: <51f5a597-1d9c-4a6a-8ca5-6ab9c8308805@zcs>
Content-Type: text/plain; charset="iso-8859-1"


New update:


I have put all incoming requests in an active request list to avoid querying the device multiple times for one request.


However:
If I am using a delayed time of more than 7 seconds, I get a timeout from the master agent and my subagent gets disconnected.


AgentX master disconnected us, reconnecting in 15
NET-SNMP version 5.7.1 AgentX subagent connected



/var/log/net-snmp.log
Connection from UDP: [127.0.0.1]:47426->[127.0.0.1]:161
agentx/master: agentx master handler starting, mode = 0xa0
agentx/master: request for variable (SNMPv2-SMI::enterprises.49463.1.3.40.0)
agentx/master: sending pdu (req=0x17d,trans=0x17c,sess=0x6b)
agentx_build: packet built okay
Connection from UDP: [127.0.0.1]:47426->[127.0.0.1]:161
agentx/master: agentx master handler starting, mode = 0xa0
agentx/master: request for variable (SNMPv2-SMI::enterprises.49463.1.3.40.0)
agentx/master: sending pdu (req=0x17f,trans=0x17e,sess=0x6b)
agentx_build: packet built okay
agentx_build: packet built okay
Connection from UDP: [127.0.0.1]:47426->[127.0.0.1]:161
agentx/master: agentx master handler starting, mode = 0xa0
agentx/master: request for variable (SNMPv2-SMI::enterprises.49463.1.3.40.0)
agentx/master: sending pdu (req=0x181,trans=0x180,sess=0x6b)
agentx_build: packet built okay
agentx_build: packet built okay
agentx_build: packet built okay
agentx_build: packet built okay
agentx_build: packet built okay
agentx_build: packet built okay
Connection from UDP: [127.0.0.1]:47426->[127.0.0.1]:161
agentx/master: agentx master handler starting, mode = 0xa0
agentx/master: request for variable (SNMPv2-SMI::enterprises.49463.1.3.40.0)
agentx/master: sending pdu (req=0x183,trans=0x182,sess=0x6b)
agentx_build: packet built okay
agentx_build: packet built okay
agentx_build: packet built okay
agentx_build: packet built okay
agentx_build: packet built okay
Connection from UDP: [127.0.0.1]:47426->[127.0.0.1]:161
agentx/master: agentx master handler starting, mode = 0xa0
agentx/master: request for variable (SNMPv2-SMI::enterprises.49463.1.3.40.0)
agentx/master: sending pdu (req=0x187,trans=0x186,sess=0x6b)
agentx_build: packet built okay
agentx_build: packet built okay
agentx/master: timeout on session 0x7f6ecc8ceb10 req=0x17d
agentx/master: close 0x7f6ecc8ceb10, -1
agentx/master: Continue removing delegated subsession reqests
agentx/master: close transport
agentx/master: response too late on session 0x7f6ecc8ceb10
agentx/master: response too late on session 0x7f6ecc8ceb10
agentx/master: response too late on session 0x7f6ecc8ceb10
agentx/master: response too late on session 0x7f6ecc8ceb10
agentx/master: response too late on session 0x7f6ecc8ceb10



----- Original Message -----

Fra: "Sverre Moe" <sve...@spacetec.no>
Til: net-snm...@lists.sourceforge.net
Sendt: 31. oktober 2012 14:23:00
Emne: Re: Delayed response



Update:


Running: snmpget -v2c -c public localhost 1.3.6.1.4.1.49463.1.3.40.0


This is the frequency my handle_snmp and delayed_response gets called.
handle_snmp
handle_snmp
handle_snmp
handle_snmp
handle_snmp
handle_snmp
delayed_response
handle_snmp
handle_snmp
handle_snmp
delayed_response
delayed_response
handle_snmp
delayed_response
delayed_response
delayed_response
handle_snmp
delayed_response
delayed_response
delayed_response
delayed_response
delayed_response



The response are sent to the requester(snmpget) at line 7(the first delayed_response). Why does both the handler method and my delayed callback get called so many times. Delayed time is set to 3 seconds. If I also sends two snmpget at the same time, this output gets jumbled for each call. Is there a way to have some sort of synchronization on the handler. Can I have new calls to wait until the current one has been dispatched?




/Sverre

----- Original Message -----

Fra: "Sverre Moe" <sve...@spacetec.no>
Til: net-snm...@lists.sourceforge.net
Sendt: 30. oktober 2012 15:01:19
Emne: Delayed response



Is registering an Net-SNMP alarm the only way to delay a response?



I don't need to delay for a given amount of time, but until a signal is received (sigc signal). Anyway I could do that?


If not, the only possible way I see to get around this is to use an alarm with a timeout delay. Wait for 5-10 seconds, check if signal is received and data ready and then send it to the requester, if not send error SNMP_ERR_RESOURCEUNAVAILABLE .




My code for the delayed handler. I doesn't work if I keep the snmp_alarm_register inside the for-loop. Why is that? It will fail on the line with " if (!cache) { ".
Also, somehow handle_snmp gets called 4 times when delayed 1 second, 9 times for 2 seconds, 14 times for 3 seconds. I can't have that. Inside my if-statement in the for-loop I call my device to get the information for the request, I cannot call this so many times for one only request.



[CODE]

int
handle_snmp(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests) {

const oid* request_oid = (*reginfo).rootoid;
map<oid_wrapper, scalar>::iterator scalar_iterator;
for (scalar_iterator = scalars.begin();
scalar_iterator != scalars.end();
scalar_iterator++) {
const oid_wrapper oid_wrapper = (*scalar_iterator).first;
const scalar _scalar = (*scalar_iterator).second;

const oid* oid_value = oid_wrapper.get_oid();
const int oid_length = oid_wrapper.get_length();
if (netsnmp_oid_equals(oid_value, oid_length, request_oid, oid_length) == 0) {
cout << "We got here..." << endl;

requests->delegated = 1;
snmp_alarm_register(1,
0,
delayed_response,
(void *)
netsnmp_create_delegated_cache(handler,
reginfo,
reqinfo,
requests,
NULL));
} else {
netsnmp_set_request_error(reqinfo,
requests,
SNMP_ERR_RESOURCEUNAVAILABLE);
}
}

return SNMP_ERR_NOERROR;
}

void
delayed_response(unsigned int clientreg, void *clientarg) {
netsnmp_delegated_cache *cache = (netsnmp_delegated_cache *) clientarg;
netsnmp_request_info *requests;
netsnmp_agent_request_info *reqinfo;
cache = netsnmp_handler_check_cache(cache);

if (!cache) {
snmp_log(LOG_ERR, "illegal call to return delayed response\n");
return;
}

reqinfo = cache->reqinfo;
requests = cache->requests;

void* datapointer;
char buffer[2048];
int dataint;
int length = 0;
u_char type;

strcpy(buffer, "Testing delayed SNMP");
datapointer = buffer;
length = strlen(buffer);
type = ASN_OCTET_STR;

requests->delegated = 0;
switch(reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb,
type,
datapointer,
length);
break;

default:
snmp_log(LOG_ERR, "unknown mode (%d) in delayed_response\n", reqinfo->mode );
}

netsnmp_free_delegated_cache(cache);
}

[/CODE]


CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be
proprietary, confidential or subject to export regulations, and is only meant
for the intended recipient(s). Any disclosure, copying, distribution or use is
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in
error, please delete it immediately from your system and notify the sender
properly.



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Net-snmp-users mailing list
Net-snm...@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users



CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be
proprietary, confidential or subject to export regulations, and is only meant
for the intended recipient(s). Any disclosure, copying, distribution or use is
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in
error, please delete it immediately from your system and notify the sender
properly.



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Net-snmp-users mailing list
Net-snm...@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users



CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be
proprietary, confidential or subject to export regulations, and is only meant
for the intended recipient(s). Any disclosure, copying, distribution or use is
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in
error, please delete it immediately from your system and notify the sender
properly.
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 15
Date: Fri, 02 Nov 2012 16:25:27 +0100
From: Edgar <po...@edgar-matzinger.nl>
Subject: Small bug in net-snmp-5.7.1/snmplib/mib.c
To: <Net-snm...@lists.sourceforge.net>
Message-ID: <9f42f6aad9814f69...@www.edgar-matzinger.nl>
Content-Type: text/plain; charset=UTF-8; format=flowed

LS,

when playing around with bitstrings, I found a small bug in
net-snmp-5.7.1/snmplib/mib.c
in sprint_realloc_bitstring:
--------8<-----------
for (; enums; enums = enums->next) {
if (enums->value == (len * 8) + bit) {
enum_string = enums->label;
break;
}
}
--------8<-----------

The above snippet assumes that all bits are enumerated in an ascending
order. But Cisco
has a MIB (CISCO-QOS-PIB-MIB) that enumerates
QosInterfaceTypeCapabilities in a
random order:

--------8<-----------
QosInterfaceTypeCapabilities ::= TEXTUAL-CONVENTION
STATUS current
DESCRIPTION
"An enumeration of interface capabilities. Used by the PDP to
select policies and configuration to push to the PEP."
SYNTAX BITS {
unspecified (0),

-- Classification support
inputL2Classification (1), inputIpClassification (2),
outputL2Classification (3), outputIpClassification (4),
inputPortClassification (19), outputPortClassification (20),

-- Policing support
inputUflowPolicing (5), inputAggregatePolicing (6),
outputUflowPolicing (7), outputAggregatePolicing (8),
policeByMarkingDown (9), policeByDropping (10),
inputUflowShaping (21), inputAggregateShaping (22),
outputUflowShaping (23), outputAggregateShaping (24),

-- Supported scheduling mechanisms
fifo (11), wrr (12), wfq (13), cq (14), pq (15), cbwfq (16),
pqWrr (25), pqCbwfq (26),

-- Supported congestion control mechanisms
tailDrop (17), wred (18)
}
--------8<-----------

When I run a small tool that print out all bits using
snmp_varlist_add_variable and
snprint_variable:

--------8<-----------
/* val is a pointer to a u_char string */
snmp_varlist_add_variable (&vars, name, name_length,
ASN_BIT_STR, (u_char *)val, val_size);

snprint_variable (n, sizeof (n), name, name_length,
vars);
printf ("test vars: %s\n", n);

snmp_free_varbind(vars);
--------8<-----------

It outputs:
$ ./snmpt
test vars: CISCO-QOS-PIB-MIB::qosInterfaceTypeCapabilities = BITS: FF
FF FF E0 00 unspecified(0) inputL2Classification(1)
inputIpClassification(2) outputL2Classification(3)
outputIpClassification(4) inputUflowPolicing(5)
inputAggregatePolicing(6) outputUflowPolicing(7)
outputAggregatePolicing(8) policeByMarkingDown(9) policeByDropping(10)
fifo(11) wrr(12) wfq(13) cq(14) pq(15) cbwfq(16) tailDrop(17) wred(18)
19 20 21 22 23 24 25 26

When I put the bits in ascending order in the MIB, it outputs:

$ ./snmpt
test vars: CISCO-QOS-PIB-MIB::qosInterfaceTypeCapabilities = BITS: FF
FF FF E0 00 unspecified(0) inputL2Classification(1)
inputIpClassification(2) outputL2Classification(3)
outputIpClassification(4) inputUflowPolicing(5)
inputAggregatePolicing(6) outputUflowPolicing(7)
outputAggregatePolicing(8) policeByMarkingDown(9) policeByDropping(10)
fifo(11) wrr(12) wfq(13) cq(14) pq(15) cbwfq(16) tailDrop(17) wred(18)
inputPortClassification(19) outputPortClassification(20)
inputUflowShaping(21) inputAggregateShaping(22) outputUflowShaping(23)
outputAggregateShaping(24) pqWrr(25) pqCbwfq(26)

Which is correct and should be the output in both situations.

The correct way should be to start the loop in the snippet above at the
start of the
list.

Kind regards, Edgar Matzinger.



------------------------------

Message: 16
Date: Fri, 02 Nov 2012 16:12:54 +0100
From: Edgar <ed...@edgar-matzinger.nl>
Subject: Small bug in net-snmp-5.7.1/snmplib/mib.c
To: <Net-snm...@lists.sourceforge.net>
Message-ID: <12bd70c653054c6d...@www.edgar-matzinger.nl>
Content-Type: text/plain; charset=UTF-8; format=flowed

Hello list,

when playing around with bitstrings, I found a small bug in
net-snmp-5.7.1/snmplib/mib.c
in function sprint_realloc_bitstring:
---------8<----------
for (; enums; enums = enums->next) {
if (enums->value == (len * 8) + bit) {
enum_string = enums->label;
break;
}
}
---------8<----------

The snippet above assumes that all bits are enumerated in an ascending
order. But, Cisco
has a mib (CISCO-QOS-PIB-MIB) that enumerates
QosInterfaceTypeCapabilities in a random
order:

---------8<----------
QosInterfaceTypeCapabilities ::= TEXTUAL-CONVENTION
STATUS current
DESCRIPTION
"An enumeration of interface capabilities. Used by the PDP to
select policies and configuration to push to the PEP."
SYNTAX BITS {
unspecified (0),

-- Classification support
inputL2Classification (1), inputIpClassification (2),
outputL2Classification (3), outputIpClassification (4),
inputPortClassification (19), outputPortClassification (20),

-- Policing support
inputUflowPolicing (5), inputAggregatePolicing (6),
outputUflowPolicing (7), outputAggregatePolicing (8),
policeByMarkingDown (9), policeByDropping (10),
inputUflowShaping (21), inputAggregateShaping (22),
outputUflowShaping (23), outputAggregateShaping (24),

-- Supported scheduling mechanisms
fifo (11), wrr (12), wfq (13), cq (14), pq (15), cbwfq (16),
pqWrr (25), pqCbwfq (26),

-- Supported congestion control mechanisms
tailDrop (17), wred (18)
}
---------8<----------

When I run my little program that prints out all bits using
snmp_varlist_add_variable
and snprint_variable:

---------8<----------
/* val is a pointer to an u_char string */
snmp_varlist_add_variable (&vars, name, name_length,
ASN_BIT_STR, (u_char *)val, val_size);

snprint_variable (n, sizeof (n), name, name_length,
vars);
printf ("test vars: %s\n", n);

snmp_free_varbind(vars);
---------8<----------
It outputs:

$ ./snmpt
test vars: CISCO-QOS-PIB-MIB::qosInterfaceTypeCapabilities = BITS: FF
FF FF E0 00 unspecified(0) inputL2Classification(1)
inputIpClassification(2) outputL2Classification(3)
outputIpClassification(4) inputUflowPolicing(5)
inputAggregatePolicing(6) outputUflowPolicing(7)
outputAggregatePolicing(8) policeByMarkingDown(9) policeByDropping(10)
fifo(11) wrr(12) wfq(13) cq(14) pq(15) cbwfq(16) tailDrop(17) wred(18)
19 20 21 22 23 24 25 26

When I put these bits in ascending order in the MIB, it outputs the
following:
$ ./snmpt
test vars: CISCO-QOS-PIB-MIB::qosInterfaceTypeCapabilities = BITS: FF
FF FF E0 00 unspecified(0) inputL2Classification(1)
inputIpClassification(2) outputL2Classification(3)
outputIpClassification(4) inputUflowPolicing(5)
inputAggregatePolicing(6) outputUflowPolicing(7)
outputAggregatePolicing(8) policeByMarkingDown(9) policeByDropping(10)
fifo(11) wrr(12) wfq(13) cq(14) pq(15) cbwfq(16) tailDrop(17) wred(18)
inputPortClassification(19) outputPortClassification(20)
inputUflowShaping(21) inputAggregateShaping(22) outputUflowShaping(23)
outputAggregateShaping(24) pqWrr(25) pqCbwfq(26)

Which is correct and should be the output for both situations of
course...

T



------------------------------

Message: 17
Date: Fri, 2 Nov 2012 16:18:31 -0700 (PDT)
From: Chris Bartram <chrisr...@yahoo.com>
Subject: snmp only answering on localhost - but daemon is listening on
all ports (no iptables rules either)
To: "net-snm...@lists.sourceforge.net"
<net-snm...@lists.sourceforge.net>
Message-ID:
<1351898311.357...@web121303.mail.ne1.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"



snmpwalk against localhost works; same snmpwalk using hostname or IP address (from local shell) times out.
?
Have snmptrapd running on the same host and it accepts traps from all hosts on the network.

No iptables rules. Per below the daemon appears to be listening on all ports. Very barebones snmpd.conf (using secure/encrypted SNMP only so none of the non-secure access/group/etc directivesin there).

Am I missing something simple? Host is a VMWare virtual system if that matters - OS version and NET-SNMP version below.


-Chris Bartram

?
Linux hostname 2.6.18-308.8.2.el5 #1 SMP Tue May 29 11:54:17 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
?
NET-SNMP version:? 5.6.1
?

$ cat /etc/snmpd.conf
syslocation VM System
syscontact name here
pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat
rouser useridhere priv .1
??
$ netstat --listen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address?????????????? Foreign Address???????????? State
tcp??????? 0????? 0 *:snmp????????????????????? *:*???????????????????????? LISTEN
udp??????? 0????? 0 *:snmp????????????????????? *:*
?
?
$ lsof -i
COMMAND???? PID???? USER?? FD?? TYPE??? DEVICE SIZE/OFF NODE NAME
snmpd?????? 695???? root??? 9u? IPv4 809620519????? 0t0? TCP *:snmp (LISTEN)
snmpd?????? 695???? root?? 10u? IPv4 809620520?? ???0t0? TCP localhost:smux (LISTEN)
snmpd?????? 695???? root?? 11u? IPv4 809620521????? 0t0? UDP *:snmp
snmptrapd 19491???? root??? 7u? IPv4 649812993????? 0t0? UDP *:snmptrap
?
?
$ cat /etc/sysconfig/snmpd.options
# snmpd command line options
OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a -x 0.0.0.0:161"
?
$ps -ef | grep snmp
root?????? 695???? 1? 0 14:37 ???????? 00:00:02 /usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a -x 0.0.0.0:161
?


?
"The purpose of life is not to be happy. It is to be useful, to be honorable, to be compassionate, to have it make some difference that you have lived and lived well". (Ralph Waldo Emerson)
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 18
Date: Sat, 3 Nov 2012 09:06:19 +0000
From: Dave Shield <D.T.S...@liverpool.ac.uk>
Subject: Re: snmp only answering on localhost - but daemon is
listening on all ports (no iptables rules either)
To: Chris Bartram <chrisr...@yahoo.com>
Cc: "net-snm...@lists.sourceforge.net"
<net-snm...@lists.sourceforge.net>
Message-ID:
<CAKoMtGbrsa6J4KWT6ma=Uwr8gLSCJYQXitz...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On 2 November 2012 23:18, Chris Bartram <chrisr...@yahoo.com> wrote:
> $ cat /etc/sysconfig/snmpd.options
> # snmpd command line options
> OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a -x 0.0.0.0:161"

$ man snmpd

OPTIONS

-x ADDRESS
Listens for AgentX connections on the specified address ....


So although the agent is indeed listening on port 161, it is expecting
*AgentX* requests on that port, rather than SNMP packets.

Though that doesn't actually explain why SNMP queries are working
when sent to localhost - I'd expect them to be discarded as malformed
as well.

Dave



------------------------------

Message: 19
Date: Mon, 5 Nov 2012 10:33:22 +0100 (CET)
From: "antonio....@alice.it" <antonio....@alice.it>
Subject: Windows: snmpd and a subagent connect via AgentX, but do not
resolve GET, SET and SNMPWALK.
To: net-snm...@lists.sourceforge.net
Message-ID: <13acfeacb6c.an...@alice.it>
Content-Type: text/plain; charset="utf-8"

Hi Net-SNMP Users,I am asking for your help to devise a solution to a problem which has beenhaunting me for a couple of days.
I have been through a lot of posts in this forum, but there is no obvioussolution I can find. So I write for your assistance.
I have successfully compiled a Net-SNMP agent version 5.7.2 using Windows SDK 7.1,then porting a subagent which does work under several flavours of Linux. The targetplatform is Windows 7, 64 bits.
It happens that the subagent starts and connects via the AgentX protocol with the masteragent - I can see pings every 15 seconds and it says it is connected (the masteranswers) - but I am not able to cause a SNMP GET, SET or whatever to transferto the subagent. The answer is empty, like this: No such object available on thisagent at this OID.
Could it be a problem on the subagent management of loaded MIBs?

Thinking that somewhat could be wrong for the procedure I used to compile,I downloaded and installed a precompiled Net-SNMP version 5.5.0, 64 bits, from SourceForge.The result is the same, i.e. connection to master, but no result.
The command snmpget can obtain values such as sysUpTime.0, so I guess it isnot involving authentication (authNoPriv, SHA).
The agent is configured in snmpd.conf with:
master agentxagentxsocket tcp:localhost:705
whereas the subagent is launched with -x tcp:localhost:705. Both snmpd and thesubagent are launched in a Windows console and I can see their dialog; thefollowing is a snippet from "snmpd -Le -f -d", when I am trying to snmpgetsome variable:

<--- CUT --->
Received SNMP packet(s) from UDP: [127.0.0.1]:57479->[0.0.0.0] GET message -- SNMPv2-SMI::enterprises.33762.4.1.8.11.0
Sending 136 bytes to UDP: [127.0.0.1]:57479->[0.0.0.0]0000: 30 81 85 02 01 03 30 0F 02 02 6D 03 02 03 00 FF 0.....0...m....?0016: E3 04 01 01 02 01 03 04 37 30 35 04 11 80 00 1F ?.......705.....0032: 88 80 2A 69 00 00 81 F0 96 50 00 00 00 00 02 01 ..*i...?-P......0048: 02 02 02 01 06 04 09 61 64 6D 69 6E 5F 67 64 73 ...... admin_gds0064: 04 0C 77 30 54 1E D9 BE B6 10 66 03 62 E1 04 00 ..w0T.???.f.b?..0080: 30 36 04 11 80 00 1F 88 80 2A 69 00 00 81 F0 96 06.......*i...?-0096: 50 00 00 00 00 04 00 A2 1F 02 02 20 A7 02 01 00 P......?... ?...0112: 02 01 00 30 13 30 11 06 0D 2B 06 01 04 01 82 87 ...0.0...+....'?0128: 62 04 01 08 0B 00 80 00 b.......

Received 20 bytes from TCP: [127.0.0.1]:503440000: 01 0D 00 00 0A 00 00 00 00 00 00 00 7A 6D 00 00 ............zm..0016: 00 00 00 00 ....

Sending 28 bytes to TCP: [127.0.0.1]:503440000: 01 12 00 00 0A 00 00 00 00 00 00 00 7A 6D 00 00 ............zm..0016: 08 00 00 00 33 68 00 00 00 00 00 00 ....3h......

Received 20 bytes from TCP: [127.0.0.1]:503440000: 01 0D 00 00 0A 00 00 00 00 00 00 00 7F 6D 00 00 .............m..0016: 00 00 00 00 ....

Sending 28 bytes to TCP: [127.0.0.1]:503440000: 01 12 00 00 0A 00 00 00 00 00 00 00 7F 6D 00 00 .............m..0016: 08 00 00 00 10 6E 00 00 00 00 00 00 .....n......
<--- END OF CUT --->

What it follows is the same request from "snmpd -Le -f -D dump"

<--- CUT --->
dumph_recv: GETdumpv_recv: Command GETdumph_recv: request_iddumpx_recv: 02 02 39 48dumpv_recv: Integer: 14664 (0x3948)dumph_recv: error statusdumpx_recv: 02 01 00dumpv_recv: Integer: 0 (0x00)dumph_recv: error indexdumpx_recv: 02 01 00dumpv_recv: Integer: 0 (0x00)dumph_recv: VarBindListdumph_recv: VarBinddumph_recv: Namedumpx_recv: 06 0D 2B 06 01 04 01 82 87 62 04 01 08 0B 00dumpv_recv: ObjID: SNMPv2-SMI::enterprises.33762.4.1.8.11.0dumph_recv: Valuedumph_send: SNMPv3 Messagedumph_send: RESPONSEdumph_send: VarBinddumph_send: Valuedumpx_send: 80 00dumpv_send: NULLdumph_send: Namedumpx_send: 06 0D 2B 06 01 04 01 82 87 62 04 01 08 0B 00dumpv_send: ObjID: SNMPv2-SMI::enterprises.33762.4.1.8.11.0dumph_send: error indexdumpx_send: 02 01 00dumpv_!
send: Integer: 0 (0x00)dumph_send: error statusdumpx_send: 02 01 00dumpv_send: Integer: 0 (0x00)dumph_send: request_iddumpx_send: 02 02 39 48dumpv_send: Integer: 14664 (0x3948)dumph_send: ScopedPdudumph_send: contextNamedumpx_send: 04 00dumpv_send: String: [NULL]dumph_send: contextEngineIDdumpx_send: 04 11 80 00 1F 88 80 2A 69 00 00 81 F0 96 50 0000 00 00dumpv_send: String: .....*i...?-P....dumph_send: msgSecurityModeldumpx_send: 02 01 03dumpv_send: Integer: 3 (0x03)dumph_send: msgFlagsdumpx_send: 04 01 01dumpv_send: String: .dumph_send: msgMaxSizedumpx_send: 02 03 00 FF E3dumpv_send: Integer: 65507 (0xFFE3)dumph_send: msgIDdumpx_send: 02 02 31 A2dumpv_send: Integer: 12706 (0x31A2)dumph_send: SNMP Version Numberdumpx_send: 02 01 03dumpv_send: Integer: 3 (0x03)dumph_send: SM msgSecurityParamet!
ersdumph_send: msgPrivacyParametersdumpx_send: 04 00dumpv_sen
d: String: [NULL]dumph_send: msgAuthenticationParametersdumpx_send: 04 0C 00 00 00 00 00 00 00 00 00 00 00 00dumpv_send: String: ............dumph_send: msgUserNamedumpx_send: 04 09 61 64 6D 69 6E 5F 67 64 73dumpv_send: String: admin_gdsdumph_send: msgAuthoritativeEngineTimedumpx_send: 02 01 0Cdumpv_send: Integer: 12 (0x0C)dumph_send: msgAuthoritativeEngineBootsdumpx_send: 02 01 02dumpv_send: Integer: 2 (0x02)dumph_send: msgAuthoritativeEngineIDdumpx_send: 04 11 80 00 1F 88 80 2A 69 00 00 81 F0 96 50 0000 00 00dumpv_send: String: .....*i...?-P....

<--- END OF CUT --->


Well, picture me rookie, but I cannot understand why the GET command is not transferredto the subagent, obtaining a NULL response from snmpd. In fact, I fail to see a requestfrom snmpd directed to the subagent when the GET is issued.

Can you help me, if you see something obviously wrong with what I reported here?
Thank you in advance,Antonio
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 20
Date: Mon, 05 Nov 2012 10:46:10 +0100
From: Antonio Tringali <antonio....@alice.it>
Subject: REPOST: Windows: snmpd and a subagent connect via AgentX, but
do not resolve GET, SET and SNMPWALK
To: net-snm...@lists.sourceforge.net
Message-ID: <50978AE2...@alice.it>
Content-Type: text/plain; charset=UTF-8; format=flowed

I am sorry to repost, I was writing from a browser at it made a mess...


--

Hi Net-SNMP Users,
I am asking for your help to devise a solution to a problem which has
been haunting me for a couple of days.

I have been through a lot of posts in this forum, but there is no
obvious solution I can find. So I write for your assistance.

I have successfully compiled a Net-SNMP agent version 5.7.2 using
Windows SDK 7.1, then porting a subagent which does work under several
flavours of Linux. The target platform is Windows 7, 64 bits.

It happens that the subagent starts and connects via the AgentX
protocol with the master agent - I can see pings every 15 seconds and it
says it is connected (the master answers) - but I am not able to cause a
SNMP GET, SET or whatever to transfer to the subagent. The answer is
empty, like this: No such object available on this
agent at this OID.

Could it be a problem on the subagent management of loaded MIBs?


Thinking that somewhat could be wrong for the procedure I used to
compile, I downloaded and installed a precompiled Net-SNMP version
5.5.0, 64 bits, from SourceForge. The result is the same, i.e.
connection to master, but no result.

The command snmpget can obtain values such as sysUpTime.0, so I guess
it is not involving authentication (authNoPriv, SHA).

The agent is configured in snmpd.conf with:

master agentx
agentxsocket tcp:localhost:705

whereas the subagent is launched with -x tcp:localhost:705. Both snmpd
and the subagent are launched in a Windows console and I can see their
dialog; the following is a snippet from "snmpd -Le -f -d", when I am
trying to snmpget some variable:


<--- CUT --->

Received SNMP packet(s) from UDP: [127.0.0.1]:57479->[0.0.0.0]
GET message
-- SNMPv2-SMI::enterprises.33762.4.1.8.11.0

Sending 136 bytes to UDP: [127.0.0.1]:57479->[0.0.0.0]
0000: 30 81 85 02 01 03 30 0F 02 02 6D 03 02 03 00 FF
0.....0...m....??
0016: E3 04 01 01 02 01 03 04 37 30 35 04 11 80 00 1F
??.......705.....
0032: 88 80 2A 69 00 00 81 F0 96 50 00 00 00 00 02 01
..*i...??-P......
0048: 02 02 02 01 06 04 09 61 64 6D 69 6E 5F 67 64 73 ......
admin_gd
s
0064: 04 0C 77 30 54 1E D9 BE B6 10 66 03 62 E1 04 00
..w0T.??????.f.b??..
0080: 30 36 04 11 80 00 1F 88 80 2A 69 00 00 81 F0 96
06.......*i...??-
0096: 50 00 00 00 00 04 00 A2 1F 02 02 20 A7 02 01 00 P......??...
??...
0112: 02 01 00 30 13 30 11 06 0D 2B 06 01 04 01 82 87
...0.0...+....'???
0128: 62 04 01 08 0B 00 80 00 b.......


Received 20 bytes from TCP: [127.0.0.1]:50344
0000: 01 0D 00 00 0A 00 00 00 00 00 00 00 7A 6D 00 00 ............zm..
0016: 00 00 00 00 ....


Sending 28 bytes to TCP: [127.0.0.1]:50344
0000: 01 12 00 00 0A 00 00 00 00 00 00 00 7A 6D 00 00 ............zm..
0016: 08 00 00 00 33 68 00 00 00 00 00 00 ....3h......


Received 20 bytes from TCP: [127.0.0.1]:50344
0000: 01 0D 00 00 0A 00 00 00 00 00 00 00 7F 6D 00 00 .............m..
0016: 00 00 00 00 ....


Sending 28 bytes to TCP: [127.0.0.1]:50344
0000: 01 12 00 00 0A 00 00 00 00 00 00 00 7F 6D 00 00 .............m..
0016: 08 00 00 00 10 6E 00 00 00 00 00 00 .....n......

<--- END OF CUT --->


What it follows is the same request from "snmpd -Le -f -D dump"


<--- CUT --->

dumph_recv: GET
dumpv_recv: Command GET
dumph_recv: request_id
dumpx_recv: 02 02 39 48
dumpv_recv: Integer: 14664 (0x3948)
dumph_recv: error status
dumpx_recv: 02 01 00
dumpv_recv: Integer: 0 (0x00)
dumph_recv: error index
dumpx_recv: 02 01 00
dumpv_recv: Integer: 0 (0x00)
dumph_recv: VarBindList
dumph_recv: VarBind
dumph_recv: Name
dumpx_recv: 06 0D 2B 06 01 04 01 82 87 62 04 01 08 0B 00
dumpv_recv: ObjID: SNMPv2-SMI::enterprises.33762.4.1.8.11.0
dumph_recv: Value
dumph_send: SNMPv3 Message
dumph_send: RESPONSE
dumph_send: VarBind
dumph_send: Value
dumpx_send: 80 00
dumpv_send: NULL
dumph_send: Name
dumpx_send: 06 0D 2B 06 01 04 01 82 87 62 04 01 08 0B 00
dumpv_send: ObjID: SNMPv2-SMI::enterprises.33762.4.1.8.11.0
dumph_send: error index
dumpx_send: 02 01 00
dumpv_send: Integer: 0 (0x00)
dumph_send: error status
dumpx_send: 02 01 00
dumpv_send: Integer: 0 (0x00)
dumph_send: request_id
dumpx_send: 02 02 39 48
dumpv_send: Integer: 14664 (0x3948)
dumph_send: ScopedPdu
dumph_send: contextName
dumpx_send: 04 00
dumpv_send: String: [NULL]
dumph_send: contextEngineID
dumpx_send: 04 11 80 00 1F 88 80 2A 69 00 00 81 F0 96 50 00
00 00 00
dumpv_send: String: .....*i...??-P....
dumph_send: msgSecurityModel
dumpx_send: 02 01 03
dumpv_send: Integer: 3 (0x03)
dumph_send: msgFlags
dumpx_send: 04 01 01
dumpv_send: String: .
dumph_send: msgMaxSize
dumpx_send: 02 03 00 FF E3
dumpv_send: Integer: 65507 (0xFFE3)
dumph_send: msgID
dumpx_send: 02 02 31 A2
dumpv_send: Integer: 12706 (0x31A2)
dumph_send: SNMP Version Number
dumpx_send: 02 01 03
dumpv_send: Integer: 3 (0x03)
dumph_send: SM msgSecurityParameters
dumph_send: msgPrivacyParameters
dumpx_send: 04 00
dumpv_send: String: [NULL]
dumph_send: msgAuthenticationParameters
dumpx_send: 04 0C 00 00 00 00 00 00 00 00 00 00 00 00
dumpv_send: String: ............
dumph_send: msgUserName
dumpx_send: 04 09 61 64 6D 69 6E 5F 67 64 73
dumpv_send: String: admin_gds
dumph_send: msgAuthoritativeEngineTime
dumpx_send: 02 01 0C
dumpv_send: Integer: 12 (0x0C)
dumph_send: msgAuthoritativeEngineBoots
dumpx_send: 02 01 02
dumpv_send: Integer: 2 (0x02)
dumph_send: msgAuthoritativeEngineID
dumpx_send: 04 11 80 00 1F 88 80 2A 69 00 00 81 F0 96 50 00
00 00 00
dumpv_send: String: .....*i...??-P....


<--- END OF CUT --->



Well, picture me rookie, but I cannot understand why the GET command
is not transferred to the subagent, obtaining a NULL response from
snmpd. In fact, I fail to see a request from snmpd directed to the
subagent when the GET is issued.


Can you help me, if you see something obviously wrong with what I
reported here?

Thank you in advance,
Antonio




------------------------------

Message: 21
Date: Mon, 5 Nov 2012 18:29:08 +0530
From: "Jatin Bodarya" <jatin....@elitecore.com>
Subject: executing snmpd::FATAL: kernel too old
To: <net-snm...@lists.sourceforge.net>
Message-ID: <000001cdbb55$58400fa0$08c02ee0$@bod...@elitecore.com>
Content-Type: text/plain; charset="us-ascii"

Hello all... can anyone help me to resolve kernel dependency ? I have done
net-snmp packaging on linux-3.0.2-generic and trying to make it work on
below version.



uname -a

Linux manage 2.6.18.8-1 #3 Wed May 28 14:06:14 UTC 2008 i686 unknown



Snmp version : 5.7.2.rc1



/usr/sbin/chroot /var/snmp3/ /usr/local/sbin/snmpd -f -Le

FATAL: kernel too old



How can I resolve this issue ? Should I make changes in snmpd.c and
recompile it ? if yes than how to do this ? If not than what is the
solution of it ?



Thanks in advance.

-Jatin

-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 22
Date: Mon, 05 Nov 2012 14:11:56 +0100 (CET)
From: Sverre Moe <sve...@spacetec.no>
Subject: Unexpected behaviour
To: net-snm...@lists.sourceforge.net
Message-ID: <f736f9db-964c-4ac3-9a31-3e3598082651@zcs>
Content-Type: text/plain; charset=ISO-8859-1

I have implemented a delegated response with a 2 seconds delay time.

My handler function handle_snmp and callback function delayed_response gets called/executed several times for the same requests. Why is that? Is it a feature or a bug? If its a feature is it how it handles the delay by executing it multiple times within the delay time?

In order to avoid querying the device multiple times per request I have implemented a list of active requests. This list holds a pointer to a netsnmp_delegated_cache. When I have gotten the response/value from the device I then remove the request from the active request list. However when this value is retrieved handle_snmp and delayed_response are not yet finished and may be executed a few times more before it ends. Thus it may query the device again.

Can I terminate the delay earlier than the defined delay if I have gotten the value I need?

int
handle_snmp(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests) {

const oid* request_oid = (*reginfo).rootoid;
const size_t request_oid_length = (*reginfo).rootoid_len - 1; //removes the trailing .0

bool request_active = false;
list<netsnmp_delegated_cache*>::iterator request_iterator;
for (request_iterator = active_requests.begin();
request_iterator != active_requests.end();
request_iterator++) {
netsnmp_delegated_cache *delegated_cache = (*request_iterator);
netsnmp_handler_registration *delegated_reginfo = delegated_cache->reginfo;
const oid* oid_value = (*delegated_reginfo).rootoid;
const size_t oid_length = (*delegated_reginfo).rootoid_len - 1; //removes the trailing .0
if (netsnmp_oid_equals(oid_value, oid_length, request_oid, request_oid_length) == 0) {
request_active = true;
break;
}
}

netsnmp_delegated_cache *cache =
netsnmp_create_delegated_cache(handler, reginfo, reqinfo, requests, NULL);

map<oid_wrapper, scalar>::iterator scalar_iterator;
for (scalar_iterator = scalars.begin();
scalar_iterator != scalars.end();
scalar_iterator++) {
const oid_wrapper oid_wrapper = (*scalar_iterator).first;
const oid* oid_value = oid_wrapper.get_oid();
const int oid_length = oid_wrapper.get_length();
if (netsnmp_oid_equals(oid_value, oid_length, request_oid, request_oid_length) == 0) {
if (!request_active) { //request is active, no need to query middleware again.
active_requests.push_back(cache);

scalar _scalar = (*scalar_iterator).second;
const string scalar_path = _scalar.getPath();
const string scalar_type = _scalar.getType();
//My own call to retrieve value from device...
}
break;
}
}

/*
* mark this variable as something that can't be handled now.
* We'll answer it later.
*/
requests->delegated = 1;

snmp_alarm_register(delay_time, /* delay */
0, /* repeat */
delayed_response, /* the function to call */
(void *) cache);

return SNMP_ERR_NOERROR;
}

void
delayed_response(unsigned int clientreg, void *clientarg) {
/*
* extract the cache from the passed argument
*/
netsnmp_delegated_cache *cache = (netsnmp_delegated_cache *) clientarg;

netsnmp_request_info *requests;
netsnmp_agent_request_info *reqinfo;
netsnmp_handler_registration *reginfo;

/*
* here we double check that the cache we created earlier is still
* valid. If not, the request timed out for some reason and we
* don't need to keep processing things. Should never happen, but
* this double checks.
*/
cache = netsnmp_handler_check_cache(cache);

if (!cache) {
snmp_log(LOG_ERR, "illegal call to return delayed response\n");
return;
}

//re-establish the previous pointers we are used to having
reqinfo = cache->reqinfo;
reginfo = cache->reginfo;
requests = cache->requests;
const oid* request_oid = (*reginfo).rootoid;
const size_t request_oid_length = (*reginfo).rootoid_len;

void* datapointer;
char buffer[2048];
int dataint;
int length = 0;
u_char type;

bool found = false;
map<oid_wrapper, status>::iterator status_iterator;
for (status_iterator = available_status.begin();
status_iterator != available_status.end();
status_iterator++) {
const oid_wrapper oid_wrapper = (*status_iterator).first;
const oid* oid_value = oid_wrapper.get_oid();
const int oid_length = oid_wrapper.get_length();
if (netsnmp_oid_equals(oid_value, oid_length, request_oid, request_oid_length) == 0) {
const status _status = (*status_iterator).second;
const string value = _status.getValue();
found = true;

strcpy(buffer, value.c_str());
datapointer = buffer;
length = strlen(buffer);
type = ASN_OCTET_STR;

//Value retrieved. We now remove it.
available_status.erase(status_iterator);
break;
}
}

/*
* mention that it's no longer delegated,
* and we've now answered the query.
*/
requests->delegated = 0;

if (found) {
list<netsnmp_delegated_cache*>::iterator request_iterator;
for (request_iterator = active_requests.begin();
request_iterator != active_requests.end();
request_iterator++) {
netsnmp_delegated_cache *delegated_cache = (*request_iterator);
netsnmp_handler_registration *delegated_reginfo = delegated_cache->reginfo;
const oid* oid_value = (*delegated_reginfo).rootoid;
const size_t oid_length = (*delegated_reginfo).rootoid_len;
if (netsnmp_oid_equals(oid_value, oid_length, request_oid, request_oid_length) == 0) {
active_requests.erase(request_iterator);
break;
}
}

snmp_set_var_typed_value(cache->requests->requestvb,
type,
datapointer,
length);
} else {
netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_GENERR);
}

//free the information cache
netsnmp_free_delegated_cache(cache);
}

CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be
proprietary, confidential or subject to export regulations, and is only meant
for the intended recipient(s). Any disclosure, copying, distribution or use is
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in
error, please delete it immediately from your system and notify the sender
properly.




------------------------------

Message: 23
Date: Mon, 5 Nov 2012 19:12:44 +0530
From: "Jatin Bodarya" <jatin....@elitecore.com>
Subject: executing snmpd::FATAL: kernel too old
To: <net-snm...@lists.sourceforge.net>
Message-ID: <000001cdbb5b$6f4ba960$4de2fc20$@bod...@elitecore.com>
Content-Type: text/plain; charset="us-ascii"

Hello all... can anyone help me to resolve kernel dependency ? I have done
net-snmp packaging on linux-3.0.2-generic and trying to make it work on
below version.



uname -a

Linux manage 2.6.18.8-1 #3 Wed May 28 14:06:14 UTC 2008 i686 unknown



Snmp version : 5.7.2.rc1



/usr/sbin/chroot /var/snmp3/ /usr/local/sbin/snmpd -f -Le

FATAL: kernel too old



file /usr/local/sbin/snmpd

/usr/local/sbin/snmpd: ELF 32-bit LSB executable, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24,
BuildID[sha1]=0xacef27c048394ffb2cdef4999566e9aa32e5d2dd, not stripped





How can I resolve this issue(" I CAN NOT CHANGE THE KERNEL VERSION") ?
Should I make changes in snmpd.c and recompile it ? if yes than how to do
this ? If not than what is the solution of it ?



Thanks in advance.

-Jatin



-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 24
Date: Tue, 6 Nov 2012 10:38:25 +0530
From: "Jatin Bodarya" <jatin....@elitecore.com>
Subject: snmpd is not working with old kernel
To: <net-snm...@lists.sourceforge.net>
Message-ID: <000001cdbbdc$c0b5edc0$4221c940$@bod...@elitecore.com>
Content-Type: text/plain; charset="us-ascii"

Hello all,



Can anyone help me to recompile "snmpd.c" with proper changes and adding
proper libs with it ...

I want to use it with old kernel...



file /usr/local/sbin/snmpd



/usr/local/sbin/snmpd: ELF 32-bit LSB executable, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24,
BuildID[sha1]=0xacef27c048394ffb2cdef4999566e9aa32e5d2dd, not stripped





uname -a

Linux manage 2.6.18.8-1 #3 Wed May 28 14:06:14 UTC 2008 i686 unknown



-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 25
Date: Tue, 6 Nov 2012 15:13:49 +0100
From: Patrick Rogier <patrick...@sioux.eu>
Subject: snmpusm: how to clone SNMPv3 users with different engineID
To: net-snm...@lists.sourceforge.net
Message-ID:
<CAM7RQr175b2ntmQjA7m0voeG...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

is it possible to use the snmpusm tool to clone a user with a different
engineID than the template user ? And if yes, can you please give an
example on how to do that, or give a reference to a webpage or document
which explains how to do that ?


Background:

This feature is useful for sending SNMPv3 INFORMs. With SNMPv3 INFORMs, the
authoritative engine is the engine that receives the INFORMs. So if an
SNMP agent sends an SNMPv3 INFORM, it should use the engineID of the SNMP
manager.

- Assume that:
- the engineID of the manager is managerEngineID
- the engineID of the agent is agentEngineID
- the usmUserTable of the agent contains the SNMPv3 user templateUser
- the templateUser uses agentEngineID as engineID (this is the normal
situation). So the index of the templateUser in the usmUserTable is
'agentEngineID.templateUser'.
- Manager clones user 'agentEngineID.templateUser' to user
'managerEngineID.informUser'. My question relates to this step. I don't
know how I can do this with the snmpusm tool.
- Agent wants to send SNMPv3 INFORM to manager with the user informUser.
It probes the manager for its engineID. The manager returns
managerEngineID.
The agent searches in its usmTable for the user
'managerEngineID.informUser'.
Because of the clone in the previous step, it finds this user. The agent
gets the priv/auth keys for this user and can send the SNMPv3 INFORM.


In the net-snmp users mail archive I found an entry from 2006-2008
which says that the snmpusm tool can't be used to clone users with a
different engineID:

snmpusm new feature - ID: 1591355:
http://sourceforge.net/tracker/index.php?func=detail&aid=1591355&group_id=12694&atid=312694

It proposes a patch. According to the 'changes' section, it was closed on
2008-08-18, but the 'comments' section has an entry on the same date
saying: "The patch has been taken out of the trunk again since it did end
up causing problems." The current status of the entry is "Open".


The snmpusm tool has the option '-CE ENGINE-ID'. But this option doesn't
seem to solve my problem. If I try to clone the user
'agentEngineID.templateUser' to 'managerEngineID.informUser' with the
command (I use symbolic names for the engineIDs in the next command to ease
reading; in reality I pass real numbers):

snmpusm -v3 -u templateUser -l authPriv -a MD5 -A setup_passphrase -x DES \
-X setup_passphrase -CE managerEngineID localhost create informUser
templateUser

it tries to find the user 'managerEngineID.templateUser'. This is not the
desired behavior.

If it's not possible to clone users with a different engineID dynamically,
then the agent must have preconfigured users for SNMPv3 INFORMs. E.g in its
/var/net-snmp/snmpd.conf it should have an entry (again with a symbolic
name for the engineID to ease reading):

createUser -e managerEngineID informUser MD5 inform_passphrase DES

But then only managers with this engineID can receive SNMPv3 INFORMs from
the agent.

I'm using version 5.7.1.

regards,

Patrick Rogier
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 26
Date: Tue, 6 Nov 2012 16:29:58 -0500
From: dos...@gmail.com
Subject: Fwd: Selecting an outgoing interface
To: "net-snm...@lists.sourceforge.net"
<net-snm...@lists.sourceforge.net>
Message-ID: <1E0E60DE-6A3A-4BD0...@gmail.com>
Content-Type: text/plain; charset="us-ascii"

I sent this out earlier, but I heard no response so I figured I'd try again.

I am looking for a way to set the source address with snmp commands, see below for details.

Thanks
--Perry

Begin forwarded message:

> From: dosman <dos...@gmail.com>
> Date: October 28, 2012 5:08:47 PM EDT
> To: net-snm...@lists.sourceforge.net
> Subject: Selecting an outgoing interface
>
> Hello,
>
> Using the Net-SNMP tools, is it possible to select which interface (or source IP) is used when using snmpget, snmpset, etc? There doesn't seem to be any option in the manpage of the commands or snmpcmd(1).
>
> I am looking to something analogous to "-I" in ping on linux. Either something where I can specify a interface name, or at least a source IP address so the message gets internally routed out the right interface.
>
> I am using Net-SNMP version 5.4.3 on Ubuntu 11.10 and 5.6 on MacOS 10.7. So if this was added in a later version, let me know.
>
> Thank You.
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 27
Date: Wed, 7 Nov 2012 12:06:43 -0800 (PST)
From: Reza Salehi <rezs...@yahoo.com>
Subject: problem with master/agentx on Openwrt - Net-snmp version
5.4.2.1
To: SNMP FORUM <net-snm...@lists.sourceforge.net>
Cc: "rezs...@yahoo.com" <rezs...@yahoo.com>
Message-ID:
<1352318803.924...@web162701.mail.bf1.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"

HI all,

I am trying to compile and use NET_SNMP as Master/Sub agent ?in OpenWrt?environment.
I can compile snmpd package and its version is 5.4.2.1.
For some reason snmpd doesn't have agentx support. ?( It doesn't have -x -X switch when I try snmpd --help on target machine).

I tried ?./configure ?--with-mib-modules="agentx" ? ? ? ? and ? ?rebuild it but it didn't help.

I can see by running above command ?some lines get created in ?include/net-snmp/agent/agent_module_config.c ? like ? #define USING_AGENTX_SUBAGENT_MODULE 1 ?but snmpd still doesn't support -x?switch?and it prints ?Unknown token: master ? in /etc/snmp/snmpd.conf.


?I ?added ? -DUSING_AGENTX_SUBAGENT_MODULE ? ?in agent/Makefile and rebuild snmpd ?.Now I can see -x and -X ? on snmpd --help but still snmpd ? prints error ? Unknown token : master. Also there is no TCP port open on port 705.?

so I am wonder how I can get it to work ?in Master/sub agent mode.



I truly appreciate if anyone can help me with this problem.

Thanks,
Reza
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 28
Date: Wed, 07 Nov 2012 15:58:18 -0500
From: Brandon Phelps <bph...@gls.com>
Subject: Determine Request PDU Size
To: net-snm...@lists.sourceforge.net
Message-ID: <509ACB6A...@gls.com>
Content-Type: text/plain; charset=ISO-8859-1

Hello,

I am using the net-snmp C API and would like to determine the size of my request and response PDUs so that I can keep track of how much data my
application sends and receives. Could someone shed some light on how I might accomplish this? I'd like to get the numbers that are equivalent to the
total packet sizes I see in Wireshark, etc.

I've tried using the sizeof(*pdu), but this always seems to result in the same number (272).

Any help would be appreciated!

Thanks,
Brandon



------------------------------

Message: 29
Date: Wed, 7 Nov 2012 21:11:54 -0800 (PST)
From: John Q <john...@yahoo.com>
Subject: statically compiled snmpd start error
To: "net-snm...@lists.sourceforge.net"
<net-snm...@lists.sourceforge.net>
Message-ID:
<1352351514.313...@web122103.mail.ne1.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"

I have compiled net-snmp 5.6.2 libraries using configure --with-ldflags=-Bstatic for totally static executables. When I start snmpd I get the following error -
?error while loading shared libraries: libnetsnmpagent.so.25: cannot open shared object file: No such file or directory

Appreciate your help in resolving this.


Best Regards
John
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 30
Date: Wed, 7 Nov 2012 22:53:18 -0800 (PST)
From: John Q <john...@yahoo.com>
Subject: Re: statically compiled snmpd start error
To: Jatin Bodarya <jatin....@elitecore.com>
Cc: "net-snm...@lists.sourceforge.net"
<net-snm...@lists.sourceforge.net>
Message-ID:
<1352357598.694...@web122105.mail.ne1.yahoo.com>
Content-Type: text/plain; charset="utf-8"

You are missing the point. Can I statically compile snmpd (compile all libraries in a single executable)? If so, how

John



________________________________
From: Jatin Bodarya <jatin....@elitecore.com>
To: 'John Q' <john...@yahoo.com>
Sent: Thursday, 8 November 2012, 15:28
Subject: RE: statically compiled snmpd start error



Check ???the location of snmpd?? whth
?whereis snmpd?
?
Than fire this command
?
? ldd?? /*location*/snmpd
?
It will shows all dependency.
?
Than ?try
?locate libnetsnmpagent.so.25?and
all the missing files... and put them into desired location..
?
Mainly in /usr/lib?? or /usr/local/lib according top your snmp
version
From:John Q [mailto:john...@yahoo.com]
Sent: 08 November 2012 10:42
To: net-snm...@lists.sourceforge.net
Subject: statically compiled snmpd start error
?
I have
compiled net-snmp 5.6.2 libraries using configure --with-ldflags=-Bstatic for
totally static executables. When I start snmpd I get the following error -
?error while loading shared libraries: libnetsnmpagent.so.25: cannot open
shared object file: No such file or directory

Appreciate your help in resolving this.

Best Regards
John
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 31
Date: Thu, 8 Nov 2012 11:48:03 +0000
From: Venkatramanan Srinivasan <Venkatramana...@semafone.com>
Subject: 'proxy' directive takes v3 user password in clear.
To: "net-snm...@lists.sourceforge.net"
<net-snm...@lists.sourceforge.net>
Message-ID:
<93AC0186A70A454CBF3...@EX01.semafone.local>
Content-Type: text/plain; charset="us-ascii"

Hello,

We are planning to use net-snmp to monitor our applications running on Ubuntu servers.
We use NET-SNMP version: 5.4.2.1 (the version that gets installed by apt-get install snmpd)

We are under obligation to secure access to our servers (we are audited regularly) so v3 is our only option.
Our application is deployed in multiple Ubuntu servers and they are pretty much locked down. Access to these servers are controlled by an edge device, another Ubuntu server. The desire here is to prevent through traffic from the outside world in to our secure zone as much as possible (other than the ones we expect to serve obviously).

The intention is to SNMP monitor all these servers in the secure zone via this edge device.

The 'proxy' directive in /etc/snmp/snmpd.conf seemed will help and it did. I followed the documentation at http://net-snmp.sourceforge.net/wiki/index.php/Snmpd_proxy.
Basically I configured our edge device mentioned above to act as a SNMP proxy. I configured Cacti to query this edge device using different contexts to reach out to each of our servers in the secured zone.
Thanks very much for that.

The 'proxy' directive takes the v3 user password in clear, for example,
proxy -Cn ctx_remotehost2 -v 3 -u MD5DESUser -a MD5 -A "PasswordA" -x DES -X "PasswordX" -l authPriv remotehost2 .1.3

This poses a problem because we are not supposed to have passwords in clear in config files, logs etc.

I would like to ask if there is a way to use encrypted passwords in the 'proxy' directive or load from a file that is encrypted
Your help is very much appreciated,

Thanks in advance
Venkat
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov

------------------------------

_______________________________________________
Net-snmp-users mailing list
Net-snm...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


End of Net-snmp-users Digest, Vol 78, Issue 1
*********************************************

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Net-snmp-users mailing list
Net-snm...@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Zheng, Wenjie (Barclay)

unread,
Nov 8, 2012, 7:49:14 PM11/8/12
to

Dear All,

Do you know what's the max_msg_size in net-snmp?
>From the code:
net-snmp/library/snmp_api.h:340:#defineSNMP_MAX_MSG_SIZE .SNMP_MAX_MSG_SIZE=1497.

But from my test, I found it can be larger in SNMP response message, by increase the max-repetition, the SNMP message got increased as more OIDs in one message, message could be around 2900, then it will not work bigger then that.

What is the bottle neck of the message size? How can we increase this?

Thanks,
Barclay

0 new messages