file_map_t map;
const char *p, *end;
uint32_t ips = 0;
+ time_t now = time(0);
if (!file_map_open(&map, file, false)) {
return NULL;
rbldb_resource_t *res = resource_get("iplist", file);
if (res == NULL) {
- debug("No resource found");
res = p_new(rbldb_resource_t, 1);
resource_set("iplist", file, res, (resource_destructor_t)rbldb_resource_wipe);
}
db->filename = m_strdup(file);
db->ips = res->ips;
if (map.st.st_size == res->size && map.st.st_mtime == res->mtime) {
- info("rbl %s up to date", file);
+ info("%s loaded: already up-to-date", file);
file_map_close(&map);
return db;
}
- debug("mtime %d/%d, size %d/%d", (int)map.st.st_mtime, (int)res->mtime, (int)map.st.st_size, (int)res->size);
res->size = map.st.st_size;
res->mtime = map.st.st_mtime;
--end;
}
if (end != map.end) {
- warn("file %s miss a final \\n, ignoring last line",
- file);
+ warn("%s: final \\n missing, ignoring last line", file);
}
while (p < end) {
}
}
- info("rbl %s loaded, %d IPs", file, ips);
+ info("%s loaded: done in %us, %u IPs", file, (uint32_t)(time(0) - now), ips);
return db;
}
const iplist_filter_t *data = filter->data;
bool error = true;
- if (parse_ipv4(query->client_address, &end, &ip) != 0) {
- if (strchr(query->client_address, ':')) {
+ if (parse_ipv4(query->client_address.str, &end, &ip) != 0) {
+ if (strchr(query->client_address.str, ':')) {
/* iplist only works on IPv4 */
return HTK_FAIL;
}
warn("invalid client address: %s, expected ipv4",
- query->client_address);
+ query->client_address.str);
return HTK_ERROR;
}
for (uint32_t i = 0 ; i < data->rbls.len ; ++i) {