Merge "Add support for duplicate allow rule detection (-D / --dups)."
diff --git a/hostapd.te b/hostapd.te
index 79db3c3..a934384 100644
--- a/hostapd.te
+++ b/hostapd.te
@@ -1,6 +1,22 @@
+# userspace wifi access points
 type hostapd, domain;
+permissive hostapd;
 type hostapd_exec, exec_type, file_type;
 
-init_daemon_domain(hostapd)
-net_domain(hostapd)
-unconfined_domain(hostapd)
+allow hostapd self:capability { net_admin net_raw setuid setgid };
+allow hostapd self:netlink_socket create_socket_perms;
+allow hostapd self:packet_socket { create write read };
+allow hostapd self:netlink_route_socket { bind create write nlmsg_write read };
+allow hostapd self:udp_socket { create ioctl };
+
+allow hostapd wifi_data_file:file rw_file_perms;
+allow hostapd wifi_data_file:dir create_dir_perms;
+allow hostapd wifi_data_file:sock_file { create setattr write unlink };
+
+allow hostapd netd:fd use;
+allow hostapd netd:udp_socket { read write };
+allow hostapd netd:netlink_kobject_uevent_socket { read write };
+allow hostapd netd:netlink_nflog_socket { read write };
+allow hostapd netd:netlink_route_socket { read write };
+allow hostapd netd:unix_stream_socket { read write };
+allow hostapd netd:fifo_file { read write };
diff --git a/ping.te b/ping.te
index 37b9b3c..9adf079 100644
--- a/ping.te
+++ b/ping.te
@@ -1,4 +1,13 @@
 type ping, domain;
+permissive ping;
 type ping_exec, exec_type, file_type;
 domain_auto_trans(shell, ping_exec, ping)
-unconfined_domain(ping)
+
+allow ping self:capability net_raw;
+allow ping self:rawip_socket create_socket_perms;
+allow ping self:udp_socket create_socket_perms;
+allow ping node:rawip_socket node_bind;
+allow ping dnsproxyd_socket:sock_file write;
+allow ping netd:unix_stream_socket connectto;
+allow ping devpts:chr_file rw_file_perms;
+allow ping shell:fd use;