aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/agent/snmp_target_mib.erl
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2014-04-11 16:14:00 +0200
committerRaimo Niskanen <[email protected]>2014-07-22 09:59:15 +0200
commit7bc7e5821ea0614ca82467bf0349f82b61d89971 (patch)
tree7e805194510601fa7394320742da3da846bc9a1f /lib/snmp/src/agent/snmp_target_mib.erl
parent768a6d38597b8bedf6551ad2e6472b2965765dd2 (diff)
downloadotp-7bc7e5821ea0614ca82467bf0349f82b61d89971.tar.gz
otp-7bc7e5821ea0614ca82467bf0349f82b61d89971.tar.bz2
otp-7bc7e5821ea0614ca82467bf0349f82b61d89971.zip
wip
Diffstat (limited to 'lib/snmp/src/agent/snmp_target_mib.erl')
-rw-r--r--lib/snmp/src/agent/snmp_target_mib.erl22
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/snmp/src/agent/snmp_target_mib.erl b/lib/snmp/src/agent/snmp_target_mib.erl
index 6dd3b6e23a..cff1e253c3 100644
--- a/lib/snmp/src/agent/snmp_target_mib.erl
+++ b/lib/snmp/src/agent/snmp_target_mib.erl
@@ -263,16 +263,16 @@ check_target_addr(
TagList, Params, EngineId, Mask, MMS]),
snmp_conf:check_string(Name,{gt,0}),
snmp_conf:check_domain(Domain),
- snmp_conf:check_address(Domain, Address),
+ NAddress = snmp_conf:check_address(Domain, Address),
snmp_conf:check_integer(Timeout, {gte, 0}),
snmp_conf:check_integer(RetryCount, {gte,0}),
snmp_conf:check_string(TagList),
snmp_conf:check_string(Params),
check_engine_id(EngineId),
- check_mask(Domain, Mask),
+ NMask = check_mask(Domain, Mask),
TDomain = snmp_conf:mk_tdomain(Domain),
- TAddress = snmp_conf:mk_taddress(Domain, Address),
- TMask = snmp_conf:mk_taddress(Domain, Mask),
+ TAddress = snmp_conf:mk_taddress(Domain, NAddress),
+ TMask = snmp_conf:mk_taddress(Domain, NMask),
snmp_conf:check_packet_size(MMS),
?vtrace("check target address done",[]),
Addr = {Name, TDomain, TAddress, Timeout,
@@ -286,13 +286,21 @@ check_engine_id(discovery) ->
check_engine_id(EngineId) ->
snmp_conf:check_string(EngineId).
+check_address(Domain, Address) ->
+ case snmp_conf:check_address(Domain, Address) of
+ ok ->
+ Address;
+ {ok, FixedAddress} ->
+ FixedAddress
+ end.
+
check_mask(_Domain, []) ->
- ok;
+ [];
check_mask(Domain, Mask) ->
- try snmp_conf:check_address(Domain, Mask)
+ try check_address(Domain, Mask)
catch
{error, {invalid_address, Info}} ->
- {error, {invalid_mask, Info}}
+ error({invalid_mask, Info})
end.
%%-----------------------------------------------------------------