diff options
author | Erlang/OTP <[email protected]> | 2013-07-08 11:55:53 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2013-07-08 11:55:53 +0200 |
commit | d0f3453270325374a76f0f86215783f8a3475c56 (patch) | |
tree | 681027f78717162c62cbcd55c314907d536784dd /lib/snmp/src/misc/snmp_conf.erl | |
parent | adc8b048e72ad774a431b32088b4df8b47d509f8 (diff) | |
parent | a020287158a6faedfcacb3c14a4e63e59194dfce (diff) | |
download | otp-d0f3453270325374a76f0f86215783f8a3475c56.tar.gz otp-d0f3453270325374a76f0f86215783f8a3475c56.tar.bz2 otp-d0f3453270325374a76f0f86215783f8a3475c56.zip |
Merge branch 'bmk/snmp/snmp4241_integration/r16' into maint-r16
* bmk/snmp/snmp4241_integration/r16:
[snmp/agent] Cleanup, renaming, appup, proper version and release notes
[snmp/agent] Local DB counter increment wrap error
SNMP/VACM: bugfix for vacmViewTreeFamilyMask
Diffstat (limited to 'lib/snmp/src/misc/snmp_conf.erl')
-rw-r--r-- | lib/snmp/src/misc/snmp_conf.erl | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/lib/snmp/src/misc/snmp_conf.erl b/lib/snmp/src/misc/snmp_conf.erl index e1e7fab57b..46625989d5 100644 --- a/lib/snmp/src/misc/snmp_conf.erl +++ b/lib/snmp/src/misc/snmp_conf.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2012. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -50,6 +50,7 @@ check_packet_size/1, check_oid/1, + check_imask/1, check_emask/1, check_mp_model/1, check_sec_model/1, check_sec_model/2, check_sec_model/3, @@ -488,6 +489,7 @@ do_check_timer(WaitFor, Factor, Incr, Retry) -> check_integer(Retry, {gte, 0}), ok. + %% --------- all_domains() -> @@ -618,6 +620,37 @@ check_oid(X) -> %% --------- +%% Check a (view) mask in the internal form (all 0 and 1): +check_imask(null) -> + {ok, []}; +check_imask(IMask) when is_list(IMask) -> + do_check_imask(IMask), + {ok, IMask}. + +do_check_imask([0|IMask]) -> + do_check_imask(IMask); +do_check_imask([1|IMask]) -> + do_check_imask(IMask); +do_check_imask([X|_]) -> + error({invalid_internal_mask_element, X}). + + +%% Check a (view) mask in the external form (according to MIB, +%% an OCTET STRING of at most length 16). +check_emask(EMask) when is_list(EMask) andalso (length(EMask) =< 16) -> + do_check_emask(EMask). + +do_check_emask([]) -> + ok; +do_check_emask([X|EMask]) + when is_integer(X) andalso (X >= 16#00) andalso (X =< 16#FF) -> + do_check_emask(EMask); +do_check_emask([X|_]) -> + error({invalid_external_mask_element, X}). + + +%% --------- + all_integer([H|T]) when is_integer(H) -> all_integer(T); all_integer([_H|_T]) -> false; all_integer([]) -> true. |