Skip to content

Commit

Permalink
Abort gracefully on raw socket permission error
Browse files Browse the repository at this point in the history
  • Loading branch information
blechschmidt committed Dec 8, 2022
1 parent b504b9f commit b022a4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ set(CMAKE_C_STANDARD 11)
add_definitions(-DHAVE_EPOLL -DHAVE_SYSINFO)

set(SOURCE_FILES src/main.c src/list.h src/hashmap.h src/massdns.h src/security.h src/net.h src/string.h src/buffers.h src/dns.h
src/timed_ring.h src/random.h src/cmd.h src/flow.h src/auto_concurrency.h src/tcp.h src/debug.h)
src/timed_ring.h src/random.h src/cmd.h src/flow.h src/auto_concurrency.h src/tcp.h)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
add_executable(massdns ${SOURCE_FILES})
6 changes: 4 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,8 @@ void tcp_raw_add_sender_socket(int version)
return;

error:
log_msg(LOG_ERROR, "Failed to create IPv%d TCP raw socket: %s\n", version, strerror(errno));
log_msg(LOG_ERROR, "Failed to create IPv%d TCP raw sending socket: %s\n", version, strerror(errno));
clean_exit(1);
}

void tcp_raw_add_receiver_socket(int version)
Expand All @@ -608,7 +609,8 @@ void tcp_raw_add_receiver_socket(int version)
return;

error:
log_msg(LOG_ERROR, "Failed to create IPv%d TCP raw socket: %s\n", version, strerror(errno));
log_msg(LOG_ERROR, "Failed to create IPv%d TCP raw receiving socket: %s\n", version, strerror(errno));
clean_exit(1);
}


Expand Down

0 comments on commit b022a4f

Please sign in to comment.