Skip to content

Commit d2c93d1

Browse files
aescolarhenrikbrixandersen
authored andcommitted
tests: net: socket/tls_configurations: Fix net API use
In d45cd67 the mayority of the Zephyr codebased was changed to use the Zephyr native net_ prefixed types, but some were forgotten. Without this fix/change the code still builds as we are by now setting CONFIG_NET_NAMESPACE_COMPAT_MODE indirectly by enabling POSIX_API. But when this is not set, things fail to build. Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
1 parent 4e04b51 commit d2c93d1

File tree

1 file changed

+6
-5
lines changed
  • tests/net/socket/tls_configurations/src

1 file changed

+6
-5
lines changed

‎tests/net/socket/tls_configurations/src/main.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ static int create_socket(void)
8989
zsock_inet_pton(NET_AF_INET, "127.0.0.1", &addr.sin_addr);
9090

9191
#if defined(CONFIG_MBEDTLS_SSL_PROTO_TLS1_3)
92-
socket_fd = zsock_socket(addr.sin_family, NET_SOCK_STREAM, IPPROTO_TLS_1_3);
92+
socket_fd = zsock_socket(addr.sin_family, NET_SOCK_STREAM, NET_IPPROTO_TLS_1_3);
9393
#else
94-
socket_fd = zsock_socket(addr.sin_family, NET_SOCK_STREAM, IPPROTO_TLS_1_2);
94+
socket_fd = zsock_socket(addr.sin_family, NET_SOCK_STREAM, NET_IPPROTO_TLS_1_2);
9595
#endif
9696
if (socket_fd < 0) {
9797
LOG_ERR("Failed to create TLS socket (%d)", errno);
@@ -107,7 +107,7 @@ static int create_socket(void)
107107
#endif
108108
};
109109

110-
ret = zsock_setsockopt(socket_fd, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list,
110+
ret = zsock_setsockopt(socket_fd, ZSOCK_SOL_TLS, ZSOCK_TLS_SEC_TAG_LIST, sec_tag_list,
111111
sizeof(sec_tag_list));
112112
if (ret < 0) {
113113
LOG_ERR("Failed to set TLS_SEC_TAG_LIST option (%d)", errno);
@@ -116,7 +116,8 @@ static int create_socket(void)
116116

117117
/* HOSTNAME is only required for key exchanges that use a certificate. */
118118
#if defined(USE_CERTIFICATE)
119-
ret = zsock_setsockopt(socket_fd, SOL_TLS, TLS_HOSTNAME, "localhost", sizeof("localhost"));
119+
ret = zsock_setsockopt(socket_fd, ZSOCK_SOL_TLS, ZSOCK_TLS_HOSTNAME, "localhost",
120+
sizeof("localhost"));
120121
if (ret < 0) {
121122
LOG_ERR("Failed to set TLS_HOSTNAME option (%d)", errno);
122123
return -errno;
@@ -218,7 +219,7 @@ int main(void)
218219

219220
wait_for_event();
220221

221-
ret = zsock_recv(socket_fd, test_buf, data_len, MSG_WAITALL);
222+
ret = zsock_recv(socket_fd, test_buf, data_len, ZSOCK_MSG_WAITALL);
222223
if (ret == 0) {
223224
LOG_ERR("Server terminated unexpectedly");
224225
ret = -EIO;

0 commit comments

Comments
 (0)