summaryrefslogtreecommitdiff
path: root/src/openvpn/win32.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-06-27 13:56:16 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-06-27 13:56:16 +0200
commit749384a154025e268b53cf3cc79eaeddde2b3ceb (patch)
tree27baa9e6aec76635d750405d90cd461440a656d1 /src/openvpn/win32.c
parentdb4f04c584f7d4e828b5d317cf40962b9d854ac5 (diff)
initial stretch branch release 2.4.0-6
Diffstat (limited to 'src/openvpn/win32.c')
-rw-r--r--src/openvpn/win32.c58
1 files changed, 10 insertions, 48 deletions
diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
index d0b10ba..e26f54d 100644
--- a/src/openvpn/win32.c
+++ b/src/openvpn/win32.c
@@ -16,9 +16,10 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
@@ -60,12 +61,6 @@
static HANDLE m_hEngineHandle = NULL; /* GLOBAL */
/*
- * TAP adapter original metric value
- */
-static int tap_metric_v4 = -1; /* GLOBAL */
-static int tap_metric_v6 = -1; /* GLOBAL */
-
-/*
* Windows internal socket API state (opaque).
*/
static struct WSAData wsa_state; /* GLOBAL */
@@ -574,8 +569,7 @@ win32_keyboard_get(struct win32_signal *ws)
if (HANDLE_DEFINED(ws->in.read))
{
INPUT_RECORD ir;
- do
- {
+ do {
DWORD n;
if (!keyboard_input_available(ws))
{
@@ -687,8 +681,7 @@ win32_pause(struct win32_signal *ws)
{
int status;
msg(M_INFO|M_NOPREFIX, "Press any key to continue...");
- do
- {
+ do {
status = WaitForSingleObject(ws->in.read, INFINITE);
} while (!win32_keyboard_get(ws));
}
@@ -991,9 +984,7 @@ env_block(const struct env_set *es)
bool path_seen = false;
for (e = es->list; e != NULL; e = e->next)
- {
nchars += strlen(e->string) + 1;
- }
nchars += strlen(force_path)+1;
@@ -1333,8 +1324,8 @@ win_wfp_block_dns(const NET_IFINDEX index, const HANDLE msg_channel)
goto out;
}
- status = GetModuleFileNameW(NULL, openvpnpath, _countof(openvpnpath));
- if (status == 0 || status == _countof(openvpnpath))
+ status = GetModuleFileNameW(NULL, openvpnpath, sizeof(openvpnpath));
+ if (status == 0 || status == sizeof(openvpnpath))
{
msg(M_WARN|M_ERRNO, "block_dns: cannot get executable path");
goto out;
@@ -1342,27 +1333,6 @@ win_wfp_block_dns(const NET_IFINDEX index, const HANDLE msg_channel)
status = add_block_dns_filters(&m_hEngineHandle, index, openvpnpath,
block_dns_msg_handler);
- if (status == 0)
- {
- tap_metric_v4 = get_interface_metric(index, AF_INET);
- tap_metric_v6 = get_interface_metric(index, AF_INET6);
- if (tap_metric_v4 < 0)
- {
- /* error, should not restore metric */
- tap_metric_v4 = -1;
- }
- if (tap_metric_v6 < 0)
- {
- /* error, should not restore metric */
- tap_metric_v6 = -1;
- }
- status = set_interface_metric(index, AF_INET, BLOCK_DNS_IFACE_METRIC);
- if (!status)
- {
- set_interface_metric(index, AF_INET6, BLOCK_DNS_IFACE_METRIC);
- }
- }
-
ret = (status == 0);
out:
@@ -1371,27 +1341,19 @@ out:
}
bool
-win_wfp_uninit(const NET_IFINDEX index, const HANDLE msg_channel)
+win_wfp_uninit(const HANDLE msg_channel)
{
dmsg(D_LOW, "Uninitializing WFP");
if (msg_channel)
{
msg(D_LOW, "Using service to delete block dns filters");
- win_block_dns_service(false, index, msg_channel);
+ win_block_dns_service(false, -1, msg_channel);
}
else
{
delete_block_dns_filters(m_hEngineHandle);
m_hEngineHandle = NULL;
- if (tap_metric_v4 >= 0)
- {
- set_interface_metric(index, AF_INET, tap_metric_v4);
- }
- if (tap_metric_v6 >= 0)
- {
- set_interface_metric(index, AF_INET6, tap_metric_v6);
- }
}
return true;