Skip to content
Permalink
Browse files
Add separate list-taps.exe "test"
This should help debug user reports of tailing to find tap devices,
like https://gitlab.com/openconnect/openconnect/issues/88

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
dwmw2 committed Dec 17, 2019
1 parent 0be961a commit 051ec3bed1e5cba15fb3874905f20bd655cda6c5
Showing with 53 additions and 0 deletions.
  1. +3 −0 tests/Makefile.am
  2. +46 −0 tests/list-taps.c
  3. +4 −0 tun-win32.c
@@ -81,6 +81,9 @@ TESTS_ENVIRONMENT = srcdir="$(srcdir)" \

C_TESTS = lzstest seqtest

if OPENCONNECT_WIN32
C_TESTS += list-taps
endif

if CHECK_DTLS
C_TESTS += bad_dtls_test
@@ -0,0 +1,46 @@
/*
* OpenConnect (SSL + DTLS) VPN client
*
* Copyright © 2019 David Woodhouse
*
* Author: David Woodhouse <dwmw2@infradead.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/

#include <config.h>

#include <stdint.h>
#include <stdio.h>

#define __OPENCONNECT_INTERNAL_H__

#define vpn_progress(v, d, ...) printf(__VA_ARGS__)
#define _(x) x

struct openconnect_info {
char *ifname;
};

#define __LIST_TAPS__

#include "../tun-win32.c"

static intptr_t print_tun(struct openconnect_info *vpninfo, char *guid, wchar_t *wname)
{
printf("Found tun device '%S'\n", wname);
return 0;
}

int main(void)
{
search_taps(NULL, print_tun, 1);
return 0;
}
@@ -160,6 +160,8 @@ static intptr_t search_taps(struct openconnect_info *vpninfo, tap_callback *cb,
return ret;
}

#ifndef __LIST_TAPS__

static int get_adapter_index(struct openconnect_info *vpninfo, char *guid)
{
struct oc_text_buf *buf = buf_alloc();
@@ -445,3 +447,5 @@ int openconnect_setup_tun_script(struct openconnect_info *vpninfo,
_("Spawning tunnel scripts is not yet supported on Windows\n"));
return -1;
}

#endif /* __LIST_TAPS__ */

0 comments on commit 051ec3b

Please sign in to comment.