changeset 313:32a6b26b7026

2003-11-9 Brian Masney <masneyb@gftp.org> * lib/options.h lib/protoocols.c - added enable_ipv6 option. * lib/rfc959.c lib/protocols.c - if there is an error creating a socket, log a more informative error about what kind of socket was attempted to be created.
author masneyb
date Mon, 10 Nov 2003 01:59:51 +0000
parents a2ec3572dea2
children 7ddb290ac719
files ChangeLog lib/options.h lib/protocols.c lib/rfc959.c
diffstat 4 files changed, 25 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Nov 10 01:42:38 2003 +0000
+++ b/ChangeLog	Mon Nov 10 01:59:51 2003 +0000
@@ -1,4 +1,10 @@
 2003-11-9 Brian Masney <masneyb@gftp.org>
+	* lib/options.h lib/protoocols.c - added enable_ipv6 option. 
+
+	* lib/rfc959.c lib/protocols.c - if there is an error creating a socket,
+	log a more informative error about what kind of socket was attempted
+	to be created.
+
 	* debian/* - updated Debian package files from 
 	Aurelien Jarno <aurel32@debian.org>
 
@@ -1745,7 +1751,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.172 2003/11/10 01:42:37 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.173 2003/11/10 01:59:50 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/options.h	Mon Nov 10 01:42:38 2003 +0000
+++ b/lib/options.h	Mon Nov 10 01:59:51 2003 +0000
@@ -111,6 +111,12 @@
   {"default_protocol", N_("Default Protocol:"),
    gftp_option_type_textcombo, "FTP", NULL, 0,
    N_("This specifies the default protocol to use"), GFTP_PORT_ALL, NULL},
+#if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR)
+  {"enable_ipv6", N_("Enable IPv6 support"), 
+   gftp_option_type_checkbox, GINT_TO_POINTER(1), NULL, 
+   GFTP_CVARS_FLAGS_SHOW_BOOKMARK,
+   N_("Enable IPv6 support"), GFTP_PORT_ALL, NULL},
+#endif
 
   {"list_dblclk_action", "", 
    gftp_option_type_int, GINT_TO_POINTER(0), NULL, 0,
--- a/lib/protocols.c	Mon Nov 10 01:42:38 2003 +0000
+++ b/lib/protocols.c	Mon Nov 10 01:59:51 2003 +0000
@@ -1826,8 +1826,8 @@
   int port, sock;
 #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR)
   struct addrinfo hints, *res;
+  int errnum, enable_ipv6;
   char serv[8];
-  int errnum;
 
   if ((request->use_proxy = gftp_need_proxy (request, service,
                                              proxy_hostname, proxy_port)) < 0)
@@ -1835,10 +1835,17 @@
   else if (request->use_proxy == 1)
     request->hostp = NULL;
 
+  gftp_lookup_request_option (request, "enable_ipv6", &enable_ipv6);
+
   request->free_hostp = 1;
   memset (&hints, 0, sizeof (hints));
   hints.ai_flags = AI_CANONNAME;
-  hints.ai_family = PF_UNSPEC;
+
+  if (enable_ipv6)
+    hints.ai_family = PF_UNSPEC;
+  else
+    hints.ai_family = AF_INET;
+
   hints.ai_socktype = SOCK_STREAM;
 
   if (request->use_proxy)
@@ -1926,7 +1933,7 @@
   if ((sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
     {
       request->logging_function (gftp_logging_error, request,
-                                 _("Failed to create a socket: %s\n"),
+                                 _("Failed to create a IPv4 socket: %s\n"),
                                  g_strerror (errno));
       return (GFTP_ERETRYABLE);
     }
--- a/lib/rfc959.c	Mon Nov 10 01:42:38 2003 +0000
+++ b/lib/rfc959.c	Mon Nov 10 01:59:51 2003 +0000
@@ -620,7 +620,7 @@
   if ((parms->data_connection = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
     {
       request->logging_function (gftp_logging_error, request,
-				 _("Failed to create a socket: %s\n"),
+				 _("Failed to create a IPv4 socket: %s\n"),
 				 g_strerror (errno));
       gftp_disconnect (request);
       return (GFTP_ERETRYABLE);
@@ -767,7 +767,7 @@
   if ((parms->data_connection = socket (AF_INET6, SOCK_STREAM, IPPROTO_TCP)) < 0)
     {
       request->logging_function (gftp_logging_error, request,
-				 _("Failed to create a socket: %s\n"),
+				 _("Failed to create a IPv6 socket: %s\n"),
 				 g_strerror (errno));
       gftp_disconnect (request);
       return (GFTP_ERETRYABLE);