]> git.ipfire.org Git - thirdparty/nftables.git/commit
segtree: fix decomposition of unclosed intervals
authorPatrick McHardy <kaber@trash.net>
Thu, 16 Jan 2014 17:11:12 +0000 (17:11 +0000)
committerPatrick McHardy <kaber@trash.net>
Thu, 16 Jan 2014 17:11:12 +0000 (17:11 +0000)
commit86b965bdab8dc8735c4a846ec09bfbbadfae780b
tree25869657d21fd59d2c9cf47972f5d1d605a7f14d
parent655fb611aecca135a3f09fe9a4c50ddb2c76a122
segtree: fix decomposition of unclosed intervals

If intervals are directly adjacent or extend to the right end of the dimension,
they are not closed by a EXPR_F_INTERVAL_END entry. This leads to multiple
errors when decomposing the intervals:

- the last unclosed interval is not shown at all.

- if a range is unclosed and the set is a map, the starting point of the
  next interval is set to the data, not the key, leading to nonsensical
  output.

- if a prefix is unclosed, the interval is assumed to be a prefix as well
  and the same starting point is kept. This makes sense for cases like
  192.168.0.0/24, 192.168.0.0/16, but leads to hard to understand
  results if the next interval is not representable as a prefix.

Fix this by doing two things:

- add an EXPR_F_INTERVAL_END element for each unclosed interval during
  preprocessing.

- process the final unclosed interval extending to the right end of the
  dimension, if present.

Signed-off-by: Patrick McHardy <kaber@trash.net>
src/segtree.c