Remove option to disable ipv6

It has been default for a while, is the only tested option,
and will only get more common.
This commit is contained in:
TingPing 2014-12-28 13:38:47 -05:00
parent 9cb73f839f
commit 1b2bee37e4
10 changed files with 7 additions and 172 deletions

View File

@ -44,7 +44,6 @@ AH_VERBATIM([HAVE_ISO_CODES],[#undef HAVE_ISO_CODES])
AH_VERBATIM([HAVE_GTK_MAC],[#undef HAVE_GTK_MAC]) AH_VERBATIM([HAVE_GTK_MAC],[#undef HAVE_GTK_MAC])
AH_VERBATIM([USE_LIBNOTIFY],[#undef USE_LIBNOTIFY]) AH_VERBATIM([USE_LIBNOTIFY],[#undef USE_LIBNOTIFY])
AH_VERBATIM([USE_LIBCANBERRA],[#undef USE_LIBCANBERRA]) AH_VERBATIM([USE_LIBCANBERRA],[#undef USE_LIBCANBERRA])
AH_VERBATIM([USE_IPV6],[#undef USE_IPV6])
AH_VERBATIM([USE_OPENSSL],[#undef USE_OPENSSL]) AH_VERBATIM([USE_OPENSSL],[#undef USE_OPENSSL])
AH_VERBATIM([USE_PLUGIN],[#undef USE_PLUGIN]) AH_VERBATIM([USE_PLUGIN],[#undef USE_PLUGIN])
AH_VERBATIM([USE_SIGACTION],[#undef USE_SIGACTION]) AH_VERBATIM([USE_SIGACTION],[#undef USE_SIGACTION])
@ -88,10 +87,6 @@ AC_ARG_ENABLE(socks,
[AS_HELP_STRING([--enable-socks],[link with SOCKS5 library (default: no)])], [AS_HELP_STRING([--enable-socks],[link with SOCKS5 library (default: no)])],
socks=$enableval, socks=no) socks=$enableval, socks=no)
AC_ARG_ENABLE(ipv6,
[AS_HELP_STRING([--disable-ipv6],[disable IPv6])],
ipv6=$enableval, ipv6=yes)
AC_ARG_ENABLE(openssl, AC_ARG_ENABLE(openssl,
[AS_HELP_STRING([--enable-openssl[=PATH]],[enable use of openSSL])], [AS_HELP_STRING([--enable-openssl[=PATH]],[enable use of openSSL])],
openssl=$enableval, openssl=yes) openssl=$enableval, openssl=yes)
@ -354,16 +349,13 @@ AC_CHECK_FUNC(select, ,
AC_MSG_WARN(i can not find select. you might need to help me))))))) AC_MSG_WARN(i can not find select. you might need to help me)))))))
AC_CHECK_LIB(socket, select) AC_CHECK_LIB(socket, select)
if test "$ipv6" = yes; then AC_CHECK_FUNCS(getaddrinfo, have_getaddrinfo=yes)
AC_CHECK_FUNCS(getaddrinfo, have_getaddrinfo=yes) AC_MSG_CHECKING(whether IPv6 is supported)
AC_MSG_CHECKING(whether to enable IPv6 support) if test "$have_getaddrinfo" = yes; then
if test "$have_getaddrinfo" = yes; then
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(USE_IPV6) else
else
ipv6=no
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi AC_MSG_ERROR(ipv6 support not found!)
fi fi
dnl ********************************************************************* dnl *********************************************************************
@ -847,7 +839,6 @@ echo D-Bus support ......... : $dbus
echo libnotify support ..... : $libnotify echo libnotify support ..... : $libnotify
echo libcanberra support ... : $libcanberra echo libcanberra support ... : $libcanberra
echo Plugin interface ...... : $plugin echo Plugin interface ...... : $plugin
echo IPv6 support .......... : $ipv6
echo libproxy support ...... : $libproxy echo libproxy support ...... : $libproxy
echo echo
echo Perl .................. : $perl echo Perl .................. : $perl

View File

@ -760,15 +760,11 @@ xchat_init (void)
#ifdef WIN32 #ifdef WIN32
WSADATA wsadata; WSADATA wsadata;
#ifdef USE_IPV6
if (WSAStartup(0x0202, &wsadata) != 0) if (WSAStartup(0x0202, &wsadata) != 0)
{ {
MessageBox (NULL, "Cannot find winsock 2.2+", "Error", MB_OK); MessageBox (NULL, "Cannot find winsock 2.2+", "Error", MB_OK);
exit (0); exit (0);
} }
#else
WSAStartup(0x0101, &wsadata);
#endif /* !USE_IPV6 */
#endif /* !WIN32 */ #endif /* !WIN32 */
#ifdef USE_SIGACTION #ifdef USE_SIGACTION

View File

@ -25,9 +25,7 @@
#include "text.h" #include "text.h"
static int identd_is_running = FALSE; static int identd_is_running = FALSE;
#ifdef USE_IPV6
static int identd_ipv6_is_running = FALSE; static int identd_ipv6_is_running = FALSE;
#endif
static int static int
identd (char *username) identd (char *username)
@ -104,7 +102,6 @@ identd (char *username)
return 0; return 0;
} }
#ifdef USE_IPV6
static int static int
identd_ipv6 (char *username) identd_ipv6 (char *username)
{ {
@ -182,7 +179,6 @@ identd_start (char *username)
{ {
DWORD tid; DWORD tid;
#ifdef USE_IPV6
DWORD tidv6; DWORD tidv6;
if (identd_ipv6_is_running == FALSE) if (identd_ipv6_is_running == FALSE)
{ {
@ -190,7 +186,6 @@ identd_start (char *username)
CloseHandle (CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) identd_ipv6, CloseHandle (CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) identd_ipv6,
g_strdup (username), 0, &tidv6)); g_strdup (username), 0, &tidv6));
} }
#endif
if (identd_is_running == FALSE) if (identd_is_running == FALSE)
{ {

View File

@ -48,12 +48,8 @@
#else #else
#include "config.h" #include "config.h"
#ifdef USE_IPV6
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#else
#include <winsock2.h>
#endif
#define set_blocking(sok) { \ #define set_blocking(sok) { \
unsigned long zero = 0; \ unsigned long zero = 0; \

View File

@ -65,10 +65,8 @@ net_ip (guint32 addr)
void void
net_store_destroy (netstore * ns) net_store_destroy (netstore * ns)
{ {
#ifdef USE_IPV6
if (ns->ip6_hostent) if (ns->ip6_hostent)
freeaddrinfo (ns->ip6_hostent); freeaddrinfo (ns->ip6_hostent);
#endif
g_free (ns); g_free (ns);
} }
@ -78,110 +76,6 @@ net_store_new (void)
return g_new0 (netstore, 1); return g_new0 (netstore, 1);
} }
#ifndef USE_IPV6
/* =================== IPV4 ================== */
/*
A note about net_resolve and lookupd:
Many IRC networks rely on round-robin DNS for load balancing, rotating the list
of IP address on each query. However, this method breaks when DNS queries are
cached. Mac OS X and Darwin handle DNS lookups through the lookupd daemon, which
caches queries in its default configuration: thus, if we always pick the first
address, we will be stuck with the same host (which might be down!) until the
TTL reaches 0 or lookupd is reset (typically, at reboot). Therefore, we need to
pick a random address from the result list, instead of always using the first.
*/
char *
net_resolve (netstore * ns, char *hostname, int port, char **real_host)
{
ns->ip4_hostent = gethostbyname (hostname);
if (!ns->ip4_hostent)
return NULL;
memset (&ns->addr, 0, sizeof (ns->addr));
#ifdef LOOKUPD
int count = 0;
while (ns->ip4_hostent->h_addr_list[count]) count++;
memcpy (&ns->addr.sin_addr,
ns->ip4_hostent->h_addr_list[RAND_INT(count)],
ns->ip4_hostent->h_length);
#else
memcpy (&ns->addr.sin_addr, ns->ip4_hostent->h_addr,
ns->ip4_hostent->h_length);
#endif
ns->addr.sin_port = htons (port);
ns->addr.sin_family = AF_INET;
*real_host = g_strdup (ns->ip4_hostent->h_name);
return g_strdup (inet_ntoa (ns->addr.sin_addr));
}
int
net_connect (netstore * ns, int sok4, int sok6, int *sok_return)
{
*sok_return = sok4;
return connect (sok4, (struct sockaddr *) &ns->addr, sizeof (ns->addr));
}
void
net_bind (netstore * tobindto, int sok4, int sok6)
{
bind (sok4, (struct sockaddr *) &tobindto->addr, sizeof (tobindto->addr));
}
void
net_sockets (int *sok4, int *sok6)
{
*sok4 = socket (AF_INET, SOCK_STREAM, 0);
*sok6 = -1;
net_set_socket_options (*sok4);
}
void
udp_sockets (int *sok4, int *sok6)
{
*sok4 = socket (AF_INET, SOCK_DGRAM, 0);
*sok6 = -1;
}
void
net_store_fill_any (netstore *ns)
{
ns->addr.sin_family = AF_INET;
ns->addr.sin_addr.s_addr = INADDR_ANY;
ns->addr.sin_port = 0;
}
void
net_store_fill_v4 (netstore *ns, guint32 addr, int port)
{
ns->addr.sin_family = AF_INET;
ns->addr.sin_addr.s_addr = addr;
ns->addr.sin_port = port;
}
guint32
net_getsockaddr_v4 (netstore *ns)
{
return ns->addr.sin_addr.s_addr;
}
int
net_getsockport (int sok4, int sok6)
{
struct sockaddr_in addr;
int len = sizeof (addr);
if (getsockname (sok4, (struct sockaddr *)&addr, &len) == -1)
return -1;
return addr.sin_port;
}
#else
/* =================== IPV6 ================== */ /* =================== IPV6 ================== */
char * char *
@ -294,5 +188,3 @@ udp_sockets (int *sok4, int *sok6)
*sok4 = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); *sok4 = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
*sok6 = socket (AF_INET6, SOCK_DGRAM, IPPROTO_UDP); *sok6 = socket (AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
} }
#endif

