BT: Add CAP_NET_ADMIN for Bluetooth Process

Precondition:
1. A reference phone has internet connection and with BT tethering enabled.
2. DUT is in PANU role & Remote is NAP role
Or
1. DUT has internet connection and with BT tethering enabled.
2. DUT is in NAP role & Remote is PANU role.

Use case:
1. Connect DUT(PANU) to reference phone(NAP).
2. Internet browse is not working on DUT & Connection is dropped from DUT.
Or
1. Connect remote(PANU) to Remote device(NAP).
2. Internet browse is not working on remote & Connection is dropped fro DUT.

RCA:
https://android-review.googlesource.com/c/kernel/common/+/936980 will cause this issue. If it's cherrypicked in codebase.
TUNSETIFF ioctl call is being failed due to Operation not permitted error, Hence bt-pan interface is not being up.&
connection is dropped.
06-04 23:18:06.856  6173  6699 D bt_btif : ioctl error:-1, errno:Operation not permitted

TEST:
1. Connect DUT(PANU) to reference phone(NAP).
2. Internet browse is  working on DUT
Or
1. Connect remote(PANU) to Remote device(NAP).
2. Internet browse is working on remote.

Fix:
BT Process need CAP_NET_ADAMIN capability to make
ioctl call to TUN driver from BT PAN module. Hence
adding CAP_NET_ADMIN capablity for BT

Bug: 133735703
Bug: 135707477
Change-Id: Ie461bfee7a8221404ed6b9852bd5d36758d094df
This commit is contained in:
Nitin Shivpure
2019-05-29 14:02:49 +05:30
committed by Maciej Żenczykowski
parent ff32698f0f
commit 99cec9d9a4

View File

@@ -1099,6 +1099,7 @@ static jlong CalculateCapabilities(JNIEnv* env, jint uid, jint gid, jintArray gi
/*
* Grant the following capabilities to the Bluetooth user:
* - CAP_WAKE_ALARM
* - CAP_NET_ADMIN
* - CAP_NET_RAW
* - CAP_NET_BIND_SERVICE (for DHCP client functionality)
* - CAP_SYS_NICE (for setting RT priority for audio-related threads)
@@ -1106,6 +1107,7 @@ static jlong CalculateCapabilities(JNIEnv* env, jint uid, jint gid, jintArray gi
if (multiuser_get_app_id(uid) == AID_BLUETOOTH) {
capabilities |= (1LL << CAP_WAKE_ALARM);
capabilities |= (1LL << CAP_NET_ADMIN);
capabilities |= (1LL << CAP_NET_RAW);
capabilities |= (1LL << CAP_NET_BIND_SERVICE);
capabilities |= (1LL << CAP_SYS_NICE);