diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2010-02-28 12:23:13 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2010-02-28 12:23:13 +0000 |
commit | 706e1fcc9ec701869f7bec0d9ebf027fabf40a94 (patch) | |
tree | bf6e654bf00f882624cc8af81663a962d7108aee /usr.sbin/smtpd | |
parent | 2d40560fa0df73ae413184a3b0bf472983efa11f (diff) |
the netmask fix I commited a couple days ago lacked the AF_INET6 bits,
this commit fixes pr user/6328
bug reported and fix verified by Martin Hedenfalk <martinh@bzero.se>
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r-- | usr.sbin/smtpd/ruleset.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/ruleset.c b/usr.sbin/smtpd/ruleset.c index 3c19ba917b7..39f5581f9c2 100644 --- a/usr.sbin/smtpd/ruleset.c +++ b/usr.sbin/smtpd/ruleset.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ruleset.c,v 1.10 2010/02/26 15:06:40 gilles Exp $ */ +/* $OpenBSD: ruleset.c,v 1.11 2010/02/28 12:23:12 gilles Exp $ */ /* * Copyright (c) 2009 Gilles Chehade <gilles@openbsd.org> @@ -171,7 +171,7 @@ ruleset_inet6_match(struct sockaddr_in6 *ss, struct netaddr *ssmask) int i; bzero(&mask, sizeof(mask)); - for (i = 0; i < (128 - ssmask->bits) / 8; i++) + for (i = 0; i < ssmask->bits / 8; i++) mask.s6_addr[i] = 0xff; i = ssmask->bits % 8; if (i) @@ -182,8 +182,9 @@ ruleset_inet6_match(struct sockaddr_in6 *ss, struct netaddr *ssmask) for (i = 0; i < 16; i++) { if ((in->s6_addr[i] & mask.s6_addr[i]) != - inmask->s6_addr[i]) + (inmask->s6_addr[i] & mask.s6_addr[i])) return (0); } + return (1); } |