summaryrefslogtreecommitdiffstats
path: root/usr.sbin/syslogd
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2001-07-19 22:04:09 +0000
committerume <ume@FreeBSD.org>2001-07-19 22:04:09 +0000
commit02712d67bab340ab748f25549553f6dcc74e9af2 (patch)
treeee62a47acb968e5aebe0e6547078ced96e895dae /usr.sbin/syslogd
parentab53999cee8842b737006169ffcbcfa5e5b125fb (diff)
downloadFreeBSD-src-02712d67bab340ab748f25549553f6dcc74e9af2.zip
FreeBSD-src-02712d67bab340ab748f25549553f6dcc74e9af2.tar.gz
- `-a' option for IPv6 was not working correctly.
- Lose any stray host bits that a user may have entered when providing a network number and netmask to the `-a' option for IPv6. This is corresponding to 1.79 that is for IPv4 only. MFC after: 1 week
Diffstat (limited to 'usr.sbin/syslogd')
-rw-r--r--usr.sbin/syslogd/syslogd.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index dc6a7ec..3ff3233 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -1813,10 +1813,10 @@ allowaddr(s)
char *cp1, *cp2;
struct allowedpeer ap;
struct servent *se;
- int masklen = -1;
+ int masklen = -1, i;
struct addrinfo hints, *res;
struct in_addr *addrp, *maskp;
- u_int32_t *mask6p;
+ u_int32_t *addr6p, *mask6p;
char ip[NI_MAXHOST];
#ifdef INET6
@@ -1907,6 +1907,11 @@ allowaddr(s)
*mask6p++ = 0xffffffff;
masklen -= 32;
}
+ /* Lose any host bits in the network number. */
+ mask6p = (u_int32_t *)&((struct sockaddr_in6 *)&ap.a_mask)->sin6_addr;
+ addr6p = (u_int32_t *)&((struct sockaddr_in6 *)&ap.a_addr)->sin6_addr;
+ for (i = 0; i < 4; i++)
+ addr6p[i] &= mask6p[i];
}
#endif
else {
@@ -2032,8 +2037,8 @@ validate(sa, hname)
#endif
reject = 0;
for (j = 0; j < 16; j += 4) {
- if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[i] & *(u_int32_t *)&m6p->sin6_addr.s6_addr[i])
- != *(u_int32_t *)&a6p->sin6_addr.s6_addr[i]) {
+ if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[j] & *(u_int32_t *)&m6p->sin6_addr.s6_addr[j])
+ != *(u_int32_t *)&a6p->sin6_addr.s6_addr[j]) {
++reject;
break;
}
OpenPOWER on IntegriCloud