type cnd, domain;
type cnd_exec, exec_type, vendor_file_type, file_type;
file_type_auto_trans(cnd, socket_device, cnd_socket);

# cnd is started by init, type transit from init domain to cnd domain
init_daemon_domain(cnd)

#communicating with QTI wlan driver for WFC/ VTiWLAN quality
allow cnd self:capability net_bind_service;

unix_socket_send(cnd, wpa, hal_wifi_supplicant)
allow cnd wpa_data_file:dir rw_dir_perms;
allow cnd wpa_data_file:sock_file create_file_perms;
allow cnd wpa_socket:sock_file write;

userdebug_or_eng(`
  allow cnd diag_device:chr_file rw_file_perms;
')

allow cnd self:udp_socket create_socket_perms;
allowxperm cnd self:udp_socket ioctl SIOCGIFMTU;
allow cnd self:{
    # Allow receiving NETLINK responses from WLAN driver.
    netlink_socket
    netlink_generic_socket
} create_socket_perms_no_ioctl;

allow cnd sysfs_timestamp_switch:file r_file_perms;
r_dir_file(cnd, sysfs_msm_subsys)
r_dir_file(cnd, sysfs_diag)
r_dir_file(cnd, sysfs_soc)

allow cnd proc_meminfo:file r_file_perms;

set_prop(cnd, cnd_prop)

allow cnd self:socket create_socket_perms;
allowxperm cnd self:socket ioctl msm_sock_ipc_ioctls;

# allow cnd to access cnd_data_file
allow cnd cnd_data_file:file create_file_perms;
allow cnd cnd_data_file:sock_file { unlink create setattr };
allow cnd cnd_data_file:dir rw_dir_perms;

# allow cnd to obtain wakelock
wakelock_use(cnd)

allow cnd ipa_vendor_data_file:dir r_dir_perms;
allow cnd ipa_vendor_data_file:file r_file_perms;

# To register cnd to hwbinder
add_hwservice(cnd, hal_cne_hwservice)
hwbinder_use(cnd)
get_prop(cnd, hwservicemanager_prop)
binder_call(cnd, dataservice_app)
binder_call(cnd, ims)
binder_call(cnd, location)

dontaudit cnd kernel:system module_request;