View File

@ -23,12 +23,7 @@
typedef struct netstore_ typedef struct netstore_
{ {
#ifdef NETWORK_PRIVATE #ifdef NETWORK_PRIVATE
#ifdef USE_IPV6
struct addrinfo *ip6_hostent; struct addrinfo *ip6_hostent;
#else
struct hostent *ip4_hostent;
struct sockaddr_in addr;
#endif
#else #else
int _dummy; /* some compilers don't like empty structs */ int _dummy; /* some compilers don't like empty structs */
#endif #endif

View File

@ -914,12 +914,10 @@ server_read_child (GIOChannel *source, GIOCondition condition, server *serv)
closesocket (serv->sok4); closesocket (serv->sok4);
if (serv->proxy_sok4 != -1) if (serv->proxy_sok4 != -1)
closesocket (serv->proxy_sok4); closesocket (serv->proxy_sok4);
#ifdef USE_IPV6
if (serv->sok6 != -1) if (serv->sok6 != -1)
closesocket (serv->sok6); closesocket (serv->sok6);
if (serv->proxy_sok6 != -1) if (serv->proxy_sok6 != -1)
closesocket (serv->proxy_sok6); closesocket (serv->proxy_sok6);
#endif
EMIT_SIGNAL (XP_TE_UKNHOST, sess, NULL, NULL, NULL, NULL, 0); EMIT_SIGNAL (XP_TE_UKNHOST, sess, NULL, NULL, NULL, NULL, 0);
if (!servlist_cycle (serv)) if (!servlist_cycle (serv))
if (prefs.hex_net_auto_reconnectonfail) if (prefs.hex_net_auto_reconnectonfail)
@ -931,12 +929,10 @@ server_read_child (GIOChannel *source, GIOCondition condition, server *serv)
closesocket (serv->sok4); closesocket (serv->sok4);
if (serv->proxy_sok4 != -1) if (serv->proxy_sok4 != -1)
closesocket (serv->proxy_sok4); closesocket (serv->proxy_sok4);
#ifdef USE_IPV6
if (serv->sok6 != -1) if (serv->sok6 != -1)
closesocket (serv->sok6); closesocket (serv->sok6);
if (serv->proxy_sok6 != -1) if (serv->proxy_sok6 != -1)
closesocket (serv->proxy_sok6); closesocket (serv->proxy_sok6);
#endif
EMIT_SIGNAL (XP_TE_CONNFAIL, sess, errorstring (atoi (tbuf)), NULL, EMIT_SIGNAL (XP_TE_CONNFAIL, sess, errorstring (atoi (tbuf)), NULL,
NULL, NULL, 0); NULL, NULL, 0);
if (!servlist_cycle (serv)) if (!servlist_cycle (serv))
@ -974,7 +970,6 @@ server_read_child (GIOChannel *source, GIOCondition condition, server *serv)
case '4': /* success */ case '4': /* success */
waitline2 (source, tbuf, sizeof (tbuf)); waitline2 (source, tbuf, sizeof (tbuf));
serv->sok = atoi (tbuf); serv->sok = atoi (tbuf);
#ifdef USE_IPV6
/* close the one we didn't end up using */ /* close the one we didn't end up using */
if (serv->sok == serv->sok4) if (serv->sok == serv->sok4)
closesocket (serv->sok6); closesocket (serv->sok6);
@ -987,7 +982,6 @@ server_read_child (GIOChannel *source, GIOCondition condition, server *serv)
else else
closesocket (serv->proxy_sok4); closesocket (serv->proxy_sok4);
} }
#endif
server_connect_success (serv); server_connect_success (serv);
break; break;
case '5': /* prefs ip discovered */ case '5': /* prefs ip discovered */
@ -1612,12 +1606,10 @@ server_child (server * serv)
xit: xit:
#if defined (USE_IPV6) || defined (WIN32)
/* this is probably not needed */ /* this is probably not needed */
net_store_destroy (ns_server); net_store_destroy (ns_server);
if (ns_proxy) if (ns_proxy)
net_store_destroy (ns_proxy); net_store_destroy (ns_proxy);
#endif
/* no need to free ip/real_hostname, this process is exiting */ /* no need to free ip/real_hostname, this process is exiting */
#ifdef WIN32 #ifdef WIN32

