diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-10-01 15:58:23 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-10-01 15:58:23 +0100 |
commit | 6ec67947dadeba207104ac0e2c65c9e10a3a580d (patch) | |
tree | 85e7fdbbf5081c779bdec6bba723fb35815f2ff9 /src/libserver/cfg_utils.c | |
parent | a8c9abd046add08c8ac8f91c3c12d5c823fb44e3 (diff) | |
download | rspamd-6ec67947dadeba207104ac0e2c65c9e10a3a580d.tar.gz rspamd-6ec67947dadeba207104ac0e2c65c9e10a3a580d.zip |
Rework addresses parsing.
Diffstat (limited to 'src/libserver/cfg_utils.c')
-rw-r--r-- | src/libserver/cfg_utils.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 4d2b86880..aecef53d4 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -1005,27 +1005,13 @@ rspamd_ucl_fin_cb (rspamd_mempool_t * pool, struct map_cb_data *data) } gboolean -rspamd_config_parse_ip_list (const gchar *ip_list, radix_tree_t **tree) +rspamd_config_parse_ip_list (const gchar *ip_list, radix_compressed_t **tree) { - gchar **strvec, **cur; - struct in_addr ina; - guint32 mask; - - strvec = g_strsplit_set (ip_list, ",", 0); - cur = strvec; - - while (*cur != NULL) { - /* XXX: handle only ipv4 addresses */ - if (parse_ipmask_v4 (*cur, &ina, &mask)) { - if (*tree == NULL) { - *tree = radix_tree_create (); - } - radix32tree_add (*tree, htonl (ina.s_addr), mask, 1); - } - cur++; + if (*tree == NULL) { + *tree = radix_create_compressed (); } - return (*tree != NULL); + return (rspamd_radix_add_iplist (ip_list, ",; ", *tree) > 0); } /* |