mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ammar Faizi <ammarfaizi2@gnuweeb.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: Pavel Begunkov <asml.silence@gmail.com>,
	io-uring Mailing List <io-uring@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ammar Faizi <ammarfaizi2@gnuweeb.org>,
	Dylan Yudaken <dylany@fb.com>
Subject: [PATCH liburing v1 1/3] io_uring-udp: Fix the wrong `inet_ntop()` argument
Date: Wed,  8 Mar 2023 03:38:28 +0700	[thread overview]
Message-ID: <20230307203830.612939-2-ammarfaizi2@gnuweeb.org> (raw)
In-Reply-To: <20230307203830.612939-1-ammarfaizi2@gnuweeb.org>

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 --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


  reply	other threads:[~2023-03-07 20:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 20:38 [PATCH liburing v1 0/3] Small fixes and CI update Ammar Faizi
2023-03-07 20:38 ` Ammar Faizi [this message]
2023-03-07 20:38 ` [PATCH liburing v1 2/3] github: Append `-Wno-sign-compare` to the GitHub build bot CFLAGS Ammar Faizi
2023-03-07 20:38 ` [PATCH liburing v1 3/3] man/io_uring_register_{buffers,files}: Kill trailing whitespaces Ammar Faizi
2023-03-07 20:55 ` [PATCH liburing v1 0/3] Small fixes and CI update Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230307203830.612939-2-ammarfaizi2@gnuweeb.org \
    --to=ammarfaizi2@gnuweeb.org \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=dylany@fb.com \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®