diff options
author | Micael Karlberg <[email protected]> | 2011-07-12 14:29:01 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-07-12 14:29:01 +0200 |
commit | 55d5d63357f4a4c25461aba837a8e473870062d9 (patch) | |
tree | de872823fd39419eebdf7c9348d2978ee06803fe /lib/snmp/src/agent | |
parent | 8fceb07c652025c3742b6ba604460c853f7a2ad5 (diff) | |
parent | 8c4b1a7189b918a298e81014b3309e8d129aeed9 (diff) | |
download | otp-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/agent')
-rw-r--r-- | lib/snmp/src/agent/snmp_target_mib.erl | 5 | ||||
-rw-r--r-- | lib/snmp/src/agent/snmpa_mpd.erl | 25 |
2 files changed, 22 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; |