Skip to contentSkip to conversation

checkpolicy,libsepol: drop unnecessary usage of s6_addr32

PATCH New Stephen Smalley 1 participant 1 message May 10, 2017 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 checkpolicy/policy_define.c | 6 ------
 libsepol/src/node_record.c  | 8 --------
 2 files changed, 14 deletions(-)
checkpolicy/policy_define.c +0 -6
index 63e3c53..8fab214 100644
@@ -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);
libsepol/src/node_record.c +0 -8
index 21043b6..6189c31 100644
@@ -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) {
 
Signature · 1 line
2.9.3