Hi,
I'm working on a project to include an SNMP agent based on NET-SNMP's snmpd
in an ethernet switch. The switch's command-line interface provides the
ability to specify the SNMP agent's engineID. This is somewhat problematic
with NET-SNMP (at least as of version 5.4.1) because there is no way to
specify the engineID exactly. I'd like to be able to configure the engineID
using a command that just takes the hex-encoded raw engineID, similar to the
oldEngineID command.
Attached is a patch that handles a new "exactEngineID" command in snmpd.conf.
Is this something that the maintainers of NET-SNMP think is useful? If so,
do you have any suggestions for changes, and would you consider adding this
to a future NET-SNMP release?
Thanks,
Nathan Schrenk
[EMAIL PROTECTED]
--- include/net-snmp/library/snmpv3.h.orig 2008-01-18 14:00:35.000000000
-0800
+++ include/net-snmp/library/snmpv3.h 2008-01-18 14:09:00.000000000 -0800
@@ -15,6 +15,7 @@
#define ENGINEID_TYPE_IPV6 2
#define ENGINEID_TYPE_MACADDR 3
#define ENGINEID_TYPE_TEXT 4
+#define ENGINEID_TYPE_EXACT 5
#define ENGINEID_TYPE_NETSNMP_RND 128
#define DEFAULT_NIC "eth0"
--- snmplib/snmpv3.c.orig 2008-01-18 13:38:29.000000000 -0800
+++ snmplib/snmpv3.c 2008-01-18 14:12:50.000000000 -0800
@@ -1195,7 +1195,7 @@
}
/*
- * engineID_old_conf(const char *, char *):
+ * oldengineID_conf(const char *, char *):
*
* Reads a octet string encoded engineID into the oldEngineID and
* oldEngineIDLen pointers.
@@ -1207,6 +1207,31 @@
}
/*
+ * exactEngineID_conf(const char *, char *):
+ *
+ * Reads a octet string encoded engineID into the engineID and
+ * engineIDLen pointers.
+ */
+void
+exactEngineID_conf(const char *word, char *cptr)
+{
+ char buf[ 1024 ];
+
+ read_config_read_octet_string(cptr, &engineID, &engineIDLength);
+ if (engineIDLength > MAX_ENGINEID_LENGTH) {
+ snprintf(buf, sizeof(buf),
+ "exactEngineID '%s' too long; truncating to %d bytes",
+ cptr, MAX_ENGINEID_LENGTH);
+ config_perror(buf);
+ engineID[MAX_ENGINEID_LENGTH - 1] = '\0';
+ engineIDLength = MAX_ENGINEID_LENGTH;
+ }
+ engineIDIsSet = 1;
+ engineIDType = ENGINEID_TYPE_EXACT;
+}
+
+
+/*
* merely call
*/
void
@@ -1290,6 +1315,8 @@
"string");
register_prenetsnmp_mib_handler(type, "oldEngineID", oldengineID_conf,
NULL, NULL);
+ register_prenetsnmp_mib_handler(type, "exactEngineID", exactEngineID_conf,
+ NULL, NULL);
register_prenetsnmp_mib_handler(type, "engineIDType",
engineIDType_conf, NULL, "num");
register_prenetsnmp_mib_handler(type, "engineIDNic", engineIDNic_conf,
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders