diff options
author | Phil Sutter <phil@nwl.cc> | 2021-02-17 12:38:42 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2021-02-17 14:09:14 +0100 |
commit | fb544ce224ab56ef789e926227e47ac537cf9a20 (patch) | |
tree | 7ad945f3912306c0d7350f36013c43b753fd11b7 | |
parent | f1ab88012df9e71dbca30b4acef17d29cba45519 (diff) |
monitor: Don't print newgen message with JSON output
Iff this should be printed, it must adhere to output format settings. In
its current form it breaks JSON syntax, so skip it for non-default
output formats.
Fixes: cb7e02f44d6a6 ("src: enable json echo output when reading native syntax")
Signed-off-by: Phil Sutter <phil@nwl.cc>
-rw-r--r-- | src/monitor.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/monitor.c b/src/monitor.c index af2998d4..047d89db 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -842,6 +842,9 @@ static int netlink_events_newgen_cb(const struct nlmsghdr *nlh, int type, char name[256] = ""; int genid = -1, pid = -1; + if (monh->format != NFTNL_OUTPUT_DEFAULT) + return MNL_CB_OK; + mnl_attr_for_each(attr, nlh, sizeof(struct nfgenmsg)) { switch (mnl_attr_get_type(attr)) { case NFTA_GEN_ID: |