Re: [nft PATCH] tests: shell: Extend get element test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Phil,

On Mon, Oct 22, 2018 at 03:45:09PM +0200, Phil Sutter wrote:
> Despite the recent fixes, the test still fails. While trying to address
> the remaining issues, I found more potentially problematic inputs so
> extend the test by those.

Applied, thanks. More comments, see below.

> ---
> Hi,
> 
> A bit of context illustrating why I think the code needs more than just
> "more fixes": AFAIU, for each input element (which may be part of a
> range or not), code asks the kernel for whether the element exists, then
> get_set_decompose() is called to find the corresponding range. This
> approach has a critical problem though: Given a set with elements 10 and
> 20-30, asking for 10 and 20 will return the same two elements as asking
> for 10-20 does. Though in the first case, we should return 10 and 20-30
> while in the latter case we should return nothing.

With this patch:

https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git/commit/?id=3b18d5eba491b2328b31efa4235724a2354af010

I'm going to send a pull request for David now, I guess you are
missing this kernel fix, so the _END interval flag is included when
searching for the right hand side of a matching interval.

With this kernel patch plus your extended test reports I get this.

# ./run-tests.sh testcases/sets/0034get_element_0 
I: using nft binary ./../../src/nft

W: [FAILED]     testcases/sets/0034get_element_0: expected 0 but got 1
ERROR: asked for '22-24, 26-28', expecting '20-30' but got '20-30, 20-30'

I: results: [OK] 0 [FAILED] 1 [TOTAL] 1

So, before applying your patch, I'm going to mangle it with this patch
below. If we ask for 22-24 and 26-28, the result in 20-30 and 20-30.
The command returns what is the interval container for 22-24 is 20-30,
same thing for 26-28 which is 20-30.

diff --git a/tests/shell/testcases/sets/0034get_element_0
b/tests/shell/testcases/sets/0034get_element_0
index b1f14476d90d..c7e7298a4aac 100755
--- a/tests/shell/testcases/sets/0034get_element_0
+++ b/tests/shell/testcases/sets/0034get_element_0
@@ -27,7 +27,7 @@ check 15-18 ""
 
 # multiple single elements, ranges smaller than present
 check "10, 40" "10, 40"
-check "22-24, 26-28" 20-30
+check "22-24, 26-28" "20-30, 20-30"
 check 21-29 20-30
 
 # mixed single elements and ranges

Thanks!



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux