From 97a2cfdf6618f98fe1da51c5e77d9a5d2765c04e Mon Sep 17 00:00:00 2001
From: Paul Jensen <pauljensen@google.com>
Date: Wed, 18 Jun 2014 09:20:36 -0400
Subject: [PATCH] Allow Bluetooth app to initiate DHCP service on bt-pan
 interface.

bug:15407087
Change-Id: I3dea9c1110583f11f093d048455a1cc739d05658
---
 bluetooth.te      | 2 ++
 dhcp.te           | 1 +
 property.te       | 2 ++
 property_contexts | 2 ++
 system_server.te  | 1 +
 5 files changed, 8 insertions(+)

diff --git a/bluetooth.te b/bluetooth.te
index 8869ce6b8..7d56d45e6 100644
--- a/bluetooth.te
+++ b/bluetooth.te
@@ -45,6 +45,8 @@ allow bluetooth proc_bluetooth_writable:file rw_file_perms;
 
 # Allow write access to bluetooth specific properties
 allow bluetooth bluetooth_prop:property_service set;
+allow bluetooth pan_result_prop:property_service set;
+allow bluetooth ctl_dhcp_pan_prop:property_service set;
 
 ###
 ### Neverallow rules
diff --git a/dhcp.te b/dhcp.te
index 9e461a4f6..2e5b3d408 100644
--- a/dhcp.te
+++ b/dhcp.te
@@ -14,6 +14,7 @@ allow dhcp system_file:file rx_file_perms;
 # For /proc/sys/net/ipv4/conf/*/promote_secondaries
 allow dhcp proc_net:file write;
 allow dhcp system_prop:property_service set ;
+allow dhcp pan_result_prop:property_service set;
 unix_socket_connect(dhcp, property, init)
 
 type_transition dhcp system_data_file:{ dir file } dhcp_data_file;
diff --git a/property.te b/property.te
index 3195caf84..aa1c9a8f5 100644
--- a/property.te
+++ b/property.te
@@ -8,6 +8,7 @@ type vold_prop, property_type;
 type rild_prop, property_type;
 type ctl_bootanim_prop, property_type;
 type ctl_default_prop, property_type;
+type ctl_dhcp_pan_prop, property_type;
 type ctl_dumpstate_prop, property_type;
 type ctl_fuse_prop, property_type;
 type ctl_mdnsd_prop, property_type;
@@ -17,4 +18,5 @@ type audio_prop, property_type;
 type logd_prop, property_type;
 type security_prop, property_type;
 type bluetooth_prop, property_type;
+type pan_result_prop, property_type;
 type powerctl_prop, property_type;
diff --git a/property_contexts b/property_contexts
index 4640d56fe..76dcbc4d5 100644
--- a/property_contexts
+++ b/property_contexts
@@ -25,6 +25,7 @@ sys.powerctl            u:object_r:powerctl_prop:s0
 service.                u:object_r:system_prop:s0
 wlan.                   u:object_r:system_prop:s0
 dhcp.                   u:object_r:system_prop:s0
+dhcp.bt-pan.result      u:object_r:pan_result_prop:s0
 bluetooth.              u:object_r:bluetooth_prop:s0
 
 debug.                  u:object_r:debug_prop:s0
@@ -57,4 +58,5 @@ ctl.fuse_               u:object_r:ctl_fuse_prop:s0
 ctl.mdnsd               u:object_r:ctl_mdnsd_prop:s0
 ctl.ril-daemon          u:object_r:ctl_rildaemon_prop:s0
 ctl.bugreport           u:object_r:ctl_bugreport_prop:s0
+ctl.dhcpcd_bt-pan       u:object_r:ctl_dhcp_pan_prop:s0
 ctl.                    u:object_r:ctl_default_prop:s0
diff --git a/system_server.te b/system_server.te
index a3a3cd193..236f4c4d6 100644
--- a/system_server.te
+++ b/system_server.te
@@ -277,6 +277,7 @@ allow system_server powerctl_prop:property_service set;
 
 # ctl interface
 allow system_server ctl_default_prop:property_service set;
+allow system_server ctl_dhcp_pan_prop:property_service set;
 allow system_server ctl_bugreport_prop:property_service set;
 
 # Create a socket for receiving info from wpa.
-- 
GitLab