If the reauthentication is scheduled while rekeying, the difference
might be negative, however, schedule_job() takes an unsigned int,
so the reauth would get scheduled very far in the future.
time_t reauth, delete, now = time_monotonic(NULL);
this->stats[STAT_REAUTH] = other->stats[STAT_REAUTH];
- reauth = this->stats[STAT_REAUTH] - now;
+ reauth = max(0, this->stats[STAT_REAUTH] - now);
delete = reauth + this->peer_cfg->get_over_time(this->peer_cfg);
this->stats[STAT_DELETE] = this->stats[STAT_REAUTH] + delete;
DBG1(DBG_IKE, "rescheduling reauthentication in %ds after rekeying, "