From de2934965c2c685270d123aa2e4fd0088511803c Mon Sep 17 00:00:00 2001
From: Simon Arlott <sa.me.uk>
Date: Fri, 18 Aug 2017 13:03:59 +0100
Subject: [PATCH] remove RB_IPV6

---
 authd/dns.c                 | 12 ----------
 authd/providers/blacklist.c |  2 --
 authd/providers/opm.c       | 12 ----------
 authd/res.c                 | 19 ---------------
 configure.ac                |  3 ---
 extensions/extb_hostmask.c  |  2 --
 include/hostmask.h          |  8 ++-----
 include/ircd_defs.h         | 13 -----------
 include/m_info.h            |  4 ----
 include/s_conf.h            |  4 +---
 include/s_newconf.h         |  4 ----
 ircd/authproc.c             |  2 --
 ircd/bandbi.c               |  2 --
 ircd/channel.c              |  7 +-----
 ircd/dns.c                  |  6 -----
 ircd/hostmask.c             | 31 +++----------------------
 ircd/listener.c             | 15 ++----------
 ircd/match.c                | 12 ++--------
 ircd/newconf.c              | 33 --------------------------
 ircd/reject.c               |  4 ----
 ircd/s_conf.c               |  2 --
 ircd/s_newconf.c            | 10 --------
 ircd/s_serv.c               |  8 -------
 librb/configure.ac          | 28 ----------------------
 librb/include/rb_lib.h      |  9 --------
 librb/include/rb_patricia.h |  2 --
 librb/src/commio.c          | 33 +-------------------------
 librb/src/patricia.c        | 46 +++----------------------------------
 modules/m_dline.c           |  2 --
 modules/m_etrace.c          |  4 ----
 modules/m_kline.c           |  2 --
 modules/m_testline.c        |  4 ----
 modules/m_version.c         |  2 --
 modules/m_whois.c           |  4 ----
 34 files changed, 15 insertions(+), 336 deletions(-)

diff --git a/authd/dns.c b/authd/dns.c
index b251dd63..f223bf30 100644
--- a/authd/dns.c
+++ b/authd/dns.c
@@ -43,13 +43,11 @@ lookup_ip(const char *host, int aftype, DNSCB callback, void *data)
 		query->type = QUERY_A;
 		g_type = T_A;
 	}
-#ifdef RB_IPV6
 	else if(aftype == AF_INET6)
 	{
 		query->type = QUERY_AAAA;
 		g_type = T_AAAA;
 	}
-#endif
 	else
 	{
 		rb_free(query);
@@ -85,10 +83,8 @@ lookup_hostname(const char *ip, DNSCB callback, void *data)
 
 	if(aftype == AF_INET)
 		query->type = QUERY_PTR_A;
-#ifdef RB_IPV6
 	else if(aftype == AF_INET6)
 		query->type = QUERY_PTR_AAAA;
-#endif
 	else
 	{
 		rb_free(query);
@@ -137,7 +133,6 @@ handle_lookup_ip_reply(void *data, struct DNSReply *reply)
 		if(GET_SS_FAMILY(&reply->addr) == AF_INET)
 			rb_inet_ntop_sock((struct sockaddr *)&reply->addr, ip, sizeof(ip));
 		break;
-#ifdef RB_IPV6
 	case QUERY_AAAA:
 		if(GET_SS_FAMILY(&reply->addr) == AF_INET6)
 		{
@@ -149,7 +144,6 @@ handle_lookup_ip_reply(void *data, struct DNSReply *reply)
 			}
 		}
 		break;
-#endif
 	default:
 		warn_opers(L_CRIT, "DNS: handle_lookup_ip_reply: unknown query type %d",
 				query->type);
@@ -189,7 +183,6 @@ handle_lookup_hostname_reply(void *data, struct DNSReply *reply)
 		if(ip->sin_addr.s_addr == ip_fwd->sin_addr.s_addr)
 			hostname = reply->h_name;
 	}
-#ifdef RB_IPV6
 	else if(query->type == QUERY_PTR_AAAA)
 	{
 		struct sockaddr_in6 *ip, *ip_fwd;
@@ -199,7 +192,6 @@ handle_lookup_hostname_reply(void *data, struct DNSReply *reply)
 		if(memcmp(&ip->sin6_addr, &ip_fwd->sin6_addr, sizeof(struct in6_addr)) == 0)
 			hostname = reply->h_name;
 	}
-#endif
 	else
 	{
 		/* Shouldn't happen */
@@ -246,17 +238,13 @@ handle_resolve_dns(int parc, char *parv[])
 
 	switch(qtype)
 	{
-#ifdef RB_IPV6
 	case '6':
 		aftype = AF_INET6;
-#endif
 	case '4':
 		if(!lookup_ip(record, aftype, submit_dns_answer, id))
 			submit_dns_answer(NULL, false, qtype, NULL);
 		break;
-#ifdef RB_IPV6
 	case 'S':
-#endif
 	case 'R':
 		if(!lookup_hostname(record, submit_dns_answer, id))
 			submit_dns_answer(NULL, false, qtype, NULL);
diff --git a/authd/providers/blacklist.c b/authd/providers/blacklist.c
index 1855c1d8..1b04bcbc 100644
--- a/authd/providers/blacklist.c
+++ b/authd/providers/blacklist.c
@@ -310,10 +310,8 @@ lookup_all_blacklists(struct auth_client *auth)
 
 	if(GET_SS_FAMILY(&auth->c_addr) == AF_INET)
 		iptype = IPTYPE_IPV4;
-#ifdef RB_IPV6
 	else if(GET_SS_FAMILY(&auth->c_addr) == AF_INET6)
 		iptype = IPTYPE_IPV6;
-#endif
 	else
 		return false;
 
diff --git a/authd/providers/opm.c b/authd/providers/opm.c
index 22b9ba3f..72c6035d 100644
--- a/authd/providers/opm.c
+++ b/authd/providers/opm.c
@@ -236,7 +236,6 @@ accept_opm(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t len, voi
 				}
 				break;
 			}
-#ifdef RB_IPV6
 		case AF_INET6:
 			{
 				struct sockaddr_in6 *s = (struct sockaddr_in6 *)&localaddr, *c = (struct sockaddr_in6 *)&auth->c_addr;
@@ -248,7 +247,6 @@ accept_opm(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t len, voi
 				}
 				break;
 			}
-#endif
 		default:
 			warn_opers(L_CRIT, "OPM: unknown address type in listen function");
 			exit(EX_PROVIDER_ERROR);
@@ -283,7 +281,6 @@ opm_connected(rb_fde_t *F, int error, void *data)
 			goto end;
 
 		break;
-#ifdef RB_IPV6
 	case AF_INET6:
 		if(!proxy->ipv6)
 			/* Welp, too bad */
@@ -294,7 +291,6 @@ opm_connected(rb_fde_t *F, int error, void *data)
 			goto end;
 
 		break;
-#endif
 	default:
 		goto end;
 	}
@@ -347,13 +343,11 @@ socks5_connected(struct opm_scan *scan)
 		memcpy(c, &(((struct sockaddr_in *)&scan->listener->addr)->sin_addr.s_addr), 4); c += 4; /* Address */
 		memcpy(c, &(((struct sockaddr_in *)&scan->listener->addr)->sin_port), 2); c += 2; /* Port */
 		break;
-#ifdef RB_IPV6
 	case AF_INET6:
 		*(c++) = '\x04'; /* Address type (4 = IPv6) */
 		memcpy(c, ((struct sockaddr_in6 *)&scan->listener->addr)->sin6_addr.s6_addr, 16); c += 16; /* Address */
 		memcpy(c, &(((struct sockaddr_in6 *)&scan->listener->addr)->sin6_port), 2); c += 2; /* Port */
 		break;
-#endif
 	default:
 		return;
 	}
@@ -400,7 +394,6 @@ establish_connection(struct auth_client *auth, struct opm_proxy *proxy)
 
 	lrb_assert(lookup != NULL);
 
-#ifdef RB_IPV6
 	if(GET_SS_FAMILY(&auth->c_addr) == AF_INET6)
 	{
 		if(proxy->proto == PROTO_SOCKS4)
@@ -412,7 +405,6 @@ establish_connection(struct auth_client *auth, struct opm_proxy *proxy)
 		listener = &listeners[LISTEN_IPV6];
 	}
 	else
-#endif
 		listener = &listeners[LISTEN_IPV4];
 
 	if(listener->F == NULL)
@@ -473,7 +465,6 @@ create_listener(const char *ip, uint16_t port)
 
 	SET_SS_PORT(&addr, htons(port));
 
-#ifdef RB_IPV6
 	if(GET_SS_FAMILY(&addr) == AF_INET6)
 	{
 		struct sockaddr_in6 *a1, *a2;
@@ -492,7 +483,6 @@ create_listener(const char *ip, uint16_t port)
 		}
 	}
 	else
