linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 0/1] isotest: Add check after accepting connection
@ 2023-06-23  7:44 Iulia Tanasescu
  2023-06-23  7:44 ` [PATCH BlueZ 1/1] " Iulia Tanasescu
  2023-06-26 20:50 ` [PATCH BlueZ 0/1] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 4+ messages in thread
From: Iulia Tanasescu @ 2023-06-23  7:44 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
	vlad.pruteanu, andrei.istodorescu, Iulia Tanasescu

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/20230623073842.16466-1-iulia.tanasescu@nxp.com/
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH BlueZ 1/1] isotest: Add check after accepting connection
  2023-06-23  7:44 [PATCH BlueZ 0/1] isotest: Add check after accepting connection Iulia Tanasescu
@ 2023-06-23  7:44 ` Iulia Tanasescu
  2023-06-23  9:19   ` bluez.test.bot
  2023-06-26 20:50 ` [PATCH BlueZ 0/1] " patchwork-bot+bluetooth
  1 sibling, 1 reply; 4+ messages in thread
From: Iulia Tanasescu @ 2023-06-23  7:44 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
	vlad.pruteanu, andrei.istodorescu, Iulia Tanasescu

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: isotest: Add check after accepting connection
  2023-06-23  7:44 ` [PATCH BlueZ 1/1] " Iulia Tanasescu
@ 2023-06-23  9:19   ` bluez.test.bot
  0 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2023-06-23  9:19 UTC (permalink / raw)
  To: linux-bluetooth, iulia.tanasescu

[-- Attachment #1: Type: text/plain, Size: 947 bytes --]

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ 0/1] isotest: Add check after accepting connection
  2023-06-23  7:44 [PATCH BlueZ 0/1] isotest: Add check after accepting connection Iulia Tanasescu
  2023-06-23  7:44 ` [PATCH BlueZ 1/1] " Iulia Tanasescu
@ 2023-06-26 20:50 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2023-06-26 20:50 UTC (permalink / raw)
  To: Iulia Tanasescu
  Cc: linux-bluetooth, claudia.rosu, mihai-octavian.urzica,
	silviu.barbulescu, vlad.pruteanu, andrei.istodorescu

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

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/20230623073842.16466-1-iulia.tanasescu@nxp.com/
> 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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-26 20:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-23  7:44 [PATCH BlueZ 0/1] isotest: Add check after accepting connection Iulia Tanasescu
2023-06-23  7:44 ` [PATCH BlueZ 1/1] " Iulia Tanasescu
2023-06-23  9:19   ` bluez.test.bot
2023-06-26 20:50 ` [PATCH BlueZ 0/1] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).