]> source.dussan.org Git - rspamd.git/commitdiff
Use opaque inet_address.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 12 Mar 2015 14:20:02 +0000 (14:20 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 12 Mar 2015 14:20:02 +0000 (14:20 +0000)
src/libutil/radix.c

index a7ef12375952ab06c0e6656faa0f131db1b4ebce..17b73b6cc937957e3ad129bd356494ff5f45c9a5 100644 (file)
@@ -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;