-#endif
 	{
 		struct sockaddr_in *a1, *a2;
 
@@ -904,10 +894,8 @@ delete_opm_listener_all(const char *key __unused, int parc __unused, const char
 	if(listeners[LISTEN_IPV4].F != NULL)
 		rb_close(listeners[LISTEN_IPV4].F);
 
-#ifdef RB_IPV6
 	if(listeners[LISTEN_IPV6].F != NULL)
 		rb_close(listeners[LISTEN_IPV6].F);
-#endif
 
 	memset(&listeners, 0, sizeof(listeners));
 }
diff --git a/authd/res.c b/authd/res.c
index 87817473..9c07c395 100644
--- a/authd/res.c
+++ b/authd/res.c
@@ -56,9 +56,7 @@ static PF res_readreply;
 #define RDLENGTH_SIZE     (size_t)2
 #define ANSWER_FIXED_SIZE (TYPE_SIZE + CLASS_SIZE + TTL_SIZE + RDLENGTH_SIZE)
 
-#ifdef RB_IPV6
 struct in6_addr ipv6_addr;
-#endif
 struct in_addr ipv4_addr;
 
 struct reslist
@@ -112,10 +110,8 @@ static uint16_t generate_random_id(void);
 static int
 res_ourserver(const struct rb_sockaddr_storage *inp)
 {
-#ifdef RB_IPV6
 	const struct sockaddr_in6 *v6;
 	const struct sockaddr_in6 *v6in = (const struct sockaddr_in6 *)inp;
-#endif
 	const struct sockaddr_in *v4;
 	const struct sockaddr_in *v4in = (const struct sockaddr_in *)inp;
 	int ns;
@@ -123,9 +119,7 @@ res_ourserver(const struct rb_sockaddr_storage *inp)
 	for(ns = 0; ns < irc_nscount; ns++)
 	{
 		const struct rb_sockaddr_storage *srv = &irc_nsaddr_list[ns];
-#ifdef RB_IPV6
 		v6 = (const struct sockaddr_in6 *)srv;
-#endif
 		v4 = (const struct sockaddr_in *)srv;
 
 		/* could probably just memcmp(srv, inp, srv.ss_len) here
@@ -133,7 +127,6 @@ res_ourserver(const struct rb_sockaddr_storage *inp)
 		 */
 		switch (GET_SS_FAMILY(srv))
 		{
-#ifdef RB_IPV6
 		case AF_INET6:
 			if(GET_SS_FAMILY(srv) == GET_SS_FAMILY(inp))
 				if(v6->sin6_port == v6in->sin6_port)
@@ -143,7 +136,6 @@ res_ourserver(const struct rb_sockaddr_storage *inp)
 						   sizeof(struct in6_addr)) == 0))
 						return 1;
 			break;
-#endif
 		case AF_INET:
 			if(GET_SS_FAMILY(srv) == GET_SS_FAMILY(inp))
 				if(v4->sin_port == v4in->sin_port)
@@ -476,7 +468,6 @@ void build_rdns(char *buf, size_t size, const struct rb_sockaddr_storage *addr,
 			(unsigned int)(cp[0]),
 			suffix == NULL ? "in-addr.arpa" : suffix);
 	}
-#ifdef RB_IPV6
 	else if (GET_SS_FAMILY(addr) == AF_INET6)
 	{
 		const struct sockaddr_in6 *v6 = (const struct sockaddr_in6 *)addr;
@@ -508,8 +499,6 @@ void build_rdns(char *buf, size_t size, const struct rb_sockaddr_storage *addr,
 
 #undef HI_NIBBLE
 #undef LO_NIBBLE
-
-#endif
 }
 
 /*
@@ -570,9 +559,7 @@ static void resend_query(struct reslist *request)
 		do_query_number(NULL, &request->addr, request);
 		break;
 	case T_A:
-#ifdef RB_IPV6
 	case T_AAAA:
-#endif
 		do_query_name(NULL, request->name, request, request->type);
 		break;
 	default:
@@ -614,9 +601,7 @@ static int proc_answer(struct reslist *request, HEADER * header, char *buf, char
 	int n;			/* temp count */
 	int rd_length;
 	struct sockaddr_in *v4;	/* conversion */
-#ifdef RB_IPV6
 	struct sockaddr_in6 *v6;
-#endif
 	current = (unsigned char *)buf + sizeof(HEADER);
 
 	for (; header->qdcount > 0; --header->qdcount)
@@ -694,7 +679,6 @@ static int proc_answer(struct reslist *request, HEADER * header, char *buf, char
 			v4->sin_family = AF_INET;
 			memcpy(&v4->sin_addr, current, sizeof(struct in_addr));
 			return (1);
-#ifdef RB_IPV6
 		case T_AAAA:
 			if (request->type != T_AAAA)
 				return (0);
@@ -705,7 +689,6 @@ static int proc_answer(struct reslist *request, HEADER * header, char *buf, char
 			v6->sin6_family = AF_INET6;
 			memcpy(&v6->sin6_addr, current, sizeof(struct in6_addr));
 			return (1);
-#endif
 		case T_PTR:
 			if (request->type != T_PTR)
 				return (0);
@@ -856,11 +839,9 @@ static int res_read_single_reply(rb_fde_t *F, void *data)
 			 * Lookup the 'authoritative' name that we were given for the
 			 * ip#.
 			 */
-#ifdef RB_IPV6
 			if (GET_SS_FAMILY(&request->addr) == AF_INET6)
 				gethost_byname_type_fqdn(request->name, request->query, T_AAAA);
 			else
-#endif
 				gethost_byname_type_fqdn(request->name, request->query, T_A);
 			rem_request(request);
 		}
diff --git a/configure.ac b/configure.ac
index e4f6c602..1170792c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -168,9 +168,6 @@ if test x"$SUN" = xyes; then
 	AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])])
 fi
 
-AC_ARG_ENABLE(ipv6,
-AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no])
-
 AC_SEARCH_LIBS(crypt, [crypt descrypt],,)
 
 CRYPT_LIB=$ac_cv_search_crypt
diff --git a/extensions/extb_hostmask.c b/extensions/extb_hostmask.c
index 9aa964de..15182981 100644
--- a/extensions/extb_hostmask.c
+++ b/extensions/extb_hostmask.c
@@ -53,7 +53,6 @@ eb_hostmask(const char *banstr, struct Client *client_p, struct Channel *chptr,
 		s3 = src_althost;
 	}
 
-#ifdef RB_IPV6
 	/* handle Teredo if necessary */
 	if (GET_SS_FAMILY(&client_p->localClient->ip) == AF_INET6 && rb_ipv4_from_ipv6((const struct sockaddr_in6 *) &client_p->localClient->ip, &ip4))
 	{
@@ -63,7 +62,6 @@ eb_hostmask(const char *banstr, struct Client *client_p, struct Channel *chptr,
 				s4, src_ip4host + sizeof src_ip4host - s4);
 		s4 = src_ip4host;
 	}
-#endif
 
 	return match(banstr, s) || match(banstr, s2) || (s3 != NULL && match(banstr, s3)) || (s4 != NULL && match(banstr, s4)) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
 }
diff --git a/include/hostmask.h b/include/hostmask.h
index 8e97cf74..bb41b6c2 100644
--- a/include/hostmask.h
+++ b/include/hostmask.h
@@ -28,10 +28,8 @@
 enum
 {
 	HM_HOST,
-	HM_IPV4
-#ifdef RB_IPV6
-		, HM_IPV6
-#endif
+	HM_IPV4,
+	HM_IPV6,
 };
 
 int parse_netmask(const char *, struct rb_sockaddr_storage *, int *);
@@ -57,9 +55,7 @@ struct ConfItem *find_dline(struct sockaddr *, int);
 			 GET_SS_FAMILY(&(x)->localClient->ip), (x)->username, NULL))
 
 void report_auth(struct Client *);
-#ifdef RB_IPV6
 int match_ipv6(struct sockaddr *, struct sockaddr *, int);
-#endif
 int match_ipv4(struct sockaddr *, struct sockaddr *, int);
 
 /* Hashtable stuff... */
diff --git a/include/ircd_defs.h b/include/ircd_defs.h
index 4e9ea037..2736a93e 100644
--- a/include/ircd_defs.h
+++ b/include/ircd_defs.h
@@ -107,24 +107,11 @@
 #define CLIENT_PARSE_ERROR -1
 #define CLIENT_OK	1
 
-#ifdef RB_IPV6
 #ifndef AF_INET6
 #error "AF_INET6 not defined"
 #endif
 
-
-#else /* #ifdef RB_IPV6 */
-
-#ifndef AF_INET6
-#define AF_INET6 AF_MAX		/* Dummy AF_INET6 declaration */
-#endif
-#endif /* #ifdef RB_IPV6 */
-
-#ifdef RB_IPV6
 #define PATRICIA_BITS	128
-#else
-#define PATRICIA_BITS	32
-#endif
 
 /* Read buffer size */
 #define READBUF_SIZE 16384
diff --git a/include/m_info.h b/include/m_info.h
index d0ff6417..94a870c3 100644
--- a/include/m_info.h
+++ b/include/m_info.h
@@ -70,11 +70,7 @@ Info MyInformation[] = {
 	 "Maximum Queue Length of Pending Connections"},
 #endif /* SOMAXCONN */
 
-#ifdef RB_IPV6
 	{"IPV6", "ON", 0, "IPv6 Support"},
-#else
-	{"IPV6", "OFF", 0, "IPv6 Support"},
-#endif
 
 	{"JOIN_LEAVE_COUNT_EXPIRE_TIME", "", JOIN_LEAVE_COUNT_EXPIRE_TIME,
 	 "Anti SpamBot Parameter"},
diff --git a/include/s_conf.h b/include/s_conf.h
index 4c3bd5ee..3d0cd7b6 100644
--- a/include/s_conf.h
+++ b/include/s_conf.h
@@ -283,10 +283,8 @@ struct server_info
 	char *network_name;
 	int hub;
 	struct rb_sockaddr_storage bind4;
-	int default_max_clients;
-#ifdef RB_IPV6
 	struct rb_sockaddr_storage bind6;
-#endif
+	int default_max_clients;
 	char *ssl_private_key;
 	char *ssl_ca_cert;
 	char *ssl_cert;
diff --git a/include/s_newconf.h b/include/s_newconf.h
index 7a489b1a..391d396b 100644
--- a/include/s_newconf.h
+++ b/include/s_newconf.h
@@ -181,10 +181,8 @@ struct server_conf
 	char *connect_host;
 	struct rb_sockaddr_storage connect4;
 	uint16_t dns_query_connect4;
-#ifdef RB_IPV6
 	struct rb_sockaddr_storage connect6;
 	uint16_t dns_query_connect6;
-#endif
 	char *passwd;
 	char *spasswd;
 	char *certfp;
@@ -197,10 +195,8 @@ struct server_conf
 	char *bind_host;
 	struct rb_sockaddr_storage bind4;
 	uint16_t dns_query_bind4;
-#ifdef RB_IPV6
 	struct rb_sockaddr_storage bind6;
 	uint16_t dns_query_bind6;
-#endif
 
 	char *class_name;
 	struct Class *class;
diff --git a/ircd/authproc.c b/ircd/authproc.c
index 797d0806..da7640bc 100644
--- a/ircd/authproc.c
+++ b/ircd/authproc.c
@@ -335,11 +335,9 @@ configure_authd(void)
 			rb_helper_write(authd_helper, "O opm_listener %s %hu",
 				opm_listeners[LISTEN_IPV4].ipaddr, opm_listeners[LISTEN_IPV4].port);
 
-#ifdef RB_IPV6
 		if(opm_listeners[LISTEN_IPV6].ipaddr[0] != '\0')
 			rb_helper_write(authd_helper, "O opm_listener %s %hu",
 				opm_listeners[LISTEN_IPV6].ipaddr, opm_listeners[LISTEN_IPV6].port);
-#endif
 
 		RB_DLINK_FOREACH(ptr, opm_list.head)
 		{
diff --git a/ircd/bandbi.c b/ircd/bandbi.c
index 5384840d..dfb4f73d 100644
--- a/ircd/bandbi.c
+++ b/ircd/bandbi.c
@@ -226,11 +226,9 @@ bandb_check_kline(struct ConfItem *aconf)
 
 	if(aftype != HM_HOST)
 	{
-#ifdef RB_IPV6
 		if(aftype == HM_IPV6)
 			aftype = AF_INET6;
 		else
-#endif
 			aftype = AF_INET;
 
 		kconf = find_conf_by_address(aconf->host, NULL, NULL, (struct sockaddr *)&daddr,
diff --git a/ircd/channel.c b/ircd/channel.c
index 50e96a3a..585f3be9 100644
--- a/ircd/channel.c
+++ b/ircd/channel.c
@@ -578,7 +578,6 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list,
 			s3 = src_althost;
 		}
 	}
-#ifdef RB_IPV6
 	if(GET_SS_FAMILY(&who->localClient->ip) == AF_INET6 &&
 			rb_ipv4_from_ipv6((const struct sockaddr_in6 *)&who->localClient->ip, &ip4))
 	{
@@ -588,7 +587,6 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list,
 				s4, src_ip4host + sizeof src_ip4host - s4);
 		s4 = src_ip4host;
 	}
-#endif
 
 	RB_DLINK_FOREACH(ptr, list->head)
 	{
@@ -597,11 +595,8 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list,
 		   match(actualBan->banstr, s2) ||
 		   match_cidr(actualBan->banstr, s2) ||
 		   match_extban(actualBan->banstr, who, chptr, CHFL_BAN) ||
-		   (s3 != NULL && match(actualBan->banstr, s3))
-#ifdef RB_IPV6
-		   ||
+		   (s3 != NULL && match(actualBan->banstr, s3)) ||
 		   (s4 != NULL && (match(actualBan->banstr, s4) || match_cidr(actualBan->banstr, s4)))
-#endif
 		   )
 			break;
 		else
diff --git a/ircd/dns.c b/ircd/dns.c
index b69b1bc2..92cca073 100644
--- a/ircd/dns.c
+++ b/ircd/dns.c
@@ -147,11 +147,9 @@ lookup_hostname(const char *hostname, int aftype, DNSCB callback, void *data)
 	req->callback = callback;
 	req->data = data;
 
-#ifdef RB_IPV6
 	if(aftype == AF_INET6)
 		aft = 6;
 	else
-#endif
 		aft = 4;
 
 	submit_dns(rid, aft == 4 ? DNS_HOST_IPV4 : DNS_HOST_IPV6, hostname);
@@ -172,11 +170,9 @@ lookup_ip(const char *addr, int aftype, DNSCB callback, void *data)
 	req->callback = callback;
 	req->data = data;
 
-#ifdef RB_IPV6
 	if(aftype == AF_INET6)
 		aft = 6;
 	else
-#endif
 		aft = 4;
 
 	submit_dns(rid, aft == 4 ? DNS_REVERSE_IPV4 : DNS_REVERSE_IPV6, addr);
@@ -226,11 +222,9 @@ dns_results_callback(const char *callid, const char *status, const char *type, c
 		req->data = NULL;
 		return;
 	}
-#ifdef RB_IPV6
 	if(aft == 6)
 		aft = AF_INET6;
 	else
-#endif
 		aft = AF_INET;
 
 	req->callback(results, st, aft, req->data);
diff --git a/ircd/hostmask.c b/ircd/hostmask.c
index c342f2c2..c6e124aa 100644
--- a/ircd/hostmask.c
+++ b/ircd/hostmask.c
@@ -31,9 +31,7 @@
 #include "send.h"
 #include "match.h"
 
-#ifdef RB_IPV6
 static unsigned long hash_ipv6(struct sockaddr *, int);
-#endif
 static unsigned long hash_ipv4(struct sockaddr *, int);
 
 
@@ -65,7 +63,6 @@ parse_netmask(const char *text, struct rb_sockaddr_storage *naddr, int *nb)
 	{
 		return HM_HOST;
 	}
-#ifdef RB_IPV6
 	if(strchr(ip, ':'))
 	{
 		if((ptr = strchr(ip, '/')))
@@ -84,7 +81,6 @@ parse_netmask(const char *text, struct rb_sockaddr_storage *naddr, int *nb)
 		else
 			return HM_HOST;
 	} else
-#endif
 	if(strchr(text, '.'))
 	{
 		if((ptr = strchr(ip, '/')))
@@ -139,7 +135,6 @@ hash_ipv4(struct sockaddr *saddr, int bits)
  * Output: A hash value of the IP address.
  * Side effects: None
  */
-#ifdef RB_IPV6
 static unsigned long
 hash_ipv6(struct sockaddr *saddr, int bits)
 {
@@ -162,7 +157,6 @@ hash_ipv6(struct sockaddr *saddr, int bits)
 	}
 	return v & (ATABLE_SIZE - 1);
 }
-#endif
 
 /* int hash_text(const char *start)
  * Input: The start of the text to hash.
@@ -227,7 +221,6 @@ find_conf_by_address(const char *name, const char *sockhost,
 	if(addr)
 	{
 		/* Check for IPV6 matches... */
-#ifdef RB_IPV6
 		if(fam == AF_INET6)
 		{
 
@@ -249,7 +242,6 @@ find_conf_by_address(const char *name, const char *sockhost,
 			}
 		}
 		else
