• AVR Freaks

Helpful ReplyHot!Snmp OctetString 4 byte problem

Author
eminkiran
New Member
  • Total Posts : 17
  • Reward points : 0
  • Joined: 2018/06/20 01:04:41
  • Location: 0
  • Status: offline
2018/12/13 06:20:18 (permalink)
0

Snmp OctetString 4 byte problem

Hello,
I am using Pic32mx795f512L.
I get a generic error when I send octetString value to long by 4 bytes tan over snmp. Does anyone know why?
 

Mplab X ide = v4.15
Compiler = xc32 v2.05
Harmony = v2_05_01


 
Best Regards
 
 
 
 
#1
crosland
Super Member
  • Total Posts : 1582
  • Reward points : 0
  • Joined: 2005/05/10 10:55:05
  • Location: Bucks, UK
  • Status: offline
Re: Snmp OctetString 4 byte problem 2018/12/13 09:30:20 (permalink)
0
I don't even understand the question!
#2
eminkiran
New Member
  • Total Posts : 17
  • Reward points : 0
  • Joined: 2018/06/20 01:04:41
  • Location: 0
  • Status: offline
Re: Snmp OctetString 4 byte problem 2018/12/13 11:52:55 (permalink)
0
Example I'm sending "user_1" to USER_SECURITY_NAME. If the value is greater than 4 bytes I get a general error and I can't change the value. No problem if I send the value as "user"
#3
crosland
Super Member
  • Total Posts : 1582
  • Reward points : 0
  • Joined: 2005/05/10 10:55:05
  • Location: Bucks, UK
  • Status: offline
Re: Snmp OctetString 4 byte problem 2018/12/13 11:58:24 (permalink)
0
Sorry, I don't know anything about SNMP in the microchip stack but I would start by looking for a #define for the maximum length or better still look for the code that handles the input.
#4
qhb
Superb Member
  • Total Posts : 9998
  • Reward points : 0
  • Joined: 2016/06/05 14:55:32
  • Location: One step ahead...
  • Status: offline
Re: Snmp OctetString 4 byte problem 2018/12/13 12:19:28 (permalink)
0
It's much easier to help if you show the REAL code that generated the error, and the REAL error message.
 

Nearly there...
#5
eminkiran
New Member
  • Total Posts : 17
  • Reward points : 0
  • Joined: 2018/06/20 01:04:41
  • Location: 0
  • Status: offline
Re: Snmp OctetString 4 byte problem 2018/12/13 13:15:20 (permalink)
0
I use Microchip TCP/Ip stack 7.30 with harmony. Stack sample "snmpv3_nvm_mpfs". Code is huge, I dont know where is the problem. Someone who has worked on this before, perhaps came across this situation.
#6
NKurzman
A Guy on the Net
  • Total Posts : 17499
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: Snmp OctetString 4 byte problem 2018/12/13 13:24:43 (permalink) ☄ Helpfulby eminkiran 2018/12/14 01:15:04
0
this is a harmony issue. You need to cross post it there, or post a link. TCP/IP issue tend to be answered quickly there.
#7
eminkiran
New Member
  • Total Posts : 17
  • Reward points : 0
  • Joined: 2018/06/20 01:04:41
  • Location: 0
  • Status: offline
Re: Snmp OctetString 4 byte problem 2018/12/14 01:15:20 (permalink)
0
Ok i will write there
#8
Carl Pickering
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2019/01/31 09:00:39
  • Location: 0
  • Status: offline
Re: Snmp OctetString 4 byte problem 2019/02/02 03:57:20 (permalink)
0
It's a bug in the Microchip SNMP library. It just assumes all datatypes used in a set are between 1 and 4 bytes. They have a "solution" in Harmony2 that ignores the length check for octet strings. We can get away with this for our application but it's not really good enough. 
 
In TCPIP_SNMP_ProcessSetVar around line 5032 it originally read:
 
// if the length of a integer type is more than 4 or less than 0 bytes don't do anything
if ((dataLen > 4) || (dataLen == 0))
{
    return (0);
}
 
but in Harmony2 it is:
 
if(actualDataTypeInfo.asnType != OCTET_STRING)
{
    // if the length of a integer type is more than 4 or less than 0 bytes don't do anything
    if ((dataLen > 4) || (dataLen == 0))
    {
        return (0);
    }
}
 
I considered using the length in actualDataTypeInfo but looking at their tables I'm not convinced it would yield the right results for every tag so copied the lines from Harmony2 and can now accept longer strings.
 
With this and the incorrectly encoded integers I really wonder how much testing has been carried out. These are schoolboy errors.
 
 
#9
Jump to:
© 2019 APG vNext Commercial Version 4.5