Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snmpv2: fixes on trapOID and mib compiler #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions contrib/apps/LwipMibCompiler/LwipMibCompiler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static void Main(string[] args)
string mibFileName = Path.GetFileNameWithoutExtension(mibFile).ToLowerInvariant();
destFile = Path.Combine(destFile, mibFileName + ".c");
}

string destFileExt = Path.GetExtension(destFile);
if (!String.IsNullOrEmpty(destFileExt))
{
Expand All @@ -94,10 +94,10 @@ static void Main(string[] args)
}
}


// read and resolve MIB
Console.WriteLine(" Reading MIB file...");

MibDocument md = new MibDocument(mibFile);
MibTypesResolver.ResolveTypes(md.Modules[0]);
MibTree mt = new MibTree(md.Modules[0] as MibModule);
Expand Down Expand Up @@ -335,7 +335,7 @@ private static SnmpScalarNode GenerateSnmpScalarNode(ObjectType ote, SnmpTreeNod
{
Console.WriteLine(String.Format("Unsupported BaseType: Module='{0}', Name='{1}'!", mibType.Module, mibType.Name));
}

return null;
}
}
Expand All @@ -353,7 +353,7 @@ private static SnmpScalarNode GenerateSnmpScalarNode(ObjectType ote, SnmpTreeNod
}
else if (ote.Access == MaxAccess.readCreate)
{
result.AccessMode = SnmpAccessMode.ReadOnly;
result.AccessMode = SnmpAccessMode.ReadWrite;
}
else if (ignoreAccessibleFlag && (ote.Access == MaxAccess.notAccessible))
{
Expand Down Expand Up @@ -426,7 +426,7 @@ private static SnmpTableNode GenerateSnmpTableNode(MibTreeNode mibTreeNode, Snmp
}

MibTreeNode rowNode = mibTreeNode.ChildNodes[0];

ObjectType rot = rowNode.Entity as ObjectType;
if (rot != null)
{
Expand Down
10 changes: 5 additions & 5 deletions src/apps/snmp/snmp_traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ snmp_prepare_trap_oid(struct snmp_obj_id *dest_snmp_trap_oid, const struct snmp_
if (sizeof(dest_snmp_trap_oid->id) >= sizeof(snmpTrapOID)) {
MEMCPY(&dest_snmp_trap_oid->id, snmpTrapOID , sizeof(snmpTrapOID));
dest_snmp_trap_oid->len = LWIP_ARRAYSIZE(snmpTrapOID);
dest_snmp_trap_oid->id[dest_snmp_trap_oid->len++] = specific_trap + 1;
dest_snmp_trap_oid->id[dest_snmp_trap_oid->len++] = generic_trap + 1;
} else {
err = ERR_MEM;
}
Expand Down Expand Up @@ -359,8 +359,8 @@ snmp_send_trap_or_notification_or_inform_generic(struct snmp_msg_trap *trap_msg,
NULL, /* *next */
NULL, /* *prev */
{ /* oid */
8, /* oid len */
{1, 3, 6, 1, 2, 1, 1, 3} /* oid for sysUpTime */
9, /* oid len */
{1, 3, 6, 1, 2, 1, 1, 3, 0} /* oid for sysUpTime.0 */
},
SNMP_ASN1_TYPE_TIMETICKS, /* type */
sizeof(u32_t), /* value_len */
Expand All @@ -371,8 +371,8 @@ snmp_send_trap_or_notification_or_inform_generic(struct snmp_msg_trap *trap_msg,
NULL, /* *next */
NULL, /* *prev */
{ /* oid */
10, /* oid len */
{1, 3, 6, 1, 6, 3, 1, 1, 4, 1} /* oid for snmpTrapOID */
11, /* oid len */
{1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0} /* oid for snmpTrapOID.0 */
},
SNMP_ASN1_TYPE_OBJECT_ID, /* type */
0, /* value_len */
Expand Down