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:
parent
c80eef0dc6
commit
288bf455bb
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user