-#endif
 		if(fam == AF_INET)
 		{
 			for (b = 32; b >= 0; b -= 8)
@@ -369,9 +361,7 @@ find_address_conf(const char *host, const char *sockhost, const char *user,
 {
 	struct ConfItem *iconf, *kconf;
 	const char *vuser;
-#ifdef RB_IPV6
 	struct sockaddr_in ip4;
-#endif
 
 	/* Find the best I-line... If none, return NULL -A1kmm */
 	if(!(iconf = find_conf_by_address(host, sockhost, NULL, ip, CONF_CLIENT, aftype, user, auth_user)))
@@ -422,7 +412,6 @@ find_address_conf(const char *host, const char *sockhost, const char *user,
 			return kconf;
 	}
 
-#ifdef RB_IPV6
 	if(ip != NULL && ip->sa_family == AF_INET6 &&
 			rb_ipv4_from_ipv6((const struct sockaddr_in6 *)(const void *)ip, &ip4))
 	{
@@ -430,7 +419,6 @@ find_address_conf(const char *host, const char *sockhost, const char *user,
 		if(kconf)
 			return kconf;
 	}
-#endif /* RB_IPV6 */
 
 	return iconf;
 }
@@ -444,9 +432,7 @@ struct ConfItem *
 find_dline(struct sockaddr *addr, int aftype)
 {
 	struct ConfItem *aconf;
-#ifdef RB_IPV6
 	struct sockaddr_in addr2;
-#endif
 
 	aconf = find_conf_by_address(NULL, NULL, NULL, addr, CONF_EXEMPTDLINE | 1, aftype, NULL, NULL);
 	if(aconf)
@@ -454,7 +440,6 @@ find_dline(struct sockaddr *addr, int aftype)
 	aconf = find_conf_by_address(NULL, NULL, NULL, addr, CONF_DLINE | 1, aftype, NULL, NULL);
 	if(aconf)
 		return aconf;
-#ifdef RB_IPV6
 	if(addr->sa_family == AF_INET6 &&
 			rb_ipv4_from_ipv6((const struct sockaddr_in6 *)(const void *)addr, &addr2))
 	{
@@ -462,7 +447,6 @@ find_dline(struct sockaddr *addr, int aftype)
 		if(aconf)
 			return aconf;
 	}
-#endif
 	return NULL;
 }
 
@@ -482,15 +466,12 @@ find_exact_conf_by_address(const char *address, int type, const char *username)
 	if(address == NULL)
 		address = "/NOMATCH!/";
 	masktype = parse_netmask(address, &addr, &bits);
-#ifdef RB_IPV6
 	if(masktype == HM_IPV6)
 	{
 		/* We have to do this, since we do not re-hash for every bit -A1kmm. */
 		hv = hash_ipv6((struct sockaddr *)&addr, bits - bits % 16);
 	}
-	else
-#endif
-	if(masktype == HM_IPV4)
+	else if(masktype == HM_IPV4)
 	{
 		/* We have to do this, since we do not re-hash for every bit -A1kmm. */
 		hv = hash_ipv4((struct sockaddr *)&addr, bits - bits % 8);
@@ -539,7 +520,6 @@ add_conf_by_address(const char *address, int type, const char *username, const c
 		address = "/NOMATCH!/";
 	arec = rb_malloc(sizeof(struct AddressRec));
 	arec->masktype = parse_netmask(address, &arec->Mask.ipa.addr, &bits);
-#ifdef RB_IPV6
 	if(arec->masktype == HM_IPV6)
 	{
 		arec->Mask.ipa.bits = bits;
@@ -548,9 +528,7 @@ add_conf_by_address(const char *address, int type, const char *username, const c
 		arec->next = atable[(hv = hash_ipv6((struct sockaddr *)&arec->Mask.ipa.addr, bits))];
 		atable[hv] = arec;
 	}
-	else
-#endif
-	if(arec->masktype == HM_IPV4)
+	else if(arec->masktype == HM_IPV4)
 	{
 		arec->Mask.ipa.bits = bits;
 		/* We have to do this, since we do not re-hash for every bit -A1kmm. */
@@ -585,16 +563,13 @@ delete_one_address_conf(const char *address, struct ConfItem *aconf)
 	struct AddressRec *arec, *arecl = NULL;
 	struct rb_sockaddr_storage addr;
 	masktype = parse_netmask(address, &addr, &bits);
-#ifdef RB_IPV6
 	if(masktype == HM_IPV6)
 	{
 		/* We have to do this, since we do not re-hash for every bit -A1kmm. */
 		bits -= bits % 16;
 		hv = hash_ipv6((struct sockaddr *)&addr, bits);
 	}
-	else
-#endif
-	if(masktype == HM_IPV4)
+	else if(masktype == HM_IPV4)
 	{
 		/* We have to do this, since we do not re-hash for every bit -A1kmm. */
 		bits -= bits % 8;
diff --git a/ircd/listener.c b/ircd/listener.c
index c1285be7..bdc52242 100644
--- a/ircd/listener.c
+++ b/ircd/listener.c
@@ -43,7 +43,7 @@
 #include "s_assert.h"
 #include "logger.h"
 
-#if defined(NO_IN6ADDR_ANY) && defined(RB_IPV6)
+#if defined(NO_IN6ADDR_ANY)
 static const struct in6_addr in6addr_any =
 { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } };
 #endif
@@ -164,7 +164,6 @@ inetport(struct Listener *listener)
 
 	F = rb_socket(GET_SS_FAMILY(&listener->addr), SOCK_STREAM, 0, "Listener socket");
 
-#ifdef RB_IPV6
 	if(GET_SS_FAMILY(&listener->addr) == AF_INET6)
 	{
 		struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)&listener->addr;
@@ -173,9 +172,7 @@ inetport(struct Listener *listener)
 			rb_inet_ntop(AF_INET6, &in6->sin6_addr, listener->vhost, sizeof(listener->vhost));
 			listener->name = listener->vhost;
 		}
-	} else
-#endif
-	{
+	} else {
 		struct sockaddr_in *in = (struct sockaddr_in *)&listener->addr;
 		if(in->sin_addr.s_addr != INADDR_ANY)
 		{
@@ -281,7 +278,6 @@ find_listener(struct rb_sockaddr_storage *addr)
 				}
 				break;
 			}
-#ifdef RB_IPV6
 			case AF_INET6:
 			{
 				struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)addr;
@@ -297,7 +293,6 @@ find_listener(struct rb_sockaddr_storage *addr)
 				break;
 
 			}
-#endif
 
 			default:
 				break;
@@ -334,14 +329,12 @@ add_listener(int port, const char *vhost_ip, int family, int ssl, int defer_acce
 			if(rb_inet_pton(family, vhost_ip, &((struct sockaddr_in *)&vaddr)->sin_addr) <= 0)
 				return;
 		}
-#ifdef RB_IPV6
 		else
 		{
 			if(rb_inet_pton(family, vhost_ip, &((struct sockaddr_in6 *)&vaddr)->sin6_addr) <= 0)
 				return;
 
 		}
-#endif
 	} else
 	{
 		switch(family)
@@ -349,13 +342,11 @@ add_listener(int port, const char *vhost_ip, int family, int ssl, int defer_acce
 			case AF_INET:
 				((struct sockaddr_in *)&vaddr)->sin_addr.s_addr = INADDR_ANY;
 				break;
-#ifdef RB_IPV6
 			case AF_INET6:
 				memcpy(&((struct sockaddr_in6 *)&vaddr)->sin6_addr, &in6addr_any, sizeof(struct in6_addr));
 				break;
 			default:
 				return;
-#endif
 		}
 	}
 	switch(family)
@@ -365,13 +356,11 @@ add_listener(int port, const char *vhost_ip, int family, int ssl, int defer_acce
 			SET_SS_FAMILY(&vaddr, AF_INET);
 			SET_SS_PORT(&vaddr, htons(port));
 			break;
-#ifdef RB_IPV6
 		case AF_INET6:
 			SET_SS_LEN(&vaddr, sizeof(struct sockaddr_in6));
 			SET_SS_FAMILY(&vaddr, AF_INET6);
 			SET_SS_PORT(&vaddr, htons(port));
 			break;
-#endif
 		default:
 			break;
 	}
diff --git a/ircd/match.c b/ircd/match.c
index f1c86d2d..b38927e2 100644
--- a/ircd/match.c
+++ b/ircd/match.c
@@ -332,14 +332,12 @@ int comp_with_mask_sock(struct sockaddr *addr, struct sockaddr *dest, unsigned i
 		iaddr = &((struct sockaddr_in *)(void *)addr)->sin_addr;
 		idest = &((struct sockaddr_in *)(void *)dest)->sin_addr;
 	}
-#ifdef RB_IPV6
 	else
 	{
 		iaddr = &((struct sockaddr_in6 *)(void *)addr)->sin6_addr;
 		idest = &((struct sockaddr_in6 *)(void *)dest)->sin6_addr;
 
 	}
-#endif
 
 	return (comp_with_mask(iaddr, idest, mask));
 }
@@ -371,7 +369,6 @@ int match_ips(const char *s1, const char *s2)
 	if (cidrlen <= 0)
 		return 0;
 
-#ifdef RB_IPV6
 	if (strchr(mask, ':') && strchr(address, ':'))
 	{
 		if (cidrlen > 128)
@@ -381,9 +378,7 @@ int match_ips(const char *s1, const char *s2)
 		ipptr = &((struct sockaddr_in6 *)&ipaddr)->sin6_addr;
 		maskptr = &((struct sockaddr_in6 *)&maskaddr)->sin6_addr;
 	}
-	else
-#endif
-	if (!strchr(mask, ':') && !strchr(address, ':'))
+	else if (!strchr(mask, ':') && !strchr(address, ':'))
 	{
 		if (cidrlen > 32)
 			return 0;
@@ -447,7 +442,6 @@ int match_cidr(const char *s1, const char *s2)
 	if (cidrlen <= 0)
 		return 0;
 
-#ifdef RB_IPV6
 	if (strchr(ip, ':') && strchr(ipmask, ':'))
 	{
 		if (cidrlen > 128)
@@ -457,9 +451,7 @@ int match_cidr(const char *s1, const char *s2)
 		ipptr = &((struct sockaddr_in6 *)&ipaddr)->sin6_addr;
 		maskptr = &((struct sockaddr_in6 *)&maskaddr)->sin6_addr;
 	}
-	else
-#endif
-	if (!strchr(ip, ':') && !strchr(ipmask, ':'))
+	else if (!strchr(ip, ':') && !strchr(ipmask, ':'))
 	{
 		if (cidrlen > 32)
 			return 0;
diff --git a/ircd/newconf.c b/ircd/newconf.c
index 27207ff0..c2d66140 100644
--- a/ircd/newconf.c
+++ b/ircd/newconf.c
@@ -259,7 +259,6 @@ static void
 conf_set_serverinfo_vhost6(void *data)
 {
 
-#ifdef RB_IPV6
 	struct rb_sockaddr_storage addr;
 
 	if(rb_inet_pton_sock(data, (struct sockaddr *)&addr) <= 0 || GET_SS_FAMILY(&addr) != AF_INET6)
@@ -269,9 +268,6 @@ conf_set_serverinfo_vhost6(void *data)
 	}
 
 	ServerInfo.bind6 = addr;
-#else
-	conf_report_error("Warning -- ignoring serverinfo::vhost6 -- IPv6 support not available.");
-#endif
 }
 
 static void
@@ -778,7 +774,6 @@ conf_set_class_cidr_ipv4_bitlen(void *data)
 
 }
 
-#ifdef RB_IPV6
 static void
 conf_set_class_cidr_ipv6_bitlen(void *data)
 {
@@ -791,7 +786,6 @@ conf_set_class_cidr_ipv6_bitlen(void *data)
 		yy_class->cidr_ipv6_bitlen = *(unsigned int *) data;
 
 }
-#endif
 
 static void
 conf_set_class_number_per_cidr(void *data)
@@ -890,18 +884,14 @@ conf_set_listen_port_both(void *data, int ssl)
                                                     "It is suggested that users be migrated to SSL/TLS connections.", args->v.number);
 			}
 			add_listener(args->v.number, listener_address, AF_INET, ssl, ssl || yy_defer_accept, yy_wsock);
