Skip to content

Commit 23ae0a9

Browse files
author
Alexander V. Buev
committed
fix ipset wrong behavior
Issue description: If local zone directive is assigned as following: "local-zone domain.com ipset" then any answers for query with names such as "anytext1domain.com" or "example2domain.com" will be added to ipset. This commit fixes this issue.
1 parent 4b627bd commit 23ae0a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ipset/ipset.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ ipset_check_zones_for_rrset(struct module_env *env, struct ipset_env *ie,
158158
qs = NULL;
159159
plen = strlen(p->str);
160160

161-
if (dlen >= plen) {
161+
if (dlen == plen || (dlen > plen && dname[dlen - plen - 1] == '.' )) {
162162
ds = dname + (dlen - plen);
163163
}
164-
if (qlen >= plen) {
164+
if (qlen == plen || (qlen > plen && qname[qlen - plen - 1] == '.' )) {
165165
qs = qname + (qlen - plen);
166166
}
167167
if ((ds && strncasecmp(p->str, ds, plen) == 0)

0 commit comments

Comments
 (0)