NAME
cmpt_get_ifcid(), cmpt_get_addrcid() — get the compartment IDs associated with a network interfaces
SYNOPSIS
#include <sys/cmpt.h>
cmpt_t cmpt_get_ifcid(const char *ifname);
cmpt_t cmpt_get_addrcid(int family,
void *addr, uint32_t mask);
Parameters
- ifname
Pointer to network interface name string.
- family
Address family of the ipaddress specified.
Currently, the
AF_INET and AF_INET6 address families are supported.
- addr
Points to a buffer holding an IPv4 address if the family
argument is AF_INET or an IPv6 address if the family is AF_INET6.
The address should be in numeric format in the network byte order.
Numeric format is the binary value that goes into a socket address structure.
The binary value is the hex representation of the IPv4/IPv6 address.
This binary value resides in the
in_addr
structure for IPv4 address
and in the
in6_addr
structure for IPv6 address.
(See
inet(3N)
for more details.)
- mask
Network mask in the CIDR representation.
DESCRIPTION
The
cmpt_get_ifcid()
function returns the compartment ID associated with a network interface.
The
cmpt_get_addrcid()
function returns the compartment ID of the
(addr,mask,family)
tuple
as set by a previous invocation of the
setrules
command.
RETURN VALUE
The functions
cmpt_get_ifcid()
and
cmpt_get_addrcid()
return the following values:
- n>0
Successful completion.
n
is the compartment of the interface or the
(addr,mask,family)
tuple.
- -1
Function failed.
errno
may be set to indicate the error.
ERRORS
If any of the following conditions occur,
cmpt_get_ifcid()
and
cmpt_get_addrcid()
fails and sets
errno.
- ENOSYS
Compartmentalization feature is not supported.
- EPERM
The process does not have the appropriate privilege.
See
privileges(5).
- ENOENT
Specified interface or the address tuple has no compartment mapping.
- EINVAL
Specified mask or family is invalid.
DEPENDENCIES
These functions are a part of the
libsec
library.