diff mbox series

[BlueZ,13/22] l2test: Add support for L2CAP_ECRED_MODE

Message ID 20200108003342.15458-14-luiz.dentz@gmail.com
State New
Headers show
Series None | expand

Commit Message

Luiz Augusto von Dentz Jan. 8, 2020, 12:33 a.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This enables using l2test to connect or listen with L2CAP_ECRED_MODE.
---
 tools/l2test.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/tools/l2test.c b/tools/l2test.c
index e787c2ce2..317515e68 100644
--- a/tools/l2test.c
+++ b/tools/l2test.c
@@ -149,6 +149,7 @@  static struct lookup_table l2cap_modes[] = {
 	*/
 	{ "ertm",	L2CAP_MODE_ERTM		},
 	{ "streaming",	L2CAP_MODE_STREAMING	},
+	{ "ecred",	L2CAP_MODE_ECRED	},
 	{ 0 }
 };
 
@@ -282,7 +283,7 @@  static int getopts(int sk, struct l2cap_options *opts, bool connected)
 
 	memset(opts, 0, sizeof(*opts));
 
-	if (bdaddr_type == BDADDR_BREDR) {
+	if (bdaddr_type == BDADDR_BREDR || rfcmode) {
 		optlen = sizeof(*opts);
 		return getsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, opts, &optlen);
 	}
@@ -298,7 +299,7 @@  static int getopts(int sk, struct l2cap_options *opts, bool connected)
 
 static int setopts(int sk, struct l2cap_options *opts)
 {
-	if (bdaddr_type == BDADDR_BREDR)
+	if (bdaddr_type == BDADDR_BREDR || rfcmode)
 		return setsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, opts,
 								sizeof(*opts));