Michael Bestas | 0feb07d | 2018-10-05 00:37:23 +0300 | [diff] [blame] | 1 | # Copyright (c) 2015,2017, The Linux Foundation. All rights reserved. |
| 2 | # |
| 3 | # Redistribution and use in source and binary forms, with or without |
| 4 | # modification, are permitted provided that the following conditions are |
| 5 | # met: |
| 6 | # * Redistributions of source code must retain the above copyright |
| 7 | # notice, this list of conditions and the following disclaimer. |
| 8 | # * Redistributions in binary form must reproduce the above |
| 9 | # copyright notice, this list of conditions and the following |
| 10 | # disclaimer in the documentation and/or other materials provided |
| 11 | # with the distribution. |
| 12 | # * Neither the name of The Linux Foundation nor the names of its |
| 13 | # contributors may be used to endorse or promote products derived |
| 14 | # from this software without specific prior written permission. |
| 15 | # |
| 16 | # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 17 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 20 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 23 | # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 25 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 26 | # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | # Allow hostapd_cli to work. hostapd_cli creates a socket in |
| 29 | # /data/misc/wifi/sockets which hostapd communicates with. |
Sridhar Parasuram | 64fdeae | 2018-02-02 16:09:10 -0800 | [diff] [blame] | 30 | # |
| 31 | |
| 32 | # userspace wifi access points |
| 33 | type hostapd, domain; |
| 34 | type hostapd_exec, exec_type, vendor_file_type, file_type; |
| 35 | |
Michael Bestas | 0feb07d | 2018-10-05 00:37:23 +0300 | [diff] [blame] | 36 | userdebug_or_eng(` |
| 37 | unix_socket_send(hostapd, wifi_vendor_wpa, su) |
| 38 | ') |
| 39 | |
| 40 | binder_call(hostapd, cnd) |
| 41 | unix_socket_connect(hostapd, cnd, cnd) |
| 42 | unix_socket_send(hostapd, cnd, cnd) |
| 43 | allow hostapd cnd:{ |
| 44 | fifo_file |
| 45 | netlink_route_socket |
| 46 | netlink_tcpdiag_socket |
| 47 | unix_stream_socket} { read write }; |
| 48 | allow hostapd cnd:fifo_file r_file_perms; |
| 49 | allow hostapd smem_log_device:chr_file rw_file_perms; |
| 50 | allow hostapd fstman:unix_dgram_socket sendto; |
| 51 | allow hostapd wifi_vendor_data_file:dir w_dir_perms; |
| 52 | allow hostapd wifi_vendor_data_file:file create_file_perms; |
Sridhar Parasuram | 64fdeae | 2018-02-02 16:09:10 -0800 | [diff] [blame] | 53 | allow hostapd hostapd_data_file:dir w_dir_perms; |
| 54 | allow hostapd hostapd_data_file:sock_file create_file_perms; |
Michael Bestas | 0feb07d | 2018-10-05 00:37:23 +0300 | [diff] [blame] | 55 | # wigig_hostapd has its own directory for sockets, |
| 56 | # in order to prevent conflicts with wifi hostapd |
| 57 | # allow wigig_hostapd to create the directory holding its control socket |
| 58 | allow hostapd wigig_hostapd_socket:dir create_dir_perms; |
| 59 | # wigig_hostapd needs to create, bind to, read and write its control socket |
| 60 | allow hostapd wigig_hostapd_socket:sock_file create_file_perms; |
| 61 | # allow wigig_hostapd to send replies to wigighalsvc |
| 62 | allow hostapd wigighalsvc:unix_dgram_socket sendto; |
| 63 | # allow hostapd to attach to fstman socket |
| 64 | allow hostapd wpa_socket:dir r_dir_perms; |
| 65 | allow hostapd wpa_socket:sock_file rw_file_perms; |
| 66 | allow hostapd wifi_vendor_wpa_socket:dir r_dir_perms; |
| 67 | allow hostapd wifi_vendor_wpa_socket:sock_file rw_file_perms; |