aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/misc
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2014-06-26 10:50:24 +0200
committerRaimo Niskanen <[email protected]>2014-07-25 12:17:50 +0200
commitdfb5cf6e2406486eeb7fbd89bf9118a6411bd5f2 (patch)
tree81418cc24ba9b30b07b93c300390031e9521ec4e /lib/snmp/src/misc
parent1ebfcb6f1f013e62aabc9935c878a55b788967a9 (diff)
downloadotp-dfb5cf6e2406486eeb7fbd89bf9118a6411bd5f2.tar.gz
otp-dfb5cf6e2406486eeb7fbd89bf9118a6411bd5f2.tar.bz2
otp-dfb5cf6e2406486eeb7fbd89bf9118a6411bd5f2.zip
Rewrite agent for IPv4 + IPv6
Diffstat (limited to 'lib/snmp/src/misc')
-rw-r--r--lib/snmp/src/misc/snmp_conf.erl8
-rw-r--r--lib/snmp/src/misc/snmp_config.erl12
2 files changed, 17 insertions, 3 deletions
diff --git a/lib/snmp/src/misc/snmp_conf.erl b/lib/snmp/src/misc/snmp_conf.erl
index 82cbf42e35..f4483995cb 100644
--- a/lib/snmp/src/misc/snmp_conf.erl
+++ b/lib/snmp/src/misc/snmp_conf.erl
@@ -223,13 +223,17 @@ read_check(_, _, [], _, Res) ->
lists:reverse(Res);
read_check(File, Check, [{StartLine, Row, EndLine}|Lines], State, Res) ->
try Check(Row, State) of
+ {Rows, NewState} when is_list(Rows) ->
+ ?vtrace("read_check -> ok:~n"
+ " Rows: ~p~n", [Rows]),
+ read_check(File, Check, Lines, NewState, Rows ++ Res);
{ok, NewState} ->
?vtrace("read_check -> ok", []),
- read_check(File, Check, Lines, NewState, [Row|Res]);
+ read_check(File, Check, Lines, NewState, [Row | Res]);
{{ok, NewRow}, NewState} ->
?vtrace("read_check -> ok:~n"
" NewRow: ~p~n", [NewRow]),
- read_check(File, Check, Lines, NewState, [NewRow|Res])
+ read_check(File, Check, Lines, NewState, [NewRow | Res])
catch
{error, Reason} ->
?vtrace("read_check -> error:~n"
diff --git a/lib/snmp/src/misc/snmp_config.erl b/lib/snmp/src/misc/snmp_config.erl
index 38e248c326..91240082f1 100644
--- a/lib/snmp/src/misc/snmp_config.erl
+++ b/lib/snmp/src/misc/snmp_config.erl
@@ -33,7 +33,7 @@
-export([write_agent_snmp_files/7, write_agent_snmp_files/12,
write_agent_snmp_files/6, write_agent_snmp_files/11,
- write_agent_snmp_conf/5,
+ write_agent_snmp_conf/4, write_agent_snmp_conf/5,
write_agent_snmp_context_conf/1,
write_agent_snmp_community_conf/1,
write_agent_snmp_standard_conf/2,
@@ -1650,6 +1650,12 @@ write_agent_snmp_files(
%% ------ [agent] agent.conf ------
%%
+write_agent_snmp_conf(Dir, Transports, EngineID, MMS) ->
+ Conf =
+ [{intAgentTransports, Transports},
+ {snmpEngineID, EngineID},
+ {snmpEngineMaxMessageSize, MMS}],
+ do_write_agent_snmp_conf(Dir, Conf).
write_agent_snmp_conf(Dir, Domain, AgentAddr, EngineID, MMS)
when is_atom(Domain) ->
@@ -2513,6 +2519,8 @@ write_config_file(Dir, FileName, Order, Check, Write, Entries)
lists:foldl(
fun (Entry, State) ->
case Check(Entry, State) of
+ {Ok, NewState} when is_list(Ok) ->
+ NewState;
{ok, NewState} ->
NewState;
{{ok, _}, NewState} ->
@@ -2709,6 +2717,8 @@ verify_lines([], _, _, Acc) ->
verify_lines(
[{StartLine, Term, EndLine}|Lines], Check, State, Acc) ->
try Check(Term, State) of
+ {Terms, NewState} when is_list(Terms) ->
+ verify_lines(Lines, Check, NewState, Terms ++ Acc);
{ok, NewState} ->
verify_lines(Lines, Check, NewState, [Term|Acc]);
{{ok, NewTerm}, NewState} ->