[AGENT++] Re: snmp++ crash issue

N Sarath chandra babu nscbabu at gmail.com
Tue Oct 31 07:20:49 CET 2006


Jochen,
I took a trace of the snmp communication between the device, here with I am
pasting the trace from my sample program, I have sent before:
No.     Time        Source                Destination           Protocol
Info
      1 0.000000    15.76.126.13          16.150.10.114         SNMP     GET

Frame 1 (111 bytes on wire, 111 bytes captured)
    Arrival Time: Oct 31, 2006 10:45:05.325075000
    Time delta from previous packet: 0.000000000 seconds
    Time since reference or first frame: 0.000000000 seconds
    Frame Number: 1
    Packet Length: 111 bytes
    Capture Length: 111 bytes
    Protocols in frame: eth:ip:udp:snmp
Ethernet II, Src: CompaqHp_bf:ae:69 (00:0b:cd:bf:ae:69), Dst:
FoundryN_8f:3f:00 (00:e0:52:8f:3f:00)
    Destination: FoundryN_8f:3f:00 (00:e0:52:8f:3f:00)
    Source: CompaqHp_bf:ae:69 (00:0b:cd:bf:ae:69)
    Type: IP (0x0800)
Internet Protocol, Src: 15.76.126.13 (15.76.126.13), Dst: 16.150.10.114 (
16.150.10.114)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..0. = ECN-Capable Transport (ECT): 0
        .... ...0 = ECN-CE: 0
    Total Length: 97
    Identification: 0x1615 (5653)
    Flags: 0x00
        0... = Reserved bit: Not set
        .0.. = Don't fragment: Not set
        ..0. = More fragments: Not set
    Fragment offset: 0
    Time to live: 128
    Protocol: UDP (0x11)
    Header checksum: 0x7c16 [correct]
        Good: True
        Bad : False
    Source: 15.76.126.13 (15.76.126.13)
    Destination: 16.150.10.114 (16.150.10.114)
User Datagram Protocol, Src Port: 1334 (1334), Dst Port: snmp (161)
    Source port: 1334 (1334)
    Destination port: snmp (161)
    Length: 77
    Checksum: 0x49c3 [correct]
Simple Network Management Protocol
    Version: 3 (3)
    Message Global Header
        Message Global Header Length: 15
        Message ID: 1835008
        Message Max Size: 4096
        Flags: 0x04
            .... .1.. = Reportable: Set
            .... ..0. = Encrypted: Not set
            .... ...0 = Authenticated: Not set
        Message Security Model: USM
    Message Security Parameters
        Message Security Parameters Length: 16
        Authoritative Engine ID:
        Engine Boots: 0
        Engine Time: 0
        User Name:
        Authentication Parameter:
        Privacy Parameter:
    Context Engine ID:
    Context Name: Jetdirect
    PDU type: GET (0)
    Request Id: 0x00000412
    Error Status: NO ERROR (0)
    Error Index: 0

No.     Time        Source                Destination           Protocol
Info
      2 0.002298    16.150.10.114         15.76.126.13          SNMP
REPORT SNMPv2-SMI::snmpModules.15.1.1.4.0

Frame 2 (144 bytes on wire, 144 bytes captured)
    Arrival Time: Oct 31, 2006 10:45:05.327373000
    Time delta from previous packet: 0.002298000 seconds
    Time since reference or first frame: 0.002298000 seconds
    Frame Number: 2
    Packet Length: 144 bytes
    Capture Length: 144 bytes
    Protocols in frame: eth:ip:udp:snmp
Ethernet II, Src: FoundryN_8f:3f:00 (00:e0:52:8f:3f:00), Dst:
CompaqHp_bf:ae:69 (00:0b:cd:bf:ae:69)
    Destination: CompaqHp_bf:ae:69 (00:0b:cd:bf:ae:69)
    Source: FoundryN_8f:3f:00 (00:e0:52:8f:3f:00)
    Type: IP (0x0800)
Internet Protocol, Src: 16.150.10.114 (16.150.10.114), Dst: 15.76.126.13 (
15.76.126.13)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..0. = ECN-Capable Transport (ECT): 0
        .... ...0 = ECN-CE: 0
    Total Length: 130
    Identification: 0x033e (830)
    Flags: 0x00
        0... = Reserved bit: Not set
        .0.. = Don't fragment: Not set
        ..0. = More fragments: Not set
    Fragment offset: 0
    Time to live: 63
    Protocol: UDP (0x11)
    Header checksum: 0xcfcc [correct]
        Good: True
        Bad : False
    Source: 16.150.10.114 (16.150.10.114)
    Destination: 15.76.126.13 (15.76.126.13)
