Module: sip-router
Branch: master
Commit: 3e154160f4b94dcb55eb3057dc9c3d346ec25ac8
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3e154160f4b94dcb55eb3057dc9c3d346ec25ac8

Author: Marius Zbihlei <[email protected]>
Committer: Marius Zbihlei <[email protected]>
Date:   Fri Oct 14 11:37:20 2011 +0300

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

---

 cfg.y         |    2 +-
 cfg_core.c    |    8 --------
 cfg_core.h    |    5 -----
 globals.h     |    4 ++++
 main.c        |    4 ++++
 socket_info.c |   16 ++++++++--------
 6 files changed, 17 insertions(+), 22 deletions(-)

diff --git a/cfg.y b/cfg.y
index ab9b126..9317541 100644
--- a/cfg.y
+++ b/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"); }
diff --git a/cfg_core.c b/cfg_core.c
index bd5a00d..27a55b3 100644
--- a/cfg_core.c
+++ b/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"},
diff --git a/cfg_core.h b/cfg_core.h
index ada5b89..25f69ae 100644
--- a/cfg_core.h
+++ b/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
diff --git a/globals.h b/globals.h
index 06c493d..0b7184a 100644
--- a/globals.h
+++ b/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;
 
diff --git a/main.c b/main.c
index f80f88c..5e4defa 100644
--- a/main.c
+++ b/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*/
diff --git a/socket_info.c b/socket_info.c
index 4e7d27e..09aba4d 100644
--- a/socket_info.c
+++ b/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,


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to