diff options
author | Andrey V. Elsukov <ae@FreeBSD.org> | 2017-11-23 05:55:53 +0000 |
---|---|---|
committer | Andrey V. Elsukov <ae@FreeBSD.org> | 2017-11-23 05:55:53 +0000 |
commit | 288bf455bb45a8f5f1922efbfb8390ed1b0c3b74 (patch) | |
tree | 83632858da5b2c1c72da5c62a6c44f2408645f20 /sys/netpfil/ipfw | |
parent | c80eef0dc66a1f655bfceb7c7196d6c0858b00ca (diff) | |
download | src-288bf455bb45a8f5f1922efbfb8390ed1b0c3b74.tar.gz src-288bf455bb45a8f5f1922efbfb8390ed1b0c3b74.zip |
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
Notes
Notes:
svn path=/head/; revision=326115
Diffstat (limited to 'sys/netpfil/ipfw')
-rw-r--r-- | sys/netpfil/ipfw/ip_fw_sockopt.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/netpfil/ipfw/ip_fw_sockopt.c b/sys/netpfil/ipfw/ip_fw_sockopt.c index 1270f14f6597..ddaf9bcc5408 100644 --- a/sys/netpfil/ipfw/ip_fw_sockopt.c +++ b/sys/netpfil/ipfw/ip_fw_sockopt.c @@ -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) { |