diff options
Diffstat (limited to 'src/libserver/cfg_utils.c')
-rw-r--r-- | src/libserver/cfg_utils.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 204e9bd55..d8237b88e 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -2998,4 +2998,27 @@ rspamd_deinit_libs (struct rspamd_external_libs_ctx *ctx) g_free (ctx); } -}
\ No newline at end of file +} + +gboolean +rspamd_ip_is_local_cfg (struct rspamd_config *cfg, + const rspamd_inet_addr_t *addr) +{ + struct rspamd_radix_map_helper *local_addrs = NULL; + + if (cfg && cfg->libs_ctx) { + local_addrs = *(struct rspamd_radix_map_helper**)cfg->libs_ctx->local_addrs; + } + + if (rspamd_inet_address_is_local (addr)) { + return TRUE; + } + + if (local_addrs) { + if (rspamd_match_radix_map_addr (local_addrs, addr) != NULL) { + return TRUE; + } + } + + return FALSE; +} |