From 35bf5000438b34a43752f668930bc5347f4643a9 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 26 Jan 2012 17:18:36 +0100 Subject: [snmp/agent] Wrong OID used for error message reply When sending an error message (reply) regarding snmpUnknownPDUHandlers, the agent used the wrong OID. OTP-9747 --- lib/snmp/src/agent/snmpa_mpd.erl | 28 +++++++++++++++++++--------- lib/snmp/src/app/snmp.appup.src | 16 ++++++++++++++++ 2 files changed, 35 insertions(+), 9 deletions(-) (limited to 'lib/snmp/src') diff --git a/lib/snmp/src/agent/snmpa_mpd.erl b/lib/snmp/src/agent/snmpa_mpd.erl index fd75b98f84..e9d6cdeaa8 100644 --- a/lib/snmp/src/agent/snmpa_mpd.erl +++ b/lib/snmp/src/agent/snmpa_mpd.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -463,15 +463,10 @@ v3_proc(NoteStore, Packet, LocalEngineID, V3Hdr, Data, Log) -> _ -> %% 4.2.2.1.2 NIsReportable = snmp_misc:is_reportable_pdu(Type), - Val = inc(snmpUnknownPDUHandlers), ErrorInfo = - {#varbind{oid = ?snmpUnknownPDUHandlers, - variabletype = 'Counter32', - value = Val}, - SecName, - [{securityLevel, SecLevel}, - {contextEngineID, ContextEngineID}, - {contextName, ContextName}]}, + snmpUnknownPDUHandlers_ei(SecName, SecLevel, + ContextEngineID, + ContextName), case generate_v3_report_msg(MsgID, MsgSecurityModel, Data, LocalEngineID, @@ -502,6 +497,21 @@ v3_proc(NoteStore, Packet, LocalEngineID, V3Hdr, Data, Log) -> end end. +make_error_info(Variable, Oid, SecName, Opts) -> + Val = inc(Variable), + VB = #varbind{oid = Oid, + variabletype = 'Counter32', + value = Val}, + {VB, SecName, Opts}. + +snmpUnknownPDUHandlers_ei(SecName, SecLevel, + ContextEngineID, ContextName) -> + Opts = [{securityLevel, SecLevel}, + {contextEngineID, ContextEngineID}, + {contextName, ContextName}], + make_error_info(snmpUnknownPDUHandlers, + ?snmpUnknownPDUHandlers_instance, + SecName, Opts). get_security_module(?SEC_USM) -> snmpa_usm; diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 4ac6daf579..38a396aaa0 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -22,9 +22,15 @@ %% ----- U p g r a d e ------------------------------------------------------- [ + {"4.17.3", + [ + {load_module, snmpa_mpd, soft_purge, soft_purge, []} + ] + }, {"4.17.2", [ {load_module, snmpa, soft_purge, soft_purge, []}, + {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, @@ -36,6 +42,7 @@ {"4.17.1", [ {load_module, snmpa, soft_purge, soft_purge, []}, + {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, @@ -49,6 +56,7 @@ {"4.17", [ {load_module, snmpa, soft_purge, soft_purge, []}, + {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, @@ -135,9 +143,15 @@ %% ------D o w n g r a d e --------------------------------------------------- [ + {"4.17.3", + [ + {load_module, snmpa_mpd, soft_purge, soft_purge, []} + ] + }, {"4.17.2", [ {load_module, snmpa, soft_purge, soft_purge, []}, + {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, @@ -149,6 +163,7 @@ {"4.17.1", [ {load_module, snmpa, soft_purge, soft_purge, []}, + {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, @@ -162,6 +177,7 @@ {"4.17", [ {load_module, snmpa, soft_purge, soft_purge, []}, + {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, -- cgit v1.2.3