: Login("NOT SERIALIZED")
, Password("NOT SERIALIZED")
, ActualIP("0.0.0.0")
+ , ActualIPIsBurnt(false)
, UpdateInterval(15)
, MaxUpdatesWithinInterval(3)
, MaxEqualUpdatesInSuccession(2)
* Checks if update will exceed max update interval or if the IP address is burnt.
* @param current_time Current time.
* @param changed_to_online True if we just changed to online, false if we were already online
+ * @param ip_host The new ip to set for the hostname.
* @return True if update is allowed, false if update would exceed max update interval.
*/
bool Service::update_allowed(const time_t current_time, bool changed_to_online, const std::string& ip_host)
i++;
}
+ if (ActualIPIsBurnt)
+ {
+ // Changed IP address removes the "burnt state"
+ if (ip_host != ActualIP)
+ ActualIPIsBurnt = false;
+ else
+ {
+ // IP is burnt and didn't change -> Update not allowed
+ return false;
+ }
+ }
+
// Check for burnt IP.
// Only check for burnt IP address if there are at least max_equal_updates_in_succession entries in the last_updates map.
if ( (MaxEqualUpdatesInSuccession != 0) && ((int)LastUpdates.size() >= MaxEqualUpdatesInSuccession) )
if ( ip_burnt )
{
- // IP Address is burnt. Too many updates in succession with the same IP.
+ // IP Address is burnt. Too many updates in succession with the same IP. Log once.
Log->print_ip_burnt(ip_host,get_service_name());
+ ActualIPIsBurnt = true;
return false;
}
}