Browse code

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 authored on 14/10/2011 08:37:20
Showing 6 changed files
... ...
@@ -886,7 +886,7 @@ assign_stm:
886 886
 	| DNS_CACHE_GC_INT error { yyerror("boolean value expected"); }
887 887
 	| DNS_CACHE_DEL_NONEXP EQUAL NUMBER   { IF_DNS_CACHE(default_core_cfg.dns_cache_del_nonexp=$3); }
888 888
 	| DNS_CACHE_DEL_NONEXP error { yyerror("boolean value expected"); }
889
-	| AUTO_BIND_IPV6 EQUAL NUMBER {IF_AUTO_BIND_IPV6(default_core_cfg.auto_bind_ipv6 = $3);}
889
+	| AUTO_BIND_IPV6 EQUAL NUMBER {IF_AUTO_BIND_IPV6(auto_bind_ipv6 = $3);}
890 890
 	| AUTO_BIND_IPV6 error { yyerror("boolean value expected"); }
891 891
 	| DST_BLST_INIT EQUAL NUMBER   { IF_DST_BLACKLIST(dst_blacklist_init=$3); }
892 892
 	| DST_BLST_INIT error { yyerror("boolean value expected"); }
... ...
@@ -105,9 +105,6 @@ struct cfg_group_core default_core_cfg = {
105 105
 	0, /*!< dns_cache_del_nonexp -- delete only expired entries by default */
106 106
 	0, /*!< dns_cache_rec_pref -- 0 by default, do not check the existing entries. */
107 107
 #endif
108
-#ifdef USE_IPV6
109
-	0, /*!< auto_bind_ipv6 -- off by default */
110
-#endif
111 108
 #ifdef PKG_MALLOC
112 109
 	0, /*!< mem_dump_pkg */
113 110
 #endif
... ...
@@ -275,11 +272,6 @@ cfg_def_t core_cfg_def[] = {
275 275
 		" 2 - prefer new records"
276 276
 		" 3 - prefer records with longer lifetime"},
277 277
 #endif
278
-#ifdef USE_IPV6
279
-	{"auto_bind_ipv6", 	CFG_VAR_INT,	0, 1, 0, 0, 0,
280
-		"enable/disable auto binding of proxy to IPV6 interfaces."
281
-		"default is disabled 0"},
282
-#endif
283 278
 #ifdef PKG_MALLOC
284 279
 	{"mem_dump_pkg",	CFG_VAR_INT,	0, 0, 0, mem_dump_pkg_cb,
285 280
 		"dump process memory status, parameter: pid_number"},
... ...
@@ -93,11 +93,6 @@ struct cfg_group_core {
93 93
 	int dns_cache_del_nonexp;
94 94
 	int dns_cache_rec_pref;
95 95
 #endif
96
-
97
-#ifdef USE_IPV6
98
-	int auto_bind_ipv6;
99
-#endif
100
-
101 96
 #ifdef PKG_MALLOC
102 97
 	int mem_dump_pkg;
103 98
 #endif
... ...
@@ -137,6 +137,10 @@ extern int stun_allow_stun;
137 137
 extern int stun_allow_fp;
138 138
 #endif
139 139
 
140
+#ifdef USE_IPV6
141
+extern int auto_bind_ipv6;
142
+#endif
143
+
140 144
 extern int tos;
141 145
 extern int pmtu_discovery;
142 146
 
... ...
@@ -421,6 +421,10 @@ int mcast_ttl = -1; /* if -1, don't touch it, use the default (usually 1) */
421 421
 int tos = IPTOS_LOWDELAY;
422 422
 int pmtu_discovery = 0;
423 423
 
424
+#ifdef USE_IPV6
425
+int auto_bind_ipv6 = 0;
426
+#endif
427
+
424 428
 #if 0
425 429
 char* names[MAX_LISTEN];              /* our names */
426 430
 int names_len[MAX_LISTEN];            /* lengths of the names*/
... ...
@@ -1712,9 +1712,9 @@ int fix_all_socket_lists()
1712 1712
 		if ( ( (add_interfaces(0, AF_INET, 0,  PROTO_UDP, &ai_lst)==0)
1713 1713
 #ifdef USE_IPV6
1714 1714
 #ifdef __OS_linux
1715
-		&&  (!(cfg_get(core, core_cfg, auto_bind_ipv6)) || add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_UDP, &ai_lst) == 0)
1715
+		&&  (!auto_bind_ipv6 || add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_UDP, &ai_lst) == 0)
1716 1716
 #else
1717
-		&& ( !(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 */
1717
+		&& ( !auto_bind_ipv6 || add_interfaces(0, AF_INET6, 0,  PROTO_UDP, &ai_lst) !=0 ) /* add_interface does not work for IPv6 on Linux */
1718 1718
 #endif /* __OS_linux */
1719 1719
 #endif /* USE_IPV6 */
1720 1720
 			 ) && (addr_info_to_si_lst(ai_lst, 0, PROTO_UDP, 0, &udp_listen)==0)){
... ...
@@ -1726,9 +1726,9 @@ int fix_all_socket_lists()
1726 1726
 				if ( ((add_interfaces(0, AF_INET, 0,  PROTO_TCP, &ai_lst)!=0)
1727 1727
 #ifdef USE_IPV6
1728 1728
 #ifdef __OS_linux
1729
-    				|| (cfg_get(core, core_cfg, auto_bind_ipv6) && add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_TCP, &ai_lst) != 0)
1729
+    				|| (auto_bind_ipv6 && add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_TCP, &ai_lst) != 0)
1730 1730
 #else
1731
-				|| (cfg_get(core, core_cfg, auto_bind_ipv6) && add_interfaces(0, AF_INET6, 0,  PROTO_TCP, &ai_lst) !=0 )
1731
+				|| (auto_bind_ipv6 && add_interfaces(0, AF_INET6, 0,  PROTO_TCP, &ai_lst) !=0 )
1732 1732
 #endif /* __OS_linux */
1733 1733
 #endif /* USE_IPV6 */
1734 1734
 				) || (addr_info_to_si_lst(ai_lst, 0, PROTO_TCP, 0,
... ...
@@ -1742,9 +1742,9 @@ int fix_all_socket_lists()
1742 1742
 										&ai_lst)!=0)
1743 1743
 #ifdef USE_IPV6
1744 1744
 #ifdef __OS_linux
1745
-    				|| (cfg_get(core, core_cfg, auto_bind_ipv6) && add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_TLS, &ai_lst) != 0)
1745
+    				|| (auto_bind_ipv6 && add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_TLS, &ai_lst) != 0)
1746 1746
 #else
