+tcp comstack: change behavior for @-specs (anyaddr). @ listens on
+AF_INET (IPV4) peers, and @6 listens to AF_INET6 (ipv6) peers.
+Previously @ listened on AF_INET6 which accepted both IPV4 and IPV6
+peers on some Linux systems. However, in general that does not work
+so YAZ can not rely on that to work. Debian changed behavior in this
+respect from Debian lenny to Debian squeeze (still testing as of Oct
+2010). Refer to:
+http://www.mail-archive.com/debian-devel@lists.debian.org/msg277726.html
+
--- 4.1.1 2010/10/05
Fix yaz-config output: echo_source not set correctly by configure.
if (!strcmp("@", host))
{
hints.ai_flags = AI_PASSIVE;
+ hints.ai_family = AF_INET;
+ error = getaddrinfo(0, port, &hints, &res);
+ }
+ else if (!strcmp("@6", host))
+ {
+ hints.ai_flags = AI_PASSIVE;
+ hints.ai_family = AF_INET6;
error = getaddrinfo(0, port, &hints, &res);
}
else
if (sp->ai && h->state == CS_ST_UNBND)
{
int s = -1;
- /* try to make IPV6 socket first */
for (ai = sp->ai; ai; ai = ai->ai_next)
{
- if (ai->ai_family == AF_INET6)
- {
- s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
- if (s != -1)
- break;
- }
- }
- if (s == -1)
- {
- /* no IPV6 could be made.. Try them all */
- for (ai = sp->ai; ai; ai = ai->ai_next)
- {
- s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
- if (s != -1)
- break;
- }
+ s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+ if (s != -1)
+ break;
}
if (s == -1)
return 0;