From d0495780d13d2a0981be7c31c58a9192f9f67251 Mon Sep 17 00:00:00 2001 From: Guido Serassio Date: Tue, 8 Jul 2008 12:07:15 +0200 Subject: [PATCH] Windows port: add option for control of IP address changes notification in squid.conf On Windows Squid by default will monitor IP address changes and will reconfigure itself after any detected event. This is very useful for proxies connected to internet with dial-up interfaces. In some cases (a Proxy server acting as VPN gateway is one) it could be desiderable to disable this behaviour. --- src/WinSvc.cc | 6 ++++-- src/cf.data.pre | 14 ++++++++++++++ src/structs.h | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) mode change 100644 => 100755 src/structs.h diff --git a/src/WinSvc.cc b/src/WinSvc.cc index 8f7a2ba942..daae1f758d 100755 --- a/src/WinSvc.cc +++ b/src/WinSvc.cc @@ -390,16 +390,18 @@ WIN32_Abort(int sig) WIN32_Exit(); } +#ifdef _SQUID_MSWIN_ void WIN32_IpAddrChangeMonitorExit() { DWORD status = ERROR_SUCCESS; - if (NotifyAddrChange_thread == INVALID_HANDLE_VALUE) { + if (NotifyAddrChange_thread != INVALID_HANDLE_VALUE) { TerminateThread(NotifyAddrChange_thread, status); CloseHandle(NotifyAddrChange_thread); } } +#endif void WIN32_Exit() @@ -459,7 +461,7 @@ WIN32_IpAddrChangeMonitorInit() DWORD status = ERROR_SUCCESS; DWORD threadID = 0, ThrdParam = 0; - if (WIN32_run_mode == _WIN_SQUID_RUN_MODE_SERVICE) { + if ((WIN32_run_mode == _WIN_SQUID_RUN_MODE_SERVICE) && (Config.onoff.WIN32_IpAddrChangeMonitor)) { NotifyAddrChange_thread = CreateThread(NULL, 0, WIN32_IpAddrChangeMonitor, &ThrdParam, 0, &threadID); if (NotifyAddrChange_thread == NULL) { diff --git a/src/cf.data.pre b/src/cf.data.pre index f81bb65130..5aec56248e 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -5478,4 +5478,18 @@ DOC_START rounded to 1000. DOC_END +NAME: windows_ipaddrchangemonitor +COMMENT: on|off +TYPE: onoff +DEFAULT: on +LOC: Config.onoff.WIN32_IpAddrChangeMonitor +DOC_START + On Windows Squid by default will monitor IP address changes and will + reconfigure itself after any detected event. This is very useful for + proxies connected to internet with dial-up interfaces. + In some cases (a Proxy server acting as VPN gateway is one) it could be + desiderable to disable this behaviour setting this to 'off'. + Note: after changing this, Squid service must be restarted. +DOC_END + EOF diff --git a/src/structs.h b/src/structs.h old mode 100644 new mode 100755 index 3cdaa4a507..f7901a85b6 --- a/src/structs.h +++ b/src/structs.h @@ -554,6 +554,7 @@ struct _SquidConfig int httpd_suppress_version_string; int global_internal_static; int debug_override_X; + int WIN32_IpAddrChangeMonitor; } onoff; -- 2.47.2