Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/nsd/dist Simplify to avoid packed struct alignm...



details:   https://anonhg.NetBSD.org/src/rev/20f221840f76
branches:  trunk
changeset: 943672:20f221840f76
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Sep 07 19:37:21 2020 +0000

description:
Simplify to avoid packed struct alignment issue.

diffstat:

 external/bsd/nsd/dist/options.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 1804840e7beb -r 20f221840f76 external/bsd/nsd/dist/options.c
--- a/external/bsd/nsd/dist/options.c   Mon Sep 07 19:17:36 2020 +0000
+++ b/external/bsd/nsd/dist/options.c   Mon Sep 07 19:37:21 2020 +0000
@@ -1432,17 +1432,18 @@
 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;



Home | Main Index | Thread Index | Old Index