While testing my app, I think I've discovered an issue...

My app uses AgentX to interact with net-snmp and during the course of
events it typically performs a large number of the following sequence:

newIndex = IndexAllocate(ANY_INDEX)       [of an Integer value]
Register(OID.newIndex);
...

Unregister(OID.index)
IndexDeallocate(OID, index)
...

When the number of rows (sequence of
allocate/register/unregister/deallocate)
is small (less than 255 entries) it works fine, but as soon as I add a 256th
entry for my table (that I've registered), when I go to Unregister (them
all),
one of them will fail with an indexNotAllocated error response.

I suspect that Net-SNMP has some table inside that holds the registrations
that uses a byte index, and hence causes an overlap once I exceed 255
entries (ie. an index had the same least significant 8 bits).

I have not looked at the source for Net-SNMP yet,
nor have I enabled Net-SNMP traces,
I thought I'd post the problem first.

I'm currently running v 5.6.1

A Wireshark (decoded) trace of an 'overlapped' allocation and its subsequent
deallocation is attached. (Note that this is not the 256th entry test case,
mentioned above, but a snapshot of my real-world situation (that allocated
~850 entries in its table).)

TIA
Fulko
No.     Time                       Source                Destination           
Protocol Info
   1840 2012-11-14 08:39:47.511104 127.0.0.1             127.0.0.1             
AgentX   IndexAllocate-PDU: sid=72, tid=0, packid=672, plen=40

