Hi,
>>>>> On Fri, 13 Jan 2006 09:45:29 +0000
>>>>> Emmanuel Dreyfus <manu@...> said:
manu> On Fri, Jan 13, 2006 at 08:46:19AM -0000, tirilimpspoolteist wrote:
> Tring to compile milter-greylist in older linux, which however is ipv6
> compatible, and runs on 2.4 kernel, but getting error:
>
> gcc -g -O2 -Wall -Ino/include -Ino/include -D_XOPEN_SOURCE=500
> -D_BSD_SOURCE -c -o pending.o pending.c
> pending.c: In function `ip_match':
> pending.c:423: structure has no member named `sin6_scope_id'
> pending.c:424: structure has no member named `sin6_scope_id'
> pending.c:424: structure has no member named `sin6_scope_id'
> pending.c: In function `ip_equal':
> pending.c:457: structure has no member named `sin6_scope_id'
> pending.c:458: structure has no member named `sin6_scope_id'
> pending.c:458: structure has no member named `sin6_scope_id'
> make: *** [pending.o] Error 1
>
> Seems some ipv6 incompatible error, how to fix it?
manu> Quick fix: Add an #undef AF_INET6 after the includes in pending.c
manu> But we need a better fix? Can we see your struct sockaddr_in6 definition?
manu> It should be in /usr/include/netinet6/in6.h
Pre-RFC2553 system doesn't have sin6_scope_id in sockaddr_in6.
However, I suspect that such system is still usable these days. :-)
In anyway, it should be good having awareness of such system. Here is
a patch. Please try it.
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/