diff mbox series

[liburing,v1,1/3] io_uring-udp: Fix the wrong `inet_ntop()` argument

Message ID 20230307203830.612939-2-ammarfaizi2@gnuweeb.org (mailing list archive)
State New
Headers show
Series Small fixes and CI update | expand

Commit Message

Ammar Faizi March 7, 2023, 8:38 p.m. UTC
The verbose output shows the wrong IP address. The second argument of
inet_ntop() should be a pointer to the binary representation of the IP
address. Fix it.

Reported-by: @mczka # A GitHub user
Cc: Dylan Yudaken <dylany@fb.com>
Closes: https://github.com/axboe/liburing/pull/815
Fixes: https://github.com/axboe/liburing/issues/814
Fixes: 61d472b51e761e61c ("add an example for a UDP server")
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
---
 examples/io_uring-udp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/examples/io_uring-udp.c b/examples/io_uring-udp.c
index a07c3e2a6f20cd17..b81a5e7c47afd9c8 100644
--- a/examples/io_uring-udp.c
+++ b/examples/io_uring-udp.c
@@ -275,7 +275,7 @@  static int process_cqe_recv(struct ctx *ctx, struct io_uring_cqe *cqe,
 		const char *name;
 		struct sockaddr_in *addr = io_uring_recvmsg_name(o);
 
-		name = inet_ntop(ctx->af, addr, buff, sizeof(buff));
+		name = inet_ntop(ctx->af, &addr->sin_addr, buff, sizeof(buff));
 		if (!name)
 			name = "<INVALID>";
 		fprintf(stderr, "received %u bytes %d from %s:%d\n",