some DNS servers return an extremely short TTL causing all kinds of fun.
This patch ensures that we just enforce a minimum TTL of 30 seconds.
* when setting the cache entry life time. The value is in seconds.
*/
#define MAX_CACHE_TTL (60 * 30)
* when setting the cache entry life time. The value is in seconds.
*/
#define MAX_CACHE_TTL (60 * 30)
+/*
+ * Also limit the other end, cache at least for 30 seconds.
+ */
+#define MIN_CACHE_TTL (30)
/*
* We limit the cache size to some sane value so that cached data does
/*
* We limit the cache size to some sane value so that cached data does
+ if (ttl < MIN_CACHE_TTL)
+ ttl = MIN_CACHE_TTL;
+
data->inserted = current_time;
data->type = type;
data->answers = answers;
data->inserted = current_time;
data->type = type;
data->answers = answers;