Yahoo Groups archive

Milter-greylist

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

Thread

Re: [milter-greylist] Disabling ipv6 support in 2.1.2 with #undef AF_INET6 gives errors

Re: [milter-greylist] Disabling ipv6 support in 2.1.2 with #undef AF_INET6 gives errors

2006-01-22 by Ranko Zivojnovic

Hi,

On Sun, 2006-01-22 at 08:40 +0000, tirilimpspoolteist wrote:
> Hello.
> 
> I had problem compiling milter-greylist 2.0.2 in older linux
> (pending.c: structure has no 
> member named `sin6_scope_id') and Emmanuel Dreyfus suggested to
> disable ipv6 
> support and add an #undef AF_INET6 after the includes in pending.c and
> it worked great.
> 
> However using same trick in milter-greylist 2.1.2 gives errors:
> 
> gcc -g -O2 -Wall -D_XOPEN_SOURCE=500 -D_BSD_SOURCE   -c -o milter-
> greylist.o 
> milter-greylist.c
> gcc -g -O2 -Wall -D_XOPEN_SOURCE=500 -D_BSD_SOURCE   -c -o pending.o
> pending.c
> pending.c: In function `pending_get':
> pending.c:184: `AF_INET6' undeclared (first use in this function)
> pending.c:184: (Each undeclared identifier is reported only once
> pending.c:184: for each function it appears in.)
> pending.c: In function `pending_put':
> pending.c:214: `AF_INET6' undeclared (first use in this function)
> pending.c: In function `pending_del':
> pending.c:278: `AF_INET6' undeclared (first use in this function)
> pending.c:271: warning: `b' might be used uninitialized in this
> function
> pending.c: In function `pending_check':
> pending.c:332: `AF_INET6' undeclared (first use in this function)
> pending.c:322: warning: `b' might be used uninitialized in this
> function
> make: *** [pending.o] Error 1
> 

Put your #undef AF_INET6 into milter-greylist.h just after the #includes
instead of having it in pending.c.

R.

Re: [milter-greylist] Disabling ipv6 support in 2.1.2 with #undef AF_INET6 gives errors

2006-01-22 by Sysadmin

Hello.
>
> Put your #undef AF_INET6 into milter-greylist.h just after the #includes
> instead of having it in pending.c.
>   
Damn, I already happily announced, that it works, but then it's stuck 
again with new error:

pending.o: In function `pending_get':
/home/soft/meilindus/milter-greylist-2.1.2/pending.c:186: undefined 
reference to `F2B'
/home/soft/meilindus/milter-greylist-2.1.2/pending.c:186: undefined 
reference to `F2B'
/home/soft/meilindus/milter-greylist-2.1.2/pending.c:186: undefined 
reference to `F2B'
/home/soft/meilindus/milter-greylist-2.1.2/pending.c:186: undefined 
reference to `F2B'
/home/soft/meilindus/milter-greylist-2.1.2/pending.c:186: undefined 
reference to `F2B'
pending.o:/home/soft/meilindus/milter-greylist-2.1.2/pending.c:186: more 
undefined references to `F2B' follow
collect2: ld returned 1 exit status


-- 
Sysadmin

Re: [milter-greylist] Disabling ipv6 support in 2.1.2 with #undef AF_INET6 gives errors

2006-01-22 by Ranko Zivojnovic

On Sun, 2006-01-22 at 16:08 +0200, Sysadmin wrote:
> 
> Hello.
> >
> > Put your #undef AF_INET6 into milter-greylist.h just after the
> #includes
> > instead of having it in pending.c.
> >   
> Damn, I already happily announced, that it works, but then it's stuck 
> again with new error:
> 
> pending.o: In function `pending_get':
> /home/soft/meilindus/milter-greylist-2.1.2/pending.c:186: undefined 
> reference to `F2B'
> /home/soft/meilindus/milter-greylist-2.1.2/pending.c:186: undefined 
> reference to `F2B'
> /home/soft/meilindus/milter-greylist-2.1.2/pending.c:186: undefined 
> reference to `F2B'
> /home/soft/meilindus/milter-greylist-2.1.2/pending.c:186: undefined 
> reference to `F2B'
> /home/soft/meilindus/milter-greylist-2.1.2/pending.c:186: undefined 
> reference to `F2B'
> pending.o:/home/soft/meilindus/milter-greylist-2.1.2/pending.c:186:
> more 
> undefined references to `F2B' follow
> collect2: ld returned 1 exit status

This is a little bug in miter-greylist.h...

Apply this patch and then add that #undef.

Emmanuel: This one could go for 2.1.3...

Regards,

R.

---PATCH---
diff -u milter-greylist-2.1.2/milter-greylist.h milter-greylist-2.1.2-fix/milter-greylist.h
--- milter-greylist-2.1.2/milter-greylist.h     2006-01-08 02:38:25.000000000 +0200
+++ milter-greylist-2.1.2-fix/milter-greylist.h 2006-01-22 16:31:11.777240668 +0200
@@ -79,13 +79,14 @@
 #define SADDR6(sa)     (&SA6(sa)->sin6_addr)
 #endif

-#ifdef AF_INET6
 /* 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)) \
---PATCH---

Re: [milter-greylist] Disabling ipv6 support in 2.1.2 with #undef AF_INET6 gives errors

2006-01-22 by Hajimu UMEMOTO

Hi,

>>>>> On Sun, 22 Jan 2006 08:40:31 -0000
>>>>> "tirilimpspoolteist" <sysadmin@...> said:

sysadmin> I had problem compiling milter-greylist 2.0.2 in older linux (pending.c: structure has no 
sysadmin> member named `sin6_scope_id') and Emmanuel Dreyfus suggested to disable ipv6 
sysadmin> support and add an #undef AF_INET6 after the includes in pending.c and it worked great.

Please try the patch I posted here recently.  I post it again.

Index: config.h.in
diff -u config.h.in.orig config.h.in
--- config.h.in.orig	Mon Oct  3 17:01:00 2005
+++ config.h.in	Mon Jan 16 16:32:25 2006
@@ -72,6 +72,9 @@
 /* Define to 1 if you have the `select' function. */
 #undef HAVE_SELECT
 
+/* sin6_scope_id field in struct sockaddr_in6 */
+#undef HAVE_SIN6_SCOPE_ID
+
 /* Define to 1 if you have the `socket' function. */
 #undef HAVE_SOCKET
 
Index: configure
diff -u configure.orig configure
--- configure.orig	Mon Jan 16 16:31:11 2006
+++ configure	Mon Jan 16 16:31:59 2006
@@ -8561,6 +8560,127 @@
 fi
 
 
+# Pre-RFC2553 system does not have a sin6_scope_id field in sockaddr_in6
+echo "$as_me:$LINENO: checking for struct sockaddr_in6.sin6_scope_id" >&5
+echo $ECHO_N "checking for struct sockaddr_in6.sin6_scope_id... $ECHO_C" >&6
+if test "${ac_cv_member_struct_sockaddr_in6_sin6_scope_id+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+		#include <sys/types.h>
+		#include <sys/socket.h>
+		#include <netinet/in.h>
+
+
+int
+main ()
+{
+static struct sockaddr_in6 ac_aggr;
+if (ac_aggr.sin6_scope_id)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_sockaddr_in6_sin6_scope_id=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+		#include <sys/types.h>
+		#include <sys/socket.h>
+		#include <netinet/in.h>
+
+
+int
+main ()
+{
+static struct sockaddr_in6 ac_aggr;
+if (sizeof ac_aggr.sin6_scope_id)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_sockaddr_in6_sin6_scope_id=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_member_struct_sockaddr_in6_sin6_scope_id=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_member_struct_sockaddr_in6_sin6_scope_id" >&5
+echo "${ECHO_T}$ac_cv_member_struct_sockaddr_in6_sin6_scope_id" >&6
+if test $ac_cv_member_struct_sockaddr_in6_sin6_scope_id = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SIN6_SCOPE_ID 1
+_ACEOF
+
+fi
+
+
 # Darwin seems to have no definition for socklen_t beyond _BSD_SOCKLEN_T_
 echo "$as_me:$LINENO: checking if socklen_t is missing" >&5
 echo $ECHO_N "checking if socklen_t is missing... $ECHO_C" >&6
Index: configure.ac
diff -u configure.ac.orig configure.ac
--- configure.ac.orig	Sun Jan  8 17:50:29 2006
+++ configure.ac	Mon Jan 16 16:31:11 2006
@@ -493,6 +493,15 @@
 		#include <sys/socket.h>
 	])
 
+# Pre-RFC2553 system does not have a sin6_scope_id field in sockaddr_in6
+AC_CHECK_MEMBER([struct sockaddr_in6.sin6_scope_id],
+	[AC_DEFINE([HAVE_SIN6_SCOPE_ID], [1],
+	    [sin6_scope_id field in struct sockaddr_in6])],, [
+		#include <sys/types.h>
+		#include <sys/socket.h>
+		#include <netinet/in.h>
+	])
+
 # Darwin seems to have no definition for socklen_t beyond _BSD_SOCKLEN_T_
 AC_MSG_CHECKING([if socklen_t is missing])
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Index: pending.c
diff -u -p pending.c.orig pending.c
--- pending.c.orig	Thu May 12 01:25:43 2005
+++ pending.c	Mon Jan 16 16:45:56 2006
@@ -419,7 +419,7 @@ ip_match(sa, pat, mask)
 		break;
 #ifdef AF_INET6
 	case AF_INET6:
-#ifdef HAVE_GETADDRINFO
+#if defined(HAVE_SIN6_SCOPE_ID) && defined(HAVE_GETADDRINFO)
 		if (SA6(pat)->sin6_scope_id != 0 &&
 		    SA6(sa)->sin6_scope_id != SA6(pat)->sin6_scope_id)
 			return 0;
@@ -453,7 +453,7 @@ ip_equal(sa, pat)
 		break;
 #ifdef AF_INET6
 	case AF_INET6:
-#ifdef HAVE_GETADDRINFO
+#if defined(HAVE_SIN6_SCOPE_ID) && defined(HAVE_GETADDRINFO)
 		if (SA6(pat)->sin6_scope_id != 0 &&
 		    SA6(sa)->sin6_scope_id != SA6(pat)->sin6_scope_id)
 			return 0;


Sincerely,

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@...  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/

milter-greylist 2.1.3 is out

2006-01-22 by manu@netbsd.org

Hajimu UMEMOTO <ume@...> wrote:
> Please try the patch I posted here recently.  I post it again.

Ranko Zivojnovic <ranko@...> wrote:
> Emmanuel: This one could go for 2.1.3...

Ok, here is 2.1.3 with the two patches:

http://ftp.espci.fr/milter-greylist/milter-greylist-2.1.3.tgz
MD5 (milter-greylist-2.1.3.tgz) = 4b2f5339194ffa28432252f30922e1f0

-- 
Emmanuel Dreyfus
Le cahier de l'admin BSD 2eme ed. est dans toutes les bonnes librairies
http://www.eyrolles.com/Informatique/Livre/9782212114638/livre-bsd.php
manu@...

Re: [milter-greylist] milter-greylist 2.1.3 is out

2006-01-22 by Sysadmin

Hello.


> Hajimu UMEMOTO <ume@...> wrote:
>  > Please try the patch I posted here recently.  I post it again.
>
> Ranko Zivojnovic <ranko@...> wrote:
>  > Emmanuel: This one could go for 2.1.3...
>
> Ok, here is 2.1.3 with the two patches:
>
> http://ftp.espci.fr/milter-greylist/milter-greylist-2.1.3.tgz
> MD5 (milter-greylist-2.1.3.tgz) = 4b2f5339194ffa28432252f30922e1f0
>   

Great, it compiles fine. Btw, the link is wrong, the right is 
http://ftp.espci.fr/pub/milter-greylist/milter-greylist-2.1.3.tgz

-- 
Sysadmin

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.