* [PATCH liburing 1/3] io_uring-udp: Fix the wrong IPv6 binary to string conversion
2023-04-15 16:59 [PATCH liburing 0/3] io_uring-udp fix, manpage fix, and hppa cross-compiler Ammar Faizi
@ 2023-04-15 16:59 ` Ammar Faizi
2023-04-15 16:59 ` [PATCH liburing 2/3] github: Add hppa cross compiler Ammar Faizi
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Ammar Faizi @ 2023-04-15 16:59 UTC (permalink / raw)
To: Jens Axboe
Cc: Ammar Faizi, Pavel Begunkov, Alviro Iskandar Setiawan,
io-uring Mailing List, Linux Kernel Mailing List,
GNU/Weeb Mailing List
Another io_uring-udp fix. The verbose output shows the wrong address
when using IPv6.
When the address family is AF_INET6, the pointer should be cast to
'struct sockaddr_in6', not 'struct sockaddr_in'.
While in there, also add a square bracket around the IP address to
easily read the port number, especially for IPv6.
Before this patch:
port bound to 49567
received 4 bytes 28 from ::2400:6180:0:d1:0:0:47048
received 4 bytes 28 from ::2400:6180:0:d1:0:0:54755
received 4 bytes 28 from ::2400:6180:0:d1:0:0:57968
(the IPv6 address is wrong)
After this patch:
port bound to 48033
received 4 bytes 28 from [2400:6180:0:d1::6a4:a00f]:40456
received 4 bytes 28 from [2400:6180:0:d1::6a4:a00f]:50306
received 4 bytes 28 from [2400:6180:0:d1::6a4:a00f]:52291
Link: https://github.com/axboe/liburing/issues/814#issuecomment-1458862489
Fixes: https://github.com/axboe/liburing/issues/814
Fixes: 61d472b51e761e61c ("add an example for a UDP server")
Signed-off-by: Ammar Faizi <[email protected]>
---
examples/io_uring-udp.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/examples/io_uring-udp.c b/examples/io_uring-udp.c
index b81a5e7c47afd9c8..4697af171ba68999 100644
--- a/examples/io_uring-udp.c
+++ b/examples/io_uring-udp.c
@@ -271,14 +271,22 @@ static int process_cqe_recv(struct ctx *ctx, struct io_uring_cqe *cqe,
}
if (ctx->verbose) {
+ struct sockaddr_in *addr = io_uring_recvmsg_name(o);
+ struct sockaddr_in6 *addr6 = (void *)addr;
char buff[INET6_ADDRSTRLEN + 1];
const char *name;
- struct sockaddr_in *addr = io_uring_recvmsg_name(o);
+ void *paddr;
- name = inet_ntop(ctx->af, &addr->sin_addr, buff, sizeof(buff));
+ if (ctx->af == AF_INET6)
+ paddr = &addr6->sin6_addr;
+ else
+ paddr = &addr->sin_addr;
+
+ name = inet_ntop(ctx->af, paddr, buff, sizeof(buff));
if (!name)
name = "<INVALID>";
- fprintf(stderr, "received %u bytes %d from %s:%d\n",
+
+ fprintf(stderr, "received %u bytes %d from [%s]:%d\n",
io_uring_recvmsg_payload_length(o, cqe->res, &ctx->msg),
o->namelen, name, (int)ntohs(addr->sin_port));
}
--
Ammar Faizi
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH liburing 2/3] github: Add hppa cross compiler
2023-04-15 16:59 [PATCH liburing 0/3] io_uring-udp fix, manpage fix, and hppa cross-compiler Ammar Faizi
2023-04-15 16:59 ` [PATCH liburing 1/3] io_uring-udp: Fix the wrong IPv6 binary to string conversion Ammar Faizi
@ 2023-04-15 16:59 ` Ammar Faizi
2023-04-15 16:59 ` [PATCH liburing 3/3] man/io_uring_cqe_get_data.3: Fix a misleading return value Ammar Faizi
2023-04-15 20:37 ` [PATCH liburing 0/3] io_uring-udp fix, manpage fix, and hppa cross-compiler Jens Axboe
3 siblings, 0 replies; 5+ messages in thread
From: Ammar Faizi @ 2023-04-15 16:59 UTC (permalink / raw)
To: Jens Axboe
Cc: Alviro Iskandar Setiawan, Pavel Begunkov, io-uring Mailing List,
Linux Kernel Mailing List, GNU/Weeb Mailing List,
Linux Parisc Mailing List, Ammar Faizi
From: Alviro Iskandar Setiawan <[email protected]>
Since commit 9c6689848ebf ("Default to mmap'ed provided buffers for
hppa"), the core library has hppa specific code. Add hppa cross compiler
on the GitHub bot CI to catch build breakage for this arch.
Cc: Linux Parisc Mailing List <[email protected]>
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
Co-authored-by: Ammar Faizi <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
---
.github/workflows/build.yml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index fed5b38c3a507336..8dd22dfd125692de 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -85,6 +85,13 @@ jobs:
cc: mips-linux-gnu-gcc
cxx: mips-linux-gnu-g++
+ # hppa
+ - arch: hppa
+ cc_pkg: gcc-hppa-linux-gnu
+ cxx_pkg: g++-hppa-linux-gnu
+ cc: hppa-linux-gnu-gcc
+ cxx: hppa-linux-gnu-g++
+
env:
FLAGS: -g -O3 -Wall -Wextra -Werror -Wno-sign-compare ${{matrix.extra_flags}}
--
Ammar Faizi
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH liburing 3/3] man/io_uring_cqe_get_data.3: Fix a misleading return value
2023-04-15 16:59 [PATCH liburing 0/3] io_uring-udp fix, manpage fix, and hppa cross-compiler Ammar Faizi
2023-04-15 16:59 ` [PATCH liburing 1/3] io_uring-udp: Fix the wrong IPv6 binary to string conversion Ammar Faizi
2023-04-15 16:59 ` [PATCH liburing 2/3] github: Add hppa cross compiler Ammar Faizi
@ 2023-04-15 16:59 ` Ammar Faizi
2023-04-15 20:37 ` [PATCH liburing 0/3] io_uring-udp fix, manpage fix, and hppa cross-compiler Jens Axboe
3 siblings, 0 replies; 5+ messages in thread
From: Ammar Faizi @ 2023-04-15 16:59 UTC (permalink / raw)
To: Jens Axboe
Cc: Ammar Faizi, Pavel Begunkov, Alviro Iskandar Setiawan,
io-uring Mailing List, Linux Kernel Mailing List,
GNU/Weeb Mailing List
Since commit 8ecd3fd959634df8 ("Don't clear sqe->user_data as part of
command prep"), the prep functions no longer zero the user data. If the
user_data is not set, it will contain whatever previous value in it.
Therefore, the returned value when the user_data is-not-set is not
always NULL. And oh, someone once hit an issue because they assume the
return value is NULL if the user_data is not set. See the link below.
Fix the manpage, tell that the return value will be undefined.
Link: https://github.com/axboe/liburing/issues/575#issuecomment-1110516140
Signed-off-by: Ammar Faizi <[email protected]>
---
man/io_uring_cqe_get_data.3 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man/io_uring_cqe_get_data.3 b/man/io_uring_cqe_get_data.3
index 4cbb32cd864e12c2..a4d2988a49d92aa8 100644
--- a/man/io_uring_cqe_get_data.3
+++ b/man/io_uring_cqe_get_data.3
@@ -46,7 +46,7 @@ or
If the
.I user_data
value has been set before submitting the request, it will be returned.
-Otherwise the functions returns NULL.
+Otherwise, the return value is undefined.
.SH SEE ALSO
.BR io_uring_get_sqe (3),
.BR io_uring_sqe_set_data (3),
--
Ammar Faizi
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH liburing 0/3] io_uring-udp fix, manpage fix, and hppa cross-compiler
2023-04-15 16:59 [PATCH liburing 0/3] io_uring-udp fix, manpage fix, and hppa cross-compiler Ammar Faizi
` (2 preceding siblings ...)
2023-04-15 16:59 ` [PATCH liburing 3/3] man/io_uring_cqe_get_data.3: Fix a misleading return value Ammar Faizi
@ 2023-04-15 20:37 ` Jens Axboe
3 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2023-04-15 20:37 UTC (permalink / raw)
To: Ammar Faizi
Cc: Pavel Begunkov, Alviro Iskandar Setiawan, io-uring Mailing List,
Linux Kernel Mailing List, GNU/Weeb Mailing List
On 4/15/23 10:59 AM, Ammar Faizi wrote:
> Hi Jens,
>
> There are three patches in this series:
>
> 1. Fix the wrong IPv6 address in io_uring-udp (me).
>
> Before:
>
> port bound to 49567
> received 4 bytes 28 from ::2400:6180:0:d1:0:0:47048
> received 4 bytes 28 from ::2400:6180:0:d1:0:0:54755
> received 4 bytes 28 from ::2400:6180:0:d1:0:0:57968
>
> (the IPv6 address is wrong)
>
> After:
>
> port bound to 48033
> received 4 bytes 28 from [2400:6180:0:d1::6a4:a00f]:40456
> received 4 bytes 28 from [2400:6180:0:d1::6a4:a00f]:50306
> received 4 bytes 28 from [2400:6180:0:d1::6a4:a00f]:52291
>
> 2. io_uring_cqe_get_data() manpage fix (me).
>
> The return value of io_uring_cqe_get_data() will be undefined if the
> user_data is not set from the SQE side.
>
> 3. Add hppa cross-compiler to the CI (Alviro).
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread