Skip to content
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

test: udp_listen NULL #1100

Closed
wants to merge 2 commits into from
Closed
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
7 changes: 5 additions & 2 deletions src/net/sockopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,19 @@ int net_sockopt_v6only(re_sock_t fd, bool only)
{
int on = only;

#ifndef OPENBSD
DEBUG_NOTICE("net_sockopt_v6only: on=%d\n", on);

#ifdef IPV6_V6ONLY
if (-1 == setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY,
BUF_CAST &on, sizeof(on))) {
int err = RE_ERRNO_SOCK;
DEBUG_WARNING("IPV6_V6ONLY: %m\n", err);
return err;
}
#else
DEBUG_NOTICE("net_sockopt_v6only: COMPILE-TIME DISABLED\n");
#endif
#endif

return 0;
}

5 changes: 4 additions & 1 deletion test/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ static int send_data(struct udp_sock *us, const struct sa *peer,
mb->pos = 0;

err = udp_send(us, peer, mb);
if (err) {
DEBUG_WARNING("udp_send error: %m\n", err);
}

mem_deref(mb);

Expand Down Expand Up @@ -164,7 +167,7 @@ int test_udp(void)
if (err)
goto out;

err = udp_listen(&ut->usc, &ut->cli, udp_recv_client, ut);
err = udp_listen(&ut->usc, NULL, udp_recv_client, ut);
err |= udp_listen(&ut->uss, &ut->srv, udp_recv_server, ut);
if (err)
goto out;
Expand Down
Loading