diff options
author | Raimo Niskanen <[email protected]> | 2014-05-21 14:33:50 +0200 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2014-07-25 12:15:16 +0200 |
commit | e3f49c557c2cf0f4e98bbe538af4142167bac6ad (patch) | |
tree | 96fa44180a6ea625f6dd244ebd4fa9ef44332dc6 /lib/snmp/src/agent/snmp_target_mib.erl | |
parent | cc1ab998ce905cd673c7ea14ee4e31ddb2412350 (diff) | |
download | otp-e3f49c557c2cf0f4e98bbe538af4142167bac6ad.tar.gz otp-e3f49c557c2cf0f4e98bbe538af4142167bac6ad.tar.bz2 otp-e3f49c557c2cf0f4e98bbe538af4142167bac6ad.zip |
Rewrite string representation of addresses and stop printing an error report when snmpa_net_if gets externally killed
Diffstat (limited to 'lib/snmp/src/agent/snmp_target_mib.erl')
-rw-r--r-- | lib/snmp/src/agent/snmp_target_mib.erl | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/lib/snmp/src/agent/snmp_target_mib.erl b/lib/snmp/src/agent/snmp_target_mib.erl index 3bcfd469e6..932829e150 100644 --- a/lib/snmp/src/agent/snmp_target_mib.erl +++ b/lib/snmp/src/agent/snmp_target_mib.erl @@ -679,6 +679,20 @@ snmpTargetAddrTable(print) -> FOI = foi(Table), PrintRow = fun(Prefix, Row) -> + TDomain = element(?snmpTargetAddrTDomain, Row), + Domain = + try snmp_conf:tdomain_to_domain(TDomain) + catch + {error, {bad_tdomain, _}} -> + undefined + end, + TAddress = element(?snmpTargetAddrTAddress, Row), + AddrString = + try snmp_conf:mk_addr_string({Domain, TAddress}) + catch + {error, {bad_address, _}} -> + "-" + end, lists:flatten( io_lib:format("~sName: ~p" "~n~sTDomain: ~p (~w)" @@ -693,21 +707,8 @@ snmpTargetAddrTable(print) -> "~n~s[Ext] TMask: ~p" "~n~s[Ext] MMS: ~p", [Prefix, element(?snmpTargetAddrName, Row), - Prefix, element(?snmpTargetAddrTDomain, Row), - case element(?snmpTargetAddrTDomain, Row) of - ?snmpUDPDomain -> snmpUDPDomain; - ?transportDomainUdpIpv4 -> transportDomainUdpIpv4; - ?transportDomainUdpIpv6 -> transportDomainUdpIpv6; - _ -> undefined - end, - Prefix, element(?snmpTargetAddrTAddress, Row), - case element(?snmpTargetAddrTAddress, Row) of - [A,B,C,D,U1,U2] -> - lists:flatten( - io_lib:format("~w.~w.~w.~w:~w", - [A, B, C, D, U1 bsl 8 + U2])); - _ -> "-" - end, + Prefix, TDomain, Domain, + Prefix, TAddress, AddrString, Prefix, element(?snmpTargetAddrTimeout, Row), Prefix, element(?snmpTargetAddrRetryCount, Row), Prefix, element(?snmpTargetAddrTagList, Row), |