Skip to content

Windows: Fix warnings and deprecations #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: main
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- name: configure
run: cmake -B build -D CMAKE_BUILD_TYPE=Release
- name: build
run: cmake --build build --parallel 2
# unfortunately the tests manipulate tap/tun drivers. This is not allowed in GA
# - name: test
# run: cd build && ctest -VV
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# libtuntap CMakeLists.txt
# ========================
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.5)

project(libtuntap)

Expand Down
30 changes: 16 additions & 14 deletions regress/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,29 @@ foreach(SOURCE_FILE ${ALL_C_TESTS})
COMMAND $<TARGET_FILE:${TEST_NAME}>)
endforeach(SOURCE_FILE)

# Shell based tests
# Shell based tests (needs a posix shell)
# -----------------
file(GLOB ALL_SH_TESTS test*.sh)
foreach(SOURCE_FILE ${ALL_SH_TESTS})
get_filename_component(TEST_NAME ${SOURCE_FILE} NAME_WE)
get_filename_component(TEST_SRC_PATH ${SOURCE_FILE} DIRECTORY)
if (UNIX)
file(GLOB ALL_SH_TESTS test*.sh)
foreach(SOURCE_FILE ${ALL_SH_TESTS})
get_filename_component(TEST_NAME ${SOURCE_FILE} NAME_WE)
get_filename_component(TEST_SRC_PATH ${SOURCE_FILE} DIRECTORY)

string(REPLACE "test" "helper" HELPER_NAME ${TEST_NAME})
string(REPLACE "test" "helper" HELPER_NAME ${TEST_NAME})

if (EXISTS ${TEST_SRC_PATH}/${HELPER_NAME}.c)
add_executable(${HELPER_NAME} ${TEST_SRC_PATH}/${HELPER_NAME}.c)
target_link_libraries(${HELPER_NAME} tuntap)
endif()
add_test(NAME tuntap.${TEST_NAME}
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}.sh)
endforeach(SOURCE_FILE)
if (EXISTS ${TEST_SRC_PATH}/${HELPER_NAME}.c)
add_executable(${HELPER_NAME} ${TEST_SRC_PATH}/${HELPER_NAME}.c)
target_link_libraries(${HELPER_NAME} tuntap)
endif()
add_test(NAME tuntap.${TEST_NAME}
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}.sh)
endforeach(SOURCE_FILE)
endif()

# "Will fail" tests
# -----------------

if(Darwin AND Windows)
if(Darwin OR Windows)
set_tests_properties(tuntap.test39 PROPERTIES WILL_FAIL true)
set_tests_properties(tuntap.test40 PROPERTIES WILL_FAIL true)
endif()
Expand Down
2 changes: 1 addition & 1 deletion tuntap-windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ formated_error(LPWSTR pMessage, DWORD m, ...) {
LPWSTR pBuffer = NULL;

va_list args = NULL;
va_start(args, pMessage);
va_start(args, m);

FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_ALLOCATE_BUFFER,
Expand Down
1 change: 0 additions & 1 deletion tuntap.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ tuntap_set_ip(struct device *dev, const char *addr, int netmask) {
t_tun_in_addr baddr4;
t_tun_in6_addr baddr6;
uint32_t mask;
int errval;

/* Only accept started device */
if (dev->tun_fd == TUNFD_INVALID_VALUE) {
Expand Down