View File

@ -67,12 +67,6 @@ static const struct defaultserver def[] =
{0, "eu.afternet.org"}, {0, "eu.afternet.org"},
{"Aitvaras", 0}, {"Aitvaras", 0},
#ifdef USE_IPV6
#ifdef USE_OPENSSL
{0, "irc6.ktu.lt/+7668"},
#endif
{0, "irc6.ktu.lt/7666"},
#endif
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
{0, "irc.data.lt/+6668"}, {0, "irc.data.lt/+6668"},
{0, "irc.omnitel.net/+6668"}, {0, "irc.omnitel.net/+6668"},
@ -192,12 +186,6 @@ static const struct defaultserver def[] =
{0, "irc.entropynet.net/+6697"}, {0, "irc.entropynet.net/+6697"},
#endif #endif
{0, "irc.entropynet.net"}, {0, "irc.entropynet.net"},
#ifdef USE_IPV6
#ifdef USE_OPENSSL
{0, "irc6.entropynet.net/+6697"},
#endif
{0, "irc6.entropynet.net"},
#endif
{"EsperNet", 0, 0, 0, LOGIN_SASL}, {"EsperNet", 0, 0, 0, LOGIN_SASL},
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
@ -326,9 +314,6 @@ static const struct defaultserver def[] =
{0, "as.link-net.org/+7000"}, {0, "as.link-net.org/+7000"},
{0, "eu.link-net.org/+7000"}, {0, "eu.link-net.org/+7000"},
{0, "us.link-net.org/+7000"}, {0, "us.link-net.org/+7000"},
#ifdef USE_IPV6
{0, "irc6.link-net.org/+7000"},
#endif
#endif #endif
{"MindForge", 0}, {"MindForge", 0},