Frame 1840: 126 bytes on wire (1008 bits), 126 bytes captured (1008 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
Internet Protocol, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 38165 (38165), Dst Port: agentx (705), 
Seq: 41973, Ack: 58001, Len: 60
Agent Extensibility (AgentX) Protocol: IndexAllocate-PDU, sid=72, tid=0, 
packid=672, plen=40
    PDU Header: Type[14], len=40, sid=72, tid=0, packid=672
        Version: 1
        Type: IndexAllocate-PDU (14)
        Flags: 0x14
            .... ...0 = Register: No
            .... ..0. = New Index: No
            .... .1.. = Any Index: Yes
            .... 0... = Non-default Context: None
            ...1 .... = Byte Order: MSB (network order)
        sessionID: 72
        TransactionID: 0
        PacketID: 672
        Payload length: 40
    IndexAllocate-PDU
        Value Representation
            Variable type: Integer (2)
            Object Identifier: .1.3.6.1.4.1.1978.20.1.1.1.1
                Number subids: 7
                OID prefix: 4
                .... ...0 = OID include: No
                OID: .1.3.6.1.4.1.1978.20.1.1.1.1
            Value(32): 1

0000  00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00   ..............E.
0010  00 70 de b9 40 00 40 06 5d cc 7f 00 00 01 7f 00   .p..@.@.].......
0020  00 01 95 15 02 c1 d1 08 cd 1f d0 76 40 1c 80 18   ...........v@...
0030  02 12 fe 64 00 00 01 01 08 0a 04 a9 8d 59 04 a9   ...d.........Y..
0040  8c ef 01 0e 14 00 00 00 00 48 00 00 00 00 00 00   .........H......
0050  02 a0 00 00 00 28 00 02 00 00 07 04 00 00 00 00   .....(..........
0060  00 01 00 00 07 ba 00 00 00 14 00 00 00 01 00 00   ................
0070  00 01 00 00 00 01 00 00 00 01 00 00 00 01         ..............

No.     Time                       Source                Destination           
Protocol Info
   1841 2012-11-14 08:39:47.511372 127.0.0.1             127.0.0.1             
AgentX   Response-PDU: sid=72, tid=0, packid=672, plen=48

Frame 1841: 134 bytes on wire (1072 bits), 134 bytes captured (1072 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
Internet Protocol, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: agentx (705), Dst Port: 38165 (38165), 
Seq: 58001, Ack: 42033, Len: 68
Agent Extensibility (AgentX) Protocol: Response-PDU, sid=72, tid=0, packid=672, 
plen=48
    PDU Header: Type[18], len=48, sid=72, tid=0, packid=672
        Version: 1
        Type: Response-PDU (18)
        Flags: 0x14
            .... ...0 = Register: No
            .... ..0. = New Index: No
            .... .1.. = Any Index: Yes
            .... 0... = Non-default Context: None
            ...1 .... = Byte Order: MSB (network order)
        sessionID: 72
        TransactionID: 0
        PacketID: 672
        Payload length: 48
    Response-PDU
        sysUptime: 2 hours, 25 minutes, 29.276 seconds
        Resp. error: noError (0)
        Resp. index: 0
        Value Representation
            Variable type: Integer (2)
            Object Identifier: .1.3.6.1.4.1.1978.20.1.1.1.1
                Number subids: 7
                OID prefix: 4
                .... ...0 = OID include: No
                OID: .1.3.6.1.4.1.1978.20.1.1.1.1
            Value(32): 333

0000  00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00   ..............E.
0010  00 78 b1 81 40 00 40 06 8a fc 7f 00 00 01 7f 00   .x..@.@.........
0020  00 01 02 c1 95 15 d0 76 40 1c d1 08 cd 5b 80 18   .......v@....[..
0030  02 11 fe 6c 00 00 01 01 08 0a 04 a9 8d 59 04 a9   ...l.........Y..
0040  8d 59 01 12 14 00 00 00 00 48 00 00 00 00 00 00   .Y.......H......
0050  02 a0 00 00 00 30 00 85 32 bc 00 00 00 00 00 02   .....0..2.......
0060  00 00 07 04 00 00 00 00 00 01 00 00 07 ba 00 00   ................
0070  00 14 00 00 00 01 00 00 00 01 00 00 00 01 00 00   ................
0080  00 01 00 00 01 4d                                 .....M

No.     Time                       Source                Destination           
Protocol Info
   1843 2012-11-14 08:39:47.512581 127.0.0.1             127.0.0.1             
AgentX   Register-PDU: sid=72, tid=0, packid=673, plen=44

Frame 1843: 130 bytes on wire (1040 bits), 130 bytes captured (1040 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
Internet Protocol, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 38165 (38165), Dst Port: agentx (705), 
Seq: 42033, Ack: 58069, Len: 64
Agent Extensibility (AgentX) Protocol: Register-PDU, sid=72, tid=0, packid=673, 
plen=44
    PDU Header: Type[3], len=44, sid=72, tid=0, packid=673
        Version: 1
        Type: Register-PDU (3)
        Flags: 0x10
            .... ...0 = Register: No
            .... ..0. = New Index: No
            .... .0.. = Any Index: No
            .... 0... = Non-default Context: None
            ...1 .... = Byte Order: MSB (network order)
        sessionID: 72
        TransactionID: 0
        PacketID: 673
        Payload length: 44
    Register-PDU
        Timeout: 0
        Priority: 127
        Range_subid: 12
        Object Identifier: .1.3.6.1.4.1.1978.20.1.1.1.1.333
            Number subids: 8
            OID prefix: 4
            .... ...0 = OID include: No
            OID: .1.3.6.1.4.1.1978.20.1.1.1.1.333
        Upper bound: 8

0000  00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00   ..............E.
0010  00 74 de bb 40 00 40 06 5d c6 7f 00 00 01 7f 00   .t..@.@.].......
0020  00 01 95 15 02 c1 d1 08 cd 5b d0 76 40 60 80 18   .........[.v@`..
0030  02 12 fe 68 00 00 01 01 08 0a 04 a9 8d 5a 04 a9   ...h.........Z..
0040  8d 59 01 03 10 00 00 00 00 48 00 00 00 00 00 00   .Y.......H......
0050  02 a1 00 00 00 2c 00 7f 0c 00 08 04 00 00 00 00   .....,..........
0060  00 01 00 00 07 ba 00 00 00 14 00 00 00 01 00 00   ................
0070  00 01 00 00 00 01 00 00 00 01 00 00 01 4d 00 00   .............M..
0080  00 08                                             ..

No.     Time                       Source                Destination           
Protocol Info
   1844 2012-11-14 08:39:47.545264 127.0.0.1             127.0.0.1             
AgentX   Response-PDU: sid=72, tid=0, packid=673, plen=84

Frame 1844: 170 bytes on wire (1360 bits), 170 bytes captured (1360 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
Internet Protocol, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: agentx (705), Dst Port: 38165 (38165), 
Seq: 58069, Ack: 42097, Len: 104
Agent Extensibility (AgentX) Protocol: Response-PDU, sid=72, tid=0, packid=673, 
plen=84
    PDU Header: Type[18], len=84, sid=72, tid=0, packid=673
        Version: 1
        Type: Response-PDU (18)
        Flags: 0x10
            .... ...0 = Register: No
            .... ..0. = New Index: No
            .... .0.. = Any Index: No
            .... 0... = Non-default Context: None
            ...1 .... = Byte Order: MSB (network order)
        sessionID: 72
        TransactionID: 0
        PacketID: 673
        Payload length: 84
    Response-PDU
        sysUptime: 2 hours, 25 minutes, 29.280 seconds
        Resp. error: noError (0)
        Resp. index: 0
        Value Representation
            Variable type: Object Identifier (6)
            Object Identifier: .1.3.6.1.4.1.1978.20.1.1.1.1.333
                Number subids: 8
                OID prefix: 4
                .... ...0 = OID include: No
                OID: .1.3.6.1.4.1.1978.20.1.1.1.1.333
            Object Identifier: .1.3.6.1.4.1.1978.20.1.1.1.8.333
                Number subids: 8
                OID prefix: 4
                .... ...1 = OID include: Yes
                OID: .1.3.6.1.4.1.1978.20.1.1.1.8.333

0000  00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00   ..............E.
0010  00 9c b1 82 40 00 40 06 8a d7 7f 00 00 01 7f 00   ....@.@.........
0020  00 01 02 c1 95 15 d0 76 40 60 d1 08 cd 9b 80 18   .......v@`......
0030  02 11 fe 90 00 00 01 01 08 0a 04 a9 8d 7b 04 a9   .............{..
0040  8d 5a 01 12 10 00 00 00 00 48 00 00 00 00 00 00   .Z.......H......
0050  02 a1 00 00 00 54 00 85 32 c0 00 00 00 00 00 06   .....T..2.......
0060  00 00 08 04 00 00 00 00 00 01 00 00 07 ba 00 00   ................
0070  00 14 00 00 00 01 00 00 00 01 00 00 00 01 00 00   ................
0080  00 01 00 00 01 4d 08 04 01 00 00 00 00 01 00 00   .....M..........
0090  07 ba 00 00 00 14 00 00 00 01 00 00 00 01 00 00   ................
00a0  00 01 00 00 00 08 00 00 01 4d                     .........M

No.     Time                       Source                Destination           
Protocol Info
   5839 2012-11-14 08:42:10.139451 127.0.0.1             127.0.0.1             
AgentX   Unregister-PDU: sid=72, tid=0, packid=1810, plen=44

Frame 5839: 130 bytes on wire (1040 bits), 130 bytes captured (1040 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
Internet Protocol, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 38165 (38165), Dst Port: agentx (705), 
Seq: 128313, Ack: 170997, Len: 64
Agent Extensibility (AgentX) Protocol: Unregister-PDU, sid=72, tid=0, 
packid=1810, plen=44
    PDU Header: Type[4], len=44, sid=72, tid=0, packid=1810
        Version: 1
        Type: Unregister-PDU (4)
        Flags: 0x10
            .... ...0 = Register: No
            .... ..0. = New Index: No
            .... .0.. = Any Index: No
            .... 0... = Non-default Context: None
            ...1 .... = Byte Order: MSB (network order)
        sessionID: 72
        TransactionID: 0
        PacketID: 1810
        Payload length: 44
    Unregister-PDU
        Timeout: 0
        Priority: 127
        Range_subid: 12
        Object Identifier: .1.3.6.1.4.1.1978.20.1.1.1.1.333
            Number subids: 8
            OID prefix: 4
            .... ...0 = OID include: No
            OID: .1.3.6.1.4.1.1978.20.1.1.1.1.333
        Upper bound: 8

0000  00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00   ..............E.
0010  00 74 e7 72 40 00 40 06 55 0f 7f 00 00 01 7f 00   .t.r@.@.U.......
0020  00 01 95 15 02 c1 d1 0a 1e 63 d0 77 f9 80 80 18   .........c.w....
0030  03 02 fe 68 00 00 01 01 08 0a 04 ab ba 7d 04 ab   ...h.........}..
0040  a6 ca 01 04 10 00 00 00 00 48 00 00 00 00 00 00   .........H......
0050  07 12 00 00 00 2c 00 7f 0c 00 08 04 00 00 00 00   .....,..........
0060  00 01 00 00 07 ba 00 00 00 14 00 00 00 01 00 00   ................
0070  00 01 00 00 00 01 00 00 00 01 00 00 01 4d 00 00   .............M..
0080  00 08                                             ..

No.     Time                       Source                Destination           
Protocol Info
   5841 2012-11-14 08:42:10.190587 127.0.0.1             127.0.0.1             
AgentX   Response-PDU: sid=72, tid=0, packid=1810, plen=84

Frame 5841: 170 bytes on wire (1360 bits), 170 bytes captured (1360 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
Internet Protocol, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: agentx (705), Dst Port: 38165 (38165), 
Seq: 170997, Ack: 128377, Len: 104
Agent Extensibility (AgentX) Protocol: Response-PDU, sid=72, tid=0, 
packid=1810, plen=84
    PDU Header: Type[18], len=84, sid=72, tid=0, packid=1810
        Version: 1
        Type: Response-PDU (18)
        Flags: 0x10
            .... ...0 = Register: No
            .... ..0. = New Index: No
            .... .0.. = Any Index: No
            .... 0... = Non-default Context: None
            ...1 .... = Byte Order: MSB (network order)
        sessionID: 72
        TransactionID: 0
        PacketID: 1810
        Payload length: 84
    Response-PDU
        sysUptime: 2 hours, 25 minutes, 43.544 seconds
        Resp. error: noError (0)
        Resp. index: 0
        Value Representation
            Variable type: Object Identifier (6)
            Object Identifier: .1.3.6.1.4.1.1978.20.1.1.1.1.333
                Number subids: 8
                OID prefix: 4
                .... ...0 = OID include: No
                OID: .1.3.6.1.4.1.1978.20.1.1.1.1.333
            Object Identifier: .1.3.6.1.4.1.1978.20.1.1.1.8.333
                Number subids: 8
                OID prefix: 4
                .... ...1 = OID include: Yes
                OID: .1.3.6.1.4.1.1978.20.1.1.1.8.333

0000  00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00   ..............E.
0010  00 9c b6 6c 40 00 40 06 85 ed 7f 00 00 01 7f 00   ...l@.@.........
0020  00 01 02 c1 95 15 d0 77 f9 80 d1 0a 1e a3 80 18   .......w........
0030  03 02 fe 90 00 00 01 01 08 0a 04 ab ba b0 04 ab   ................
0040  ba 7d 01 12 10 00 00 00 00 48 00 00 00 00 00 00   .}.......H......
0050  07 12 00 00 00 54 00 85 6a 78 00 00 00 00 00 06   .....T..jx......
0060  00 00 08 04 00 00 00 00 00 01 00 00 07 ba 00 00   ................
0070  00 14 00 00 00 01 00 00 00 01 00 00 00 01 00 00   ................
0080  00 01 00 00 01 4d 08 04 01 00 00 00 00 01 00 00   .....M..........
0090  07 ba 00 00 00 14 00 00 00 01 00 00 00 01 00 00   ................
00a0  00 01 00 00 00 08 00 00 01 4d                     .........M

No.     Time                       Source                Destination           
Protocol Info
   5843 2012-11-14 08:42:10.506791 127.0.0.1             127.0.0.1             
AgentX   IndexDeallocate-PDU: sid=72, tid=0, packid=1811, plen=40

Frame 5843: 126 bytes on wire (1008 bits), 126 bytes captured (1008 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
Internet Protocol, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 38165 (38165), Dst Port: agentx (705), 
Seq: 128377, Ack: 171101, Len: 60
Agent Extensibility (AgentX) Protocol: IndexDeallocate-PDU, sid=72, tid=0, 
packid=1811, plen=40
    PDU Header: Type[15], len=40, sid=72, tid=0, packid=1811
        Version: 1
        Type: IndexDeallocate-PDU (15)
        Flags: 0x10
            .... ...0 = Register: No
            .... ..0. = New Index: No
            .... .0.. = Any Index: No
            .... 0... = Non-default Context: None
            ...1 .... = Byte Order: MSB (network order)
        sessionID: 72
        TransactionID: 0
        PacketID: 1811
        Payload length: 40
    IndexDeallocate-PDU
        Value Representation
            Variable type: Integer (2)
            Object Identifier: .1.3.6.1.4.1.1978.20.1.1.1.1
                Number subids: 7
                OID prefix: 4
                .... ...0 = OID include: No
                OID: .1.3.6.1.4.1.1978.20.1.1.1.1
            Value(32): 333

0000  00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00   ..............E.
0010  00 70 e7 74 40 00 40 06 55 11 7f 00 00 01 7f 00   .p.t@.@.U.......
0020  00 01 95 15 02 c1 d1 0a 1e a3 d0 77 f9 e8 80 18   ...........w....
0030  03 02 fe 64 00 00 01 01 08 0a 04 ab bb ed 04 ab   ...d............
0040  ba b0 01 0f 10 00 00 00 00 48 00 00 00 00 00 00   .........H......
0050  07 13 00 00 00 28 00 02 00 00 07 04 00 00 00 00   .....(..........
0060  00 01 00 00 07 ba 00 00 00 14 00 00 00 01 00 00   ................
0070  00 01 00 00 00 01 00 00 00 01 00 00 01 4d         .............M

No.     Time                       Source                Destination           
Protocol Info
   5845 2012-11-14 08:42:10.507000 127.0.0.1             127.0.0.1             
AgentX   Response-PDU: sid=72, tid=0, packid=1811, plen=48

Frame 5845: 134 bytes on wire (1072 bits), 134 bytes captured (1072 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
Internet Protocol, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: agentx (705), Dst Port: 38165 (38165), 
Seq: 171101, Ack: 128437, Len: 68
Agent Extensibility (AgentX) Protocol: Response-PDU, sid=72, tid=0, 
packid=1811, plen=48
    PDU Header: Type[18], len=48, sid=72, tid=0, packid=1811
        Version: 1
        Type: Response-PDU (18)
        Flags: 0x10
            .... ...0 = Register: No
            .... ..0. = New Index: No
            .... .0.. = Any Index: No
            .... 0... = Non-default Context: None
            ...1 .... = Byte Order: MSB (network order)
        sessionID: 72
        TransactionID: 0
        PacketID: 1811
        Payload length: 48
    Response-PDU
        sysUptime: 2 hours, 25 minutes, 43.576 seconds
        Resp. error: indexNotAllocated (261)
        Resp. index: 0
        Value Representation
            Variable type: Integer (2)
            Object Identifier: .1.3.6.1.4.1.1978.20.1.1.1.1
                Number subids: 7
                OID prefix: 4
                .... ...0 = OID include: No
                OID: .1.3.6.1.4.1.1978.20.1.1.1.1
            Value(32): 333

0000  00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00   ..............E.
0010  00 78 b6 6e 40 00 40 06 86 0f 7f 00 00 01 7f 00   .x.n@.@.........
0020  00 01 02 c1 95 15 d0 77 f9 e8 d1 0a 1e df 80 18   .......w........
0030  03 02 fe 6c 00 00 01 01 08 0a 04 ab bb ed 04 ab   ...l............
0040  bb ed 01 12 10 00 00 00 00 48 00 00 00 00 00 00   .........H......
0050  07 13 00 00 00 30 00 85 6a 98 01 05 00 00 00 02   .....0..j.......
0060  00 00 07 04 00 00 00 00 00 01 00 00 07 ba 00 00   ................
0070  00 14 00 00 00 01 00 00 00 01 00 00 00 01 00 00   ................
0080  00 01 00 00 01 4d                                 .....M
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to