Quellcode durchsuchen

Merge branch 'master' of ssh://git.sip-router.org/sip-router

Konstantin Mosesov vor 12 Jahren
Ursprung
Commit
8750305d46
75 geänderte Dateien mit 294 neuen und 450 gelöschten Zeilen
  1. 3 4
      Makefile.defs
  2. 1 1
      action.c
  3. 1 5
      cfg.lex
  4. 0 15
      cfg.y
  5. 0 4
      cfg_core.c
  6. 2 0
      config.h
  7. 0 71
      dns_cache.c
  8. 1 1
      doc/cfg_list/Makefile
  9. 1 1
      doc/counter_list/Makefile
  10. 1 1
      doc/rpc_list/Makefile
  11. 1 1
      doc/select_list/Makefile
  12. 30 6
      dset.c
  13. 8 5
      dset.h
  14. 0 22
      dst_blacklist.c
  15. 0 14
      forward.c
  16. 0 2
      globals.h
  17. 0 10
      ip_addr.c
  18. 0 36
      ip_addr.h
  19. 0 10
      main.c
  20. 1 1
      modules/alias_db/alookup.c
  21. 2 2
      modules/avpops/avpops_impl.c
  22. 1 1
      modules/corex/corex_lib.c
  23. 1 1
      modules/cpl-c/cpl_sig.c
  24. 1 1
      modules/dialplan/dialplan.c
  25. 1 1
      modules/domain/domain.c
  26. 0 2
      modules/drouting/drouting.c
  27. 2 2
      modules/enum/enum.c
  28. 1 1
      modules/exec/exec.c
  29. 1 1
      modules/ims_icscf/scscf_list.c
  30. 1 1
      modules/ims_isc/isc.c
  31. 0 1
      modules/ims_registrar_scscf/reg_mod.h
  32. 1 1
      modules/ims_registrar_scscf/save.c
  33. 0 18
      modules/lcr/lcr_mod.c
  34. 0 2
      modules/mi_datagram/datagram_fnc.c
  35. 0 2
      modules/nathelper/nathelper.c
  36. 0 4
      modules/permissions/address.c
  37. 1 1
      modules/permissions/permissions.c
  38. 3 0
      modules/pv/pv.c
  39. 11 1
      modules/pv/pv_branch.c
  40. 21 3
      modules/pv/pv_core.c
  41. 3 0
      modules/pv/pv_core.h
  42. 12 1
      modules/registrar/lookup.c
  43. 0 1
      modules/registrar/reg_mod.h
  44. 1 1
      modules/registrar/save.c
  45. 0 10
      modules/sipcapture/hep.c
  46. 0 6
      modules/sipcapture/hep.h
  47. 0 2
      modules/sipcapture/sipcapture.c
  48. 0 12
      modules/siptrace/siptrace.c
  49. 0 4
      modules/stun/kam_stun.c
  50. 0 9
      modules/tls/tls_config.c
  51. 1 0
      modules/tm/h_table.h
  52. 83 12
      modules/tm/t_fwd.c
  53. 0 2
      modules/tm/t_msgbuilder.c
  54. 45 12
      modules/tm/t_serial.c
  55. 3 3
      modules/xprint/xp_lib.c
  56. 0 9
      msg_translator.c
  57. 0 2
      name_alias.h
  58. 0 14
      obsolete/permissions/ip_set.c
  59. 0 2
      obsolete/permissions/ip_set.h
  60. 0 2
      obsolete/permissions/ip_set_rpc.c
  61. 0 2
      obsolete/permissions/permissions.c
  62. 0 4
      obsolete/registrar/save.c
  63. 39 0
      parser/msg_parser.c
  64. 5 0
      parser/msg_parser.h
  65. 0 4
      pt.c
  66. 0 6
      resolve.c
  67. 0 12
      resolve.h
  68. 0 6
      sctp_server.c
  69. 3 3
      select_core.c
  70. 0 18
      socket_info.c
  71. 0 10
      tcp_main.c
  72. 0 4
      test/p_uri.c
  73. 0 4
      test/parse_to_body.c
  74. 0 10
      udp_server.c
  75. 1 7
      ver_defs.h

+ 3 - 4
Makefile.defs

@@ -680,7 +680,6 @@ C_DEFS= $(extra_defs) \
 	 -DPKG_MALLOC \
 	 -DPKG_MALLOC \
 	 -DSHM_MEM  -DSHM_MMAP \
 	 -DSHM_MEM  -DSHM_MMAP \
 	 -DDNS_IP_HACK \
 	 -DDNS_IP_HACK \
-	 -DUSE_IPV6 \
 	 -DUSE_MCAST \
 	 -DUSE_MCAST \
 	 -DUSE_TCP \
 	 -DUSE_TCP \
 	 -DDISABLE_NAGLE \
 	 -DDISABLE_NAGLE \
@@ -2054,9 +2053,9 @@ ifeq ($(OS), darwin)
 endif
 endif
 
 
 ifneq (,$(findstring cygwin, $(OS)))
 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 \
 	C_DEFS+=-DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
 			-DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
 			-DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
 			-DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER
 			-DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER

+ 1 - 1
action.c

@@ -509,7 +509,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 			ret=append_branch(msg, &a->val[0].u.str, &msg->dst_uri,
 			ret=append_branch(msg, &a->val[0].u.str, &msg->dst_uri,
 					  &msg->path_vec, a->val[1].u.number,
 					  &msg->path_vec, a->val[1].u.number,
 					  (flag_t)flags, msg->force_send_socket,
 					  (flag_t)flags, msg->force_send_socket,
-					  0, 0, 0);
+					  0, 0, 0, 0);
 			/* if the uri is the ruri and q was also not changed, mark
 			/* if the uri is the ruri and q was also not changed, mark
 			   ruri as consumed, to avoid having an identical branch */
 			   ruri as consumed, to avoid having an identical branch */
 			if ((a->val[0].u.str.s == 0 || a->val[0].u.str.len == 0) &&
 			if ((a->val[0].u.str.s == 0 || a->val[0].u.str.len == 0) &&

+ 1 - 5
cfg.lex

@@ -1160,11 +1160,7 @@ IMPORTFILE      "import_file"
 <INITIAL>{INET}			{ count(); yylval.intval=AF_INET;
 <INITIAL>{INET}			{ count(); yylval.intval=AF_INET;
 							yy_number_str=yytext; return NUMBER; }
 							yy_number_str=yytext; return NUMBER; }
 <INITIAL>{INET6}		{ count();
 <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;
 						yy_number_str=yytext;
 						return NUMBER; }
 						return NUMBER; }
 <INITIAL>{SSLv23}		{ count(); yylval.strval=yytext; return SSLv23; }
 <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");\
 		if (rt!=ONSEND_ROUTE) yyerror( s " allowed only in onsend_routes");\
 	}while(0)
 	}while(0)
 
 
-#ifdef USE_IPV6
 	#define IF_AUTO_BIND_IPV6(x) x
 	#define IF_AUTO_BIND_IPV6(x) x
-#else
-	#define IF_AUTO_BIND_IPV6(x) warn("IPV6 support not compiled");
-#endif
 
 
 #ifdef USE_DNS_CACHE
 #ifdef USE_DNS_CACHE
 	#define IF_DNS_CACHE(x) x
 	#define IF_DNS_CACHE(x) x
