ports/120041: [maintainer] mail/libetpan add IPv6 fallback patch from etpan`s CVS

Pawel Pekala c0rn at o2.pl
Sun Jan 27 12:50:02 UTC 2008


>Number:         120041
>Category:       ports
>Synopsis:       [maintainer] mail/libetpan add IPv6 fallback patch from etpan`s CVS
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 27 12:50:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Pawel Pekala
>Release:        FreeBSD 6.2-RELEASE-p9 i386
>Organization:
>Environment:


System: FreeBSD 6.2-RELEASE-p9 #0: Thu Nov 29 04:07:33 UTC 2007
    root at i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC



>Description:


Add patch from libetpan`s CVS fixing connect errors in some cases:

2008-01-25 - libetpan-0.52cvs35 - colin

	* src/data-types/connect.c
	    Fix connection failures when client and server are ipv4 
	    and ipv6 capable, but no ip6 route exists to the server.


>How-To-Repeat:





>Fix:


--- libetpan.diff begins here ---
diff -urN /usr/ports/mail/libetpan/files/patch-ipv6-fallback libetpan/files/patch-ipv6-fallback
--- /usr/ports/mail/libetpan/files/patch-ipv6-fallback	Thu Jan  1 01:00:00 1970
+++ libetpan/files/patch-ipv6-fallback	Sun Jan 27 13:01:48 2008
@@ -0,0 +1,69 @@
+Index: src/data-types/connect.c
+===================================================================
+RCS file: /cvsroot/libetpan/libetpan/src/data-types/connect.c,v
+retrieving revision 1.25
+diff -u -p -u -r1.25 connect.c
+--- src/data-types/connect.c	27 Oct 2007 10:08:24 -0000	1.25
++++ src/data-types/connect.c	25 Jan 2008 08:29:58 -0000
+@@ -88,6 +88,21 @@ static int prepare_fd(int fd)
+   return 0;
+ }
+ 
++#ifdef HAVE_IPV6
++static int verify_sock_errors(int s)
++{
++  uint len;
++  int val;
++  len = sizeof(val);
++  if (getsockopt(s, SOL_SOCKET, SO_ERROR, &val, &len) < 0) {
++    return -1;
++  } else if (val != 0) {
++    return -1;
++  }
++  return 0;
++}
++#endif
++
+ static int wait_connect(int s, int r)
+ {
+   fd_set fds;
+@@ -206,6 +221,7 @@ int mail_tcp_connect_with_local_address(
+ 
+   for (ai = res; ai != NULL; ai = ai->ai_next) {
+     s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
++
+     if (s == -1)
+       continue;
+     
+@@ -239,8 +255,22 @@ int mail_tcp_connect_with_local_address(
+     
+     r = connect(s, ai->ai_addr, ai->ai_addrlen);
+     r = wait_connect(s, r);
++    
++    if (r != -1) {
++      r = verify_sock_errors(s);
++    }
++
+     if (r == -1) {
+-      goto close_socket;
++      if (ai->ai_next) {
++#ifdef WIN32
++	  closesocket(s);
++#else
++	  close(s);
++#endif
++	  continue;
++      } else {
++        goto close_socket;
++      }
+     }
+     /* if we're here, we're good */
+     break;
+@@ -252,7 +282,6 @@ int mail_tcp_connect_with_local_address(
+   if (ai == NULL)
+     goto err;
+ #endif
+-  
+   return s;
+   
+  close_socket:
--- libetpan.diff ends here ---



>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list