-#ifdef RB_IPV6
 			add_listener(args->v.number, listener_address, AF_INET6, ssl, ssl || yy_defer_accept, yy_wsock);
-#endif
                 }
 		else
                 {
 			int family;
-#ifdef RB_IPV6
 			if(strchr(listener_address, ':') != NULL)
 				family = AF_INET6;
 			else
-#endif
 				family = AF_INET;
 
 			if (!ssl)
@@ -1320,9 +1310,7 @@ conf_end_connect(struct TopConf *tc)
 
 	if(EmptyString(yy_server->connect_host)
 			&& GET_SS_FAMILY(&yy_server->connect4) != AF_INET
-#ifdef RB_IPV6
 			&& GET_SS_FAMILY(&yy_server->connect6) != AF_INET6
-#endif
 		)
 	{
 		conf_report_error("Ignoring connect block for %s -- missing host.",
@@ -1359,12 +1347,10 @@ conf_set_connect_host(void *data)
 	{
 		yy_server->connect4 = addr;
 	}
-#ifdef RB_IPV6
 	else if(GET_SS_FAMILY(&addr) == AF_INET6)
 	{
 		yy_server->connect6 = addr;
 	}
-#endif
 	else
 	{
 		conf_report_error("Unsupported IP address for server connect host (%s)",
@@ -1387,12 +1373,10 @@ conf_set_connect_vhost(void *data)
 	{
 		yy_server->bind4 = addr;
 	}
-#ifdef RB_IPV6
 	else if(GET_SS_FAMILY(&addr) == AF_INET6)
 	{
 		yy_server->bind6 = addr;
 	}
-#endif
 	else
 	{
 		conf_report_error("Unsupported IP address for server connect vhost (%s)",
@@ -1453,10 +1437,8 @@ conf_set_connect_aftype(void *data)
 
 	if(rb_strcasecmp(aft, "ipv4") == 0)
 		yy_server->aftype = AF_INET;
-#ifdef RB_IPV6
 	else if(rb_strcasecmp(aft, "ipv6") == 0)
 		yy_server->aftype = AF_INET6;
-#endif
 	else
 		conf_report_error("connect::aftype '%s' is unknown.", aft);
 }
@@ -2207,7 +2189,6 @@ conf_set_opm_listen_address_both(void *data, bool ipv6)
 
 	if(ipv6)
 	{
-#ifdef RB_IPV6
 		if(GET_SS_FAMILY(&addr) != AF_INET6)
 		{
 			conf_report_error("%s is of the wrong address type: %s", confstr, ip);
@@ -2221,10 +2202,6 @@ conf_set_opm_listen_address_both(void *data, bool ipv6)
 		}
 
 		yy_opm_address_ipv6 = rb_strdup(ip);
-#else
-		conf_report_error("%s requires IPv6 support in your ircd", confstr, ip);
-		return;
-#endif
 	}
 	else
 	{
@@ -2262,14 +2239,6 @@ conf_set_opm_listen_port_both(void *data, bool ipv6)
 	int port = *((int *)data);
 	const char *confstr = (ipv6 ? "opm::port_ipv6" : "opm::port_ipv4");
 
-#ifndef RB_IPV6
-	if(ipv6)
-	{
-		conf_report_error("%s requires IPv6 support in your ircd", confstr);
-		return;
-	}
-#endif
-
 	if(port > 65535 || port <= 0)
 	{
 		conf_report_error("%s is out of range: %d", confstr, port);
@@ -2696,9 +2665,7 @@ static struct ConfEntry conf_class_table[] =
 {
 	{ "ping_time", 		CF_TIME, conf_set_class_ping_time,		0, NULL },
 	{ "cidr_ipv4_bitlen",	CF_INT,  conf_set_class_cidr_ipv4_bitlen,		0, NULL },
-#ifdef RB_IPV6
 	{ "cidr_ipv6_bitlen",	CF_INT,  conf_set_class_cidr_ipv6_bitlen,		0, NULL },
-#endif
 	{ "number_per_cidr",	CF_INT,  conf_set_class_number_per_cidr,	0, NULL },
 	{ "number_per_ip",	CF_INT,  conf_set_class_number_per_ip,		0, NULL },
 	{ "number_per_ip_global", CF_INT,conf_set_class_number_per_ip_global,	0, NULL },
diff --git a/ircd/reject.c b/ircd/reject.c
index 90f4f1e8..570552a7 100644
--- a/ircd/reject.c
+++ b/ircd/reject.c
@@ -166,10 +166,8 @@ add_reject(struct Client *client_p, const char *mask1, const char *mask2)
 	else
 	{
 		int bitlen = 32;
-#ifdef RB_IPV6
 		if(GET_SS_FAMILY(&client_p->localClient->ip) == AF_INET6)
 			bitlen = 128;
-#endif
 		pnode = make_and_lookup_ip(reject_tree, (struct sockaddr *)&client_p->localClient->ip, bitlen);
 		pnode->data = rdata = rb_malloc(sizeof(reject_t));
 		rb_dlinkAddTail(pnode, &rdata->rnode, &reject_list);
@@ -321,10 +319,8 @@ throttle_add(struct sockaddr *addr)
 
 	} else {
 		int bitlen = 32;
-#ifdef RB_IPV6
 		if(GET_SS_FAMILY(addr) == AF_INET6)
 			bitlen = 128;
-#endif
 		t = rb_malloc(sizeof(throttle_t));
 		t->last = rb_current_time();
 		t->count = 1;
diff --git a/ircd/s_conf.c b/ircd/s_conf.c
index 87589332..a6722d90 100644
--- a/ircd/s_conf.c
+++ b/ircd/s_conf.c
@@ -679,10 +679,8 @@ set_default_conf(void)
 
 	memset(&ServerInfo.bind4, 0, sizeof(ServerInfo.bind4));
 	SET_SS_FAMILY(&ServerInfo.bind4, AF_UNSPEC);
-#ifdef RB_IPV6
 	memset(&ServerInfo.bind6, 0, sizeof(ServerInfo.bind6));
 	SET_SS_FAMILY(&ServerInfo.bind6, AF_UNSPEC);
-#endif
 
 	AdminInfo.name = NULL;
 	AdminInfo.email = NULL;
diff --git a/ircd/s_newconf.c b/ircd/s_newconf.c
index c593635a..4123312c 100644
--- a/ircd/s_newconf.c
+++ b/ircd/s_newconf.c
@@ -331,13 +331,11 @@ make_server_conf(void)
 	SET_SS_FAMILY(&server_p->bind4, AF_UNSPEC);
 	SET_SS_LEN(&server_p->bind4, sizeof(struct sockaddr_in));
 
-#ifdef RB_IPV6
 	SET_SS_FAMILY(&server_p->connect6, AF_UNSPEC);
 	SET_SS_LEN(&server_p->connect6, sizeof(struct sockaddr_in6));
 
 	SET_SS_FAMILY(&server_p->bind6, AF_UNSPEC);
 	SET_SS_LEN(&server_p->bind6, sizeof(struct sockaddr_in6));
-#endif
 
 	server_p->aftype = AF_UNSPEC;
 
@@ -393,7 +391,6 @@ conf_connect_dns_callback(const char *result, int status, int aftype, void *data
 
 		server_p->dns_query_connect4 = 0;
 	}
-#ifdef RB_IPV6
 	else if(aftype == AF_INET6)
 	{
 		if(status == 1)
@@ -401,7 +398,6 @@ conf_connect_dns_callback(const char *result, int status, int aftype, void *data
 
 		server_p->dns_query_connect6 = 0;
 	}
-#endif
 }
 
 /*
@@ -426,7 +422,6 @@ conf_bind_dns_callback(const char *result, int status, int aftype, void *data)
 
 		server_p->dns_query_bind4 = 0;
 	}
-#ifdef RB_IPV6
 	else if(aftype == AF_INET6)
 	{
 		if(status == 1)
@@ -434,7 +429,6 @@ conf_bind_dns_callback(const char *result, int status, int aftype, void *data)
 
 		server_p->dns_query_bind6 = 0;
 	}
-#endif
 }
 
 void
@@ -462,20 +456,16 @@ add_server_conf(struct server_conf *server_p)
 	{
 		server_p->dns_query_connect4 =
 			lookup_hostname(server_p->connect_host, AF_INET, conf_connect_dns_callback, server_p);
-#ifdef RB_IPV6
 		server_p->dns_query_connect6 =
 			lookup_hostname(server_p->connect_host, AF_INET6, conf_connect_dns_callback, server_p);
-#endif
 	}
 
 	if(server_p->bind_host)
 	{
 		server_p->dns_query_bind4 =
 			lookup_hostname(server_p->bind_host, AF_INET, conf_bind_dns_callback, server_p);
-#ifdef RB_IPV6
 		server_p->dns_query_bind6 =
 			lookup_hostname(server_p->bind_host, AF_INET6, conf_bind_dns_callback, server_p);
-#endif
 	}
 }
 
diff --git a/ircd/s_serv.c b/ircd/s_serv.c
index 738912d4..7331f217 100644
--- a/ircd/s_serv.c
+++ b/ircd/s_serv.c
@@ -379,11 +379,9 @@ check_server(const char *name, struct Client *client_p)
 			|| (GET_SS_FAMILY(&client_addr) == GET_SS_FAMILY(&tmp_p->connect4)
 				&& comp_with_mask_sock((struct sockaddr *)&client_addr,
 					(struct sockaddr *)&tmp_p->connect4, 32))
-#ifdef RB_IPV6
 			|| (GET_SS_FAMILY(&client_addr) == GET_SS_FAMILY(&tmp_p->connect6)
 				&& comp_with_mask_sock((struct sockaddr *)&client_addr,
 					(struct sockaddr *)&tmp_p->connect6, 128))
-#endif
 			)
 		{
 			host_matched = true;
@@ -1045,7 +1043,6 @@ serv_connect(struct server_conf *server_p, struct Client *by)
 	SET_SS_FAMILY(&sa_connect, AF_UNSPEC);
 	SET_SS_FAMILY(&sa_bind, AF_UNSPEC);
 
-#ifdef RB_IPV6
 	if(server_p->aftype != AF_UNSPEC
 		&& GET_SS_FAMILY(&server_p->connect4) == AF_INET
 		&& GET_SS_FAMILY(&server_p->connect6) == AF_INET6)
@@ -1062,18 +1059,15 @@ serv_connect(struct server_conf *server_p, struct Client *by)
 		}
 	}
 	else if(server_p->aftype == AF_INET || GET_SS_FAMILY(&server_p->connect4) == AF_INET)
-#endif
 	{
 		sa_connect = server_p->connect4;
 		sa_bind = server_p->bind4;
 	}
-#ifdef RB_IPV6
 	else if(server_p->aftype == AF_INET6 || GET_SS_FAMILY(&server_p->connect6) == AF_INET6)
 	{
 		sa_connect = server_p->connect6;
 		sa_bind = server_p->bind6;
 	}
-#endif
 
 	/* log */
 	buf[0] = 0;
@@ -1171,10 +1165,8 @@ serv_connect(struct server_conf *server_p, struct Client *by)
 	{
 		if(GET_SS_FAMILY(&sa_connect) == GET_SS_FAMILY(&ServerInfo.bind4))
 			sa_bind = ServerInfo.bind4;
-#ifdef RB_IPV6
 		if(GET_SS_FAMILY(&sa_connect) == GET_SS_FAMILY(&ServerInfo.bind6))
 			sa_bind = ServerInfo.bind6;
-#endif
 	}
 
 	rb_connect_tcp(client_p->localClient->F,
diff --git a/librb/configure.ac b/librb/configure.ac
index 0f5f3f59..18ab249f 100644
--- a/librb/configure.ac
+++ b/librb/configure.ac
@@ -172,27 +172,6 @@ rb_socklen_t=$rb_cv_socklen_t
 
 
 
-AC_ARG_ENABLE(ipv6,AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),[ipv6=$enableval],[ipv6=yes])
-
-if test x$ipv6 != xyes; then
-	have_v6="no"
-else
-
-have_v6=yes
-RB_PROTO_INET6([], [
-		AC_MSG_NOTICE([Disabling IPv6 support: PF_INET6 not found])
-		have_v6=no
-		])
-
-	if test "X$have_v6" = "Xyes"; then
-	RB_TYPE_STRUCT_SOCKADDR_IN6([], [
-		AC_MSG_NOTICE([Disabling IPv6 support: struct sockaddr_in6 not found])
-		have_v6=no
-		])
-	fi
-
-fi
-
 AC_CHECK_TYPES([struct sockaddr_storage],[
 	rb_have_sockaddr_storage=yes
         ],[], [
@@ -490,10 +469,6 @@ AC_CONFIG_COMMANDS([include/librb-config.h],
 
 _______EOF
 
-if test "x$rb_have_ipv6" = "xyes"; then
-	echo "#define RB_IPV6 1" >> $outfile
-fi
-
 if test "x$rb_windows_h" = "xyes"; then
 	echo '#define WIN32_LEAN_AND_MEAN 1' >> $outfile
 	echo '#include <windows.h>' >> $outfile
@@ -664,8 +639,6 @@ fi
 		rb_sockaddr_storage="no"
 	fi
 
-	rb_have_ipv6="$have_v6"
-
 	rb_mv="$MV"
 	rb_rm="$RM"
 
@@ -691,7 +664,6 @@ echo
 
 echo "Installing into: $prefix"
 
-echo "IPv6 support ................... $have_v6"
 echo "Assert debugging ............... $assert"
 echo "SSL Type........................ $SSL_TYPE"
 echo
diff --git a/librb/include/rb_lib.h b/librb/include/rb_lib.h
index d1ad39d3..c02dff68 100644
--- a/librb/include/rb_lib.h
+++ b/librb/include/rb_lib.h
@@ -176,14 +176,9 @@ char *rb_strerror(int error);
 #define GET_SS_LEN(x) (((struct sockaddr *)(x))->sa_len)
 #else /* !RB_SOCKADDR_HAS_SA_LEN */
 #define SET_SS_LEN(x, y) (((struct sockaddr *)(x))->sa_family = ((struct sockaddr *)(x))->sa_family)
-#ifdef RB_IPV6
 #define GET_SS_LEN(x) (((struct sockaddr *)(x))->sa_family == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6))
-#else
-#define GET_SS_LEN(x) (((struct sockaddr *)(x))->sa_family == AF_INET ? sizeof(struct sockaddr_in) : 0)
-#endif
 #endif
 
-#ifdef RB_IPV6
 #define GET_SS_PORT(x) (((struct sockaddr *)(x))->sa_family == AF_INET ? ((struct sockaddr_in *)(x))->sin_port : ((struct sockaddr_in6 *)(x))->sin6_port)
 #define SET_SS_PORT(x, y)	do { \
 					if(((struct sockaddr *)(x))->sa_family == AF_INET) { \
@@ -192,10 +187,6 @@ char *rb_strerror(int error);
 						((struct sockaddr_in6 *)(x))->sin6_port = (y); \
 					} \
 				} while (0)
-#else
-#define GET_SS_PORT(x) (((struct sockaddr_in *)(x))->sin_port)
-#define SET_SS_PORT(x, y) (((struct sockaddr_in *)(x))->sin_port = y)
-#endif
 
 #ifndef INADDRSZ
 #define INADDRSZ 4
diff --git a/librb/include/rb_patricia.h b/librb/include/rb_patricia.h
index 79b9fecb..49e42092 100644
--- a/librb/include/rb_patricia.h
+++ b/librb/include/rb_patricia.h
@@ -36,9 +36,7 @@ typedef struct _rb_prefix_t
 	union
 	{
 		struct in_addr sin;
-#ifdef RB_IPV6
 		struct in6_addr sin6;
-#endif				/* RB_IPV6 */
 	}
 	add;
 }
diff --git a/librb/src/commio.c b/librb/src/commio.c
index f8bd8fa5..a131b7eb 100644
--- a/librb/src/commio.c
+++ b/librb/src/commio.c
@@ -69,9 +69,7 @@ int rb_maxconnections = 0;
 
 static PF rb_connect_timeout;
 static PF rb_connect_tryconnect;
-#ifdef RB_IPV6
 static void mangle_mapped_sockaddr(struct sockaddr *in);
-#endif
 
 #ifndef HAVE_SOCKETPAIR
 static int rb_inet_socketpair(int d, int type, int protocol, rb_platform_fd_t sv[2]);
@@ -382,9 +380,7 @@ rb_accept_tryaccept(rb_fde_t *F, void *data)
 			rb_close(new_F);
 		}
 
-#ifdef RB_IPV6
 		mangle_mapped_sockaddr((struct sockaddr *)&st);
-#endif
 
 		if(F->accept->precb != NULL)
 		{
@@ -708,7 +704,6 @@ rb_socket(int family, int sock_type, int proto, const char *note)
 	if(rb_unlikely(fd < 0))
 		return NULL;	/* errno will be passed through, yay.. */
 
-#if defined(RB_IPV6) && defined(IPV6_V6ONLY)
 	/*
 	 * Make sure we can take both IPv4 and IPv6 connections
 	 * on an AF_INET6 socket
@@ -724,7 +719,6 @@ rb_socket(int family, int sock_type, int proto, const char *note)
 			return NULL;
 		}
 	}
-#endif
 
 	F = rb_open(fd, RB_FD_SOCKET, note);
 	if(F == NULL)
@@ -749,7 +743,6 @@ rb_socket(int family, int sock_type, int proto, const char *note)
  * If a sockaddr_storage is AF_INET6 but is a mapped IPv4
  * socket manged the sockaddr.
  */
-#ifdef RB_IPV6
 static void
 mangle_mapped_sockaddr(struct sockaddr *in)
 {
@@ -765,7 +758,6 @@ mangle_mapped_sockaddr(struct sockaddr *in)
 		memcpy(in, &in4, sizeof(struct sockaddr_in));
 	}
 }
-#endif
 
 /*
  * rb_listen() - listen on a port
@@ -1180,9 +1172,7 @@ inetntoa(const char *in)
  */
 
 static const char *inet_ntop4(const unsigned char *src, char *dst, unsigned int size);
-#ifdef RB_IPV6
 static const char *inet_ntop6(const unsigned char *src, char *dst, unsigned int size);
-#endif
 
 /* const char *
  * inet_ntop4(src, dst, size)
@@ -1209,7 +1199,6 @@ inet_ntop4(const unsigned char *src, char *dst, unsigned int size)
  * author:
  *	Paul Vixie, 1996.
  */
-#ifdef RB_IPV6
 static const char *
 inet_ntop6(const unsigned char *src, char *dst, unsigned int size)
 {
@@ -1314,7 +1303,6 @@ inet_ntop6(const unsigned char *src, char *dst, unsigned int size)
 	}
 	return memcpy(dst, tmp, tp - tmp);
 }
-#endif
 
 int
 rb_inet_pton_sock(const char *src, struct sockaddr *dst)
@@ -1326,7 +1314,6 @@ rb_inet_pton_sock(const char *src, struct sockaddr *dst)
 		SET_SS_LEN(dst, sizeof(struct sockaddr_in));
 		return 1;
 	}
-#ifdef RB_IPV6
 	else if(rb_inet_pton(AF_INET6, src, &((struct sockaddr_in6 *)dst)->sin6_addr))
 	{
 		SET_SS_FAMILY(dst, AF_INET6);
@@ -1334,7 +1321,6 @@ rb_inet_pton_sock(const char *src, struct sockaddr *dst)
 		SET_SS_LEN(dst, sizeof(struct sockaddr_in6));
 		return 1;
 	}
-#endif
 	return 0;
 }
 
@@ -1345,11 +1331,9 @@ rb_inet_ntop_sock(struct sockaddr *src, char *dst, unsigned int size)
 	{
 	case AF_INET:
 		return (rb_inet_ntop(AF_INET, &((struct sockaddr_in *)src)->sin_addr, dst, size));
-#ifdef RB_IPV6
 	case AF_INET6:
 		return (rb_inet_ntop
 			(AF_INET6, &((struct sockaddr_in6 *)src)->sin6_addr, dst, size));
-#endif
 	default:
 		return NULL;
 	}
@@ -1370,7 +1354,6 @@ rb_inet_ntop(int af, const void *src, char *dst, unsigned int size)
 	{
 	case AF_INET:
 		return (inet_ntop4(src, dst, size));
-#ifdef RB_IPV6
 	case AF_INET6:
 		if(IN6_IS_ADDR_V4MAPPED((const struct in6_addr *)src) ||
 		   IN6_IS_ADDR_V4COMPAT((const struct in6_addr *)src))
@@ -1379,9 +1362,6 @@ rb_inet_ntop(int af, const void *src, char *dst, unsigned int size)
 				 s6_addr[12], dst, size));
 		else
 			return (inet_ntop6(src, dst, size));
-
-
-#endif
 	default:
 		return (NULL);
 	}
@@ -1457,7 +1437,6 @@ inet_pton4(const char *src, unsigned char *dst)
 	return (1);
 }
 
-#ifdef RB_IPV6
 /* int
  * inet_pton6(src, dst)
  *	convert presentation level address to network order binary form.
@@ -1570,7 +1549,7 @@ inet_pton6(const char *src, unsigned char *dst)
 	memcpy(dst, tmp, IN6ADDRSZ);
 	return (1);
 }
-#endif
+
 int
 rb_inet_pton(int af, const char *src, void *dst)
 {
@@ -1578,7 +1557,6 @@ rb_inet_pton(int af, const char *src, void *dst)
 	{
 	case AF_INET:
 		return (inet_pton4(src, dst));
-#ifdef RB_IPV6
 	case AF_INET6:
 		/* Somebody might have passed as an IPv4 address this is sick but it works */
 		if(inet_pton4(src, dst))
@@ -1589,7 +1567,6 @@ rb_inet_pton(int af, const char *src, void *dst)
 		}
 		else
 			return (inet_pton6(src, dst));
-#endif
 	default:
 		return (-1);
 	}
@@ -2257,7 +2234,6 @@ rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasiz
 #endif /* _WIN32 */
 #endif /* defined(HAVE_SENDMSG) && !defined(WIN32) */
 
-#ifdef RB_IPV6
 int
 rb_ipv4_from_ipv6(const struct sockaddr_in6 *restrict ip6, struct sockaddr_in *restrict ip4)
 {
@@ -2282,10 +2258,3 @@ rb_ipv4_from_ipv6(const struct sockaddr_in6 *restrict ip6, struct sockaddr_in *r
 	ip4->sin_port = 0;
 	return 1;
 }
-#else
-int
-rb_ipv4_from_ipv6(const struct sockaddr_in6 *restrict ip6, struct sockaddr_in *restrict ip4)
-{
-	return 0;
-}
-#endif /* RB_IPV6 */
diff --git a/librb/src/patricia.c b/librb/src/patricia.c
index d04e8865..397bf7d5 100644
--- a/librb/src/patricia.c
+++ b/librb/src/patricia.c
@@ -92,25 +92,17 @@ prefix_toa2(rb_prefix_t *prefix, char *buff, int buf_len)
 static char *
 prefix_toa(rb_prefix_t *prefix)
 {
-#ifdef RB_IPV6
 	static char buf[INET6_ADDRSTRLEN + 6];
-#else
-	static char buf[16 + 6];
-#endif
 	return (prefix_toa2(prefix, buf, sizeof(buf)));
 }
 #endif
+
 static rb_prefix_t *
 New_Prefix2(int family, void *dest, int bitlen, rb_prefix_t *prefix)
 {
 	int dynamic_allocated = 0;
-#ifdef RB_IPV6
 	int default_bitlen = 128;
-#else
-	int default_bitlen = 32;
-#endif
 
-#ifdef RB_IPV6
 	if(family == AF_INET6)
 	{
 		default_bitlen = 128;
@@ -121,9 +113,7 @@ New_Prefix2(int family, void *dest, int bitlen, rb_prefix_t *prefix)
 		}
 		memcpy(&prefix->add.sin6, dest, 16);
 	}
-	else
-#endif /* RB_IPV6 */
-	if(family == AF_INET)
+	else if(family == AF_INET)
 	{
 		if(prefix == NULL)
 		{
@@ -161,9 +151,7 @@ ascii2prefix(int family, const char *string)
 	long bitlen, maxbitlen = 0;
 	char *cp;
 	struct in_addr sinaddr;
-#ifdef RB_IPV6
 	struct in6_addr sinaddr6;
-#endif /* RB_IPV6 */
 	int result;
 	char save[MAXLINE];
 
@@ -174,21 +162,17 @@ ascii2prefix(int family, const char *string)
 	if(family == 0)
 	{
 		family = AF_INET;
-#ifdef RB_IPV6
 		if(strchr(string, ':'))
 			family = AF_INET6;
-#endif /* RB_IPV6 */
 	}
 	if(family == AF_INET)
 	{
 		maxbitlen = 32;
 	}
-#ifdef RB_IPV6
 	else if(family == AF_INET6)
 	{
 		maxbitlen = 128;
 	}
-#endif /* RB_IPV6 */
 
 	if((cp = strchr(string, '/')) != NULL)
 	{
@@ -213,14 +197,12 @@ ascii2prefix(int family, const char *string)
 			return (NULL);
 		return (New_Prefix(AF_INET, &sinaddr, bitlen));
 	}
-#ifdef RB_IPV6
 	else if(family == AF_INET6)
 	{
 		if((result = rb_inet_pton(AF_INET6, string, &sinaddr6)) <= 0)
 			return (NULL);
 		return (New_Prefix(AF_INET6, &sinaddr6, bitlen));
 	}
-#endif /* RB_IPV6 */
 	else
 		return (NULL);
 }
@@ -916,11 +898,9 @@ make_and_lookup_ip(rb_patricia_tree_t *tree, struct sockaddr *in, int bitlen)
 	rb_prefix_t *prefix;
 	rb_patricia_node_t *node;
 	void *ipptr = NULL;
-#ifdef RB_IPV6
 	if(in->sa_family == AF_INET6)
 		ipptr = &((struct sockaddr_in6 *)in)->sin6_addr;
 	else
-#endif
 		ipptr = &((struct sockaddr_in *)in)->sin_addr;
 
 	prefix = New_Prefix(in->sa_family, ipptr, bitlen);
@@ -948,13 +928,11 @@ make_and_lookup(rb_patricia_tree_t *tree, const char *string)
 		node = rb_patricia_lookup(tree, prefix);
 	}
 	else
-#ifdef RB_IPV6
 	if((prefix = ascii2prefix(AF_INET6, string)) != NULL)
 	{
 		node = rb_patricia_lookup(tree, prefix);
 	}
 	else
-#endif
 		return NULL;
 #ifdef PATRICIA_DEBUG
 	printf("make_and_lookup: %s/%d\n", prefix_toa(prefix), prefix->bitlen);
@@ -975,14 +953,12 @@ try_search_exact(rb_patricia_tree_t *tree, char *string)
 		Deref_Prefix(prefix);
 		return (node);
 	}
-#ifdef RB_IPV6
 	else if((prefix = ascii2prefix(AF_INET6, string)) != NULL)
 	{
 		node = rb_patricia_search_exact(tree, prefix);
 		Deref_Prefix(prefix);
 		return (node);
 	}
-#endif
 	else
 		return NULL;
 }
@@ -1005,11 +981,7 @@ rb_match_ip(rb_patricia_tree_t *tree, struct sockaddr *ip)
 	void *ipptr;
 	unsigned int len;
 	int family;
-#ifndef RB_IPV6
-	len = 32;
-	family = AF_INET;
-	ipptr = &((struct sockaddr_in *)ip)->sin_addr;
-#else
+
 	if(ip->sa_family == AF_INET6)
 	{
 		len = 128;
@@ -1022,7 +994,6 @@ rb_match_ip(rb_patricia_tree_t *tree, struct sockaddr *ip)
 		family = AF_INET;
 		ipptr = &((struct sockaddr_in *)ip)->sin_addr;
 	}
-#endif
 
 	if((prefix = New_Prefix(family, ipptr, len)) != NULL)
 	{
@@ -1040,13 +1011,7 @@ rb_match_ip_exact(rb_patricia_tree_t *tree, struct sockaddr *ip, unsigned int le
 	rb_patricia_node_t *node;
 	void *ipptr;
 	int family;
-#ifndef RB_IPV6
-	if(len > 128)
-		len = 128;
 
-	family = AF_INET;
-	ipptr = &((struct sockaddr_in *)ip)->sin_addr;
-#else
 	if(ip->sa_family == AF_INET6)
 	{
 		if(len > 128)
@@ -1061,7 +1026,6 @@ rb_match_ip_exact(rb_patricia_tree_t *tree, struct sockaddr *ip, unsigned int le
 		family = AF_INET;
 		ipptr = &((struct sockaddr_in *)ip)->sin_addr;
 	}
-#endif
 
 	if((prefix = New_Prefix(family, ipptr, len)) != NULL)
 	{
@@ -1086,14 +1050,12 @@ rb_match_string(rb_patricia_tree_t *tree, const char *string)
 		Deref_Prefix(prefix);
 	}
 	else
-#ifdef RB_IPV6
 	if((prefix = ascii2prefix(AF_INET6, string)) != NULL)
 	{
 		node = rb_patricia_search_best(tree, prefix);
 		Deref_Prefix(prefix);
 	}
 	else
-#endif
 		return NULL;
 	return node;
 }
@@ -1109,14 +1071,12 @@ rb_match_exact_string(rb_patricia_tree_t *tree, const char *string)
 		Deref_Prefix(prefix);
 	}
 	else
-#ifdef RB_IPV6
 	if((prefix = ascii2prefix(AF_INET6, string)) != NULL)
 	{
 		node = rb_patricia_search_exact(tree, prefix);
 		Deref_Prefix(prefix);
 	}
 	else
-#endif
 		return NULL;
 	return node;
 }
diff --git a/modules/m_dline.c b/modules/m_dline.c
index 9a056d05..cc62d572 100644
--- a/modules/m_dline.c
+++ b/modules/m_dline.c
@@ -222,11 +222,9 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
 		sendto_one(source_p, ":%s NOTICE %s :Invalid D-Line", me.name, source_p->name);
 		return;
 	}
-#ifdef RB_IPV6
 	if(ty == HM_IPV6)
 		t = AF_INET6;
 	else
-#endif
 		t = AF_INET;
 
 	/* This means dlines wider than /16 cannot be set remotely */
diff --git a/modules/m_etrace.c b/modules/m_etrace.c
index 064206ae..fded420b 100644
--- a/modules/m_etrace.c
+++ b/modules/m_etrace.c
@@ -107,12 +107,10 @@ mo_etrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
 	{
 		if(!irccmp(parv[1], "-full"))
 			do_etrace_full(source_p);
-#ifdef RB_IPV6
 		else if(!irccmp(parv[1], "-v6"))
 			do_etrace(source_p, 0, 1);
 		else if(!irccmp(parv[1], "-v4"))
 			do_etrace(source_p, 1, 0);
-#endif
 		else
 		{
 			struct Client *target_p = find_named_person(parv[1]);
@@ -163,11 +161,9 @@ do_etrace(struct Client *source_p, int ipv4, int ipv6)
 	{
 		target_p = ptr->data;
 
-#ifdef RB_IPV6
 		if((!ipv4 && GET_SS_FAMILY(&target_p->localClient->ip) == AF_INET) ||
 		   (!ipv6 && GET_SS_FAMILY(&target_p->localClient->ip) == AF_INET6))
 			continue;
-#endif
 
 		sendto_one(source_p, form_str(RPL_ETRACE),
 			   me.name, source_p->name,
diff --git a/modules/m_kline.c b/modules/m_kline.c
index 7c55fc55..abcfa1e7 100644
--- a/modules/m_kline.c
+++ b/modules/m_kline.c
@@ -715,11 +715,9 @@ already_placed_kline(struct Client *source_p, const char *luser, const char *lho
 		bits = 0;
 		if((t = parse_netmask(lhost, &iphost, &bits)) != HM_HOST)
 		{
-#ifdef RB_IPV6
 			if(t == HM_IPV6)
 				t = AF_INET6;
 			else
-#endif
 				t = AF_INET;
 
 			piphost = &iphost;
diff --git a/modules/m_testline.c b/modules/m_testline.c
index 22bf9b7a..7aa27a88 100644
--- a/modules/m_testline.c
+++ b/modules/m_testline.c
@@ -123,11 +123,9 @@ mo_testline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
 	/* parses as an IP, check for a dline */
 	if((type = parse_netmask(host, &ip, &host_mask)) != HM_HOST)
 	{
-#ifdef RB_IPV6
 		if(type == HM_IPV6)
 			aconf = find_dline((struct sockaddr *)&ip, AF_INET6);
 		else
-#endif
 			aconf = find_dline((struct sockaddr *)&ip, AF_INET);
 
 		if(aconf && aconf->status & CONF_DLINE)
@@ -175,9 +173,7 @@ mo_testline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
 	if((aconf = find_address_conf(host, NULL, user_trunc, notildeuser_trunc,
 				(type != HM_HOST) ? (struct sockaddr *)&ip : NULL,
 				(type != HM_HOST) ? (
-#ifdef RB_IPV6
 				 (type == HM_IPV6) ? AF_INET6 :
-#endif
 				  AF_INET) : 0, NULL)))
 	{
 		static char buf[HOSTLEN+USERLEN+2];
diff --git a/modules/m_version.c b/modules/m_version.c
index 02cc6369..3bda7ef4 100644
--- a/modules/m_version.c
+++ b/modules/m_version.c
@@ -140,9 +140,7 @@ confopts(void)
 	*p++ = 'Z';
 #endif
 
-#ifdef RB_IPV6
 	*p++ = '6';
-#endif
 
 	*p = '\0';
 
diff --git a/modules/m_whois.c b/modules/m_whois.c
index d5e33ec6..594656ee 100644
--- a/modules/m_whois.c
+++ b/modules/m_whois.c
@@ -233,9 +233,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
 	int tlen;
 	hook_data_client hdata;
 	int extra_space = 0;
-#ifdef RB_IPV6
 	struct sockaddr_in ip4;
-#endif
 
 	if(target_p->user == NULL)
 	{
@@ -364,7 +362,6 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
 					   form_str(RPL_WHOISACTUALLY),
 					   target_p->name, target_p->sockhost);
 
-#ifdef RB_IPV6
 		if (GET_SS_FAMILY(&target_p->localClient->ip) == AF_INET6 &&
 				(show_ip(source_p, target_p) ||
 				 (source_p == target_p && !IsIPSpoof(target_p))) &&
@@ -376,7 +373,6 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
 					"%s :Underlying IPv4 is %s",
 					target_p->name, buf);
 		}
-#endif /* RB_IPV6 */
 
 		sendto_one_numeric(source_p, RPL_WHOISIDLE, form_str(RPL_WHOISIDLE),
 				   target_p->name,