diff options
| author | Johan Hedberg <johan.hedberg@nokia.com> | 2009-01-16 11:13:39 +0200 | 
|---|---|---|
| committer | Johan Hedberg <johan.hedberg@nokia.com> | 2009-01-16 11:13:39 +0200 | 
| commit | d9b5a3fcb122277222b80ff40ac786d2c5ad4ab8 (patch) | |
| tree | ef0b6672c628635faa6339f00eeb68aa24e0e367 | |
| parent | 188d5f24a64ef9d2c2809d9ba9158b9e6e187e17 (diff) | |
Use L2CAP_LM for the L2CAP raw socket for now
| -rw-r--r-- | src/device.c | 17 | 
1 files changed, 10 insertions, 7 deletions
| diff --git a/src/device.c b/src/device.c index 9c089eee..0ae81a02 100644 --- a/src/device.c +++ b/src/device.c @@ -1685,10 +1685,9 @@ static void create_bond_req_exit(DBusConnection *conn, void *user_data)  static int l2raw_connect(const bdaddr_t *src, const bdaddr_t *dst,  						gboolean *auth_required)  { -	struct bt_security sec;  	struct sockaddr_l2 addr;  	long arg; -	int sk, err; +	int sk, err, opt;  	sk = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_L2CAP);  	if (sk < 0) { @@ -1705,12 +1704,13 @@ static int l2raw_connect(const bdaddr_t *src, const bdaddr_t *dst,  		goto failed;  	} -	memset(&sec, 0, sizeof(sec)); -	sec.level = BT_SECURITY_MEDIUM; +	opt = L2CAP_LM_AUTH | L2CAP_LM_ENCRYPT; -	err = setsockopt(sk, SOL_BLUETOOTH, BT_SECURITY, &sec, sizeof(sec)); -	if (auth_required) -		*auth_required = err < 0 ? TRUE : FALSE; +	err = setsockopt(sk, SOL_L2CAP, L2CAP_LM, &opt, sizeof(opt)); +	if (err < 0) { +		error("setsockopt: %s (%d)", strerror(errno), errno); +		goto failed; +	}  	arg = fcntl(sk, F_GETFL);  	if (arg < 0) { @@ -1735,6 +1735,9 @@ static int l2raw_connect(const bdaddr_t *src, const bdaddr_t *dst,  		goto failed;  	} +	if (auth_required) +		*auth_required = TRUE; +  	return sk;  failed: | 
