Browse code

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 authored on 18/05/2013 08:07:25
Showing 44 changed files
... ...
@@ -680,7 +680,6 @@ C_DEFS= $(extra_defs) \
680 680
 	 -DPKG_MALLOC \
681 681
 	 -DSHM_MEM  -DSHM_MMAP \
682 682
 	 -DDNS_IP_HACK \
683
-	 -DUSE_IPV6 \
684 683
 	 -DUSE_MCAST \
685 684
 	 -DUSE_TCP \
686 685
 	 -DDISABLE_NAGLE \
... ...
@@ -2054,9 +2053,9 @@ ifeq ($(OS), darwin)
2054 2054
 endif
2055 2055
 
2056 2056
 ifneq (,$(findstring cygwin, $(OS)))
2057
-	# cygwin doesn't support IPV6 and doesn't support fd passing so no TCP
2058
-	#C_DEFS:=$(filter-out -DUSE_IPV6 -DUSE_TCP, $(C_DEFS))
2059
-	DEFS_RM+=-DUSE_IPV6 -DUSE_TCP
2057
+	# cygwin does support IPV6 starting from version 1.7, but (still?) doesn't support fd passing so no TCP
2058
+	#C_DEFS:=$(filter-out -DUSE_TCP, $(C_DEFS))
2059
+	DEFS_RM+=-DUSE_TCP
2060 2060
 	C_DEFS+=-DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
2061 2061
 			-DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
2062 2062
 			-DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER
... ...
@@ -1160,11 +1160,7 @@ IMPORTFILE      "import_file"
1160 1160
 <INITIAL>{INET}			{ count(); yylval.intval=AF_INET;
1161 1161
 							yy_number_str=yytext; return NUMBER; }
1162 1162
 <INITIAL>{INET6}		{ count();
1163
-						#ifdef USE_IPV6
1164
-						  yylval.intval=AF_INET6;
1165
-						#else
1166
-						  yylval.intval=-1; /* no match*/
1167
-						#endif
1163
+						yylval.intval=AF_INET6;
1168 1164
 						yy_number_str=yytext;
1169 1165
 						return NUMBER; }
1170 1166
 <INITIAL>{SSLv23}		{ count(); yylval.strval=yytext; return SSLv23; }
... ...
@@ -165,11 +165,7 @@
165 165
 		if (rt!=ONSEND_ROUTE) yyerror( s " allowed only in onsend_routes");\
166 166
 	}while(0)
167 167
 
168
-#ifdef USE_IPV6
169 168
 	#define IF_AUTO_BIND_IPV6(x) x
170
-#else
171
-	#define IF_AUTO_BIND_IPV6(x) warn("IPV6 support not compiled");
172
-#endif
173 169
 
174 170
 #ifdef USE_DNS_CACHE
175 171
 	#define IF_DNS_CACHE(x) x
... ...
@@ -1124,12 +1120,8 @@ assign_stm:
1124 1124
 	| TCP_SOURCE_IPV4 EQUAL error { yyerror("IPv4 address expected"); }
1125 1125
 	| TCP_SOURCE_IPV6 EQUAL ipv6 {
1126 1126
 		#ifdef USE_TCP
1127
-			#ifdef USE_IPV6
1128 1127
 				if (tcp_set_src_addr($3)<0)
1129 1128
 					warn("tcp_source_ipv6 failed");
1130
-			#else
1131
-				warn("IPv6 support not compiled in");
1132
-			#endif
1133 1129
 		#else
1134 1130
 			warn("tcp support not compiled in");
1135 1131
 		#endif
... ...
@@ -1856,17 +1848,12 @@ ipv6addr:
1856 1856
 		if ($$==0) {
1857 1857
 			LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
1858 1858
 		} else {
1859
-		#ifdef USE_IPV6
1860 1859
 			memset($$, 0, sizeof(struct ip_addr));
1861 1860
 			$$->af=AF_INET6;
1862 1861
 			$$->len=16;
1863 1862
 			if (inet_pton(AF_INET6, $1, $$->u.addr)<=0) {
1864 1863
 				yyerror("bad ipv6 address");
1865 1864
 			}
1866
-		#else
1867
-			yyerror("ipv6 address & no ipv6 support compiled in");
1868
-			YYABORT;
1869
-		#endif
1870 1865
 		}
1871 1866
 	}
1872 1867
 	;
... ...
@@ -2243,10 +2230,8 @@ exp_elem:
2243 2243
 			}
2244 2244
 			if (s_tmp.s){
2245 2245
 				ip_tmp=str2ip(&s_tmp);
2246
-			#ifdef USE_IPV6
2247 2246
 				if (ip_tmp==0)
2248 2247
 					ip_tmp=str2ip6(&s_tmp);
2249
-			#endif
2250 2248
 				pkg_free(s_tmp.s);
2251 2249
 				if (ip_tmp) {
2252 2250
 					$$=mk_elem($2, $1, 0, NET_ST, 
... ...
@@ -76,11 +76,7 @@ struct cfg_group_core default_core_cfg = {
76 76
 	0, /* blst_sctp_imask */
77 77
 #endif
78 78
 	/* resolver */
79
-#ifdef USE_IPV6
80 79
 	1,  /*!< dns_try_ipv6 -- on by default */
81
-#else
82
-	0,  /*!< dns_try_ipv6 -- off, if no ipv6 support */
83
-#endif
84 80
 	0,  /*!< dns_try_naptr -- off by default */
85 81
 	30,  /*!< udp transport preference (for naptr) */
86 82
 	20,  /*!< tcp transport preference (for naptr) */
... ...
@@ -1891,10 +1891,8 @@ inline static struct dns_hash_entry* dns_cache_do_request(str* name, int type)
1891 1891
 #endif /* USE_DNS_CACHE_STATS */
1892 1892
 
1893 1893
 	if (type==T_A){
1894
-#ifdef USE_IPV6
1895 1894
 		if (str2ip6(name)!=0)
1896 1895
 			goto end;
1897
-#endif /* USE_IPV6 */
1898 1896
 		if ((ip=str2ip(name))!=0){
1899 1897
 				e=dns_cache_mk_ip_entry(name, ip);
1900 1898
 				if (likely(e))
... ...
@@ -1902,7 +1900,6 @@ inline static struct dns_hash_entry* dns_cache_do_request(str* name, int type)
1902 1902
 				goto end; /* we do not cache obvious stuff */
1903 1903
 		}
1904 1904
 	}
1905
-#ifdef USE_IPV6
1906 1905
 	else if (type==T_AAAA){
1907 1906
 		if (str2ip(name)!=0)
1908 1907
 			goto end;
... ...
@@ -1913,7 +1910,6 @@ inline static struct dns_hash_entry* dns_cache_do_request(str* name, int type)
1913 1913
 				goto end;/* we do not cache obvious stuff */
1914 1914
 		}
1915 1915
 	}
1916
-#endif /* USE_IPV6 */
1917 1916
 #ifdef DNS_WATCHDOG_SUPPORT
1918 1917
 	if (atomic_get(dns_servers_up)==0)
1919 1918
 		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)
2412 2412
 			len=4;
2413 2413
 			break;
2414 2414
 		case T_AAAA:
2415
-#ifdef USE_IPV6
2416 2415
 			af=AF_INET6;
2417 2416
 			len=16;
2418 2417
 			break;
2419
-#else /* USE_IPV6 */
2420
-			LOG(L_ERR, "ERROR: dns_entry2he: IPv6 dns cache entry, but "
2421
-						"IPv6 support disabled at compile time"
2422
-						" (recompile with -DUSE_IPV6)\n");
2423
-			return 0;
2424
-#endif /* USE_IPV6 */
2425 2418
 		default:
2426 2419
 			LOG(L_CRIT, "BUG: dns_entry2he: wrong entry type %d for %.*s\n",
2427 2420
 					e->type, e->name_len, e->name);
... ...
@@ -2472,10 +2461,8 @@ inline static struct hostent* dns_a_get_he(str* name)
2472 2472
 	struct hostent* he;
2473 2473
 
2474 2474
 	e=0;
2475
-#ifdef	USE_IPV6
2476 2475
 	if (str2ip6(name)!=0)
2477 2476
 		return 0;
2478
-#endif
2479 2477
 	if ((ip=str2ip(name))!=0){
2480 2478
 		return ip_addr2he(name, ip);
2481 2479
 	}
... ...
@@ -2488,7 +2475,6 @@ inline static struct hostent* dns_a_get_he(str* name)
2488 2488
 }
2489 2489
 
2490 2490
 
2491
-#ifdef USE_IPV6
2492 2491
 /* gethostbyname compatibility: performs an aaaa_lookup and returns a pointer
2493 2492
  * to a statical internal hostent structure
2494 2493
  * 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)
2512 2512
 	dns_hash_put(e);
2513 2513
 	return he;
2514 2514
 }
2515
-#endif
2516 2515
 
2517 2516
 
2518 2517
 
... ...
@@ -2527,16 +2512,10 @@ inline static int dns_rr2ip(int type, struct dns_rr* rr, struct ip_addr* ip)
2527 2527
 			return 0;
2528 2528
 			break;
2529 2529
 		case T_AAAA:
2530
-#ifdef USE_IPV6
2531 2530
 			ip->af=AF_INET6;
2532 2531
 			ip->len=16;
2533 2532
 			memcpy(ip->u.addr, ((struct aaaa_rdata*)rr->rdata)->ip6, 16);
2534 2533
 			return 0;
2535
-#else /* USE_IPV6 */
2536
-			LOG(L_ERR, "ERROR: dns_rr2ip: IPv6 dns rr, but IPv6 support"
2537
-					   "disabled at compile time (recompile with "
2538
-					   "-DUSE_IPV6)\n" );
2539
-#endif /*USE_IPV6 */
2540 2534
 			break;
2541 2535
 	}
