diff options
author | Patrick McHardy <kaber@trash.net> | 2015-03-19 13:34:18 +0000 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2015-04-12 19:59:27 +0100 |
commit | 7b5248972d9f2122c7b3683ca205d3165e7a9255 (patch) | |
tree | 619a70e2ddf2d56eae85040f4217705239726e67 /src/expression.c | |
parent | 38a077f7af8a2151b565e3cb324901b48afd299e (diff) |
setelem: add timeout support for set elements
Support specifying per element timeout values and displaying the expiration
time.
If an element should not use the default timeout value of the set, an
element specific value can be specified as follows:
# nft add element filter test { 192.168.0.1, 192.168.0.2 timeout 10m}
For listing of elements that use the default timeout value, just the
expiration time is shown, otherwise the element specific timeout value
is also displayed:
set test {
type ipv4_addr
timeout 1h
elements = { 192.168.0.2 timeout 10m expires 9m59s, 192.168.0.1 expires 59m59s}
}
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/expression.c')
-rw-r--r-- | src/expression.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/expression.c b/src/expression.c index 67893968..2037c607 100644 --- a/src/expression.c +++ b/src/expression.c @@ -889,6 +889,14 @@ struct expr *set_ref_expr_alloc(const struct location *loc, struct set *set) static void set_elem_expr_print(const struct expr *expr) { expr_print(expr->key); + if (expr->timeout) { + printf(" timeout "); + time_print(expr->timeout / 1000); + } + if (expr->expiration) { + printf(" expires "); + time_print(expr->expiration / 1000); + } } static void set_elem_expr_destroy(struct expr *expr) |