aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/manager/snmpm_config.erl
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2014-05-27 08:09:26 +0200
committerRaimo Niskanen <[email protected]>2014-07-25 12:17:49 +0200
commit20bb61e48a8370a4b5913d7d8e16a260bd3e31eb (patch)
tree5f9593b6a24cf479e47839d0df6a201856c6ea74 /lib/snmp/src/manager/snmpm_config.erl
parentf8efe4ff765e9067172d70e0d93f15fb9f8bd98b (diff)
downloadotp-20bb61e48a8370a4b5913d7d8e16a260bd3e31eb.tar.gz
otp-20bb61e48a8370a4b5913d7d8e16a260bd3e31eb.tar.bz2
otp-20bb61e48a8370a4b5913d7d8e16a260bd3e31eb.zip
Mend write_config_file and append_config_file
Diffstat (limited to 'lib/snmp/src/manager/snmpm_config.erl')
-rw-r--r--lib/snmp/src/manager/snmpm_config.erl38
1 files changed, 30 insertions, 8 deletions
diff --git a/lib/snmp/src/manager/snmpm_config.erl b/lib/snmp/src/manager/snmpm_config.erl
index e938a68ab0..b3500d7293 100644
--- a/lib/snmp/src/manager/snmpm_config.erl
+++ b/lib/snmp/src/manager/snmpm_config.erl
@@ -103,8 +103,10 @@
get_agent_mp_model/2
]).
--export([check_manager_config/1,
- check_user_config/1,
+-export([
+ order_manager_config/2,
+ check_manager_config/2,
+ check_user_config/1,
check_agent_config/1,
check_usm_user_config/1]).
@@ -2285,8 +2287,8 @@ is_crypto_supported(Func) ->
%% end.
read_manager_config_file(Dir) ->
- Order = fun snmp_conf:no_order/2,
- Check = fun (Entry, State) -> {check_manager_config(Entry), State} end,
+ Order = fun order_manager_config/2,
+ Check = fun check_manager_config/2,
Conf = read_file(Dir, "manager.conf", Order, Check),
?d("read_manager_config_file -> ok: "
"~n Conf: ~p", [Conf]),
@@ -2309,11 +2311,31 @@ default_manager_config() ->
"~n _Reason: ~p", [_Reason]),
[]
end.
-
-check_manager_config({address, Addr}) ->
- snmp_conf:check_ip(Addr);
+
+order_manager_config(EntryA, EntryB) ->
+ snmp_conf:keyorder(1, EntryA, EntryB, [domain]).
+
+check_manager_config({domain, D}, _Domain) ->
+ {snmp_conf:check_domain(D), D};
+check_manager_config({address = Tag, Ip}, D) ->
+ Domain =
+ case D of
+ undefined ->
+ default_transport_domain();
+ _ ->
+ D
+ end,
+ {case snmp_conf:check_ip(Domain, Ip) of
+ ok ->
+ ok;
+ {ok, FixedIp} ->
+ {ok, {Tag, FixedIp}}
+ end, Domain};
+check_manager_config(Entry, Domain) ->
+ {check_manager_config(Entry), Domain}.
+
check_manager_config({port, Port}) ->
- snmp_conf:check_integer(Port, {gt, 0});
+ snmp_conf:check_port(Port);
check_manager_config({engine_id, EngineID}) ->
snmp_conf:check_string(EngineID);
check_manager_config({max_message_size, Max}) ->