2542 2536
 	return -1;
... ...
@@ -2554,7 +2533,6 @@ inline static int dns_rr2ip(int type, struct dns_rr* rr, struct ip_addr* ip)
2554 2554
  */
2555 2555
 struct hostent* dns_get_he(str* name, int flags)
2556 2556
 {
2557
-#ifdef USE_IPV6
2558 2557
 	struct hostent* he;
2559 2558
 
2560 2559
 	if ((flags&(DNS_IPV6_FIRST|DNS_IPV6_ONLY))){
... ...
@@ -2570,9 +2548,6 @@ struct hostent* dns_get_he(str* name, int flags)
2570 2570
 		he=dns_aaaa_get_he(name);
2571 2571
 	}
2572 2572
 	return he;
2573
-#else /* USE_IPV6 */
2574
-	return dns_a_get_he(name);
2575
-#endif /* USE_IPV6 */
2576 2573
 }
2577 2574
 
2578 2575
 
... ...
@@ -2705,9 +2680,7 @@ struct hostent* dns_srv_sip_resolvehost(str* name, unsigned short* port,
2705 2705
 		}else{
2706 2706
 			/* check if it's an ip address */
2707 2707
 			if ( ((ip=str2ip(name))!=0)
2708
-#ifdef	USE_IPV6
2709 2708
 				  || ((ip=str2ip6(name))!=0)
2710
-#endif
2711 2709
 				){
2712 2710
 				/* we are lucky, this is an ip address */
2713 2711
 				return ip_addr2he(name,ip);
... ...
@@ -2869,17 +2842,13 @@ struct hostent* dns_naptr_sip_resolvehost(str* name, unsigned short* port,
2869 2869
 		*proto=PROTO_UDP; /* just in case we don't find another */
2870 2870
 		/* check if it's an ip address */
2871 2871
 		if ( ((tmp_ip=str2ip(name))!=0)
2872
-#ifdef	USE_IPV6
2873 2872
 			  || ((tmp_ip=str2ip6(name))!=0)
2874
-#endif
2875 2873
 			){
2876 2874
 			/* we are lucky, this is an ip address */
2877
-#ifdef	USE_IPV6
2878 2875
 			if (((dns_flags&DNS_IPV4_ONLY) && (tmp_ip->af==AF_INET6))||
2879 2876
 				((dns_flags&DNS_IPV6_ONLY) && (tmp_ip->af==AF_INET))){
2880 2877
 				return 0;
2881 2878
 			}
2882
-#endif
2883 2879
 			*port=SIP_PORT;
2884 2880
 			return ip_addr2he(name, tmp_ip);
2885 2881
 		}
... ...
@@ -2976,10 +2945,8 @@ inline static int dns_a_resolve( struct dns_hash_entry** e,
2976 2976
 	ret=-E_DNS_NO_IP;
2977 2977
 	if (*e==0){ /* do lookup */
2978 2978
 		/* if ip don't set *e */
2979
-#ifdef	USE_IPV6
2980 2979
 		if (str2ip6(name)!=0)
2981 2980
 			goto error;
2982
-#endif
2983 2981
 		if ((tmp=str2ip(name))!=0){
2984 2982
 			*ip=*tmp;
2985 2983
 			*rr_no=0;
... ...
@@ -3009,7 +2976,6 @@ error:
3009 3009
 }
3010 3010
 
3011 3011
 
3012
-#ifdef USE_IPV6
3013 3012
 /* lookup, fills the dns_entry pointer and the ip addr.
3014 3013
  *  (with the first good ip). if *e ==0 does the a lookup, and changes it
3015 3014
  *   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,
3056 3056
 error:
3057 3057
 	return ret;
3058 3058
 }
3059
-#endif /* USE_IPV6 */
3060 3059
 
3061 3060
 
3062 3061
 
... ...
@@ -3081,7 +3046,6 @@ inline static int dns_ip_resolve(	struct dns_hash_entry** e,
3081 3081
 
3082 3082
 	ret=-E_DNS_NO_IP;
3083 3083
 	if (*e==0){ /* first call */
3084
-#ifdef USE_IPV6
3085 3084
 		if ((flags&(DNS_IPV6_FIRST|DNS_IPV6_ONLY))){
3086 3085
 			ret=dns_aaaa_resolve(e, rr_no, name, ip);
3087 3086
 			if (ret>=0) return ret;
... ...
@@ -3094,9 +3058,6 @@ inline static int dns_ip_resolve(	struct dns_hash_entry** e,
3094 3094
 		}else if (!(flags&(DNS_IPV6_ONLY|DNS_IPV4_ONLY))){
3095 3095
 			ret=dns_aaaa_resolve(e, rr_no, name, ip);
3096 3096
 		}
3097
-#else /* USE_IPV6 */
3098
-		ret=dns_a_resolve(e, rr_no, name, ip);
3099
-#endif /* USE_IPV6 */
3100 3097
 	}else if ((*e)->type==T_A){
3101 3098
 		/* continue A resolving */
3102 3099
 		/* 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,
3104 3104
 		host.s=(*e)->name;
3105 3105
 		host.len=(*e)->name_len;
3106 3106
 		ret=dns_a_resolve(e, rr_no, &host, ip);
3107
-#ifdef USE_IPV6
3108 3107
 		if (ret>=0) return ret;
3109 3108
 		if (!(flags&(DNS_IPV6_ONLY|DNS_IPV6_FIRST|DNS_IPV4_ONLY))){
3110 3109
 			/* not found, try with AAAA */
... ...
@@ -3115,13 +3075,11 @@ inline static int dns_ip_resolve(	struct dns_hash_entry** e,
3115 3115
 			/* delay original record release until we're finished with host*/
3116 3116
 			dns_hash_put(orig);
3117 3117
 		}
3118
-#endif /* USE_IPV6 */
3119 3118
 	}else if ((*e)->type==T_AAAA){
3120 3119
 		/* retrieve host name from the hash entry  (ignore name which might
3121 3120
 		  be null when continuing a srv lookup) */
3122 3121
 		host.s=(*e)->name;
3123 3122
 		host.len=(*e)->name_len;
3124
-#ifdef USE_IPV6
3125 3123
 		/* continue AAAA resolving */
3126 3124
 		ret=dns_aaaa_resolve(e, rr_no, &host, ip);
3127 3125
 		if (ret>=0) return ret;
... ...
@@ -3134,15 +3092,6 @@ inline static int dns_ip_resolve(	struct dns_hash_entry** e,
3134 3134
 			/* delay original record release until we're finished with host*/
3135 3135
 			dns_hash_put(orig);
3136 3136
 		}
3137
-#else /* USE_IPV6 */
3138
-		/* ipv6 disabled, try with A */
3139
-		orig=*e;
3140
-		*e=0;
3141
-		*rr_no=0;
3142
-		ret=dns_a_resolve(e, rr_no, &host, ip);
3143
-		/* delay original record release until we're finished with host*/
3144
-		dns_hash_put(orig);
3145
-#endif /* USE_IPV6 */
3146 3137
 	}else{
3147 3138
 		LOG(L_CRIT, "BUG: dns_ip_resolve: invalid record type %d\n",
3148 3139
 					(*e)->type);
... ...
@@ -3324,17 +3273,13 @@ inline static int dns_srv_sip_resolve(struct dns_srv_handle* h,  str* name,
3324 3324
 				}else{
3325 3325
 					/* check if it's an ip address */
3326 3326
 					if ( ((tmp_ip=str2ip(name))!=0)
3327
-#ifdef	USE_IPV6
3328 3327
 						  || ((tmp_ip=str2ip6(name))!=0)
3329
-#endif
3330 3328
 						){
3331 3329
 						/* we are lucky, this is an ip address */
3332
-#ifdef	USE_IPV6
3333 3330
 						if (((flags&DNS_IPV4_ONLY) && (tmp_ip->af==AF_INET6))||
3334 3331
 							((flags&DNS_IPV6_ONLY) && (tmp_ip->af==AF_INET))){
3335 3332
 							return -E_DNS_AF_MISMATCH;
3336 3333
 						}
3337
-#endif
3338 3334
 						*ip=*tmp_ip;
3339 3335
 						*port=h->port;
3340 3336
 						/* proto already set */
... ...
@@ -3467,17 +3412,13 @@ inline static int dns_naptr_sip_resolve(struct dns_srv_handle* h,  str* name,
3467 3467
 
3468 3468
 		/* check if it's an ip address */
3469 3469
 		if ( ((tmp_ip=str2ip(name))!=0)
3470
-#ifdef	USE_IPV6
3471 3470
 			  || ((tmp_ip=str2ip6(name))!=0)
3472
-#endif
3473 3471
 			){
3474 3472
 			/* we are lucky, this is an ip address */
3475
-#ifdef	USE_IPV6
3476 3473
 			if (((flags&DNS_IPV4_ONLY) && (tmp_ip->af==AF_INET6))||
3477 3474
 				((flags&DNS_IPV6_ONLY) && (tmp_ip->af==AF_INET))){
3478 3475
 				return -E_DNS_AF_MISMATCH;
3479 3476
 			}
3480
-#endif
3481 3477
 			*ip=*tmp_ip;
3482 3478
 			h->port=SIP_PORT;
3483 3479
 			h->proto=*proto;
... ...
@@ -3556,7 +3497,6 @@ inline static int dns_a_get_ip(str* name, struct ip_addr* ip)
3556 3556
 }
3557 3557
 
3558 3558
 
3559
-#ifdef USE_IPV6
3560 3559
 inline static int dns_aaaa_get_ip(str* name, struct ip_addr* ip)
3561 3560
 {
3562 3561
 	struct dns_hash_entry* e;
... ...
@@ -3569,7 +3509,6 @@ inline static int dns_aaaa_get_ip(str* name, struct ip_addr* ip)
3569 3569
 	if (e) dns_hash_put(e);
3570 3570
 	return ret;
3571 3571
 }
3572
-#endif /* USE_IPV6 */
3573 3572
 
3574 3573
 
3575 3574
 
... ...
@@ -4280,7 +4219,6 @@ int dns_cache_add_record(unsigned short type,
4280 4280
 			}
4281 4281
 			break;
4282 4282
 		case T_AAAA:
4283
-#ifdef USE_IPV6
4284 4283
 			ip_addr = str2ip6(value);
4285 4284
 			if (!ip_addr) {
4286 4285
 				LOG(L_ERR, "ERROR: Malformed ip address: %.*s\n",
... ...
@@ -4288,10 +4226,6 @@ int dns_cache_add_record(unsigned short type,
4288 4288
 				return -1;
4289 4289
 			}
4290 4290
 			break;
4291
-#else /* USE_IPV6 */
4292
-			LOG(L_ERR, "ERROR: IPv6 support is disabled\n");
4293
-			return -1;
4294
-#endif /* USE_IPV6 */
4295 4291
 		case T_SRV:
4296 4292
 			rr_name = *value;
4297 4293
 			break;
... ...
@@ -4588,7 +4522,6 @@ int dns_cache_delete_single_record(unsigned short type,
4588 4588
 			}
4589 4589
 			break;
4590 4590
 		case T_AAAA:
4591
-#ifdef USE_IPV6
4592 4591
 			ip_addr = str2ip6(value);
4593 4592
 			if (!ip_addr) {
4594 4593
 				LOG(L_ERR, "ERROR: Malformed ip address: %.*s\n",
... ...
@@ -4596,10 +4529,6 @@ int dns_cache_delete_single_record(unsigned short type,
4596 4596
 				return -1;
4597 4597
 			}
4598 4598
 			break;
4599
-#else /* USE_IPV6 */
4600
-			LOG(L_ERR, "ERROR: IPv6 support is disabled\n");
4601
-			return -1;
4602
-#endif /* USE_IPV6 */
4603 4599
 		case T_SRV:
4604 4600
 			rr_name = *value;
4605 4601
 			break;
... ...
@@ -63,7 +63,7 @@ gcc=gcc
63 63
 
64 64
 # defines used by gcc
65 65
 c_defs=-D__CPU_i386 -D__OS_linux -DSER_VER=2099099 -DPKG_MALLOC -DSHM_MEM  \
66
-		-DSHM_MMAP -DDNS_IP_HACK -DUSE_IPV6 -DUSE_MCAST -DUSE_TCP \
66
+		-DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP \
67 67
 		-DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR \
68 68
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
69 69
 		-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
... ...
@@ -57,7 +57,7 @@ gcc=gcc
57 57
 
58 58
 # defines used by gcc
59 59
 c_defs=-D__CPU_i386 -D__OS_linux -DSER_VER=2099099 -DPKG_MALLOC -DSHM_MEM  \
60
-		-DSHM_MMAP -DDNS_IP_HACK -DUSE_IPV6 -DUSE_MCAST -DUSE_TCP \
60
+		-DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP \
61 61
 		-DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR \
62 62
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
63 63
 		-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
... ...
@@ -100,7 +100,7 @@ gcc=gcc
100 100
 # -D__CPU_i386 -DARCH="i386"
101 101
 c_defsX= -D__CPU_x86_64 -D__OS_linux -DSER_VER=3003000 -DPKG_MALLOC -DSHM_MEM  \
102 102
 		-DVERSION='\"3.3.0-dev2\"' -DARCH='\"x86_64\"' -DOS=linux_ -DOS_QUOTED='\"linux\"' \
103
-		-DSHM_MMAP -DDNS_IP_HACK -DUSE_IPV6 -DUSE_MCAST -DUSE_TCP \
103
+		-DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP \
104 104
 		-DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR \
105 105
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
106 106
 		-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
... ...
@@ -67,7 +67,7 @@ gcc=gcc
67 67
 
68 68
 # defines used by gcc
69 69
 c_defs=-D__CPU_i386 -D__OS_linux -DSER_VER=2099099 -DPKG_MALLOC -DSHM_MEM  \
70
-		-DSHM_MMAP -DDNS_IP_HACK -DUSE_IPV6 -DUSE_MCAST -DUSE_TCP \
70
+		-DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP \
71 71
 		-DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR \
72 72
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
73 73
 		-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
... ...
@@ -338,12 +338,10 @@ static ticks_t blst_timer(ticks_t ticks, struct timer_ln* tl, void* data);
338 338
 inline static void dst_blst_entry2ip(struct ip_addr* ip,
339 339
 										struct dst_blst_entry* e)
340 340
 {
341
-#ifdef USE_IPV6
342 341
 	if (e->flags & BLST_IS_IPV6){
343 342
 		ip->af=AF_INET6;
344 343
 		ip->len=16;
345 344
 	}else
346
-#endif /* USE_IPV6 */
347 345
 	{
348 346
 		ip->af=AF_INET;
349 347
 		ip->len=4;
... ...
@@ -566,12 +564,7 @@ inline static struct dst_blst_entry* _dst_blacklist_lst_find(
566 566
 	unsigned char type;
567 567
 
568 568
 	head=&dst_blst_hash[hash].first;
569
-#ifdef USE_IPV6
570 569
 	type=(ip->af==AF_INET6)*BLST_IS_IPV6;
571
-#else  /* USE_IPV6 */
572
-	if (unlikely(ip->af!=AF_INET)) return 0;
573
-	type=0;
574
-#endif /* USE_IPV6 */
575 570
 	for (crt=head, tmp=&(*head)->next; *crt; crt=tmp, tmp=&(*crt)->next){
576 571
 		e=*crt;
577 572
 		prefetch_loc_r((*crt)->next, 1);
... ...
@@ -612,12 +605,7 @@ inline static int _dst_blacklist_del(
612 612
 	unsigned char type;
613 613
 	
614 614
 	head=&dst_blst_hash[hash].first;
615
-#ifdef USE_IPV6
616 615
 	type=(ip->af==AF_INET6)*BLST_IS_IPV6;
617
-#else  /* USE_IPV6 */
618
-	if (unlikely(ip->af!=AF_INET)) return 0;
619
-	type=0;
620
-#endif /* USE_IPV6 */
621 616
 	for (crt=head, tmp=&(*head)->next; *crt; crt=tmp, tmp=&(*crt)->next){
622 617
 		e=*crt;
623 618
 		prefetch_loc_r((*crt)->next, 1);
... ...
@@ -1159,24 +1147,14 @@ void dst_blst_add(rpc_t* rpc, void* ctx)
1159 1159
 	}
1160 1160
 
1161 1161
 	if (err_flags & BLST_IS_IPV6) {
1162
-#ifdef USE_IPV6
1163 1162
 		/* IPv6 address is specified */
1164 1163
 		ip_addr = str2ip6(&ip);
1165
-#else  /* USE_IPV6 */
1166
-		rpc->fault(ctx, 400, "IPv6 support disabled");
1167
-		return;
1168
-#endif /* USE_IPV6 */
1169 1164
 	} else {
1170 1165
 		/* try IPv4 first, than IPv6 */
1171 1166
 		ip_addr = str2ip(&ip);
1172 1167
 		if (!ip_addr) {
1173
-#ifdef USE_IPV6
1174 1168
 			ip_addr = str2ip6(&ip);
1175 1169
 			err_flags |= BLST_IS_IPV6;
1176
-#else  /* USE_IPV6 */
1177
-			rpc->fault(ctx, 400, "Malformed or IPv6 ip address");
1178
-			return;
1179
-#endif /* USE_IPV6 */
1180 1170
 		}
1181 1171
 	}
1182 1172
 	if (!ip_addr) {
... ...
@@ -120,9 +120,7 @@
120 120
 
121 121
 static int mhomed_sock_cache_disabled = 0;
122 122
 static int sock_inet = -1;
123
-#ifdef USE_IPV6
124 123
 static int sock_inet6 = -1;
125
-#endif /* USE_IPV6 */
126 124
 
127 125
 static void apply_force_send_socket(struct dest_info* dst, struct sip_msg* msg);
128 126
 
... ...
@@ -155,7 +153,6 @@ retry:
155 155
 		temp_sock = &sock_inet;
156 156
 		break;
157 157
 	}
158
-#ifdef USE_IPV6
159 158
 	case AF_INET6 : {
160 159
 		if(unlikely(sock_inet6 < 0)){
161 160
 			sock_inet6 = socket(AF_INET6, SOCK_DGRAM, 0);
... ...
@@ -167,7 +164,6 @@ retry:
167 167
 		temp_sock = &sock_inet6;
168 168
 		break;
169 169
 	}
170
-#endif /* USE_IPV6 */
171 170
 	default: {
172 171
 		LM_ERR("Unknown protocol family \n");
173 172
 		return 0;
... ...
@@ -189,12 +185,10 @@ retry:
189 189
 				close(sock_inet);
190 190
 				sock_inet=-1;
191 191
 			}
192
-#ifdef USE_IPV6
193 192
 			if (sock_inet6>=0){
194 193
 				close(sock_inet6);
195 194
 				sock_inet6=-1;
196 195
 			}
197
-#endif /* USE_IPV6 */
198 196
 			goto retry;
199 197
 		}
200 198
 		LOG(L_ERR, "ERROR: get_out_socket: connect failed: %s\n",
... ...
@@ -332,10 +326,8 @@ not_forced:
332 332
 				/* FIXME */
333 333
 				case AF_INET:	send_sock=sendipv4_tcp;
334 334
 								break;
335
-#ifdef USE_IPV6
336 335
 				case AF_INET6:	send_sock=sendipv6_tcp;
337 336
 								break;
338
-#endif
339 337
 				default:	LOG(L_ERR, "get_send_socket: BUG: don't know how"
340 338
 									" to forward to af %d\n", to->s.sa_family);
341 339
 			}
... ...
@@ -348,10 +340,8 @@ not_forced:
348 348
 				/* FIXME */
349 349
 				case AF_INET:	send_sock=sendipv4_tls;
350 350
 								break;
351
-#ifdef USE_IPV6
352 351
 				case AF_INET6:	send_sock=sendipv6_tls;
353 352
 								break;
354
-#endif
355 353
 				default:	LOG(L_ERR, "get_send_socket: BUG: don't know how"
356 354
 									" to forward to af %d\n", to->s.sa_family);
357 355
 			}
... ...
@@ -365,10 +355,8 @@ not_forced:
365 365
 				switch(to->s.sa_family){
366 366
 					case AF_INET:	send_sock=sendipv4_sctp;
367 367
 									break;
368
-#ifdef USE_IPV6
369 368
 					case AF_INET6:	send_sock=sendipv6_sctp;
370 369
 									break;
371
-#endif
372 370
 					default:	LOG(L_ERR, "get_send_socket: BUG: don't know"
373 371
 										" how to forward to af %d\n",
374 372
 										to->s.sa_family);
... ...
@@ -383,10 +371,8 @@ not_forced:
383 383
 				switch(to->s.sa_family){
384 384
 					case AF_INET:	send_sock=sendipv4;
385 385
 									break;
386
-#ifdef USE_IPV6
387 386
 					case AF_INET6:	send_sock=sendipv6;
388 387
 									break;
389
-#endif
390 388
 					default:	LOG(L_ERR, "get_send_socket: BUG: don't know"
391 389
 										" how to forward to af %d\n",
392 390
 										to->s.sa_family);
... ...
@@ -136,9 +136,7 @@ extern int mcast_loopback;
136 136
 extern int mcast_ttl;
137 137
 #endif /* USE_MCAST */
138 138
 
139
-#ifdef USE_IPV6
140 139
 extern int auto_bind_ipv6;
141
-#endif
142 140
 
143 141
 extern int tos;
144 142
 extern int pmtu_discovery;
... ...
@@ -184,10 +184,8 @@ int mk_net_str(struct net* dst, str* s)
184 184
 	
185 185
 	/* test for ip only */
186 186
 	t = str2ip(s);
187
-#ifdef USE_IPV6
188 187
 	if (unlikely(t == 0))
189 188
 		t = str2ip6(s);
190
-#endif /* USE_IPV6 */
191 189
 	if (likely(t))
192 190
 		return mk_net_bitlen(dst, t, t->len*8);
193 191
 	/* not a simple ip, maybe an ip/netmask pair */
... ...
@@ -212,7 +210,6 @@ int mk_net_str(struct net* dst, str* s)
212 212
 			/* error */
213 213
 			return -1;
214 214
 		}
215
-#ifdef USE_IPV6
216 215
 		else {
217 216
 			t = str2ip6(&addr);
218 217
 			if (likely(t)) {
... ...
@@ -227,7 +224,6 @@ int mk_net_str(struct net* dst, str* s)
227 227
 				return -1;
228 228
 			}
229 229
 		}
230
-#endif /* USE_IPV6 */
231 230
 	}
232 231
 	return -1;
233 232
 }
... ...
@@ -246,7 +242,6 @@ void print_ip(char* p, struct ip_addr* ip, char *s)
246 246
 								(s)?s:""
247 247
 								);
248 248
 			break;
249
-#ifdef USE_IPV6
250 249
 		case AF_INET6:
251 250
 			DBG("%s%x:%x:%x:%x:%x:%x:%x:%x%s", (p)?p:"",
252 251
 											htons(ip->u.addr16[0]),
... ...
@@ -260,7 +255,6 @@ void print_ip(char* p, struct ip_addr* ip, char *s)
260 260
 											(s)?s:""
261 261
 				);
262 262
 			break;
263
-#endif /* USE_IPV6 */
264 263
 		default:
265 264
 			DBG("print_ip: warning unknown address family %d\n", ip->af);
266 265
 	}
... ...
@@ -277,7 +271,6 @@ void stdout_print_ip(struct ip_addr* ip)
277 277
 								ip->u.addr[2],
278 278
 								ip->u.addr[3]);
279 279
 			break;
280
-#ifdef USE_IPV6
281 280
 		case AF_INET6:
282 281
 			printf("%x:%x:%x:%x:%x:%x:%x:%x",	htons(ip->u.addr16[0]),
283 282
 											htons(ip->u.addr16[1]),
... ...
@@ -289,7 +282,6 @@ void stdout_print_ip(struct ip_addr* ip)
289 289
 											htons(ip->u.addr16[7])
290 290
 				);
291 291
 			break;
292
-#endif /* USE_IPV6 */
293 292
 		default:
294 293
 			DBG("print_ip: warning unknown address family %d\n", ip->af);
295 294
 	}
... ...
@@ -319,10 +311,8 @@ int is_mcast(struct ip_addr* ip)
319 319
 
320 320
 	if (ip->af==AF_INET){
321 321
 		return IN_MULTICAST(htonl(ip->u.addr32[0]));
322
-#ifdef USE_IPV6
323 322
 	} else if (ip->af==AF_INET6){
324 323
 		return IN6_IS_ADDR_MULTICAST((struct in6_addr*)ip->u.addr32);
325
-#endif /* USE_IPV6 */
326 324
 	} else {
327 325
 		LOG(L_ERR, "ERROR: is_mcast: Unsupported protocol family\n");
328 326
 		return -1;
... ...
@@ -82,9 +82,7 @@ struct net{
82 82
 union sockaddr_union{
83 83
 		struct sockaddr     s;
84 84
 		struct sockaddr_in  sin;
85
-	#ifdef USE_IPV6
86 85
 		struct sockaddr_in6 sin6;
87
-	#endif
88 86
 };
89 87
 
90 88
 
... ...
@@ -217,13 +215,9 @@ struct socket_id{
217 217
 #ifdef HAVE_SOCKADDR_SA_LEN
218 218
 #define sockaddru_len(su)	((su).s.sa_len)
219 219
 #else
220
-#ifdef USE_IPV6
221 220
 #define sockaddru_len(su)	\
222 221
 			(((su).s.sa_family==AF_INET6)?sizeof(struct sockaddr_in6):\
223 222
 					sizeof(struct sockaddr_in))
224
-#else
225
-#define sockaddru_len(su)	sizeof(struct sockaddr_in)
226
-#endif /*USE_IPV6*/
227 223
 #endif /* HAVE_SOCKADDR_SA_LEN*/
228 224
 	
229 225
 /* inits an ip_addr with the addr. info from a hostent structure
... ...
@@ -243,11 +237,7 @@ struct socket_id{
243 243
 /* gets the protocol family corresponding to a specific address family
244 244
  * ( PF_INET - AF_INET, PF_INET6 - AF_INET6, af for others)
245 245
  */
246
-#ifdef USE_IPV6
247 246
 #define AF2PF(af)   (((af)==AF_INET)?PF_INET:((af)==AF_INET6)?PF_INET6:(af))
248
-#else
249
-#define AF2PF(af)   (((af)==AF_INET)?PF_INET:(af))
250
-#endif
251 247
 
252 248
 
253 249
 
... ...
@@ -294,10 +284,8 @@ inline static int ip_addr_loopback(struct ip_addr* ip)
294 294
 {
295 295
 	if (ip->af==AF_INET)
296 296
 		return ip->u.addr32[0]==htonl(INADDR_LOOPBACK);
297
-#ifdef USE_IPV6
298 297
 	else if (ip->af==AF_INET6)
299 298
 		return IN6_IS_ADDR_LOOPBACK((struct in6_addr*)ip->u.addr32);
300
-#endif /* USE_IPV6 */
301 299
 	return 0;
302 300
 }
303 301
 
... ...
@@ -311,7 +299,6 @@ inline static void ip_addr_mk_any(int af, struct ip_addr* ip)
311 311
 		ip->len=4;
312 312
 		ip->u.addr32[0]=0;
313 313
 	}
314
-#ifdef USE_IPV6
315 314
 	else{
316 315
 		ip->len=16;
317 316
 #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)
325 325
 		ip->u.addr32[3]=0;
326 326
 #endif /* ULONG_MAX */
327 327
 	}
328
-#endif
329 328
 }
330 329
 
331 330
 /* 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)
359 359
 			ip->len=4;
360 360
 			memcpy(ip->u.addr, &((struct sockaddr_in*)sa)->sin_addr, 4);
361 361
 			break;
362
-#ifdef USE_IPV6
363 362
 	case AF_INET6:
364 363
 			ip->af=AF_INET6;
365 364
 			ip->len=16;
366 365
 			memcpy(ip->u.addr, &((struct sockaddr_in6*)sa)->sin6_addr, 16);
367 366
 			break;
368
-#endif
369 367
 	default:
370 368
 			LOG(L_CRIT, "sockaddr2ip_addr: BUG: unknown address family %d\n",
371 369
 					sa->sa_family);
... ...
@@ -390,11 +374,9 @@ static inline int su_cmp(const union sockaddr_union* s1,
390 390
 		case AF_INET:
391 391
 			return (s1->sin.sin_port==s2->sin.sin_port)&&
392 392
 					(memcmp(&s1->sin.sin_addr, &s2->sin.sin_addr, 4)==0);
393
-#ifdef USE_IPV6
394 393
 		case AF_INET6:
395 394
 			return (s1->sin6.sin6_port==s2->sin6.sin6_port)&&
396 395
 					(memcmp(&s1->sin6.sin6_addr, &s2->sin6.sin6_addr, 16)==0);
397
-#endif
398 396
 		default:
399 397
 			LOG(L_CRIT,"su_cmp: BUG: unknown address family %d\n",
400 398
 						s1->s.sa_family);
... ...
@@ -410,10 +392,8 @@ static inline unsigned short su_getport(const union sockaddr_union* su)
410 410
 	switch(su->s.sa_family){
411 411
 		case AF_INET:
412 412
 			return ntohs(su->sin.sin_port);
413
-#ifdef USE_IPV6
414 413
 		case AF_INET6:
415 414
 			return ntohs(su->sin6.sin6_port);
416
-#endif
417 415
 		default:
418 416
 			LOG(L_CRIT,"su_get_port: BUG: unknown address family %d\n",
419 417
 						su->s.sa_family);
... ...
@@ -430,11 +410,9 @@ static inline void su_setport(union sockaddr_union* su, unsigned short port)
430 430
 		case AF_INET:
431 431
 			su->sin.sin_port=htons(port);
432 432
 			break;
433
-#ifdef USE_IPV6
434 433
 		case AF_INET6:
435 434
 			 su->sin6.sin6_port=htons(port);
436 435
 			 break;
437
-#endif
438 436
 		default:
439 437
 			LOG(L_CRIT,"su_set_port: BUG: unknown address family %d\n",
440 438
 						su->s.sa_family);
... ...
@@ -452,13 +430,11 @@ static inline void su2ip_addr(struct ip_addr* ip, union sockaddr_union* su)
452 452
 					ip->len=4;
453 453
 					memcpy(ip->u.addr, &su->sin.sin_addr, 4);
454 454
 					break;
455
-#ifdef USE_IPV6
456 455
 	case AF_INET6:
457 456
 					ip->af=AF_INET6;
458 457
 					ip->len=16;
459 458
 					memcpy(ip->u.addr, &su->sin6.sin6_addr, 16);
460 459
 					break;
461
-#endif
462 460
 	default:
463 461
 					LOG(L_CRIT,"su2ip_addr: BUG: unknown address family %d\n",
464 462
 							su->s.sa_family);
... ...
@@ -479,7 +455,6 @@ static inline int init_su( union sockaddr_union* su,
479 479
 	memset(su, 0, sizeof(union sockaddr_union));/*needed on freebsd*/
480 480
 	su->s.sa_family=ip->af;
481 481
 	switch(ip->af){
482
-#ifdef USE_IPV6
483 482
 	case	AF_INET6:
484 483
 		memcpy(&su->sin6.sin6_addr, ip->u.addr, ip->len); 
485 484
 		#ifdef HAVE_SOCKADDR_SA_LEN
... ...
@@ -487,7 +462,6 @@ static inline int init_su( union sockaddr_union* su,
487 487
 		#endif
488 488
 		su->sin6.sin6_port=htons(port);
489 489
 		break;
490
-#endif
491 490
 	case AF_INET:
492 491
 		memcpy(&su->sin.sin_addr, ip->u.addr, ip->len);
493 492
 		#ifdef HAVE_SOCKADDR_SA_LEN
... ...
@@ -516,7 +490,6 @@ static inline int hostent2su( union sockaddr_union* su,
516 516
 	memset(su, 0, sizeof(union sockaddr_union)); /*needed on freebsd*/
517 517
 	su->s.sa_family=he->h_addrtype;
518 518
 	switch(he->h_addrtype){
519
-#ifdef USE_IPV6
520 519
 	case	AF_INET6:
521 520
 		memcpy(&su->sin6.sin6_addr, he->h_addr_list[idx], he->h_length);
522 521
 		#ifdef HAVE_SOCKADDR_SA_LEN
... ...
@@ -524,7 +497,6 @@ static inline int hostent2su( union sockaddr_union* su,
524 524
 		#endif
525 525
 		su->sin6.sin6_port=htons(port);
526 526
 		break;
527
-#endif
528 527
 	case AF_INET:
529 528
 		memcpy(&su->sin.sin_addr, he->h_addr_list[idx], he->h_length);
530 529
 		#ifdef HAVE_SOCKADDR_SA_LEN
... ...
@@ -546,7 +518,6 @@ static inline int hostent2su( union sockaddr_union* su,
546 546
 #define IP6_MAX_STR_SIZE 39 /*1234:5678:9012:3456:7890:1234:5678:9012*/
547 547
 #define IP4_MAX_STR_SIZE 15 /*123.456.789.012*/
548 548
 
549
-#ifdef USE_IPV6
550 549
 /* converts a raw ipv6 addr (16 bytes) to ascii */
551 550
 static inline int ip6tosbuf(unsigned char* ip6, char* buff, int len)
552 551
 {
... ...
@@ -619,7 +590,6 @@ static inline int ip6tosbuf(unsigned char* ip6, char* buff, int len)
619 619
 	
620 620
 	return offset;
621 621
 }
622
-#endif /* USE_IPV6 */
623 622
 
624 623
 
625 624
 
... ...
@@ -688,11 +658,9 @@ static inline int ip4tosbuf(unsigned char* ip4, char* buff, int len)
688 688
 static inline int ip_addr2sbuf(struct ip_addr* ip, char* buff, int len)
689 689
 {
690 690
 	switch(ip->af){
691
-	#ifdef USE_IPV6
692 691
 		case AF_INET6:
693 692
 			return ip6tosbuf(ip->u.addr, buff, len);
694 693
 			break;
695
-	#endif /* USE_IPV6 */
696 694
 		case AF_INET:
697 695
 			return ip4tosbuf(ip->u.addr, buff, len);
698 696
 			break;
... ...
@@ -736,7 +704,6 @@ static inline char* su2a(union sockaddr_union* su, int su_len)
736 736
 	static char buf[SU2A_MAX_STR_SIZE];
737 737
 	int offs;
738 738
 
739
-#ifdef USE_IPV6
740 739
 	if (unlikely(su->s.sa_family==AF_INET6)){
741 740
 		if (unlikely(su_len<sizeof(su->sin6)))
742 741
 			return "<addr. error>";
... ...
@@ -746,7 +713,6 @@ static inline char* su2a(union sockaddr_union* su, int su_len)
746 746
 		buf[offs]=']';
747 747
 		offs++;
748 748
 	}else
749
-#endif /* USE_IPV6*/
750 749
 	if (unlikely(su_len<sizeof(su->sin)))
751 750
 		return "<addr. error>";
752 751
 	else
... ...
@@ -766,7 +732,6 @@ static inline char* suip2a(union sockaddr_union* su, int su_len)
766 766
 	static char buf[SUIP2A_MAX_STR_SIZE];
767 767
 	int offs;
768 768
 
769
-#ifdef USE_IPV6
770 769
 	if (unlikely(su->s.sa_family==AF_INET6)){
771 770
 		if (unlikely(su_len<sizeof(su->sin6)))
772 771
 			return "<addr. error>";
... ...
@@ -776,7 +741,6 @@ static inline char* suip2a(union sockaddr_union* su, int su_len)
776 776
 		buf[offs]=']';
777 777
 		offs++;
778 778
 	}else
779
-#endif /* USE_IPV6*/
780 779
 	if (unlikely(su_len<sizeof(su->sin)))
781 780
 		return "<addr. error>";
782 781
 	else
... ...
@@ -458,9 +458,7 @@ int mcast_ttl = -1; /* if -1, don't touch it, use the default (usually 1) */
458 458
 int tos = IPTOS_LOWDELAY;
459 459
 int pmtu_discovery = 0;
460 460
 
461
-#ifdef USE_IPV6
462 461
 int auto_bind_ipv6 = 0;
463
-#endif
464 462
 
465 463
 #if 0
466 464
 char* names[MAX_LISTEN];              /* our names */
... ...
@@ -1450,11 +1448,9 @@ int main_loop(void)
1450 1450
 			if ((si->address.af==AF_INET)&&
1451 1451
 					((sendipv4==0)||(sendipv4->flags&(SI_IS_LO|SI_IS_MCAST))))
1452 1452
 				sendipv4=si;
1453
-	#ifdef USE_IPV6
1454 1453
 			if ( ((sendipv6==0)||(sendipv6->flags&(SI_IS_LO|SI_IS_MCAST))) &&
1455 1454
 					(si->address.af==AF_INET6))
1456 1455
 				sendipv6=si;
1457
-	#endif
1458 1456
 			/* children_no per each socket */
1459 1457
 			cfg_register_child((si->workers>0)?si->workers:children_no);
1460 1458
 		}
... ...
@@ -1503,12 +1499,10 @@ int main_loop(void)
1503 1503
 						((sendipv4_sctp==0) ||
1504 1504
 							(sendipv4_sctp->flags&(SI_IS_LO|SI_IS_MCAST))))
1505 1505
 					sendipv4_sctp=si;
1506
-		#ifdef USE_IPV6
1507 1506
 				if( ((sendipv6_sctp==0) || 
1508 1507
 							(sendipv6_sctp->flags&(SI_IS_LO|SI_IS_MCAST))) &&
1509 1508
 						(si->address.af==AF_INET6))
1510 1509
 					sendipv6_sctp=si;
1511
-		#endif
1512 1510
 				/* sctp_children_no per each socket */
1513 1511
 				cfg_register_child((si->workers>0)?si->workers:sctp_children_no);
1514 1512
 			}
... ...
@@ -1524,12 +1518,10 @@ int main_loop(void)
1524 1524
 						((sendipv4_tcp==0) ||
1525 1525
 							(sendipv4_tcp->flags&(SI_IS_LO|SI_IS_MCAST))))
1526 1526
 					sendipv4_tcp=si;
1527
-		#ifdef USE_IPV6
1528 1527
 				if( ((sendipv6_tcp==0) ||
1529 1528
 							(sendipv6_tcp->flags&(SI_IS_LO|SI_IS_MCAST))) &&
1530 1529
 						(si->address.af==AF_INET6))
1531 1530
 					sendipv6_tcp=si;
1532
-		#endif
1533 1531
 			}
1534 1532
 			/* the number of sockets does not matter */
1535 1533
 			cfg_register_child(tcp_children_no + 1 /* tcp main */);
... ...
@@ -1544,12 +1536,10 @@ int main_loop(void)
1544 1544
 						((sendipv4_tls==0) ||
1545 1545
 							(sendipv4_tls->flags&(SI_IS_LO|SI_IS_MCAST))))
1546 1546
 					sendipv4_tls=si;
1547
-		#ifdef USE_IPV6
1548 1547
 				if( ((sendipv6_tls==0) ||
1549 1548
 							(sendipv6_tls->flags&(SI_IS_LO|SI_IS_MCAST))) &&
1550 1549
 						(si->address.af==AF_INET6))
1551 1550
 					sendipv6_tls=si;
1552
-		#endif
1553 1551
 			}
1554 1552
 		}
1555 1553
 #endif /* USE_TLS */
... ...
@@ -1108,9 +1108,7 @@ static int goes_to_gw_1(struct sip_msg* msg, char* _type, char* _f2)
1108 1108
 	}
1109 1109
 
1110 1110
 	if ( ((ip=str2ip(&puri.host))!=0)
1111
-#ifdef USE_IPV6
1112 1111
 	|| ((ip=str2ip6(&puri.host))!=0)
1113
-#endif
1114 1112
 	){
1115 1113
 		pgwa = (*rdata)->pgw_addr_l;
1116 1114
 		while(pgwa) {
... ...
@@ -956,12 +956,10 @@ static int insert_gws(db1_res_t *res, struct gw_info *gws,
956 956
 		/* 123.123.123.123 */
957 957
 		ip_addr = *ip_p;
958 958
 	    }
959
-#ifdef USE_IPV6
960 959
 	    else if ((ip_p = str2ip6(&ip_string))) {
961 960
 		/* fe80::123:4567:89ab:cdef and [fe80::123:4567:89ab:cdef] */
962 961
 		ip_addr = *ip_p;
963 962
 	    }
964
-#endif
965 963
 	    else if (inet_aton(ip_string.s, &in_addr) == 0) {
966 964
 		/* backwards compatibility for integer or hex notations */
967 965
 		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,
1572 1572
 	string = int2str(ip_addr->u.addr32[0], &len);
1573 1573
 	append_str(at, string, len);
1574 1574
     }
1575
-#ifdef USE_IPV6
1576 1575
     else if (ip_addr->af == AF_INET6 && !ip_addr_any(ip_addr)) {
1577 1576
 	append_chr(at, '[');
1578 1577
 	at += ip6tosbuf(ip_addr->u.addr, at, MAX_URI_LEN - (at - value));
1579 1578
 	append_chr(at, ']');
1580 1579
     }
1581
-#endif
1582 1580
     append_chr(at, '|');
1583 1581
     /* hostname */
1584 1582
     append_str(at, hostname, hostname_len);
... ...
@@ -1673,10 +1669,8 @@ inline int decode_avp_value(char *value, unsigned int *gw_index, str *scheme,
1673 1673
     if (s.len > 0) {
1674 1674
 	if ((ip = str2ip(&s)) != NULL)
1675 1675
 	    *addr = *ip;
1676
-#ifdef USE_IPV6
1677 1676
 	else if ((ip = str2ip6(&s)) != NULL)
1678 1677
 	    *addr = *ip;
1679
-#endif
1680 1678
 	else {
1681 1679
 	    str2int(&s, &u);
1682 1680
 	    addr->af = AF_INET;
... ...
@@ -2393,10 +2387,8 @@ static int from_gw_3(struct sip_msg* _m, char* _lcr_id, char* _addr,
2393 2393
     addr_str.len = strlen(_addr);
2394 2394
     if ((ip = str2ip(&addr_str)) != NULL)
2395 2395
 	src_addr = *ip;
2396
-#ifdef USE_IPV6
2397 2396
     else if ((ip = str2ip6(&addr_str)) != NULL)
2398 2397
 	src_addr = *ip;
2399
-#endif
2400 2398
     else {
2401 2399
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
2402 2400
 	return -1;
... ...
@@ -2453,10 +2445,8 @@ static int from_any_gw_2(struct sip_msg* _m, char* _addr, char* _transport)
2453 2453
     addr_str.len = strlen(_addr);
2454 2454
     if ((ip = str2ip(&addr_str)) != NULL)
2455 2455
 	src_addr = *ip;
2456
-#ifdef USE_IPV6
2457 2456
     else if ((ip = str2ip6(&addr_str)) != NULL)
2458 2457
 	src_addr = *ip;
2459
-#endif
2460 2458
     else {
2461 2459
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
2462 2460
 	return -1;
... ...
@@ -2549,10 +2539,8 @@ static int to_gw_1(struct sip_msg* _m, char* _lcr_id, char* _s2)
2549 2549
     }
2550 2550
     if ((ip = str2ip(&(_m->parsed_uri.host))) != NULL)
2551 2551
 	dst_addr = *ip;
2552
-#ifdef USE_IPV6
2553 2552
     else if ((ip = str2ip6(&(_m->parsed_uri.host))) != NULL)
2554 2553
 	dst_addr = *ip;
2555
-#endif
2556 2554
     else {
2557 2555
 	LM_DBG("request is not going to gw "
2558 2556
 	       "(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,
2592 2592
     addr_str.len = strlen(_addr);
2593 2593
     if ((ip = str2ip(&addr_str)) != NULL)
2594 2594
 	dst_addr = *ip;
2595
-#ifdef USE_IPV6
2596 2595
     else if ((ip = str2ip(&addr_str)) != NULL)
2597 2596
 	dst_addr = *ip;
2598
-#endif
2599 2597
     else {
2600 2598
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
2601 2599
 	return -1;
... ...
@@ -2637,10 +2623,8 @@ static int to_any_gw_0(struct sip_msg* _m, char* _s1, char* _s2)
2637 2637
     }
2638 2638
     if ((ip = str2ip(&(_m->parsed_uri.host))) != NULL)
2639 2639
 	dst_addr = *ip;
2640
-#ifdef USE_IPV6
2641 2640
     else if ((ip = str2ip6(&(_m->parsed_uri.host))) != NULL)
2642 2641
 	dst_addr = *ip;
2643
-#endif
2644 2642
     else {
2645 2643
 	LM_DBG("request is not going to gw "
2646 2644
 	       "(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)
2675 2675
     addr_str.len = strlen(_addr);
2676 2676
     if ((ip = str2ip(&addr_str)) != NULL)
2677 2677
 	dst_addr = *ip;
2678
-#ifdef USE_IPV6
2679 2678
     if ((ip = str2ip6(&addr_str)) != NULL)
2680 2679
 	dst_addr = *ip;
2681
-#endif
2682 2680
     else {
2683 2681
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
2684 2682
 	return -1;
... ...
@@ -148,14 +148,12 @@ int  mi_init_datagram_server(sockaddr_dtgram *addr, unsigned int socket_domain,
148 148
 				goto err_rx;
149 149
 			}
150 150
 			break;
151
-#ifdef USE_IPV6
152 151
 	case AF_INET6: 
153 152
 			if(bind(socks->rx_sock, (struct sockaddr*)&addr->udp_addr.sin6, sizeof(addr->udp_addr)) < 0) {
154 153
 				LM_ERR("bind: %s\n", strerror(errno));
155 154
 				goto err_rx;
156 155
 			}
157 156
 			break;
158
-#endif
159 157
 	default:
160 158
 			LM_ERR("domain not supported\n");
161 159
 			goto err_both;
... ...
@@ -1040,9 +1040,7 @@ add_contact_alias_3_f(struct sip_msg* msg, char* _ip, char* _port, char* _proto)
1040 1040
 	return -1;
1041 1041
     }
1042 1042
     if ((str2ip(&ip_str) == NULL)
1043
-#ifdef USE_IPV6
1044 1043
 	&& (str2ip6(&ip_str) == NULL)
1045
-#endif
1046 1044
 	) {
1047 1045
 	LM_ERR("ip param value %s is not valid IP address\n", ip_str.s);
1048 1046
 	return -1;
... ...
@@ -67,12 +67,8 @@ static inline ip_addr_t *strtoipX(str *ips)
67 67
 	/* try to figure out INET class */
68 68
 	if(ips->s[0] == '[' || memchr(ips->s, ':', ips->len)!=NULL)
69 69
 	{
70
-#ifdef USE_IPV6
71 70
 		/* IPv6 */
72 71
 		return str2ip6(ips);
73
-#else
74
-		return 0;
75
-#endif
76 72
 	} else {
77 73
 		/* IPv4 */
78 74
 		return str2ip(ips);
... ...
@@ -97,9 +97,7 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){
97 97
 	struct hep_timehdr* heptime_tmp = NULL;
98 98
         memset(heptime, 0, sizeof(struct hep_timehdr));
99 99
 
100
-#ifdef USE_IPV6
101 100
         struct hep_ip6hdr *hepip6h = NULL;
102
-#endif /* USE_IPV6 */
103 101
 
104 102
 	hep_offset = 0; 
105 103
 	
... ...
@@ -117,11 +115,9 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){
117 117
         	case AF_INET:
118 118
                 	hl += sizeof(struct hep_iphdr);
119 119
                         break;
120
-#ifdef USE_IPV6
121 120
 		case AF_INET6:
122 121
                 	hl += sizeof(struct hep_ip6hdr);
123 122
                         break;
124
-#endif /* USE_IPV6 */
125 123
 		default:
126 124
                         LOG(L_ERR, "ERROR: sipcapture:hep_msg_received:  unsupported family [%d]\n", heph->hp_f);
127 125
                         return -1;
... ...
@@ -151,13 +147,11 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){
151 151
                 	hep_offset+=sizeof(struct hep_iphdr);
152 152
                         hepiph = (struct hep_iphdr*) hep_ip;
153 153
                         break;
154
-#ifdef USE_IPV6
155 154
 
156 155
 		case AF_INET6:
157 156
                 	hep_offset+=sizeof(struct hep_ip6hdr);
158 157
                         hepip6h = (struct hep_ip6hdr*) hep_ip;
159 158
                         break;
160
-#endif /* USE_IPV6 */
161 159
 
162 160
 	}
163 161
 
... ...
@@ -189,7 +183,6 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){
189 189
                         memcpy(&dst_ip.u.addr, &hepiph->hp_dst, 4);
190 190
                         memcpy(&src_ip.u.addr, &hepiph->hp_src, 4);
191 191
                         break;
192
-#ifdef USE_IPV6
193 192
 
194 193
 		case AF_INET6:
195 194
                 	dst_ip.af = src_ip.af = AF_INET6;
... ...
@@ -198,7 +191,6 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){
198 198
                         memcpy(&src_ip.u.addr, &hepip6h->hp6_src, 16);
199 199
                         break;
200 200
 
201
-#endif /* USE_IPV6 */
202 201
 	}
203 202
 
204 203
         ri->src_ip = src_ip;
... ...
@@ -338,7 +330,6 @@ int parsing_hepv3_message(char *buf, unsigned int len) {
338 338
                                         totelem++;
339 339
 
340 340
                                         break;
341
-#ifdef USE_IPV6                                                     
342 341
                                 case 5:
343 342
                                         hg->hep_src_ip6  = (hep_chunk_ip6_t *) (tmp);
344 343
                                         i+=chunk_length;
... ...
@@ -355,7 +346,6 @@ int parsing_hepv3_message(char *buf, unsigned int len) {
355 355
 				        memcpy(dst_ip.u.addr, &hg->hep_dst_ip6->data, 16);
356 356
 				        totelem++;
357 357
                                         break;
358
-#endif                                             
359 358
         
360 359
                                 case 7:
361 360
                                         hg->src_port  = (hep_chunk_uint16_t *) (tmp);
... ...
@@ -63,12 +63,10 @@ struct hep_timehdr{
63 63
    u_int16_t captid;          /* Capture ID node */
64 64
 };
65 65
 
66
-#ifdef USE_IPV6
67 66
 struct hep_ip6hdr {
68 67
         struct in6_addr hp6_src;        /* source address */
69 68
         struct in6_addr hp6_dst;        /* destination address */
70 69
 };
71
-#endif
72 70
 
73 71
 /* HEPv3 types */
74 72
 
... ...
@@ -115,12 +113,10 @@ struct hep_chunk_ip4 {
115 115
 
116 116
 typedef struct hep_chunk_ip4 hep_chunk_ip4_t;
117 117
 
118
-#ifdef USE_IPV6
119 118
 struct hep_chunk_ip6 {
120 119
        hep_chunk_t chunk;
121 120
        struct in6_addr data;
122 121
 } __attribute__((packed));
123
-#endif
124 122
 
125 123
 typedef struct hep_chunk_ip6 hep_chunk_ip6_t;
126 124
 
... ...
@@ -152,10 +148,8 @@ struct hep_generic_recv {
152 152
         hep_chunk_uint32_t *time_usec;
153 153
         hep_chunk_ip4_t    *hep_src_ip4;
154 154
         hep_chunk_ip4_t	    *hep_dst_ip4;
155
-#ifdef USE_IPV6
156 155
         hep_chunk_ip6_t    *hep_src_ip6;
157 156
         hep_chunk_ip6_t    *hep_dst_ip6;
158
-#endif
159 157
         hep_chunk_uint8_t  *proto_t;
160 158
         hep_chunk_uint32_t *capt_id;
161 159
         hep_chunk_uint16_t *keep_tm;
... ...
@@ -524,9 +524,7 @@ static int mod_init(void) {
524 524
 		register_procs(raw_sock_children);
525 525
 		                		
526 526
 		if(extract_host_port() && (((ip=str2ip(&raw_socket_listen)) == NULL)
527
-#ifdef  USE_IPV6
528 527
 		               && ((ip=str2ip6(&raw_socket_listen)) == NULL)
529
-#endif
530 528
 		         )) 
531 529
 		{		
532 530
 			LM_ERR("sipcapture mod_init: bad RAW IP: %.*s\n", raw_socket_listen.len, raw_socket_listen.s); 
... ...
@@ -1517,9 +1517,7 @@ static int trace_send_hep_duplicate(str *body, str *from, str *to)
1517 1517
 	struct timeval tvb;
1518 1518
 	struct timezone tz;
1519 1519
 	                 
1520
-#if USE_IPV6
1521 1520
 	struct hep_ip6hdr hep_ip6header;
1522
-#endif
1523 1521
 
1524 1522
 	if(body->s==NULL || body->len <= 0)
1525 1523
 		return -1;
... ...
@@ -1533,11 +1531,7 @@ static int trace_send_hep_duplicate(str *body, str *from, str *to)
1533 1533
 
1534 1534
 	/* message length */
1535 1535
 	len = body->len 
1536
-#if USE_IPV6
1537 1536
 		+ sizeof(struct hep_ip6hdr)
1538
-#else
1539
-		+ sizeof(struct hep_iphdr)          
1540
-#endif
1541 1537
 		+ sizeof(struct hep_hdr) + sizeof(struct hep_timehdr);;
1542 1538
 
1543 1539
 
... ...
@@ -1595,7 +1589,6 @@ static int trace_send_hep_duplicate(str *body, str *from, str *to)
1595 1595
 
1596 1596
 		len = sizeof(struct hep_iphdr);
1597 1597
 	}
1598
-#ifdef USE_IPV6
1599 1598
 	else if (from_su.s.sa_family==AF_INET6){
1600 1599
 		/* prepare the hep6 headers */
1601 1600
 
... ...
@@ -1609,7 +1602,6 @@ static int trace_send_hep_duplicate(str *body, str *from, str *to)
1609 1609
 
1610 1610
 		len = sizeof(struct hep_ip6hdr);
1611 1611
 	}
1612
-#endif /* USE_IPV6 */
1613 1612
 	else {
1614 1613
 		LOG(L_ERR, "ERROR: trace_send_hep_duplicate: Unsupported protocol family\n");
1615 1614
 		goto error;;
... ...
@@ -1638,12 +1630,10 @@ static int trace_send_hep_duplicate(str *body, str *from, str *to)
1638 1638
 		memcpy((void*)buffer + buflen, &hep_ipheader, sizeof(struct hep_iphdr));
1639 1639
 		buflen += sizeof(struct hep_iphdr);
1640 1640
 	}
1641
-#if USE_IPV6
1642 1641
 	else {
1643 1642
 		memcpy((void*)buffer+buflen, &hep_ip6header, sizeof(struct hep_ip6hdr));
1644 1643
 		buflen += sizeof(struct hep_ip6hdr);
1645 1644
 	}
1646
-#endif /* USE_IPV6 */
1647 1645
 
1648 1646
 	if(hep_version == 2) {
1649 1647
 
... ...
@@ -1763,9 +1753,7 @@ static int pipport2su (char *pipport, union sockaddr_union *tmp_su, unsigned int
1763 1763
 
1764 1764
 	/* check if it's an ip address */
1765 1765
 	if (((ip=str2ip(&host_uri))!=0)
1766
-#ifdef  USE_IPV6
1767 1766
 			|| ((ip=str2ip6(&host_uri))!=0)
1768
-#endif
1769 1767
 	   ) {
1770 1768
 		ip_addr2su(tmp_su, ip, ntohs(port_no));
1771 1769
 		return 0;	
... ...
@@ -750,10 +750,8 @@ static int stun_add_address_attr(struct stun_msg* res,
750 750
 {
751 751
 	struct stun_attr attr;
752 752
 	int		 ip_struct_len;
753
-#ifdef USE_IPV6
754 753
 	UINT_T	 id[IP_ADDR];
755 754
 	int i;
756
-#endif /* USE_IPV6 */ 
757 755
 	
758 756
 	ip_struct_len = 0;
759 757
 	attr.type = htons(type);
... ...
@@ -766,7 +764,6 @@ static int stun_add_address_attr(struct stun_msg* res,
766 766
 			res->ip_addr.ip[0] = (do_xor) ? 
767 767
 				res->ip_addr.ip[0] ^ htonl(MAGIC_COOKIE) : res->ip_addr.ip[0];
768 768
 			break;
769
-#ifdef USE_IPV6
770 769
 		case AF_INET6:
771 770
 			ip_struct_len = sizeof(struct stun_ip_addr);
772 771
 			res->ip_addr.family = htons(IPV6_FAMILY);
... ...
@@ -777,7 +774,6 @@ static int stun_add_address_attr(struct stun_msg* res,
777 777
 							res->ip_addr.ip[i] ^ id[i] : res->ip_addr.ip[i];
778 778
 			}
779 779
 			break;
780
-#endif /* USE_IPV6 */ 
781 780
 		default:
782 781
 			break;
783 782
 	}
... ...
@@ -49,7 +49,6 @@
49 49
 static tls_domains_cfg_t* cfg = NULL;
50 50
 static tls_domain_t* domain = NULL;
51 51
 
52
-#ifdef USE_IPV6
53 52
 static int parse_ipv6(struct ip_addr* ip, cfg_token_t* token, 
54 53
 					  cfg_parser_t* st)
55 54
 {
... ...
@@ -77,7 +76,6 @@ static int parse_ipv6(struct ip_addr* ip, cfg_token_t* token,
77 77
 	    st->file, token->start.line, token->start.col);
78 78
 	return -1;
79 79
 }
80
-#endif /* USE_IPV6 */
81 80
 
82 81
 
83 82
 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,
202 202
 	}
203 203
 
204 204
 	if (t.type == '[') {
205
-#ifdef USE_IPV6
206 205
 		if (parse_ipv6(ip, &t, st) < 0) return -1;
207
-#else
208
-		ERR("%s:%d:%d: IPv6 address  not supported (compiled without IPv6"
209
-				" support)\n", 
210
-		    st->file, t.start.line, t.start.col);
211
-		return -1;
212
-#endif /* USE_IPV6 */
213 206
 	} else if (t.type == CFG_TOKEN_ALPHA) {
214 207
 		opt = cfg_lookup_token(token_default, &t.val);
215 208
 		if (opt) {
... ...
@@ -815,9 +815,7 @@ static unsigned long nhop_type(sip_msg_t *orig_inv, rte_t *rtset,
815 815
 		return F_RB_NH_STRICT;
816 816
 	/* if 1st route contains an IP address, comparing it against .dst */
817 817
 	if ((uri_ia = str2ip(&topr_uri.host))
818
-#ifdef USE_IPV6
819 818
 			|| (uri_ia = str2ip6(&topr_uri.host))
820
-#endif
821 819
 			) {
822 820
 		/* we have an IP address in route -> comparison can go swiftly */
823 821
 		if (init_su(&uri_sau, uri_ia, uri_port) < 0)
... ...
@@ -195,9 +195,7 @@ static int check_via_address(struct ip_addr* ip, str *name,
195 195
 	struct hostent* he;
196 196
 	int i;
197 197
 	char* s;
198
-	#ifdef USE_IPV6
199 198
 	int len;
200
-	#endif
201 199
 
202 200
 	/* maybe we are lucky and name it's an ip */
203 201
 	s=ip_addr2a(ip);
... ...
@@ -205,8 +203,6 @@ static int check_via_address(struct ip_addr* ip, str *name,
205 205
 		DBG("check_via_address(%s, %.*s, %d)\n",
206 206
 			s, name->len, name->s, resolver);
207 207
 
208
-	#ifdef USE_IPV6
209
-
210 208
 		len=strlen(s);
211 209
 
212 210
 		/* 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,
220 220
 		   )
221 221
 			return 0;
222 222
 		else
223
-	#endif
224 223
 
225 224
 			if (strncmp(name->s, s, name->len)==0)
226 225
 				return 0;
... ...
@@ -1764,9 +1759,7 @@ after_local_via:
1764 1764
 			}
1765 1765
 #if 0
1766 1766
 			/* no longer necessary, now hots.s contains [] */
1767
-		#ifdef USE_IPV6
1768 1767
 			if(send_sock->address.af==AF_INET6) size+=1; /* +1 for ']'*/
1769
-		#endif
1770 1768
 #endif
1771 1769
 	}
1772 1770
 	/* if received needs to be added, add anchor after host and add it, or
... ...
@@ -2514,7 +2507,6 @@ char* via_builder( unsigned int *len,
2514 2514
 		LOG(L_CRIT, "BUG: via_builder: unknown proto %d\n", send_info->proto);
2515 2515
 		return 0;
2516 2516
 	}
2517
-#	ifdef USE_IPV6
2518 2517
 	/* add [] only if ipv6 and outbound socket address is used;
2519 2518
 	 * if using pre-set no check is made */
2520 2519
 	if ((send_sock->address.af==AF_INET6) &&
... ...
@@ -2524,7 +2516,6 @@ char* via_builder( unsigned int *len,
2524 2524
 		extra_len=1;
2525 2525
 		via_len+=2; /* [ ]*/
2526 2526
 	}
2527
-#	endif
2528 2527
 	memcpy(line_buf+via_prefix_len+extra_len, address_str->s,
2529 2528
 				address_str->len);
2530 2529
 	if ((send_sock->port_no!=SIP_PORT) ||
... ...
@@ -59,13 +59,11 @@ static inline int grep_aliases(char* name, int len, unsigned short port,
59 59
 {
60 60
 	struct  host_alias* a;
61 61
 	
62
-#ifdef USE_IPV6
63 62
 	if ((len>2)&&((*name)=='[')&&(name[len-1]==']')){
64 63
 		/* ipv6 reference, skip [] */
65 64
 		name++;
66 65
 		len-=2;
67 66
 	}
68
-#endif
69 67
 	for(a=aliases;a;a=a->next)
70 68
 		if ((a->alias.len==len) && ((a->port==0) || (port==0) || 
71 69
 				(a->port==port)) && ((a->proto==0) || (proto==0) || 
... ...
@@ -34,26 +34,20 @@ void ip_set_init(struct ip_set *ip_set, int use_shm) {
34 34
 	memset(ip_set, 0, sizeof(*ip_set));
35 35
 	ip_set->use_shm = use_shm;
36 36
 	ip_tree_init(&ip_set->ipv4_tree);
37
-	#ifdef USE_IPV6
38 37
 	ip_tree_init(&ip_set->ipv6_tree);
39
-	#endif
40 38
 }
41 39
 
42 40
 void ip_set_destroy(struct ip_set *ip_set) {
43 41
 	ip_tree_destroy(&ip_set->ipv4_tree, 0, ip_set->use_shm);
44
-	#ifdef USE_IPV6
45 42
 	ip_tree_destroy(&ip_set->ipv6_tree, 0, ip_set->use_shm);
46
-	#endif
47 43
 }
48 44
 
49 45
 int ip_set_add_ip(struct ip_set *ip_set, struct ip_addr *ip, unsigned int network_prefix) {
50 46
 	switch (ip->af) {
51 47
 		case AF_INET:
52 48
 			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);
53
-	#ifdef USE_IPV6
54 49
 		case AF_INET6:
55 50
 			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);
56
-	#endif
57