# Policy for /system/bin/cnss-daemon
type cnss-daemon, domain;
type cnss-daemon_exec, exec_type, file_type;

# STOPSHIP b/28340421
# Temporarily grant this permission and log its use.
allow cnss-daemon self:capability {
    net_admin
    net_bind_service
};
auditallow cnss-daemon self:capability net_admin;

init_daemon_domain(cnss-daemon)

allow cnss-daemon self:capability { setgid setuid };

# whitelist socket ioctl commands
allow cnss-daemon self:netlink_socket create_socket_perms;
allow cnss-daemon self:socket create_socket_perms;
allowxperm cnss-daemon self:socket ioctl msm_sock_ipc_ioctls;

allow cnss-daemon proc_net:file rw_file_perms;
allow cnss-daemon sysfs_wifi:file write;
allow cnss-daemon sysfs_pcie:file write;
allow cnss-daemon sysfs_msm_core:file write;
r_dir_file(cnss-daemon, sysfs_type)

# access to /dev/diag on debug builds
userdebug_or_eng(`
  allow cnss-daemon diag_device:chr_file rw_file_perms;
')