diff options
author | Florian Westphal <fw@strlen.de> | 2024-01-12 13:32:17 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2024-06-16 13:39:23 +0200 |
commit | b40bebbcee3602e2d849e48f3a50676bd8987204 (patch) | |
tree | df165814b8936a5f8ca09ae3f546ed701346707a /src | |
parent | 48b1f5e88f09eea1632fe7c27dd30b7c370d647f (diff) |
rule: do not crash if to-be-printed flowtable lacks priority
Print an empty flowtable rather than crashing when dereferencing
flowtable->priority.expr (its NULL).
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/rule.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -2107,12 +2107,15 @@ static void flowtable_print_declaration(const struct flowtable *flowtable, if (nft_output_handle(octx)) nft_print(octx, " # handle %" PRIu64, flowtable->handle.handle.id); nft_print(octx, "%s", opts->nl); - nft_print(octx, "%s%shook %s priority %s%s", - opts->tab, opts->tab, - hooknum2str(NFPROTO_NETDEV, flowtable->hook.num), - prio2str(octx, priobuf, sizeof(priobuf), NFPROTO_NETDEV, - flowtable->hook.num, flowtable->priority.expr), - opts->stmt_separator); + + if (flowtable->priority.expr) { + nft_print(octx, "%s%shook %s priority %s%s", + opts->tab, opts->tab, + hooknum2str(NFPROTO_NETDEV, flowtable->hook.num), + prio2str(octx, priobuf, sizeof(priobuf), NFPROTO_NETDEV, + flowtable->hook.num, flowtable->priority.expr), + opts->stmt_separator); + } if (flowtable->dev_array_len > 0) { nft_print(octx, "%s%sdevices = { ", opts->tab, opts->tab); |