aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/agent/snmpa_set_lib.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2011-11-28 11:52:30 +0100
committerErlang/OTP <[email protected]>2011-11-28 11:52:30 +0100
commit021d5c2e49e623d4f43c0cc88a097bc99f3564e6 (patch)
tree964b58e697295c51afd7eeffec45766180f4aa05 /lib/snmp/src/agent/snmpa_set_lib.erl
parent2b05cc74d7f5000f70fc05d5bb964fe38f8d620c (diff)
parentb05fda981594800fbeec61e37a4932e23b9edabb (diff)
downloadotp-021d5c2e49e623d4f43c0cc88a097bc99f3564e6.tar.gz
otp-021d5c2e49e623d4f43c0cc88a097bc99f3564e6.tar.bz2
otp-021d5c2e49e623d4f43c0cc88a097bc99f3564e6.zip
Merge branch 'bmk/snmp/snmp4213_integration' into maint-r14
* bmk/snmp/snmp4213_integration: Added make targets for building an snmp dialyzer plt. [compiler] Fix the --warnings/--W option parsing in the snmpc wrapper script. The short warning option was incorrectly '--w', instead of as documented '--W'. This has now been corrected. Tuncer Ayaz OTP-9718 [compiler] Improved version info printout from the MIB compiler frontend escript. OTP-9618 [agent] When sending an error message (reply) regarding snmpUnknownPDUHandlers, the agent used the wrong OID. OTP-9747 Updated appup file and release notes. OTP-9745 [agent] Version 4.20 introduced a change that broke trap sending from subagents. Due to a bug in the test code, this was not discovered, until that bug was fixed. OTP-9745 Upped the version in prep of patch. OTP-9748 Fixed expect function, which basically ignored detected errors. Also added more printouts to make it easier to follow the flow of the test. In the same spirit, changed the tags in some of the test cases so that it would be possible to distinguish one expect call form another (not always possible since some functions are used by several test cases). OTP-9748
Diffstat (limited to 'lib/snmp/src/agent/snmpa_set_lib.erl')
-rw-r--r--lib/snmp/src/agent/snmpa_set_lib.erl63
1 files changed, 41 insertions, 22 deletions
diff --git a/lib/snmp/src/agent/snmpa_set_lib.erl b/lib/snmp/src/agent/snmpa_set_lib.erl
index 191029f6db..9f355855b4 100644
--- a/lib/snmp/src/agent/snmpa_set_lib.erl
+++ b/lib/snmp/src/agent/snmpa_set_lib.erl
@@ -143,8 +143,8 @@ consistency_check(Varbinds) ->
consistency_check(Varbinds, []).
consistency_check([{TableOid, TableVbs} | Varbinds], Done) ->
?vtrace("consistency_check -> entry with"
- "~n TableOid: ~p"
- "~n TableVbs: ~p",[TableOid,TableVbs]),
+ "~n TableOid: ~p"
+ "~n TableVbs: ~p", [TableOid, TableVbs]),
TableOpsWithShortOids = deletePrefixes(TableOid, TableVbs),
[#ivarbind{mibentry = MibEntry}|_] = TableVbs,
case is_set_ok_table(MibEntry, TableOpsWithShortOids) of
@@ -158,7 +158,7 @@ consistency_check([{TableOid, TableVbs} | Varbinds], Done) ->
end;
consistency_check([IVarbind | Varbinds], Done) ->
?vtrace("consistency_check -> entry with"
- "~n IVarbind: ~p",[IVarbind]),
+ "~n IVarbind: ~p", [IVarbind]),
#ivarbind{varbind = Varbind, mibentry = MibEntry} = IVarbind,
#varbind{value = Value, org_index = OrgIndex} = Varbind,
case is_set_ok_variable(MibEntry, Value) of
@@ -358,32 +358,39 @@ make_value_a_correct_value(Value, ASN1Type, Mfa) ->
%% Runtime debug support
%%-----------------------------------------------------------------
-% XXX: This function match on the exakt return codes from EXIT
-% messages. As of this writing it was not decided if this is
-% the right way so don't blindly do things this way.
-%
-% We fake a real EXIT signal as the return value because the
-% result is passed to the function snmpa_agent:validate_err()
-% that expect it.
+%% XYZ: This function match on the exakt return codes from EXIT
+%% messages. As of this writing it was not decided if this is
+%% the right way so don't blindly do things this way.
+%%
+%% We fake a real EXIT signal as the return value because the
+%% result is passed to the function snmpa_agent:validate_err()
+%% that expect it.
dbg_apply(M,F,A) ->
- Result =
- case get(verbosity) of
- false ->
- (catch apply(M,F,A));
- _ ->
- ?vlog("~n apply: ~w,~w,~p~n", [M,F,A]),
- Res = (catch apply(M,F,A)),
- ?vlog("~n returned: ~p", [Res]),
- Res
- end,
- case Result of
+ case maybe_verbose_apply(M, F, A) of
+ %% <Future proofing>
+ %% As of R15 we get extra info containing,
+ %% among other things, line numbers.
+ {'EXIT', {undef, [{M, F, A, _} | _]}} ->
+ {'EXIT', {hook_undef, {M, F, A}}};
+ {'EXIT', {function_clause, [{M, F, A, _} | _]}} ->
+ {'EXIT', {hook_function_clause, {M, F, A}}};
+
+ %% This is really overkill, but just to be on the safe side...
+ {'EXIT', {undef, {M, F, A, _}}} ->
+ {'EXIT', {hook_undef, {M, F, A}}};
+ {'EXIT', {function_clause, {M, F, A, _}}} ->
+ {'EXIT', {hook_function_clause, {M, F, A}}};
+ %% </Future proofing>
+
+
+ %% Old format format for compatibility
{'EXIT', {undef, [{M, F, A} | _]}} ->
{'EXIT', {hook_undef, {M, F, A}}};
{'EXIT', {function_clause, [{M, F, A} | _]}} ->
{'EXIT', {hook_function_clause, {M, F, A}}};
- % XXX: Old format for compatibility
+ % XYZ: Older format for compatibility
{'EXIT', {undef, {M, F, A}}} ->
{'EXIT', {hook_undef, {M, F, A}}};
{'EXIT', {function_clause, {M, F, A}}} ->
@@ -393,3 +400,15 @@ dbg_apply(M,F,A) ->
Result
end.
+
+maybe_verbose_apply(M, F, A) ->
+ case get(verbosity) of
+ false ->
+ (catch apply(M,F,A));
+ _ ->
+ ?vlog("~n apply: ~w,~w,~p~n", [M,F,A]),
+ Res = (catch apply(M,F,A)),
+ ?vlog("~n returned: ~p", [Res]),
+ Res
+ end.
+