summaryrefslogtreecommitdiffstats
path: root/src/libutil/radix.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-12 14:20:02 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-12 14:20:02 +0000
commit90fcbffa798f86afddc2645803f113d937d94035 (patch)
tree22b2e83bc141ef105b6d752511b4a3551ce335d4 /src/libutil/radix.c
parent8d7fc82bd61b49eb621560205a902baa7858d28d (diff)
downloadrspamd-90fcbffa798f86afddc2645803f113d937d94035.tar.gz
rspamd-90fcbffa798f86afddc2645803f113d937d94035.zip
Use opaque inet_address.
Diffstat (limited to 'src/libutil/radix.c')
-rw-r--r--src/libutil/radix.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libutil/radix.c b/src/libutil/radix.c
index a7ef12375..17b73b6cc 100644
--- a/src/libutil/radix.c
+++ b/src/libutil/radix.c
@@ -870,17 +870,17 @@ radix_destroy_compressed (radix_compressed_t *tree)
uintptr_t
radix_find_compressed_addr (radix_compressed_t *tree, rspamd_inet_addr_t *addr)
{
+ guchar *key;
+ guint klen = 0;
+
if (addr == NULL) {
return RADIX_NO_VALUE;
}
- if (addr->af == AF_INET) {
- return radix_find_compressed (tree, (guint8 *)&addr->addr.s4.sin_addr,
- sizeof (addr->addr.s4.sin_addr));
- }
- else if (addr->af == AF_INET6) {
- return radix_find_compressed (tree, (guint8 *)&addr->addr.s6.sin6_addr,
- sizeof (addr->addr.s6.sin6_addr));
+ key = rspamd_inet_address_get_radix_key (addr, &klen);
+
+ if (key && klen) {
+ return radix_find_compressed (tree, key, klen);
}
return RADIX_NO_VALUE;