Re: [RFC 1/1] Bluetooth: Add LE SecMgr and mgmtops support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Brian,

On Mon, Nov 07, 2011 at 02:00:16PM -0800, Brian Gix wrote:
...
> hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct
> 
>  static inline u8 hci_get_auth_req(struct hci_conn *conn)
>  {
> +	BT_DBG("%p", conn);
> +
>  	/* If remote requests dedicated bonding follow that lead */
>  	if (conn->remote_auth == 0x02 || conn->remote_auth == 0x03) {
>  		/* If both remote and local IO capabilities allow MITM
>  		 * protection then require it, otherwise don't */
> -		if (conn->remote_cap == 0x03 || conn->io_capability == 0x03)
> +		if (conn->remote_cap == 0x03 || conn->io_capability == 0x03) {
>  			return 0x02;
> -		else
> +		} else {
> +			conn->auth_type |= 0x01;
>  			return 0x03;
> +		}
>  	}

Maybe you could also fix those magic numbers issues. We shall define
capabilities.


> 
>  	/* If remote requests no-bonding follow that lead */
> -	if (conn->remote_auth == 0x00 || conn->remote_auth == 0x01)
> -		return conn->remote_auth | (conn->auth_type & 0x01);
> +	if (conn->remote_auth <= 0x01)
> +		return 0x00;
> 
>  	return conn->auth_type;
>  }
> @@ -2626,11 +2660,15 @@ static inline void
> hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff
>  	if (test_bit(HCI_PAIRABLE, &hdev->flags) ||
>  			(conn->remote_auth & ~0x01) == HCI_AT_NO_BONDING) {
>  		struct hci_cp_io_capability_reply cp;
> +		u8 io_cap = conn->io_capability;
> 
> +		/* ACL-SSP does not support IO CAP 0x04 */
> +		cp.capability = (io_cap == 0x04) ? 0x01 : io_cap;
>  		bacpy(&cp.bdaddr, &ev->bdaddr);
> -		cp.capability = conn->io_capability;
> -		conn->auth_type = hci_get_auth_req(conn);
> -		cp.authentication = conn->auth_type;
> +		if (conn->auth_initiator)
> +			cp.authentication = conn->auth_type;
> +		else
> +			cp.authentication = hci_get_auth_req(conn);
> 
>  		if ((conn->out == 0x01 || conn->remote_oob == 0x01) &&
>  				hci_find_remote_oob_data(hdev, &conn->dst))
> @@ -2675,24 +2713,28 @@ unlock:
>  	hci_dev_unlock(hdev);
...

Best regards 
Andrei Emeltchenko 
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux