소스 검색

core and modules: make IPv6 default, remove compile time flags

* Make IPv6 the default in the core and affected modules
* it has been default switched on since a long time, and was introduced in 2002
* even on embedded systems one probably want now proper IPv6 support
* there was an issue in cygwin in 2008, but IPv6 is there also available since v1.7
* remove over 160 #ifdefs, cleanup the code a lot and removes many of rarely
  tested alternative code paths to ease support of the codebase
* note for gentoo maintainer: please review your packages, they will maybe not
  work now correctly anymore if somebody specified -ipv6 in the use flags
Henning Westerholt 12 년 전
부모
커밋
abdf40dabb

+ 3 - 4
Makefile.defs

@@ -680,7 +680,6 @@ C_DEFS= $(extra_defs) \
 	 -DPKG_MALLOC \
 	 -DSHM_MEM  -DSHM_MMAP \
 	 -DDNS_IP_HACK \
-	 -DUSE_IPV6 \
 	 -DUSE_MCAST \
 	 -DUSE_TCP \
 	 -DDISABLE_NAGLE \
@@ -2054,9 +2053,9 @@ ifeq ($(OS), darwin)
 endif
 
 ifneq (,$(findstring cygwin, $(OS)))
-	# cygwin doesn't support IPV6 and doesn't support fd passing so no TCP
-	#C_DEFS:=$(filter-out -DUSE_IPV6 -DUSE_TCP, $(C_DEFS))
-	DEFS_RM+=-DUSE_IPV6 -DUSE_TCP
+	# cygwin does support IPV6 starting from version 1.7, but (still?) doesn't support fd passing so no TCP
+	#C_DEFS:=$(filter-out -DUSE_TCP, $(C_DEFS))
+	DEFS_RM+=-DUSE_TCP
 	C_DEFS+=-DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
 			-DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
 			-DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER

+ 1 - 5
cfg.lex

@@ -1160,11 +1160,7 @@ IMPORTFILE      "import_file"
 <INITIAL>{INET}			{ count(); yylval.intval=AF_INET;
 							yy_number_str=yytext; return NUMBER; }
 <INITIAL>{INET6}		{ count();
-						#ifdef USE_IPV6
-						  yylval.intval=AF_INET6;
-						#else
-						  yylval.intval=-1; /* no match*/
-						#endif
+						yylval.intval=AF_INET6;
 						yy_number_str=yytext;
 						return NUMBER; }
 <INITIAL>{SSLv23}		{ count(); yylval.strval=yytext; return SSLv23; }

+ 0 - 15
cfg.y

@@ -165,11 +165,7 @@
 		if (rt!=ONSEND_ROUTE) yyerror( s " allowed only in onsend_routes");\
 	}while(0)
 
-#ifdef USE_IPV6
 	#define IF_AUTO_BIND_IPV6(x) x
-#else
-	#define IF_AUTO_BIND_IPV6(x) warn("IPV6 support not compiled");
-#endif
 
 #ifdef USE_DNS_CACHE
 	#define IF_DNS_CACHE(x) x
@@ -1124,12 +1120,8 @@ assign_stm:
 	| TCP_SOURCE_IPV4 EQUAL error { yyerror("IPv4 address expected"); }
 	| TCP_SOURCE_IPV6 EQUAL ipv6 {
 		#ifdef USE_TCP
-			#ifdef USE_IPV6
 				if (tcp_set_src_addr($3)<0)
 					warn("tcp_source_ipv6 failed");
-			#else
-				warn("IPv6 support not compiled in");
-			#endif
 		#else
 			warn("tcp support not compiled in");
 		#endif
@@ -1856,17 +1848,12 @@ ipv6addr:
 		if ($$==0) {
 			LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
 		} else {
-		#ifdef USE_IPV6
 			memset($$, 0, sizeof(struct ip_addr));
 			$$->af=AF_INET6;
 			$$->len=16;
 			if (inet_pton(AF_INET6, $1, $$->u.addr)<=0) {
 				yyerror("bad ipv6 address");
 			}
-		#else
-			yyerror("ipv6 address & no ipv6 support compiled in");
-			YYABORT;
-		#endif
 		}
 	}
 	;
