diff options
Diffstat (limited to 'lib/snmp')
-rw-r--r-- | lib/snmp/src/agent/snmpa_net_if.erl | 15 | ||||
-rw-r--r-- | lib/snmp/src/manager/snmpm_net_if.erl | 8 | ||||
-rw-r--r-- | lib/snmp/src/misc/snmp_log.erl | 10 | ||||
-rw-r--r-- | lib/snmp/vsn.mk | 2 |
4 files changed, 27 insertions, 8 deletions
diff --git a/lib/snmp/src/agent/snmpa_net_if.erl b/lib/snmp/src/agent/snmpa_net_if.erl index bc0777a7dd..3a91cf4033 100644 --- a/lib/snmp/src/agent/snmpa_net_if.erl +++ b/lib/snmp/src/agent/snmpa_net_if.erl @@ -945,6 +945,12 @@ system_terminate(Reason, _Parent, _Dbg, #state{log = Log}) -> do_close_log(Log), exit(Reason). +system_code_change(OldState, _Module, _OldVsn, downgrade_to_pre_4_16) -> + {OldLog, Type} = OldState#state.log, + NewLog = snmp_log:downgrade(OldLog), + NewState = OldState#state{log = {NewLog, Type}}, + {ok, NewState}; + system_code_change(OldState, _Module, _OldVsn, upgrade_from_pre_4_16) -> Initial = ?ATL_SEQNO_INITIAL, Max = ?ATL_SEQNO_MAX, @@ -952,12 +958,11 @@ system_code_change(OldState, _Module, _OldVsn, upgrade_from_pre_4_16) -> Function = increment_counter, Args = [atl_seqno, Initial, Max], SeqNoGen = {Module, Function, Args}, - NewLog = snmp_log:upgrade(OldState#state.log, SeqNoGen), - NewState = OldState#state{log = NewLog}, - {ok, NewState}; -system_code_change(OldState, _Module, _OldVsn, downgrade_to_pre_4_16) -> - NewState = OldState#state{log = snmp_log:downgrade(OldState#state.log)}, + {OldLog, Type} = OldState#state.log, + NewLog = snmp_log:upgrade(OldLog, SeqNoGen), + NewState = OldState#state{log = {NewLog, Type}}, {ok, NewState}; + system_code_change(S, _Module, _OldVsn, _Extra) -> {ok, S}. diff --git a/lib/snmp/src/manager/snmpm_net_if.erl b/lib/snmp/src/manager/snmpm_net_if.erl index 4ec24af7f3..ad39157721 100644 --- a/lib/snmp/src/manager/snmpm_net_if.erl +++ b/lib/snmp/src/manager/snmpm_net_if.erl @@ -464,13 +464,17 @@ do_close_log(_) -> code_change({down, _Vsn}, OldState, downgrade_to_pre_4_16) -> ?d("code_change(down) -> entry", []), - State = OldState#state{log = snmp_log:downgrade(OldState#state.log)}, + {OldLog, Type} = OldState#state.log, + NewLog = snmp_log:downgrade(OldLog), + State = OldState#state{log = {NewLog, Type}}, {ok, State}; % upgrade code_change(_Vsn, OldState, upgrade_from_pre_4_16) -> ?d("code_change(up) -> entry", []), - State = OldState#state{log = snmp_log:upgrade(OldState#state.log)}, + {OldLog, Type} = OldState#state.log, + NewLog = snmp_log:upgrade(OldLog), + State = OldState#state{log = {NewLog, Type}}, {ok, State}; code_change(_Vsn, State, _Extra) -> diff --git a/lib/snmp/src/misc/snmp_log.erl b/lib/snmp/src/misc/snmp_log.erl index 9f4fdf97ca..f9aa911817 100644 --- a/lib/snmp/src/misc/snmp_log.erl +++ b/lib/snmp/src/misc/snmp_log.erl @@ -115,6 +115,11 @@ create(Name, File, SeqNoGen, Size, Repair, Notify) -> close(#snmp_log{id = Log}) -> ?vtrace("close -> entry with" "~n Log: ~p", [Log]), + do_close(Log); +close(Log) -> + do_close(Log). + +do_close(Log) -> disk_log:close(Log). @@ -345,6 +350,11 @@ next_seqno(_) -> %% -- change_size --- change_size(#snmp_log{id = Log}, NewSize) -> + do_change_size(Log, NewSize); +change_size(Log, NewSize) -> + do_change_size(Log, NewSize). + +do_change_size(Log, NewSize) -> ?vtrace("change_size -> entry with" "~n Log: ~p" "~n NewSize: ~p", [Log, NewSize]), diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk index d78a2cec7a..a6991cc04b 100644 --- a/lib/snmp/vsn.mk +++ b/lib/snmp/vsn.mk @@ -18,7 +18,7 @@ # %CopyrightEnd% SNMP_VSN = 4.16 -PRE_VSN =-p01 +PRE_VSN =-p02 APP_VSN = "snmp-$(SNMP_VSN)$(PRE_VSN)" TICKETS = OTP-8395 |