diff options
author | Micael Karlberg <[email protected]> | 2011-03-28 18:30:22 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-03-28 18:30:22 +0200 |
commit | 618cf53ef3fddc032857a5a8011f041f46ba7886 (patch) | |
tree | b6983e14b74e97ac44c2192dae9ee22e26552f73 | |
parent | b79bf6baf1c2bc4415baec4b1072724303d1d765 (diff) | |
parent | 5f4c56191dd2ff41768b3ac2873a61da934298fc (diff) | |
download | otp-618cf53ef3fddc032857a5a8011f041f46ba7886.tar.gz otp-618cf53ef3fddc032857a5a8011f041f46ba7886.tar.bz2 otp-618cf53ef3fddc032857a5a8011f041f46ba7886.zip |
Merge branch 'bmk/snmp/support_ipv6_transport_address' into bmk/snmp/snmp420_integration
OTP-9088
-rw-r--r-- | lib/snmp/src/misc/snmp_config.erl | 17 | ||||
-rw-r--r-- | lib/snmp/src/misc/snmp_misc.erl | 9 |
2 files changed, 22 insertions, 4 deletions
diff --git a/lib/snmp/src/misc/snmp_config.erl b/lib/snmp/src/misc/snmp_config.erl index 91a6550b0a..813942225e 100644 --- a/lib/snmp/src/misc/snmp_config.erl +++ b/lib/snmp/src/misc/snmp_config.erl @@ -491,6 +491,9 @@ config_agent_snmp(Dir, Vsns) -> Host = host(), AgentIP = ask("5. IP address for the agent (only used as id ~n" " when sending traps)", Host, fun verify_address/1), + %% We intentionally skip TDomain... + %% If the user wish to use IPv6, the user must create an dummy entry here + %% and then manually edit these entries later. ManagerIP = ask("6. IP address for the manager (only this manager ~n" " will have access to the agent, traps are sent ~n" " to this one)", Host, fun verify_address/1), @@ -1062,9 +1065,19 @@ verify_sec_type(ST) -> {error, "invalid security type: " ++ ST}. verify_address(A) -> - case (catch snmp_misc:ip(A)) of + verify_address(A, snmpUDPDomain). + +verify_address(A, snmpUDPDomain = _Domain) -> + do_verify_address(A, inet); +verify_address(A, transportDomainUdpIpv4 = _Domain) -> + do_verify_address(A, inet); +verify_address(A, transportDomainUdpIpv6 = _Domain) -> + do_verify_address(A, inet6). + +do_verify_address(A, Family) -> + case (catch snmp_misc:ip(A, Family)) of {ok, IP} -> - {ok, tuple_to_list(IP)}; + {ok, tuple_to_list(IP)}; {error, _} -> {error, "invalid address: " ++ A}; _E -> diff --git a/lib/snmp/src/misc/snmp_misc.erl b/lib/snmp/src/misc/snmp_misc.erl index 1b535743a4..2dce76992b 100644 --- a/lib/snmp/src/misc/snmp_misc.erl +++ b/lib/snmp/src/misc/snmp_misc.erl @@ -347,10 +347,15 @@ bits_to_int([Kibble|Ks],Kibbles,Res) -> %%---------------------------------------------------------------------- -%% Returns: {ok, {int(),int(),int(),int()}} | {error, Reason} +%% Returns: {ok, {int(),int(),int(),int()}} | +%% {ok, {int(),int(),int(),int()},int(),int(),int(),int()} | +%% {error, Reason} %%---------------------------------------------------------------------- ip(Host) -> - inet:getaddr(Host, inet). + ip(Host, inet). + +ip(Host, Family) -> + inet:getaddr(Host, Family). ensure_trailing_dir_delimiter([]) -> "/"; ensure_trailing_dir_delimiter(DirSuggestion) -> |