Rework rule ranges matching. Use comparison rule id with UINT32_MAX to

match all rules with the same rule number.

Obtained from:	Yandex LLC
MFC after:	1 week
Sponsored by:	Yandex LLC
This commit is contained in:
Andrey V. Elsukov 2017-11-23 05:55:53 +00:00
parent c80eef0dc6
commit 288bf455bb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326115

View File

@ -1021,10 +1021,9 @@ delete_range(struct ip_fw_chain *chain, ipfw_range_tlv *rt, int *ndel)
if ((rt->flags & IPFW_RCFLAG_RANGE) != 0) {
start = ipfw_find_rule(chain, rt->start_rule, 0);
end = ipfw_find_rule(chain, rt->end_rule, 0);
if (rt->end_rule != IPFW_DEFAULT_RULE)
while (chain->map[end]->rulenum == rt->end_rule)
end++;
if (rt->end_rule >= IPFW_DEFAULT_RULE)
rt->end_rule = IPFW_DEFAULT_RULE - 1;
end = ipfw_find_rule(chain, rt->end_rule, UINT32_MAX);
}
/* Allocate new map of the same size */
@ -2401,9 +2400,9 @@ dump_config(struct ip_fw_chain *chain, ip_fw3_opheader *op3,
if ((rnum = hdr->start_rule) > IPFW_DEFAULT_RULE)
rnum = IPFW_DEFAULT_RULE;
da.b = ipfw_find_rule(chain, rnum, 0);
rnum = hdr->end_rule;
rnum = (rnum < IPFW_DEFAULT_RULE) ? rnum+1 : IPFW_DEFAULT_RULE;
da.e = ipfw_find_rule(chain, rnum, 0) + 1;
rnum = (hdr->end_rule < IPFW_DEFAULT_RULE) ?
hdr->end_rule + 1: IPFW_DEFAULT_RULE;
da.e = ipfw_find_rule(chain, rnum, UINT32_MAX) + 1;
}
if (hdr->flags & IPFW_CFG_GET_STATIC) {