User Datagram Protocol, Src Port: snmp (161), Dst Port: 1334 (1334)
    Source port: snmp (161)
    Destination port: 1334 (1334)
    Length: 110
    Checksum: 0x0494 [correct]
Simple Network Management Protocol
    Version: 3 (3)
    Message Global Header
        Message Global Header Length: 15
        Message ID: 1835008
        Message Max Size: 8192
        Flags: 0x00
            .... .0.. = Reportable: Not set
            .... ..0. = Encrypted: Not set
            .... ...0 = Authenticated: Not set
        Message Security Model: USM
    Message Security Parameters
        Message Security Parameters Length: 29
        Authoritative Engine ID: 0000000B00110AF3B5950001
            0... .... = Engine ID Conformance: RFC1910 (Non-SNMPv3)
            Engine Enterprise ID: Hewlett Packard (11)
            AgentID Trailer: 0x00110AF3B5950001
        Engine Boots: 2
        Engine Time: 1409
        User Name:
        Authentication Parameter:
        Privacy Parameter:
    Context Engine ID: 0000000B00110AF3B5950001
        0... .... = Engine ID Conformance: RFC1910 (Non-SNMPv3)
        Engine Enterprise ID: Hewlett Packard (11)
        AgentID Trailer: 0x00110AF3B5950001
    Context Name:
    PDU type: REPORT (8)
    Request Id: 0x00000412
    Error Status: NO ERROR (0)
    Error Index: 0
    Object identifier 1: 1.3.6.1.6.3.15.1.1.4.0 (SNMPv2-SMI::
snmpModules.15.1.1.4.0)
    Value: Counter32: 7

No.     Time        Source                Destination           Protocol
Info
      3 0.189040    15.76.126.13          16.150.10.114         SNMP
Encrypted PDU

Frame 3 (178 bytes on wire, 178 bytes captured)
    Arrival Time: Oct 31, 2006 10:45:05.514115000
    Time delta from previous packet: 0.186742000 seconds
    Time since reference or first frame: 0.189040000 seconds
    Frame Number: 3
    Packet Length: 178 bytes
    Capture Length: 178 bytes
    Protocols in frame: eth:ip:udp:snmp
Ethernet II, Src: CompaqHp_bf:ae:69 (00:0b:cd:bf:ae:69), Dst:
FoundryN_8f:3f:00 (00:e0:52:8f:3f:00)
    Destination: FoundryN_8f:3f:00 (00:e0:52:8f:3f:00)
    Source: CompaqHp_bf:ae:69 (00:0b:cd:bf:ae:69)
    Type: IP (0x0800)
Internet Protocol, Src: 15.76.126.13 (15.76.126.13), Dst: 16.150.10.114 (
16.150.10.114)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..0. = ECN-Capable Transport (ECT): 0
        .... ...0 = ECN-CE: 0
    Total Length: 164
    Identification: 0x1616 (5654)
    Flags: 0x00
        0... = Reserved bit: Not set
        .0.. = Don't fragment: Not set
        ..0. = More fragments: Not set
    Fragment offset: 0
    Time to live: 128
    Protocol: UDP (0x11)
    Header checksum: 0x7bd2 [correct]
        Good: True
        Bad : False
    Source: 15.76.126.13 (15.76.126.13)
    Destination: 16.150.10.114 (16.150.10.114)
User Datagram Protocol, Src Port: 1334 (1334), Dst Port: snmp (161)
    Source port: 1334 (1334)
    Destination port: snmp (161)
    Length: 144
    Checksum: 0x8f06 [correct]
Simple Network Management Protocol
    Version: 3 (3)
    Message Global Header
        Message Global Header Length: 15
        Message ID: 1835009
        Message Max Size: 4096
        Flags: 0x07
            .... .1.. = Reportable: Set
            .... ..1. = Encrypted: Set
            .... ...1 = Authenticated: Set
        Message Security Model: USM
    Message Security Parameters
        Message Security Parameters Length: 53
        Authoritative Engine ID: 0000000B00110AF3B5950001
            0... .... = Engine ID Conformance: RFC1910 (Non-SNMPv3)
            Engine Enterprise ID: Hewlett Packard (11)
            AgentID Trailer: 0x00110AF3B5950001
        Engine Boots: 0
        Engine Time: 0
        User Name: babun
        Authentication Parameter: FD346B689BDCB32BEFEC6C84
        Privacy Parameter: 0000000000009047
    Encrypted PDU (58 bytes)

No.     Time        Source                Destination           Protocol
Info
      4 0.191749    16.150.10.114         15.76.126.13          SNMP
REPORT SNMPv2-SMI::snmpModules.15.1.1.5.0

Frame 4 (148 bytes on wire, 148 bytes captured)
    Arrival Time: Oct 31, 2006 10:45:05.516824000
    Time delta from previous packet: 0.002709000 seconds
    Time since reference or first frame: 0.191749000 seconds
    Frame Number: 4
    Packet Length: 148 bytes
    Capture Length: 148 bytes
    Protocols in frame: eth:ip:udp:snmp
Ethernet II, Src: FoundryN_8f:3f:00 (00:e0:52:8f:3f:00), Dst:
CompaqHp_bf:ae:69 (00:0b:cd:bf:ae:69)
    Destination: CompaqHp_bf:ae:69 (00:0b:cd:bf:ae:69)
    Source: FoundryN_8f:3f:00 (00:e0:52:8f:3f:00)
    Type: IP (0x0800)
Internet Protocol, Src: 16.150.10.114 (16.150.10.114), Dst: 15.76.126.13 (
15.76.126.13)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..0. = ECN-Capable Transport (ECT): 0
        .... ...0 = ECN-CE: 0
    Total Length: 134
    Identification: 0x0340 (832)
    Flags: 0x00
        0... = Reserved bit: Not set
        .0.. = Don't fragment: Not set
        ..0. = More fragments: Not set
    Fragment offset: 0
    Time to live: 63
    Protocol: UDP (0x11)
    Header checksum: 0xcfc6 [correct]
        Good: True
        Bad : False
    Source: 16.150.10.114 (16.150.10.114)
    Destination: 15.76.126.13 (15.76.126.13)
User Datagram Protocol, Src Port: snmp (161), Dst Port: 1334 (1334)
    Source port: snmp (161)
    Destination port: 1334 (1334)
    Length: 114
    Checksum: 0x8fff [correct]
Simple Network Management Protocol
    Version: 3 (3)
    Message Global Header
        Message Global Header Length: 15
        Message ID: 1835009
        Message Max Size: 8192
        Flags: 0x00
            .... .0.. = Reportable: Not set
            .... ..0. = Encrypted: Not set
            .... ...0 = Authenticated: Not set
        Message Security Model: USM
    Message Security Parameters
        Message Security Parameters Length: 34
        Authoritative Engine ID: 0000000B00110AF3B5950001
            0... .... = Engine ID Conformance: RFC1910 (Non-SNMPv3)
            Engine Enterprise ID: Hewlett Packard (11)
            AgentID Trailer: 0x00110AF3B5950001
        Engine Boots: 2
        Engine Time: 1409
        User Name: babun
        Authentication Parameter:
        Privacy Parameter:
    Context Engine ID: 0000000B00110AF3B5950001
        0... .... = Engine ID Conformance: RFC1910 (Non-SNMPv3)
        Engine Enterprise ID: Hewlett Packard (11)
        AgentID Trailer: 0x00110AF3B5950001
    Context Name:
    PDU type: REPORT (8)
    Request Id: 0x00000000
    Error Status: NO ERROR (0)
    Error Index: 0
    Object identifier 1: 1.3.6.1.6.3.15.1.1.5.0 (SNMPv2-SMI::
snmpModules.15.1.1.5.0)
    Value: Counter32: 2

This is another trace I obtained from the MIB browser tool, from MG-SOFT
this tool successfully sets SNMP oid's which I am trying to do from my code:

No.     Time        Source                Destination           Protocol
Info
     34 2.044826    15.76.126.13          16.150.10.114         SNMP     GET

Frame 34 (100 bytes on wire, 100 bytes captured)
Ethernet II, Src: 15.76.126.13 (00:0b:cd:bf:ae:69), Dst:
15.76.126.1(00:e0:52:8f:3f:00)
Internet Protocol, Src: 15.76.126.13 (15.76.126.13), Dst: 16.150.10.114 (
16.150.10.114)
User Datagram Protocol, Src Port: 1358 (1358), Dst Port: snmp (161)
Simple Network Management Protocol
    Version: 3 (3)
    Message Global Header
        Message Global Header Length: 14
        Message ID: 16
        Message Max Size: 65520
        Flags: 0x04
            .... .1.. = Reportable: Set
            .... ..0. = Encrypted: Not set
            .... ...0 = Authenticated: Not set
        Message Security Model: USM
    Message Security Parameters
        Message Security Parameters Length: 16
        Authoritative Engine ID:
        Engine Boots: 0
        Engine Time: 0
        User Name:
        Authentication Parameter:
        Privacy Parameter:
    Context Engine ID:
    Context Name:
    PDU type: GET (0)
    Request Id: 0x0000000f
    Error Status: NO ERROR (0)
    Error Index: 0

No.     Time        Source                Destination           Protocol
Info
     35 2.047097    16.150.10.114         15.76.126.13          SNMP
REPORT SNMPv2-SMI::snmpModules.15.1.1.4.0

Frame 35 (141 bytes on wire, 141 bytes captured)
Ethernet II, Src: 15.76.126.1 (00:e0:52:8f:3f:00), Dst:
15.76.126.13(00:0b:cd:bf:ae:69)
Internet Protocol, Src: 16.150.10.114 (16.150.10.114), Dst: 15.76.126.13 (
15.76.126.13)
User Datagram Protocol, Src Port: snmp (161), Dst Port: 1358 (1358)
Simple Network Management Protocol
    Version: 3 (3)
    Message Global Header
        Message Global Header Length: 13
        Message ID: 16
        Message Max Size: 8192
        Flags: 0x00
            .... .0.. = Reportable: Not set
            .... ..0. = Encrypted: Not set
            .... ...0 = Authenticated: Not set
        Message Security Model: USM
    Message Security Parameters
        Message Security Parameters Length: 29
        Authoritative Engine ID: 0000000B00110AF3B5950001
            0... .... = Engine ID Conformance: RFC1910 (Non-SNMPv3)
            Engine Enterprise ID: Hewlett Packard (11)
            AgentID Trailer: 0x00110AF3B5950001
        Engine Boots: 2
        Engine Time: 1735
        User Name:
        Authentication Parameter:
        Privacy Parameter:
    Context Engine ID: 0000000B00110AF3B5950001
        0... .... = Engine ID Conformance: RFC1910 (Non-SNMPv3)
        Engine Enterprise ID: Hewlett Packard (11)
        AgentID Trailer: 0x00110AF3B5950001
    Context Name:
    PDU type: REPORT (8)
    Request Id: 0x0000000f
    Error Status: NO ERROR (0)
    Error Index: 0
    Object identifier 1: 1.3.6.1.6.3.15.1.1.4.0 (SNMPv2-SMI::
snmpModules.15.1.1.4.0)
    Value: Counter32: 13

No.     Time        Source                Destination           Protocol
Info
     36 2.050177    15.76.126.13          16.150.10.114         SNMP
Encrypted PDU

Frame 36 (202 bytes on wire, 202 bytes captured)
Ethernet II, Src: 15.76.126.13 (00:0b:cd:bf:ae:69), Dst:
15.76.126.1(00:e0:52:8f:3f:00)
Internet Protocol, Src: 15.76.126.13 (15.76.126.13), Dst: 16.150.10.114 (
16.150.10.114)
User Datagram Protocol, Src Port: 1358 (1358), Dst Port: snmp (161)
Simple Network Management Protocol
    Version: 3 (3)
    Message Global Header
        Message Global Header Length: 14
        Message ID: 17
        Message Max Size: 65520
        Flags: 0x07
            .... .1.. = Reportable: Set
            .... ..1. = Encrypted: Set
            .... ...1 = Authenticated: Set
        Message Security Model: USM
    Message Security Parameters
        Message Security Parameters Length: 54
        Authoritative Engine ID: 0000000B00110AF3B5950001
            0... .... = Engine ID Conformance: RFC1910 (Non-SNMPv3)
            Engine Enterprise ID: Hewlett Packard (11)
            AgentID Trailer: 0x00110AF3B5950001
        Engine Boots: 2
        Engine Time: 1736
        User Name: babun
        Authentication Parameter: 9C288EFCC4477FC75D97D3AD
        Privacy Parameter: 000000C800000021
    Encrypted PDU (82 bytes)

