rpms/vnc/devel vnc-viewerIPv6.patch, NONE, 1.1 vnc.spec, 1.191, 1.192 vnc-210617.patch, 1.1, NONE

Adam Tkac (atkac) fedora-extras-commits at redhat.com
Thu May 29 16:38:05 UTC 2008


Author: atkac

Update of /cvs/pkgs/rpms/vnc/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6108

Modified Files:
	vnc.spec 
Added Files:
	vnc-viewerIPv6.patch 
Removed Files:
	vnc-210617.patch 
Log Message:
- substituted vnc-210617.patch with improved version - vnc-viewerIPv6.patch
  (#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-05-29 17:53:53.000000000 +0200
+++ vnc-4_1_2-unixsrc/common/network/Makefile.am	2008-05-29 17:53:53.000000000 +0200
@@ -1,5 +1,7 @@
 noinst_LTLIBRARIES = libnetwork.la
 
+libnetwork_la_CPPFLAGS = -DHAVE_IPV6
+
 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-05-29 17:53:53.000000000 +0200
+++ vnc-4_1_2-unixsrc/common/network/TcpSocket.cxx	2008-05-29 18:18:28.000000000 +0200
@@ -109,50 +109,100 @@ TcpSocket::TcpSocket(int sock, bool clos
 TcpSocket::TcpSocket(const char *host, int port)
   : closeFd(true)
 {
-  int sock;
+  int sock, err, family, ret;
+  size_t addrlen;
+  struct sockaddr_storage addr;
+#ifdef HAVE_IPV6
+  struct addrinfo *hostai, *current, hints;
+  char errstr[256];
+#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_IPV6
+  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 (getaddrinfo(host, NULL, &hints, &hostai) != 0) {
+    err = errorNumber;
+    if (snprintf(errstr, 256, "unable resolve host by name (%s)",
+	gai_strerror(err)) < 0)
+      throw Exception("unable resolve host by name");
+    throw Exception(errstr);
+  }
+
+  for (current = hostai; current != NULL; current = hostai->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)
+      ((struct sockaddr_in *)&addr)->sin_port = htons(port);
+    else
+      ((struct sockaddr_in6 *)&addr)->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);
+    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 {
+	err = errorNumber;
+	strcpy(errstr, "unable to resolve host by name");
+	goto socket_fail;
+      }
+    }
+#endif
+    sock = socket (family, SOCK_STREAM, 0);
+    if (sock == -1) {
+      err = errno;
+      strcpy(errstr, "unable to create socket");
+      goto socket_fail;
     }
-  }
 
-  // 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 ((ret = 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_IPV6
+    if (ret == 0)
+      break;
+    else
+      continue;
+  }
+#endif
+  if (ret == -1) {
+    strcpy(errstr, "unable to connect to host");
+    goto socket_fail;
   }
 
+#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);
 
@@ -160,6 +210,14 @@ TcpSocket::TcpSocket(const char *host, i
   instream = new FdInStream(sock);
   outstream = new FdOutStream(sock);
   ownStreams = true;
+
+  return;
+
+socket_fail:
+#ifdef HAVE_IPV6
+  freeaddrinfo(hostai);
+#endif
+  throw SocketException(errstr, err);
 }
 
 TcpSocket::~TcpSocket() {


Index: vnc.spec
===================================================================
RCS file: /cvs/pkgs/rpms/vnc/devel/vnc.spec,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -r1.191 -r1.192
--- vnc.spec	25 Apr 2008 10:43:54 -0000	1.191
+++ vnc.spec	29 May 2008 16:37:19 -0000	1.192
@@ -3,7 +3,7 @@
 Summary:   A remote display system
 Name:      vnc
 Version:   4.1.2
-Release:   30%{?dist}
+Release:   31%{?dist}
 URL:       http://www.realvnc.com
 Source0:   http://www.realvnc.com/dist/vnc-%{vnc_version}-unixsrc.tar.gz
 Source1:   Makefile.am
@@ -25,7 +25,6 @@
 Patch16:   vnc-64bit.patch
 Patch17:   vnc-select.patch
 Patch21:   vnc-newfbsize.patch
-Patch23:   vnc-210617.patch
 Patch24:   vnc-102434.patch
 Patch25:   vnc-config.patch
 Patch28:   vnc-render.patch
@@ -47,6 +46,8 @@
 Patch50:   vnc-scrollbars.patch
 Patch51:   vnc-bounds.patch
 Patch52:   vnc-includes.patch
+Patch53:   vnc-viewerIPv6.patch
+
 License:   GPLv2
 Group:     User Interface/Desktops
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
@@ -115,7 +116,6 @@
 %patch16 -p1 -b .64bit
 %patch17 -p1 -b .select
 %patch21 -p1 -b .newfbsize
-%patch23 -p1 -b .ipv6
 %patch24 -p1 -b .102434
 %patch25 -p1 -b .config
 %patch28 -p1 -b .render
@@ -144,9 +144,10 @@
 %patch50 -p1 -b .scrollbars
 %patch51 -p1 -b .bounds
 %patch52 -p1 -b .includes
+%patch53 -p1 -b .ipv6
 
 %build
-export CFLAGS="$CFLAGS $RPM_OPT_FLAGS"
+export CFLAGS="$CFLAGS $RPM_OPT_FLAGS -O0"
 export CXXFLAGS="$CFLAGS"
 
 pushd common
@@ -334,6 +335,10 @@
 %{_libdir}/librfb.so.*
 
 %changelog
+* Wed May 29 2008 Adam Tkac <atkac redhat com> 4.1.2-31
+- substituted vnc-210617.patch with improved version - vnc-viewerIPv6.patch
+  (#438422)
+
 * Fri Apr 25 2008 Adam Tkac <atkac redhat com> 4.1.2-30
 - rebuild against new mesa to fix GLX under anaconda (#443635)
 


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




More information about the fedora-extras-commits mailing list