Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# shiftn(num,list...)
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# shift the list num times
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
define(`shiftn',`ifelse($1,0,`shift($*)',`shiftn(decr($1),shift(shift($*)))')')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
define(`declare_netifs',`dnl
Chris PeBenito 17de1b
netifcon $2 gen_context(system_u:object_r:$1,$3) gen_context(system_u:object_r:unlabeled_t,$3)
Chris PeBenito 17de1b
ifelse(`$4',`',`',`declare_netifs($1,shiftn(3,$*))')dnl
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# network_interface(if_name,linux_interface,mls_sensitivity)
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
define(`network_interface',`
Chris PeBenito 17de1b
gen_require(`type unlabeled_t')
Chris PeBenito 17de1b
type $1_netif_t alias netif_$1_t, netif_type;
Chris PeBenito 17de1b
declare_netifs($1_netif_t,shift($*))
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
define(`declare_nodes',`dnl
Chris PeBenito 17de1b
nodecon $3 $4 gen_context(system_u:object_r:$1,$2)
Chris PeBenito 17de1b
ifelse(`$5',`',`',`declare_nodes($1,shiftn(4,$*))')dnl
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# network_node(node_name,mls_sensitivity,address,netmask[, mls_sensitivity,address,netmask, [...]])
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
define(`network_node',`
Chris PeBenito 17de1b
type $1_node_t alias node_$1_t, node_type;
Chris PeBenito 17de1b
declare_nodes($1_node_t,shift($*))
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# These next three macros have formatting, and should not me indented
Chris PeBenito 17de1b
define(`determine_reserved_capability',`dnl
Chris PeBenito 17de1b
ifelse(eval($2 < 1024),1,``allow' dollarsone self:capability net_bind_service;',`dnl
Chris PeBenito 17de1b
ifelse($4,`',`',`determine_reserved_capability(shiftn(3,$*))')dnl end inner ifelse
Chris PeBenito 17de1b
')dnl end outer ifelse
Chris PeBenito 17de1b
') dnl end determine reserved capability
Chris PeBenito 17de1b
Chris PeBenito 17de1b
define(`determine_reserved_capability_depend',`dnl
Chris PeBenito 17de1b
ifelse(eval($2 < 1024),1,`class capability net_bind_service;',`dnl
Chris PeBenito 17de1b
ifelse($4,`',`',`determine_reserved_capability_depend(shiftn(3,$*))')dnl end inner ifelse
Chris PeBenito 17de1b
')dnl end outer ifelse
Chris PeBenito 17de1b
') dnl end determine reserved capability depend
Chris PeBenito 17de1b
Chris PeBenito 17de1b
define(`declare_ports',`dnl
Chris PeBenito 17de1b
ifelse(eval($3 < 1024),1,`
Chris PeBenito 17de1b
typeattribute $1 reserved_port_type;
Chris PeBenito 17de1b
#bindresvport in glibc starts searching for reserved ports at 600
Chris PeBenito 17de1b
ifelse(eval($3 >= 600),1,`typeattribute $1 rpc_port_type;',`dnl')
Chris PeBenito 17de1b
',`dnl')
Chris PeBenito 17de1b
portcon $2 $3 gen_context(system_u:object_r:$1,$4)
Chris PeBenito 17de1b
ifelse(`$5',`',`',`declare_ports($1,shiftn(4,$*))')dnl
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# network_port(port_name,protocol portnum mls_sensitivity [,protocol portnum mls_sensitivity[,...]])
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
define(`network_port',`
Chris PeBenito 17de1b
type $1_port_t, port_type;
Chris PeBenito 17de1b
type $1_client_packet_t, packet_type, client_packet_type;
Chris PeBenito 17de1b
type $1_server_packet_t, packet_type, server_packet_type;
Chris PeBenito 17de1b
declare_ports($1_port_t,shift($*))
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# network_packet(packet_name)
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
define(`network_packet',`
Chris PeBenito 17de1b
type $1_client_packet_t, packet_type, client_packet_type;
Chris PeBenito 17de1b
type $1_server_packet_t, packet_type, server_packet_type;
Chris PeBenito 17de1b
')