Skip to contentSkip to conversation

l2test: Fix calling getsockopt(BT_PHY)

PATCH Superseded Luiz Augusto von Dentz 1 participant 1 message Jul 7 Bluetooth drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 l2test: Fix calling getsockopt(BT_PHY)

From: Luiz Augusto von Dentz <[email protected]>

getsockopt(BT_PHY) expectes a 32 bits argument not a sizeof(struct sockaddr_l2).

---
 tools/l2test.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/l2test.c +4 -1
index aa05f5247c5e..08d2269936b9 100644
@@ -358,7 +358,8 @@ static int print_info(int sk, struct l2cap_options *opts)
 	struct sockaddr_l2 addr;
 	socklen_t optlen;
 	struct l2cap_conninfo conn;
-	int prio, phy;
+	int prio;
+	uint32_t phy;
 	char ba[18];
 
 	/* Get connection information */
@@ -414,6 +415,8 @@ static int print_info(int sk, struct l2cap_options *opts)
 		conn.dev_class[0], prio, rcvbuf);
 
 
+	optlen = sizeof(phy);
+
 	if (!getsockopt(sk, SOL_BLUETOOTH, BT_PHY, &phy, &optlen)) {
 		syslog(LOG_INFO, "Supported PHY: 0x%08x", phy);
 		print_bitfield(2, phy, phy_table);
Signature · 1 line
2.54.0