|
37 | 37 | #include "../../parser/parse_from.h" |
38 | 38 | #include "../../mod_fix.h" |
39 | 39 | #include "../../resolve.h" |
| 40 | +#include "../../redact_pii.h" |
40 | 41 |
|
41 | 42 | #include "permissions.h" |
42 | 43 | #include "hash.h" |
@@ -292,25 +293,27 @@ int reload_address_table(struct pm_part_struct *part_struct) |
292 | 293 | mask = (unsigned int) VAL_INT(val + 2); |
293 | 294 |
|
294 | 295 | subnet = mk_net_bitlen(ip_addr, mask); |
295 | | - if (pm_hash_insert(new_hash_table, subnet, group, port, proto, |
296 | | - &str_pattern, &str_info, mask) == -1) { |
297 | | - LM_ERR("hash table insert error\n"); |
298 | | - if (subnet) { |
299 | | - pkg_free(subnet); |
300 | | - } |
301 | | - goto error; |
302 | | - } |
303 | | - if ((mask == 32 && ip_addr->af==AF_INET) || (mask == 128 && ip_addr->af==AF_INET6)) { |
304 | | - address_count += 1; |
305 | | - } else { |
306 | | - subnet_count += 1; |
307 | | - } |
308 | | - LM_DBG("Tuple <%.*s, %u, %u, %u, %.*s, %.*s> inserted into " |
309 | | - "address hash table\n", str_src_ip.len, str_src_ip.s, |
310 | | - group, port, proto, str_pattern.len, str_pattern.s, |
311 | | - str_info.len,str_info.s); |
312 | 296 | if (subnet) { |
| 297 | + if (pm_hash_insert(new_hash_table, subnet, group, port, proto, |
| 298 | + &str_pattern, &str_info, mask) == -1) { |
| 299 | + LM_ERR("hash table insert error\n"); |
| 300 | + if (subnet) { |
| 301 | + pkg_free(subnet); |
| 302 | + } |
| 303 | + goto error; |
| 304 | + } |
| 305 | + if ((mask == 32 && ip_addr->af==AF_INET) || (mask == 128 && ip_addr->af==AF_INET6)) { |
| 306 | + address_count += 1; |
| 307 | + } else { |
| 308 | + subnet_count += 1; |
| 309 | + } |
| 310 | + LM_DBG("Tuple <%.*s, %u, %u, %u, %.*s, %.*s> inserted into " |
| 311 | + "address hash table\n", str_src_ip.len, str_src_ip.s, |
| 312 | + group, port, proto, str_pattern.len, str_pattern.s, |
| 313 | + str_info.len,str_info.s); |
313 | 314 | pkg_free(subnet); |
| 315 | + } else { |
| 316 | + LM_ERR("invalid address: %.*s/%d\n", str_src_ip.len, redact_pii(str_src_ip.s), mask); |
314 | 317 | } |
315 | 318 | } |
316 | 319 |
|
|
0 commit comments