diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-03 17:00:56 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-03 17:13:24 +0000 |
commit | f4b315188ef4f1cb1999872defd1d1f558dbc2e0 (patch) | |
tree | 3b0b90a20156fe6a86fb80b65e35719893e0330d /src/libutil/addr.c | |
parent | dfeb726476193fee3add70d91c665e0a1be83289 (diff) | |
download | rspamd-f4b315188ef4f1cb1999872defd1d1f558dbc2e0.tar.gz rspamd-f4b315188ef4f1cb1999872defd1d1f558dbc2e0.zip |
Add local addrs extension available in the conviguration
Diffstat (limited to 'src/libutil/addr.c')
-rw-r--r-- | src/libutil/addr.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/libutil/addr.c b/src/libutil/addr.c index f301c724e..d8dec0b97 100644 --- a/src/libutil/addr.c +++ b/src/libutil/addr.c @@ -26,7 +26,7 @@ #include "util.h" #include "logger.h" #include "xxhash.h" - +#include "radix.h" #include "unix-std.h" /* pwd and grp */ #ifdef HAVE_PWD_H @@ -37,6 +37,7 @@ #include <grp.h> #endif +static radix_compressed_t *local_addrs; enum { RSPAMD_IPV6_UNDEFINED = 0, @@ -1355,7 +1356,27 @@ rspamd_inet_address_is_local (const rspamd_inet_addr_t *addr) return TRUE; } } + + if (local_addrs) { + if (radix_find_compressed_addr (local_addrs, addr) != RADIX_NO_VALUE) { + return TRUE; + } + } } return FALSE; } + +void ** +rspamd_inet_library_init (void) +{ + return (void **)&local_addrs; +} + +void +rspamd_inet_library_destroy (void) +{ + if (local_addrs != NULL) { + radix_destroy_compressed (local_addrs); + } +} |