rpms/vnc/F-8 vnc-viewerIPv6.patch, NONE, 1.1 vnc.spec, 1.184, 1.185 vnc-210617.patch, 1.1, NONE

Adam Tkac (atkac) fedora-extras-commits at redhat.com
Mon Jun 30 11:20:21 UTC 2008


Author: atkac

Update of /cvs/pkgs/rpms/vnc/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv31413

Modified Files:
	vnc.spec 
Added Files:
	vnc-viewerIPv6.patch 
Removed Files:
	vnc-210617.patch 
Log Message:
- improved IPv6 support in viewer (#438422)


vnc-viewerIPv6.patch:

--- NEW FILE vnc-viewerIPv6.patch ---
diff -up vnc-4_1_2-unixsrc/common/network/Makefile.am.ipv6 vnc-4_1_2-unixsrc/common/network/Makefile.am
--- vnc-4_1_2-unixsrc/common/network/Makefile.am.ipv6	2008-06-02 10:22:17.000000000 +0200
+++ vnc-4_1_2-unixsrc/common/network/Makefile.am	2008-06-02 10:52:56.000000000 +0200
@@ -1,5 +1,7 @@
 noinst_LTLIBRARIES = libnetwork.la
 
+libnetwork_la_CPPFLAGS = -DHAVE_GETADDRINFO
+
 libnetwork_la_SOURCES = \
 	Socket.h \
 	TcpSocket.cxx \
diff -up vnc-4_1_2-unixsrc/common/network/TcpSocket.cxx.ipv6 vnc-4_1_2-unixsrc/common/network/TcpSocket.cxx
--- vnc-4_1_2-unixsrc/common/network/TcpSocket.cxx.ipv6	2008-06-02 10:22:17.000000000 +0200
+++ vnc-4_1_2-unixsrc/common/network/TcpSocket.cxx	2008-06-02 10:49:04.000000000 +0200
@@ -109,50 +109,99 @@ TcpSocket::TcpSocket(int sock, bool clos
 TcpSocket::TcpSocket(const char *host, int port)
   : closeFd(true)
 {
-  int sock;
+#define CAST_ADDR(x) (*((struct x *)&addr))
+  int sock, err, family, result = -1;
+  size_t addrlen;
+  struct sockaddr_storage addr;
+#ifdef HAVE_GETADDRINFO
+  struct addrinfo *ai, *current, hints;
+#endif
 
   // - Create a socket
   initSockets();
-  if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
-    throw SocketException("unable to create socket", errorNumber);
 
-#ifndef WIN32
-  // - By default, close the socket on exec()
-  fcntl(sock, F_SETFD, FD_CLOEXEC);
-#endif
+#ifdef HAVE_GETADDRINFO
+  memset(&hints, 0, sizeof(struct addrinfo));
+  hints.ai_family = AF_UNSPEC;
+  hints.ai_socktype = SOCK_STREAM;
+  hints.ai_canonname = NULL;
+  hints.ai_addr = NULL;
+  hints.ai_next = NULL;
+
+  if ((result = getaddrinfo(host, NULL, &hints, &ai)) != 0) {
+    throw Exception("unable to resolve host by name: %s",
+		    gai_strerror(result));
+  }
+
+  for (current = ai; current != NULL; current = current->ai_next) {
+    family = current->ai_family;
+    if (family != AF_INET && family != AF_INET6)
+      continue;
+
+    addrlen = current->ai_addrlen;
+    memcpy(&addr, current->ai_addr, addrlen);
+
+    if (family == AF_INET)
+      CAST_ADDR(sockaddr_in).sin_port = htons(port);
+    else
+      CAST_ADDR(sockaddr_in6).sin6_port = htons(port);
 
-  // - Connect it to something
+#else
+    family = AF_INET;
+    addrlen = sizeof(struct sockaddr_in);
 
-  // Try processing the host as an IP address
-  struct sockaddr_in addr;
-  memset(&addr, 0, sizeof(addr));
-  addr.sin_family = AF_INET;
-  addr.sin_addr.s_addr = inet_addr(host);
-  addr.sin_port = htons(port);
-  if ((int)addr.sin_addr.s_addr == -1) {
-    // Host was not an IP address - try resolving as DNS name
-    struct hostent *hostinfo;
-    hostinfo = gethostbyname(host);
-    if (hostinfo && hostinfo->h_addr) {
-      addr.sin_addr.s_addr = ((struct in_addr *)hostinfo->h_addr)->s_addr;
-    } else {
-      int e = errorNumber;
-      closesocket(sock);
-      throw SocketException("unable to resolve host by name", e);
+    // Try processing the host as an IP address
+    memset(&addr, 0, addrlen);
+    CAST_ADDR(sockaddr_in).sin_family = AF_INET;
+    CAST_ADDR(sockaddr_in).sin_addr.s_addr = inet_addr(host);
+    CAST_ADDR(sockaddr_in).sin_port = htons(port);
+    if ((int)CAST_ADDR(sockaddr_in).sin_addr.s_addr == -1) {
+      // Host was not an IP address - try resolving as DNS name
+      struct hostent *hostinfo;
+      hostinfo = gethostbyname(host);
+      if (hostinfo && hostinfo->h_addr) {
+	CAST_ADDR(sockaddr_in).sin_addr.s_addr =
+	  ((struct in_addr *)hostinfo->h_addr)->s_addr;
+      } else {
+	err = errorNumber;
+	throw SocketException("unable to resolve host by name", err);
+      }
+    }
+#endif
+    sock = socket (family, SOCK_STREAM, 0);
+    if (sock == -1) {
+      err = errorNumber;
+#ifdef HAVE_GETADDRINFO
+      freeaddrinfo(ai);
+#endif
+      throw SocketException("unable to create socket", err);
     }
-  }
 
-  // Attempt to connect to the remote host
-  for (;;) {
-    if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) != 0) {
-      int e = errorNumber;
-      if (e == EINTR)
-        continue;
+    // Attempt to connect to the remote host
+    while ((result = connect(sock, (struct sockaddr *)&addr, addrlen)) == -1) {
+      err = errorNumber;
+      if (err == EINTR)
+	continue;
       closesocket(sock);
-      throw SocketException("unable to connect to host", e);
-    } else break;
+      break;
+    }
+#ifdef HAVE_GETADDRINFO
+    if (result == 0)
+      break;
+    else
+      continue;
   }
 
+  freeaddrinfo(ai);
+#endif
+  if (result == -1)
+    throw SocketException("unable connect to socket", err);
+
+#ifndef WIN32
+  // - By default, close the socket on exec()
+  fcntl(sock, F_SETFD, FD_CLOEXEC);
+#endif
+
   // Disable Nagle's algorithm, to reduce latency
   enableNagles(sock, false);
 
diff -up vnc-4_1_2-unixsrc/common/rdr/Exception.cxx.ipv6 vnc-4_1_2-unixsrc/common/rdr/Exception.cxx
--- vnc-4_1_2-unixsrc/common/rdr/Exception.cxx.ipv6	2008-06-02 10:23:35.000000000 +0200
+++ vnc-4_1_2-unixsrc/common/rdr/Exception.cxx	2008-06-02 10:28:51.000000000 +0200
@@ -22,8 +22,23 @@
 #include <winsock2.h>
 #endif
 
+#include <stdarg.h>
+
 using namespace rdr;
 
+Exception::Exception(const char *format, ...) {
+  va_list ap;
+  int result;
+
+  va_start(ap, format);
+  result = vsnprintf(str_, len, format, ap);
+  va_end(ap);
+
+  /* XXX - ensure that string ends correctly */
+  if (result > len)
+    str_[len - 1] = '\0';
+}
+
 SystemException::SystemException(const char* s, int err_)
   : Exception(s), err(err_)
 {
diff -up vnc-4_1_2-unixsrc/common/rdr/Exception.h.ipv6 vnc-4_1_2-unixsrc/common/rdr/Exception.h
--- vnc-4_1_2-unixsrc/common/rdr/Exception.h.ipv6	2008-06-02 10:23:05.000000000 +0200
+++ vnc-4_1_2-unixsrc/common/rdr/Exception.h	2008-06-02 10:28:41.000000000 +0200
@@ -27,13 +27,7 @@ namespace rdr {
   struct Exception {
     enum { len = 256 };
     char str_[len];
-    Exception(const char* s=0) {
-      str_[0] = 0;
-      if (s)
-        strncat(str_, s, len-1);
-      else
-        strcat(str_, "Exception");
-    }
+    Exception(const char *format, ...);
     virtual const char* str() const { return str_; }
   };
 


Index: vnc.spec
===================================================================
RCS file: /cvs/pkgs/rpms/vnc/F-8/vnc.spec,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -r1.184 -r1.185
--- vnc.spec	19 Mar 2008 11:52:25 -0000	1.184
+++ vnc.spec	30 Jun 2008 11:19:26 -0000	1.185
@@ -4,7 +4,7 @@
 Summary:   A remote display system
 Name:      vnc
 Version:   4.1.2
-Release:   24%{?dist}
+Release:   24.1%{?dist}
 URL:       http://www.realvnc.com
 Source0:   http://www.realvnc.com/dist/vnc-%{vnc_version}-unixsrc.tar.gz
 Source1:   http://www.realvnc.com/dist/vnc-%{java_vnc_version}-javasrc.tar.gz
@@ -27,7 +27,6 @@
 Patch17:   vnc-select.patch
 Patch19:   vnc-ppc64.patch
 Patch21:   vnc-newfbsize.patch
-Patch23:   vnc-210617.patch
 Patch24:   vnc-102434.patch
 Patch25:   vnc-config.patch
 Patch28:   vnc-render.patch
@@ -39,6 +38,7 @@
 Patch37:   vnc-noxorg.patch
 Patch39:   vnc-manminor.patch
 Patch40:   vnc-bounds.patch
+Patch41:   vnc-viewerIPv6.patch
 License:   GPLv2
 Group:     User Interface/Desktops
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
@@ -105,7 +105,6 @@
 %patch17 -p1 -b .select
 %patch19 -p1 -b .ppc64
 %patch21 -p1 -b .newfbsize
-%patch23 -p1 -b .ipv6
 %patch24 -p1 -b .102434
 %patch25 -p1 -b .config
 %patch28 -p1 -b .render
@@ -128,6 +127,7 @@
 
 %patch39 -p1 -b .minor
 %patch40 -p1 -b .bounds
+%patch41 -p1 -b .ipv6
 
 %build
 cd common
@@ -317,6 +317,9 @@
 %{_libdir}/librfb.so.*
 
 %changelog
+* Mon Jun 30 2008 Adam Tkac <atkac redhat com> 4.1.2-24.1
+- improved IPv6 support in viewer (#438422)
+
 * Wed Mar 19 2008 Adam Tkac <atkac redhat com> 4.1.2-24
 - minor vncviewer manpage fixes (#427672, #427701)
 - validate framebuffer bounds before GetImage call (#430468)


--- vnc-210617.patch DELETED ---




More information about the fedora-extras-commits mailing list