1747
-				|| (cfg_get(core, core_cfg, auto_bind_ipv6) && add_interfaces(0, AF_INET6, 0,  PROTO_TLS, &ai_lst)!=0)
1747
+				|| (auto_bind_ipv6 && add_interfaces(0, AF_INET6, 0,  PROTO_TLS, &ai_lst)!=0)
1748 1748
 #endif /* __OS_linux */
1749 1749
 #endif /* USE_IPV6 */
1750 1750
 					) || (addr_info_to_si_lst(ai_lst, 0, PROTO_TLS, 0,
... ...
@@ -1761,9 +1761,9 @@ int fix_all_socket_lists()
1761 1761
 				if (((add_interfaces(0, AF_INET, 0,  PROTO_SCTP, &ai_lst)!=0)
1762 1762
 #ifdef USE_IPV6
1763 1763
 #ifdef __OS_linux
1764
-    				|| (cfg_get(core, core_cfg, auto_bind_ipv6) && add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_SCTP, &ai_lst) != 0)
1764
+    				|| (auto_bind_ipv6 && add_interfaces_via_netlink(0, AF_INET6, 0, PROTO_SCTP, &ai_lst) != 0)
1765 1765
 #else
1766
-				|| (cfg_get(core, core_cfg, auto_bind_ipv6) && add_interfaces(0, AF_INET6, 0,  PROTO_SCTP, &ai_lst) != 0)
1766
+				|| (auto_bind_ipv6 && add_interfaces(0, AF_INET6, 0,  PROTO_SCTP, &ai_lst) != 0)
1767 1767
 #endif /* __OS_linux */
1768 1768
 #endif /* USE_IPV6 */
1769 1769
 					) || (addr_info_to_si_lst(ai_lst, 0, PROTO_SCTP, 0,