checkpolicy,libsepol: drop unnecessary usage of s6_addr32
s6_addr32 is not portable; use s6_addr instead. This obviates the need for #ifdef __APPLE__ conditionals in these cases. Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
This commit is contained in:
parent
3db61481ad
commit
c3118041df
|
@ -5260,14 +5260,8 @@ int define_ipv6_node_context(void)
|
|||
}
|
||||
|
||||
memset(newc, 0, sizeof(ocontext_t));
|
||||
|
||||
#ifdef __APPLE__
|
||||
memcpy(&newc->u.node6.addr[0], &addr.s6_addr[0], 16);
|
||||
memcpy(&newc->u.node6.mask[0], &mask.s6_addr[0], 16);
|
||||
#else
|
||||
memcpy(&newc->u.node6.addr[0], &addr.s6_addr32[0], 16);
|
||||
memcpy(&newc->u.node6.mask[0], &mask.s6_addr32[0], 16);
|
||||
#endif
|
||||
|
||||
if (parse_security_context(&newc->context[0])) {
|
||||
free(newc);
|
||||
|
|
|
@ -70,11 +70,7 @@ static int node_parse_addr(sepol_handle_t * handle,
|
|||
return STATUS_ERR;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
memcpy(addr_bytes, in_addr.s6_addr, 16);
|
||||
#else
|
||||
memcpy(addr_bytes, in_addr.s6_addr32, 16);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -162,11 +158,7 @@ static int node_expand_addr(sepol_handle_t * handle,
|
|||
{
|
||||
struct in6_addr addr;
|
||||
memset(&addr, 0, sizeof(struct in6_addr));
|
||||
#ifdef __APPLE__
|
||||
memcpy(&addr.s6_addr[0], addr_bytes, 16);
|
||||
#else
|
||||
memcpy(&addr.s6_addr32[0], addr_bytes, 16);
|
||||
#endif
|
||||
if (inet_ntop(AF_INET6, &addr, addr_str,
|
||||
INET6_ADDRSTRLEN) == NULL) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue