Subject: postfix and INET6
To: None <tech-userlevel@netbsd.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-userlevel
Date: 08/22/2001 08:05:59
in-tree postfix behave improperly with some settings.
(with multiple addresses in inet_interfaces?)
patch to fix it is attached.
is it ok?
and i have a non-NetBSD-related question.
i'm not sure about what we should pass to SA_LEN macro.....
it sometimes take sockaddr*, but sometimes take sockaddr**. :D
latter is bug, isn't it?
index: inet_addr_list.c
===================================================================
RCS file: /cvs/cvsroot/gnusrc/gnu/dist/postfix/src/util/inet_addr_list.c,v
retrieving revision 1.3
diff -u -r1.3 inet_addr_list.c
--- inet_addr_list.c 2001/08/09 08:10:19 1.3
+++ inet_addr_list.c 2001/08/21 22:32:56
@@ -129,10 +129,29 @@
static int inet_addr_list_comp(const void *a, const void *b)
{
+#ifdef INET6
+ SOCKADDR_SIZE a_len, b_len;
+ const struct sockaddr *a_addr = (const struct sockaddr *)a;
+ const struct sockaddr *b_addr = (const struct sockaddr *)b;
+
+#ifndef HAS_SA_LEN
+ a_len = SA_LEN((struct sockaddr *)a_addr); /* XXX ??? */
+ b_len = SA_LEN((struct sockaddr *)b_addr); /* XXX ??? */
+#else
+ a_len = a_addr->sa_len;
+ b_len = b_addr->sa_len;
+#endif
+ if (a_len != b_len)
+ return (int)a_len - b_len;
+
+ return memcmp(a_addr, b_addr, a_len);
+
+#else /*INET6*/
const struct in_addr *a_addr = (const struct in_addr *) a;
const struct in_addr *b_addr = (const struct in_addr *) b;
return (a_addr->s_addr - b_addr->s_addr);
+#endif /*INET6*/
}
/* inet_addr_list_uniq - weed out duplicates */