-
Notifications
You must be signed in to change notification settings - Fork 39
IPSet.Ranges sometimes generates invalid IPRanges #125
Comments
With more debugspam:
Everything works fine until we hit 10.0.0.4. The two starts are ignored (first because it's a remove, second because it's within a remove). Then the first end is treated as a transition from drop->want, which adds a point for 10.0.0.5, and finally the last point adds a range end for 10.0.0.4. One way to fix it would be to have the sorting reverse ordering when want=false, start=false, so that in this test case, the nesting would go:
I think this only matters in cases where an add range and a remove overlap exactly. |
Fixed one set of issues with the change I suggested above, but now hitting other edge conditions I'm still working on. |
The effect is to correctly nest start(want=false),start(want=true), end(want=true),end(want=false) rather than alternating want={true,false}. Corrects part of #125. Signed-off-by: David Anderson <[email protected]>
The main goal was to fix #125 by providing a less tricky implementation of Ranges as a comparison baseline... But this implementation turns out to also be a bit faster and memory efficient. Fixes #125. name old time/op new time/op delta IPSetFuzz-8 16.3µs ± 3% 14.1µs ± 1% -12.99% (p=0.008 n=5+5) name old alloc/op new alloc/op delta IPSetFuzz-8 2.60kB ± 0% 1.95kB ± 0% -25.24% (p=0.008 n=5+5) name old allocs/op new allocs/op delta IPSetFuzz-8 33.0 ± 0% 30.0 ± 0% -9.09% (p=0.008 n=5+5) Signed-off-by: David Anderson <[email protected]>
Ended up reimplementing IPSet.Ranges with an algorithm that (I think) is easier to follow, fixes this bug, and also happens to be a little bit faster. Cleaning up PR for review now. |
The main goal was to fix #125 by providing a less tricky implementation of Ranges as a comparison baseline... But this implementation turns out to also be a bit faster and memory efficient. Fixes #125. name old time/op new time/op delta IPSetFuzz-8 16.3µs ± 3% 14.1µs ± 1% -12.99% (p=0.008 n=5+5) name old alloc/op new alloc/op delta IPSetFuzz-8 2.60kB ± 0% 1.95kB ± 0% -25.24% (p=0.008 n=5+5) name old allocs/op new allocs/op delta IPSetFuzz-8 33.0 ± 0% 30.0 ± 0% -9.09% (p=0.008 n=5+5) Signed-off-by: David Anderson <[email protected]>
The main goal was to fix #125 by providing a less tricky implementation of Ranges as a comparison baseline... But this implementation turns out to also be a bit faster and memory efficient. Fixes #125. name old time/op new time/op delta IPSetFuzz-8 16.3µs ± 3% 14.1µs ± 1% -12.99% (p=0.008 n=5+5) name old alloc/op new alloc/op delta IPSetFuzz-8 2.60kB ± 0% 1.95kB ± 0% -25.24% (p=0.008 n=5+5) name old allocs/op new allocs/op delta IPSetFuzz-8 33.0 ± 0% 30.0 ± 0% -9.09% (p=0.008 n=5+5) Signed-off-by: David Anderson <[email protected]>
The main goal was to fix #125 by providing a less tricky implementation of Ranges as a comparison baseline... But this implementation turns out to also be a bit faster and memory efficient. Fixes #125. name old time/op new time/op delta IPSetFuzz-8 16.3µs ± 3% 14.1µs ± 1% -12.99% (p=0.008 n=5+5) name old alloc/op new alloc/op delta IPSetFuzz-8 2.60kB ± 0% 1.95kB ± 0% -25.24% (p=0.008 n=5+5) name old allocs/op new allocs/op delta IPSetFuzz-8 33.0 ± 0% 30.0 ± 0% -9.09% (p=0.008 n=5+5) Signed-off-by: David Anderson <[email protected]>
The main goal was to fix #125 by providing a less tricky implementation of Ranges as a comparison baseline... But this implementation turns out to also be a bit faster and memory efficient. Fixes #125. name old time/op new time/op delta IPSetFuzz-8 16.3µs ± 3% 14.1µs ± 1% -12.99% (p=0.008 n=5+5) name old alloc/op new alloc/op delta IPSetFuzz-8 2.60kB ± 0% 1.95kB ± 0% -25.24% (p=0.008 n=5+5) name old allocs/op new allocs/op delta IPSetFuzz-8 33.0 ± 0% 30.0 ± 0% -9.09% (p=0.008 n=5+5) Signed-off-by: David Anderson <[email protected]>
The main goal was to fix #125 by providing a less tricky implementation of Ranges as a comparison baseline... But this implementation turns out to also be a bit faster and more memory efficient. Fixes #125. name old time/op new time/op delta IPSetFuzz-8 16.3µs ± 3% 14.1µs ± 1% -12.99% (p=0.008 n=5+5) name old alloc/op new alloc/op delta IPSetFuzz-8 2.60kB ± 0% 1.95kB ± 0% -25.24% (p=0.008 n=5+5) name old allocs/op new allocs/op delta IPSetFuzz-8 33.0 ± 0% 30.0 ± 0% -9.09% (p=0.008 n=5+5) Signed-off-by: David Anderson <[email protected]>
Signed-off-by: David Anderson <[email protected]>
The main goal was to fix #125 by providing a less tricky implementation of Ranges as a comparison baseline... But this implementation turns out to also be a bit faster and more memory efficient. Fixes #125. name old time/op new time/op delta IPSetFuzz-8 16.3µs ± 3% 14.1µs ± 1% -12.99% (p=0.008 n=5+5) name old alloc/op new alloc/op delta IPSetFuzz-8 2.60kB ± 0% 1.95kB ± 0% -25.24% (p=0.008 n=5+5) name old allocs/op new allocs/op delta IPSetFuzz-8 33.0 ± 0% 30.0 ± 0% -9.09% (p=0.008 n=5+5) Signed-off-by: David Anderson <[email protected]>
Signed-off-by: David Anderson <[email protected]>
Signed-off-by: David Anderson <[email protected]>
Found while implementing other functionality and writing tests. PR at #124 adds an assert that trips on the existing single_ips test.
The sort looks reasonable, but post-merge we end up with the invalid range 10.0.0.5-10.0.0.4.
cc @bradfitz
The text was updated successfully, but these errors were encountered: