aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/misc/snmp_log.erl
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2014-05-21 15:09:05 +0200
committerRaimo Niskanen <[email protected]>2014-07-25 12:15:16 +0200
commit5b99573e288d3798414958975db41daf5509c0fb (patch)
tree73807557d07309ff8c8ad679866c36b75c746939 /lib/snmp/src/misc/snmp_log.erl
parentaa8f929cb3810b2c5ed67b44392d26131857f8e6 (diff)
downloadotp-5b99573e288d3798414958975db41daf5509c0fb.tar.gz
otp-5b99573e288d3798414958975db41daf5509c0fb.tar.bz2
otp-5b99573e288d3798414958975db41daf5509c0fb.zip
Fix log validation and fix some testcases
Diffstat (limited to 'lib/snmp/src/misc/snmp_log.erl')
-rw-r--r--lib/snmp/src/misc/snmp_log.erl19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/snmp/src/misc/snmp_log.erl b/lib/snmp/src/misc/snmp_log.erl
index a1fd392676..4b22281b89 100644
--- a/lib/snmp/src/misc/snmp_log.erl
+++ b/lib/snmp/src/misc/snmp_log.erl
@@ -231,7 +231,20 @@ validate(Log, SeqNoReq)
validate_seqno(PrevSN, SeqNo),
{Timestamp, SeqNo};
- ({Timestamp, _Packet, _Addr, _Port}, {PrevTS, _PrevSN}) when SeqNoReq =:= true ->
+ ({Timestamp, SeqNo, _Packet, _AddrStr}, {PrevTS, PrevSN})
+ when is_integer(SeqNo) ->
+ ?vtrace("validating log entry when"
+ "~n Timestamp: ~p"
+ "~n SeqNo: ~p"
+ "~n PrevTS: ~p"
+ "~n PrevSN: ~p",
+ [Timestamp, SeqNo, PrevTS, PrevSN]),
+ validate_timestamp(PrevTS, Timestamp),
+ validate_seqno(PrevSN, SeqNo),
+ {Timestamp, SeqNo};
+
+ ({Timestamp, _Packet, _Addr, _Port}, {PrevTS, _PrevSN})
+ when SeqNoReq =:= true ->
?vtrace("validating log entry when"
"~n Timestamp: ~p"
"~n PrevTS: ~p",
@@ -969,8 +982,8 @@ get_type(#pdu{type = Type}) ->
Type.
-ip(Domain, Addr) ->
- snmp_conf:mk_addr_string(Domain, Addr).
+%% ip(Domain, Addr) ->
+%% snmp_conf:mk_addr_string(Domain, Addr).
%% ip({A,B,C,D}) ->
%% io_lib:format("~w.~w.~w.~w", [A,B,C,D]).