Skip to content

Commit

Permalink
doc and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Sep 18, 2024
1 parent 4749643 commit 12712db
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions include/aws/io/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ AWS_IO_API int aws_socket_validate_port_for_bind(uint32_t port, enum aws_socket_
AWS_IO_API void aws_socket_endpoint_init_local_address_for_test(struct aws_socket_endpoint *endpoint);

/**
* Assigns a random address (UUID) for use with AWS_SOCKET_LOCAL (Unix Domain Sockets).
* For use in internal tests only.
* Validates whether the network interface name is valid. On Windows, it will always return false since network
* interface names are not supported on Windows
*/
AWS_IO_API bool aws_is_network_interface_name_valid(char *interface_name);

Expand Down
6 changes: 1 addition & 5 deletions source/posix/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -2010,11 +2010,7 @@ void aws_socket_endpoint_init_local_address_for_test(struct aws_socket_endpoint

bool aws_is_network_interface_name_valid(char *interface_name) {
if (if_nametoindex(interface_name) == 0) {
AWS_LOGF_ERROR(
AWS_LS_IO_SOCKET,
"network_interface_name(%s) is invalid with errno: %d",
interface_name,
errno);
AWS_LOGF_ERROR(AWS_LS_IO_SOCKET, "network_interface_name(%s) is invalid with errno: %d", interface_name, errno);
return false;
}
return true;
Expand Down
12 changes: 6 additions & 6 deletions tests/socket_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,14 +498,14 @@ AWS_TEST_CASE(test_socket_with_bind_to_invalid_interface, s_test_socket_with_bin

static int s_test_is_network_interface_name_valid(struct aws_allocator *allocator, void *ctx) {
(void)ctx;
(void) allocator;
(void)allocator;

ASSERT_FALSE(aws_is_network_interface_name_valid("invalid_name"));
#if defined(AWS_OS_APPLE)
ASSERT_TRUE(aws_is_network_interface_name_valid("lo0"));
#elif !defined(AWS_OS_WINDOWS)
ASSERT_TRUE(aws_is_network_interface_name_valid("lo"));
#endif
#if defined(AWS_OS_APPLE)
ASSERT_TRUE(aws_is_network_interface_name_valid("lo0"));
#elif !defined(AWS_OS_WINDOWS)
ASSERT_TRUE(aws_is_network_interface_name_valid("lo"));
#endif
return AWS_OP_SUCCESS;
}
AWS_TEST_CASE(test_is_network_interface_name_valid, s_test_is_network_interface_name_valid)
Expand Down

0 comments on commit 12712db

Please sign in to comment.