2023-06-23 07:49:48

by Iulia Tanasescu

[permalink] [raw]
Subject: [PATCH BlueZ 0/1] isotest: Add check after accepting connection

This checks for the POLLERR event on a newly accepted connection,
to determine if the connection was successful or not.

This check is related to the kernel update introduced by,
https://patchwork.kernel.org/project/bluetooth/cover/[email protected]/
where unsuccessful bis connections are also added to the accept queue
of a listening socket, to indicate the fact that BIG sync failed.

Iulia Tanasescu (1):
isotest: Add check after accepting connection

tools/isotest.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)


base-commit: 37042ca9c6ddcdbbb0899b3d62238935cd53f443
--
2.34.1



2023-06-23 07:50:30

by Iulia Tanasescu

[permalink] [raw]
Subject: [PATCH BlueZ 1/1] isotest: Add check after accepting connection

This checks for the POLLERR event on a newly accepted connection,
to determine if the connection was successful or not.

---
tools/isotest.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

diff --git a/tools/isotest.c b/tools/isotest.c
index 0eae3cdc1..c71bc6fa0 100644
--- a/tools/isotest.c
+++ b/tools/isotest.c
@@ -33,6 +33,7 @@
#include <time.h>
#include <inttypes.h>
#include <sys/wait.h>
+#include <poll.h>

#include "lib/bluetooth.h"
#include "lib/hci.h"
@@ -440,6 +441,9 @@ static void do_listen(char *filename, void (*handler)(int fd, int sk),
socklen_t optlen;
int sk, nsk, fd = -1;
char ba[18];
+ struct pollfd fds;
+ int err, sk_err;
+ socklen_t len;

if (filename) {
fd = open(filename, O_WRONLY | O_CREAT | O_APPEND, 0644);
@@ -529,6 +533,28 @@ static void do_listen(char *filename, void (*handler)(int fd, int sk),
goto error;
}

+ /* Check if connection was successful */
+ memset(&fds, 0, sizeof(fds));
+ fds.fd = nsk;
+ fds.events = POLLERR;
+
+ if (poll(&fds, 1, 0) > 0 && (fds.revents & POLLERR)) {
+ len = sizeof(sk_err);
+
+ if (getsockopt(nsk, SOL_SOCKET, SO_ERROR,
+ &sk_err, &len) < 0)
+ err = -errno;
+ else
+ err = -sk_err;
+
+ if (err < 0)
+ syslog(LOG_ERR, "Connection failed: %s (%d)",
+ strerror(-err), -err);
+
+ close(nsk);
+ continue;
+ }
+
if (fork()) {
/* Parent */
close(nsk);
--
2.34.1


2023-06-23 09:37:03

by bluez.test.bot

[permalink] [raw]
Subject: RE: isotest: Add check after accepting connection

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=759716

---Test result---

Test Summary:
CheckPatch PASS 0.36 seconds
GitLint PASS 0.24 seconds
BuildEll PASS 27.68 seconds
BluezMake PASS 884.65 seconds
MakeCheck PASS 12.42 seconds
MakeDistcheck PASS 159.39 seconds
CheckValgrind PASS 262.54 seconds
CheckSmatch PASS 340.96 seconds
bluezmakeextell PASS 103.63 seconds
IncrementalBuild PASS 715.11 seconds
ScanBuild PASS 1093.68 seconds



---
Regards,
Linux Bluetooth

2023-06-26 20:51:56

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH BlueZ 0/1] isotest: Add check after accepting connection

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Fri, 23 Jun 2023 10:44:05 +0300 you wrote:
> This checks for the POLLERR event on a newly accepted connection,
> to determine if the connection was successful or not.
>
> This check is related to the kernel update introduced by,
> https://patchwork.kernel.org/project/bluetooth/cover/[email protected]/
> where unsuccessful bis connections are also added to the accept queue
> of a listening socket, to indicate the fact that BIG sync failed.
>
> [...]

Here is the summary with links:
- [BlueZ,1/1] isotest: Add check after accepting connection
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=b00bc612fab8

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html