@@ -2243,10 +2230,8 @@ exp_elem:
 			}
 			if (s_tmp.s){
 				ip_tmp=str2ip(&s_tmp);
-			#ifdef USE_IPV6
 				if (ip_tmp==0)
 					ip_tmp=str2ip6(&s_tmp);
-			#endif
 				pkg_free(s_tmp.s);
 				if (ip_tmp) {
 					$$=mk_elem($2, $1, 0, NET_ST, 

+ 0 - 4
cfg_core.c

@@ -76,11 +76,7 @@ struct cfg_group_core default_core_cfg = {
 	0, /* blst_sctp_imask */
 #endif
 	/* resolver */
-#ifdef USE_IPV6
 	1,  /*!< dns_try_ipv6 -- on by default */
-#else
-	0,  /*!< dns_try_ipv6 -- off, if no ipv6 support */
-#endif
 	0,  /*!< dns_try_naptr -- off by default */
 	30,  /*!< udp transport preference (for naptr) */
 	20,  /*!< tcp transport preference (for naptr) */

+ 0 - 71
dns_cache.c

@@ -1891,10 +1891,8 @@ inline static struct dns_hash_entry* dns_cache_do_request(str* name, int type)
 #endif /* USE_DNS_CACHE_STATS */
 
 	if (type==T_A){
-#ifdef USE_IPV6
 		if (str2ip6(name)!=0)
 			goto end;
-#endif /* USE_IPV6 */
 		if ((ip=str2ip(name))!=0){
 				e=dns_cache_mk_ip_entry(name, ip);
 				if (likely(e))
@@ -1902,7 +1900,6 @@ inline static struct dns_hash_entry* dns_cache_do_request(str* name, int type)
 				goto end; /* we do not cache obvious stuff */
 		}
 	}
-#ifdef USE_IPV6
 	else if (type==T_AAAA){
 		if (str2ip(name)!=0)
 			goto end;
@@ -1913,7 +1910,6 @@ inline static struct dns_hash_entry* dns_cache_do_request(str* name, int type)
 				goto end;/* we do not cache obvious stuff */
 		}
 	}
-#endif /* USE_IPV6 */
 #ifdef DNS_WATCHDOG_SUPPORT
 	if (atomic_get(dns_servers_up)==0)
 		goto end; /* the servers are down, needless to perform the query */
@@ -2412,16 +2408,9 @@ inline static struct hostent* dns_entry2he(struct dns_hash_entry* e)
 			len=4;
 			break;
 		case T_AAAA:
-#ifdef USE_IPV6
 			af=AF_INET6;
 			len=16;
 			break;
-#else /* USE_IPV6 */
-			LOG(L_ERR, "ERROR: dns_entry2he: IPv6 dns cache entry, but "
-						"IPv6 support disabled at compile time"
-						" (recompile with -DUSE_IPV6)\n");
-			return 0;
-#endif /* USE_IPV6 */
 		default:
 			LOG(L_CRIT, "BUG: dns_entry2he: wrong entry type %d for %.*s\n",
 					e->type, e->name_len, e->name);
@@ -2472,10 +2461,8 @@ inline static struct hostent* dns_a_get_he(str* name)
 	struct hostent* he;
 
 	e=0;
-#ifdef	USE_IPV6
 	if (str2ip6(name)!=0)
 		return 0;
-#endif
 	if ((ip=str2ip(name))!=0){
 		return ip_addr2he(name, ip);
 	}
@@ -2488,7 +2475,6 @@ inline static struct hostent* dns_a_get_he(str* name)
 }
 
 
-#ifdef USE_IPV6
 /* gethostbyname compatibility: performs an aaaa_lookup and returns a pointer
  * to a statical internal hostent structure
  * returns 0 on success, <0 on error (see the error codes)
@@ -2512,7 +2498,6 @@ inline static struct hostent* dns_aaaa_get_he(str* name)
 	dns_hash_put(e);
 	return he;
 }
-#endif
 
 
 
@@ -2527,16 +2512,10 @@ inline static int dns_rr2ip(int type, struct dns_rr* rr, struct ip_addr* ip)
 			return 0;
 			break;
 		case T_AAAA:
-#ifdef USE_IPV6
 			ip->af=AF_INET6;
 			ip->len=16;
 			memcpy(ip->u.addr, ((struct aaaa_rdata*)rr->rdata)->ip6, 16);
 			return 0;
-#else /* USE_IPV6 */
-			LOG(L_ERR, "ERROR: dns_rr2ip: IPv6 dns rr, but IPv6 support"
-					   "disabled at compile time (recompile with "
-					   "-DUSE_IPV6)\n" );
-#endif /*USE_IPV6 */
 			break;
 	}
 	return -1;
@@ -2554,7 +2533,6 @@ inline static int dns_rr2ip(int type, struct dns_rr* rr, struct ip_addr* ip)
  */
 struct hostent* dns_get_he(str* name, int flags)
 {
-#ifdef USE_IPV6
 	struct hostent* he;
 
 	if ((flags&(DNS_IPV6_FIRST|DNS_IPV6_ONLY))){
@@ -2570,9 +2548,6 @@ struct hostent* dns_get_he(str* name, int flags)
 		he=dns_aaaa_get_he(name);
 	}
 	return he;
-#else /* USE_IPV6 */
-	return dns_a_get_he(name);
-#endif /* USE_IPV6 */
 }
 
 
@@ -2705,9 +2680,7 @@ struct hostent* dns_srv_sip_resolvehost(str* name, unsigned short* port,
 		}else{
 			/* check if it's an ip address */
 			if ( ((ip=str2ip(name))!=0)
-#ifdef	USE_IPV6
 				  || ((ip=str2ip6(name))!=0)
-#endif
 				){
 				/* we are lucky, this is an ip address */
 				return ip_addr2he(name,ip);
@@ -2869,17 +2842,13 @@ struct hostent* dns_naptr_sip_resolvehost(str* name, unsigned short* port,
 		*proto=PROTO_UDP; /* just in case we don't find another */
 		/* check if it's an ip address */
 		if ( ((tmp_ip=str2ip(name))!=0)
-#ifdef	USE_IPV6
 			  || ((tmp_ip=str2ip6(name))!=0)
-#endif
 			){
 			/* we are lucky, this is an ip address */
-#ifdef	USE_IPV6
 			if (((dns_flags&DNS_IPV4_ONLY) && (tmp_ip->af==AF_INET6))||
 				((dns_flags&DNS_IPV6_ONLY) && (tmp_ip->af==AF_INET))){
 				return 0;
 			}
-#endif
 			*port=SIP_PORT;
 			return ip_addr2he(name, tmp_ip);
 		}
@@ -2976,10 +2945,8 @@ inline static int dns_a_resolve( struct dns_hash_entry** e,
 	ret=-E_DNS_NO_IP;
 	if (*e==0){ /* do lookup */
 		/* if ip don't set *e */
-#ifdef	USE_IPV6
 		if (str2ip6(name)!=0)
 			goto error;
-#endif
 		if ((tmp=str2ip(name))!=0){
 			*ip=*tmp;
 			*rr_no=0;
@@ -3009,7 +2976,6 @@ error:
 }
 
 
-#ifdef USE_IPV6
 /* lookup, fills the dns_entry pointer and the ip addr.
  *  (with the first good ip). if *e ==0 does the a lookup, and changes it
  *   to the result, if not it uses the current value and tries to use
@@ -3056,7 +3022,6 @@ inline static int dns_aaaa_resolve( struct dns_hash_entry** e,
 error:
 	return ret;
 }
-#endif /* USE_IPV6 */
 
 
 
@@ -3081,7 +3046,6 @@ inline static int dns_ip_resolve(	struct dns_hash_entry** e,
 
 	ret=-E_DNS_NO_IP;
 	if (*e==0){ /* first call */
-#ifdef USE_IPV6
 		if ((flags&(DNS_IPV6_FIRST|DNS_IPV6_ONLY))){
 			ret=dns_aaaa_resolve(e, rr_no, name, ip);
 			if (ret>=0) return ret;
@@ -3094,9 +3058,6 @@ inline static int dns_ip_resolve(	struct dns_hash_entry** e,
 		}else if (!(flags&(DNS_IPV6_ONLY|DNS_IPV4_ONLY))){
 			ret=dns_aaaa_resolve(e, rr_no, name, ip);
 		}
-#else /* USE_IPV6 */
-		ret=dns_a_resolve(e, rr_no, name, ip);
-#endif /* USE_IPV6 */
 	}else if ((*e)->type==T_A){
 		/* continue A resolving */
 		/* retrieve host name from the hash entry  (ignore name which might
@@ -3104,7 +3065,6 @@ inline static int dns_ip_resolve(	struct dns_hash_entry** e,
 		host.s=(*e)->name;
 		host.len=(*e)->name_len;
 		ret=dns_a_resolve(e, rr_no, &host, ip);
-#ifdef USE_IPV6
 		if (ret>=0) return ret;
 		if (!(flags&(DNS_IPV6_ONLY|DNS_IPV6_FIRST|DNS_IPV4_ONLY))){
 			/* not found, try with AAAA */
@@ -3115,13 +3075,11 @@ inline static int dns_ip_resolve(	struct dns_hash_entry** e,
 			/* delay original record release until we're finished with host*/
 			dns_hash_put(orig);
 		}
-#endif /* USE_IPV6 */
 	}else if ((*e)->type==T_AAAA){
 		/* retrieve host name from the hash entry  (ignore name which might
 		  be null when continuing a srv lookup) */
 		host.s=(*e)->name;
 		host.len=(*e)->name_len;
-#ifdef USE_IPV6
 		/* continue AAAA resolving */
 		ret=dns_aaaa_resolve(e, rr_no, &host, ip);
 		if (ret>=0) return ret;
@@ -3134,15 +3092,6 @@ inline static int dns_ip_resolve(	struct dns_hash_entry** e,
 			/* delay original record release until we're finished with host*/
 			dns_hash_put(orig);
 		}
-#else /* USE_IPV6 */
-		/* ipv6 disabled, try with A */
-		orig=*e;
-		*e=0;
-		*rr_no=0;
-		ret=dns_a_resolve(e, rr_no, &host, ip);
-		/* delay original record release until we're finished with host*/
-		dns_hash_put(orig);
-#endif /* USE_IPV6 */
 	}else{
 		LOG(L_CRIT, "BUG: dns_ip_resolve: invalid record type %d\n",
 					(*e)->type);
@@ -3324,17 +3273,13 @@ inline static int dns_srv_sip_resolve(struct dns_srv_handle* h,  str* name,
 				}else{
 					/* check if it's an ip address */
 					if ( ((tmp_ip=str2ip(name))!=0)
-#ifdef	USE_IPV6
 						  || ((tmp_ip=str2ip6(name))!=0)
-#endif
 						){
 						/* we are lucky, this is an ip address */
-#ifdef	USE_IPV6
 						if (((flags&DNS_IPV4_ONLY) && (tmp_ip->af==AF_INET6))||
 							((flags&DNS_IPV6_ONLY) && (tmp_ip->af==AF_INET))){
 							return -E_DNS_AF_MISMATCH;
 						}
-#endif
 						*ip=*tmp_ip;
 						*port=h->port;
 						/* proto already set */
@@ -3467,17 +3412,13 @@ inline static int dns_naptr_sip_resolve(struct dns_srv_handle* h,  str* name,
 
 		/* check if it's an ip address */
 		if ( ((tmp_ip=str2ip(name))!=0)
-#ifdef	USE_IPV6
 			  || ((tmp_ip=str2ip6(name))!=0)
-#endif
 			){
 			/* we are lucky, this is an ip address */
-#ifdef	USE_IPV6
 			if (((flags&DNS_IPV4_ONLY) && (tmp_ip->af==AF_INET6))||
 				((flags&DNS_IPV6_ONLY) && (tmp_ip->af==AF_INET))){
 				return -E_DNS_AF_MISMATCH;
 			}
-#endif
 			*ip=*tmp_ip;
 			h->port=SIP_PORT;
 			h->proto=*proto;
@@ -3556,7 +3497,6 @@ inline static int dns_a_get_ip(str* name, struct ip_addr* ip)
 }
 
 
-#ifdef USE_IPV6
 inline static int dns_aaaa_get_ip(str* name, struct ip_addr* ip)
 {
 	struct dns_hash_entry* e;
@@ -3569,7 +3509,6 @@ inline static int dns_aaaa_get_ip(str* name, struct ip_addr* ip)
 	if (e) dns_hash_put(e);
 	return ret;
 }
-#endif /* USE_IPV6 */
 
 
 
@@ -4280,7 +4219,6 @@ int dns_cache_add_record(unsigned short type,
 			}
 			break;
 		case T_AAAA:
-#ifdef USE_IPV6
 			ip_addr = str2ip6(value);
 			if (!ip_addr) {
 				LOG(L_ERR, "ERROR: Malformed ip address: %.*s\n",
@@ -4288,10 +4226,6 @@ int dns_cache_add_record(unsigned short type,
 				return -1;
 			}
 			break;
-#else /* USE_IPV6 */
-			LOG(L_ERR, "ERROR: IPv6 support is disabled\n");
-			return -1;
-#endif /* USE_IPV6 */
 		case T_SRV:
 			rr_name = *value;
 			break;
@@ -4588,7 +4522,6 @@ int dns_cache_delete_single_record(unsigned short type,
 			}
 			break;
 		case T_AAAA:
-#ifdef USE_IPV6
 			ip_addr = str2ip6(value);
 			if (!ip_addr) {
 				LOG(L_ERR, "ERROR: Malformed ip address: %.*s\n",
@@ -4596,10 +4529,6 @@ int dns_cache_delete_single_record(unsigned short type,
 				return -1;
 			}
 			break;
-#else /* USE_IPV6 */
-			LOG(L_ERR, "ERROR: IPv6 support is disabled\n");
-			return -1;
-#endif /* USE_IPV6 */
 		case T_SRV:
 			rr_name = *value;
 			break;

+ 1 - 1
doc/cfg_list/Makefile

@@ -63,7 +63,7 @@ gcc=gcc
 
 # defines used by gcc
 c_defs=-D__CPU_i386 -D__OS_linux -DSER_VER=2099099 -DPKG_MALLOC -DSHM_MEM  \
-		-DSHM_MMAP -DDNS_IP_HACK -DUSE_IPV6 -DUSE_MCAST -DUSE_TCP \
+		-DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP \
 		-DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR \
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
 		-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \

+ 1 - 1
doc/counter_list/Makefile

@@ -57,7 +57,7 @@ gcc=gcc
 
 # defines used by gcc
 c_defs=-D__CPU_i386 -D__OS_linux -DSER_VER=2099099 -DPKG_MALLOC -DSHM_MEM  \
-		-DSHM_MMAP -DDNS_IP_HACK -DUSE_IPV6 -DUSE_MCAST -DUSE_TCP \
+		-DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP \
 		-DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR \
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
 		-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \

+ 1 - 1
doc/rpc_list/Makefile

@@ -100,7 +100,7 @@ gcc=gcc
 # -D__CPU_i386 -DARCH="i386"
 c_defsX= -D__CPU_x86_64 -D__OS_linux -DSER_VER=3003000 -DPKG_MALLOC -DSHM_MEM  \
 		-DVERSION='\"3.3.0-dev2\"' -DARCH='\"x86_64\"' -DOS=linux_ -DOS_QUOTED='\"linux\"' \
-		-DSHM_MMAP -DDNS_IP_HACK -DUSE_IPV6 -DUSE_MCAST -DUSE_TCP \
+		-DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP \
 		-DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR \
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
 		-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \

+ 1 - 1
doc/select_list/Makefile

@@ -67,7 +67,7 @@ gcc=gcc
 
 # defines used by gcc
 c_defs=-D__CPU_i386 -D__OS_linux -DSER_VER=2099099 -DPKG_MALLOC -DSHM_MEM  \
-		-DSHM_MMAP -DDNS_IP_HACK -DUSE_IPV6 -DUSE_MCAST -DUSE_TCP \
+		-DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP \
 		-DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR \
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
 		-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \

+ 0 - 22
dst_blacklist.c

@@ -338,12 +338,10 @@ static ticks_t blst_timer(ticks_t ticks, struct timer_ln* tl, void* data);
 inline static void dst_blst_entry2ip(struct ip_addr* ip,
 										struct dst_blst_entry* e)
 {
-#ifdef USE_IPV6
 	if (e->flags & BLST_IS_IPV6){
 		ip->af=AF_INET6;
 		ip->len=16;
 	}else
-#endif /* USE_IPV6 */
 	{
 		ip->af=AF_INET;
 		ip->len=4;
@@ -566,12 +564,7 @@ inline static struct dst_blst_entry* _dst_blacklist_lst_find(
 	unsigned char type;
 
 	head=&dst_blst_hash[hash].first;
-#ifdef USE_IPV6
 	type=(ip->af==AF_INET6)*BLST_IS_IPV6;
-#else  /* USE_IPV6 */
-	if (unlikely(ip->af!=AF_INET)) return 0;
-	type=0;
-#endif /* USE_IPV6 */
 	for (crt=head, tmp=&(*head)->next; *crt; crt=tmp, tmp=&(*crt)->next){
 		e=*crt;
 		prefetch_loc_r((*crt)->next, 1);
@@ -612,12 +605,7 @@ inline static int _dst_blacklist_del(
 	unsigned char type;
 	
 	head=&dst_blst_hash[hash].first;
-#ifdef USE_IPV6
 	type=(ip->af==AF_INET6)*BLST_IS_IPV6;
-#else  /* USE_IPV6 */
-	if (unlikely(ip->af!=AF_INET)) return 0;
-	type=0;
-#endif /* USE_IPV6 */
 	for (crt=head, tmp=&(*head)->next; *crt; crt=tmp, tmp=&(*crt)->next){
 		e=*crt;
 		prefetch_loc_r((*crt)->next, 1);
@@ -1159,24 +1147,14 @@ void dst_blst_add(rpc_t* rpc, void* ctx)
 	}
 
 	if (err_flags & BLST_IS_IPV6) {
-#ifdef USE_IPV6
 		/* IPv6 address is specified */
 		ip_addr = str2ip6(&ip);
-#else  /* USE_IPV6 */
-		rpc->fault(ctx, 400, "IPv6 support disabled");
-		return;
-#endif /* USE_IPV6 */
 	} else {
 		/* try IPv4 first, than IPv6 */
 		ip_addr = str2ip(&ip);
 		if (!ip_addr) {
-#ifdef USE_IPV6
 			ip_addr = str2ip6(&ip);
 			err_flags |= BLST_IS_IPV6;
-#else  /* USE_IPV6 */
-			rpc->fault(ctx, 400, "Malformed or IPv6 ip address");
-			return;
-#endif /* USE_IPV6 */
 		}
 	}
 	if (!ip_addr) {

+ 0 - 14
forward.c

@@ -120,9 +120,7 @@
 
 static int mhomed_sock_cache_disabled = 0;
 static int sock_inet = -1;
-#ifdef USE_IPV6
 static int sock_inet6 = -1;
-#endif /* USE_IPV6 */
 
 static void apply_force_send_socket(struct dest_info* dst, struct sip_msg* msg);
 
@@ -155,7 +153,6 @@ retry:
 		temp_sock = &sock_inet;
 		break;
 	}
-#ifdef USE_IPV6
 	case AF_INET6 : {
 		if(unlikely(sock_inet6 < 0)){
 			sock_inet6 = socket(AF_INET6, SOCK_DGRAM, 0);
@@ -167,7 +164,6 @@ retry:
 		temp_sock = &sock_inet6;
 		break;
 	}
-#endif /* USE_IPV6 */
 	default: {
 		LM_ERR("Unknown protocol family \n");
 		return 0;
@@ -189,12 +185,10 @@ retry:
 				close(sock_inet);
 				sock_inet=-1;
 			}
-#ifdef USE_IPV6
 			if (sock_inet6>=0){
 				close(sock_inet6);
 				sock_inet6=-1;
 			}
-#endif /* USE_IPV6 */
 			goto retry;
 		}
 		LOG(L_ERR, "ERROR: get_out_socket: connect failed: %s\n",
@@ -332,10 +326,8 @@ not_forced:
 				/* FIXME */
 				case AF_INET:	send_sock=sendipv4_tcp;
 								break;
-#ifdef USE_IPV6
 				case AF_INET6:	send_sock=sendipv6_tcp;
 								break;
-#endif
 				default:	LOG(L_ERR, "get_send_socket: BUG: don't know how"
 									" to forward to af %d\n", to->s.sa_family);
 			}
@@ -348,10 +340,8 @@ not_forced:
 				/* FIXME */
 				case AF_INET:	send_sock=sendipv4_tls;
 								break;
-#ifdef USE_IPV6
 				case AF_INET6:	send_sock=sendipv6_tls;
 								break;
-#endif
 				default:	LOG(L_ERR, "get_send_socket: BUG: don't know how"
 									" to forward to af %d\n", to->s.sa_family);
 			}
@@ -365,10 +355,8 @@ not_forced:
 				switch(to->s.sa_family){
 					case AF_INET:	send_sock=sendipv4_sctp;
 									break;
-#ifdef USE_IPV6
 					case AF_INET6:	send_sock=sendipv6_sctp;
 									break;
-#endif
 					default:	LOG(L_ERR, "get_send_socket: BUG: don't know"
 										" how to forward to af %d\n",
 										to->s.sa_family);
@@ -383,10 +371,8 @@ not_forced:
 				switch(to->s.sa_family){
 					case AF_INET:	send_sock=sendipv4;
 									break;
-#ifdef USE_IPV6
 					case AF_INET6:	send_sock=sendipv6;
 									break;
-#endif
 					default:	LOG(L_ERR, "get_send_socket: BUG: don't know"
 										" how to forward to af %d\n",
 										to->s.sa_family);

+ 0 - 2
globals.h

@@ -136,9 +136,7 @@ extern int mcast_loopback;
 extern int mcast_ttl;
 #endif /* USE_MCAST */
 
-#ifdef USE_IPV6
 extern int auto_bind_ipv6;
-#endif
 
 extern int tos;
 extern int pmtu_discovery;

+ 0 - 10
ip_addr.c

@@ -184,10 +184,8 @@ int mk_net_str(struct net* dst, str* s)
 	
 	/* test for ip only */
 	t = str2ip(s);
-#ifdef USE_IPV6
 	if (unlikely(t == 0))
 		t = str2ip6(s);
-#endif /* USE_IPV6 */
 	if (likely(t))
 		return mk_net_bitlen(dst, t, t->len*8);
 	/* not a simple ip, maybe an ip/netmask pair */
@@ -212,7 +210,6 @@ int mk_net_str(struct net* dst, str* s)
 			/* error */
 			return -1;
 		}
-#ifdef USE_IPV6
 		else {
 			t = str2ip6(&addr);
 			if (likely(t)) {
@@ -227,7 +224,6 @@ int mk_net_str(struct net* dst, str* s)
 				return -1;
 			}
 		}
-#endif /* USE_IPV6 */
 	}
 	return -1;
 }
@@ -246,7 +242,6 @@ void print_ip(char* p, struct ip_addr* ip, char *s)
 								(s)?s:""
 								);
 			break;
-#ifdef USE_IPV6
 		case AF_INET6:
 			DBG("%s%x:%x:%x:%x:%x:%x:%x:%x%s", (p)?p:"",
 											htons(ip->u.addr16[0]),
@@ -260,7 +255,6 @@ void print_ip(char* p, struct ip_addr* ip, char *s)
 											(s)?s:""
 				);
 			break;
-#endif /* USE_IPV6 */
 		default:
 			DBG("print_ip: warning unknown address family %d\n", ip->af);
 	}
@@ -277,7 +271,6 @@ void stdout_print_ip(struct ip_addr* ip)
 								ip->u.addr[2],
 								ip->u.addr[3]);
 			break;
-#ifdef USE_IPV6
 		case AF_INET6:
 			printf("%x:%x:%x:%x:%x:%x:%x:%x",	htons(ip->u.addr16[0]),
 											htons(ip->u.addr16[1]),
@@ -289,7 +282,6 @@ void stdout_print_ip(struct ip_addr* ip)
 											htons(ip->u.addr16[7])
 				);
 			break;
-#endif /* USE_IPV6 */
 		default:
 			DBG("print_ip: warning unknown address family %d\n", ip->af);
 	}
@@ -319,10 +311,8 @@ int is_mcast(struct ip_addr* ip)
 
 	if (ip->af==AF_INET){
 		return IN_MULTICAST(htonl(ip->u.addr32[0]));
-#ifdef USE_IPV6
 	} else if (ip->af==AF_INET6){
 		return IN6_IS_ADDR_MULTICAST((struct in6_addr*)ip->u.addr32);
-#endif /* USE_IPV6 */
 	} else {
 		LOG(L_ERR, "ERROR: is_mcast: Unsupported protocol family\n");
 		return -1;

+ 0 - 36
ip_addr.h

@@ -82,9 +82,7 @@ struct net{
 union sockaddr_union{
 		struct sockaddr     s;
 		struct sockaddr_in  sin;
-	#ifdef USE_IPV6
 		struct sockaddr_in6 sin6;
-	#endif
 };
 
 
@@ -217,13 +215,9 @@ struct socket_id{
 #ifdef HAVE_SOCKADDR_SA_LEN
 #define sockaddru_len(su)	((su).s.sa_len)
 #else
-#ifdef USE_IPV6
 #define sockaddru_len(su)	\
 			(((su).s.sa_family==AF_INET6)?sizeof(struct sockaddr_in6):\
 					sizeof(struct sockaddr_in))
-#else
-#define sockaddru_len(su)	sizeof(struct sockaddr_in)
-#endif /*USE_IPV6*/
 #endif /* HAVE_SOCKADDR_SA_LEN*/
 	
 /* inits an ip_addr with the addr. info from a hostent structure
@@ -243,11 +237,7 @@ struct socket_id{
 /* gets the protocol family corresponding to a specific address family
  * ( PF_INET - AF_INET, PF_INET6 - AF_INET6, af for others)
  */
-#ifdef USE_IPV6
 #define AF2PF(af)   (((af)==AF_INET)?PF_INET:((af)==AF_INET6)?PF_INET6:(af))
-#else
-#define AF2PF(af)   (((af)==AF_INET)?PF_INET:(af))
-#endif
 
 
 
@@ -294,10 +284,8 @@ inline static int ip_addr_loopback(struct ip_addr* ip)
 {
 	if (ip->af==AF_INET)
 		return ip->u.addr32[0]==htonl(INADDR_LOOPBACK);
-#ifdef USE_IPV6
 	else if (ip->af==AF_INET6)
 		return IN6_IS_ADDR_LOOPBACK((struct in6_addr*)ip->u.addr32);
-#endif /* USE_IPV6 */
 	return 0;
 }
 
@@ -311,7 +299,6 @@ inline static void ip_addr_mk_any(int af, struct ip_addr* ip)
 		ip->len=4;
 		ip->u.addr32[0]=0;
 	}
-#ifdef USE_IPV6
 	else{
 		ip->len=16;
 #if (defined (ULONG_MAX) && ULONG_MAX > 4294967295) || defined LP64
@@ -325,7 +312,6 @@ inline static void ip_addr_mk_any(int af, struct ip_addr* ip)
 		ip->u.addr32[3]=0;
 #endif /* ULONG_MAX */
 	}
-#endif
 }
 
 /* returns 1 if ip & net.mask == net.ip ; 0 otherwise & -1 on error 
@@ -359,13 +345,11 @@ static inline void sockaddr2ip_addr(struct ip_addr* ip, struct sockaddr* sa)
 			ip->len=4;
 			memcpy(ip->u.addr, &((struct sockaddr_in*)sa)->sin_addr, 4);
 			break;
-#ifdef USE_IPV6
 	case AF_INET6:
 			ip->af=AF_INET6;
 			ip->len=16;
 			memcpy(ip->u.addr, &((struct sockaddr_in6*)sa)->sin6_addr, 16);
 			break;
-#endif
 	default:
 			LOG(L_CRIT, "sockaddr2ip_addr: BUG: unknown address family %d\n",
 					sa->sa_family);
@@ -390,11 +374,9 @@ static inline int su_cmp(const union sockaddr_union* s1,
 		case AF_INET:
 			return (s1->sin.sin_port==s2->sin.sin_port)&&
 					(memcmp(&s1->sin.sin_addr, &s2->sin.sin_addr, 4)==0);
-#ifdef USE_IPV6
 		case AF_INET6:
 			return (s1->sin6.sin6_port==s2->sin6.sin6_port)&&
 					(memcmp(&s1->sin6.sin6_addr, &s2->sin6.sin6_addr, 16)==0);
-#endif
 		default:
 			LOG(L_CRIT,"su_cmp: BUG: unknown address family %d\n",
 						s1->s.sa_family);
@@ -410,10 +392,8 @@ static inline unsigned short su_getport(const union sockaddr_union* su)
 	switch(su->s.sa_family){
 		case AF_INET:
 			return ntohs(su->sin.sin_port);
-#ifdef USE_IPV6
 		case AF_INET6:
 			return ntohs(su->sin6.sin6_port);
-#endif
 		default:
 			LOG(L_CRIT,"su_get_port: BUG: unknown address family %d\n",
 						su->s.sa_family);
@@ -430,11 +410,9 @@ static inline void su_setport(union sockaddr_union* su, unsigned short port)
 		case AF_INET:
 			su->sin.sin_port=htons(port);
 			break;
-#ifdef USE_IPV6
 		case AF_INET6:
 			 su->sin6.sin6_port=htons(port);
 			 break;
-#endif
 		default:
 			LOG(L_CRIT,"su_set_port: BUG: unknown address family %d\n",
 						su->s.sa_family);
@@ -452,13 +430,11 @@ static inline void su2ip_addr(struct ip_addr* ip, union sockaddr_union* su)
 					ip->len=4;
 					memcpy(ip->u.addr, &su->sin.sin_addr, 4);
 					break;
-#ifdef USE_IPV6
 	case AF_INET6:
 					ip->af=AF_INET6;
 					ip->len=16;
 					memcpy(ip->u.addr, &su->sin6.sin6_addr, 16);
 					break;
-#endif
 	default:
 					LOG(L_CRIT,"su2ip_addr: BUG: unknown address family %d\n",
 							su->s.sa_family);
@@ -479,7 +455,6 @@ static inline int init_su( union sockaddr_union* su,
 	memset(su, 0, sizeof(union sockaddr_union));/*needed on freebsd*/
 	su->s.sa_family=ip->af;
 	switch(ip->af){
-#ifdef USE_IPV6
 	case	AF_INET6:
 		memcpy(&su->sin6.sin6_addr, ip->u.addr, ip->len); 
 		#ifdef HAVE_SOCKADDR_SA_LEN
@@ -487,7 +462,6 @@ static inline int init_su( union sockaddr_union* su,
 		#endif
 		su->sin6.sin6_port=htons(port);
 		break;
-#endif
 	case AF_INET:
 		memcpy(&su->sin.sin_addr, ip->u.addr, ip->len);
 		#ifdef HAVE_SOCKADDR_SA_LEN
@@ -516,7 +490,6 @@ static inline int hostent2su( union sockaddr_union* su,
 	memset(su, 0, sizeof(union sockaddr_union)); /*needed on freebsd*/
 	su->s.sa_family=he->h_addrtype;
 	switch(he->h_addrtype){
-#ifdef USE_IPV6
 	case	AF_INET6:
 		memcpy(&su->sin6.sin6_addr, he->h_addr_list[idx], he->h_length);
 		#ifdef HAVE_SOCKADDR_SA_LEN
@@ -524,7 +497,6 @@ static inline int hostent2su( union sockaddr_union* su,
 		#endif
 		su->sin6.sin6_port=htons(port);
 		break;
-#endif
 	case AF_INET:
 		memcpy(&su->sin.sin_addr, he->h_addr_list[idx], he->h_length);
 		#ifdef HAVE_SOCKADDR_SA_LEN
@@ -546,7 +518,6 @@ static inline int hostent2su( union sockaddr_union* su,
 #define IP6_MAX_STR_SIZE 39 /*1234:5678:9012:3456:7890:1234:5678:9012*/
 #define IP4_MAX_STR_SIZE 15 /*123.456.789.012*/
 
-#ifdef USE_IPV6
 /* converts a raw ipv6 addr (16 bytes) to ascii */
 static inline int ip6tosbuf(unsigned char* ip6, char* buff, int len)
 {
@@ -619,7 +590,6 @@ static inline int ip6tosbuf(unsigned char* ip6, char* buff, int len)
 	
 	return offset;
 }
-#endif /* USE_IPV6 */
 
 
 
@@ -688,11 +658,9 @@ static inline int ip4tosbuf(unsigned char* ip4, char* buff, int len)
 static inline int ip_addr2sbuf(struct ip_addr* ip, char* buff, int len)
 {
 	switch(ip->af){
-	#ifdef USE_IPV6
 		case AF_INET6:
 			return ip6tosbuf(ip->u.addr, buff, len);
 			break;
-	#endif /* USE_IPV6 */
 		case AF_INET:
 			return ip4tosbuf(ip->u.addr, buff, len);
 			break;
@@ -736,7 +704,6 @@ static inline char* su2a(union sockaddr_union* su, int su_len)
 	static char buf[SU2A_MAX_STR_SIZE];
 	int offs;
 
-#ifdef USE_IPV6
 	if (unlikely(su->s.sa_family==AF_INET6)){
 		if (unlikely(su_len<sizeof(su->sin6)))
 			return "<addr. error>";
@@ -746,7 +713,6 @@ static inline char* su2a(union sockaddr_union* su, int su_len)
 		buf[offs]=']';
 		offs++;
 	}else
-#endif /* USE_IPV6*/
 	if (unlikely(su_len<sizeof(su->sin)))
 		return "<addr. error>";
 	else
@@ -766,7 +732,6 @@ static inline char* suip2a(union sockaddr_union* su, int su_len)
 	static char buf[SUIP2A_MAX_STR_SIZE];
 	int offs;
 
-#ifdef USE_IPV6
 	if (unlikely(su->s.sa_family==AF_INET6)){
 		if (unlikely(su_len<sizeof(su->sin6)))
 			return "<addr. error>";
@@ -776,7 +741,6 @@ static inline char* suip2a(union sockaddr_union* su, int su_len)
 		buf[offs]=']';
 		offs++;
 	}else
-#endif /* USE_IPV6*/
 	if (unlikely(su_len<sizeof(su->sin)))
 		return "<addr. error>";
 	else

+ 0 - 10
main.c

@@ -458,9 +458,7 @@ int mcast_ttl = -1; /* if -1, don't touch it, use the default (usually 1) */
 int tos = IPTOS_LOWDELAY;
 int pmtu_discovery = 0;
 
-#ifdef USE_IPV6
 int auto_bind_ipv6 = 0;
-#endif
 
 #if 0
 char* names[MAX_LISTEN];              /* our names */
@@ -1450,11 +1448,9 @@ int main_loop(void)
 			if ((si->address.af==AF_INET)&&
 					((sendipv4==0)||(sendipv4->flags&(SI_IS_LO|SI_IS_MCAST))))
 				sendipv4=si;
-	#ifdef USE_IPV6
 			if ( ((sendipv6==0)||(sendipv6->flags&(SI_IS_LO|SI_IS_MCAST))) &&
 					(si->address.af==AF_INET6))
 				sendipv6=si;
-	#endif
 			/* children_no per each socket */
 			cfg_register_child((si->workers>0)?si->workers:children_no);
 		}
@@ -1503,12 +1499,10 @@ int main_loop(void)
 						((sendipv4_sctp==0) ||
 							(sendipv4_sctp->flags&(SI_IS_LO|SI_IS_MCAST))))
 					sendipv4_sctp=si;
-		#ifdef USE_IPV6
 				if( ((sendipv6_sctp==0) || 
 							(sendipv6_sctp->flags&(SI_IS_LO|SI_IS_MCAST))) &&
 						(si->address.af==AF_INET6))
 					sendipv6_sctp=si;
-		#endif
 				/* sctp_children_no per each socket */
 				cfg_register_child((si->workers>0)?si->workers:sctp_children_no);
 			}
@@ -1524,12 +1518,10 @@ int main_loop(void)
 						((sendipv4_tcp==0) ||
 							(sendipv4_tcp->flags&(SI_IS_LO|SI_IS_MCAST))))
 					sendipv4_tcp=si;
-		#ifdef USE_IPV6
 				if( ((sendipv6_tcp==0) ||
 							(sendipv6_tcp->flags&(SI_IS_LO|SI_IS_MCAST))) &&
 						(si->address.af==AF_INET6))
 					sendipv6_tcp=si;
-		#endif
 			}
 			/* the number of sockets does not matter */
 			cfg_register_child(tcp_children_no + 1 /* tcp main */);
@@ -1544,12 +1536,10 @@ int main_loop(void)
 						((sendipv4_tls==0) ||
 							(sendipv4_tls->flags&(SI_IS_LO|SI_IS_MCAST))))
 					sendipv4_tls=si;
-		#ifdef USE_IPV6
 				if( ((sendipv6_tls==0) ||
 							(sendipv6_tls->flags&(SI_IS_LO|SI_IS_MCAST))) &&
 						(si->address.af==AF_INET6))
 					sendipv6_tls=si;
-		#endif
 			}
 		}
 #endif /* USE_TLS */

+ 0 - 2
modules/drouting/drouting.c

@@ -1108,9 +1108,7 @@ static int goes_to_gw_1(struct sip_msg* msg, char* _type, char* _f2)
 	}
 
 	if ( ((ip=str2ip(&puri.host))!=0)
-#ifdef USE_IPV6
 	|| ((ip=str2ip6(&puri.host))!=0)
-#endif
 	){
 		pgwa = (*rdata)->pgw_addr_l;
 		while(pgwa) {

+ 0 - 18
modules/lcr/lcr_mod.c

@@ -956,12 +956,10 @@ static int insert_gws(db1_res_t *res, struct gw_info *gws,
 		/* 123.123.123.123 */
 		ip_addr = *ip_p;
 	    }
-#ifdef USE_IPV6
 	    else if ((ip_p = str2ip6(&ip_string))) {
 		/* fe80::123:4567:89ab:cdef and [fe80::123:4567:89ab:cdef] */
 		ip_addr = *ip_p;
 	    }
-#endif
 	    else if (inet_aton(ip_string.s, &in_addr) == 0) {
 		/* backwards compatibility for integer or hex notations */
 		ip_addr.u.addr32[0] = in_addr.s_addr;
@@ -1572,13 +1570,11 @@ inline int encode_avp_value(char *value, unsigned int gw_index, uri_type scheme,
 	string = int2str(ip_addr->u.addr32[0], &len);
 	append_str(at, string, len);
     }
-#ifdef USE_IPV6
     else if (ip_addr->af == AF_INET6 && !ip_addr_any(ip_addr)) {
 	append_chr(at, '[');
 	at += ip6tosbuf(ip_addr->u.addr, at, MAX_URI_LEN - (at - value));
 	append_chr(at, ']');
     }
-#endif
     append_chr(at, '|');
     /* hostname */
     append_str(at, hostname, hostname_len);
@@ -1673,10 +1669,8 @@ inline int decode_avp_value(char *value, unsigned int *gw_index, str *scheme,
     if (s.len > 0) {
 	if ((ip = str2ip(&s)) != NULL)
 	    *addr = *ip;
-#ifdef USE_IPV6
 	else if ((ip = str2ip6(&s)) != NULL)
 	    *addr = *ip;
-#endif
 	else {
 	    str2int(&s, &u);
 	    addr->af = AF_INET;
@@ -2393,10 +2387,8 @@ static int from_gw_3(struct sip_msg* _m, char* _lcr_id, char* _addr,
     addr_str.len = strlen(_addr);
     if ((ip = str2ip(&addr_str)) != NULL)
 	src_addr = *ip;
-#ifdef USE_IPV6
     else if ((ip = str2ip6(&addr_str)) != NULL)
 	src_addr = *ip;
-#endif
     else {
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
 	return -1;
@@ -2453,10 +2445,8 @@ static int from_any_gw_2(struct sip_msg* _m, char* _addr, char* _transport)
     addr_str.len = strlen(_addr);
     if ((ip = str2ip(&addr_str)) != NULL)
 	src_addr = *ip;
-#ifdef USE_IPV6
     else if ((ip = str2ip6(&addr_str)) != NULL)
 	src_addr = *ip;
-#endif
     else {
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
 	return -1;
@@ -2549,10 +2539,8 @@ static int to_gw_1(struct sip_msg* _m, char* _lcr_id, char* _s2)
     }
     if ((ip = str2ip(&(_m->parsed_uri.host))) != NULL)
 	dst_addr = *ip;
-#ifdef USE_IPV6
     else if ((ip = str2ip6(&(_m->parsed_uri.host))) != NULL)
 	dst_addr = *ip;
-#endif
     else {
 	LM_DBG("request is not going to gw "
 	       "(Request-URI host is not an IP address)\n");
@@ -2592,10 +2580,8 @@ static int to_gw_3(struct sip_msg* _m, char* _lcr_id, char* _addr,
     addr_str.len = strlen(_addr);
     if ((ip = str2ip(&addr_str)) != NULL)
 	dst_addr = *ip;
-#ifdef USE_IPV6
     else if ((ip = str2ip(&addr_str)) != NULL)
 	dst_addr = *ip;
-#endif
     else {
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
 	return -1;
@@ -2637,10 +2623,8 @@ static int to_any_gw_0(struct sip_msg* _m, char* _s1, char* _s2)
     }
     if ((ip = str2ip(&(_m->parsed_uri.host))) != NULL)
 	dst_addr = *ip;
-#ifdef USE_IPV6
     else if ((ip = str2ip6(&(_m->parsed_uri.host))) != NULL)
 	dst_addr = *ip;
-#endif
     else {
 	LM_DBG("request is not going to gw "
 	       "(Request-URI host is not an IP address)\n");
@@ -2675,10 +2659,8 @@ static int to_any_gw_2(struct sip_msg* _m, char* _addr, char* _transport)
     addr_str.len = strlen(_addr);
     if ((ip = str2ip(&addr_str)) != NULL)
 	dst_addr = *ip;
-#ifdef USE_IPV6
     if ((ip = str2ip6(&addr_str)) != NULL)
 	dst_addr = *ip;
-#endif
     else {
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
 	return -1;

+ 0 - 2
modules/mi_datagram/datagram_fnc.c

@@ -148,14 +148,12 @@ int  mi_init_datagram_server(sockaddr_dtgram *addr, unsigned int socket_domain,
 				goto err_rx;
 			}
 			break;
-#ifdef USE_IPV6
 	case AF_INET6: 
 			if(bind(socks->rx_sock, (struct sockaddr*)&addr->udp_addr.sin6, sizeof(addr->udp_addr)) < 0) {
 				LM_ERR("bind: %s\n", strerror(errno));
 				goto err_rx;
 			}
 			break;
-#endif
 	default:
 			LM_ERR("domain not supported\n");
 			goto err_both;

+ 0 - 2
modules/nathelper/nathelper.c

@@ -1040,9 +1040,7 @@ add_contact_alias_3_f(struct sip_msg* msg, char* _ip, char* _port, char* _proto)
 	return -1;
     }
     if ((str2ip(&ip_str) == NULL)
-#ifdef USE_IPV6
 	&& (str2ip6(&ip_str) == NULL)
-#endif
 	) {
 	LM_ERR("ip param value %s is not valid IP address\n", ip_str.s);
 	return -1;

+ 0 - 4
modules/permissions/address.c

@@ -67,12 +67,8 @@ static inline ip_addr_t *strtoipX(str *ips)
 	/* try to figure out INET class */
 	if(ips->s[0] == '[' || memchr(ips->s, ':', ips->len)!=NULL)
 	{
-#ifdef USE_IPV6
 		/* IPv6 */
 		return str2ip6(ips);
-#else
-		return 0;
-#endif
 	} else {
 		/* IPv4 */
 		return str2ip(ips);

+ 0 - 10
modules/sipcapture/hep.c

@@ -97,9 +97,7 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){
 	struct hep_timehdr* heptime_tmp = NULL;
         memset(heptime, 0, sizeof(struct hep_timehdr));
 
-#ifdef USE_IPV6
         struct hep_ip6hdr *hepip6h = NULL;
-#endif /* USE_IPV6 */
 
 	hep_offset = 0; 
 	
@@ -117,11 +115,9 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){
         	case AF_INET:
                 	hl += sizeof(struct hep_iphdr);
                         break;
-#ifdef USE_IPV6
 		case AF_INET6:
                 	hl += sizeof(struct hep_ip6hdr);
                         break;
-#endif /* USE_IPV6 */
 		default:
                         LOG(L_ERR, "ERROR: sipcapture:hep_msg_received:  unsupported family [%d]\n", heph->hp_f);
                         return -1;
@@ -151,13 +147,11 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){
                 	hep_offset+=sizeof(struct hep_iphdr);
                         hepiph = (struct hep_iphdr*) hep_ip;
                         break;
-#ifdef USE_IPV6
 
 		case AF_INET6:
                 	hep_offset+=sizeof(struct hep_ip6hdr);
                         hepip6h = (struct hep_ip6hdr*) hep_ip;
                         break;
-#endif /* USE_IPV6 */
 
 	}
 
@@ -189,7 +183,6 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){
                         memcpy(&dst_ip.u.addr, &hepiph->hp_dst, 4);
                         memcpy(&src_ip.u.addr, &hepiph->hp_src, 4);
                         break;
-#ifdef USE_IPV6
 
 		case AF_INET6:
                 	dst_ip.af = src_ip.af = AF_INET6;
@@ -198,7 +191,6 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){
                         memcpy(&src_ip.u.addr, &hepip6h->hp6_src, 16);
                         break;
 
-#endif /* USE_IPV6 */
 	}
 
         ri->src_ip = src_ip;
@@ -338,7 +330,6 @@ int parsing_hepv3_message(char *buf, unsigned int len) {
                                         totelem++;
 
                                         break;
-#ifdef USE_IPV6                                                     
                                 case 5:
                                         hg->hep_src_ip6  = (hep_chunk_ip6_t *) (tmp);
                                         i+=chunk_length;
@@ -355,7 +346,6 @@ int parsing_hepv3_message(char *buf, unsigned int len) {
 				        memcpy(dst_ip.u.addr, &hg->hep_dst_ip6->data, 16);
 				        totelem++;
                                         break;
-#endif                                             
         
                                 case 7:
                                         hg->src_port  = (hep_chunk_uint16_t *) (tmp);

+ 0 - 6
modules/sipcapture/hep.h

@@ -63,12 +63,10 @@ struct hep_timehdr{
    u_int16_t captid;          /* Capture ID node */
 };
 
-#ifdef USE_IPV6
 struct hep_ip6hdr {
         struct in6_addr hp6_src;        /* source address */
         struct in6_addr hp6_dst;        /* destination address */
 };
-#endif
 
 /* HEPv3 types */
 
@@ -115,12 +113,10 @@ struct hep_chunk_ip4 {
 
 typedef struct hep_chunk_ip4 hep_chunk_ip4_t;
 
-#ifdef USE_IPV6
 struct hep_chunk_ip6 {
        hep_chunk_t chunk;
        struct in6_addr data;
 } __attribute__((packed));
-#endif
 
 typedef struct hep_chunk_ip6 hep_chunk_ip6_t;
 
@@ -152,10 +148,8 @@ struct hep_generic_recv {
         hep_chunk_uint32_t *time_usec;
         hep_chunk_ip4_t    *hep_src_ip4;
         hep_chunk_ip4_t	    *hep_dst_ip4;
-#ifdef USE_IPV6
         hep_chunk_ip6_t    *hep_src_ip6;
         hep_chunk_ip6_t    *hep_dst_ip6;
-#endif
         hep_chunk_uint8_t  *proto_t;
         hep_chunk_uint32_t *capt_id;
         hep_chunk_uint16_t *keep_tm;

+ 0 - 2
modules/sipcapture/sipcapture.c

@@ -524,9 +524,7 @@ static int mod_init(void) {
 		register_procs(raw_sock_children);
 		                		
 		if(extract_host_port() && (((ip=str2ip(&raw_socket_listen)) == NULL)
-#ifdef  USE_IPV6
 		               && ((ip=str2ip6(&raw_socket_listen)) == NULL)
-#endif
 		         )) 
 		{		
 			LM_ERR("sipcapture mod_init: bad RAW IP: %.*s\n", raw_socket_listen.len, raw_socket_listen.s); 

+ 0 - 12
modules/siptrace/siptrace.c

@@ -1517,9 +1517,7 @@ static int trace_send_hep_duplicate(str *body, str *from, str *to)
 	struct timeval tvb;
 	struct timezone tz;
 	                 
-#if USE_IPV6
 	struct hep_ip6hdr hep_ip6header;
-#endif
 
 	if(body->s==NULL || body->len <= 0)
 		return -1;
@@ -1533,11 +1531,7 @@ static int trace_send_hep_duplicate(str *body, str *from, str *to)
 
 	/* message length */
 	len = body->len 
-#if USE_IPV6
 		+ sizeof(struct hep_ip6hdr)
-#else
-		+ sizeof(struct hep_iphdr)          
-#endif
 		+ sizeof(struct hep_hdr) + sizeof(struct hep_timehdr);;
 
 
@@ -1595,7 +1589,6 @@ static int trace_send_hep_duplicate(str *body, str *from, str *to)
 
 		len = sizeof(struct hep_iphdr);
 	}
-#ifdef USE_IPV6
 	else if (from_su.s.sa_family==AF_INET6){
 		/* prepare the hep6 headers */
 
@@ -1609,7 +1602,6 @@ static int trace_send_hep_duplicate(str *body, str *from, str *to)
 
 		len = sizeof(struct hep_ip6hdr);
 	}
-#endif /* USE_IPV6 */
 	else {
 		LOG(L_ERR, "ERROR: trace_send_hep_duplicate: Unsupported protocol family\n");
 		goto error;;
@@ -1638,12 +1630,10 @@ static int trace_send_hep_duplicate(str *body, str *from, str *to)
 		memcpy((void*)buffer + buflen, &hep_ipheader, sizeof(struct hep_iphdr));
 		buflen += sizeof(struct hep_iphdr);
 	}
-#if USE_IPV6
 	else {
 		memcpy((void*)buffer+buflen, &hep_ip6header, sizeof(struct hep_ip6hdr));
 		buflen += sizeof(struct hep_ip6hdr);
 	}
-#endif /* USE_IPV6 */
 
 	if(hep_version == 2) {
 
@@ -1763,9 +1753,7 @@ static int pipport2su (char *pipport, union sockaddr_union *tmp_su, unsigned int
 
 	/* check if it's an ip address */
 	if (((ip=str2ip(&host_uri))!=0)
-#ifdef  USE_IPV6
 			|| ((ip=str2ip6(&host_uri))!=0)
-#endif
 	   ) {
 		ip_addr2su(tmp_su, ip, ntohs(port_no));
 		return 0;	

+ 0 - 4
modules/stun/kam_stun.c

@@ -750,10 +750,8 @@ static int stun_add_address_attr(struct stun_msg* res,
 {
 	struct stun_attr attr;
 	int		 ip_struct_len;
-#ifdef USE_IPV6
 	UINT_T	 id[IP_ADDR];
 	int i;
-#endif /* USE_IPV6 */ 
 	
 	ip_struct_len = 0;
 	attr.type = htons(type);
@@ -766,7 +764,6 @@ static int stun_add_address_attr(struct stun_msg* res,
 			res->ip_addr.ip[0] = (do_xor) ? 
 				res->ip_addr.ip[0] ^ htonl(MAGIC_COOKIE) : res->ip_addr.ip[0];
 			break;
-#ifdef USE_IPV6
 		case AF_INET6:
 			ip_struct_len = sizeof(struct stun_ip_addr);
 			res->ip_addr.family = htons(IPV6_FAMILY);
@@ -777,7 +774,6 @@ static int stun_add_address_attr(struct stun_msg* res,
 							res->ip_addr.ip[i] ^ id[i] : res->ip_addr.ip[i];
 			}
 			break;
-#endif /* USE_IPV6 */ 
 		default:
 			break;
 	}

+ 0 - 9
modules/tls/tls_config.c

@@ -49,7 +49,6 @@
 static tls_domains_cfg_t* cfg = NULL;
 static tls_domain_t* domain = NULL;
 
-#ifdef USE_IPV6
 static int parse_ipv6(struct ip_addr* ip, cfg_token_t* token, 
 					  cfg_parser_t* st)
 {
@@ -77,7 +76,6 @@ static int parse_ipv6(struct ip_addr* ip, cfg_token_t* token,
 	    st->file, token->start.line, token->start.col);
 	return -1;
 }
-#endif /* USE_IPV6 */
 
 
 static int parse_ipv4(struct ip_addr* ip, cfg_token_t* token, 
@@ -202,14 +200,7 @@ static int parse_hostport(int* type, struct ip_addr* ip, unsigned int* port,
 	}
 
 	if (t.type == '[') {
-#ifdef USE_IPV6
 		if (parse_ipv6(ip, &t, st) < 0) return -1;
-#else
-		ERR("%s:%d:%d: IPv6 address  not supported (compiled without IPv6"
-				" support)\n", 
-		    st->file, t.start.line, t.start.col);
-		return -1;
-#endif /* USE_IPV6 */
 	} else if (t.type == CFG_TOKEN_ALPHA) {
 		opt = cfg_lookup_token(token_default, &t.val);
 		if (opt) {

+ 0 - 2
modules/tm/t_msgbuilder.c

@@ -815,9 +815,7 @@ static unsigned long nhop_type(sip_msg_t *orig_inv, rte_t *rtset,
 		return F_RB_NH_STRICT;
 	/* if 1st route contains an IP address, comparing it against .dst */
 	if ((uri_ia = str2ip(&topr_uri.host))
-#ifdef USE_IPV6
 			|| (uri_ia = str2ip6(&topr_uri.host))
-#endif
 			) {
 		/* we have an IP address in route -> comparison can go swiftly */
 		if (init_su(&uri_sau, uri_ia, uri_port) < 0)

+ 0 - 9
msg_translator.c

@@ -195,9 +195,7 @@ static int check_via_address(struct ip_addr* ip, str *name,
 	struct hostent* he;
 	int i;
 	char* s;
-	#ifdef USE_IPV6
 	int len;
-	#endif
 
 	/* maybe we are lucky and name it's an ip */
 	s=ip_addr2a(ip);
@@ -205,8 +203,6 @@ static int check_via_address(struct ip_addr* ip, str *name,
 		DBG("check_via_address(%s, %.*s, %d)\n",
 			s, name->len, name->s, resolver);
 
-	#ifdef USE_IPV6
-
 		len=strlen(s);
 
 		/* check if name->s is an ipv6 address or an ipv6 address ref. */
@@ -220,7 +216,6 @@ static int check_via_address(struct ip_addr* ip, str *name,
 		   )
 			return 0;
 		else
-	#endif
 
 			if (strncmp(name->s, s, name->len)==0)
 				return 0;
@@ -1764,9 +1759,7 @@ after_local_via:
 			}
 #if 0
 			/* no longer necessary, now hots.s contains [] */
-		#ifdef USE_IPV6
 			if(send_sock->address.af==AF_INET6) size+=1; /* +1 for ']'*/
-		#endif
 #endif
 	}
 	/* if received needs to be added, add anchor after host and add it, or
@@ -2514,7 +2507,6 @@ char* via_builder( unsigned int *len,
 		LOG(L_CRIT, "BUG: via_builder: unknown proto %d\n", send_info->proto);
 		return 0;
 	}
-#	ifdef USE_IPV6
 	/* add [] only if ipv6 and outbound socket address is used;
 	 * if using pre-set no check is made */
 	if ((send_sock->address.af==AF_INET6) &&
@@ -2524,7 +2516,6 @@ char* via_builder( unsigned int *len,
 		extra_len=1;
 		via_len+=2; /* [ ]*/
 	}
-#	endif
 	memcpy(line_buf+via_prefix_len+extra_len, address_str->s,
 				address_str->len);
 	if ((send_sock->port_no!=SIP_PORT) ||

+ 0 - 2
name_alias.h

@@ -59,13 +59,11 @@ static inline int grep_aliases(char* name, int len, unsigned short port,
 {
 	struct  host_alias* a;
 	
-#ifdef USE_IPV6
 	if ((len>2)&&((*name)=='[')&&(name[len-1]==']')){
 		/* ipv6 reference, skip [] */
 		name++;
 		len-=2;
 	}
-#endif
 	for(a=aliases;a;a=a->next)
 		if ((a->alias.len==len) && ((a->port==0) || (port==0) || 
 				(a->port==port)) && ((a->proto==0) || (proto==0) || 

+ 0 - 14
obsolete/permissions/ip_set.c

@@ -34,26 +34,20 @@ void ip_set_init(struct ip_set *ip_set, int use_shm) {
 	memset(ip_set, 0, sizeof(*ip_set));
 	ip_set->use_shm = use_shm;
 	ip_tree_init(&ip_set->ipv4_tree);
-	#ifdef USE_IPV6
 	ip_tree_init(&ip_set->ipv6_tree);
-	#endif
 }
 
 void ip_set_destroy(struct ip_set *ip_set) {
 	ip_tree_destroy(&ip_set->ipv4_tree, 0, ip_set->use_shm);
-	#ifdef USE_IPV6
 	ip_tree_destroy(&ip_set->ipv6_tree, 0, ip_set->use_shm);
-	#endif
 }
 
 int ip_set_add_ip(struct ip_set *ip_set, struct ip_addr *ip, unsigned int network_prefix) {
 	switch (ip->af) {
 		case AF_INET:
 			return ip_tree_add_ip(&ip_set->ipv4_tree, ip->u.addr, (ip->len*8<network_prefix)?ip->len*8:network_prefix, ip_set->use_shm);
-	#ifdef USE_IPV6
 		case AF_INET6:
 			return ip_tree_add_ip(&ip_set->ipv6_tree, ip->u.addr, (ip->len*8<network_prefix)?ip->len*8:network_prefix, ip_set->use_shm);
-	#endif
 		default:
 			return -1;				
 		}
@@ -64,10 +58,8 @@ int ip_set_ip_exists(struct ip_set *ip_set, struct ip_addr *ip) {
 	switch (ip->af) {
 		case AF_INET:
 			return ip_tree_find_ip(ip_set->ipv4_tree, ip->u.addr, ip->len*8, &h) > 0;
-	#ifdef USE_IPV6
 		case AF_INET6:
 			return ip_tree_find_ip(ip_set->ipv6_tree, ip->u.addr, ip->len*8, &h) > 0;
-	#endif
 		default:
 			return -1;				
 		}
@@ -76,10 +68,8 @@ int ip_set_ip_exists(struct ip_set *ip_set, struct ip_addr *ip) {
 void ip_set_print(FILE *stream, struct ip_set *ip_set) {
 	fprintf(stream, "IPv4:\n");
 	ip_tree_print(stream, ip_set->ipv4_tree, 2);
-	#ifdef USE_IPV6
 	fprintf(stream, "IPv6:\n");
 	ip_tree_print(stream, ip_set->ipv6_tree, 2);
-	#endif
 }
 
 int ip_set_add_list(struct ip_set *ip_set, str ip_set_s){
@@ -126,9 +116,7 @@ int ip_set_add_ip_s(struct ip_set *ip_set, str ip_s, str mask_s){
 	unsigned int prefix, i;
 
 	if ( ((ip = str2ip(&ip_s))==0)
-		#ifdef  USE_IPV6
 					  && ((ip = str2ip6(&ip_s))==0)
-		#endif
 									  ){
 		ERR("ip_set_add_ip_s: string to ip conversion error '%.*s'\n", ip_s.len, ip_s.s);
 		return -1;
@@ -153,9 +141,7 @@ int ip_set_add_ip_s(struct ip_set *ip_set, str ip_s, str mask_s){
 		
 		if (fl) {  /* 255.255.255.0 format */
 			if ( ((ip = str2ip(&mask_s))==0)
-				#ifdef  USE_IPV6
 					  && ((ip = str2ip6(&mask_s))==0)
-				#endif
 				  ){
 				ERR("ip_set_add_ip_s: string to ip mask conversion error '%.*s'\n", mask_s.len, mask_s.s);
 				return -1;

+ 0 - 2
obsolete/permissions/ip_set.h

@@ -37,9 +37,7 @@
 struct ip_set {
 	int use_shm;
 	struct ip_tree_leaf *ipv4_tree;
-#ifdef USE_IPV6
 	struct ip_tree_leaf *ipv6_tree;	
-#endif
 };
 
 extern void ip_set_init(struct ip_set *ip_set, int use_shm);

+ 0 - 2
obsolete/permissions/ip_set_rpc.c

@@ -274,10 +274,8 @@ void rpc_ip_set_print(rpc_t* rpc, void* ctx) {
 	rpc->add(ctx, "{", &c);
 	if (rpc->struct_add(c, "s", "IPv", "6") < 0) 
 		goto err;	
-#ifdef USE_IPV6
 	if (rpc_ip_tree_print(rpc, c, "", ip_set->ipv6_tree, 0) < 0) 
 		goto err;
-#endif
 
 err:		
 	if (pending)

+ 0 - 2
obsolete/permissions/permissions.c

@@ -679,9 +679,7 @@ static int w_ip_is_trusted(struct sip_msg* msg, char* _ip_set, char* _ip) {
 			/* string -> ip */
 
 			if ( ((ip = str2ip(&ip_s))==0)
-				#ifdef  USE_IPV6
 			                  && ((ip = str2ip6(&ip_s))==0)
-				#endif
 							                  ){
 				ERR(MODULE_NAME": ip_is_trusted: string to ip conversion error '%.*s'\n", ip_s.len, ip_s.s);
 				return -1;

+ 0 - 4
obsolete/registrar/save.c

@@ -295,12 +295,8 @@ int parse_uri_dstip(str* received, struct ip_addr* ip, unsigned short* port,
 		goto end; /* no dst_ip param */
 	/* check if it's ipv4 or ipv6 */
 	if (
-#ifdef USE_IPV6
 			likely(((p = str2ip(&hooks.uri.dstip->body)) != 0) ||
 				((p = str2ip6(&hooks.uri.dstip->body)) != 0))
-#else /* ! USE_IPV6 */
-			likely(((p = str2ip(&hooks.uri.dstip->body)) != 0))
-#endif /* USE_IPV6 */
 				) {
 		*ip = *p;
 	} else

+ 0 - 4
pt.c

@@ -95,11 +95,7 @@ static int calc_common_open_fds_no(void)
 									  tmp. tcp send +
 									  tmp dns.*/
 				-1 /* timer (no udp)*/ + 3 /* stdin/out/err */ +
-#ifdef USE_IPV6
 				2*mhomed
-#else
-				mhomed
-#endif /* USE_IPV6*/
 				;
 	return max_fds_no;
 }

+ 0 - 6
resolve.c

@@ -1229,9 +1229,7 @@ struct hostent* srv_sip_resolvehost(str* name, int zt, unsigned short* port,
 														  don't find another */
 		/* check if it's an ip address */
 		if (((ip=str2ip(name))!=0)
-#ifdef	USE_IPV6
 			  || ((ip=str2ip6(name))!=0) 
-#endif
 			 ){
 			/* we are lucky, this is an ip address */
 			he=ip_addr2he(name, ip);
@@ -1456,9 +1454,7 @@ struct hostent* no_naptr_srv_sip_resolvehost(str* name, unsigned short* port, ch
 
 	/* check if it's an ip address */
 	if (((ip=str2ip(name))!=0)
-#ifdef	USE_IPV6
 			  || ((ip=str2ip6(name))!=0)
-#endif
 			 ){
 		/* we are lucky, this is an ip address */
 		/* set proto if needed - default udp */
@@ -1629,9 +1625,7 @@ struct hostent* naptr_sip_resolvehost(str* name,  unsigned short* port,
 	if (port && proto && (*proto==0) && (*port==0)){
 		*proto=PROTO_UDP; /* just in case we don't find another */
 		if ( ((ip=str2ip(name))!=0)
-#ifdef	USE_IPV6
 			  || ((ip=str2ip6(name))!=0)
-#endif
 		){
 			/* we are lucky, this is an ip address */
 			he=ip_addr2he(name,ip);

+ 0 - 12
resolve.h

@@ -276,7 +276,6 @@ error_dots:
 }
 
 
-#ifdef USE_IPV6
 /* returns an ip_addr struct.; on error returns 0
  * the ip_addr struct is static, so subsequent calls will destroy its content*/
 static inline struct ip_addr* str2ip6(str* st)
@@ -379,7 +378,6 @@ error_char:
 			st->s);*/
 	return 0;
 }
-#endif /* USE_IPV6 */
 
 
 
@@ -392,16 +390,12 @@ static inline struct hostent* _resolvehost(char* name)
 {
 	static struct hostent* he=0;
 #ifdef HAVE_GETIPNODEBYNAME 
-#ifdef USE_IPV6
 	int err;
 	static struct hostent* he2=0;
 #endif
-#endif
 #ifndef DNS_IP_HACK
-#ifdef USE_IPV6
 	int len;
 #endif
-#endif
 #ifdef DNS_IP_HACK
 	struct ip_addr* ip;
 	str s;
@@ -411,16 +405,13 @@ static inline struct hostent* _resolvehost(char* name)
 
 	/* check if it's an ip address */
 	if ( ((ip=str2ip(&s))!=0)
-#ifdef	USE_IPV6
 		  || ((ip=str2ip6(&s))!=0)
-#endif
 		){
 		/* we are lucky, this is an ip address */
 		return ip_addr2he(&s, ip);
 	}
 	
 #else /* DNS_IP_HACK */
-#ifdef USE_IPV6
 	len=0;
 	if (*name=='['){
 		len=strlen(name);
@@ -430,12 +421,10 @@ static inline struct hostent* _resolvehost(char* name)
 			goto skip_ipv4;
 		}
 	}
-#endif
 #endif
 	/* ipv4 */
 	he=dns_func.sr_gethostbyname(name);
 
-#ifdef USE_IPV6
 	if(he==0 && cfg_get(core, core_cfg, dns_try_ipv6)){
 #ifndef DNS_IP_HACK
 skip_ipv4:
@@ -456,7 +445,6 @@ skip_ipv4:
 		if (len) name[len-2]=']'; /* restore */
 #endif
 	}
-#endif
 	return he;
 }
 

+ 0 - 6
sctp_server.c

@@ -458,7 +458,6 @@ static int sctp_init_sock_opt_common(int s, int af)
 					strerror(errno));
 			/* continue since this is not critical */
 		}
-#ifdef USE_IPV6
 	} else if(af==AF_INET6){
 		if (setsockopt(s, IPPROTO_IPV6, IPV6_TCLASS,
 					(void*)&optval, sizeof(optval)) ==-1) {
@@ -466,7 +465,6 @@ static int sctp_init_sock_opt_common(int s, int af)
 					strerror(errno));
 			/* continue since this is not critical */
 		}
-#endif
 	}
 	
 	/* set receive buffer: SO_RCVBUF*/
@@ -822,11 +820,9 @@ static int sctp_bind_sock(struct socket_info* sock_info)
 				(unsigned)sockaddru_len(*addr),
 				sock_info->address_str.s,
 				strerror(errno));
-	#ifdef USE_IPV6
 		if (addr->s.sa_family==AF_INET6)
 			LOG(L_ERR, "ERROR: sctp_bind_sock: might be caused by using a "
 							"link local address, try site local or global\n");
-	#endif
 		goto error;
 	}
 	for (ai=sock_info->addr_info_lst; ai; ai=ai->next)
@@ -839,11 +835,9 @@ static int sctp_bind_sock(struct socket_info* sock_info)
 						sock_info->port_no,
 						sock_info->address_str.s, sock_info->port_no,
 						errno, strerror(errno));
-		#ifdef USE_IPV6
 			if (ai->su.s.sa_family==AF_INET6)
 				LOG(L_ERR, "ERROR: sctp_bind_sock: might be caused by using a "
 							"link local address, try site local or global\n");
-		#endif
 			/* try to continue, a secondary address bind failure is not 
 			 * critical */
 		}

+ 0 - 18
socket_info.c

@@ -513,9 +513,7 @@ struct socket_info** get_sock_info_list(unsigned short proto)
 inline static int si_hname_cmp(str* host, str* name, str* addr_str, 
 								struct ip_addr* ip_addr, int flags)
 {
-#ifdef USE_IPV6
 	struct ip_addr* ip6;
-#endif
 	
 	if ( (host->len==name->len) && 
 		(strncasecmp(host->s, name->s, name->len)==0) /*slower*/)
@@ -524,7 +522,6 @@ inline static int si_hname_cmp(str* host, str* name, str* addr_str,
 		 * ipv6 addresses if we are lucky*/
 		goto found;
 	/* check if host == ip address */
-#ifdef USE_IPV6
 	/* ipv6 case is uglier, host can be [3ffe::1] */
 	ip6=str2ip6(host);
 	if (ip6){
@@ -534,7 +531,6 @@ inline static int si_hname_cmp(str* host, str* name, str* addr_str,
 			return -1; /* no match, but this is an ipv6 address
 						 so no point in trying ipv4 */
 	}
-#endif
 	/* ipv4 */
 	if ( (!(flags&SI_IS_IP)) && (host->len==addr_str->len) && 
 			(memcmp(host->s, addr_str->s, addr_str->len)==0) )
@@ -563,13 +559,11 @@ struct socket_info* grep_sock_info(str* host, unsigned short port,
 	unsigned short c_proto;
 	
 	hname=*host;
-#ifdef USE_IPV6
 	if ((hname.len>2)&&((*hname.s)=='[')&&(hname.s[hname.len-1]==']')){
 		/* ipv6 reference, skip [] */
 		hname.s++;
 		hname.len-=2;
 	}
-#endif
 
 	c_proto=(proto!=PROTO_NONE)?proto:PROTO_UDP;
 retry:
@@ -1275,12 +1269,8 @@ int add_interfaces(char* if_name, int family, unsigned short port,
 				#else
 					( (ifr.ifr_addr.sa_family==AF_INET)?
 						sizeof(struct sockaddr_in):
-					#ifdef USE_IPV6
 						((ifr.ifr_addr.sa_family==AF_INET6)?
 						sizeof(struct sockaddr_in6):sizeof(struct sockaddr)) )
-					#else /* USE_IPV6 */
-						sizeof(struct sockaddr) )
-					#endif /* USE_IPV6 */
 				#endif
 				)
 			#endif
@@ -1843,13 +1833,11 @@ int fix_all_socket_lists()
 		){
 		/* get all listening ipv4/ipv6 interfaces */
 		if ( ( (add_interfaces(0, AF_INET, 0,  PROTO_UDP, &ai_lst)==0)
-#ifdef USE_IPV6
 #ifdef __OS_linux
 		&&  (!auto_bind_ipv6 || add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_UDP, &ai_lst) == 0)
 #else
 		&& ( !auto_bind_ipv6 || add_interfaces(0, AF_INET6, 0,  PROTO_UDP, &ai_lst) !=0 ) /* add_interface does not work for IPv6 on Linux */
 #endif /* __OS_linux */
-#endif /* USE_IPV6 */
 			 ) && (addr_info_to_si_lst(ai_lst, 0, PROTO_UDP, 0, &udp_listen)==0)){
 			free_addr_info_lst(&ai_lst);
 			ai_lst=0;
@@ -1857,13 +1845,11 @@ int fix_all_socket_lists()
 #ifdef USE_TCP
 			if (!tcp_disable){
 				if ( ((add_interfaces(0, AF_INET, 0,  PROTO_TCP, &ai_lst)!=0)
-#ifdef USE_IPV6
 #ifdef __OS_linux
     				|| (auto_bind_ipv6 && add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_TCP, &ai_lst) != 0)
 #else
 				|| (auto_bind_ipv6 && add_interfaces(0, AF_INET6, 0,  PROTO_TCP, &ai_lst) !=0 )
 #endif /* __OS_linux */
-#endif /* USE_IPV6 */
 				) || (addr_info_to_si_lst(ai_lst, 0, PROTO_TCP, 0,
 										 				&tcp_listen)!=0))
 					goto error;
@@ -1873,13 +1859,11 @@ int fix_all_socket_lists()
 				if (!tls_disable){
 					if (((add_interfaces(0, AF_INET, 0, PROTO_TLS,
 										&ai_lst)!=0)
-#ifdef USE_IPV6
 #ifdef __OS_linux
     				|| (auto_bind_ipv6 && add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_TLS, &ai_lst) != 0)
 #else
 				|| (auto_bind_ipv6 && add_interfaces(0, AF_INET6, 0,  PROTO_TLS, &ai_lst)!=0)
 #endif /* __OS_linux */
-#endif /* USE_IPV6 */
 					) || (addr_info_to_si_lst(ai_lst, 0, PROTO_TLS, 0,
 										 				&tls_listen)!=0))
 						goto error;
@@ -1892,13 +1876,11 @@ int fix_all_socket_lists()
 #ifdef USE_SCTP
 			if (!sctp_disable){
 				if (((add_interfaces(0, AF_INET, 0,  PROTO_SCTP, &ai_lst)!=0)
-#ifdef USE_IPV6
 #ifdef __OS_linux
     				|| (auto_bind_ipv6 && add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_SCTP, &ai_lst) != 0)
 #else
 				|| (auto_bind_ipv6 && add_interfaces(0, AF_INET6, 0,  PROTO_SCTP, &ai_lst) != 0)
 #endif /* __OS_linux */
-#endif /* USE_IPV6 */
 					) || (addr_info_to_si_lst(ai_lst, 0, PROTO_SCTP, 0,
 							 				&sctp_listen)!=0))
 					goto error;

+ 0 - 10
tcp_main.c

@@ -254,10 +254,8 @@ int tls_max_connections=DEFAULT_TLS_MAX_CONNECTIONS;
 
 static union sockaddr_union tcp_source_ipv4_addr; /* saved bind/srv v4 addr. */
 static union sockaddr_union* tcp_source_ipv4=0;
-#ifdef USE_IPV6
 static union sockaddr_union tcp_source_ipv6_addr; /* saved bind/src v6 addr. */
 static union sockaddr_union* tcp_source_ipv6=0;
-#endif
 
 static int* tcp_connections_no=0; /* current tcp (+tls) open connections */
 static int* tls_connections_no=0; /* current tls open connections */
@@ -308,12 +306,10 @@ int tcp_set_src_addr(struct ip_addr* ip)
 			ip_addr2su(&tcp_source_ipv4_addr, ip, 0);
 			tcp_source_ipv4=&tcp_source_ipv4_addr;
 			break;
-		#ifdef USE_IPV6
 		case AF_INET6:
 			ip_addr2su(&tcp_source_ipv6_addr, ip, 0);
 			tcp_source_ipv6=&tcp_source_ipv6_addr;
 			break;
-		#endif
 		default:
 			return -1;
 	}
@@ -395,7 +391,6 @@ static int init_sock_opt(int s, int af)
 					strerror(errno));
 			/* continue since this is not critical */
 		}
-#ifdef USE_IPV6
 	} else if(af==AF_INET6){
 		if (setsockopt(s, IPPROTO_IPV6, IPV6_TCLASS,
 					(void*)&optval, sizeof(optval)) ==-1) {
@@ -403,7 +398,6 @@ static int init_sock_opt(int s, int af)
 					strerror(errno));
 			/* continue since this is not critical */
 		}
-#endif
 	}
 
 #if  !defined(TCP_DONT_REUSEADDR) 
@@ -1250,9 +1244,7 @@ find_socket:
 				" listening socket for %s, using default...\n",
 					su2a(server, sizeof(*server)), ip_addr2a(&ip));
 		if (server->s.sa_family==AF_INET) *res_si=sendipv4_tcp;
-#ifdef USE_IPV6
 		else *res_si=sendipv6_tcp;
-#endif
 	}
 	*res_local_addr=*from;
 	return s;
@@ -1862,11 +1854,9 @@ int tcp_send(struct dest_info* dst, union sockaddr_union* from,
 				case AF_INET:
 						from = tcp_source_ipv4;
 					break;
-#ifdef USE_IPV6
 				case AF_INET6:
 						from = tcp_source_ipv6;
 					break;
-#endif
 				default:
 					/* error, bad af, ignore ... */
 					break;

+ 0 - 4
test/p_uri.c

@@ -31,11 +31,7 @@ struct cfg_group_core default_core_cfg = {
 	DEFAULT_BLST_MAX_MEM,
 #endif
 	/* resolver */
-#ifdef USE_IPV6
 	1,  /* dns_try_ipv6 -- on by default */
-#else
-	0,  /* dns_try_ipv6 -- off, if no ipv6 support */
-#endif
 	0,  /* dns_try_naptr -- off by default */
 	30,  /* udp transport preference (for naptr) */
 	20,  /* tcp transport preference (for naptr) */

+ 0 - 4
test/parse_to_body.c

@@ -31,11 +31,7 @@ struct cfg_group_core default_core_cfg = {
 	DEFAULT_BLST_MAX_MEM,
 #endif
 	/* resolver */
-#ifdef USE_IPV6
 	1,  /* dns_try_ipv6 -- on by default */
-#else
-	0,  /* dns_try_ipv6 -- off, if no ipv6 support */
-#endif
 	0,  /* dns_try_naptr -- off by default */
 	30,  /* udp transport preference (for naptr) */
 	20,  /* tcp transport preference (for naptr) */

+ 0 - 10
udp_server.c

@@ -240,9 +240,7 @@ int probe_max_receive_buffer( int udp_sock )
 static int setup_mcast_rcvr(int sock, union sockaddr_union* addr)
 {
 	struct ip_mreq mreq;
-#ifdef USE_IPV6
 	struct ipv6_mreq mreq6;
-#endif /* USE_IPV6 */
 	
 	if (addr->s.sa_family==AF_INET){
 		memcpy(&mreq.imr_multiaddr, &addr->sin.sin_addr, 
@@ -256,7 +254,6 @@ static int setup_mcast_rcvr(int sock, union sockaddr_union* addr)
 			return -1;
 		}
 		
-#ifdef USE_IPV6
 	} else if (addr->s.sa_family==AF_INET6){
 		memcpy(&mreq6.ipv6mr_multiaddr, &addr->sin6.sin6_addr, 
 		       sizeof(struct in6_addr));
@@ -272,7 +269,6 @@ static int setup_mcast_rcvr(int sock, union sockaddr_union* addr)
 			return -1;
 		}
 		
-#endif /* USE_IPV6 */
 	} else {
 		LOG(L_ERR, "ERROR: setup_mcast_rcvr: Unsupported protocol family\n");
 		return -1;
@@ -325,7 +321,6 @@ int udp_init(struct socket_info* sock_info)
 					strerror(errno));
 			/* continue since this is not critical */
 		}
-#ifdef USE_IPV6
 	} else if (addr->s.sa_family==AF_INET6){
 		if (setsockopt(sock_info->socket, IPPROTO_IPV6, IPV6_TCLASS,
 					(void*)&optval, sizeof(optval)) ==-1) {
@@ -333,7 +328,6 @@ int udp_init(struct socket_info* sock_info)
 					strerror(errno));
 			/* continue since this is not critical */
 		}
-#endif
 	}
 
 #if defined (__OS_linux) && defined(UDP_ERRORS)
@@ -379,7 +373,6 @@ int udp_init(struct socket_info* sock_info)
 						" %s\n", strerror(errno));
 			}
 		}
-#ifdef USE_IPV6
 	} else if (addr->s.sa_family==AF_INET6){
 		if (setsockopt(sock_info->socket, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, 
 						&mcast_loopback, sizeof(mcast_loopback))==-1){
@@ -393,7 +386,6 @@ int udp_init(struct socket_info* sock_info)
 						"(IPV6_MULTICAST_HOPS): %s\n", strerror(errno));
 			}
 		}
-#endif /* USE_IPV6*/
 	} else {
 		LOG(L_ERR, "ERROR: udp_init: Unsupported protocol family %d\n",
 					addr->s.sa_family);
@@ -409,11 +401,9 @@ int udp_init(struct socket_info* sock_info)
 				(unsigned)sockaddru_len(*addr),
 				sock_info->address_str.s,
 				strerror(errno));
-	#ifdef USE_IPV6
 		if (addr->s.sa_family==AF_INET6)
 			LOG(L_ERR, "ERROR: udp_init: might be caused by using a link "
 					" local address, try site local or global\n");
-	#endif
 		goto error;
 	}
 

+ 1 - 7
ver_defs.h

@@ -39,12 +39,6 @@
 #define STATS_STR  "STATS: Off"
 #endif
 
-#ifdef USE_IPV6
-#define USE_IPV6_STR ", USE_IPV6"
-#else
-#define USE_IPV6_STR ""
-#endif
-
 #ifdef USE_TCP
 #define USE_TCP_STR ", USE_TCP"
 #else
@@ -328,7 +322,7 @@
 #endif
 
 #define SER_COMPILE_FLAGS \
-	STATS_STR EXTRA_DEBUG_STR USE_IPV6_STR USE_TCP_STR USE_TLS_STR \
+	STATS_STR EXTRA_DEBUG_STR USE_TCP_STR USE_TLS_STR \
 	USE_SCTP_STR CORE_TLS_STR TLS_HOOKS_STR  USE_RAW_SOCKS_STR \
 	DISABLE_NAGLE_STR USE_MCAST_STR NO_DEBUG_STR NO_LOG_STR \
 	NO_SIG_DEBUG_STR DNS_IP_HACK_STR  SHM_MEM_STR SHM_MMAP_STR PKG_MALLOC_STR \