Simplify to avoid packed struct alignment issue.

This commit is contained in:
christos 2020-09-07 19:37:21 +00:00
parent db958a8ce2
commit 29ff04b87c
1 changed files with 3 additions and 2 deletions

View File

@ -1432,17 +1432,18 @@ acl_addr_matches_ipv6host(struct acl_options* acl, struct sockaddr_storage* addr
int
acl_addr_matches_ipv4host(struct acl_options* acl, struct sockaddr_in* addr, unsigned int port)
{
uint32_t saddr = addr->sin_addr.s_addr;
if(acl->port != 0 && acl->port != port)
return 0;
switch(acl->rangetype) {
case acl_range_mask:
case acl_range_subnet:
if(!acl_addr_match_mask((uint32_t*)&acl->addr.addr, (uint32_t*)&addr->sin_addr,
if(!acl_addr_match_mask((uint32_t*)&acl->addr.addr, &saddr,
(uint32_t*)&acl->range_mask.addr, sizeof(struct in_addr)))
return 0;
break;
case acl_range_minmax:
if(!acl_addr_match_range((uint32_t*)&acl->addr.addr, (uint32_t*)&addr->sin_addr,
if(!acl_addr_match_range((uint32_t*)&acl->addr.addr, &saddr,
(uint32_t*)&acl->range_mask.addr, sizeof(struct in_addr)))
return 0;
break;