View File

@ -111,9 +111,6 @@ fe_new_window (struct session *sess, int focus)
#endif #endif
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
"OpenSSL " "OpenSSL "
#endif
#ifdef USE_IPV6
"IPv6"
#endif #endif
"\n\n", 0, FALSE); "\n\n", 0, FALSE);
fflush (stdout); fflush (stdout);

View File

@ -2,7 +2,6 @@
#define ENABLE_NLS #define ENABLE_NLS
#define USE_PLUGIN #define USE_PLUGIN
#define USE_OPENSSL #define USE_OPENSSL
#define USE_IPV6
#define HAVE_ISO_CODES #define HAVE_ISO_CODES
#define ISO_CODES_PREFIX ".\\" #define ISO_CODES_PREFIX ".\\"
#define ISO_CODES_LOCALEDIR LOCALEDIR #define ISO_CODES_LOCALEDIR LOCALEDIR
@ -13,6 +12,3 @@
#define OLD_PERL #define OLD_PERL
#define GETTEXT_PACKAGE "hexchat" #define GETTEXT_PACKAGE "hexchat"
#define PACKAGE_TARNAME "hexchat-<#= [string]::Join('.', $versionParts) #>" #define PACKAGE_TARNAME "hexchat-<#= [string]::Join('.', $versionParts) #>"
#ifndef USE_IPV6
#define socklen_t int
#endif