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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
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@xxxxxxxxxxx>
---
 examples/io_uring-udp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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",
-- 
Ammar Faizi




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux