aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2011-07-12 14:29:01 +0200
committerMicael Karlberg <[email protected]>2011-07-12 14:29:01 +0200
commit55d5d63357f4a4c25461aba837a8e473870062d9 (patch)
treede872823fd39419eebdf7c9348d2978ee06803fe /lib/snmp/src
parent8fceb07c652025c3742b6ba604460c853f7a2ad5 (diff)
parent8c4b1a7189b918a298e81014b3309e8d129aeed9 (diff)
downloadotp-55d5d63357f4a4c25461aba837a8e473870062d9.tar.gz
otp-55d5d63357f4a4c25461aba837a8e473870062d9.tar.bz2
otp-55d5d63357f4a4c25461aba837a8e473870062d9.zip
Merge branch 'bmk/snmp/agent/wrong_default_transport_domain/OTP-9425' into bmk/snmp/manager/transport_domain/OTP-9305
Conflicts: lib/snmp/doc/src/notes.xml lib/snmp/src/agent/snmpa_mpd.erl lib/snmp/src/app/snmp.appup.src lib/snmp/vsn.mk
Diffstat (limited to 'lib/snmp/src')
-rw-r--r--lib/snmp/src/agent/snmp_target_mib.erl5
-rw-r--r--lib/snmp/src/agent/snmpa_mpd.erl25
-rw-r--r--lib/snmp/src/app/snmp.appup.src14
3 files changed, 36 insertions, 8 deletions
diff --git a/lib/snmp/src/agent/snmp_target_mib.erl b/lib/snmp/src/agent/snmp_target_mib.erl
index 77910541a2..25b3dab088 100644
--- a/lib/snmp/src/agent/snmp_target_mib.erl
+++ b/lib/snmp/src/agent/snmp_target_mib.erl
@@ -53,7 +53,7 @@
%%-----------------------------------------------------------------
default_domain() ->
- snmpUDPDomain.
+ transportDomainUdpIpv4.
%%-----------------------------------------------------------------
@@ -436,7 +436,8 @@ is_valid_tag(TDomain, TAddress, Tag, Key) ->
%% TargAddrs =
%% [{TagList, TargetAddr, TargetAddrName, TargetParams, Timeout, Retry}]
-%% TargetAddr = {TDomain, TAddr}; e.g. {?snmpUDPDomain, IpAndUdpPortAsList}
+%% TargetAddr = {TDomain, TAddr}; e.g.
+%% {?transportDomainUdpIpv4, IpAndUdpPortAsList}
get_target_addrs() ->
get_target_addrs([], db(snmpTargetAddrTable), []).
diff --git a/lib/snmp/src/agent/snmpa_mpd.erl b/lib/snmp/src/agent/snmpa_mpd.erl
index 5d276fd6de..21c333b950 100644
--- a/lib/snmp/src/agent/snmpa_mpd.erl
+++ b/lib/snmp/src/agent/snmpa_mpd.erl
@@ -1069,6 +1069,8 @@ transform_taddr(?transportDomainUdpIpv4, [A, B, C, D, P1, P2]) ->
Port = P1 bsl 8 + P2,
Address = {Addr, Port},
{ok, {Domain, Address}};
+transform_taddr(?transportDomainUdpIpv4, BadAddr) ->
+ {error, {bad_transportDomainUdpIpv4_address, BadAddr}};
transform_taddr(?transportDomainUdpIpv6,
[A1, A2, A3, A4, A5, A6, A7, A8, P1, P2]) ->
Domain = transportDomainUdpIpv6,
@@ -1076,8 +1078,10 @@ transform_taddr(?transportDomainUdpIpv6,
Port = P1 bsl 8 + P2,
Address = {Addr, Port},
{ok, {Domain, Address}};
-transform_taddr(_TDomain, _TAddress) ->
- error.
+transform_taddr(?transportDomainUdpIpv6, BadAddr) ->
+ {error, {bad_transportDomainUdpIpv6_address, BadAddr}};
+transform_taddr(BadTDomain, BadTAddress) ->
+ {error, {bad_domain, BadTDomain, BadTAddress}}.
process_taddrs(Dests) ->
@@ -1098,21 +1102,30 @@ process_taddrs([{{TDomain, TAddress}, SecData} | T], Acc) ->
"~n SecData: ~p", [TDomain, TAddress, SecData]),
case transform_taddr(TDomain, TAddress) of
{ok, DestAddr} ->
+ ?vtrace("process_taddrs -> transformed: "
+ "~n DestAddr: ~p", [DestAddr]),
Entry = {DestAddr, SecData},
process_taddrs(T, [Entry | Acc]);
- error ->
+ {error, Reason} ->
+ ?vinfo("Failed transforming v3 domain and address"
+ "~n Reason: ~p", [Reason]),
user_err("Bad TDomain/TAddress: ~w/~w", [TDomain, TAddress]),
process_taddrs(T, Acc)
end;
%% v1 & v2
process_taddrs([{TDomain, TAddress} | T], Acc) ->
- ?vtrace("process_taddrs -> entry when v3 with"
+ ?vtrace("process_taddrs -> entry when v1/v2 with"
"~n TDomain: ~p"
"~n TAddress: ~p", [TDomain, TAddress]),
case transform_taddr(TDomain, TAddress) of
- {ok, Entry} ->
+ {ok, DestAddr} ->
+ ?vtrace("process_taddrs -> transformed: "
+ "~n DestAddr: ~p", [DestAddr]),
+ Entry = DestAddr,
process_taddrs(T, [Entry | Acc]);
- error ->
+ {error, Reason} ->
+ ?vinfo("Failed transforming v1/v2 domain and address: "
+ "~n Reason: ~p", [Reason]),
user_err("Bad TDomain/TAddress: ~w/~w", [TDomain, TAddress]),
process_taddrs(T, Acc)
end;
diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src
index edf3555b6c..3c82ad56ef 100644
--- a/lib/snmp/src/app/snmp.appup.src
+++ b/lib/snmp/src/app/snmp.appup.src
@@ -22,8 +22,15 @@
%% ----- U p g r a d e -------------------------------------------------------
[
+ {"4.20.1",
+ [
+ {load_module, snmpa_mpd, soft_purge, soft_purge, []},
+ {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mpd]}
+ ]
+ },
{"4.20",
[
+ {load_module, snmp_target_mib, soft_purge, soft_purge, []},
{load_module, snmpa_mpd, soft_purge, soft_purge, []},
{update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mpd]}
]
@@ -115,8 +122,15 @@
%% ------D o w n g r a d e ---------------------------------------------------
[
+ {"4.20.1",
+ [
+ {load_module, snmpa_mpd, soft_purge, soft_purge, []},
+ {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mpd]}
+ ]
+ },
{"4.20",
[
+ {load_module, snmp_target_mib, soft_purge, soft_purge, []},
{load_module, snmpa_mpd, soft_purge, soft_purge, []},
{update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mpd]}
]