[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #19454 [Core Tor/Tor]: tor crashed when "HeartbeatPeriod 0"



#19454: tor crashed when "HeartbeatPeriod 0"
--------------------------+------------------------------------
 Reporter:  kukabu        |          Owner:
     Type:  defect        |         Status:  new
 Priority:  Medium        |      Milestone:  Tor: 0.2.8.x-final
Component:  Core Tor/Tor  |        Version:  Tor: 0.2.8.4-rc
 Severity:  Blocker       |     Resolution:
 Keywords:  029-proposed  |  Actual Points:
Parent ID:                |         Points:
 Reviewer:                |        Sponsor:
--------------------------+------------------------------------

Comment (by cypherpunks):

 The following patch seems to fix the issue. The `HEARTBEAT_INTERVAL` value
 is a copy of the `MIN_HEARTBEAT_PERIOD` value in src/or/config.c because
 its scope prevented me from reusing it. It would be a good idea to write
 tests for these callback functions to test their intended behavior and
 catch issues like this in the future.

 Also, I'm guessing the `XXXX` comment is referring to checking the return
 value of `log_heartbeat` and changing the return value accordingly. If
 heartbeats are enabled and the callback is successful, i see nothing wrong
 with returning the value of `HeartbeatPeriod`.
 {{{
 diff --git a/src/or/main.c b/src/or/main.c
 index 9f3306d..0967248 100644
 --- a/src/or/main.c
 +++ b/src/or/main.c
 @@ -2007,6 +2007,11 @@ check_fw_helper_app_callback(time_t now, const
 or_options_t *options)
  static int
  heartbeat_callback(time_t now, const or_options_t *options)
  {
 +#define HEARTBEAT_INTERVAL (30*60)
 +  if (!options->HeartbeatPeriod) {
 +    return HEARTBEAT_INTERVAL;
 +  }
 +
    static int first = 1;
    /* 12. write the heartbeat message */
    if (first) {
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/19454#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs