diff options
author | ps <ps@FreeBSD.org> | 2001-11-14 09:20:24 +0000 |
---|---|---|
committer | ps <ps@FreeBSD.org> | 2001-11-14 09:20:24 +0000 |
commit | b88e604b92099b837a5cdc8f2a1d36fa3da1aee4 (patch) | |
tree | 4d7e795e6994e0c94e2f826fbd5e2d164472a325 /usr.sbin/syslogd/syslogd.c | |
parent | fa34986a65d9f598ce615796a9e39942487ab06b (diff) | |
download | FreeBSD-src-b88e604b92099b837a5cdc8f2a1d36fa3da1aee4.zip FreeBSD-src-b88e604b92099b837a5cdc8f2a1d36fa3da1aee4.tar.gz |
If the mask length is zero, there is no need to convert it to a
netmask.
PR: 31947
Submitted by: Aaron Scarisbrick <aaronsca@hotmail.com>
MFC after: 1 week
Diffstat (limited to 'usr.sbin/syslogd/syslogd.c')
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 249cc8e..b8d5202 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1988,7 +1988,10 @@ allowaddr(s) maskp->s_addr = htonl(IN_CLASSC_NET); } else if (masklen <= 32) { /* convert masklen to netmask */ - maskp->s_addr = htonl(~((1 << (32 - masklen)) - 1)); + if (masklen == 0) + maskp->s_addr = 0; + else + maskp->s_addr = htonl(~((1 << (32 - masklen)) - 1)); } else { freeaddrinfo(res); return -1; |