2005-10-21 13:11:17 +00:00
|
|
|
#
|
|
|
|
# shiftn(num,list...)
|
|
|
|
#
|
|
|
|
# shift the list num times
|
|
|
|
#
|
|
|
|
define(`shiftn',`ifelse($1,0,`shift($*)',`shiftn(decr($1),shift(shift($*)))')')
|
|
|
|
|
2005-07-22 14:00:38 +00:00
|
|
|
define(`declare_netifs',`dnl
|
2005-10-06 19:33:06 +00:00
|
|
|
netifcon $2 gen_context(system_u:object_r:$1,$3) gen_context(system_u:object_r:unlabeled_t,$3)
|
2005-07-22 14:00:38 +00:00
|
|
|
ifelse(`$4',`',`',`declare_netifs($1,shiftn(3,$*))')dnl
|
|
|
|
')
|
|
|
|
|
2005-06-08 21:46:39 +00:00
|
|
|
#
|
2005-07-22 14:00:38 +00:00
|
|
|
# network_interface(if_name,linux_interface,mls_sensitivity)
|
2005-06-08 21:46:39 +00:00
|
|
|
#
|
|
|
|
define(`network_interface',`
|
2005-06-13 20:51:09 +00:00
|
|
|
gen_require(`type unlabeled_t')
|
2005-06-08 21:46:39 +00:00
|
|
|
type $1_netif_t alias netif_$1_t, netif_type;
|
2005-07-22 14:00:38 +00:00
|
|
|
declare_netifs($1_netif_t,shift($*))
|
2005-06-08 21:46:39 +00:00
|
|
|
')
|
|
|
|
|
2006-01-16 18:48:57 +00:00
|
|
|
define(`declare_nodes',`dnl
|
|
|
|
nodecon $3 $4 gen_context(system_u:object_r:$1,$2)
|
|
|
|
ifelse(`$5',`',`',`declare_nodes($1,shiftn(4,$*))')dnl
|
|
|
|
')
|
|
|
|
|
2005-06-08 21:46:39 +00:00
|
|
|
#
|
2006-01-16 18:48:57 +00:00
|
|
|
# network_node(node_name,mls_sensitivity,address,netmask[, mls_sensitivity,address,netmask, [...]])
|
2005-06-08 21:46:39 +00:00
|
|
|
#
|
|
|
|
define(`network_node',`
|
|
|
|
type $1_node_t alias node_$1_t, node_type;
|
2006-01-16 18:48:57 +00:00
|
|
|
declare_nodes($1_node_t,shift($*))
|
2005-06-08 21:46:39 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
# These next three macros have formatting, and should not me indented
|
|
|
|
define(`determine_reserved_capability',`dnl
|
|
|
|
ifelse(eval($2 < 1024),1,``allow' dollarsone self:capability net_bind_service;',`dnl
|
|
|
|
ifelse($4,`',`',`determine_reserved_capability(shiftn(3,$*))')dnl end inner ifelse
|
|
|
|
')dnl end outer ifelse
|
|
|
|
') dnl end determine reserved capability
|
|
|
|
|
|
|
|
define(`determine_reserved_capability_depend',`dnl
|
|
|
|
ifelse(eval($2 < 1024),1,`class capability net_bind_service;',`dnl
|
|
|
|
ifelse($4,`',`',`determine_reserved_capability_depend(shiftn(3,$*))')dnl end inner ifelse
|
|
|
|
')dnl end outer ifelse
|
|
|
|
') dnl end determine reserved capability depend
|
|
|
|
|
|
|
|
define(`declare_ports',`dnl
|
2006-05-03 19:58:01 +00:00
|
|
|
ifelse(eval($3 < 1024),1,`
|
|
|
|
typeattribute $1 reserved_port_type;
|
|
|
|
#bindresvport in glibc starts searching for reserved ports at 600
|
|
|
|
ifelse(eval($3 >= 600),1,`typeattribute $1 rpc_port_type;',`dnl')
|
|
|
|
',`dnl')
|
2005-10-06 19:33:06 +00:00
|
|
|
portcon $2 $3 gen_context(system_u:object_r:$1,$4)
|
2005-06-08 21:46:39 +00:00
|
|
|
ifelse(`$5',`',`',`declare_ports($1,shiftn(4,$*))')dnl
|
|
|
|
')
|
|
|
|
|
|
|
|
#
|
|
|
|
# network_port(port_name,protocol portnum mls_sensitivity [,protocol portnum mls_sensitivity[,...]])
|
|
|
|
#
|
|
|
|
define(`network_port',`
|
|
|
|
type $1_port_t, port_type;
|
2006-05-26 13:49:13 +00:00
|
|
|
type $1_client_packet_t, packet_type, client_packet_type;
|
|
|
|
type $1_server_packet_t, packet_type, server_packet_type;
|
2005-06-08 21:46:39 +00:00
|
|
|
declare_ports($1_port_t,shift($*))
|
|
|
|
')
|
2006-05-23 18:31:02 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# network_packet(packet_name)
|
|
|
|
#
|
|
|
|
define(`network_packet',`
|
2006-05-26 13:49:13 +00:00
|
|
|
type $1_client_packet_t, packet_type, client_packet_type;
|
|
|
|
type $1_server_packet_t, packet_type, server_packet_type;
|
2006-05-23 18:31:02 +00:00
|
|
|
')
|