Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Message

Re: [milter-greylist] hash table acceleration breaks lazyaw

2006-03-28 by Sysadmin

Tere.
> Please consider this version.
>   
[test@test milter-greylist-2.1.3]# patch -p0 < milter-greylist.h.patch
patching file `milter-greylist.h'
Hunk #1 FAILED at 80.
1 out of 1 hunk FAILED -- saving rejects to milter-greylist.h.rej

cat milter-greylist.h.rej

***************
*** 80,106 ****
  #endif
 
  /* Notes:
!  * -For IPv6 not using s6_addr32 as Solaris 8 for some reason has it
only defined for its kernel...
!  * -Using also first two characters in "from" and "rcpt" to distribute
potentially lot of triplets
!  *  coming from a single host (first two chars only because "<>" is
the "shortest" email address)
   */
  #define F2B(s) (tolower((int)*(s)) | (tolower((int)*((s)+1)) << 8))
  #ifdef AF_INET6
! #define BUCKET_HASH(sa, from, rcpt, bucket_count)    \
!     (sa->sa_family == AF_INET ? \
!       ((ntohl(SADDR4(sa)->s_addr) ^ F2B(from) ^ F2B(rcpt)) \
!         % bucket_count) \
!     : sa->sa_family == AF_INET6 ? \
!       (((uint32_t)(SADDR6(sa)->s6_addr)[3] ^ F2B(from) ^ F2B(rcpt)) \
!         % bucket_count) \
!     : 0)
 
- #else
- #define BUCKET_HASH(sa, from, rcpt, bucket_count) \
-     (sa->sa_family == AF_INET ? \
-       ((ntohl(SADDR4(sa)->s_addr) ^ F2B(from) ^ F2B(rcpt)) \
-         % bucket_count) \
-     : 0)
  #endif
 
  struct mlfi_priv {
--- 80,127 ----
  #endif
 
  /* Notes:
!  * -For IPv6 not using s6_addr32 as Solaris 8 for some reason has it only
!  *  defined for its kernel...
!  * -Using also first two characters in "from" and "rcpt" to distribute
!  *  potentially lot of triplets coming from a single host (first two
chars
!  *  only because "<>" is the "shortest" email address)
   */
  #define F2B(s) (tolower((int)*(s)) | (tolower((int)*((s)+1)) << 8))
+ #define F2B_SPICE(from, rcpt) (conf.c_lazyaw ? 0 : (F2B(from) ^
F2B(rcpt)))
+
+ #define BUCKET_HASH_V4(sa, from, rcpt, bucket_count)         \
+   ((ntohl(SADDR4(sa)->s_addr &                     \
+       ((ipaddr *)&conf.c_match_mask)->in4.s_addr)        \
+     ^ F2B_SPICE(from, rcpt))                    \
+    % bucket_count)
+
  #ifdef AF_INET6
! #define BUCKET_HASH_V6(sa, from, rcpt, bucket_count)            \
!   (((((uint32_t)(SADDR6(sa)->s6_addr)[0] &                \
!       (uint32_t)(((ipaddr *)&conf.c_match_mask6)->in6.s6_addr)[0]) ^    \
!      ((uint32_t)(SADDR6(sa)->s6_addr)[1] &                \
!       (uint32_t)(((ipaddr *)&conf.c_match_mask6)->in6.s6_addr)[1]) ^    \
!      ((uint32_t)(SADDR6(sa)->s6_addr)[2] &                \
!       (uint32_t)(((ipaddr *)&conf.c_match_mask6)->in6.s6_addr)[2]) ^    \
!      ((uint32_t)(SADDR6(sa)->s6_addr)[3] &                \
!       (uint32_t)(((ipaddr *)&conf.c_match_mask6)->in6.s6_addr)[3]))    \
!     ^ F2B_SPICE(from, rcpt))                        \
!    % bucket_count)
!
! #define BUCKET_HASH(sa, from, rcpt, bucket_count)        \
!   (sa->sa_family == AF_INET ?                    \
!    BUCKET_HASH_V4(sa, from, rcpt, bucket_count)         \
!    : sa->sa_family == AF_INET6 ?                 \
!    BUCKET_HASH_V6(sa, from, rcpt, bucket_count)         \
!    : 0)
!
! #else /* AF_INET6 */
!
! #define BUCKET_HASH(sa, from, rcpt, bucket_count)         \
!   (sa->sa_family == AF_INET ?                    \
!    BUCKET_HASH_V4(sa, from, rcpt, bucket_count)         \
!    : 0)
 
  #endif
 
  struct mlfi_priv {


-- 
Sysadmin

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.