diff options
author | Micael Karlberg <[email protected]> | 2011-07-13 11:00:26 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-07-13 11:00:26 +0200 |
commit | 989fca957acc84d71c67bfe7646f665cca00bac0 (patch) | |
tree | 2350607deeadf431bbba0d6c516b934ae8cdd834 /lib/snmp/src/manager/snmpm_config.erl | |
parent | 5bccd012d163a98dd59191db9f69134ccef49faf (diff) | |
download | otp-989fca957acc84d71c67bfe7646f665cca00bac0.tar.gz otp-989fca957acc84d71c67bfe7646f665cca00bac0.tar.bz2 otp-989fca957acc84d71c67bfe7646f665cca00bac0.zip |
Improved (transport) domain error reporting.
Diffstat (limited to 'lib/snmp/src/manager/snmpm_config.erl')
-rw-r--r-- | lib/snmp/src/manager/snmpm_config.erl | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/snmp/src/manager/snmpm_config.erl b/lib/snmp/src/manager/snmpm_config.erl index e61e7abb31..c2e57abddb 100644 --- a/lib/snmp/src/manager/snmpm_config.erl +++ b/lib/snmp/src/manager/snmpm_config.erl @@ -147,7 +147,7 @@ %% -define(DEF_ADDR_TAG, default_addr_tag). -define(DEFAULT_TARGETNAME, default_agent). -define(DEF_PORT_TAG, default_port_tag). --define(VALID_DOMAINS, [transportDomainUdpIpv4, transportDomainUdpIpv6]). +-define(SUPPORTED_DOMAINS, [transportDomainUdpIpv4, transportDomainUdpIpv6]). -ifdef(snmp_debug). -define(GS_START_LINK(Opts), @@ -3000,15 +3000,20 @@ verify_val(reg_type, RegType) {ok, RegType}; verify_val(tdomain = Item, snmpUDPDomain = _Domain) -> verify_val(Item, transportDomainUdpIpv4); -verify_val(tdomain, TDomain) -> - case lists:member(TDomain, ?VALID_DOMAINS) of +verify_val(tdomain, Domain) -> + case lists:member(Domain, ?SUPPORTED_DOMAINS) of true -> - {ok, TDomain}; + {ok, Domain}; false -> - error({bad_tdomain, TDomain}) + case lists:member(Domain, snmp_conf:all_domains()) of + true -> + error({unsupported_domain, Domain}); + false -> + error({unknown_domain, Domain}) + end end; -verify_val(address, {TDomain, Addr0}) -> - case normalize_address(TDomain, Addr0) of +verify_val(address, {Domain, Addr0}) -> + case normalize_address(Domain, Addr0) of {_A1, _A2, _A3, _A4} = Addr -> {ok, Addr}; {_A1, _A2, _A3, _A4, _A5, _A6, _A7, _A8} = Addr -> |