@@ -1124,12 +1120,8 @@ assign_stm:
 	| TCP_SOURCE_IPV4 EQUAL error { yyerror("IPv4 address expected"); }
 	| TCP_SOURCE_IPV4 EQUAL error { yyerror("IPv4 address expected"); }
 	| TCP_SOURCE_IPV6 EQUAL ipv6 {
 	| TCP_SOURCE_IPV6 EQUAL ipv6 {
 		#ifdef USE_TCP
 		#ifdef USE_TCP
-			#ifdef USE_IPV6
 				if (tcp_set_src_addr($3)<0)
 				if (tcp_set_src_addr($3)<0)
 					warn("tcp_source_ipv6 failed");
 					warn("tcp_source_ipv6 failed");
-			#else
-				warn("IPv6 support not compiled in");
-			#endif
 		#else
 		#else
 			warn("tcp support not compiled in");
 			warn("tcp support not compiled in");
 		#endif
 		#endif
@@ -1856,17 +1848,12 @@ ipv6addr:
 		if ($$==0) {
 		if ($$==0) {
 			LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
 			LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
 		} else {
 		} else {
-		#ifdef USE_IPV6
 			memset($$, 0, sizeof(struct ip_addr));
 			memset($$, 0, sizeof(struct ip_addr));
 			$$->af=AF_INET6;
 			$$->af=AF_INET6;
 			$$->len=16;
 			$$->len=16;
 			if (inet_pton(AF_INET6, $1, $$->u.addr)<=0) {
 			if (inet_pton(AF_INET6, $1, $$->u.addr)<=0) {
 				yyerror("bad ipv6 address");
 				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){
 			if (s_tmp.s){
 				ip_tmp=str2ip(&s_tmp);
 				ip_tmp=str2ip(&s_tmp);
-			#ifdef USE_IPV6
 				if (ip_tmp==0)
 				if (ip_tmp==0)
 					ip_tmp=str2ip6(&s_tmp);
 					ip_tmp=str2ip6(&s_tmp);
-			#endif
 				pkg_free(s_tmp.s);
 				pkg_free(s_tmp.s);
 				if (ip_tmp) {
 				if (ip_tmp) {
 					$$=mk_elem($2, $1, 0, NET_ST, 
 					$$=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 */
 	0, /* blst_sctp_imask */
 #endif
 #endif
 	/* resolver */
 	/* resolver */
-#ifdef USE_IPV6
 	1,  /*!< dns_try_ipv6 -- on by default */
 	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 */
 	0,  /*!< dns_try_naptr -- off by default */
 	30,  /*!< udp transport preference (for naptr) */
 	30,  /*!< udp transport preference (for naptr) */
 	20,  /*!< tcp transport preference (for naptr) */
 	20,  /*!< tcp transport preference (for naptr) */

+ 2 - 0
config.h

@@ -77,6 +77,8 @@
 
 
 #define MAX_RUID_SIZE 65		/*!< Maximum length of ruid for location records */
 #define MAX_RUID_SIZE 65		/*!< Maximum length of ruid for location records */
 
 
+#define MAX_UA_SIZE 255			/*!< Maximum length of user-agent for location records */
+
 #define MY_VIA "Via: SIP/2.0/UDP "
 #define MY_VIA "Via: SIP/2.0/UDP "
 #define MY_VIA_LEN (sizeof(MY_VIA) - 1)
 #define MY_VIA_LEN (sizeof(MY_VIA) - 1)
 
 

+ 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 */
 #endif /* USE_DNS_CACHE_STATS */
 
 
 	if (type==T_A){
 	if (type==T_A){
-#ifdef USE_IPV6
 		if (str2ip6(name)!=0)
 		if (str2ip6(name)!=0)
 			goto end;
 			goto end;
-#endif /* USE_IPV6 */
 		if ((ip=str2ip(name))!=0){
 		if ((ip=str2ip(name))!=0){
 				e=dns_cache_mk_ip_entry(name, ip);
 				e=dns_cache_mk_ip_entry(name, ip);
 				if (likely(e))
 				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 */
 				goto end; /* we do not cache obvious stuff */
 		}
 		}
 	}
 	}
-#ifdef USE_IPV6
 	else if (type==T_AAAA){
 	else if (type==T_AAAA){
 		if (str2ip(name)!=0)
 		if (str2ip(name)!=0)
 			goto end;
 			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 */
 				goto end;/* we do not cache obvious stuff */
 		}
 		}
 	}
 	}
-#endif /* USE_IPV6 */
 #ifdef DNS_WATCHDOG_SUPPORT
 #ifdef DNS_WATCHDOG_SUPPORT
 	if (atomic_get(dns_servers_up)==0)
 	if (atomic_get(dns_servers_up)==0)
 		goto end; /* the servers are down, needless to perform the query */
 		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;
 			len=4;
 			break;
 			break;
 		case T_AAAA:
 		case T_AAAA:
-#ifdef USE_IPV6
 			af=AF_INET6;
 			af=AF_INET6;
 			len=16;
 			len=16;
 			break;
 			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:
 		default:
 			LOG(L_CRIT, "BUG: dns_entry2he: wrong entry type %d for %.*s\n",
 			LOG(L_CRIT, "BUG: dns_entry2he: wrong entry type %d for %.*s\n",
 					e->type, e->name_len, e->name);
 					e->type, e->name_len, e->name);
@@ -2472,10 +2461,8 @@ inline static struct hostent* dns_a_get_he(str* name)
 	struct hostent* he;
 	struct hostent* he;
 
 
 	e=0;
 	e=0;
-#ifdef	USE_IPV6
 	if (str2ip6(name)!=0)
 	if (str2ip6(name)!=0)
 		return 0;
 		return 0;
-#endif
 	if ((ip=str2ip(name))!=0){
 	if ((ip=str2ip(name))!=0){
 		return ip_addr2he(name, ip);
 		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
 /* gethostbyname compatibility: performs an aaaa_lookup and returns a pointer
  * to a statical internal hostent structure
  * to a statical internal hostent structure
  * returns 0 on success, <0 on error (see the error codes)
  * 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);
 	dns_hash_put(e);
 	return he;
 	return he;
 }
 }
-#endif
 
 
 
 
 
 
@@ -2527,16 +2512,10 @@ inline static int dns_rr2ip(int type, struct dns_rr* rr, struct ip_addr* ip)
 			return 0;
 			return 0;
 			break;
 			break;
 		case T_AAAA:
 		case T_AAAA:
-#ifdef USE_IPV6
 			ip->af=AF_INET6;
 			ip->af=AF_INET6;
 			ip->len=16;
 			ip->len=16;
 			memcpy(ip->u.addr, ((struct aaaa_rdata*)rr->rdata)->ip6, 16);
 			memcpy(ip->u.addr, ((struct aaaa_rdata*)rr->rdata)->ip6, 16);
 			return 0;
 			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;
 			break;
 	}
 	}
 	return -1;
 	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)
 struct hostent* dns_get_he(str* name, int flags)
 {
 {
-#ifdef USE_IPV6
 	struct hostent* he;
 	struct hostent* he;
 
 
 	if ((flags&(DNS_IPV6_FIRST|DNS_IPV6_ONLY))){
 	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);
 		he=dns_aaaa_get_he(name);
 	}
 	}
 	return he;
 	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{
 		}else{
 			/* check if it's an ip address */
 			/* check if it's an ip address */
 			if ( ((ip=str2ip(name))!=0)
 			if ( ((ip=str2ip(name))!=0)
-#ifdef	USE_IPV6
 				  || ((ip=str2ip6(name))!=0)
 				  || ((ip=str2ip6(name))!=0)
-#endif
 				){
 				){
 				/* we are lucky, this is an ip address */
 				/* we are lucky, this is an ip address */
 				return ip_addr2he(name,ip);
 				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 */
 		*proto=PROTO_UDP; /* just in case we don't find another */
 		/* check if it's an ip address */
 		/* check if it's an ip address */
 		if ( ((tmp_ip=str2ip(name))!=0)
 		if ( ((tmp_ip=str2ip(name))!=0)
-#ifdef	USE_IPV6
 			  || ((tmp_ip=str2ip6(name))!=0)
 			  || ((tmp_ip=str2ip6(name))!=0)
-#endif
 			){
 			){
 			/* we are lucky, this is an ip address */
 			/* we are lucky, this is an ip address */
-#ifdef	USE_IPV6
 			if (((dns_flags&DNS_IPV4_ONLY) && (tmp_ip->af==AF_INET6))||
 			if (((dns_flags&DNS_IPV4_ONLY) && (tmp_ip->af==AF_INET6))||
 				((dns_flags&DNS_IPV6_ONLY) && (tmp_ip->af==AF_INET))){
 				((dns_flags&DNS_IPV6_ONLY) && (tmp_ip->af==AF_INET))){
 				return 0;
 				return 0;
 			}
 			}
-#endif
 			*port=SIP_PORT;
 			*port=SIP_PORT;
 			return ip_addr2he(name, tmp_ip);
 			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;
 	ret=-E_DNS_NO_IP;
 	if (*e==0){ /* do lookup */
 	if (*e==0){ /* do lookup */
 		/* if ip don't set *e */
 		/* if ip don't set *e */
-#ifdef	USE_IPV6
 		if (str2ip6(name)!=0)
 		if (str2ip6(name)!=0)
 			goto error;
 			goto error;
-#endif
 		if ((tmp=str2ip(name))!=0){
 		if ((tmp=str2ip(name))!=0){
 			*ip=*tmp;
 			*ip=*tmp;
 			*rr_no=0;
 			*rr_no=0;
@@ -3009,7 +2976,6 @@ error:
 }
 }
 
 
 
 
-#ifdef USE_IPV6
 /* lookup, fills the dns_entry pointer and the ip addr.
 /* 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
  *  (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
  *   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:
 error:
 	return ret;
 	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;
 	ret=-E_DNS_NO_IP;
 	if (*e==0){ /* first call */
 	if (*e==0){ /* first call */
-#ifdef USE_IPV6
 		if ((flags&(DNS_IPV6_FIRST|DNS_IPV6_ONLY))){
 		if ((flags&(DNS_IPV6_FIRST|DNS_IPV6_ONLY))){
 			ret=dns_aaaa_resolve(e, rr_no, name, ip);
 			ret=dns_aaaa_resolve(e, rr_no, name, ip);
 			if (ret>=0) return ret;
 			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))){
 		}else if (!(flags&(DNS_IPV6_ONLY|DNS_IPV4_ONLY))){
 			ret=dns_aaaa_resolve(e, rr_no, name, ip);
 			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){
 	}else if ((*e)->type==T_A){
 		/* continue A resolving */
 		/* continue A resolving */
 		/* retrieve host name from the hash entry  (ignore name which might
 		/* 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.s=(*e)->name;
 		host.len=(*e)->name_len;
 		host.len=(*e)->name_len;
 		ret=dns_a_resolve(e, rr_no, &host, ip);
 		ret=dns_a_resolve(e, rr_no, &host, ip);
-#ifdef USE_IPV6
 		if (ret>=0) return ret;
 		if (ret>=0) return ret;
 		if (!(flags&(DNS_IPV6_ONLY|DNS_IPV6_FIRST|DNS_IPV4_ONLY))){
 		if (!(flags&(DNS_IPV6_ONLY|DNS_IPV6_FIRST|DNS_IPV4_ONLY))){
 			/* not found, try with AAAA */
 			/* 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*/
 			/* delay original record release until we're finished with host*/
 			dns_hash_put(orig);
 			dns_hash_put(orig);
 		}
 		}
-#endif /* USE_IPV6 */
 	}else if ((*e)->type==T_AAAA){
 	}else if ((*e)->type==T_AAAA){
 		/* retrieve host name from the hash entry  (ignore name which might
 		/* retrieve host name from the hash entry  (ignore name which might
 		  be null when continuing a srv lookup) */
 		  be null when continuing a srv lookup) */
 		host.s=(*e)->name;
 		host.s=(*e)->name;
 		host.len=(*e)->name_len;
 		host.len=(*e)->name_len;
-#ifdef USE_IPV6
 		/* continue AAAA resolving */
 		/* continue AAAA resolving */
 		ret=dns_aaaa_resolve(e, rr_no, &host, ip);
 		ret=dns_aaaa_resolve(e, rr_no, &host, ip);
 		if (ret>=0) return ret;
 		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*/
 			/* delay original record release until we're finished with host*/
 			dns_hash_put(orig);
 			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{
 	}else{
 		LOG(L_CRIT, "BUG: dns_ip_resolve: invalid record type %d\n",
 		LOG(L_CRIT, "BUG: dns_ip_resolve: invalid record type %d\n",
 					(*e)->type);
 					(*e)->type);
@@ -3324,17 +3273,13 @@ inline static int dns_srv_sip_resolve(struct dns_srv_handle* h,  str* name,
 				}else{
 				}else{
 					/* check if it's an ip address */
 					/* check if it's an ip address */
 					if ( ((tmp_ip=str2ip(name))!=0)
 					if ( ((tmp_ip=str2ip(name))!=0)
-#ifdef	USE_IPV6
 						  || ((tmp_ip=str2ip6(name))!=0)
 						  || ((tmp_ip=str2ip6(name))!=0)
-#endif
 						){
 						){
 						/* we are lucky, this is an ip address */
 						/* we are lucky, this is an ip address */
-#ifdef	USE_IPV6
 						if (((flags&DNS_IPV4_ONLY) && (tmp_ip->af==AF_INET6))||
 						if (((flags&DNS_IPV4_ONLY) && (tmp_ip->af==AF_INET6))||
 							((flags&DNS_IPV6_ONLY) && (tmp_ip->af==AF_INET))){
 							((flags&DNS_IPV6_ONLY) && (tmp_ip->af==AF_INET))){
 							return -E_DNS_AF_MISMATCH;
 							return -E_DNS_AF_MISMATCH;
 						}
 						}
-#endif
 						*ip=*tmp_ip;
 						*ip=*tmp_ip;
 						*port=h->port;
 						*port=h->port;
 						/* proto already set */
 						/* 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 */
 		/* check if it's an ip address */
 		if ( ((tmp_ip=str2ip(name))!=0)
 		if ( ((tmp_ip=str2ip(name))!=0)
-#ifdef	USE_IPV6
 			  || ((tmp_ip=str2ip6(name))!=0)
 			  || ((tmp_ip=str2ip6(name))!=0)
-#endif
 			){
 			){
 			/* we are lucky, this is an ip address */
 			/* we are lucky, this is an ip address */
-#ifdef	USE_IPV6
 			if (((flags&DNS_IPV4_ONLY) && (tmp_ip->af==AF_INET6))||
 			if (((flags&DNS_IPV4_ONLY) && (tmp_ip->af==AF_INET6))||
 				((flags&DNS_IPV6_ONLY) && (tmp_ip->af==AF_INET))){
 				((flags&DNS_IPV6_ONLY) && (tmp_ip->af==AF_INET))){
 				return -E_DNS_AF_MISMATCH;
 				return -E_DNS_AF_MISMATCH;
 			}
 			}
-#endif
 			*ip=*tmp_ip;
 			*ip=*tmp_ip;
 			h->port=SIP_PORT;
 			h->port=SIP_PORT;
 			h->proto=*proto;
 			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)
 inline static int dns_aaaa_get_ip(str* name, struct ip_addr* ip)
 {
 {
 	struct dns_hash_entry* e;
 	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);
 	if (e) dns_hash_put(e);
 	return ret;
 	return ret;
 }
 }
-#endif /* USE_IPV6 */
 
 
 
 
 
 
@@ -4280,7 +4219,6 @@ int dns_cache_add_record(unsigned short type,
 			}
 			}
 			break;
 			break;
 		case T_AAAA:
 		case T_AAAA:
-#ifdef USE_IPV6
 			ip_addr = str2ip6(value);
 			ip_addr = str2ip6(value);
 			if (!ip_addr) {
 			if (!ip_addr) {
 				LOG(L_ERR, "ERROR: Malformed ip address: %.*s\n",
 				LOG(L_ERR, "ERROR: Malformed ip address: %.*s\n",
@@ -4288,10 +4226,6 @@ int dns_cache_add_record(unsigned short type,
 				return -1;
 				return -1;
 			}
 			}
 			break;
 			break;
-#else /* USE_IPV6 */
-			LOG(L_ERR, "ERROR: IPv6 support is disabled\n");
-			return -1;
-#endif /* USE_IPV6 */
 		case T_SRV:
 		case T_SRV:
 			rr_name = *value;
 			rr_name = *value;
 			break;
 			break;
@@ -4588,7 +4522,6 @@ int dns_cache_delete_single_record(unsigned short type,
 			}
 			}
 			break;
 			break;
 		case T_AAAA:
 		case T_AAAA:
-#ifdef USE_IPV6
 			ip_addr = str2ip6(value);
 			ip_addr = str2ip6(value);
 			if (!ip_addr) {
 			if (!ip_addr) {
 				LOG(L_ERR, "ERROR: Malformed ip address: %.*s\n",
 				LOG(L_ERR, "ERROR: Malformed ip address: %.*s\n",
@@ -4596,10 +4529,6 @@ int dns_cache_delete_single_record(unsigned short type,
 				return -1;
 				return -1;
 			}
 			}
 			break;
 			break;
-#else /* USE_IPV6 */
-			LOG(L_ERR, "ERROR: IPv6 support is disabled\n");
-			return -1;
-#endif /* USE_IPV6 */
 		case T_SRV:
 		case T_SRV:
 			rr_name = *value;
 			rr_name = *value;
 			break;
 			break;

+ 1 - 1
doc/cfg_list/Makefile

@@ -63,7 +63,7 @@ gcc=gcc
 
 
 # defines used by gcc
 # defines used by gcc
 c_defs=-D__CPU_i386 -D__OS_linux -DSER_VER=2099099 -DPKG_MALLOC -DSHM_MEM  \
 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_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR \
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
 		-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
 		-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \

+ 1 - 1
doc/counter_list/Makefile

@@ -57,7 +57,7 @@ gcc=gcc
 
 
 # defines used by gcc
 # defines used by gcc
 c_defs=-D__CPU_i386 -D__OS_linux -DSER_VER=2099099 -DPKG_MALLOC -DSHM_MEM  \
 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_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR \
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
 		-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
 		-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"
 # -D__CPU_i386 -DARCH="i386"
 c_defsX= -D__CPU_x86_64 -D__OS_linux -DSER_VER=3003000 -DPKG_MALLOC -DSHM_MEM  \
 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\"' \
 		-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_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR \
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
 		-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
 		-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \

+ 1 - 1
doc/select_list/Makefile

@@ -67,7 +67,7 @@ gcc=gcc
 
 
 # defines used by gcc
 # defines used by gcc
 c_defs=-D__CPU_i386 -D__OS_linux -DSER_VER=2099099 -DPKG_MALLOC -DSHM_MEM  \
 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_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR \
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
 		-DUSE_TLS -DTLS_HOOKS -DFAST_LOCK   -DCC_GCC_LIKE_ASM \
 		-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
 		-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \

+ 30 - 6
dset.c

@@ -216,7 +216,7 @@ void set_branch_iterator(int n)
 char* get_branch(unsigned int i, int* len, qvalue_t* q, str* dst_uri,
 char* get_branch(unsigned int i, int* len, qvalue_t* q, str* dst_uri,
 		 str* path, unsigned int *flags,
 		 str* path, unsigned int *flags,
 		 struct socket_info** force_socket,
 		 struct socket_info** force_socket,
-		 str *ruid, str *instance)
+		 str *ruid, str *instance, str *location_ua)
 {
 {
 	if (i < nr_branches) {
 	if (i < nr_branches) {
 		*len = branches[i].len;
 		*len = branches[i].len;
@@ -241,6 +241,11 @@ char* get_branch(unsigned int i, int* len, qvalue_t* q, str* dst_uri,
 			instance->len = branches[i].instance_len;
 			instance->len = branches[i].instance_len;
 			instance->s = (instance->len)?branches[i].instance:0;
 			instance->s = (instance->len)?branches[i].instance:0;
 		}
 		}
+		if (location_ua) {
+			location_ua->len = branches[i].location_ua_len;
+			location_ua->s
+				= (location_ua->len)?branches[i].location_ua:0;
+		}
 		return branches[i].uri;
 		return branches[i].uri;
 	} else {
 	} else {
 		*len = 0;
 		*len = 0;
@@ -265,6 +270,10 @@ char* get_branch(unsigned int i, int* len, qvalue_t* q, str* dst_uri,
 			instance->s = 0;
 			instance->s = 0;
 			instance->len = 0;
 			instance->len = 0;
 		}
 		}
+		if (location_ua) {
+			location_ua->s = 0;
+			location_ua->len = 0;
+		}
 		return 0;
 		return 0;
 	}
 	}
 }
 }
@@ -276,12 +285,12 @@ char* get_branch(unsigned int i, int* len, qvalue_t* q, str* dst_uri,
  */
  */
 char* next_branch(int* len, qvalue_t* q, str* dst_uri, str* path,
 char* next_branch(int* len, qvalue_t* q, str* dst_uri, str* path,
 		  unsigned int* flags, struct socket_info** force_socket,
 		  unsigned int* flags, struct socket_info** force_socket,
-		  str* ruid, str *instance)
+		  str* ruid, str *instance, str *location_ua)
 {
 {
 	char* ret;
 	char* ret;
 	
 	
 	ret=get_branch(branch_iterator, len, q, dst_uri, path, flags,
 	ret=get_branch(branch_iterator, len, q, dst_uri, path, flags,
-		       force_socket, ruid, instance);
+		       force_socket, ruid, instance, location_ua);
 	if (likely(ret))
 	if (likely(ret))
 		branch_iterator++;
 		branch_iterator++;
 	return ret;
 	return ret;
@@ -316,7 +325,7 @@ int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
 		  qvalue_t q, unsigned int flags,
 		  qvalue_t q, unsigned int flags,
 		  struct socket_info* force_socket,
 		  struct socket_info* force_socket,
 		  str* instance, unsigned int reg_id,
 		  str* instance, unsigned int reg_id,
-		  str* ruid)
+		  str* ruid, str* location_ua)
 {
 {
 	str luri;
 	str luri;
 
 
@@ -416,6 +425,21 @@ int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
 		branches[nr_branches].ruid_len = 0;
 		branches[nr_branches].ruid_len = 0;
 	}
 	}
 
 
+	if (unlikely(location_ua && location_ua->len && location_ua->s)) {
+		if (unlikely(location_ua->len > MAX_UA_SIZE)) {
+			LOG(L_ERR, "too long location_ua: %.*s\n",
+			    location_ua->len, location_ua->s);
+			return -1;
+		}
+		memcpy(branches[nr_branches].location_ua, location_ua->s,
+		       location_ua->len);
+		branches[nr_branches].location_ua[location_ua->len] = 0;
+		branches[nr_branches].location_ua_len = location_ua->len;
+	} else {
+		branches[nr_branches].location_ua[0] = '\0';
+		branches[nr_branches].location_ua_len = 0;
+	}
+	
 	nr_branches++;
 	nr_branches++;
 	return 1;
 	return 1;
 }
 }
@@ -450,7 +474,7 @@ char* print_dset(struct sip_msg* msg, int* len)
 	crt_branch = get_branch_iterator();
 	crt_branch = get_branch_iterator();
 
 
 	init_branch_iterator();
 	init_branch_iterator();
-	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0, 0, 0))) {
+	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0, 0, 0, 0))) {
 		cnt++;
 		cnt++;
 		*len += uri.len;
 		*len += uri.len;
 		if (q != Q_UNSPECIFIED) {
 		if (q != Q_UNSPECIFIED) {
@@ -491,7 +515,7 @@ char* print_dset(struct sip_msg* msg, int* len)
 	}
 	}
 
 
 	init_branch_iterator();
 	init_branch_iterator();
-	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0, 0, 0))) {
+	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0, 0, 0, 0))) {
 		if (i) {
 		if (i) {
 			memcpy(p, CONTACT_DELIM, CONTACT_DELIM_LEN);
 			memcpy(p, CONTACT_DELIM, CONTACT_DELIM_LEN);
 			p += CONTACT_DELIM_LEN;
 			p += CONTACT_DELIM_LEN;

+ 8 - 5
dset.h

@@ -70,6 +70,9 @@ struct branch
     char ruid[MAX_RUID_SIZE];
     char ruid[MAX_RUID_SIZE];
     unsigned int ruid_len;
     unsigned int ruid_len;
 
 
+    char location_ua[MAX_UA_SIZE + 1];
+    unsigned int location_ua_len;
+
     /* Branch flags */
     /* Branch flags */
     flag_t flags;
     flag_t flags;
 };
 };
@@ -93,11 +96,11 @@ int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
 		  qvalue_t q, unsigned int flags,
 		  qvalue_t q, unsigned int flags,
 		  struct socket_info* force_socket,
 		  struct socket_info* force_socket,
 		  str* instance, unsigned int reg_id,
 		  str* instance, unsigned int reg_id,
-		  str* ruid);
+		  str* ruid, str* location_ua);
 
 
 /*! \brief kamailio compatible version */
 /*! \brief kamailio compatible version */
 #define km_append_branch(msg, uri, dst_uri, path, q, flags, force_socket) \
 #define km_append_branch(msg, uri, dst_uri, path, q, flags, force_socket) \
-    append_branch(msg, uri, dst_uri, path, q, flags, force_socket, 0, 0, 0)
+    append_branch(msg, uri, dst_uri, path, q, flags, force_socket, 0, 0, 0, 0)
 
 
 /*! \brief ser compatible append_branch version.
 /*! \brief ser compatible append_branch version.
  *  append_branch version compatible with ser: no path or branch flags support
  *  append_branch version compatible with ser: no path or branch flags support
@@ -114,7 +117,7 @@ static inline int ser_append_branch(struct sip_msg* msg,
     s_uri.len=uri_len;
     s_uri.len=uri_len;
     s_dst_uri.s=dst_uri;
     s_dst_uri.s=dst_uri;
     s_dst_uri.len=dst_uri_len;
     s_dst_uri.len=dst_uri_len;
-    return append_branch(msg, &s_uri, &s_dst_uri, 0, q, 0, force_socket, 0, 0, 0);
+    return append_branch(msg, &s_uri, &s_dst_uri, 0, q, 0, force_socket, 0, 0, 0, 0);
 }
 }
 
 
 
 
@@ -140,12 +143,12 @@ void set_branch_iterator(int n);
  */
  */
 char* next_branch(int* len, qvalue_t* q, str* dst_uri, str* path,
 char* next_branch(int* len, qvalue_t* q, str* dst_uri, str* path,
 		  unsigned int* flags, struct socket_info** force_socket,
 		  unsigned int* flags, struct socket_info** force_socket,
-		  str *ruid, str *instance);
+		  str *ruid, str *instance, str *location_ua);
 
 
 char* get_branch( unsigned int i, int* len, qvalue_t* q, str* dst_uri,
 char* get_branch( unsigned int i, int* len, qvalue_t* q, str* dst_uri,
 		  str* path, unsigned int *flags,
 		  str* path, unsigned int *flags,
 		  struct socket_info** force_socket,
 		  struct socket_info** force_socket,
-		  str* ruid, str *instance);
+		  str* ruid, str *instance, str *location_ua);
 
 
 /*! \brief
 /*! \brief
  * Empty the array of branches
  * Empty the array of branches

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

+ 0 - 14
forward.c

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

+ 0 - 2
globals.h

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

+ 0 - 36
ip_addr.h

@@ -82,9 +82,7 @@ struct net{
 union sockaddr_union{
 union sockaddr_union{
 		struct sockaddr     s;
 		struct sockaddr     s;
 		struct sockaddr_in  sin;
 		struct sockaddr_in  sin;
-	#ifdef USE_IPV6
 		struct sockaddr_in6 sin6;
 		struct sockaddr_in6 sin6;
-	#endif
 };
 };
 
 
 
 
@@ -217,13 +215,9 @@ struct socket_id{
 #ifdef HAVE_SOCKADDR_SA_LEN
 #ifdef HAVE_SOCKADDR_SA_LEN
 #define sockaddru_len(su)	((su).s.sa_len)
 #define sockaddru_len(su)	((su).s.sa_len)
 #else
 #else
-#ifdef USE_IPV6
 #define sockaddru_len(su)	\
 #define sockaddru_len(su)	\
 			(((su).s.sa_family==AF_INET6)?sizeof(struct sockaddr_in6):\
 			(((su).s.sa_family==AF_INET6)?sizeof(struct sockaddr_in6):\
 					sizeof(struct sockaddr_in))
 					sizeof(struct sockaddr_in))
-#else
-#define sockaddru_len(su)	sizeof(struct sockaddr_in)
-#endif /*USE_IPV6*/
 #endif /* HAVE_SOCKADDR_SA_LEN*/
 #endif /* HAVE_SOCKADDR_SA_LEN*/
 	
 	
 /* inits an ip_addr with the addr. info from a hostent structure
 /* 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
 /* gets the protocol family corresponding to a specific address family
  * ( PF_INET - AF_INET, PF_INET6 - AF_INET6, af for others)
  * ( 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))
 #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)
 	if (ip->af==AF_INET)
 		return ip->u.addr32[0]==htonl(INADDR_LOOPBACK);
 		return ip->u.addr32[0]==htonl(INADDR_LOOPBACK);
-#ifdef USE_IPV6
 	else if (ip->af==AF_INET6)
 	else if (ip->af==AF_INET6)
 		return IN6_IS_ADDR_LOOPBACK((struct in6_addr*)ip->u.addr32);
 		return IN6_IS_ADDR_LOOPBACK((struct in6_addr*)ip->u.addr32);
-#endif /* USE_IPV6 */
 	return 0;
 	return 0;
 }
 }
 
 
@@ -311,7 +299,6 @@ inline static void ip_addr_mk_any(int af, struct ip_addr* ip)
 		ip->len=4;
 		ip->len=4;
 		ip->u.addr32[0]=0;
 		ip->u.addr32[0]=0;
 	}
 	}
-#ifdef USE_IPV6
 	else{
 	else{
 		ip->len=16;
 		ip->len=16;
 #if (defined (ULONG_MAX) && ULONG_MAX > 4294967295) || defined LP64
 #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;
 		ip->u.addr32[3]=0;
 #endif /* ULONG_MAX */
 #endif /* ULONG_MAX */
 	}
 	}
-#endif
 }
 }
 
 
 /* returns 1 if ip & net.mask == net.ip ; 0 otherwise & -1 on error 
 /* 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;
 			ip->len=4;
 			memcpy(ip->u.addr, &((struct sockaddr_in*)sa)->sin_addr, 4);
 			memcpy(ip->u.addr, &((struct sockaddr_in*)sa)->sin_addr, 4);
 			break;
 			break;
-#ifdef USE_IPV6
 	case AF_INET6:
 	case AF_INET6:
 			ip->af=AF_INET6;
 			ip->af=AF_INET6;
 			ip->len=16;
 			ip->len=16;
 			memcpy(ip->u.addr, &((struct sockaddr_in6*)sa)->sin6_addr, 16);
 			memcpy(ip->u.addr, &((struct sockaddr_in6*)sa)->sin6_addr, 16);
 			break;
 			break;
-#endif
 	default:
 	default:
 			LOG(L_CRIT, "sockaddr2ip_addr: BUG: unknown address family %d\n",
 			LOG(L_CRIT, "sockaddr2ip_addr: BUG: unknown address family %d\n",
 					sa->sa_family);
 					sa->sa_family);
@@ -390,11 +374,9 @@ static inline int su_cmp(const union sockaddr_union* s1,
 		case AF_INET:
 		case AF_INET:
 			return (s1->sin.sin_port==s2->sin.sin_port)&&
 			return (s1->sin.sin_port==s2->sin.sin_port)&&
 					(memcmp(&s1->sin.sin_addr, &s2->sin.sin_addr, 4)==0);
 					(memcmp(&s1->sin.sin_addr, &s2->sin.sin_addr, 4)==0);
-#ifdef USE_IPV6
 		case AF_INET6:
 		case AF_INET6:
 			return (s1->sin6.sin6_port==s2->sin6.sin6_port)&&
 			return (s1->sin6.sin6_port==s2->sin6.sin6_port)&&
 					(memcmp(&s1->sin6.sin6_addr, &s2->sin6.sin6_addr, 16)==0);
 					(memcmp(&s1->sin6.sin6_addr, &s2->sin6.sin6_addr, 16)==0);
-#endif
 		default:
 		default:
 			LOG(L_CRIT,"su_cmp: BUG: unknown address family %d\n",
 			LOG(L_CRIT,"su_cmp: BUG: unknown address family %d\n",
 						s1->s.sa_family);
 						s1->s.sa_family);
@@ -410,10 +392,8 @@ static inline unsigned short su_getport(const union sockaddr_union* su)
 	switch(su->s.sa_family){
 	switch(su->s.sa_family){
 		case AF_INET:
 		case AF_INET:
 			return ntohs(su->sin.sin_port);
 			return ntohs(su->sin.sin_port);
-#ifdef USE_IPV6
 		case AF_INET6:
 		case AF_INET6:
 			return ntohs(su->sin6.sin6_port);
 			return ntohs(su->sin6.sin6_port);
-#endif
 		default:
 		default:
 			LOG(L_CRIT,"su_get_port: BUG: unknown address family %d\n",
 			LOG(L_CRIT,"su_get_port: BUG: unknown address family %d\n",
 						su->s.sa_family);
 						su->s.sa_family);
@@ -430,11 +410,9 @@ static inline void su_setport(union sockaddr_union* su, unsigned short port)
 		case AF_INET:
 		case AF_INET:
 			su->sin.sin_port=htons(port);
 			su->sin.sin_port=htons(port);
 			break;
 			break;
-#ifdef USE_IPV6
 		case AF_INET6:
 		case AF_INET6:
 			 su->sin6.sin6_port=htons(port);
 			 su->sin6.sin6_port=htons(port);
 			 break;
 			 break;
-#endif
 		default:
 		default:
 			LOG(L_CRIT,"su_set_port: BUG: unknown address family %d\n",
 			LOG(L_CRIT,"su_set_port: BUG: unknown address family %d\n",
 						su->s.sa_family);
 						su->s.sa_family);
@@ -452,13 +430,11 @@ static inline void su2ip_addr(struct ip_addr* ip, union sockaddr_union* su)
 					ip->len=4;
 					ip->len=4;
 					memcpy(ip->u.addr, &su->sin.sin_addr, 4);
 					memcpy(ip->u.addr, &su->sin.sin_addr, 4);
 					break;
 					break;
-#ifdef USE_IPV6
 	case AF_INET6:
 	case AF_INET6:
 					ip->af=AF_INET6;
 					ip->af=AF_INET6;
 					ip->len=16;
 					ip->len=16;
 					memcpy(ip->u.addr, &su->sin6.sin6_addr, 16);
 					memcpy(ip->u.addr, &su->sin6.sin6_addr, 16);
 					break;
 					break;
-#endif
 	default:
 	default:
 					LOG(L_CRIT,"su2ip_addr: BUG: unknown address family %d\n",
 					LOG(L_CRIT,"su2ip_addr: BUG: unknown address family %d\n",
 							su->s.sa_family);
 							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*/
 	memset(su, 0, sizeof(union sockaddr_union));/*needed on freebsd*/
 	su->s.sa_family=ip->af;
 	su->s.sa_family=ip->af;
 	switch(ip->af){
 	switch(ip->af){
-#ifdef USE_IPV6
 	case	AF_INET6:
 	case	AF_INET6:
 		memcpy(&su->sin6.sin6_addr, ip->u.addr, ip->len); 
 		memcpy(&su->sin6.sin6_addr, ip->u.addr, ip->len); 
 		#ifdef HAVE_SOCKADDR_SA_LEN
 		#ifdef HAVE_SOCKADDR_SA_LEN
@@ -487,7 +462,6 @@ static inline int init_su( union sockaddr_union* su,
 		#endif
 		#endif
 		su->sin6.sin6_port=htons(port);
 		su->sin6.sin6_port=htons(port);
 		break;
 		break;
-#endif
 	case AF_INET:
 	case AF_INET:
 		memcpy(&su->sin.sin_addr, ip->u.addr, ip->len);
 		memcpy(&su->sin.sin_addr, ip->u.addr, ip->len);
 		#ifdef HAVE_SOCKADDR_SA_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*/
 	memset(su, 0, sizeof(union sockaddr_union)); /*needed on freebsd*/
 	su->s.sa_family=he->h_addrtype;
 	su->s.sa_family=he->h_addrtype;
 	switch(he->h_addrtype){
 	switch(he->h_addrtype){
-#ifdef USE_IPV6
 	case	AF_INET6:
 	case	AF_INET6:
 		memcpy(&su->sin6.sin6_addr, he->h_addr_list[idx], he->h_length);
 		memcpy(&su->sin6.sin6_addr, he->h_addr_list[idx], he->h_length);
 		#ifdef HAVE_SOCKADDR_SA_LEN
 		#ifdef HAVE_SOCKADDR_SA_LEN
@@ -524,7 +497,6 @@ static inline int hostent2su( union sockaddr_union* su,
 		#endif
 		#endif
 		su->sin6.sin6_port=htons(port);
 		su->sin6.sin6_port=htons(port);
 		break;
 		break;
-#endif
 	case AF_INET:
 	case AF_INET:
 		memcpy(&su->sin.sin_addr, he->h_addr_list[idx], he->h_length);
 		memcpy(&su->sin.sin_addr, he->h_addr_list[idx], he->h_length);
 		#ifdef HAVE_SOCKADDR_SA_LEN
 		#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 IP6_MAX_STR_SIZE 39 /*1234:5678:9012:3456:7890:1234:5678:9012*/
 #define IP4_MAX_STR_SIZE 15 /*123.456.789.012*/
 #define IP4_MAX_STR_SIZE 15 /*123.456.789.012*/
 
 
-#ifdef USE_IPV6
 /* converts a raw ipv6 addr (16 bytes) to ascii */
 /* converts a raw ipv6 addr (16 bytes) to ascii */
 static inline int ip6tosbuf(unsigned char* ip6, char* buff, int len)
 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;
 	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)
 static inline int ip_addr2sbuf(struct ip_addr* ip, char* buff, int len)
 {
 {
 	switch(ip->af){
 	switch(ip->af){
-	#ifdef USE_IPV6
 		case AF_INET6:
 		case AF_INET6:
 			return ip6tosbuf(ip->u.addr, buff, len);
 			return ip6tosbuf(ip->u.addr, buff, len);
 			break;
 			break;
-	#endif /* USE_IPV6 */
 		case AF_INET:
 		case AF_INET:
 			return ip4tosbuf(ip->u.addr, buff, len);
 			return ip4tosbuf(ip->u.addr, buff, len);
 			break;
 			break;
@@ -736,7 +704,6 @@ static inline char* su2a(union sockaddr_union* su, int su_len)
 	static char buf[SU2A_MAX_STR_SIZE];
 	static char buf[SU2A_MAX_STR_SIZE];
 	int offs;
 	int offs;
 
 
-#ifdef USE_IPV6
 	if (unlikely(su->s.sa_family==AF_INET6)){
 	if (unlikely(su->s.sa_family==AF_INET6)){
 		if (unlikely(su_len<sizeof(su->sin6)))
 		if (unlikely(su_len<sizeof(su->sin6)))
 			return "<addr. error>";
 			return "<addr. error>";
@@ -746,7 +713,6 @@ static inline char* su2a(union sockaddr_union* su, int su_len)
 		buf[offs]=']';
 		buf[offs]=']';
 		offs++;
 		offs++;
 	}else
 	}else
-#endif /* USE_IPV6*/
 	if (unlikely(su_len<sizeof(su->sin)))
 	if (unlikely(su_len<sizeof(su->sin)))
 		return "<addr. error>";
 		return "<addr. error>";
 	else
 	else
@@ -766,7 +732,6 @@ static inline char* suip2a(union sockaddr_union* su, int su_len)
 	static char buf[SUIP2A_MAX_STR_SIZE];
 	static char buf[SUIP2A_MAX_STR_SIZE];
 	int offs;
 	int offs;
 
 
-#ifdef USE_IPV6
 	if (unlikely(su->s.sa_family==AF_INET6)){
 	if (unlikely(su->s.sa_family==AF_INET6)){
 		if (unlikely(su_len<sizeof(su->sin6)))
 		if (unlikely(su_len<sizeof(su->sin6)))
 			return "<addr. error>";
 			return "<addr. error>";
@@ -776,7 +741,6 @@ static inline char* suip2a(union sockaddr_union* su, int su_len)
 		buf[offs]=']';
 		buf[offs]=']';
 		offs++;
 		offs++;
 	}else
 	}else
-#endif /* USE_IPV6*/
 	if (unlikely(su_len<sizeof(su->sin)))
 	if (unlikely(su_len<sizeof(su->sin)))
 		return "<addr. error>";
 		return "<addr. error>";
 	else
 	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 tos = IPTOS_LOWDELAY;
 int pmtu_discovery = 0;
 int pmtu_discovery = 0;
 
 
-#ifdef USE_IPV6
 int auto_bind_ipv6 = 0;
 int auto_bind_ipv6 = 0;
-#endif
 
 
 #if 0
 #if 0
 char* names[MAX_LISTEN];              /* our names */
 char* names[MAX_LISTEN];              /* our names */
@@ -1450,11 +1448,9 @@ int main_loop(void)
 			if ((si->address.af==AF_INET)&&
 			if ((si->address.af==AF_INET)&&
 					((sendipv4==0)||(sendipv4->flags&(SI_IS_LO|SI_IS_MCAST))))
 					((sendipv4==0)||(sendipv4->flags&(SI_IS_LO|SI_IS_MCAST))))
 				sendipv4=si;
 				sendipv4=si;
-	#ifdef USE_IPV6
 			if ( ((sendipv6==0)||(sendipv6->flags&(SI_IS_LO|SI_IS_MCAST))) &&
 			if ( ((sendipv6==0)||(sendipv6->flags&(SI_IS_LO|SI_IS_MCAST))) &&
 					(si->address.af==AF_INET6))
 					(si->address.af==AF_INET6))
 				sendipv6=si;
 				sendipv6=si;
-	#endif
 			/* children_no per each socket */
 			/* children_no per each socket */
 			cfg_register_child((si->workers>0)?si->workers:children_no);
 			cfg_register_child((si->workers>0)?si->workers:children_no);
 		}
 		}
@@ -1503,12 +1499,10 @@ int main_loop(void)
 						((sendipv4_sctp==0) ||
 						((sendipv4_sctp==0) ||
 							(sendipv4_sctp->flags&(SI_IS_LO|SI_IS_MCAST))))
 							(sendipv4_sctp->flags&(SI_IS_LO|SI_IS_MCAST))))
 					sendipv4_sctp=si;
 					sendipv4_sctp=si;
-		#ifdef USE_IPV6
 				if( ((sendipv6_sctp==0) || 
 				if( ((sendipv6_sctp==0) || 
 							(sendipv6_sctp->flags&(SI_IS_LO|SI_IS_MCAST))) &&
 							(sendipv6_sctp->flags&(SI_IS_LO|SI_IS_MCAST))) &&
 						(si->address.af==AF_INET6))
 						(si->address.af==AF_INET6))
 					sendipv6_sctp=si;
 					sendipv6_sctp=si;
-		#endif
 				/* sctp_children_no per each socket */
 				/* sctp_children_no per each socket */
 				cfg_register_child((si->workers>0)?si->workers:sctp_children_no);
 				cfg_register_child((si->workers>0)?si->workers:sctp_children_no);
 			}
 			}
@@ -1524,12 +1518,10 @@ int main_loop(void)
 						((sendipv4_tcp==0) ||
 						((sendipv4_tcp==0) ||
 							(sendipv4_tcp->flags&(SI_IS_LO|SI_IS_MCAST))))
 							(sendipv4_tcp->flags&(SI_IS_LO|SI_IS_MCAST))))
 					sendipv4_tcp=si;
 					sendipv4_tcp=si;
-		#ifdef USE_IPV6
 				if( ((sendipv6_tcp==0) ||
 				if( ((sendipv6_tcp==0) ||
 							(sendipv6_tcp->flags&(SI_IS_LO|SI_IS_MCAST))) &&
 							(sendipv6_tcp->flags&(SI_IS_LO|SI_IS_MCAST))) &&
 						(si->address.af==AF_INET6))
 						(si->address.af==AF_INET6))
 					sendipv6_tcp=si;
 					sendipv6_tcp=si;
-		#endif
 			}
 			}
 			/* the number of sockets does not matter */
 			/* the number of sockets does not matter */
 			cfg_register_child(tcp_children_no + 1 /* tcp main */);
 			cfg_register_child(tcp_children_no + 1 /* tcp main */);
@@ -1544,12 +1536,10 @@ int main_loop(void)
 						((sendipv4_tls==0) ||
 						((sendipv4_tls==0) ||
 							(sendipv4_tls->flags&(SI_IS_LO|SI_IS_MCAST))))
 							(sendipv4_tls->flags&(SI_IS_LO|SI_IS_MCAST))))
 					sendipv4_tls=si;
 					sendipv4_tls=si;
-		#ifdef USE_IPV6
 				if( ((sendipv6_tls==0) ||
 				if( ((sendipv6_tls==0) ||
 							(sendipv6_tls->flags&(SI_IS_LO|SI_IS_MCAST))) &&
 							(sendipv6_tls->flags&(SI_IS_LO|SI_IS_MCAST))) &&
 						(si->address.af==AF_INET6))
 						(si->address.af==AF_INET6))
 					sendipv6_tls=si;
 					sendipv6_tls=si;
-		#endif
 			}
 			}
 		}
 		}
 #endif /* USE_TLS */
 #endif /* USE_TLS */

+ 1 - 1
modules/alias_db/alookup.c

@@ -202,7 +202,7 @@ int alias_db_lookup(struct sip_msg* _msg, str table_s)
 		} else {
 		} else {
 			user_s.s = useruri_buf;
 			user_s.s = useruri_buf;
 			if (append_branch(_msg, &user_s, 0, 0, MIN_Q, 0, 0,
 			if (append_branch(_msg, &user_s, 0, 0, MIN_Q, 0, 0,
-					  0, 0, 0) == -1)
+					  0, 0, 0, 0) == -1)
 			{
 			{
 				LM_ERR("error while appending branches\n");
 				LM_ERR("error while appending branches\n");
 				goto err_server;
 				goto err_server;

+ 2 - 2
modules/avpops/avpops_impl.c

@@ -999,7 +999,7 @@ int ops_pushto_avp (struct sip_msg* msg, struct fis_param* dst,
 				/* if is not the first modification, push the current uri as
 				/* if is not the first modification, push the current uri as
 				 * branch */
 				 * branch */
 			    if (append_branch( msg, 0, 0, 0, Q_UNSPECIFIED,
 			    if (append_branch( msg, 0, 0, 0, Q_UNSPECIFIED,
-					       0, 0, 0, 0, 0) != 1)
+					       0, 0, 0, 0, 0, 0) != 1)
 				{
 				{
 					LM_ERR("append_branch action failed\n");
 					LM_ERR("append_branch action failed\n");
 					goto error;
 					goto error;
@@ -1026,7 +1026,7 @@ int ops_pushto_avp (struct sip_msg* msg, struct fis_param* dst,
 			ruri_mark_new(); /* re-use uri for serial forking */
 			ruri_mark_new(); /* re-use uri for serial forking */
 		} else if (dst->opd&AVPOPS_USE_BRANCH) {
 		} else if (dst->opd&AVPOPS_USE_BRANCH) {
 			if (append_branch( msg, &val, 0, 0, Q_UNSPECIFIED, 0,
 			if (append_branch( msg, &val, 0, 0, Q_UNSPECIFIED, 0,
-					   msg->force_send_socket, 0, 0, 0) != 1)
+					   msg->force_send_socket, 0, 0, 0, 0) != 1)
 			{
 			{
 				LM_ERR("append_branch action failed\n");
 				LM_ERR("append_branch action failed\n");
 				goto error;
 				goto error;

+ 1 - 1
modules/corex/corex_lib.c

@@ -71,7 +71,7 @@ int corex_append_branch(sip_msg_t *msg, gparam_t *pu, gparam_t *pq)
 	getbflagsval(0, &branch_flags);
 	getbflagsval(0, &branch_flags);
 	ret = append_branch(msg, (uri.len>0)?&uri:0, &msg->dst_uri,
 	ret = append_branch(msg, (uri.len>0)?&uri:0, &msg->dst_uri,
 			    &msg->path_vec, q, branch_flags,
 			    &msg->path_vec, q, branch_flags,
-			    msg->force_send_socket, 0, 0, 0);
+			    msg->force_send_socket, 0, 0, 0, 0);
 
 
 
 
 	if(uri.len<=0)
 	if(uri.len<=0)

+ 1 - 1
modules/cpl-c/cpl_sig.c

@@ -92,7 +92,7 @@ int cpl_proxy_to_loc_set( struct sip_msg *msg, struct location **locs,
 			(*locs)->addr.uri.len, (*locs)->addr.uri.s, bflags);
 			(*locs)->addr.uri.len, (*locs)->addr.uri.s, bflags);
 		if(append_branch(msg, &(*locs)->addr.uri,
 		if(append_branch(msg, &(*locs)->addr.uri,
 				 &(*locs)->addr.received, 0,
 				 &(*locs)->addr.received, 0,
-				 Q_UNSPECIFIED, bflags, 0, 0, 0, 0)==-1){
+				 Q_UNSPECIFIED, bflags, 0, 0, 0, 0, 0)==-1){
 			LM_ERR("failed when appending branch <%s>\n",
 			LM_ERR("failed when appending branch <%s>\n",
 			       (*locs)->addr.uri.s);
 			       (*locs)->addr.uri.s);
 			goto error;
 			goto error;

+ 1 - 1
modules/dialplan/dialplan.c

@@ -295,7 +295,7 @@ static int dp_update(struct sip_msg * msg, pv_spec_t * src, pv_spec_t * dest,
 
 
 	if(is_route_type(FAILURE_ROUTE)
 	if(is_route_type(FAILURE_ROUTE)
 			&& (dest->type==PVT_RURI || dest->type==PVT_RURI_USERNAME)) {
 			&& (dest->type==PVT_RURI || dest->type==PVT_RURI_USERNAME)) {
-	    if (append_branch(msg, 0, 0, 0, Q_UNSPECIFIED, 0, 0, 0, 0, 0) != 1) {
+	    if (append_branch(msg, 0, 0, 0, Q_UNSPECIFIED, 0, 0, 0, 0, 0, 0) != 1) {
 			LM_ERR("append_branch action failed\n");
 			LM_ERR("append_branch action failed\n");
 			return -1;
 			return -1;
 		}
 		}

+ 1 - 1
modules/domain/domain.c

@@ -142,7 +142,7 @@ int is_uri_host_local(struct sip_msg* _msg, char* _s1, char* _s2)
 	}
 	}
 	return hash_table_lookup(&(_msg->parsed_uri.host), &did, &attrs);
 	return hash_table_lookup(&(_msg->parsed_uri.host), &did, &attrs);
     } else if (is_route_type(FAILURE_ROUTE)) {
     } else if (is_route_type(FAILURE_ROUTE)) {
-	branch.s = get_branch(0, &branch.len, &q, 0, 0, 0, 0, 0, 0);
+	branch.s = get_branch(0, &branch.len, &q, 0, 0, 0, 0, 0, 0, 0);
 	if (branch.s) {
 	if (branch.s) {
 	    if (parse_uri(branch.s, branch.len, &puri) < 0) {
 	    if (parse_uri(branch.s, branch.len, &puri) < 0) {
 		LM_ERR("error while parsing branch URI\n");
 		LM_ERR("error while parsing branch URI\n");

+ 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)
 	if ( ((ip=str2ip(&puri.host))!=0)
-#ifdef USE_IPV6
 	|| ((ip=str2ip6(&puri.host))!=0)
 	|| ((ip=str2ip6(&puri.host))!=0)
-#endif
 	){
 	){
 		pgwa = (*rdata)->pgw_addr_l;
 		pgwa = (*rdata)->pgw_addr_l;
 		while(pgwa) {
 		while(pgwa) {

+ 2 - 2
modules/enum/enum.c

@@ -687,7 +687,7 @@ int do_query(struct sip_msg* _msg, char *user, char *name, str *service) {
 		q = q - 10;
 		q = q - 10;
 		curr_prio = priority;
 		curr_prio = priority;
 	    }
 	    }
-	    if (append_branch(_msg, &result, 0, 0, q, 0, 0, 0, 0, 0) == -1) {
+	    if (append_branch(_msg, &result, 0, 0, q, 0, 0, 0, 0, 0, 0) == -1) {
 		goto done;
 		goto done;
 	    }
 	    }
 	}
 	}
@@ -1137,7 +1137,7 @@ int enum_pv_query_3(struct sip_msg* _msg, char* _sp, char* _suffix,
 				q = q - 10;
 				q = q - 10;
 				curr_prio = priority;
 				curr_prio = priority;
 			}
 			}
-			if (append_branch(_msg, &result, 0, 0, q, 0, 0, 0, 0, 0)
+			if (append_branch(_msg, &result, 0, 0, q, 0, 0, 0, 0, 0, 0)
 			    == -1) {
 			    == -1) {
 				goto done;
 				goto done;
 			}
 			}

+ 1 - 1
modules/exec/exec.c

@@ -168,7 +168,7 @@ int exec_str(struct sip_msg *msg, char *cmd, char *param, int param_len) {
 			}
 			}
 		} else {
 		} else {
 		    if (append_branch(msg, &uri, 0, 0, Q_UNSPECIFIED, 0, 0,
 		    if (append_branch(msg, &uri, 0, 0, Q_UNSPECIFIED, 0, 0,
-				      0, 0, 0) == -1) {
+				      0, 0, 0, 0) == -1) {
 				LM_ERR("append_branch failed; too many or too long URIs?\n");
 				LM_ERR("append_branch failed; too many or too long URIs?\n");
 				goto error02;
 				goto error02;
 			}
 			}

+ 1 - 1
modules/ims_icscf/scscf_list.c

@@ -384,7 +384,7 @@ int I_scscf_select(struct sip_msg* msg, char* str1, char* str2) {
         } else {
         } else {
             /* subsequent */
             /* subsequent */
             req = msg;
             req = msg;
-            append_branch(req, &scscf_name, 0, 0, Q_UNSPECIFIED, 0, 0, 0, 0, 0);
+            append_branch(req, &scscf_name, 0, 0, Q_UNSPECIFIED, 0, 0, 0, 0, 0, 0);
             result = CSCF_RETURN_TRUE;
             result = CSCF_RETURN_TRUE;
         }
         }
     } else {
     } else {

+ 1 - 1
modules/ims_isc/isc.c

@@ -76,7 +76,7 @@ int isc_forward(struct sip_msg *msg, isc_match *m, isc_mark *mark) {
 
 
 	/* append branch if last trigger failed */
 	/* append branch if last trigger failed */
 	if (is_route_type(FAILURE_ROUTE))
 	if (is_route_type(FAILURE_ROUTE))
-		append_branch(msg, &(msg->first_line.u.request.uri), &(msg->dst_uri), 0, Q_UNSPECIFIED, 0, 0, 0, 0, 0);
+		append_branch(msg, &(msg->first_line.u.request.uri), &(msg->dst_uri), 0, Q_UNSPECIFIED, 0, 0, 0, 0, 0, 0);
 
 
 	// Determines the tm transaction identifiers.
 	// Determines the tm transaction identifiers.
 	// If no transaction, then creates one
 	// If no transaction, then creates one

+ 0 - 1
modules/ims_registrar_scscf/reg_mod.h

@@ -62,7 +62,6 @@
 #define USERNAME_MAX_SIZE      64
 #define USERNAME_MAX_SIZE      64
 #define DOMAIN_MAX_SIZE        128
 #define DOMAIN_MAX_SIZE        128
 #define CALLID_MAX_SIZE        255
 #define CALLID_MAX_SIZE        255
-#define UA_MAX_SIZE            255
 
 
 #define PATH_MODE_STRICT	2
 #define PATH_MODE_STRICT	2
 #define PATH_MODE_LAZY		1
 #define PATH_MODE_LAZY		1

+ 1 - 1
modules/ims_registrar_scscf/save.c

@@ -259,7 +259,7 @@ static inline ucontact_info_t* pack_ci(struct sip_msg* _m, contact_t* _c, unsign
 
 
         /* additional info from message */
         /* additional info from message */
         if (parse_headers(_m, HDR_USERAGENT_F, 0) != -1 && _m->user_agent
         if (parse_headers(_m, HDR_USERAGENT_F, 0) != -1 && _m->user_agent
-                && _m->user_agent->body.len > 0 && _m->user_agent->body.len < UA_MAX_SIZE) {
+                && _m->user_agent->body.len > 0 && _m->user_agent->body.len < MAX_UA_SIZE) {
             ci.user_agent = &_m->user_agent->body;
             ci.user_agent = &_m->user_agent->body;
         } else {
         } else {
             ci.user_agent = &no_ua;
             ci.user_agent = &no_ua;

+ 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 */
 		/* 123.123.123.123 */
 		ip_addr = *ip_p;
 		ip_addr = *ip_p;
 	    }
 	    }
-#ifdef USE_IPV6
 	    else if ((ip_p = str2ip6(&ip_string))) {
 	    else if ((ip_p = str2ip6(&ip_string))) {
 		/* fe80::123:4567:89ab:cdef and [fe80::123:4567:89ab:cdef] */
 		/* fe80::123:4567:89ab:cdef and [fe80::123:4567:89ab:cdef] */
 		ip_addr = *ip_p;
 		ip_addr = *ip_p;
 	    }
 	    }
-#endif
 	    else if (inet_aton(ip_string.s, &in_addr) == 0) {
 	    else if (inet_aton(ip_string.s, &in_addr) == 0) {
 		/* backwards compatibility for integer or hex notations */
 		/* backwards compatibility for integer or hex notations */
 		ip_addr.u.addr32[0] = in_addr.s_addr;
 		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);
 	string = int2str(ip_addr->u.addr32[0], &len);
 	append_str(at, string, len);
 	append_str(at, string, len);
     }
     }
-#ifdef USE_IPV6
     else if (ip_addr->af == AF_INET6 && !ip_addr_any(ip_addr)) {
     else if (ip_addr->af == AF_INET6 && !ip_addr_any(ip_addr)) {
 	append_chr(at, '[');
 	append_chr(at, '[');
 	at += ip6tosbuf(ip_addr->u.addr, at, MAX_URI_LEN - (at - value));
 	at += ip6tosbuf(ip_addr->u.addr, at, MAX_URI_LEN - (at - value));
 	append_chr(at, ']');
 	append_chr(at, ']');
     }
     }
-#endif
     append_chr(at, '|');
     append_chr(at, '|');
     /* hostname */
     /* hostname */
     append_str(at, hostname, hostname_len);
     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 (s.len > 0) {
 	if ((ip = str2ip(&s)) != NULL)
 	if ((ip = str2ip(&s)) != NULL)
 	    *addr = *ip;
 	    *addr = *ip;
-#ifdef USE_IPV6
 	else if ((ip = str2ip6(&s)) != NULL)
 	else if ((ip = str2ip6(&s)) != NULL)
 	    *addr = *ip;
 	    *addr = *ip;
-#endif
 	else {
 	else {
 	    str2int(&s, &u);
 	    str2int(&s, &u);
 	    addr->af = AF_INET;
 	    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);
     addr_str.len = strlen(_addr);
     if ((ip = str2ip(&addr_str)) != NULL)
     if ((ip = str2ip(&addr_str)) != NULL)
 	src_addr = *ip;
 	src_addr = *ip;
-#ifdef USE_IPV6
     else if ((ip = str2ip6(&addr_str)) != NULL)
     else if ((ip = str2ip6(&addr_str)) != NULL)
 	src_addr = *ip;
 	src_addr = *ip;
-#endif
     else {
     else {
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
 	return -1;
 	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);
     addr_str.len = strlen(_addr);
     if ((ip = str2ip(&addr_str)) != NULL)
     if ((ip = str2ip(&addr_str)) != NULL)
 	src_addr = *ip;
 	src_addr = *ip;
-#ifdef USE_IPV6
     else if ((ip = str2ip6(&addr_str)) != NULL)
     else if ((ip = str2ip6(&addr_str)) != NULL)
 	src_addr = *ip;
 	src_addr = *ip;
-#endif
     else {
     else {
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
 	return -1;
 	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)
     if ((ip = str2ip(&(_m->parsed_uri.host))) != NULL)
 	dst_addr = *ip;
 	dst_addr = *ip;
-#ifdef USE_IPV6
     else if ((ip = str2ip6(&(_m->parsed_uri.host))) != NULL)
     else if ((ip = str2ip6(&(_m->parsed_uri.host))) != NULL)
 	dst_addr = *ip;
 	dst_addr = *ip;
-#endif
     else {
     else {
 	LM_DBG("request is not going to gw "
 	LM_DBG("request is not going to gw "
 	       "(Request-URI host is not an IP address)\n");
 	       "(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);
     addr_str.len = strlen(_addr);
     if ((ip = str2ip(&addr_str)) != NULL)
     if ((ip = str2ip(&addr_str)) != NULL)
 	dst_addr = *ip;
 	dst_addr = *ip;
-#ifdef USE_IPV6
     else if ((ip = str2ip(&addr_str)) != NULL)
     else if ((ip = str2ip(&addr_str)) != NULL)
 	dst_addr = *ip;
 	dst_addr = *ip;
-#endif
     else {
     else {
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
 	return -1;
 	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)
     if ((ip = str2ip(&(_m->parsed_uri.host))) != NULL)
 	dst_addr = *ip;
 	dst_addr = *ip;
-#ifdef USE_IPV6
     else if ((ip = str2ip6(&(_m->parsed_uri.host))) != NULL)
     else if ((ip = str2ip6(&(_m->parsed_uri.host))) != NULL)
 	dst_addr = *ip;
 	dst_addr = *ip;
-#endif
     else {
     else {
 	LM_DBG("request is not going to gw "
 	LM_DBG("request is not going to gw "
 	       "(Request-URI host is not an IP address)\n");
 	       "(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);
     addr_str.len = strlen(_addr);
     if ((ip = str2ip(&addr_str)) != NULL)
     if ((ip = str2ip(&addr_str)) != NULL)
 	dst_addr = *ip;
 	dst_addr = *ip;
-#ifdef USE_IPV6
     if ((ip = str2ip6(&addr_str)) != NULL)
     if ((ip = str2ip6(&addr_str)) != NULL)
 	dst_addr = *ip;
 	dst_addr = *ip;
-#endif
     else {
     else {
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
 	LM_ERR("addr param value %s is not an IP address\n", _addr);
 	return -1;
 	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;
 				goto err_rx;
 			}
 			}
 			break;
 			break;
-#ifdef USE_IPV6
 	case AF_INET6: 
 	case AF_INET6: 
 			if(bind(socks->rx_sock, (struct sockaddr*)&addr->udp_addr.sin6, sizeof(addr->udp_addr)) < 0) {
 			if(bind(socks->rx_sock, (struct sockaddr*)&addr->udp_addr.sin6, sizeof(addr->udp_addr)) < 0) {
 				LM_ERR("bind: %s\n", strerror(errno));
 				LM_ERR("bind: %s\n", strerror(errno));
 				goto err_rx;
 				goto err_rx;
 			}
 			}
 			break;
 			break;
-#endif
 	default:
 	default:
 			LM_ERR("domain not supported\n");
 			LM_ERR("domain not supported\n");
 			goto err_both;
 			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;
 	return -1;
     }
     }
     if ((str2ip(&ip_str) == NULL)
     if ((str2ip(&ip_str) == NULL)
-#ifdef USE_IPV6
 	&& (str2ip6(&ip_str) == NULL)
 	&& (str2ip6(&ip_str) == NULL)
-#endif
 	) {
 	) {
 	LM_ERR("ip param value %s is not valid IP address\n", ip_str.s);
 	LM_ERR("ip param value %s is not valid IP address\n", ip_str.s);
 	return -1;
 	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 */
 	/* try to figure out INET class */
 	if(ips->s[0] == '[' || memchr(ips->s, ':', ips->len)!=NULL)
 	if(ips->s[0] == '[' || memchr(ips->s, ':', ips->len)!=NULL)
 	{
 	{
-#ifdef USE_IPV6
 		/* IPv6 */
 		/* IPv6 */
 		return str2ip6(ips);
 		return str2ip6(ips);
-#else
-		return 0;
-#endif
 	} else {
 	} else {
 		/* IPv4 */
 		/* IPv4 */
 		return str2ip(ips);
 		return str2ip(ips);

+ 1 - 1
modules/permissions/permissions.c

@@ -406,7 +406,7 @@ static int check_routing(struct sip_msg* msg, int idx)
 	}
 	}
 
 
 check_branches:
 check_branches:
-	for( br_idx=0 ; (branch.s=get_branch(br_idx,&branch.len,&q,0,0,0,0,0,0))!=0 ;
+	for( br_idx=0 ; (branch.s=get_branch(br_idx,&branch.len,&q,0,0,0,0,0,0,0))!=0 ;
 			br_idx++ ) {
 			br_idx++ ) {
 		uri_str = get_plain_uri(&branch);
 		uri_str = get_plain_uri(&branch);
 		if (!uri_str) {
 		if (!uri_str) {

+ 3 - 0
modules/pv/pv.c

@@ -416,6 +416,9 @@ static pv_export_t mod_pvs[] = {
 	{{"ruid", (sizeof("ruid")-1)}, /* */
 	{{"ruid", (sizeof("ruid")-1)}, /* */
 		PVT_OTHER, pv_get_ruid, 0,
 		PVT_OTHER, pv_get_ruid, 0,
 		0, 0, 0, 0},
 		0, 0, 0, 0},
+	{{"location_ua", (sizeof("location_ua")-1)}, /* */
+		PVT_OTHER, pv_get_location_ua, 0,
+		0, 0, 0, 0},
 
 
 	{ {"shv", (sizeof("shv")-1)}, PVT_OTHER, pv_get_shvar,
 	{ {"shv", (sizeof("shv")-1)}, PVT_OTHER, pv_get_shvar,
 		pv_set_shvar, pv_parse_shvar_name, 0, 0, 0},
 		pv_set_shvar, pv_parse_shvar_name, 0, 0, 0},

+ 11 - 1
modules/pv/pv_branch.c

@@ -41,6 +41,7 @@ int pv_get_branchx(struct sip_msg *msg, pv_param_t *param,
 	unsigned int fl = 0;
 	unsigned int fl = 0;
 	struct socket_info* fsocket = NULL;
 	struct socket_info* fsocket = NULL;
 	str ruid;
 	str ruid;
+	str location_ua;
 
 
 	/* get the index */
 	/* get the index */
 	if(pv_get_spec_index(msg, param, &idx, &idxf)!=0)
 	if(pv_get_spec_index(msg, param, &idx, &idxf)!=0)
@@ -49,7 +50,7 @@ int pv_get_branchx(struct sip_msg *msg, pv_param_t *param,
 		return pv_get_null(msg, param, res);
 		return pv_get_null(msg, param, res);
 	}
 	}
 
 
-	uri.s = get_branch(idx, &uri.len, &lq, &duri, &path, &fl, &fsocket, &ruid, 0);
+	uri.s = get_branch(idx, &uri.len, &lq, &duri, &path, &fl, &fsocket, &ruid, 0, &location_ua);
 
 
 	/* branch(count) doesn't need a valid branch, everything else does */
 	/* branch(count) doesn't need a valid branch, everything else does */
 	if(uri.s == 0 && ( param->pvn.u.isname.name.n != 5/* count*/ ))
 	if(uri.s == 0 && ( param->pvn.u.isname.name.n != 5/* count*/ ))
@@ -84,6 +85,10 @@ int pv_get_branchx(struct sip_msg *msg, pv_param_t *param,
 			if(ruid.len==0)
 			if(ruid.len==0)
 				return pv_get_null(msg, param, res);
 				return pv_get_null(msg, param, res);
 			return pv_get_strval(msg, param, res, &ruid);
 			return pv_get_strval(msg, param, res, &ruid);
+		case 8: /* location_ua */
+			if(location_ua.len==0)
+				return pv_get_null(msg, param, res);
+			return pv_get_strval(msg, param, res, &location_ua);
 		default:
 		default:
 			/* 0 - uri */
 			/* 0 - uri */
 			return pv_get_strval(msg, param, res, &uri);
 			return pv_get_strval(msg, param, res, &uri);
@@ -253,6 +258,9 @@ int pv_set_branchx(struct sip_msg* msg, pv_param_t *param,
 		case 7: /* ruid */
 		case 7: /* ruid */
 			/* do nothing - cannot set the ruid */
 			/* do nothing - cannot set the ruid */
 		break;
 		break;
+		case 8: /* location_ua */
+			/* do nothing - cannot set the location_ua */
+		break;
 		default:
 		default:
 			/* 0 - uri */
 			/* 0 - uri */
 			if(val==NULL || (val->flags&PV_VAL_NULL))
 			if(val==NULL || (val->flags&PV_VAL_NULL))
@@ -316,6 +324,8 @@ int pv_parse_branchx_name(pv_spec_p sp, str *in)
 		case 11: 
 		case 11: 
 			if(strncmp(in->s, "send_socket", 11)==0)
 			if(strncmp(in->s, "send_socket", 11)==0)
 				sp->pvp.pvn.u.isname.name.n = 4;
 				sp->pvp.pvn.u.isname.name.n = 4;
+			else if(strncmp(in->s, "location_ua", 11)==0)
+				sp->pvp.pvn.u.isname.name.n = 8;
 			else goto error;
 			else goto error;
 		break;
 		break;
 		case 5: 
 		case 5: 

+ 21 - 3
modules/pv/pv_core.c

@@ -1359,7 +1359,7 @@ int pv_get_branch(struct sip_msg *msg, pv_param_t *param,
 		return pv_get_null(msg, param, res);
 		return pv_get_null(msg, param, res);
 
 
 
 
-	branch.s = get_branch(0, &branch.len, &q, 0, 0, 0, 0, 0, 0);
+	branch.s = get_branch(0, &branch.len, &q, 0, 0, 0, 0, 0, 0, 0);
 	if (!branch.s) {
 	if (!branch.s) {
 		return pv_get_null(msg, param, res);
 		return pv_get_null(msg, param, res);
 	}
 	}
@@ -1388,7 +1388,7 @@ int pv_get_branches(struct sip_msg *msg, pv_param_t *param,
   
   
 	cnt = s.len = 0;
 	cnt = s.len = 0;
 
 
-	while ((uri.s = get_branch(cnt, &uri.len, &q, 0, 0, 0, 0, 0, 0)))
+	while ((uri.s = get_branch(cnt, &uri.len, &q, 0, 0, 0, 0, 0, 0, 0)))
 	{
 	{
 		cnt++;
 		cnt++;
 		s.len += uri.len;
 		s.len += uri.len;
@@ -1412,7 +1412,7 @@ int pv_get_branches(struct sip_msg *msg, pv_param_t *param,
 	i = 0;
 	i = 0;
 	p = pv_local_buf;
 	p = pv_local_buf;
 
 
-	while ((uri.s = get_branch(i, &uri.len, &q, 0, 0, 0, 0, 0, 0)))
+	while ((uri.s = get_branch(i, &uri.len, &q, 0, 0, 0, 0, 0, 0, 0)))
 	{
 	{
 		if (i)
 		if (i)
 		{
 		{
@@ -1823,6 +1823,24 @@ int pv_get_ruid(struct sip_msg *msg, pv_param_t *param,
 	return pv_get_strval(msg, param, res, &msg->ruid);
 	return pv_get_strval(msg, param, res, &msg->ruid);
 }
 }
 
 
+int pv_get_location_ua(struct sip_msg *msg, pv_param_t *param,
+		pv_value_t *res)
+{
+	if(msg==NULL)
+		return -1;
+
+	if(msg->first_line.type == SIP_REPLY)
+		return pv_get_null(msg, param, res);
+
+	if(msg->location_ua.len==0) 
+	{
+		LM_DBG("no location_ua\n");
+		return pv_get_null(msg, param, res);
+	}
+	
+	return pv_get_strval(msg, param, res, &msg->location_ua);
+}
+
 int pv_get_tcpconn_id(struct sip_msg *msg, pv_param_t *param,
 int pv_get_tcpconn_id(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res)
 		pv_value_t *res)
 {
 {

+ 3 - 0
modules/pv/pv_core.h

@@ -217,6 +217,9 @@ int pv_get_cnt(struct sip_msg *msg, pv_param_t *param,
 int pv_get_ruid(struct sip_msg *msg, pv_param_t *param,
 int pv_get_ruid(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res);
 		pv_value_t *res);
 
 
+int pv_get_location_ua(struct sip_msg *msg, pv_param_t *param,
+		pv_value_t *res);
+
 int pv_get_tcpconn_id(struct sip_msg *msg, pv_param_t *param,
 int pv_get_tcpconn_id(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res);
 		pv_value_t *res);
 
 

+ 12 - 1
modules/registrar/lookup.c

@@ -280,6 +280,13 @@ int lookup(struct sip_msg* _m, udomain_t* _d, str* _uri)
 		    }
 		    }
 		}
 		}
 
 
+		if (ptr->user_agent.len) {
+		    if (set_ua(_m, &(ptr->user_agent)) < 0) {
+				ret = -3;
+				goto done;
+		    }
+		}
+
 		set_ruri_q(ptr->q);
 		set_ruri_q(ptr->q);
 
 
 		old_bflags = 0;
 		old_bflags = 0;
@@ -324,7 +331,7 @@ int lookup(struct sip_msg* _m, udomain_t* _d, str* _uri)
 					  ptr->sock,
 					  ptr->sock,
 					  ptr->instance.len?&(ptr->instance):0,
 					  ptr->instance.len?&(ptr->instance):0,
 				          ptr->instance.len?ptr->reg_id:0,
 				          ptr->instance.len?ptr->reg_id:0,
-					  &ptr->ruid)
+					  &ptr->ruid, &ptr->user_agent)
 			    == -1) {
 			    == -1) {
 				LM_ERR("failed to append a branch\n");
 				LM_ERR("failed to append a branch\n");
 				/* Also give a chance to the next branches*/
 				/* Also give a chance to the next branches*/
@@ -360,6 +367,7 @@ int reset_ruri_branch(sip_msg_t *msg)
 	reset_instance(msg);
 	reset_instance(msg);
 	msg->reg_id = 0;
 	msg->reg_id = 0;
 	reset_ruid(msg);
 	reset_ruid(msg);
+	reset_ua(msg);
 	return 0;
 	return 0;
 }
 }
 
 
@@ -385,6 +393,7 @@ int lookup_branches(sip_msg_t *msg, udomain_t *d)
 	str ruri_b_instance = {0};
 	str ruri_b_instance = {0};
 	unsigned int ruri_b_reg_id = 0;
 	unsigned int ruri_b_reg_id = 0;
 	str ruri_b_ruid = {0};
 	str ruri_b_ruid = {0};
+	str ruri_b_ua = {0};
 	branch_t *crt = NULL;
 	branch_t *crt = NULL;
 
 
 	ret = 1;
 	ret = 1;
@@ -410,6 +419,7 @@ int lookup_branches(sip_msg_t *msg, udomain_t *d)
 	ruri_b_instance = msg->instance;
 	ruri_b_instance = msg->instance;
 	ruri_b_reg_id = msg->reg_id;
 	ruri_b_reg_id = msg->reg_id;
 	ruri_b_ruid = msg->ruid;
 	ruri_b_ruid = msg->ruid;
+	ruri_b_ua = msg->location_ua;
 	reset_ruri_branch(msg);
 	reset_ruri_branch(msg);
 
 
 	for(i=0; i<nr_branches_start; i++) {
 	for(i=0; i<nr_branches_start; i++) {
@@ -490,6 +500,7 @@ done:
 	msg->instance = ruri_b_instance;
 	msg->instance = ruri_b_instance;
 	msg->reg_id = ruri_b_reg_id;
 	msg->reg_id = ruri_b_reg_id;
 	msg->ruid = ruri_b_ruid;
 	msg->ruid = ruri_b_ruid;
+	msg->location_ua = ruri_b_ua;
 
 
 	return (found)?1:ret;
 	return (found)?1:ret;
 }
 }

+ 0 - 1
modules/registrar/reg_mod.h

@@ -56,7 +56,6 @@
 #define USERNAME_MAX_SIZE      64
 #define USERNAME_MAX_SIZE      64
 #define DOMAIN_MAX_SIZE        128
 #define DOMAIN_MAX_SIZE        128
 #define CALLID_MAX_SIZE        255
 #define CALLID_MAX_SIZE        255
-#define UA_MAX_SIZE            255
 
 
 #define PATH_MODE_STRICT	2
 #define PATH_MODE_STRICT	2
 #define PATH_MODE_LAZY		1
 #define PATH_MODE_LAZY		1

+ 1 - 1
modules/registrar/save.c

@@ -265,7 +265,7 @@ static inline ucontact_info_t* pack_ci( struct sip_msg* _m, contact_t* _c, unsig
 
 
 		/* additional info from message */
 		/* additional info from message */
 		if (parse_headers(_m, HDR_USERAGENT_F, 0) != -1 && _m->user_agent &&
 		if (parse_headers(_m, HDR_USERAGENT_F, 0) != -1 && _m->user_agent &&
-		_m->user_agent->body.len>0 && _m->user_agent->body.len<UA_MAX_SIZE) {
+		_m->user_agent->body.len>0 && _m->user_agent->body.len<MAX_UA_SIZE) {
 			ci.user_agent = &_m->user_agent->body;
 			ci.user_agent = &_m->user_agent->body;
 		} else {
 		} else {
 			ci.user_agent = &no_ua;
 			ci.user_agent = &no_ua;

+ 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;
 	struct hep_timehdr* heptime_tmp = NULL;
         memset(heptime, 0, sizeof(struct hep_timehdr));
         memset(heptime, 0, sizeof(struct hep_timehdr));
 
 
-#ifdef USE_IPV6
         struct hep_ip6hdr *hepip6h = NULL;
         struct hep_ip6hdr *hepip6h = NULL;
-#endif /* USE_IPV6 */
 
 
 	hep_offset = 0; 
 	hep_offset = 0; 
 	
 	
@@ -117,11 +115,9 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){
         	case AF_INET:
         	case AF_INET:
                 	hl += sizeof(struct hep_iphdr);
                 	hl += sizeof(struct hep_iphdr);
                         break;
                         break;
-#ifdef USE_IPV6
 		case AF_INET6:
 		case AF_INET6:
                 	hl += sizeof(struct hep_ip6hdr);
                 	hl += sizeof(struct hep_ip6hdr);
                         break;
                         break;
-#endif /* USE_IPV6 */
 		default:
 		default:
                         LOG(L_ERR, "ERROR: sipcapture:hep_msg_received:  unsupported family [%d]\n", heph->hp_f);
                         LOG(L_ERR, "ERROR: sipcapture:hep_msg_received:  unsupported family [%d]\n", heph->hp_f);
                         return -1;
                         return -1;
@@ -151,13 +147,11 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){
                 	hep_offset+=sizeof(struct hep_iphdr);
                 	hep_offset+=sizeof(struct hep_iphdr);
                         hepiph = (struct hep_iphdr*) hep_ip;
                         hepiph = (struct hep_iphdr*) hep_ip;
                         break;
                         break;
-#ifdef USE_IPV6
 
 
 		case AF_INET6:
 		case AF_INET6:
                 	hep_offset+=sizeof(struct hep_ip6hdr);
                 	hep_offset+=sizeof(struct hep_ip6hdr);
                         hepip6h = (struct hep_ip6hdr*) hep_ip;
                         hepip6h = (struct hep_ip6hdr*) hep_ip;
                         break;
                         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(&dst_ip.u.addr, &hepiph->hp_dst, 4);
                         memcpy(&src_ip.u.addr, &hepiph->hp_src, 4);
                         memcpy(&src_ip.u.addr, &hepiph->hp_src, 4);
                         break;
                         break;
-#ifdef USE_IPV6
 
 
 		case AF_INET6:
 		case AF_INET6:
                 	dst_ip.af = src_ip.af = 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);
                         memcpy(&src_ip.u.addr, &hepip6h->hp6_src, 16);
                         break;
                         break;
 
 
-#endif /* USE_IPV6 */
 	}
 	}
 
 
         ri->src_ip = src_ip;
         ri->src_ip = src_ip;
@@ -338,7 +330,6 @@ int parsing_hepv3_message(char *buf, unsigned int len) {
                                         totelem++;
                                         totelem++;
 
 
                                         break;
                                         break;
-#ifdef USE_IPV6                                                     
                                 case 5:
                                 case 5:
                                         hg->hep_src_ip6  = (hep_chunk_ip6_t *) (tmp);
                                         hg->hep_src_ip6  = (hep_chunk_ip6_t *) (tmp);
                                         i+=chunk_length;
                                         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);
 				        memcpy(dst_ip.u.addr, &hg->hep_dst_ip6->data, 16);
 				        totelem++;
 				        totelem++;
                                         break;
                                         break;
-#endif                                             
         
         
                                 case 7:
                                 case 7:
                                         hg->src_port  = (hep_chunk_uint16_t *) (tmp);
                                         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 */
    u_int16_t captid;          /* Capture ID node */
 };
 };
 
 
-#ifdef USE_IPV6
 struct hep_ip6hdr {
 struct hep_ip6hdr {
         struct in6_addr hp6_src;        /* source address */
         struct in6_addr hp6_src;        /* source address */
         struct in6_addr hp6_dst;        /* destination address */
         struct in6_addr hp6_dst;        /* destination address */
 };
 };
-#endif
 
 
 /* HEPv3 types */
 /* HEPv3 types */
 
 
@@ -115,12 +113,10 @@ struct hep_chunk_ip4 {
 
 
 typedef struct hep_chunk_ip4 hep_chunk_ip4_t;
 typedef struct hep_chunk_ip4 hep_chunk_ip4_t;
 
 
-#ifdef USE_IPV6
 struct hep_chunk_ip6 {
 struct hep_chunk_ip6 {
        hep_chunk_t chunk;
        hep_chunk_t chunk;
        struct in6_addr data;
        struct in6_addr data;
 } __attribute__((packed));
 } __attribute__((packed));
-#endif
 
 
 typedef struct hep_chunk_ip6 hep_chunk_ip6_t;
 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_uint32_t *time_usec;
         hep_chunk_ip4_t    *hep_src_ip4;
         hep_chunk_ip4_t    *hep_src_ip4;
         hep_chunk_ip4_t	    *hep_dst_ip4;
         hep_chunk_ip4_t	    *hep_dst_ip4;
-#ifdef USE_IPV6
         hep_chunk_ip6_t    *hep_src_ip6;
         hep_chunk_ip6_t    *hep_src_ip6;
         hep_chunk_ip6_t    *hep_dst_ip6;
         hep_chunk_ip6_t    *hep_dst_ip6;
-#endif
         hep_chunk_uint8_t  *proto_t;
         hep_chunk_uint8_t  *proto_t;
         hep_chunk_uint32_t *capt_id;
         hep_chunk_uint32_t *capt_id;
         hep_chunk_uint16_t *keep_tm;
         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);
 		register_procs(raw_sock_children);
 		                		
 		                		
 		if(extract_host_port() && (((ip=str2ip(&raw_socket_listen)) == NULL)
 		if(extract_host_port() && (((ip=str2ip(&raw_socket_listen)) == NULL)
-#ifdef  USE_IPV6
 		               && ((ip=str2ip6(&raw_socket_listen)) == NULL)
 		               && ((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); 
 			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 timeval tvb;
 	struct timezone tz;
 	struct timezone tz;
 	                 
 	                 
-#if USE_IPV6
 	struct hep_ip6hdr hep_ip6header;
 	struct hep_ip6hdr hep_ip6header;
-#endif
 
 
 	if(body->s==NULL || body->len <= 0)
 	if(body->s==NULL || body->len <= 0)
 		return -1;
 		return -1;
@@ -1533,11 +1531,7 @@ static int trace_send_hep_duplicate(str *body, str *from, str *to)
 
 
 	/* message length */
 	/* message length */
 	len = body->len 
 	len = body->len 
-#if USE_IPV6
 		+ sizeof(struct hep_ip6hdr)
 		+ sizeof(struct hep_ip6hdr)
-#else
-		+ sizeof(struct hep_iphdr)          
-#endif
 		+ sizeof(struct hep_hdr) + sizeof(struct hep_timehdr);;
 		+ 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);
 		len = sizeof(struct hep_iphdr);
 	}
 	}
-#ifdef USE_IPV6
 	else if (from_su.s.sa_family==AF_INET6){
 	else if (from_su.s.sa_family==AF_INET6){
 		/* prepare the hep6 headers */
 		/* 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);
 		len = sizeof(struct hep_ip6hdr);
 	}
 	}
-#endif /* USE_IPV6 */
 	else {
 	else {
 		LOG(L_ERR, "ERROR: trace_send_hep_duplicate: Unsupported protocol family\n");
 		LOG(L_ERR, "ERROR: trace_send_hep_duplicate: Unsupported protocol family\n");
 		goto error;;
 		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));
 		memcpy((void*)buffer + buflen, &hep_ipheader, sizeof(struct hep_iphdr));
 		buflen += sizeof(struct hep_iphdr);
 		buflen += sizeof(struct hep_iphdr);
 	}
 	}
-#if USE_IPV6
 	else {
 	else {
 		memcpy((void*)buffer+buflen, &hep_ip6header, sizeof(struct hep_ip6hdr));
 		memcpy((void*)buffer+buflen, &hep_ip6header, sizeof(struct hep_ip6hdr));
 		buflen += sizeof(struct hep_ip6hdr);
 		buflen += sizeof(struct hep_ip6hdr);
 	}
 	}
-#endif /* USE_IPV6 */
 
 
 	if(hep_version == 2) {
 	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 */
 	/* check if it's an ip address */
 	if (((ip=str2ip(&host_uri))!=0)
 	if (((ip=str2ip(&host_uri))!=0)
-#ifdef  USE_IPV6
 			|| ((ip=str2ip6(&host_uri))!=0)
 			|| ((ip=str2ip6(&host_uri))!=0)
-#endif
 	   ) {
 	   ) {
 		ip_addr2su(tmp_su, ip, ntohs(port_no));
 		ip_addr2su(tmp_su, ip, ntohs(port_no));
 		return 0;	
 		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;
 	struct stun_attr attr;
 	int		 ip_struct_len;
 	int		 ip_struct_len;
-#ifdef USE_IPV6
 	UINT_T	 id[IP_ADDR];
 	UINT_T	 id[IP_ADDR];
 	int i;
 	int i;
-#endif /* USE_IPV6 */ 
 	
 	
 	ip_struct_len = 0;
 	ip_struct_len = 0;
 	attr.type = htons(type);
 	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] = (do_xor) ? 
 				res->ip_addr.ip[0] ^ htonl(MAGIC_COOKIE) : res->ip_addr.ip[0];
 				res->ip_addr.ip[0] ^ htonl(MAGIC_COOKIE) : res->ip_addr.ip[0];
 			break;
 			break;
-#ifdef USE_IPV6
 		case AF_INET6:
 		case AF_INET6:
 			ip_struct_len = sizeof(struct stun_ip_addr);
 			ip_struct_len = sizeof(struct stun_ip_addr);
 			res->ip_addr.family = htons(IPV6_FAMILY);
 			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];
 							res->ip_addr.ip[i] ^ id[i] : res->ip_addr.ip[i];
 			}
 			}
 			break;
 			break;
-#endif /* USE_IPV6 */ 
 		default:
 		default:
 			break;
 			break;
 	}
 	}

+ 0 - 9
modules/tls/tls_config.c

@@ -49,7 +49,6 @@
 static tls_domains_cfg_t* cfg = NULL;
 static tls_domains_cfg_t* cfg = NULL;
 static tls_domain_t* domain = NULL;
 static tls_domain_t* domain = NULL;
 
 
-#ifdef USE_IPV6
 static int parse_ipv6(struct ip_addr* ip, cfg_token_t* token, 
 static int parse_ipv6(struct ip_addr* ip, cfg_token_t* token, 
 					  cfg_parser_t* st)
 					  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);
 	    st->file, token->start.line, token->start.col);
 	return -1;
 	return -1;
 }
 }
-#endif /* USE_IPV6 */
 
 
 
 
 static int parse_ipv4(struct ip_addr* ip, cfg_token_t* token, 
 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 == '[') {
 	if (t.type == '[') {
-#ifdef USE_IPV6
 		if (parse_ipv6(ip, &t, st) < 0) return -1;
 		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) {
 	} else if (t.type == CFG_TOKEN_ALPHA) {
 		opt = cfg_lookup_token(token_default, &t.val);
 		opt = cfg_lookup_token(token_default, &t.val);
 		if (opt) {
 		if (opt) {

+ 1 - 0
modules/tm/h_table.h

@@ -231,6 +231,7 @@ typedef struct ua_client
 	str path;
 	str path;
 	str instance;
 	str instance;
 	str ruid;
 	str ruid;
+	str location_ua;
 	/* if we don't store, we at least want to know the status */
 	/* if we don't store, we at least want to know the status */
 	int             last_received;
 	int             last_received;
 
 

+ 83 - 12
modules/tm/t_fwd.c

@@ -188,7 +188,8 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 									struct socket_info* fsocket,
 									struct socket_info* fsocket,
 									snd_flags_t snd_flags,
 									snd_flags_t snd_flags,
 									int fproto, int flags,
 									int fproto, int flags,
-									str *instance, str *ruid)
+									str *instance, str *ruid,
+									str *location_ua)
 {
 {
 	char *shbuf;
 	char *shbuf;
 	struct lump* add_rm_backup, *body_lumps_backup;
 	struct lump* add_rm_backup, *body_lumps_backup;
@@ -205,6 +206,8 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 	int free_instance;
 	int free_instance;
 	str ruid_bak;
 	str ruid_bak;
 	int free_ruid;
 	int free_ruid;
+	str ua_bak;
+	int free_ua;
 	int backup_route_type;
 	int backup_route_type;
 	snd_flags_t fwd_snd_flags_bak;
 	snd_flags_t fwd_snd_flags_bak;
 	snd_flags_t rpl_snd_flags_bak;
 	snd_flags_t rpl_snd_flags_bak;
@@ -230,6 +233,9 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 	ruid_bak.s=0;
 	ruid_bak.s=0;
 	ruid_bak.len=0;
 	ruid_bak.len=0;
 	free_ruid=0;
 	free_ruid=0;
+	ua_bak.s=0;
+	ua_bak.len=0;
+	free_ua=0;
 	dst=&t->uac[branch].request.dst;
 	dst=&t->uac[branch].request.dst;
 
 
 	/* ... we calculate branch ... */	
 	/* ... we calculate branch ... */	
@@ -272,6 +278,7 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 	path_bak=i_req->path_vec;
 	path_bak=i_req->path_vec;
 	instance_bak=i_req->instance;
 	instance_bak=i_req->instance;
 	ruid_bak=i_req->ruid;
 	ruid_bak=i_req->ruid;
+	ua_bak=i_req->location_ua;
 	
 	
 	if (unlikely(branch_route || has_tran_tmcbs(t, TMCB_REQUEST_FWDED))){
 	if (unlikely(branch_route || has_tran_tmcbs(t, TMCB_REQUEST_FWDED))){
 		/* dup uris, path a.s.o. if we have a branch route or callback */
 		/* dup uris, path a.s.o. if we have a branch route or callback */
@@ -336,6 +343,22 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 			}
 			}
 			free_ruid=1;
 			free_ruid=1;
 		}
 		}
+
+		/* update location_ua */
+		/* if location_ua points to msg location_ua, it needs to be "fixed" so that we 
+		   can change/update msg->location_ua */
+		if (location_ua==&i_req->location_ua)
+			location_ua=&ua_bak;
+		/* zero it first so that set_ua will work */
+		i_req->location_ua.s=0;
+		i_req->location_ua.len=0;
+		if (unlikely(location_ua)){
+			if (unlikely(set_ua(i_req, location_ua)<0)){
+				ret=E_OUT_OF_MEM;
+				goto error03;
+			}
+			free_ua=1;
+		}
 	
 	
 		/* backup dst uri  & zero it*/
 		/* backup dst uri  & zero it*/
 		dst_uri_bak=i_req->dst_uri;
 		dst_uri_bak=i_req->dst_uri;
@@ -455,6 +478,13 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 			i_req->ruid.s=0;
 			i_req->ruid.s=0;
 			i_req->ruid.len=0;
 			i_req->ruid.len=0;
 		}
 		}
+		if (unlikely(location_ua && (i_req->location_ua.s!=location_ua->s ||
+							  i_req->location_ua.len!=location_ua->len))){
+			i_req->location_ua=*location_ua;
+		}else if (unlikely(location_ua==0 && i_req->location_ua.len!=0)){
+			i_req->location_ua.s=0;
+			i_req->location_ua.len=0;
+		}
 	}
 	}
 	
 	
 	if (likely(next_hop!=0 || (flags & UAC_DNS_FAILOVER_F))){
 	if (likely(next_hop!=0 || (flags & UAC_DNS_FAILOVER_F))){
@@ -552,6 +582,21 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 		t->uac[branch].ruid.s[i_req->ruid.len]=0;
 		t->uac[branch].ruid.s[i_req->ruid.len]=0;
 		memcpy( t->uac[branch].ruid.s, i_req->ruid.s, i_req->ruid.len);
 		memcpy( t->uac[branch].ruid.s, i_req->ruid.s, i_req->ruid.len);
 	}
 	}
+	if (unlikely(i_req->location_ua.s && i_req->location_ua.len)){
+		t->uac[branch].location_ua.s=shm_malloc(i_req->location_ua.len+1);
+		if (unlikely(t->uac[branch].location_ua.s==0)) {
+			shm_free(shbuf);
+			t->uac[branch].request.buffer=0;
+			t->uac[branch].request.buffer_len=0;
+			t->uac[branch].uri.s=0;
+			t->uac[branch].uri.len=0;
+			ret=E_OUT_OF_MEM;
+			goto error01;
+		}
+		t->uac[branch].location_ua.len=i_req->location_ua.len;
+		t->uac[branch].location_ua.s[i_req->location_ua.len]=0;
+		memcpy( t->uac[branch].location_ua.s, i_req->location_ua.s, i_req->location_ua.len);
+	}
 	ret=0;
 	ret=0;
 
 
 error01:
 error01:
@@ -569,6 +614,9 @@ error03:
 	if (unlikely(free_ruid)){
 	if (unlikely(free_ruid)){
 		reset_ruid(i_req);
 		reset_ruid(i_req);
 	}
 	}
+	if (unlikely(free_ua)){
+		reset_ua(i_req);
+	}
 	if (dst_uri_backed_up){
 	if (dst_uri_backed_up){
 		reset_dst_uri(i_req); /* free dst_uri */
 		reset_dst_uri(i_req); /* free dst_uri */
 		i_req->dst_uri=dst_uri_bak;
 		i_req->dst_uri=dst_uri_bak;
@@ -579,7 +627,7 @@ error03:
 	i_req->parsed_uri_ok=parsed_uri_ok_bak;
 	i_req->parsed_uri_ok=parsed_uri_ok_bak;
 	i_req->path_vec=path_bak;
 	i_req->path_vec=path_bak;
 	i_req->instance=instance_bak;
 	i_req->instance=instance_bak;
-	i_req->ruid=ruid_bak;
+	i_req->location_ua=ua_bak;
 	
 	
 	/* Delete the duplicated lump lists, this will also delete
 	/* Delete the duplicated lump lists, this will also delete
 	 * all lumps created here, such as lumps created in per-branch
 	 * all lumps created here, such as lumps created in per-branch
@@ -743,7 +791,8 @@ int add_blind_uac( /*struct cell *t*/ )
 static int add_uac( struct cell *t, struct sip_msg *request, str *uri,
 static int add_uac( struct cell *t, struct sip_msg *request, str *uri,
 					str* next_hop, str* path, struct proxy_l *proxy,
 					str* next_hop, str* path, struct proxy_l *proxy,
 					struct socket_info* fsocket, snd_flags_t snd_flags,
 					struct socket_info* fsocket, snd_flags_t snd_flags,
-					int proto, int flags, str *instance, str *ruid)
+					int proto, int flags, str *instance, str *ruid,
+					str *location_ua)
 {
 {
 
 
 	int ret;
 	int ret;
@@ -788,7 +837,8 @@ static int add_uac( struct cell *t, struct sip_msg *request, str *uri,
 	/* now message printing starts ... */
 	/* now message printing starts ... */
 	if (unlikely( (ret=prepare_new_uac(t, request, branch, uri, path,
 	if (unlikely( (ret=prepare_new_uac(t, request, branch, uri, path,
 										next_hop, fsocket, snd_flags,
 										next_hop, fsocket, snd_flags,
-										proto, flags, instance, ruid)) < 0)){
+										proto, flags, instance, ruid,
+										location_ua)) < 0)){
 		ser_error=ret;
 		ser_error=ret;
 		goto error01;
 		goto error01;
 	}
 	}
@@ -829,7 +879,8 @@ static int add_uac_from_buf( struct cell *t, struct sip_msg *request,
 								snd_flags_t send_flags,
 								snd_flags_t send_flags,
 								int proto,
 								int proto,
 								char *buf, short buf_len,
 								char *buf, short buf_len,
-								str *instance, str *ruid)
+								str *instance, str *ruid,
+								str *location_ua)
 {
 {
 
 
 	int ret;
 	int ret;
@@ -932,6 +983,22 @@ static int add_uac_from_buf( struct cell *t, struct sip_msg *request,
 		t->uac[branch].ruid.s[ruid->len]=0;
 		t->uac[branch].ruid.s[ruid->len]=0;
 		memcpy( t->uac[branch].ruid.s, ruid->s, ruid->len);
 		memcpy( t->uac[branch].ruid.s, ruid->s, ruid->len);
 	}
 	}
+	/* copy the location_ua */
+	if (unlikely(location_ua && location_ua->s)){
+		t->uac[branch].location_ua.s=shm_malloc(location_ua->len+1);
+		if (unlikely(t->uac[branch].location_ua.s==0)) {
+			shm_free(shbuf);
+			t->uac[branch].request.buffer=0;
+			t->uac[branch].request.buffer_len=0;
+			t->uac[branch].uri.s=0;
+			t->uac[branch].uri.len=0;
+			ret=ser_error=E_OUT_OF_MEM;
+			goto error;
+		}
+		t->uac[branch].location_ua.len=location_ua->len;
+		t->uac[branch].location_ua.s[location_ua->len]=0;
+		memcpy( t->uac[branch].location_ua.s, location_ua->s, location_ua->len);
+	}
 	membar_write(); /* to allow lockless ops (e.g. prepare_to_cancel()) we want
 	membar_write(); /* to allow lockless ops (e.g. prepare_to_cancel()) we want
 					   to be sure everything above is fully written before
 					   to be sure everything above is fully written before
 					   updating branches no. */
 					   updating branches no. */
@@ -1004,7 +1071,8 @@ int add_uac_dns_fallback(struct cell *t, struct sip_msg* msg,
 							old_uac->request.dst.proto,
 							old_uac->request.dst.proto,
 							old_uac->request.buffer,
 							old_uac->request.buffer,
 							old_uac->request.buffer_len,
 							old_uac->request.buffer_len,
-							&old_uac->instance, &old_uac->ruid);
+							&old_uac->instance, &old_uac->ruid,
+							&old_uac->location_ua);
 			}else
 			}else
 				/* add_uac will use dns_h => next_hop will be ignored.
 				/* add_uac will use dns_h => next_hop will be ignored.
 				 * Unfortunately we can't reuse the old buffer, the branch id
 				 * Unfortunately we can't reuse the old buffer, the branch id
@@ -1016,7 +1084,8 @@ int add_uac_dns_fallback(struct cell *t, struct sip_msg* msg,
 									old_uac->request.dst.send_sock:0,
 									old_uac->request.dst.send_sock:0,
 							old_uac->request.dst.send_flags,
 							old_uac->request.dst.send_flags,
 							old_uac->request.dst.proto, UAC_DNS_FAILOVER_F,
 							old_uac->request.dst.proto, UAC_DNS_FAILOVER_F,
-							&old_uac->instance, &old_uac->ruid);
+							&old_uac->instance, &old_uac->ruid,
+							&old_uac->location_ua);
 
 
 			if (ret<0){
 			if (ret<0){
 				/* failed, delete the copied dns_h */
 				/* failed, delete the copied dns_h */
@@ -1092,7 +1161,7 @@ int e2e_cancel_branch( struct sip_msg *cancel_msg, struct cell *t_cancel,
 									&t_invite->uac[branch].uri,
 									&t_invite->uac[branch].uri,
 									&t_invite->uac[branch].path,
 									&t_invite->uac[branch].path,
 									0, 0, snd_flags, PROTO_NONE, 0,
 									0, 0, snd_flags, PROTO_NONE, 0,
-									NULL, NULL)) <0)){
+									NULL, NULL, NULL)) <0)){
 			ser_error=ret;
 			ser_error=ret;
 			goto error;
 			goto error;
 		}
 		}
@@ -1551,7 +1620,7 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
 	int success_branch;
 	int success_branch;
 	int try_new;
 	int try_new;
 	int lock_replies;
 	int lock_replies;
-	str dst_uri, path, instance, ruid;
+	str dst_uri, path, instance, ruid, location_ua;
 	struct socket_info* si;
 	struct socket_info* si;
 	flag_t backup_bflags = 0;
 	flag_t backup_bflags = 0;
 	flag_t bflags = 0;
 	flag_t bflags = 0;
@@ -1617,7 +1686,8 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
 		branch_ret=add_uac( t, p_msg, GET_RURI(p_msg), GET_NEXT_HOP(p_msg),
 		branch_ret=add_uac( t, p_msg, GET_RURI(p_msg), GET_NEXT_HOP(p_msg),
 							&p_msg->path_vec, proxy, p_msg->force_send_socket,
 							&p_msg->path_vec, proxy, p_msg->force_send_socket,
 							p_msg->fwd_send_flags, proto,
 							p_msg->fwd_send_flags, proto,
-							(p_msg->dst_uri.len)?0:UAC_SKIP_BR_DST_F, &p_msg->instance, &p_msg->ruid);
+							(p_msg->dst_uri.len)?0:UAC_SKIP_BR_DST_F, &p_msg->instance,
+							&p_msg->ruid, &p_msg->location_ua);
 		if (branch_ret>=0) 
 		if (branch_ret>=0) 
 			added_branches |= 1<<branch_ret;
 			added_branches |= 1<<branch_ret;
 		else
 		else
@@ -1626,14 +1696,15 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
 
 
 	init_branch_iterator();
 	init_branch_iterator();
 	while((current_uri.s=next_branch( &current_uri.len, &q, &dst_uri, &path,
 	while((current_uri.s=next_branch( &current_uri.len, &q, &dst_uri, &path,
-										&bflags, &si, &ruid, &instance))) {
+										&bflags, &si, &ruid, &instance, &location_ua))) {
 		try_new++;
 		try_new++;
 		setbflagsval(0, bflags);
 		setbflagsval(0, bflags);
 
 
 		branch_ret=add_uac( t, p_msg, &current_uri,
 		branch_ret=add_uac( t, p_msg, &current_uri,
 							(dst_uri.len) ? (&dst_uri) : &current_uri,
 							(dst_uri.len) ? (&dst_uri) : &current_uri,
 							&path, proxy, si, p_msg->fwd_send_flags,
 							&path, proxy, si, p_msg->fwd_send_flags,
-							proto, (dst_uri.len)?0:UAC_SKIP_BR_DST_F, &instance, &ruid);
+							proto, (dst_uri.len)?0:UAC_SKIP_BR_DST_F, &instance,
+							&ruid, &location_ua);
 		/* pick some of the errors in case things go wrong;
 		/* pick some of the errors in case things go wrong;
 		   note that picking lowest error is just as good as
 		   note that picking lowest error is just as good as
 		   any other algorithm which picks any other negative
 		   any other algorithm which picks any other negative

+ 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;
 		return F_RB_NH_STRICT;
 	/* if 1st route contains an IP address, comparing it against .dst */
 	/* if 1st route contains an IP address, comparing it against .dst */
 	if ((uri_ia = str2ip(&topr_uri.host))
 	if ((uri_ia = str2ip(&topr_uri.host))
-#ifdef USE_IPV6
 			|| (uri_ia = str2ip6(&topr_uri.host))
 			|| (uri_ia = str2ip6(&topr_uri.host))
-#endif
 			) {
 			) {
 		/* we have an IP address in route -> comparison can go swiftly */
 		/* we have an IP address in route -> comparison can go swiftly */
 		if (init_su(&uri_sau, uri_ia, uri_port) < 0)
 		if (init_su(&uri_sau, uri_ia, uri_port) < 0)

+ 45 - 12
modules/tm/t_serial.c

@@ -51,6 +51,7 @@ struct contact {
     struct socket_info* sock;
     struct socket_info* sock;
     str instance;
     str instance;
     str ruid;
     str ruid;
+    str location_ua;
     unsigned int flags;
     unsigned int flags;
     unsigned short q_flag;
     unsigned short q_flag;
     struct contact *next;
     struct contact *next;
@@ -94,10 +95,11 @@ static str instance_name = {"instance", 8};
 static str flags_name = {"flags", 5};
 static str flags_name = {"flags", 5};
 static str q_flag_name = {"q_flag", 6};
 static str q_flag_name = {"q_flag", 6};
 static str ruid_name = {"ruid", 4};
 static str ruid_name = {"ruid", 4};
+static str ua_name = {"ua", 2};
 
 
 void add_contacts_avp(str *uri, str *dst_uri, str *path, str *sock_str,
 void add_contacts_avp(str *uri, str *dst_uri, str *path, str *sock_str,
 		      unsigned int flags, unsigned int q_flag, str *instance,
 		      unsigned int flags, unsigned int q_flag, str *instance,
-		      str *ruid)
+		      str *ruid, str *location_ua)
 {
 {
     sr_xavp_t *record;
     sr_xavp_t *record;
     sr_xval_t val;
     sr_xval_t val;
@@ -145,6 +147,12 @@ void add_contacts_avp(str *uri, str *dst_uri, str *path, str *sock_str,
 	xavp_add_value(&ruid_name, &val, &record);
 	xavp_add_value(&ruid_name, &val, &record);
     }
     }
 
 
+    if (location_ua->len > 0) {
+	val.type = SR_XTYPE_STR;
+	val.v.s = *location_ua;
+	xavp_add_value(&ua_name, &val, &record);
+    }
+
     val.type = SR_XTYPE_XAVP;
     val.type = SR_XTYPE_XAVP;
     val.v.xavp = record;
     val.v.xavp = record;
     xavp_add_value(&contacts_avp, &val, NULL);
     xavp_add_value(&contacts_avp, &val, NULL);
@@ -202,6 +210,7 @@ int t_load_contacts(struct sip_msg* msg, char* key, char* value)
 	contacts->q = get_ruri_q();
 	contacts->q = get_ruri_q();
 	contacts->instance = msg->instance;
 	contacts->instance = msg->instance;
         contacts->ruid = msg->ruid;
         contacts->ruid = msg->ruid;
+	contacts->location_ua = msg->location_ua;
 	first_idx = 0;
 	first_idx = 0;
     } else {
     } else {
 	/* Insert first branch to first contact */
 	/* Insert first branch to first contact */
@@ -219,6 +228,8 @@ int t_load_contacts(struct sip_msg* msg, char* key, char* value)
 	contacts->instance.len = branch->instance_len;
 	contacts->instance.len = branch->instance_len;
         contacts->ruid.s = branch->ruid;
         contacts->ruid.s = branch->ruid;
         contacts->ruid.len = branch->ruid_len;
         contacts->ruid.len = branch->ruid_len;
+	contacts->location_ua.s = branch->location_ua;
+	contacts->location_ua.len = branch->location_ua_len;
 	first_idx = 1;
 	first_idx = 1;
     }
     }
 
 
@@ -247,6 +258,8 @@ int t_load_contacts(struct sip_msg* msg, char* key, char* value)
 	next->instance.len = branch->instance_len;
 	next->instance.len = branch->instance_len;
 	next->ruid.s = branch->ruid;
 	next->ruid.s = branch->ruid;
 	next->ruid.len = branch->ruid_len;
 	next->ruid.len = branch->ruid_len;
+	next->location_ua.s = branch->location_ua;
+	next->location_ua.len = branch->location_ua_len;
 	next->next = (struct contact *)0;
 	next->next = (struct contact *)0;
 
 
 	prev = (struct contact *)0;
 	prev = (struct contact *)0;
@@ -299,7 +312,7 @@ int t_load_contacts(struct sip_msg* msg, char* key, char* value)
 
 
 	add_contacts_avp(&(curr->uri), &(curr->dst_uri), &(curr->path),
 	add_contacts_avp(&(curr->uri), &(curr->dst_uri), &(curr->path),
 			 &sock_str, curr->flags, curr->q_flag,
 			 &sock_str, curr->flags, curr->q_flag,
-			 &(curr->instance), &(curr->ruid));
+			 &(curr->instance), &(curr->ruid), &(curr->location_ua));
 
 
 	curr = curr->next;
 	curr = curr->next;
     }
     }
@@ -314,7 +327,8 @@ int t_load_contacts(struct sip_msg* msg, char* key, char* value)
 }
 }
 
 
 void add_contact_flows_avp(str *uri, str *dst_uri, str *path, str *sock_str,
 void add_contact_flows_avp(str *uri, str *dst_uri, str *path, str *sock_str,
-			   unsigned int flags, str *instance, str *ruid)
+			   unsigned int flags, str *instance, str *ruid,
+			   str *location_ua)
 {
 {
     sr_xavp_t *record;
     sr_xavp_t *record;
     sr_xval_t val;
     sr_xval_t val;
@@ -354,6 +368,12 @@ void add_contact_flows_avp(str *uri, str *dst_uri, str *path, str *sock_str,
 	xavp_add_value(&ruid_name, &val, &record);
 	xavp_add_value(&ruid_name, &val, &record);
     }
     }
 
 
+    if (location_ua->len > 0) {
+	val.type = SR_XTYPE_STR;
+	val.v.s = *location_ua;
+	xavp_add_value(&ua_name, &val, &record);
+    }
+
     val.type = SR_XTYPE_INT;
     val.type = SR_XTYPE_INT;
     val.v.i = flags;
     val.v.i = flags;
     xavp_add_value(&flags_name, &val, &record);
     xavp_add_value(&flags_name, &val, &record);
@@ -376,7 +396,7 @@ void add_contact_flows_avp(str *uri, str *dst_uri, str *path, str *sock_str,
  * there was nothing to do. Returns -1 in case of an error. */
  * there was nothing to do. Returns -1 in case of an error. */
 int t_next_contacts(struct sip_msg* msg, char* key, char* value)
 int t_next_contacts(struct sip_msg* msg, char* key, char* value)
 {
 {
-    str uri, dst_uri, path, instance, host, sock_str, ruid;
+    str uri, dst_uri, path, instance, host, sock_str, ruid, location_ua;
     struct socket_info *sock;
     struct socket_info *sock;
     unsigned int flags, q_flag;
     unsigned int flags, q_flag;
     sr_xavp_t *xavp_list, *xavp, *prev_xavp, *vavp;
     sr_xavp_t *xavp_list, *xavp, *prev_xavp, *vavp;
@@ -471,6 +491,9 @@ int t_next_contacts(struct sip_msg* msg, char* key, char* value)
     vavp = xavp_get(&ruid_name, xavp->val.v.xavp);
     vavp = xavp_get(&ruid_name, xavp->val.v.xavp);
     ruid = vavp->val.v.s;
     ruid = vavp->val.v.s;
 
 
+    vavp = xavp_get(&ua_name, xavp->val.v.xavp);
+    location_ua = vavp->val.v.s;
+
     /* Rewrite Request-URI */
     /* Rewrite Request-URI */
     rewrite_uri(msg, &uri);
     rewrite_uri(msg, &uri);
 
 
@@ -492,6 +515,8 @@ int t_next_contacts(struct sip_msg* msg, char* key, char* value)
 
 
     set_ruid(msg, &ruid);
     set_ruid(msg, &ruid);
 
 
+    set_ua(msg, &location_ua);
+
     /* Check if there was only one contact at this priority */
     /* Check if there was only one contact at this priority */
     if (q_flag) {
     if (q_flag) {
 	xavp_rm(xavp, NULL);
 	xavp_rm(xavp, NULL);
@@ -556,6 +581,9 @@ int t_next_contacts(struct sip_msg* msg, char* key, char* value)
 	vavp = xavp_get(&ruid_name, xavp->val.v.xavp);
 	vavp = xavp_get(&ruid_name, xavp->val.v.xavp);
 	ruid = vavp->val.v.s;
 	ruid = vavp->val.v.s;
 
 
+	vavp = xavp_get(&ua_name, xavp->val.v.xavp);
+	location_ua = vavp->val.v.s;
+
 	vavp = xavp_get(&instance_name, xavp->val.v.xavp);
 	vavp = xavp_get(&instance_name, xavp->val.v.xavp);
 	if (vavp != NULL) {
 	if (vavp != NULL) {
 	    instance = vavp->val.v.s;
 	    instance = vavp->val.v.s;
@@ -568,7 +596,7 @@ int t_next_contacts(struct sip_msg* msg, char* key, char* value)
 	    }
 	    }
 	    if (ilp) {
 	    if (ilp) {
 		add_contact_flows_avp(&uri, &dst_uri, &path, &sock_str,
 		add_contact_flows_avp(&uri, &dst_uri, &path, &sock_str,
-				      flags, &instance, &ruid);
+				      flags, &instance, &ruid, &location_ua);
 		goto check_q_flag;
 		goto check_q_flag;
 	    }
 	    }
 	    if (!q_flag) {
 	    if (!q_flag) {
@@ -595,14 +623,15 @@ int t_next_contacts(struct sip_msg* msg, char* key, char* value)
 		instance.len = 0;
 		instance.len = 0;
 	}
 	}
 
 
-	LM_DBG("Appending branch uri-'%.*s' dst-'%.*s' path-'%.*s' inst-'%.*s' ruid-'%.*s'\n",
+	LM_DBG("Appending branch uri-'%.*s' dst-'%.*s' path-'%.*s' inst-'%.*s'"
+		" ruid-'%.*s' location_ua-'%.*s'\n",
 		uri.len, uri.s,
 		uri.len, uri.s,
 		dst_uri.len, (dst_uri.len > 0)?dst_uri.s:"",
 		dst_uri.len, (dst_uri.len > 0)?dst_uri.s:"",
 		path.len, (path.len>0)?path.s:"",
 		path.len, (path.len>0)?path.s:"",
 		instance.len, (instance.len>0)?instance.s:"",
 		instance.len, (instance.len>0)?instance.s:"",
-		ruid.len, ruid.s);
+		ruid.len, ruid.s, location_ua.len, location_ua.s);
 	if (append_branch(msg, &uri, &dst_uri, &path, 0, flags, sock, &instance, 0,
 	if (append_branch(msg, &uri, &dst_uri, &path, 0, flags, sock, &instance, 0,
-			  &ruid) != 1) {
+			  &ruid, &location_ua) != 1) {
 	    LM_ERR("appending branch failed\n");
 	    LM_ERR("appending branch failed\n");
 	    free_instance_list(il);
 	    free_instance_list(il);
 	    xavp_destroy_list(&xavp_list);
 	    xavp_destroy_list(&xavp_list);
@@ -637,7 +666,7 @@ int t_next_contacts(struct sip_msg* msg, char* key, char* value)
  * there was nothing to do. Returns -1 in case of an error. */
  * there was nothing to do. Returns -1 in case of an error. */
 int t_next_contact_flow(struct sip_msg* msg, char* key, char* value)
 int t_next_contact_flow(struct sip_msg* msg, char* key, char* value)
 {
 {
-    str uri, dst_uri, path, instance, host, ruid;
+    str uri, dst_uri, path, instance, host, ruid, location_ua;
 	str this_instance;
 	str this_instance;
     struct socket_info *sock;
     struct socket_info *sock;
     unsigned int flags;
     unsigned int flags;
@@ -728,14 +757,18 @@ int t_next_contact_flow(struct sip_msg* msg, char* key, char* value)
 		vavp = xavp_get(&ruid_name, xavp->val.v.xavp);
 		vavp = xavp_get(&ruid_name, xavp->val.v.xavp);
 		ruid = vavp->val.v.s;
 		ruid = vavp->val.v.s;
 
 
-		LM_DBG("Appending branch uri-'%.*s' dst-'%.*s' path-'%.*s' inst-'%.*s' ruid-'%.*s'\n",
+		vavp = xavp_get(&ua_name, xavp->val.v.xavp);
+		location_ua = vavp->val.v.s;
+
+		LM_DBG("Appending branch uri-'%.*s' dst-'%.*s' path-'%.*s'"
+			" inst-'%.*s' ruid-'%.*s' location_ua-'%.*s'\n",
 			uri.len, uri.s,
 			uri.len, uri.s,
 			dst_uri.len, (dst_uri.len > 0)?dst_uri.s:"",
 			dst_uri.len, (dst_uri.len > 0)?dst_uri.s:"",
 			path.len, (path.len>0)?path.s:"",
 			path.len, (path.len>0)?path.s:"",
 			instance.len, (instance.len>0)?instance.s:"",
 			instance.len, (instance.len>0)?instance.s:"",
-			ruid.len, ruid.s);
+			ruid.len, ruid.s, location_ua.len, location_ua.s);
 		if (append_branch(msg, &uri, &dst_uri, &path, 0, flags, sock, &instance, 0,
 		if (append_branch(msg, &uri, &dst_uri, &path, 0, flags, sock, &instance, 0,
-			  &ruid) != 1) {
+			  &ruid, &location_ua) != 1) {
 			LM_ERR("appending branch failed\n");
 			LM_ERR("appending branch failed\n");
 			xavp_destroy_list(&xavp_list);
 			xavp_destroy_list(&xavp_list);
 			return -1;
 			return -1;

+ 3 - 3
modules/xprint/xp_lib.c

@@ -700,7 +700,7 @@ static int xl_get_branch(struct sip_msg *msg, str *res, str *hp, int hi, int hf)
 
 
 
 
 	init_branch_iterator();
 	init_branch_iterator();
-	branch.s = next_branch(&branch.len, &q, 0, 0, 0, 0, 0, 0);
+	branch.s = next_branch(&branch.len, &q, 0, 0, 0, 0, 0, 0, 0);
 	if (!branch.s) {
 	if (!branch.s) {
 		return xl_get_null(msg, res, hp, hi, hf);
 		return xl_get_null(msg, res, hp, hi, hf);
 	}
 	}
@@ -731,7 +731,7 @@ static int xl_get_branches(struct sip_msg *msg, str *res, str *hp, int hi, int h
 	cnt = len = 0;
 	cnt = len = 0;
 
 
 	init_branch_iterator();
 	init_branch_iterator();
-	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0, 0, 0)))
+	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0, 0, 0, 0)))
 	{
 	{
 		cnt++;
 		cnt++;
 		len += uri.len;
 		len += uri.len;
@@ -756,7 +756,7 @@ static int xl_get_branches(struct sip_msg *msg, str *res, str *hp, int hi, int h
 	p = local_buf;
 	p = local_buf;
 
 
 	init_branch_iterator();
 	init_branch_iterator();
-	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0, 0, 0)))
+	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0, 0, 0, 0)))
 	{
 	{
 		if (i)
 		if (i)
 		{
 		{

+ 0 - 9
msg_translator.c

@@ -195,9 +195,7 @@ static int check_via_address(struct ip_addr* ip, str *name,
 	struct hostent* he;
 	struct hostent* he;
 	int i;
 	int i;
 	char* s;
 	char* s;
-	#ifdef USE_IPV6
 	int len;
 	int len;
-	#endif
 
 
 	/* maybe we are lucky and name it's an ip */
 	/* maybe we are lucky and name it's an ip */
 	s=ip_addr2a(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",
 		DBG("check_via_address(%s, %.*s, %d)\n",
 			s, name->len, name->s, resolver);
 			s, name->len, name->s, resolver);
 
 
-	#ifdef USE_IPV6
-
 		len=strlen(s);
 		len=strlen(s);
 
 
 		/* check if name->s is an ipv6 address or an ipv6 address ref. */
 		/* 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;
 			return 0;
 		else
 		else
-	#endif
 
 
 			if (strncmp(name->s, s, name->len)==0)
 			if (strncmp(name->s, s, name->len)==0)
 				return 0;
 				return 0;
@@ -1764,9 +1759,7 @@ after_local_via:
 			}
 			}
 #if 0
 #if 0
 			/* no longer necessary, now hots.s contains [] */
 			/* no longer necessary, now hots.s contains [] */
-		#ifdef USE_IPV6
 			if(send_sock->address.af==AF_INET6) size+=1; /* +1 for ']'*/
 			if(send_sock->address.af==AF_INET6) size+=1; /* +1 for ']'*/
-		#endif
 #endif
 #endif
 	}
 	}
 	/* if received needs to be added, add anchor after host and add it, or
 	/* 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);
 		LOG(L_CRIT, "BUG: via_builder: unknown proto %d\n", send_info->proto);
 		return 0;
 		return 0;
 	}
 	}
-#	ifdef USE_IPV6
 	/* add [] only if ipv6 and outbound socket address is used;
 	/* add [] only if ipv6 and outbound socket address is used;
 	 * if using pre-set no check is made */
 	 * if using pre-set no check is made */
 	if ((send_sock->address.af==AF_INET6) &&
 	if ((send_sock->address.af==AF_INET6) &&
@@ -2524,7 +2516,6 @@ char* via_builder( unsigned int *len,
 		extra_len=1;
 		extra_len=1;
 		via_len+=2; /* [ ]*/
 		via_len+=2; /* [ ]*/
 	}
 	}
-#	endif
 	memcpy(line_buf+via_prefix_len+extra_len, address_str->s,
 	memcpy(line_buf+via_prefix_len+extra_len, address_str->s,
 				address_str->len);
 				address_str->len);
 	if ((send_sock->port_no!=SIP_PORT) ||
 	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;
 	struct  host_alias* a;
 	
 	
-#ifdef USE_IPV6
 	if ((len>2)&&((*name)=='[')&&(name[len-1]==']')){
 	if ((len>2)&&((*name)=='[')&&(name[len-1]==']')){
 		/* ipv6 reference, skip [] */
 		/* ipv6 reference, skip [] */
 		name++;
 		name++;
 		len-=2;
 		len-=2;
 	}
 	}
-#endif
 	for(a=aliases;a;a=a->next)
 	for(a=aliases;a;a=a->next)
 		if ((a->alias.len==len) && ((a->port==0) || (port==0) || 
 		if ((a->alias.len==len) && ((a->port==0) || (port==0) || 
 				(a->port==port)) && ((a->proto==0) || (proto==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));
 	memset(ip_set, 0, sizeof(*ip_set));
 	ip_set->use_shm = use_shm;
 	ip_set->use_shm = use_shm;
 	ip_tree_init(&ip_set->ipv4_tree);
 	ip_tree_init(&ip_set->ipv4_tree);
-	#ifdef USE_IPV6
 	ip_tree_init(&ip_set->ipv6_tree);
 	ip_tree_init(&ip_set->ipv6_tree);
-	#endif
 }
 }
 
 
 void ip_set_destroy(struct ip_set *ip_set) {
 void ip_set_destroy(struct ip_set *ip_set) {
 	ip_tree_destroy(&ip_set->ipv4_tree, 0, ip_set->use_shm);
 	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);
 	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) {
 int ip_set_add_ip(struct ip_set *ip_set, struct ip_addr *ip, unsigned int network_prefix) {
 	switch (ip->af) {
 	switch (ip->af) {
 		case AF_INET:
 		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);
 			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:
 		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);
 			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:
 		default:
 			return -1;				
 			return -1;				
 		}
 		}
@@ -64,10 +58,8 @@ int ip_set_ip_exists(struct ip_set *ip_set, struct ip_addr *ip) {
 	switch (ip->af) {
 	switch (ip->af) {
 		case AF_INET:
 		case AF_INET:
 			return ip_tree_find_ip(ip_set->ipv4_tree, ip->u.addr, ip->len*8, &h) > 0;
 			return ip_tree_find_ip(ip_set->ipv4_tree, ip->u.addr, ip->len*8, &h) > 0;
-	#ifdef USE_IPV6
 		case AF_INET6:
 		case AF_INET6:
 			return ip_tree_find_ip(ip_set->ipv6_tree, ip->u.addr, ip->len*8, &h) > 0;
 			return ip_tree_find_ip(ip_set->ipv6_tree, ip->u.addr, ip->len*8, &h) > 0;
-	#endif
 		default:
 		default:
 			return -1;				
 			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) {
 void ip_set_print(FILE *stream, struct ip_set *ip_set) {
 	fprintf(stream, "IPv4:\n");
 	fprintf(stream, "IPv4:\n");
 	ip_tree_print(stream, ip_set->ipv4_tree, 2);
 	ip_tree_print(stream, ip_set->ipv4_tree, 2);
-	#ifdef USE_IPV6
 	fprintf(stream, "IPv6:\n");
 	fprintf(stream, "IPv6:\n");
 	ip_tree_print(stream, ip_set->ipv6_tree, 2);
 	ip_tree_print(stream, ip_set->ipv6_tree, 2);
-	#endif
 }
 }
 
 
 int ip_set_add_list(struct ip_set *ip_set, str ip_set_s){
 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;
 	unsigned int prefix, i;
 
 
 	if ( ((ip = str2ip(&ip_s))==0)
 	if ( ((ip = str2ip(&ip_s))==0)
-		#ifdef  USE_IPV6
 					  && ((ip = str2ip6(&ip_s))==0)
 					  && ((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);
 		ERR("ip_set_add_ip_s: string to ip conversion error '%.*s'\n", ip_s.len, ip_s.s);
 		return -1;
 		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 (fl) {  /* 255.255.255.0 format */
 			if ( ((ip = str2ip(&mask_s))==0)
 			if ( ((ip = str2ip(&mask_s))==0)
-				#ifdef  USE_IPV6
 					  && ((ip = str2ip6(&mask_s))==0)
 					  && ((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);
 				ERR("ip_set_add_ip_s: string to ip mask conversion error '%.*s'\n", mask_s.len, mask_s.s);
 				return -1;
 				return -1;

+ 0 - 2
obsolete/permissions/ip_set.h

@@ -37,9 +37,7 @@
 struct ip_set {
 struct ip_set {
 	int use_shm;
 	int use_shm;
 	struct ip_tree_leaf *ipv4_tree;
 	struct ip_tree_leaf *ipv4_tree;
-#ifdef USE_IPV6
 	struct ip_tree_leaf *ipv6_tree;	
 	struct ip_tree_leaf *ipv6_tree;	
-#endif
 };
 };
 
 
 extern void ip_set_init(struct ip_set *ip_set, int use_shm);
 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);
 	rpc->add(ctx, "{", &c);
 	if (rpc->struct_add(c, "s", "IPv", "6") < 0) 
 	if (rpc->struct_add(c, "s", "IPv", "6") < 0) 
 		goto err;	
 		goto err;	
-#ifdef USE_IPV6
 	if (rpc_ip_tree_print(rpc, c, "", ip_set->ipv6_tree, 0) < 0) 
 	if (rpc_ip_tree_print(rpc, c, "", ip_set->ipv6_tree, 0) < 0) 
 		goto err;
 		goto err;
-#endif
 
 
 err:		
 err:		
 	if (pending)
 	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 */
 			/* string -> ip */
 
 
 			if ( ((ip = str2ip(&ip_s))==0)
 			if ( ((ip = str2ip(&ip_s))==0)
-				#ifdef  USE_IPV6
 			                  && ((ip = str2ip6(&ip_s))==0)
 			                  && ((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);
 				ERR(MODULE_NAME": ip_is_trusted: string to ip conversion error '%.*s'\n", ip_s.len, ip_s.s);
 				return -1;
 				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 */
 		goto end; /* no dst_ip param */
 	/* check if it's ipv4 or ipv6 */
 	/* check if it's ipv4 or ipv6 */
 	if (
 	if (
-#ifdef USE_IPV6
 			likely(((p = str2ip(&hooks.uri.dstip->body)) != 0) ||
 			likely(((p = str2ip(&hooks.uri.dstip->body)) != 0) ||
 				((p = str2ip6(&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;
 		*ip = *p;
 	} else
 	} else

+ 39 - 0
parser/msg_parser.c

@@ -898,6 +898,45 @@ void reset_ruid(struct sip_msg* const msg)
 }
 }
 
 
 
 
+int set_ua(struct sip_msg* msg, str* location_ua)
+{
+	char* ptr;
+
+	if (unlikely(!msg || !location_ua)) {
+		LM_ERR("invalid location_ua parameter value\n");
+		return -1;
+	}
+
+	if (unlikely(location_ua->len == 0)) {
+		reset_ua(msg);
+	} else if (msg->location_ua.s && (msg->location_ua.len >= location_ua->len)) {
+		memcpy(msg->location_ua.s, location_ua->s, location_ua->len);
+		msg->location_ua.len = location_ua->len;
+	} else {
+		ptr = (char*)pkg_malloc(location_ua->len);
+		if (!ptr) {
+			LM_ERR("not enough pkg memory for location_ua\n");
+			return -1;
+		}
+		memcpy(ptr, location_ua->s, location_ua->len);
+		if (msg->location_ua.s) pkg_free(msg->location_ua.s);
+		msg->location_ua.s = ptr;
+		msg->location_ua.len = location_ua->len;
+	}
+	return 0;
+}
+
+
+void reset_ua(struct sip_msg* const msg)
+{
+	if(msg->location_ua.s != 0) {
+		pkg_free(msg->location_ua.s);
+	}
+	msg->location_ua.s = 0;
+	msg->location_ua.len = 0;
+}
+
+
 hdr_field_t* get_hdr(const sip_msg_t* const msg, const enum _hdr_types_t ht)
 hdr_field_t* get_hdr(const sip_msg_t* const msg, const enum _hdr_types_t ht)
 {
 {
 	hdr_field_t *hdr;
 	hdr_field_t *hdr;

+ 5 - 0
parser/msg_parser.h

@@ -366,6 +366,7 @@ typedef struct sip_msg {
         str instance;
         str instance;
         unsigned int reg_id;
         unsigned int reg_id;
 	str ruid;
 	str ruid;
+	str location_ua;
 
 
 	struct {
 	struct {
 		int decoded;
 		int decoded;
@@ -463,6 +464,10 @@ int set_ruid(struct sip_msg* msg, str* ruid);
 
 
 void reset_ruid(struct sip_msg* const msg);
 void reset_ruid(struct sip_msg* const msg);
 
 
+int set_ua(struct sip_msg* msg, str *location_ua);
+
+void reset_ua(struct sip_msg* const msg);
+
 /** force a specific send socket for forwarding a request.
 /** force a specific send socket for forwarding a request.
  * @param msg - sip msg.
  * @param msg - sip msg.
  * @param fsocket - forced socket, pointer to struct socket_info, can be 0 (in
  * @param fsocket - forced socket, pointer to struct socket_info, can be 0 (in

+ 0 - 4
pt.c

@@ -95,11 +95,7 @@ static int calc_common_open_fds_no(void)
 									  tmp. tcp send +
 									  tmp. tcp send +
 									  tmp dns.*/
 									  tmp dns.*/
 				-1 /* timer (no udp)*/ + 3 /* stdin/out/err */ +
 				-1 /* timer (no udp)*/ + 3 /* stdin/out/err */ +
-#ifdef USE_IPV6
 				2*mhomed
 				2*mhomed
-#else
-				mhomed
-#endif /* USE_IPV6*/
 				;
 				;
 	return max_fds_no;
 	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 */
 														  don't find another */
 		/* check if it's an ip address */
 		/* check if it's an ip address */
 		if (((ip=str2ip(name))!=0)
 		if (((ip=str2ip(name))!=0)
-#ifdef	USE_IPV6
 			  || ((ip=str2ip6(name))!=0) 
 			  || ((ip=str2ip6(name))!=0) 
-#endif
 			 ){
 			 ){
 			/* we are lucky, this is an ip address */
 			/* we are lucky, this is an ip address */
 			he=ip_addr2he(name, ip);
 			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 */
 	/* check if it's an ip address */
 	if (((ip=str2ip(name))!=0)
 	if (((ip=str2ip(name))!=0)
-#ifdef	USE_IPV6
 			  || ((ip=str2ip6(name))!=0)
 			  || ((ip=str2ip6(name))!=0)
-#endif
 			 ){
 			 ){
 		/* we are lucky, this is an ip address */
 		/* we are lucky, this is an ip address */
 		/* set proto if needed - default udp */
 		/* 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)){
 	if (port && proto && (*proto==0) && (*port==0)){
 		*proto=PROTO_UDP; /* just in case we don't find another */
 		*proto=PROTO_UDP; /* just in case we don't find another */
 		if ( ((ip=str2ip(name))!=0)
 		if ( ((ip=str2ip(name))!=0)
-#ifdef	USE_IPV6
 			  || ((ip=str2ip6(name))!=0)
 			  || ((ip=str2ip6(name))!=0)
-#endif
 		){
 		){
 			/* we are lucky, this is an ip address */
 			/* we are lucky, this is an ip address */
 			he=ip_addr2he(name,ip);
 			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
 /* returns an ip_addr struct.; on error returns 0
  * the ip_addr struct is static, so subsequent calls will destroy its content*/
  * the ip_addr struct is static, so subsequent calls will destroy its content*/
 static inline struct ip_addr* str2ip6(str* st)
 static inline struct ip_addr* str2ip6(str* st)
@@ -379,7 +378,6 @@ error_char:
 			st->s);*/
 			st->s);*/
 	return 0;
 	return 0;
 }
 }
-#endif /* USE_IPV6 */
 
 
 
 
 
 
@@ -392,16 +390,12 @@ static inline struct hostent* _resolvehost(char* name)
 {
 {
 	static struct hostent* he=0;
 	static struct hostent* he=0;
 #ifdef HAVE_GETIPNODEBYNAME 
 #ifdef HAVE_GETIPNODEBYNAME 
-#ifdef USE_IPV6
 	int err;
 	int err;
 	static struct hostent* he2=0;
 	static struct hostent* he2=0;
 #endif
 #endif
-#endif
 #ifndef DNS_IP_HACK
 #ifndef DNS_IP_HACK
-#ifdef USE_IPV6
 	int len;
 	int len;
 #endif
 #endif
-#endif
 #ifdef DNS_IP_HACK
 #ifdef DNS_IP_HACK
 	struct ip_addr* ip;
 	struct ip_addr* ip;
 	str s;
 	str s;
@@ -411,16 +405,13 @@ static inline struct hostent* _resolvehost(char* name)
 
 
 	/* check if it's an ip address */
 	/* check if it's an ip address */
 	if ( ((ip=str2ip(&s))!=0)
 	if ( ((ip=str2ip(&s))!=0)
-#ifdef	USE_IPV6
 		  || ((ip=str2ip6(&s))!=0)
 		  || ((ip=str2ip6(&s))!=0)
-#endif
 		){
 		){
 		/* we are lucky, this is an ip address */
 		/* we are lucky, this is an ip address */
 		return ip_addr2he(&s, ip);
 		return ip_addr2he(&s, ip);
 	}
 	}
 	
 	
 #else /* DNS_IP_HACK */
 #else /* DNS_IP_HACK */
-#ifdef USE_IPV6
 	len=0;
 	len=0;
 	if (*name=='['){
 	if (*name=='['){
 		len=strlen(name);
 		len=strlen(name);
@@ -430,12 +421,10 @@ static inline struct hostent* _resolvehost(char* name)
 			goto skip_ipv4;
 			goto skip_ipv4;
 		}
 		}
 	}
 	}
-#endif
 #endif
 #endif
 	/* ipv4 */
 	/* ipv4 */
 	he=dns_func.sr_gethostbyname(name);
 	he=dns_func.sr_gethostbyname(name);
 
 
-#ifdef USE_IPV6
 	if(he==0 && cfg_get(core, core_cfg, dns_try_ipv6)){
 	if(he==0 && cfg_get(core, core_cfg, dns_try_ipv6)){
 #ifndef DNS_IP_HACK
 #ifndef DNS_IP_HACK
 skip_ipv4:
 skip_ipv4:
@@ -456,7 +445,6 @@ skip_ipv4:
 		if (len) name[len-2]=']'; /* restore */
 		if (len) name[len-2]=']'; /* restore */
 #endif
 #endif
 	}
 	}
-#endif
 	return he;
 	return he;
 }
 }
 
 

+ 0 - 6
sctp_server.c

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

+ 3 - 3
select_core.c

@@ -1621,7 +1621,7 @@ int select_branch_uri(str* res, select_t* s, struct sip_msg* msg) {
 		char *c;
 		char *c;
 		init_branch_iterator();
 		init_branch_iterator();
 		len = 0;
 		len = 0;
-		while ((c = next_branch(&l, &q, &dst_uri, 0, 0, 0, 0, 0))) {
+		while ((c = next_branch(&l, &q, &dst_uri, 0, 0, 0, 0, 0, 0))) {
 
 
 			if (s->params[SEL_POS].v.i & SEL_BRANCH_DST_URI) {
 			if (s->params[SEL_POS].v.i & SEL_BRANCH_DST_URI) {
 				l = dst_uri.len;
 				l = dst_uri.len;
@@ -1645,7 +1645,7 @@ int select_branch_uri(str* res, select_t* s, struct sip_msg* msg) {
 		init_branch_iterator();
 		init_branch_iterator();
 		res->len = 0;
 		res->len = 0;
 		n = 0;
 		n = 0;
-		while ((c = next_branch(&l, &q, &dst_uri, 0, 0, 0, 0, 0))) {
+		while ((c = next_branch(&l, &q, &dst_uri, 0, 0, 0, 0, 0, 0))) {
 			if (s->params[SEL_POS].v.i & SEL_BRANCH_DST_URI) {
 			if (s->params[SEL_POS].v.i & SEL_BRANCH_DST_URI) {
 				l = dst_uri.len;
 				l = dst_uri.len;
 				c = dst_uri.s;
 				c = dst_uri.s;
@@ -1687,7 +1687,7 @@ int select_branch_uri(str* res, select_t* s, struct sip_msg* msg) {
 		if (n < 0 || n >= nr_branches) 
 		if (n < 0 || n >= nr_branches) 
 			return -1;
 			return -1;
 		init_branch_iterator();
 		init_branch_iterator();
-		for (; (c = next_branch(&l, &q, &dst_uri, 0, 0, 0, 0, 0)) && n; n--);
+		for (; (c = next_branch(&l, &q, &dst_uri, 0, 0, 0, 0, 0, 0)) && n; n--);
 		if (!c) return 1;
 		if (!c) return 1;
 		
 		
 		if (s->params[SEL_POS].v.i & SEL_BRANCH_DST_URI) {
 		if (s->params[SEL_POS].v.i & SEL_BRANCH_DST_URI) {

+ 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, 
 inline static int si_hname_cmp(str* host, str* name, str* addr_str, 
 								struct ip_addr* ip_addr, int flags)
 								struct ip_addr* ip_addr, int flags)
 {
 {
-#ifdef USE_IPV6
 	struct ip_addr* ip6;
 	struct ip_addr* ip6;
-#endif
 	
 	
 	if ( (host->len==name->len) && 
 	if ( (host->len==name->len) && 
 		(strncasecmp(host->s, name->s, name->len)==0) /*slower*/)
 		(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*/
 		 * ipv6 addresses if we are lucky*/
 		goto found;
 		goto found;
 	/* check if host == ip address */
 	/* check if host == ip address */
-#ifdef USE_IPV6
 	/* ipv6 case is uglier, host can be [3ffe::1] */
 	/* ipv6 case is uglier, host can be [3ffe::1] */
 	ip6=str2ip6(host);
 	ip6=str2ip6(host);
 	if (ip6){
 	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
 			return -1; /* no match, but this is an ipv6 address
 						 so no point in trying ipv4 */
 						 so no point in trying ipv4 */
 	}
 	}
-#endif
 	/* ipv4 */
 	/* ipv4 */
 	if ( (!(flags&SI_IS_IP)) && (host->len==addr_str->len) && 
 	if ( (!(flags&SI_IS_IP)) && (host->len==addr_str->len) && 
 			(memcmp(host->s, addr_str->s, addr_str->len)==0) )
 			(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;
 	unsigned short c_proto;
 	
 	
 	hname=*host;
 	hname=*host;
-#ifdef USE_IPV6
 	if ((hname.len>2)&&((*hname.s)=='[')&&(hname.s[hname.len-1]==']')){
 	if ((hname.len>2)&&((*hname.s)=='[')&&(hname.s[hname.len-1]==']')){
 		/* ipv6 reference, skip [] */
 		/* ipv6 reference, skip [] */
 		hname.s++;
 		hname.s++;
 		hname.len-=2;
 		hname.len-=2;
 	}
 	}
-#endif
 
 
 	c_proto=(proto!=PROTO_NONE)?proto:PROTO_UDP;
 	c_proto=(proto!=PROTO_NONE)?proto:PROTO_UDP;
 retry:
 retry:
@@ -1275,12 +1269,8 @@ int add_interfaces(char* if_name, int family, unsigned short port,
 				#else
 				#else
 					( (ifr.ifr_addr.sa_family==AF_INET)?
 					( (ifr.ifr_addr.sa_family==AF_INET)?
 						sizeof(struct sockaddr_in):
 						sizeof(struct sockaddr_in):
-					#ifdef USE_IPV6
 						((ifr.ifr_addr.sa_family==AF_INET6)?
 						((ifr.ifr_addr.sa_family==AF_INET6)?
 						sizeof(struct sockaddr_in6):sizeof(struct sockaddr)) )
 						sizeof(struct sockaddr_in6):sizeof(struct sockaddr)) )
-					#else /* USE_IPV6 */
-						sizeof(struct sockaddr) )
-					#endif /* USE_IPV6 */
 				#endif
 				#endif
 				)
 				)
 			#endif
 			#endif
@@ -1843,13 +1833,11 @@ int fix_all_socket_lists()
 		){
 		){
 		/* get all listening ipv4/ipv6 interfaces */
 		/* get all listening ipv4/ipv6 interfaces */
 		if ( ( (add_interfaces(0, AF_INET, 0,  PROTO_UDP, &ai_lst)==0)
 		if ( ( (add_interfaces(0, AF_INET, 0,  PROTO_UDP, &ai_lst)==0)
-#ifdef USE_IPV6
 #ifdef __OS_linux
 #ifdef __OS_linux
 		&&  (!auto_bind_ipv6 || add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_UDP, &ai_lst) == 0)
 		&&  (!auto_bind_ipv6 || add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_UDP, &ai_lst) == 0)
 #else
 #else
 		&& ( !auto_bind_ipv6 || add_interfaces(0, AF_INET6, 0,  PROTO_UDP, &ai_lst) !=0 ) /* add_interface does not work for IPv6 on Linux */
 		&& ( !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 /* __OS_linux */
-#endif /* USE_IPV6 */
 			 ) && (addr_info_to_si_lst(ai_lst, 0, PROTO_UDP, 0, &udp_listen)==0)){
 			 ) && (addr_info_to_si_lst(ai_lst, 0, PROTO_UDP, 0, &udp_listen)==0)){
 			free_addr_info_lst(&ai_lst);
 			free_addr_info_lst(&ai_lst);
 			ai_lst=0;
 			ai_lst=0;
@@ -1857,13 +1845,11 @@ int fix_all_socket_lists()
 #ifdef USE_TCP
 #ifdef USE_TCP
 			if (!tcp_disable){
 			if (!tcp_disable){
 				if ( ((add_interfaces(0, AF_INET, 0,  PROTO_TCP, &ai_lst)!=0)
 				if ( ((add_interfaces(0, AF_INET, 0,  PROTO_TCP, &ai_lst)!=0)
-#ifdef USE_IPV6
 #ifdef __OS_linux
 #ifdef __OS_linux
     				|| (auto_bind_ipv6 && add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_TCP, &ai_lst) != 0)
     				|| (auto_bind_ipv6 && add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_TCP, &ai_lst) != 0)
 #else
 #else
 				|| (auto_bind_ipv6 && add_interfaces(0, AF_INET6, 0,  PROTO_TCP, &ai_lst) !=0 )
 				|| (auto_bind_ipv6 && add_interfaces(0, AF_INET6, 0,  PROTO_TCP, &ai_lst) !=0 )
 #endif /* __OS_linux */
 #endif /* __OS_linux */
-#endif /* USE_IPV6 */
 				) || (addr_info_to_si_lst(ai_lst, 0, PROTO_TCP, 0,
 				) || (addr_info_to_si_lst(ai_lst, 0, PROTO_TCP, 0,
 										 				&tcp_listen)!=0))
 										 				&tcp_listen)!=0))
 					goto error;
 					goto error;
@@ -1873,13 +1859,11 @@ int fix_all_socket_lists()
 				if (!tls_disable){
 				if (!tls_disable){
 					if (((add_interfaces(0, AF_INET, 0, PROTO_TLS,
 					if (((add_interfaces(0, AF_INET, 0, PROTO_TLS,
 										&ai_lst)!=0)
 										&ai_lst)!=0)
-#ifdef USE_IPV6
 #ifdef __OS_linux
 #ifdef __OS_linux
     				|| (auto_bind_ipv6 && add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_TLS, &ai_lst) != 0)
     				|| (auto_bind_ipv6 && add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_TLS, &ai_lst) != 0)
 #else
 #else
 				|| (auto_bind_ipv6 && add_interfaces(0, AF_INET6, 0,  PROTO_TLS, &ai_lst)!=0)
 				|| (auto_bind_ipv6 && add_interfaces(0, AF_INET6, 0,  PROTO_TLS, &ai_lst)!=0)
 #endif /* __OS_linux */
 #endif /* __OS_linux */
-#endif /* USE_IPV6 */
 					) || (addr_info_to_si_lst(ai_lst, 0, PROTO_TLS, 0,
 					) || (addr_info_to_si_lst(ai_lst, 0, PROTO_TLS, 0,
 										 				&tls_listen)!=0))
 										 				&tls_listen)!=0))
 						goto error;
 						goto error;
@@ -1892,13 +1876,11 @@ int fix_all_socket_lists()
 #ifdef USE_SCTP
 #ifdef USE_SCTP
 			if (!sctp_disable){
 			if (!sctp_disable){
 				if (((add_interfaces(0, AF_INET, 0,  PROTO_SCTP, &ai_lst)!=0)
 				if (((add_interfaces(0, AF_INET, 0,  PROTO_SCTP, &ai_lst)!=0)
-#ifdef USE_IPV6
 #ifdef __OS_linux
 #ifdef __OS_linux
     				|| (auto_bind_ipv6 && add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_SCTP, &ai_lst) != 0)
     				|| (auto_bind_ipv6 && add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_SCTP, &ai_lst) != 0)
 #else
 #else
 				|| (auto_bind_ipv6 && add_interfaces(0, AF_INET6, 0,  PROTO_SCTP, &ai_lst) != 0)
 				|| (auto_bind_ipv6 && add_interfaces(0, AF_INET6, 0,  PROTO_SCTP, &ai_lst) != 0)
 #endif /* __OS_linux */
 #endif /* __OS_linux */
-#endif /* USE_IPV6 */
 					) || (addr_info_to_si_lst(ai_lst, 0, PROTO_SCTP, 0,
 					) || (addr_info_to_si_lst(ai_lst, 0, PROTO_SCTP, 0,
 							 				&sctp_listen)!=0))
 							 				&sctp_listen)!=0))
 					goto error;
 					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_addr; /* saved bind/srv v4 addr. */
 static union sockaddr_union* tcp_source_ipv4=0;
 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_addr; /* saved bind/src v6 addr. */
 static union sockaddr_union* tcp_source_ipv6=0;
 static union sockaddr_union* tcp_source_ipv6=0;
-#endif
 
 
 static int* tcp_connections_no=0; /* current tcp (+tls) open connections */
 static int* tcp_connections_no=0; /* current tcp (+tls) open connections */
 static int* tls_connections_no=0; /* current 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);
 			ip_addr2su(&tcp_source_ipv4_addr, ip, 0);
 			tcp_source_ipv4=&tcp_source_ipv4_addr;
 			tcp_source_ipv4=&tcp_source_ipv4_addr;
 			break;
 			break;
-		#ifdef USE_IPV6
 		case AF_INET6:
 		case AF_INET6:
 			ip_addr2su(&tcp_source_ipv6_addr, ip, 0);
 			ip_addr2su(&tcp_source_ipv6_addr, ip, 0);
 			tcp_source_ipv6=&tcp_source_ipv6_addr;
 			tcp_source_ipv6=&tcp_source_ipv6_addr;
 			break;
 			break;
-		#endif
 		default:
 		default:
 			return -1;
 			return -1;
 	}
 	}
@@ -395,7 +391,6 @@ static int init_sock_opt(int s, int af)
 					strerror(errno));
 					strerror(errno));
 			/* continue since this is not critical */
 			/* continue since this is not critical */
 		}
 		}
-#ifdef USE_IPV6
 	} else if(af==AF_INET6){
 	} else if(af==AF_INET6){
 		if (setsockopt(s, IPPROTO_IPV6, IPV6_TCLASS,
 		if (setsockopt(s, IPPROTO_IPV6, IPV6_TCLASS,
 					(void*)&optval, sizeof(optval)) ==-1) {
 					(void*)&optval, sizeof(optval)) ==-1) {
@@ -403,7 +398,6 @@ static int init_sock_opt(int s, int af)
 					strerror(errno));
 					strerror(errno));
 			/* continue since this is not critical */
 			/* continue since this is not critical */
 		}
 		}
-#endif
 	}
 	}
 
 
 #if  !defined(TCP_DONT_REUSEADDR) 
 #if  !defined(TCP_DONT_REUSEADDR) 
@@ -1250,9 +1244,7 @@ find_socket:
 				" listening socket for %s, using default...\n",
 				" listening socket for %s, using default...\n",
 					su2a(server, sizeof(*server)), ip_addr2a(&ip));
 					su2a(server, sizeof(*server)), ip_addr2a(&ip));
 		if (server->s.sa_family==AF_INET) *res_si=sendipv4_tcp;
 		if (server->s.sa_family==AF_INET) *res_si=sendipv4_tcp;
-#ifdef USE_IPV6
 		else *res_si=sendipv6_tcp;
 		else *res_si=sendipv6_tcp;
-#endif
 	}
 	}
 	*res_local_addr=*from;
 	*res_local_addr=*from;
 	return s;
 	return s;
@@ -1862,11 +1854,9 @@ int tcp_send(struct dest_info* dst, union sockaddr_union* from,
 				case AF_INET:
 				case AF_INET:
 						from = tcp_source_ipv4;
 						from = tcp_source_ipv4;
 					break;
 					break;
-#ifdef USE_IPV6
 				case AF_INET6:
 				case AF_INET6:
 						from = tcp_source_ipv6;
 						from = tcp_source_ipv6;
 					break;
 					break;
-#endif
 				default:
 				default:
 					/* error, bad af, ignore ... */
 					/* error, bad af, ignore ... */
 					break;
 					break;

+ 0 - 4
test/p_uri.c

@@ -31,11 +31,7 @@ struct cfg_group_core default_core_cfg = {
 	DEFAULT_BLST_MAX_MEM,
 	DEFAULT_BLST_MAX_MEM,
 #endif
 #endif
 	/* resolver */
 	/* resolver */
-#ifdef USE_IPV6
 	1,  /* dns_try_ipv6 -- on by default */
 	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 */
 	0,  /* dns_try_naptr -- off by default */
 	30,  /* udp transport preference (for naptr) */
 	30,  /* udp transport preference (for naptr) */
 	20,  /* tcp 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,
 	DEFAULT_BLST_MAX_MEM,
 #endif
 #endif
 	/* resolver */
 	/* resolver */
-#ifdef USE_IPV6
 	1,  /* dns_try_ipv6 -- on by default */
 	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 */
 	0,  /* dns_try_naptr -- off by default */
 	30,  /* udp transport preference (for naptr) */
 	30,  /* udp transport preference (for naptr) */
 	20,  /* tcp 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)
 static int setup_mcast_rcvr(int sock, union sockaddr_union* addr)
 {
 {
 	struct ip_mreq mreq;
 	struct ip_mreq mreq;
-#ifdef USE_IPV6
 	struct ipv6_mreq mreq6;
 	struct ipv6_mreq mreq6;
-#endif /* USE_IPV6 */
 	
 	
 	if (addr->s.sa_family==AF_INET){
 	if (addr->s.sa_family==AF_INET){
 		memcpy(&mreq.imr_multiaddr, &addr->sin.sin_addr, 
 		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;
 			return -1;
 		}
 		}
 		
 		
-#ifdef USE_IPV6
 	} else if (addr->s.sa_family==AF_INET6){
 	} else if (addr->s.sa_family==AF_INET6){
 		memcpy(&mreq6.ipv6mr_multiaddr, &addr->sin6.sin6_addr, 
 		memcpy(&mreq6.ipv6mr_multiaddr, &addr->sin6.sin6_addr, 
 		       sizeof(struct in6_addr));
 		       sizeof(struct in6_addr));
@@ -272,7 +269,6 @@ static int setup_mcast_rcvr(int sock, union sockaddr_union* addr)
 			return -1;
 			return -1;
 		}
 		}
 		
 		
-#endif /* USE_IPV6 */
 	} else {
 	} else {
 		LOG(L_ERR, "ERROR: setup_mcast_rcvr: Unsupported protocol family\n");
 		LOG(L_ERR, "ERROR: setup_mcast_rcvr: Unsupported protocol family\n");
 		return -1;
 		return -1;
@@ -325,7 +321,6 @@ int udp_init(struct socket_info* sock_info)
 					strerror(errno));
 					strerror(errno));
 			/* continue since this is not critical */
 			/* continue since this is not critical */
 		}
 		}
-#ifdef USE_IPV6
 	} else if (addr->s.sa_family==AF_INET6){
 	} else if (addr->s.sa_family==AF_INET6){
 		if (setsockopt(sock_info->socket, IPPROTO_IPV6, IPV6_TCLASS,
 		if (setsockopt(sock_info->socket, IPPROTO_IPV6, IPV6_TCLASS,
 					(void*)&optval, sizeof(optval)) ==-1) {
 					(void*)&optval, sizeof(optval)) ==-1) {
@@ -333,7 +328,6 @@ int udp_init(struct socket_info* sock_info)
 					strerror(errno));
 					strerror(errno));
 			/* continue since this is not critical */
 			/* continue since this is not critical */
 		}
 		}
-#endif
 	}
 	}
 
 
 #if defined (__OS_linux) && defined(UDP_ERRORS)
 #if defined (__OS_linux) && defined(UDP_ERRORS)
@@ -379,7 +373,6 @@ int udp_init(struct socket_info* sock_info)
 						" %s\n", strerror(errno));
 						" %s\n", strerror(errno));
 			}
 			}
 		}
 		}
-#ifdef USE_IPV6
 	} else if (addr->s.sa_family==AF_INET6){
 	} else if (addr->s.sa_family==AF_INET6){
 		if (setsockopt(sock_info->socket, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, 
 		if (setsockopt(sock_info->socket, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, 
 						&mcast_loopback, sizeof(mcast_loopback))==-1){
 						&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));
 						"(IPV6_MULTICAST_HOPS): %s\n", strerror(errno));
 			}
 			}
 		}
 		}
-#endif /* USE_IPV6*/
 	} else {
 	} else {
 		LOG(L_ERR, "ERROR: udp_init: Unsupported protocol family %d\n",
 		LOG(L_ERR, "ERROR: udp_init: Unsupported protocol family %d\n",
 					addr->s.sa_family);
 					addr->s.sa_family);
@@ -409,11 +401,9 @@ int udp_init(struct socket_info* sock_info)
 				(unsigned)sockaddru_len(*addr),
 				(unsigned)sockaddru_len(*addr),
 				sock_info->address_str.s,
 				sock_info->address_str.s,
 				strerror(errno));
 				strerror(errno));
-	#ifdef USE_IPV6
 		if (addr->s.sa_family==AF_INET6)
 		if (addr->s.sa_family==AF_INET6)
 			LOG(L_ERR, "ERROR: udp_init: might be caused by using a link "
 			LOG(L_ERR, "ERROR: udp_init: might be caused by using a link "
 					" local address, try site local or global\n");
 					" local address, try site local or global\n");
-	#endif
 		goto error;
 		goto error;
 	}
 	}
 
 

+ 1 - 7
ver_defs.h

@@ -39,12 +39,6 @@
 #define STATS_STR  "STATS: Off"
 #define STATS_STR  "STATS: Off"
 #endif
 #endif
 
 
-#ifdef USE_IPV6
-#define USE_IPV6_STR ", USE_IPV6"
-#else
-#define USE_IPV6_STR ""
-#endif
-
 #ifdef USE_TCP
 #ifdef USE_TCP
 #define USE_TCP_STR ", USE_TCP"
 #define USE_TCP_STR ", USE_TCP"
 #else
 #else
@@ -328,7 +322,7 @@
 #endif
 #endif
 
 
 #define SER_COMPILE_FLAGS \
 #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 \
 	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 \
 	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 \
 	NO_SIG_DEBUG_STR DNS_IP_HACK_STR  SHM_MEM_STR SHM_MMAP_STR PKG_MALLOC_STR \