Re: [nft PATCH] evaluate: Convert ranges of N-N to N

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

 



Hi Phil,

On Wed, Oct 24, 2018 at 12:42:09PM +0200, Phil Sutter wrote:
> Trying to add a range of size 1 was previously not allowed:
> 
> | # nft add element ip t s '{ 40-40 }'
> | Error: Range has zero or negative size
> | add element ip t s { 40-40 }
> |                      ^^^^^
> 
> The error message is not correct: A range of N-K with K >= N consists of
> K - N + 1 elements (N, N + 1, N + 2, ... K - 1, K). Therefore a range of
> N-N consists of 1 (N - N + 1) elements, namely N.
> 
> Allow this in a simple way by reducing the range into a single element:
> 
> | # nft list set ip t s
> | table ip t {
> | 	set s {
> | 		type inet_service
> | 	}
> | }
> | # nft add element ip t s '{ 40-40 }'
> | # nft list set ip t s
> | table ip t {
> | 	set s {
> | 		type inet_service
> | 		elements = { 40 }
> | 	}
> | }
> | # nft get element ip t s '{ 40-40 }'
> | table ip t {
> | 	set s {
> | 		type inet_service
> | 		flags interval
> | 		elements = { 40 }
> | 	}
> | }

Hm, I would probably just do it if the 'merge' flag is set on.

Arguably, this can be something mistyped by the user. Or dealing with
a silly robot.

So not sure about this one.



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

  Powered by Linux