2009/3/10 Samer Vazdekis <[email protected]>:
> Yes I did try the "sysobjectid" directive but didn't work. Looking at code,
> I see the open-pdu OID is always set to the sysObjectId.
Actually, having checked the code more carefully - the Open-PDU OID
is set to the internal "version_oid" (which is hardcoded), rather than the
sysObjectID buffer (which can be configured)
Please try the attached patch - does that address your requirements?
Dave
Index: mibgroup/mibII/system_mib.c
===================================================================
--- mibgroup/mibII/system_mib.c (revision 17411)
+++ mibgroup/mibII/system_mib.c (working copy)
@@ -59,8 +59,8 @@
static char sysContact[SYS_STRING_LEN] = NETSNMP_SYS_CONTACT;
static char sysName[SYS_STRING_LEN] = NETSNMP_SYS_NAME;
static char sysLocation[SYS_STRING_LEN] = NETSNMP_SYS_LOC;
-static oid sysObjectID[MAX_OID_LEN];
-static size_t sysObjectIDLength;
+extern oid sysObjectID[];
+extern size_t sysObjectIDLength;
extern oid version_sysoid[];
extern int version_sysoid_len;
Index: mibgroup/agentx/client.c
===================================================================
--- mibgroup/agentx/client.c (revision 17411)
+++ mibgroup/agentx/client.c (working copy)
@@ -121,8 +121,8 @@
agentx_open_session(netsnmp_session * ss)
{
netsnmp_pdu *pdu, *response;
- extern oid version_sysoid[];
- extern int version_sysoid_len;
+ extern oid sysObjectID[];
+ extern int sysObjectIDLength;
DEBUGMSGTL(("agentx/subagent", "opening session \n"));
if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
@@ -133,7 +133,7 @@
if (pdu == NULL)
return 0;
pdu->time = 0;
- snmp_add_var(pdu, version_sysoid, version_sysoid_len,
+ snmp_add_var(pdu, sysObjectID, sysObjectIDLength,
's', "Net-SNMP AgentX sub-agent");
if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS)
Index: snmp_agent.c
===================================================================
--- snmp_agent.c (revision 17411)
+++ snmp_agent.c (working copy)
@@ -174,6 +174,8 @@
}
}
+oid sysObjectID[MAX_OID_LEN];
+size_t sysObjectIDLength;
oid version_sysoid[] = { NETSNMP_SYSTEM_MIB };
int version_sysoid_len = OID_LENGTH(version_sysoid);
@@ -1219,6 +1221,9 @@
/* default to a default cache size */
netsnmp_set_lookup_cache_size(-1);
+ memcpy(sysObjectID, version_sysoid, version_sysoid_len * sizeof(oid));
+ sysObjectIDLength = version_sysoid_len;
+
if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_ROLE) != MASTER_AGENT) {
DEBUGMSGTL(("snmp_agent",
------------------------------------------------------------------------------
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders