فهرست منبع

core: auto_bind_ipv6 : changed param from cfg framework to normal global parameter as setting it at run time doesn't change anything

Marius Zbihlei 14 سال پیش
والد
کامیت
3e154160f4
6فایلهای تغییر یافته به همراه17 افزوده شده و 22 حذف شده
  1. 1 1
      cfg.y
  2. 0 8
      cfg_core.c
  3. 0 5
      cfg_core.h
  4. 4 0
      globals.h
  5. 4 0
      main.c
  6. 8 8
      socket_info.c

+ 1 - 1
cfg.y

@@ -886,7 +886,7 @@ assign_stm:
 	| DNS_CACHE_GC_INT error { yyerror("boolean value expected"); }
 	| DNS_CACHE_DEL_NONEXP EQUAL NUMBER   { IF_DNS_CACHE(default_core_cfg.dns_cache_del_nonexp=$3); }
 	| DNS_CACHE_DEL_NONEXP error { yyerror("boolean value expected"); }
-	| AUTO_BIND_IPV6 EQUAL NUMBER {IF_AUTO_BIND_IPV6(default_core_cfg.auto_bind_ipv6 = $3);}
+	| AUTO_BIND_IPV6 EQUAL NUMBER {IF_AUTO_BIND_IPV6(auto_bind_ipv6 = $3);}
 	| AUTO_BIND_IPV6 error { yyerror("boolean value expected"); }
 	| DST_BLST_INIT EQUAL NUMBER   { IF_DST_BLACKLIST(dst_blacklist_init=$3); }
 	| DST_BLST_INIT error { yyerror("boolean value expected"); }

+ 0 - 8
cfg_core.c

@@ -105,9 +105,6 @@ struct cfg_group_core default_core_cfg = {
 	0, /*!< dns_cache_del_nonexp -- delete only expired entries by default */
 	0, /*!< dns_cache_rec_pref -- 0 by default, do not check the existing entries. */
 #endif
-#ifdef USE_IPV6
-	0, /*!< auto_bind_ipv6 -- off by default */
-#endif
 #ifdef PKG_MALLOC
 	0, /*!< mem_dump_pkg */
 #endif
@@ -275,11 +272,6 @@ cfg_def_t core_cfg_def[] = {
 		" 2 - prefer new records"
 		" 3 - prefer records with longer lifetime"},
 #endif
-#ifdef USE_IPV6
-	{"auto_bind_ipv6", 	CFG_VAR_INT,	0, 1, 0, 0, 0,
-		"enable/disable auto binding of proxy to IPV6 interfaces."
-		"default is disabled 0"},
-#endif
 #ifdef PKG_MALLOC
 	{"mem_dump_pkg",	CFG_VAR_INT,	0, 0, 0, mem_dump_pkg_cb,
 		"dump process memory status, parameter: pid_number"},

+ 0 - 5
cfg_core.h

@@ -93,11 +93,6 @@ struct cfg_group_core {
 	int dns_cache_del_nonexp;
 	int dns_cache_rec_pref;
 #endif
-
-#ifdef USE_IPV6
-	int auto_bind_ipv6;
-#endif
-
 #ifdef PKG_MALLOC
 	int mem_dump_pkg;
 #endif

+ 4 - 0
globals.h

@@ -137,6 +137,10 @@ extern int stun_allow_stun;
 extern int stun_allow_fp;
 #endif
 
+#ifdef USE_IPV6
+extern int auto_bind_ipv6;
+#endif
+
 extern int tos;
 extern int pmtu_discovery;
 

+ 4 - 0
main.c

@@ -421,6 +421,10 @@ int mcast_ttl = -1; /* if -1, don't touch it, use the default (usually 1) */
 int tos = IPTOS_LOWDELAY;
 int pmtu_discovery = 0;
 
+#ifdef USE_IPV6
+int auto_bind_ipv6 = 0;
+#endif
+
 #if 0
 char* names[MAX_LISTEN];              /* our names */
 int names_len[MAX_LISTEN];            /* lengths of the names*/

+ 8 - 8
socket_info.c

@@ -1712,9 +1712,9 @@ int fix_all_socket_lists()
 		if ( ( (add_interfaces(0, AF_INET, 0,  PROTO_UDP, &ai_lst)==0)
 #ifdef USE_IPV6
 #ifdef __OS_linux
-		&&  (!(cfg_get(core, core_cfg, 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
-		&& ( !(cfg_get(core, core_cfg, 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 /* USE_IPV6 */
 			 ) && (addr_info_to_si_lst(ai_lst, 0, PROTO_UDP, 0, &udp_listen)==0)){
@@ -1726,9 +1726,9 @@ int fix_all_socket_lists()
 				if ( ((add_interfaces(0, AF_INET, 0,  PROTO_TCP, &ai_lst)!=0)
 #ifdef USE_IPV6
 #ifdef __OS_linux
-    				|| (cfg_get(core, core_cfg, 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
-				|| (cfg_get(core, core_cfg, 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 /* USE_IPV6 */
 				) || (addr_info_to_si_lst(ai_lst, 0, PROTO_TCP, 0,
@@ -1742,9 +1742,9 @@ int fix_all_socket_lists()
 										&ai_lst)!=0)
 #ifdef USE_IPV6
 #ifdef __OS_linux
-    				|| (cfg_get(core, core_cfg, 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
-				|| (cfg_get(core, core_cfg, 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 /* USE_IPV6 */
 					) || (addr_info_to_si_lst(ai_lst, 0, PROTO_TLS, 0,
@@ -1761,9 +1761,9 @@ int fix_all_socket_lists()
 				if (((add_interfaces(0, AF_INET, 0,  PROTO_SCTP, &ai_lst)!=0)
 #ifdef USE_IPV6
 #ifdef __OS_linux
-    				|| (cfg_get(core, core_cfg, 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
-				|| (cfg_get(core, core_cfg, 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 /* USE_IPV6 */
 					) || (addr_info_to_si_lst(ai_lst, 0, PROTO_SCTP, 0,