No.     Time        Source                Destination           Protocol
Info
     37 2.055098    16.150.10.114         15.76.126.13          SNMP
Encrypted PDU

Frame 37 (201 bytes on wire, 201 bytes captured)
Ethernet II, Src: 15.76.126.1 (00:e0:52:8f:3f:00), Dst:
15.76.126.13(00:0b:cd:bf:ae:69)
Internet Protocol, Src: 16.150.10.114 (16.150.10.114), Dst: 15.76.126.13 (
15.76.126.13)
User Datagram Protocol, Src Port: snmp (161), Dst Port: 1358 (1358)
Simple Network Management Protocol
    Version: 3 (3)
    Message Global Header
        Message Global Header Length: 13
        Message ID: 17
        Message Max Size: 8192
        Flags: 0x03
            .... .0.. = Reportable: Not set
            .... ..1. = Encrypted: Set
            .... ...1 = Authenticated: Set
        Message Security Model: USM
    Message Security Parameters
        Message Security Parameters Length: 54
        Authoritative Engine ID: 0000000B00110AF3B5950001
            0... .... = Engine ID Conformance: RFC1910 (Non-SNMPv3)
            Engine Enterprise ID: Hewlett Packard (11)
            AgentID Trailer: 0x00110AF3B5950001
        Engine Boots: 2
        Engine Time: 1735
        User Name: babun
        Authentication Parameter: 538379F14DF58BF6AE851B65
        Privacy Parameter: 0000000200000005
    Encrypted PDU (82 bytes)

Let me know what is going wrong with my code compared with what the tool is
doing right.
regards,
--sarath

On 10/10/06, N Sarath chandra babu <nscbabu at gmail.com> wrote:
>
>
>
> ---------- Forwarded message ----------
> From: "N Sarath chandra babu" <nscbabu at gmail.com>
> To: agentpp at agentpp.org
> Date: Tue, 10 Oct 2006 14:40:07 +0530
> Subject: snmp++ crash issue
> Hi,
> The following code crashes, I run it on windows, I see this happens only
> when I set an integer value for a vb.
> Any help in this direction is highly appreciated.
>
> Thanks in advance,
> --sarath.
>
> #include "../include/snmp_pp/snmp_pp.h"
> #include <stdlib.h>
> #include <stdio.h>
>
> #ifdef WIN32
> #define strcasecmp stricmp
> #endif
>
> #ifdef SNMP_PP_NAMESPACE
> using namespace Snmp_pp;
> #endif
>
> #if (__GNUC__ > 2)
> #include <iostream>
> using std::cerr;
> using std::cout;
> using std::cin;
> using std::endl;
> using std::flush;
> #else
> #include <iostream.h>
> #endif
>
> main ()
> {
>     Snmp::socket_startup();
>     Vb vb;
>
>     UdpAddress address("16.150.10.55");
>     address.set_port(161);
>
>     int status;
>
>     Snmp snmp(status, 0, (address.get_ip_version() ==
> Address::version_ipv6));
>
>     CTarget ctarget( address);
>
>     ctarget.set_version(version1);         // set the SNMP version SNMPV1
> or V2
>     ctarget.set_retry(10);           // set the number of auto retries
>     ctarget.set_timeout (5 * 100);         // set timeout
>     ctarget.set_readcommunity("public");
>     ctarget.set_writecommunity("internal");
>
>     unsigned long i;
>     i = 2;
>     vb.set_oid("1.3.6.1.4.1.11.2.14.11.1.3.1.1.10.1 "); //Set download
> status
>     //vb.set_syntax(sNMP_SYNTAX_UINT32);
>     vb.set_value(4); //create and go
>
>
>     /*Oid oid("1.3.6.1.6.1.1");
>     vb.set_oid("1.3.6.1.4.1.11.2.14.11.1.3.1.1.5.1 ");
>     vb.set_value(oid);*/
>
>     Pdu pdu;
>     pdu += vb;
>     if ((status = snmp.set(pdu, ctarget)) == SNMP_CLASS_SUCCESS)
>     {
>         cout <<"hello";
>     }
>     Snmp::socket_cleanup();
> }
>



More information about the AGENTPP mailing list