aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/misc/snmp_conf.erl
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2014-04-17 16:29:51 +0200
committerRaimo Niskanen <[email protected]>2014-07-25 12:14:44 +0200
commit373d9fa059875a2d68251c485968d3aa78e830b4 (patch)
treebefc6315db5b1da0790120cb12eb03f7bfb9dc16 /lib/snmp/src/misc/snmp_conf.erl
parent7bc7e5821ea0614ca82467bf0349f82b61d89971 (diff)
downloadotp-373d9fa059875a2d68251c485968d3aa78e830b4.tar.gz
otp-373d9fa059875a2d68251c485968d3aa78e830b4.tar.bz2
otp-373d9fa059875a2d68251c485968d3aa78e830b4.zip
wip-all-regression-tests-but-one-manager
Diffstat (limited to 'lib/snmp/src/misc/snmp_conf.erl')
-rw-r--r--lib/snmp/src/misc/snmp_conf.erl16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/snmp/src/misc/snmp_conf.erl b/lib/snmp/src/misc/snmp_conf.erl
index f85f1d3828..3fefe3e8cd 100644
--- a/lib/snmp/src/misc/snmp_conf.erl
+++ b/lib/snmp/src/misc/snmp_conf.erl
@@ -596,6 +596,8 @@ mk_taddress(?transportDomainUdpIpv6, Address) ->
%%
mk_taddress(transportDomainUdpIpv4 = Domain, Address) ->
case Address of
+ [] -> % Empty mask
+ [];
{Ip, Port} when tuple_size(Ip) =:= 4, is_integer(Port) ->
tuple_to_list(Ip) ++ mk_bytes(Port);
_ ->
@@ -603,6 +605,8 @@ mk_taddress(transportDomainUdpIpv4 = Domain, Address) ->
end;
mk_taddress(transportDomainUdpIpv6 = Domain, Address) ->
case Address of
+ [] -> % Empty mask
+ [];
{Ip, Port}
when tuple_size(Ip) =:= 8, is_integer(Port) ->
tuple_to_list(Ip) ++ mk_bytes(Port);
@@ -710,14 +714,14 @@ check_ip(X) ->
check_ip(snmpUDPDomain, X) ->
check_ip(transportDomainUdpIpv4, X);
-check_ip(transportDomainUdpIpv4, X) ->
+check_ip(transportDomainUdpIpv4 = Domain, X) ->
case X of
[A,B,C,D] when ?is_ipv4_addr(A, B, C, D) ->
ok;
_ ->
- error({invalid_ip_address, X})
+ error({bad_address, {Domain, X}})
end;
-check_ip(transportDomainUdpIpv6, X) ->
+check_ip(transportDomainUdpIpv6 = Domain, X) ->
case X of
[A,B,C,D,E,F,G,H]
when ?is_ipv6_addr(A, B, C, D, E, F, G, H) ->
@@ -727,7 +731,7 @@ check_ip(transportDomainUdpIpv6, X) ->
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) ->
ok;
_ ->
- error({invalid_ip_address, X})
+ error({bad_address, {Domain, X}})
end;
%%
check_ip(BadDomain, _X) ->
@@ -744,7 +748,7 @@ check_address(Domain, Address, DefaultPort) ->
false ->
case check_address_ip_port(Domain, Address) of
false ->
- error({invalid_address, {Domain, Address}});
+ error({bad_address, {Domain, Address}});
true ->
{ok, Address};
FixedAddress ->
@@ -759,7 +763,7 @@ check_address(Domain, Address, DefaultPort) ->
check_address(Domain, Address) ->
case check_address_ip_port(Domain, Address) of
false ->
- error({invalid_address, {Domain, Address}});
+ error({bad_address, {Domain, Address}});
true ->
{ok, Address};
FixedAddress ->